From e719f3e5d5d16ee8a9dece97d9889610507628ac Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 18 八月 2025 08:15:27 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPD.cs |   42 ++++++++++++++++++++++++++++++++----------
 1 files changed, 32 insertions(+), 10 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 8e9bc17..d36d9ec 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"
@@ -77,7 +77,7 @@
                         //鎴愬搧涓�妤煎叆搴撳彛鍐欏叆瀵瑰簲鍏ュ簱绔欏彴鍦板潃
                         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)
                             {
                                 //鍒嗛厤宸烽亾 瀛樺叆鎵樼洏鏁版嵁
@@ -100,9 +100,28 @@
                                 //鏇存柊浠诲姟淇℃伅
                                 task.CurrentAddress = item.StationCode;
                                 task.NextAddress = router.NextPosi;
-                                task.PalletType = 1;
-                                task.PalletCode = conveyorLineInfoRead.PalletCode;
                                 _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
+                                WriteInfo(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�");
+                            }
+                        }
+                        else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0)
+                        {
+                            Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum== conveyorLineInfoRead.TaskNo &&  x.NextAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode == device.DeviceCode);
+                            if (task != null)
+                            {
+                                //鍒嗛厤宸烽亾 瀛樺叆鎵樼洏鏁版嵁
+                                List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.NextAddress == x.StartPosi);
+                                Dt_Router router = routers.FirstOrDefault();
+                                if (router == null)
+                                {
+                                    WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}鏈壘鍒拌矾鐢遍厤缃俊鎭�");
+                                    return Task.CompletedTask;
+                                }
+                                //鏇存柊浠诲姟淇℃伅
+                                task.CurrentAddress = router.StartPosi;
+                                task.NextAddress = task.TargetAddress;
+                                task.DeviceCode = router.NextPosi;
+                                _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute);
                                 WriteInfo(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�");
                             }
                         }
@@ -117,13 +136,16 @@
                             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);
-                                WriteInfo(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜鍫嗗灈鏈哄叆搴�");
+                                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}杩涜鍫嗗灈鏈哄叆搴�");
+                                }
                             }
                         }
                     }

--
Gitblit v1.9.3