From ad18b0c17b5b1f715c33cb2a2b39589c10434a00 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 09 十一月 2024 13:24:48 +0800
Subject: [PATCH] 11.09-1申请巷道与申请货位拆分

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 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..78f336f 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>
         /// 澶勭悊鍑哄簱浠诲姟
@@ -43,7 +44,7 @@
                 // 鏇存柊浠诲姟鐘舵��
                 _taskService.UpdateTaskStatusToNext(taskOut);
             }
-            else if (taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+            else if (taskOut.TaskType == (int)TaskOutboundTypeEnum.OutTray && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
             {
                 // 瀹屾垚WMS浠诲姟
                 CompleteWmsTask(taskOut, command, conveyorLine, childDeviceCode, ProtocalDetailValue);
@@ -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"))
@@ -95,7 +97,11 @@
             }
 
             // TODO璋冪敤WMS浠诲姟瀹屾垚鎺ュ彛
-            var result = HttpHelper.GetAsync("http://127.0.0.1:8098/api/Task/CompleteTaskAsync", new { taskNum = taskOut.TaskNum }.ToJsonString()).Result;
+            var keys = new Dictionary<string, object>()
+                {
+                    {"taskNum", taskOut.TaskNum}
+                };
+            var result = HttpHelper.GetAsync($"http://127.0.0.1:5000/api/Task/CompleteTaskAsync", keys).Result;
             WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
             if (content.Status)
             {
@@ -109,7 +115,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")
             {
@@ -141,19 +147,25 @@
         /// </summary>
         private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode)
         {
-            // 鍒涘缓骞惰繑鍥炵┖鎵樼洏浠诲姟DTO
-            return new WMSTaskDTO
+            #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:5000/api/Task/RequestTrayInTaskAsync", request.ToJsonString()).Result;
+            if (result == null)
+                return wMSTaskDTO;
+
+            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            // 妫�鏌ョ姸鎬佸苟杩斿洖
+            if (!content.Status)
+                return wMSTaskDTO;
+
+            return JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+
+            #endregion 鍚慦MS璇锋眰绌烘墭鐩樹换鍔�
         }
 
         /// <summary>
@@ -165,7 +177,7 @@
             if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
             {
                 // 鏌ヨ浠诲姟
-                Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                Dt_Task task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
                 if (task != null)
                 {
                     // 鏄犲皠浠诲姟鍛戒护
@@ -180,4 +192,4 @@
             }
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3