From 441b6f8d257a01b2998253ef0515a201777d7e68 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 04 七月 2025 14:06:49 +0800
Subject: [PATCH] 修改入库、移库、出库逻辑

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ProductionLineJob/CommonProductionLineJob.cs |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ProductionLineJob/CommonProductionLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ProductionLineJob/CommonProductionLineJob.cs"
index 7bc6222..b83fbb7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ProductionLineJob/CommonProductionLineJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ProductionLineJob/CommonProductionLineJob.cs"
@@ -40,6 +40,7 @@
                 OtherDevice ProductionLine = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams");
                 if (ProductionLine != null)
                 {
+                    #region MyRegion
                     var request = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.request);
                     if (request == 1)
                     {
@@ -48,25 +49,33 @@
                         if (traytype == 4)
                         {
                             var Barcode = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.trayBarcode).Replace("\0", "");
-                            var batchNo = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.batchNo).Replace("\0", "");
-                            ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO()
+                            if (string.IsNullOrEmpty(Barcode)) throw new Exception("浜х嚎鐢宠鎵樼洏鍙蜂负绌猴紒");
+                            var task = _taskRepository.QueryFirst(x => x.PalletCode == Barcode);
+                            if (task == null)
                             {
-                                stationCode = ProductionLine.DeviceCode,
-                                traytype = traytype,
-                                Barcode = Barcode,
-                                batchNo = batchNo,
-                            };
-                            var content = ProductionLineToWMSRequest(MaterielGroupDTO);
-                            if (content.Status)
-                                ProductionLine.SetValue(ProductionLineDBName.Wrequest, request);
+                                var batchNo = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.batchNo).Replace("\0", "");
+                                if (string.IsNullOrEmpty(batchNo)) throw new Exception("浜х嚎鐢宠鎵瑰彿涓虹┖锛�");
+                                WriteDebug($"{ProductionLine.DeviceName}鐢宠鍏ュ簱", $"鎵樼洏鍙枫�恵Barcode}銆�,鎵规煖鍙枫�恵batchNo}銆�");
+                                ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO()
+                                {
+                                    stationCode = ProductionLine.DeviceCode,
+                                    traytype = traytype,
+                                    Barcode = Barcode,
+                                    batchNo = batchNo,
+                                };
+                                var content = ProductionLineToWMSRequest(MaterielGroupDTO);
+                                if (content.Status)
+                                    ProductionLine.SetValue(ProductionLineDBName.Wrequest, request);
+                            }
                         }
                     }
+                    #endregion
                 }
                 #endregion
             }
             catch (Exception ex)
             {
-                Console.Out.WriteLine(nameof(CommonProductionLineJob) + ":" + ex.ToString());
+                //Console.Out.WriteLine(nameof(CommonProductionLineJob) + ":" + ex.ToString());
             }
             return Task.CompletedTask;
         }

--
Gitblit v1.9.3