From ff34f2d5f1e9a4a3fcd7ed5049bd88d75c70203b Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 10 十二月 2025 12:39:59 +0800
Subject: [PATCH] 1

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs |   42 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
index 6ee670c..854c468 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
@@ -117,6 +117,8 @@
 
                     #region 璺敱鏂瑰紡
                     List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+
+                    childDeviceCodes.Add("4000");
                     
                     foreach (string childDeviceCode in childDeviceCodes)
                     {
@@ -147,7 +149,6 @@
                                     MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
                                     if (method != null)
                                     {
-                                        //var strings = platform.Location.Split(',').ToList();
                                         int count = 1;
                                         method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
                                     }
@@ -161,7 +162,6 @@
                         var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                         if (tokenInfos == null || !tokenInfos.Any())
                         {
-                            //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
                             continue;
                         }
                         var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
@@ -208,6 +208,13 @@
 
                 //_noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
                 WriteInfo(conveyorLine.DeviceName, log);
+
+                if (childDeviceCode == "4000")
+                {
+                    conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1601), childDeviceCode);
+                    Thread.Sleep(100);
+                    conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 9999, childDeviceCode);
+                }
 
                 if (task == null)
                 {
@@ -446,12 +453,25 @@
                     }
                 }
 
-                //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                 bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
                 if (sendFlag)
                 {
                     conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                     content = _taskService.UpdateTaskStatusToNext(task);
+                }
+                var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationArea == "Call" && x.stationType == 12);
+                CommonConveyorLine_BZ? commonConveyorBZ=Storage.Devices.FirstOrDefault(x=>x.DeviceCode==station.stationPLC) as CommonConveyorLine_BZ;
+                if (commonConveyorBZ != null)
+                {
+                    ConveyorLineTaskCommand_After readSignal = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(station.stationLocation);
+                    if (readSignal.Reserved5 == 1)
+                    {
+                        var tasks = _taskRepository.QueryData(x => x.TargetAddress == childDeviceCode);
+                        if (tasks.Count == 0)
+                        {
+                            commonConveyorBZ.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), station.stationLocation);
+                        }
+                    }
                 }
             }
             else
@@ -483,8 +503,6 @@
                         }
                     }
 
-                    //conveyorLine.SendCommand(taskCommand, childDeviceCode); 
-
                     bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
                     if (sendFlag)
                     {
@@ -493,6 +511,20 @@
                         taskNext.ExceptionMessage = log;
                         content = _taskService.UpdateTaskStatusToNext(taskNext);
                     }
+                    var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationArea == "Call" && x.stationType == 12);
+                    CommonConveyorLine_BZ? commonConveyorBZ = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC) as CommonConveyorLine_BZ;
+                    if (commonConveyorBZ != null)
+                    {
+                        ConveyorLineTaskCommand_After readSignal = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(station.stationLocation);
+                        if (readSignal.Reserved5 == 1)
+                        {
+                            var tasks = _taskRepository.QueryData(x => x.TargetAddress == childDeviceCode);
+                            if (tasks.Count == 0)
+                            {
+                                commonConveyorBZ.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), station.stationLocation);
+                            }
+                        }
+                    }
                 }
             }
         }

--
Gitblit v1.9.3