From 9ae0890dd74771ba9edd44d4830e0de37f8d9938 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 26 九月 2025 16:55:03 +0800
Subject: [PATCH] MES接口优化,老厂排程优化等

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPA.cs |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 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_CPA.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_CPA.cs"
index 72c964a..a6e1576 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_CPA.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_CPA.cs"
@@ -68,7 +68,7 @@
                 OtherDevice device = (OtherDevice)value;
                 List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                 //鑾峰彇鏈夊崗璁殑杈撻�佺嚎
-                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
+                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData();
                 foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                 {
                     DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
@@ -82,16 +82,32 @@
                             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 = "SC01_CP-002-064-008-01";
-                                if (!string.IsNullOrEmpty(local))
+                                Dt_StationManger stationManger = stationMangers.FirstOrDefault(x => x.StationCode == task.SourceAddress);
+                                if (stationManger != null)
                                 {
-                                    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 = "";
+                                    switch (stationManger.AGVStationCode.ObjToInt() % 2)
+                                    {
+                                        case 1:
+                                            local = task.Roadway + "-001-062-001-01";
+                                            break;
+                                        case 0:
+                                            local = task.Roadway + "-002-062-001-01";
+                                            break;
+                                        default:
+                                            WriteError(item.StationName, $"鏈壘鍒板彲鍒嗛厤宸烽亾{task.TaskNum}");
+                                            break;
+                                    }
+                                    //鍒嗛厤璐т綅
+                                    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