From 21cd52c5592aad3687be74599a932012d9dd77a4 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 15 四月 2025 10:03:38 +0800
Subject: [PATCH] 条码上传冠宏

---
 代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index 6d62fda..93f0168 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -52,9 +52,7 @@
         }
 
         public Task Execute(IJobExecutionContext context)
-        
-        
-        
+
         {
             try
             {
@@ -115,7 +113,7 @@
                 string taskType = request.Value.Contains("ZJXL") ? "姝f瀬" : "璐熸瀬";
 
                 // 鏌ヨ鏄惁瀛樺湪宸茬敓鎴愮殑鏂颁换鍔�
-                var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd && x.TaskState == (int)TaskInStatusEnum.InNew);
+                var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd);//&& x.TaskState == (int)TaskInStatusEnum.InNew
                 if (task != null)
                 {
                     ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},浠诲姟宸茬敓鎴愬瓨鍦紝绋嶅悗閲嶈瘯......");
@@ -131,7 +129,7 @@
                 }
 
                 // 鍒涘缓骞舵坊鍔犳柊浠诲姟鍒颁换鍔′粨搴�
-                task = CreateTask(fromAdd, czTask.TaskEndAddress, czTask.TaskOrderNo, czTask.TaskProductCode, taskType);
+                task = CreateTask(fromAdd, czTask.TaskEndAddress, czTask.TaskOrderNo, czTask.TaskProductCode, taskType, czTask.Id);
                 _taskRepository.AddData(task);
                 ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},浠诲姟宸茬敓鎴愶紝绛夊緟鎵ц......");
             }
@@ -148,7 +146,7 @@
                 }
 
                 string fromAdd = request.Value;
-                string taskType = request.Value.Contains("ZJXL") ? "姝f瀬" : "璐熸瀬";
+                string taskType = "璐熸瀬"; //request.Value.Contains("ZJXL") ? "姝f瀬" :
 
                 // 鏍规嵁浠诲姟绫诲瀷纭畾璇锋眰鍦板潃
                 (string upRequest, string gmRequest, string gmState) = GetRequestAddresses(taskType);
@@ -191,8 +189,13 @@
         }
 
         // 杈呭姪鏂规硶锛氬垱寤轰换鍔″璞�
-        private Dt_Task CreateTask(string currentAddress, string targetAddress, string remark, string palletCode, string taskType)
+        private Dt_Task CreateTask(string currentAddress, string targetAddress, string remark, string palletCode, string taskType, int czTaskID = 0)
         {
+            Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.SourceAddress == currentAddress);
+            if (dt_Task != null)
+            {
+                return null;
+            }
             return new Dt_Task
             {
                 TaskNum = _taskService.GetTaskNum(),
@@ -208,7 +211,7 @@
                 NextAddress = targetAddress,
                 Barcode = "",
                 Roadway = $"{taskType}AGV",
-                WMSId = 0,
+                WMSId = czTaskID > 0 ? czTaskID : 0,
                 Remark = remark
             };
         }

--
Gitblit v1.9.3