From 68343df577836d29f8bd106823b1805d365f4a54 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 17 七月 2025 16:23:40 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/LongDeLiLiKu

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPA.cs |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 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 a541310..058e55f 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"
@@ -10,6 +10,7 @@
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Communicator;
+using WIDESEAWCS_Core;
 using WIDESEAWCS_IBasicInfoRepository;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
@@ -66,7 +67,9 @@
             {
                 OtherDevice device = (OtherDevice)value;
                 List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
+                //鑾峰彇鏈夊崗璁殑杈撻�佺嚎-z
                 List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
+                //璁╂瘡涓緭閫佺嚎鍚姩-z
                 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();
@@ -74,13 +77,22 @@
                     if (deviceProRead != null)
                     {
                         R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress);
-                        if (conveyorLineInfoRead.Command == 2 && conveyorLineInfoRead.TaskNo > 0)
+                        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)
                             {
+                                string local = "";
                                 //鍒嗛厤璐т綅
-                                string local = "SC01_CP-001-064-001-01";
+                                if (task.HeightType==1)
+                                {
+                                    local = "SC02_CP-001-064-001-01";
+                                }
+                                else if (task.HeightType == 2)
+                                {
+                                    local = "SC02_CP-001-063-001-01";
+                                }
                                 task.CurrentAddress = item.StackerCraneStationCode;
                                 task.TargetAddress= local;
                                 task.NextAddress = local;
@@ -96,6 +108,31 @@
 
                             }
                         }
+                        else if (conveyorLineInfoRead != null && conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo <= 0 && item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //浜屾ゼ绾夸綋鍑哄簱绔欏彴
+                        {
+                            //鑾峰彇鍑哄簱绔欏彴鏄惁瀛樺湪鍑哄簱寰呮墽琛屼换鍔�
+                            Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) 
+                            && x.TaskState ==TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode);
+                            if (task != null)
+                            {
+                                //鑾峰彇璺敱閰嶇疆
+                                List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi);
+                                Dt_Router router = routers.FirstOrDefault();
+                                if (router == null)
+                                {
+                                    WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}鏈壘鍒拌矾鐢遍厤缃俊鎭�");
+                                    return Task.CompletedTask;
+                                }
+                                //鍐欏叆鍑哄簱绾夸綋鍦板潃
+                                device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode);
+                                device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode);
+                                device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode);
+                                //鏇存柊璁惧
+                                task.DeviceCode = router.ChildPosiDeviceCode;
+                                _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing);
+                                WriteError(item.StationName, $"浠诲姟鍙�:{task.TaskNum}杩涜绾夸綋鍑哄簱");
+                            }
+                        }
                     }
                     else
                     {

--
Gitblit v1.9.3