1
huangxiaoqiang
2026-03-17 3fa25c0bcb790b64bc206211923099cc330c5086
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
{
    /// <summary>
    /// MES同步订单特征至BDC
    /// </summary>
    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<List<SyncOrderFeatureInfo>>(json.ToString());  //List<SyncOrderFeatureInfo>
 
                //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);
            }
        }
    }
}