From 1d685ca799f0b50ad63336963511cbbf21ab2e4c Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 18 十二月 2025 09:41:53 +0800
Subject: [PATCH] 需求优化

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPA.cs |   42 +++++++++++++++---------------------------
 1 files changed, 15 insertions(+), 27 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 f198bbf..b4b5965 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"
@@ -70,7 +70,7 @@
                     OtherDevice device = (OtherDevice)value;
                     List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
                     //鑾峰彇鏈夊崗璁殑杈撻�佺嚎
-                    List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData();
+                    List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x=>x.StationDeviceCode==device.DeviceCode);
                     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();
@@ -80,38 +80,26 @@
                             R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
                             if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0 && item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) //浜屾ゼ绾夸綋鍏ュ簱绔欏彴->鍫嗗灈鏈�
                             {
-                                //鑾峰彇鍏ュ簱绔欏彴鏄惁瀛樺湪鍏ュ簱浠诲姟
                                 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)
                                 {
-                                    Dt_StationManger stationManger = stationMangers.FirstOrDefault(x => x.StationCode == task.SourceAddress);
-                                    if (stationManger != null)
+                                    //鍒嗛厤璐т綅
+                                    string? local = _taskService.RequestAssignLocation(task.TaskNum, task.Roadway);
+                                    //鍒嗛厤璐т綅
+                                    if (!string.IsNullOrEmpty(local))
                                     {
-                                        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}杩涜鍫嗗灈鏈哄叆搴�");
-                                        }
+                                        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
+                                {
+                                    WriteError(item.StationName, $"鏈壘鍒皗item.StationCode}鐨勪换鍔conveyorLineInfoRead.TaskNo}");
+                                }
                             }
                             else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0 && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //浜屾ゼ绾夸綋鍑哄簱绔欏彴
                             {

--
Gitblit v1.9.3