From b466b3135cd7f3b08f570efda0ffb691daff5270 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 05 十二月 2025 18:15:16 +0800
Subject: [PATCH] 一期输送线代码及AGV请求等

---
 项目代码/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs |   46 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 37 insertions(+), 9 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index 72a97af..6c5807b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using System.Text;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseController;
@@ -71,15 +72,31 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶噞stationManger.StationDeviceCode}");
                 }
-                CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
-                string PickBarCode = commonConveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.R_PickBarCode, stationManger.StationCode).Trim();
-                if (containerFlowDTO.ContainerCode!= PickBarCode) throw new Exception($"浼犲叆鏂欑鐮亄containerFlowDTO.ContainerCode}锛岃緭閫佹枡绠辩爜{PickBarCode}鏁版嵁閿欒");
-                if (containerFlowDTO.Direction=="100")
+                if (stationManger.StationDeviceCode== "CL1" || stationManger.StationDeviceCode == "CL2")
                 {
-                    WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode);
-                    if (!responseContent.Status) throw new Exception(responseContent.Message);
+                    OtherDevice commonConveyorLine = (OtherDevice)device;
+                    byte[] bytesPick = commonConveyorLine.Communicator.Read("12", 5);
+                    string PickBarCode = Encoding.UTF8.GetString(bytesPick).Replace("\0", "").Replace("\\0", "");
+                    if (containerFlowDTO.ContainerCode != PickBarCode) throw new Exception($"浼犲叆鏂欑鐮亄containerFlowDTO.ContainerCode}锛岃緭閫佹枡绠辩爜{PickBarCode}鏁版嵁閿欒");
+                    if (containerFlowDTO.Direction == "100")
+                    {
+                        WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode);
+                        if (!responseContent.Status) throw new Exception(responseContent.Message);
+                    }
+                    commonConveyorLine.Communicator.Write("22", (short)(containerFlowDTO.Direction == "100" ? 256 : 512));
                 }
-                commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode,(short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode);
+                else
+                {
+                    CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device;
+                    string PickBarCode = commonConveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.R_PickBarCode, stationManger.StationCode).Trim();
+                    if (containerFlowDTO.ContainerCode != PickBarCode) throw new Exception($"浼犲叆鏂欑鐮亄containerFlowDTO.ContainerCode}锛岃緭閫佹枡绠辩爜{PickBarCode}鏁版嵁閿欒");
+                    if (containerFlowDTO.Direction == "100")
+                    {
+                        WebResponseContent responseContent = Service.ContainerFlow(containerFlowDTO, stationManger.StationDeviceCode);
+                        if (!responseContent.Status) throw new Exception(responseContent.Message);
+                    }
+                    commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode, (short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode);
+                }
                 content.OK();
             }
             catch (Exception ex)
@@ -107,10 +124,21 @@
         /// </summary>
         /// <param name="taskNum"></param>
         /// <returns></returns>
-        [HttpPost, HttpGet, Route("RecWMSTaskCompleted"), AllowAnonymous]
-        public WebResponseContent RecWMSTaskCompleted(int taskNum)
+        [HttpPost, HttpGet, Route("RecTaskCompleted"), AllowAnonymous]
+        public WebResponseContent RecTaskCompleted(int taskNum)
         {
             return Service.TaskCompleted(taskNum);
         }
+
+        /// <summary>
+        /// WMS浠诲姟鍙栨秷鍚屾
+        /// </summary>
+        /// <param name="taskNum"></param>
+        /// <returns></returns>
+        [HttpPost, HttpGet, Route("CancelTask"), AllowAnonymous]
+        public WebResponseContent CancelTask(List<TaskCancel> taskCancels)
+        {
+            return WebResponseContent.Instance.Error();
+        }
     }
 }

--
Gitblit v1.9.3