From c9982eb3dd76696b8a3851cc6411a71c402d042f Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期三, 06 十一月 2024 20:04:41 +0800 Subject: [PATCH] 11.06 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs | 54 ++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 38 insertions(+), 16 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs index f7f6183..b904bad 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs @@ -13,10 +13,11 @@ using WIDESEAWCS_Tasks.ConveyorLineJob; using HslCommunication; using OfficeOpenXml.ConditionalFormatting; +using WIDESEAWCS_DTO.WMS; namespace WIDESEAWCS_Tasks { - partial class CommonConveyorLineJob + public partial class CommonConveyorLineJob { /// <summary> /// 澶勭悊鍑哄簱浠诲姟 @@ -34,7 +35,7 @@ bool isOutboundAndOutFinish = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.SC_OutFinish; bool isOutboundAndLineOutExecuting = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting; - if (isOutTray || isOutboundAndOutFinish || isOutboundAndLineOutExecuting) + if (isOutTray || isOutboundAndOutFinish || !isOutboundAndLineOutExecuting) { // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎 conveyorLine.SendCommand(taskCommand, childDeviceCode); @@ -56,13 +57,14 @@ private void HandleNewTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) { // 鐗瑰畾鏉′欢涓嬪垱寤哄苟鍙戦�佺┖鎵樼洏鍏ュ簱浠诲姟 - if (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") + if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048")) { + // 璇锋眰WMS绌烘墭鐩樹换鍔� CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); } - else if (conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") + else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088")||(conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339")) { - // 璇锋眰WMS浠诲姟 + // 璇锋眰WMS鍏ュ簱浠诲姟 RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); } else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1073") || (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1002")) @@ -109,7 +111,7 @@ /// <summary> /// 鍒涘缓骞跺彂閫佺┖鎵樼洏浠诲姟 /// </summary> - private void CreateAndSendEmptyTrayTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) + public void CreateAndSendEmptyTrayTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) { if (command.Barcode != "NoRead") { @@ -142,18 +144,38 @@ private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode) { // 鍒涘缓骞惰繑鍥炵┖鎵樼洏浠诲姟DTO - return new WMSTaskDTO + //return new WMSTaskDTO + //{ + // TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), + // Grade = 1, + // PalletCode = barcode, + // RoadWay = "JZSC01", + // SourceAddress = childDeviceCode, + // TargetAddress = "JZSC01", + // TaskState = (int)TaskInStatusEnum.InNew, + // Id = 0, + // TaskType = (int)TaskInboundTypeEnum.InTray, + //}; + + #region 鍚慦MS璇锋眰绌烘墭鐩樹换鍔� + + WMSTaskDTO wMSTaskDTO = new WMSTaskDTO(); + RequestTaskDto request = new RequestTaskDto() { - TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), - Grade = 1, + Position = childDeviceCode, PalletCode = barcode, - RoadWay = "CHSC01", - SourceAddress = childDeviceCode, - TargetAddress = "CHSC01", - TaskState = (int)TaskInStatusEnum.InNew, - Id = 0, - TaskType = (int)TaskInboundTypeEnum.InTray, }; + var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result; + + WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); + + // 妫�鏌ョ姸鎬佸苟杩斿洖 + if (!content.Status) + return wMSTaskDTO; + + return JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); + + #endregion 鍚慦MS璇锋眰绌烘墭鐩樹换鍔� } /// <summary> @@ -180,4 +202,4 @@ } } } -} +} \ No newline at end of file -- Gitblit v1.9.3