From e46aa927d231af83724683c7286d9db503e24cf7 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期二, 10 六月 2025 11:46:20 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index 173377b..8358d6a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -34,6 +34,16 @@
 
 namespace WIDESEAWCS_Tasks
 {
+    /// <summary>
+    /// 閫氱敤杈撻�佺嚎浠诲姟锛岃礋璐e鐞嗚緭閫佺嚎璁惧鐨勯�氫俊涓庝换鍔℃墽琛�
+    /// </summary>
+    /// <remarks>
+    /// 1. 閫氳繃PLC閫氫俊璇诲彇璁惧鐘舵�佸拰鏉$爜淇℃伅 <br/>
+    /// 2. 鏍规嵁鏉$爜鏌ヨ浜у搧淇℃伅鍜屽幓鍚戝伐浣� <br/>
+    /// 3. 灏嗕骇鍝佸昂瀵稿拰鍘诲悜淇℃伅鍐欏叆PLC <br/>
+    /// 4. 澶勭悊寮傚父鎯呭喌骞惰褰曢敊璇棩蹇�
+    /// </remarks>
+    /// <attribute>[DisallowConcurrentExecution]</attribute>
     [DisallowConcurrentExecution]
     public class CommonConveyorLineJob : JobBase, IJob
     {
@@ -59,10 +69,8 @@
             try
             {
                 bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
-                if (flag && value != null && value is OtherDevice)
+                if (flag && value != null && value is OtherDevice otherDevice)
                 {
-                    OtherDevice otherDevice = (OtherDevice)value;
-
                     bool request = otherDevice.Communicator.Read<bool>("DB15.22.0");   //鐢宠
                     bool response = otherDevice.Communicator.Read<bool>("DB15.22.1");   //搴旂瓟
 
@@ -99,14 +107,24 @@
 
                             if (toplc > 0)//鑾峰彇鍒版湁鏁堝幓鍚�
                             {
-                                otherDevice.Communicator.Write("DB15.10", productInfo.Length);
-                                otherDevice.Communicator.Write("DB15.14", productInfo.Width);
-                                otherDevice.Communicator.Write("DB15.18", productInfo.Height);
+                                if (toplc == 1 && productInfo.Length < productInfo.Width)
+                                {
+                                    otherDevice.Communicator.Write("DB15.10", productInfo.Width);
+                                    otherDevice.Communicator.Write("DB15.14", productInfo.Length);
+                                    otherDevice.Communicator.Write("DB15.18", productInfo.Height);
+                                }
+                                else
+                                {
+                                    otherDevice.Communicator.Write("DB15.10", productInfo.Length);
+                                    otherDevice.Communicator.Write("DB15.14", productInfo.Width);
+                                    otherDevice.Communicator.Write("DB15.18", productInfo.Height);
+                                }
+
 
                                 otherDevice.Communicator.Write("DB15.6", toplc);   //鍐欏叆鍘诲悜
                                 otherDevice.Communicator.Write("DB15.0", true);
 
-                                var datast = _OrderDetailsService.ToMesBarc(int.Parse(barcode));
+                                //var datast = _OrderDetailsService.ToMesBarc(int.Parse(barcode));
                             }
                             else if (toplc == -1)//鏉挎潗鏃犳潯鐮�
                             {
@@ -120,7 +138,7 @@
                     }
                     else
                     {
-                        if (wcsResponse)
+                        if (wcsResponse && !request)
                             otherDevice.Communicator.Write("DB15.0", false);  //娓呴櫎鍝嶅簲
                     }
                 }
@@ -137,7 +155,7 @@
             List<int> result = new List<int>();
             for (int i = 0; i < values.Length; i++)
             {
-                if (value.Equals(values[i]))
+                if (value?.Equals(values[i]) ?? false)
                 {
                     result.Add(i);
                 }

--
Gitblit v1.9.3