From 27428ddcd208e10c15adead9d6b48d6843b0a0b6 Mon Sep 17 00:00:00 2001 From: xiaoyang <xiaoyang@hnkhzn.com> Date: 星期四, 07 十一月 2024 16:15:36 +0800 Subject: [PATCH] MOM对接代码更改 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs | 111 +++++++++++++++++++++++++++---------------------------- 1 files changed, 54 insertions(+), 57 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs index f5b3c70..1459cc2 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs @@ -1,13 +1,10 @@ 锘縰sing LogLibrary.Log; using Masuit.Tools; -using Newtonsoft.Json; using WIDESEA_Common; using WIDESEA_Core; using WIDESEA_DTO; -using WIDESEA_DTO.MOM; using WIDESEA_IStorageBasicService; using WIDESEA_IStoragIntegrationServices; -using WIDESEA_Model.Models; namespace WIDESEA_StoragIntegrationServices; @@ -33,40 +30,42 @@ try { input.SessionId = Guid.NewGuid().ToString(); - input.Software = "闄堝寲鏈�"; - input.EquipmentCode = "P1K10040"; input.EmployeeNo = "T00001"; input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); var inputJson = input.ToDictionary(); var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/CellState", inputJson); - if (x != null) - { - ResultCellState result = JsonConvert.DeserializeObject<ResultCellState>(x); - DtBoxingInfo boxingInfo = new DtBoxingInfo() - { - IsFull = true, - PalletCode = "", - }; - var details = new List<DtBoxingInfoDetail>(); - foreach (var item in result.SerialNos) - { - DtBoxingInfoDetail detail = new DtBoxingInfoDetail() - { - SerialNumber = item.SerialNo, - OrderNo = item.BindCode, - Status = item.SerialNoStatus, - }; - details.Add(detail); - } - boxingInfo.BoxingInfoDetails = details; - var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo); - if (abc.Status) - return content.OK("缁勭洏鎴愬姛"); - else - return content.Error("缁勭洏澶辫触"); - } + #region + //if (x != null) + //{ + // ResultCellState result = JsonConvert.DeserializeObject<ResultCellState>(x); + // DtBoxingInfo boxingInfo = new DtBoxingInfo() + // { + // IsFull = true, + // PalletCode = "", + // }; + // var details = new List<DtBoxingInfoDetail>(); + // foreach (var item in result.SerialNos) + // { + // DtBoxingInfoDetail detail = new DtBoxingInfoDetail() + // { + // SerialNumber = item.SerialNo, + // OrderNo = item.BindCode, + // Status = item.SerialNoStatus, + // }; + // details.Add(detail); + // } + // boxingInfo.BoxingInfoDetails = details; + // var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo); + // if (abc.Status) + // return content.OK("缁勭洏鎴愬姛"); + // else + // return content.Error("缁勭洏澶辫触"); + //} + #endregion + LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, x); + return x; } catch (Exception err) { @@ -88,38 +87,36 @@ try { input.SessionId = Guid.NewGuid().ToString(); - input.Software = "闄堝寲鏈�"; - input.EquipmentCode = "P1K10040"; input.EmployeeNo = "T00001"; input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); var inputJson = input.ToDictionary(); var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/TrayCellsStatus", inputJson); if (x != null) { - ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x); - DtBoxingInfo boxingInfo = new DtBoxingInfo() - { - IsFull = true, - PalletCode = "", - }; - var details = new List<DtBoxingInfoDetail>(); - foreach (var item in result.SerialNos) - { - DtBoxingInfoDetail detail = new DtBoxingInfoDetail() - { - SerialNumber = item.SerialNo, - OrderNo = result.BindCode, - Status = item.SerialNoStatus, - BatchNo = item.PositionNo.ToString() - }; - details.Add(detail); - } - boxingInfo.BoxingInfoDetails = details; - var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo); - if (abc.Status) - content.OK("缁勭洏鎴愬姛", result); - else - content.Error("缁勭洏澶辫触"); + // 鍙嶅簭鍒楀寲ResultTrayCellsStatus瀵硅薄 + //ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x); + + //// 鍒涘缓DtBoxingInfo瀵硅薄 + //DtBoxingInfo boxingInfo = new DtBoxingInfo + //{ + // IsFull = true, + // PalletCode = result.TrayBarcode, + //}; + + //// 浣跨敤LINQ鍒涘缓DtBoxingInfoDetail瀵硅薄鍒楄〃 + //var details = result.SerialNos.Select(item => new DtBoxingInfoDetail + //{ + // SerialNumber = item.SerialNo, + // OrderNo = item.PositionNo.ToString(), + // Status = item.SerialNoStatus, + // Remark = result.TrayBarcodePropertys.ToJsonString(), + // MaterielCode = result.BindCode, + //}).ToList(); + + //// 璧嬪�糄tBoxingInfoDetails + //boxingInfo.BoxingInfoDetails = details; + //var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo); + content.OK("缁勭洏鎴愬姛", x); } LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, x); -- Gitblit v1.9.3