From da5d613a85d97ecd826e343eae6d901806120a05 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 18 三月 2026 14:18:36 +0800
Subject: [PATCH] fix: 修复输送线目标地址选择器并完善机械手任务地址映射

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
index 2983836..16f7735 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
@@ -9,6 +9,11 @@
         private const string ConstraintMachineName = "鎷樻潫鏈�";
         private const string PinMachineName = "鎻掓嫈閽夋満";
 
+        // 鎷樻潫鏈虹偣浣�
+        private static readonly List<string> ConstraintMachineCodes = new List<string> { "10180", "20090" };
+        // 鎻掓嫈閽夋満鐐逛綅
+        private static readonly List<string> PinMachineCodes = new List<string> { "10190", "20100" };
+
         public void HandleInboundNextAddress(CommonConveyorLine conveyorLine, string nextAddress, string childDeviceCode)
         {
             HandleDeviceRequest(conveyorLine, nextAddress, childDeviceCode, isUpper: true);
@@ -23,7 +28,7 @@
         {
             var devices = Storage.Devices;
 
-            if (string.Equals(nextAddress, ConstraintMachineName, StringComparison.Ordinal))
+            if (ConstraintMachineCodes.Contains(nextAddress))
             {
                 ConstraintMachine? constraint = devices.OfType<ConstraintMachine>().FirstOrDefault(d => d.DeviceName == ConstraintMachineName);
                 if (constraint == null)
@@ -35,11 +40,11 @@
                     conveyorLine,
                     childDeviceCode,
                     getMaterialRequest: () => isUpper
-                        ? constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper)
-                        : constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestLower),
+                        ? constraint.GetValue<ConstraintMachineDBName, short>(ConstraintMachineDBName.MaterialRequestUpper) != 0
+                        : constraint.GetValue<ConstraintMachineDBName, short>(ConstraintMachineDBName.MaterialRequestLower) != 0,
                     getOutputRequest: () => isUpper
-                        ? constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestUpper)
-                        : constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestLower),
+                        ? constraint.GetValue<ConstraintMachineDBName, short>(ConstraintMachineDBName.OutputRequestUpper) != 0
+                        : constraint.GetValue<ConstraintMachineDBName, short>(ConstraintMachineDBName.OutputRequestLower) != 0,
                     setOutputReady: outputReq =>
                     {
                         if (isUpper)
@@ -52,7 +57,7 @@
                         }
                     });
             }
-            else if (string.Equals(nextAddress, PinMachineName, StringComparison.Ordinal))
+            else if (PinMachineCodes.Contains(nextAddress))
             {
                 PinMachine? pinMachine = devices.OfType<PinMachine>().FirstOrDefault(d => d.DeviceName == PinMachineName);
                 if (pinMachine == null)
@@ -64,11 +69,11 @@
                     conveyorLine,
                     childDeviceCode,
                     getMaterialRequest: () => isUpper
-                        ? pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper)
-                        : pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestLower),
+                        ? pinMachine.GetValue<PinMachineDBName, short>(PinMachineDBName.MaterialRequestUpper) != 0
+                        : pinMachine.GetValue<PinMachineDBName, short>(PinMachineDBName.MaterialRequestLower) != 0,
                     getOutputRequest: () => isUpper
-                        ? pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestUpper)
-                        : pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestLower),
+                        ? pinMachine.GetValue<PinMachineDBName, short>(PinMachineDBName.OutputRequestUpper) != 0
+                        : pinMachine.GetValue<PinMachineDBName, short>(PinMachineDBName.OutputRequestLower) != 0,
                     setOutputReady: outputReq =>
                     {
                         if (isUpper)

--
Gitblit v1.9.3