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.MES; using WIDESEA_Core; namespace WIDESEA_StoragIntegrationServices { /// /// MES同步订单特征至BDC /// public partial class MESService { public WebResponseContent syncOrderFeature(object json) { WebResponseContent content = new WebResponseContent(); try { if (string.IsNullOrEmpty(json.ToString())) throw new Exception("请求参数为空"); Console.WriteLine(json); var result = JsonConvert.DeserializeObject>(json.ToString()); //List //todo 修改对应数据 foreach (var item in result) { if (string.IsNullOrEmpty(item.workOrderNo)) throw new Exception($"未知工单号{item.workOrderNo}"); var info = _assemblyOrderInfoRepository.QueryFirst(x => x.workOrderNo == item.workOrderNo); if (info == null) throw new Exception($"未知工单号{item.workOrderNo}"); } 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); } } } }