using Newtonsoft.Json;
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Common.MES;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Enums;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Model.Models;
namespace WIDESEA_StoragIntegrationServices
{
///
/// 预绑定
///
public partial class MESService
{
public WebResponseContent prebind(object json)
{
WebResponseContent content = new WebResponseContent();
try
{
if (string.IsNullOrEmpty(json.ToString())) throw new Exception("请求参数为空");
var result = JsonConvert.DeserializeObject(json.ToString());
var palletStockInfo = _palletStockInfoRepository.QueryFirst(x => x.PVI == result.pvi);
if (palletStockInfo == null) throw new Exception($"未找到{result.pvi}车身库存信息,无法预绑定");
palletStockInfo.StockStatus = StockStateEmun.预绑定.ObjToInt();
palletStockInfo.OrderID = result.preWorkOrderNo;
//palletStockInfo.
_palletStockInfoRepository.UpdateData(palletStockInfo);
//todo:工单为集合时处理
return content.OK();
}
catch (Exception ex)
{
return content.Error(ex.Message);
}
}
}
}