From 88724eca51a5863f20ee0a552af741aeebf4e8f2 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 11 二月 2026 17:31:45 +0800
Subject: [PATCH] 添加堆垛机配置并重构任务

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs |  115 +++------------------------------------------------------
 1 files changed, 6 insertions(+), 109 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
index ae00347..73df26f 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
@@ -96,11 +96,7 @@
                 if (string.Equals(task.NextAddress, ConstraintMachineName, StringComparison.Ordinal))
                 {
                     ConstraintMachine? constraint = devices.OfType<ConstraintMachine>().FirstOrDefault(d => d.DeviceName == ConstraintMachineName);
-                    if (constraint == null)
-                    {
-                        // 处理 processing 为空的情况(可根据实际业务需求添加处理逻辑)
-                        return;
-                    }
+                    if (constraint == null) return;
 
                     ProcessDeviceRequest(conveyorLine, constraint, childDeviceCode,
                     () => constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper),
@@ -110,11 +106,7 @@
                 else if (string.Equals(task.NextAddress, PinMachineName, StringComparison.Ordinal))
                 {
                     PinMachine? pinMachine = devices.OfType<PinMachine>().FirstOrDefault(d => d.DeviceName == PinMachineName);
-                    if (pinMachine == null)
-                    {
-                        // 处理 pinMachine 为空的情况(可根据实际业务需求添加处理逻辑)
-                        return;
-                    }
+                    if (pinMachine == null) return;
 
                     ProcessDeviceRequest(conveyorLine, pinMachine, childDeviceCode,
                     () => pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper),
@@ -123,10 +115,10 @@
                 }
 
                 Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
-                //if (newTask != null)
-                //{
-                //    _taskService.UpdateTaskStatusToNext(task);
-                //}
+                if (newTask != null)
+                {
+                    _taskService.UpdateTaskStatusToNext(task);
+                }
             }
         }
 
@@ -227,101 +219,6 @@
                 conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
                 Console.Out.WriteLine(content.Serialize());
-            }
-        }
-
-        /// <summary>
-        /// 入库拘束机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="constraint"></param>
-        /// <param name="childDeviceCode"></param>
-        public void InboundConstraintMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, ConstraintMachine? constraint, string childDeviceCode)
-        {
-            //入库拘束机请求处理逻辑
-            bool materialReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper);
-            bool outputReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestUpper);
-
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                constraint.SetValue(ConstraintMachineDBName.ConstraintTrayOutputReadyUpper, outputReq ? 1 : 0);
-            }
-        }
-
-        /// <summary>
-        /// 入库插拔钉机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="pinMachine"></param>
-        /// <param name="childDeviceCode"></param>
-        public void InboundPinMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, PinMachine? pinMachine, string childDeviceCode)
-        {
-            //入库插拔钉机请求处理逻辑
-            bool materialReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper);
-            bool outputReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestUpper);
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                pinMachine.SetValue(PinMachineDBName.PlugPinTrayOutputReadyUpper, outputReq ? 1 : 0);
-            }
-        }
-
-        /// <summary>
-        /// 出库拘束机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="constraint"></param>
-        /// <param name="childDeviceCode"></param>
-        public void OutConstraintMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, ConstraintMachine? constraint, string childDeviceCode)
-        {
-            //出库拘束机请求处理逻辑
-
-            bool materialReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestLower);
-            bool outputReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestLower);
-
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                constraint.SetValue(ConstraintMachineDBName.ConstraintTrayOutputReadyLower, outputReq ? 1 : 0);
-            }
-        }
-
-        /// <summary>
-        /// 出库插拔钉机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="pinMachine"></param>
-        /// <param name="childDeviceCode"></param>
-        public void OutPinMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, PinMachine? pinMachine, string childDeviceCode)
-        {
-            //出库插拔钉机请求处理逻辑
-            bool materialReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestLower);
-            bool outputReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestLower);
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                pinMachine.SetValue(PinMachineDBName.PlugPinTrayOutputReadyLower, outputReq ? 1 : 0);
             }
         }
 

--
Gitblit v1.9.3