using AngleSharp.Dom;
using log4net.Core;
using Masuit.Tools;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.WMS;
using WIDESEA_Model.Models;
using WIDESEA_StorageBasicRepository;
using WIDESEA_StorageOutOrderRepository;
namespace WIDESEA_StoragIntegrationServices
{
public partial class MESService
{
///
/// MES推送涂装工单
///
///
///
public WebResponseContent pushWorkOrderInfo(object json)
{
WebResponseContent content = new WebResponseContent();
try
{
if (string.IsNullOrEmpty(json.ToString())) throw new Exception("请求参数为空");
Console.WriteLine(json);
var result = JsonConvert.DeserializeObject>(json.ToString());
var paintingOrderInfos = new List();
foreach (var item in result)
{
//var paintingInfo = _paintingOrderInfoRepository.QueryFirst(x => x.workOrderNo == item.workOrderNo && x.workOrderType == item.workOrderType);
//if (null != paintingInfo)
//{
// paintingInfo.pvi = item.pvi;
// paintingInfo.carBodyCharacteristic = item.carBodyCharacteristic;
// paintingInfo.twoToneCharacteristic = item.twoToneCharacteristic;
// paintingInfo.pbMaterial = item.pbMaterial;
// _paintingOrderInfoRepository.UpdateData(paintingInfo);
//}
//else
//{
Dt_PaintingOrderInfo paintingOrderInfo = new Dt_PaintingOrderInfo()
{
biwMaterial = item.biwMaterial,
carBodyCharacteristic = item.carBodyCharacteristic,
config1 = item.config1,
config3 = item.config3,
CreateDate = DateTime.Now,
Creater = "System",
pbMaterial = item.pbMaterial,
plantCode = item.plantCode,
pvi = item.pvi,
sequenceNo = item.sequenceNo,
skylightCharacteristic = item.skylightCharacteristic,
twoToneCharacteristic = item.twoToneCharacteristic,
vehicleCharacteristic = item.vehicleCharacteristic,
workOrderNo = item.workOrderNo,
workOrderSendStatus = item.workOrderSendStatus,
splitStrategy = item.splitStrategy,
workOrderType = item.workOrderType,
workshopCode = item.workshopCode,
};
paintingOrderInfos.Add(paintingOrderInfo);
}
_paintingOrderInfoRepository.AddData(paintingOrderInfos);
//}
LogFactory.GetLog("涂装工单信息").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("涂装工单信息").Info(true, result.ToJsonString());
return content.OK();
}
catch (Exception ex)
{
LogFactory.GetLog("涂装工单信息").Info(true, $"\r\r--------------------------------------");
LogFactory.GetLog("涂装工单信息").Info(true, $"涂装工单接收异常:{ex.Message}");
return content.Error(ex.Message);
}
}
}
}