From a34059e688e947a2ea079a0646872f1a21089940 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 22 九月 2025 14:47:00 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   82 ++++++++++++++++++++++++-----------------
 1 files changed, 48 insertions(+), 34 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index a10955a..e0a7884 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -24,6 +24,7 @@
 using Newtonsoft.Json;
 using Quartz;
 using SqlSugar;
+using System.Net;
 using System.Reflection;
 using System.Threading.Tasks;
 using WIDESEAWCS_BasicInfoRepository;
@@ -43,6 +44,7 @@
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_SignalR;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
+using WIDESEAWCS_Tasks.StackerCraneJob;
 using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
 
 namespace WIDESEAWCS_Tasks
@@ -295,9 +297,15 @@
                 conveyorLine.SetValue(ConveyorLineDBName.WheelsDiameter, task.wheels_gkcc, stationInfo.stationChildCode);
                 conveyorLine.SetValue(ConveyorLineDBName.WheelsLX, task.WheelsLX, stationInfo.stationChildCode);
 
-                conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
-
-                _taskService.UpdatePosition(task.TaskNum, stationInfo.stationChildCode);
+                Dt_Task dt_Task = _taskService.UpdatePosition(task.TaskNum, stationInfo.stationChildCode);
+                if (dt_Task != null)
+                {
+                    conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
+                }
+                else
+                {
+                    conveyorLine.SetValue(ConveyorLineDBName.ResponState, 3, stationInfo.stationChildCode);
+                }
             }
         }
 
@@ -341,46 +349,53 @@
             var task = _taskService.QueryExecutingTaskByBarcode(command.Number, stationInfo.stationChildCode);
             if (task != null)
             {
-                //鏍规嵁杞﹁酱缂撳瓨浣嶇疆 鍐欏叆瀵瑰簲鐩爣鍦板潃
-                if (task.TargetAddress == stationInfo.stationChildCode)
+                if (task.TargetAddress == "2032" || task.TargetAddress == "2042")
                 {
-                    //WebResponseContent content = _taskService.RequestWheelsFlow(task.task_CZInfo).Result;
-                    WebResponseContent content = _taskService.RequestWheelsFlow(task.PalletCode).Result;
-                    if (content.Status)
-                    {
-                        string taraddress = content.Data.ToString(); // "2032";SourceAddress
 
-                        bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode);
-                        
-                        bool k2= conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taraddress, stationInfo.stationChildCode);
-                        bool k3= conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
-                        WebResponseContent k4 = _taskService.UpdateTaskStatusToNext(task);
+                    bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode);
 
-                        Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},浠诲姟淇敼鐘舵�侊細{k4.Status}锛�)");
-                    }
-                    else
-                    {
-                        conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode);
-
-                        Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽悜WMS鐢宠鍘诲悜澶辫触锛屽師鍥狅細{content.Message},鍐欏叆鐢宠瘔淇℃晠闅滐細2");
-                    }
-                }
-                else
-                {
-                    bool k1= conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode);
                     bool k2 = conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.TargetAddress, stationInfo.stationChildCode);
                     bool k3 = conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
                     WebResponseContent k4 = _taskService.UpdateTaskStatusToNext(task);
 
-                    Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},浠诲姟淇敼鐘舵�侊細{k4.Status}锛�)");
+                    Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},浠诲姟淇敼鐘舵�侊細{k4.Status},,鍐欏叆鍘诲悜锛歿task.TargetAddress}锛�)");
+
                 }
+                else
+                {
+                    if (task.Towhereabouts == "2032" || task.Towhereabouts == "2042")
+                    {
+                        bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode);
+
+                        bool k2 = conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.Towhereabouts, stationInfo.stationChildCode);
+                        bool k3 = conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
+                        WebResponseContent k4 = _taskService.UpdateTaskStatusToNext(task);
+
+                        Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},浠诲姟淇敼鐘舵�侊細{k4.Status},,鍐欏叆鍘诲悜锛歿task.Towhereabouts}锛�)");
+                    }  
+                }
+
             }
             else
             {
-                conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode);
-                Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屾湭鎵惧埌,鍐欏叆鐢宠瘔淇℃晠闅滐細2");
+
+                string taraddresspos = _taskService.RequestWheletHty(command.Number);
+                if (taraddresspos != null)
+                {
+
+                    bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode);
+
+                    bool k2 = conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taraddresspos, stationInfo.stationChildCode);
+                    bool k3 = conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
+
+                    Console.Out.WriteLine($"鍘嗗彶鏌ヨ淇℃伅锛�,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},鍐欏叆鐩爣鍦板潃涓猴細{taraddresspos})");
+                }
+                else
+                {
+                    conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode);
+                    Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屾湭鎵惧埌浠诲姟锛岀敵璇蜂笅涓�鍦板潃涓猴細{stationInfo.stationChildCode},鍐欏叆鐢宠瘔淇℃晠闅滐細2");
+                }
             }
-            //_taskService.UpdatePosition(task.TaskNum, stationInfo.stationChildCode);
         }
 
         #region 杞﹁酱绾夸氦浜�
@@ -397,7 +412,7 @@
             if (content.Status)
             {
                 conveyorLine.SetValue(ConveyorLineDBName.Number, content.Data.ToString(), stationInfo.stationChildCode);
-                conveyorLine.SetValue(ConveyorLineDBName.CarType,"001", stationInfo.stationChildCode);
+                conveyorLine.SetValue(ConveyorLineDBName.CarType, "001", stationInfo.stationChildCode);
                 conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode);
             }
             else
@@ -415,7 +430,6 @@
         /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
         public void RequestTakeCZ(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationInfo)
         {
-
             WebResponseContent content = _taskService.UpdateAxleCurrentStatue(command.Number);
             if (content.Status)
             {
@@ -442,7 +456,7 @@
         {
             DeviceProDTO? deviceProDTOt = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == "3022" && x.DeviceProParamName == "Number");
             string Number = conveyorLine.Communicator.Read<string>(deviceProDTOt.DeviceProAddress);
-            if (Number != "" && Number!=null)
+            if (Number != "" && Number != null)
             {
                 //璋冨彇wms鎺ュ彛鐢宠agv浠诲姟
                 WebResponseContent content = _taskService.GetAGVTaskdistribution(stationInfo.stationLocation);

--
Gitblit v1.9.3