From b31d961a3f0bcd2e555ea12b76c30c453826deba Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 28 七月 2025 09:42:58 +0800
Subject: [PATCH] 代码提交

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs |   66 ++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 17 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs"
index a3b4d9c..478a196 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs"
@@ -28,7 +28,9 @@
                 case 1:
                     await RequestTask(conveyorLine, command, childDeviceCode, stationManager);
                     break;
-
+                case 9:
+                    RequestWMSTask(conveyorLine, stationManager);
+                    break;
                 case 2:
                 case 3:
                     RequestNextAddress(command, conveyorLine, stationManager, task);
@@ -48,13 +50,13 @@
 
         private async Task RequestTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, Dt_StationManager stationManager)
         {
-            var hasTask = await _taskRepository.QueryFirstAsync(x => x.SourceAddress == childDeviceCode);
+            var hasTask = await _taskRepository.QueryFirstAsync(x => x.SourceAddress == childDeviceCode && x.TaskState < (int)TaskInStatusEnum.RGV_InExecutingFinish && x.TaskState >= (int)TaskInStatusEnum.InNew);
             if (hasTask != null)
             {
                 var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵hasTask.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵hasTask.PalletCode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎瀛樺湪浠诲姟";
                 ConsoleHelper.WriteWarningLine(log);
 
-               await _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
+                await _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
                 WriteInfo(conveyorLine.DeviceName, log);
                 return;
             }
@@ -91,21 +93,51 @@
             {
                 RGVName = "RGV03";
             }
-
-
-                Dt_Task task = new Dt_Task()
-                {
-                    TaskNum = _taskRepository.GetTaskNo().Result,
-                    TaskType = (int)TaskInboundTypeEnum.Inbound,
-                    TaskState = (int)TaskInStatusEnum.InNew,
-                    SourceAddress = childDeviceCode,
-                    Dispatchertime = DateTime.Now,
-                    Grade = 1, // 璁剧疆榛樿浼樺厛绾т负1
-                    Creater = "System",
-                    Floor = stationManager.stationFloor,
-                    RGVName = stationManager.RGVName != null ? stationManager.RGVName : RGVName,
-                };
+            Dt_Task task = new Dt_Task()
+            {
+                TaskNum = _taskRepository.GetTaskNo().Result,
+                TaskType = (int)TaskInboundTypeEnum.Inbound,
+                TaskState = (int)TaskInStatusEnum.InNew,
+                SourceAddress = childDeviceCode,
+                Dispatchertime = DateTime.Now,
+                Grade = 1, // 璁剧疆榛樿浼樺厛绾т负1
+                Creater = "System",
+                Floor = stationManager.stationFloor,
+                RGVName = stationManager.RGVName != null ? stationManager.RGVName : RGVName,
+            };
             _taskRepository.AddData(task);
         }
+        private void RequestWMSTask(CommonConveyorLine conveyorLine,  Dt_StationManager stationManager)
+        {
+            var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationNextChildCode);
+
+            if (Barcode == "")
+            {
+                conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal,Convert.ToSByte(3), stationManager.stationChildCode);
+            }
+            var task = _taskRepository.QueryFirst(x => x.PalletCode == Barcode);
+            if (task != null)
+            {
+
+            }
+            else
+            {
+                //var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                //var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+                //var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue;
+                //var keys = new Dictionary<string, object>()
+                //{
+                //    {"TPbarcode", Barcode},
+                //    {"WhCode", "1001"},
+                //    {"BeginPoint", stationManager.stationChildCode}
+                //};
+                //if (wmsBase == null || requestTask == null)
+                //{
+                //    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                //}
+                //var wmsIpAddress = wmsBase + requestTask;
+                //var result = WIDESEA_Comm.Http.HttpHelper.PostAsync(wmsIpAddress, keys.ToString()).Result;
+            }
+        }
     }
 }

--
Gitblit v1.9.3