From c2cdf0b95d4c9214646c860609b8c838d6ffa779 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 15 八月 2025 13:42:10 +0800
Subject: [PATCH] AGV,成品库代码更新上传

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPD.cs |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs"
index e5d23d4..5f2809f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPD.cs"
@@ -74,9 +74,10 @@
                     if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite != null)
                     {
                         R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
+                        //鎴愬搧涓�妤煎叆搴撳彛鍐欏叆瀵瑰簲鍏ュ簱绔欏彴鍦板潃
                         if (conveyorLineInfoRead!=null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0)
                         {
-                            Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode == device.DeviceCode);
+                            Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt() && x.DeviceCode == device.DeviceCode);
                             if (task != null)
                             {
                                 //鍒嗛厤宸烽亾 瀛樺叆鎵樼洏鏁版嵁
@@ -102,39 +103,37 @@
                                 task.PalletType = 1;
                                 task.PalletCode = conveyorLineInfoRead.PalletCode;
                                 _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
-                                WriteError(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�");
+                                WriteInfo(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�");
                             }
                         }
                     }
                     else if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && deviceProRead != null)
                     {
                         R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
+                        //鍏ュ簱绔欏彴鍒嗛厤璐т綅鍑嗗鍫嗗灈鍏ュ簱
                         if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0)
                         {
                             Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode);
                             if (task != null)
                             {
                                 //鍒嗛厤璐т綅
-                                string local = "SC03_CP-002-064-001-01";
-                                task.CurrentAddress = item.StackerCraneStationCode;
-                                task.TargetAddress = local;
-                                task.NextAddress = local;
-                                task.DeviceCode = item.StackerCraneCode;
-                                _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute);
-                                WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜鍫嗗灈鏈哄叆搴�");
-                                //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP");
-                                //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt())
-                                //{
-                                //    WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
-                                //    continue;
-                                //}
-
+                                string? local = _taskService.RequestAssignLocation(task.TaskNum, task.Roadway);
+                                if (!string.IsNullOrEmpty(local))
+                                {
+                                    task.CurrentAddress = item.StackerCraneStationCode;
+                                    task.TargetAddress = local;
+                                    task.NextAddress = local;
+                                    task.DeviceCode = item.StackerCraneCode;
+                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute);
+                                    WriteInfo(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜鍫嗗灈鏈哄叆搴�");
+                                }
                             }
                         }
                     }
                     else if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt() && deviceProRead != null && deviceProWrite != null)
                     {
                         R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
+                        //鍑哄簱绔欏彴鍒嗛厤鍑哄簱瀵瑰簲鐩爣鍑哄簱鍙e湴鍧�
                         if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0)
                         {
                             //鑾峰彇鍑哄簱绔欏彴鏄惁瀛樺湪鍑哄簱寰呮墽琛屼换鍔�
@@ -155,7 +154,7 @@
                                 device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode);
                                 device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode);
                                 _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
-                                WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜绾夸綋鍑哄簱");
+                                WriteInfo(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜绾夸綋鍑哄簱");
                             }
                         }
                     }

--
Gitblit v1.9.3