hudong
5 天以前 3a3c5f5711a57439f34e772313fcbb18ba7885bc
api/WmsSapController.cs
@@ -206,7 +206,7 @@
        {
            #region xml数据接收转数组
            LogHelper.Info("供应商接收接口:" + JsonConvert.SerializeObject(xmlData));
            //LogHelper.Info("供应商接收接口:" + JsonConvert.SerializeObject(xmlData));
            ////接收xml数据
            //XmlDocument xmlDoc = new XmlDocument();
@@ -250,7 +250,7 @@
        {
            #region xml数据接收转数组
            LogHelper.Info("生产订单接收接口:" + JsonConvert.SerializeObject(xmlData));
            //LogHelper.Info("生产订单接收接口:" + JsonConvert.SerializeObject(xmlData));
            ////接收xml数据
            //XmlDocument xmlDoc = new XmlDocument();
@@ -291,37 +291,11 @@
        [HttpPost]
        public WLReturnRoot.Root MaterReceiveXmlData([FromBody] MaterDto.Root xmlData)
        {
            #region xml数据接收转数组
            LogHelper.Info("物料接收接口:" + JsonConvert.SerializeObject(xmlData));
            ////接收xml数据
            //XmlDocument xmlDoc = new XmlDocument();
            //xmlDoc.LoadXml(xmlData.ToString());
            //// 将 XmlDocument 转换为 JSON 字符串
            //JObject jsonObject = JsonConvert.DeserializeObject<JObject>(JsonConvert.SerializeXmlNode(xmlDoc));
            //// 处理特定字段,强制转换为数组
            //WmsSpaHelper.EnsureArrayFormats(jsonObject, "ITEM");
            //// 反序列化为RootWithArray
            //var data = JsonConvert.DeserializeObject<MaterDto.Root>(jsonObject.ToString());
            #endregion
            #region 外采入库业务流程
            WLReturnRoot.Root simpleResult = WmsSpaHelper.Mater_In(xmlData);
            //接收返回参数 生成sap对接文档返回格式
            //var json = WmsSpaHelper.GetJsonResult(simpleResult.WLPZBH, simpleResult.resultCode.ToString(), simpleResult.resultMsg);
            //#endregion
            //#region  返回xml
            //string xml = JsonConvert.DeserializeXmlNode(json, "root").OuterXml;
            ////返回json
            //var response = new HttpResponseMessage()
            //{
            //    Content = new StringContent(xml, Encoding.UTF8, "application/xml")
            //};
            //return response;
            var json = JsonConvert.SerializeObject(simpleResult);
            return simpleResult;
@@ -338,7 +312,7 @@
        public WcReturnRoot.Root WCReceiveXmlData([FromBody] SapRoot.Root xmlData)
        {
            #region xml数据接收转数组
            LogHelper.Info("外采收货接口:" + JsonConvert.SerializeObject(xmlData));
            //LogHelper.Info("外采收货接口:" + JsonConvert.SerializeObject(xmlData));
            //接收xml数据
            //XmlDocument xmlDoc = new XmlDocument();
            //xmlDoc.LoadXml(xmlData.ToString());
@@ -401,7 +375,7 @@
            //NcDto.ROOT rOOT = new NcDto.ROOT();
            //rOOT.WLPZ = new NcDto.WLPZ();
            LogHelper.Info("内采收货接口:" + JsonConvert.SerializeObject(xmlData));
            //LogHelper.Info("内采收货接口:" + JsonConvert.SerializeObject(xmlData));
            ////接收xmloo
            //XmlDocument xmlDoc = new XmlDocument();
@@ -465,35 +439,12 @@
        [HttpPost]
        public OtherReturnRoot.Root OtherReceiveXmlData([FromBody] otherDto.Root xmlData)
        {
            #region xml数据接收转数组
            LogHelper.Info("其他出入库sap接口:" + JsonConvert.SerializeObject(xmlData));
            ////接收xml数据
            //XmlDocument xmlDoc = new XmlDocument();
            //xmlDoc.LoadXml(xmlData.ToString());
            //// 将 XmlDocument 转换为 JSON 字符串
            //JObject jsonObject = JsonConvert.DeserializeObject<JObject>(JsonConvert.SerializeXmlNode(xmlDoc));
            //// 处理特定字段,强制转换为数组
            //WmsSpaHelper.EnsureArrayFormat(jsonObject, "ITEM", "ITEM1");
            //// 反序列化为RootWithArray
            //var data = JsonConvert.DeserializeObject<otherDto.Root>(jsonObject.ToString());
            #endregion
            #region 其他出入库业务流程
            List<SimpleResult> simpleResult = WmsSpaHelper.Otherbound_Order_In(xmlData);
            //接收返回参数 生成sap对接文档返回格式
            //var json = WmsSpaHelper.GetJsonResult(simpleResult.WLPZBH, simpleResult.resultCode.ToString(), simpleResult.resultMsg);
            #endregion
            #region  返回xml
            //string xml = JsonConvert.DeserializeXmlNode(json, "ROOT").OuterXml;
            ////返回json
            //var response = new HttpResponseMessage()
            //{
            //    Content = new StringContent(xml, Encoding.UTF8, "application/xml")
            //};
            //return response;
            #endregion
            List<OtherReturnRoot.ITEM> wcReturnRoots = new List<OtherReturnRoot.ITEM>();
            foreach (var item in simpleResult)
@@ -505,8 +456,6 @@
                wcReturnRoot.MSGDESP = item.resultMsg;
                wcReturnRoots.Add(wcReturnRoot);
            }
            //var json = WmsSpaHelper.GetJsonResult(simpleResult.WLPZBH, simpleResult.resultCode.ToString(), simpleResult.resultMsg);
            // 完整嵌套实例化
            var result = new OtherReturnRoot.Root
            {
                ROOT = new OtherReturnRoot.ROOT
@@ -534,6 +483,17 @@
        }
        /// <summary>
        /// pda分拣完整版
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<SimpleResult> AllOutboundOrderSorting(FJSorting model)
        {
            return WmsSpaHelper.ALLOutboundOrderSorting(model);
        }
        /// <summary>
        /// pda分拣
        /// </summary>
        /// <param name="model"></param>
@@ -543,7 +503,16 @@
        {
            return WmsSpaHelper.OutboundOrderSorting(model);
        }
        /// <summary>
        /// 回库
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<SimpleResult> HkGet(HuiK model)
        {
            return WmsSpaHelper.HkGets(model);
        }
        /// <summary>
        /// 空托出入库
        /// </summary>
@@ -613,47 +582,23 @@
        [HttpPost]
        public LLDReturnRoot.Root LLDReceiveXmlData([FromBody] CKDdto.Root xmlData)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            //Stopwatch sw = new Stopwatch();
            //sw.Start();
            #region xml数据接收转数组
            LogHelper.Info("生产订单领料单(生成领料单)接口:" + JsonConvert.SerializeObject(xmlData));
            //LogHelper.Info("生产订单领料单(生成领料单)接口:" + JsonConvert.SerializeObject(xmlData));
            ////接收xml数据
            //XmlDocument xmlDoc = new XmlDocument();
            //xmlDoc.LoadXml(xmlData.ToString());
            //// 将 XmlDocument 转换为 JSON 字符串
            //JObject jsonObject = JsonConvert.DeserializeObject<JObject>(JsonConvert.SerializeXmlNode(xmlDoc));
            //// 处理特定字段,强制转换为数组
            ////WmsSpaHelper.EnsureArrayFormat(jsonObject, "ITME");
            //WmsSpaHelper.EnsureArrayFormat(jsonObject["ROOT"]["SCDDLL"] as JObject, "ITEM");
            //// 反序列化为RootWithArray
            //var data = JsonConvert.DeserializeObject<CKDdto.Root>(jsonObject.ToString());
            #endregion
            #region 出库业务流程
            LLDReturnRoot.Root json = WmsSpaHelper.Out_Order_Ins(xmlData);
            return WmsSpaHelper.Out_Order_Ins(xmlData);
            //接收返回参数 生成sap对接文档返回格式
            //var json = WmsSpaHelper.GetJsonResult(simpleResult.WLPZBH, simpleResult.resultCode.ToString(), simpleResult.resultMsg);
            //接收返回参数 生成sap对接文档返回格式
            List<WcReturnRoot.ITEM> wcReturnRoots = new List<WcReturnRoot.ITEM>();
            sw.Stop();
            long elapsedMilliseconds = sw.ElapsedMilliseconds;
            return json;
            //sw.Stop();
            //long elapsedMilliseconds = sw.ElapsedMilliseconds;
            //LogHelper.Info("生产订单领料单(生成领料单)返回时长:" + elapsedMilliseconds);
            #endregion
            //#region  返回xml
            //string xml = JsonConvert.DeserializeXmlNode(json, "root").OuterXml;
            ////返回json
            //var response = new HttpResponseMessage()
            //{
            //    Content = new StringContent(xml, Encoding.UTF8, "application/xml")
            //};
            //return response;
            //#endregion
        }
        /// <summary>
@@ -667,7 +612,7 @@
        {
            var json = WmsSpaHelper.Out_Order_Inss(dto.S_NO);
            var json = WmsSpaHelper.Out_Order_Inss(dto.S_NO,dto.N_PRIORITY);
            return json;