From abf9b6bb33fcfad5b56a17a5d3e99b49782a7316 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 04 12月 2024 15:19:00 +0800
Subject: [PATCH] 22

---
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOperationTask/WmsOperationTaskService.cs      |   86 ++++++++++++++++++----------
 CC/iWareSql/DataAccess/TaskHandler.cs                                                                      |    6 +-
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Configuration/Database.json                              |    4 
 CC/iWareCC_ASRS/ThreadService/01_BZ01工位(清灰,洗板后工位)/DataProcess_BZ01.cs                                      |    3 
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/4、DataProcess_RobotBuffer_ForceOutbound.cs         |    4 
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/2、DataProcess_RobotBuffer_IssueOutboundTask.cs     |    6 +-
 LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Enum/ReportCenter/RbTaskTypeEnum.cs                      |   16 +++-
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/3、DataProcess_RobotBuffer_FinishTaskForOutbound.cs |   16 ++++
 CC/iWareModel/EnumType/WMS/RbTaskTypeEnum.cs                                                               |   16 +++-
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/1、DataProcess_RobotBuffer_AutoQiTaoOutbound.cs     |    4 
 10 files changed, 105 insertions(+), 56 deletions(-)

diff --git "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
index af1ebef..ef1a668 100644
--- "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
@@ -168,7 +168,8 @@
         private static bool IsAllloRunOutTaskMode(WmsDBModel wmsDB, mes_batchOrderUPI_new curUpiObj)
         {
             //棣栧厛鏌ヨ鏁版嵁搴撲腑鏄惁鏈� 瑕佸嚭搴撶殑鏁版嵁
-            var isExistOutTaskForNewCreated = wmsDB.wms_rbline_task.Where(x => x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+            var isExistOutTaskForNewCreated = wmsDB.wms_rbline_task.Where(x => 
+            (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                && x.TaskStatus == (int)TaskStatusEnum.鏂板缓
               ).Count();
             if (isExistOutTaskForNewCreated == 0)
diff --git "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.cs" "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.cs"
index 4540825..efd8f83 100644
--- "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.cs"
@@ -71,8 +71,8 @@
                                             OrderId = x.OrderId,
                                             PackageCode = x.PackageCode,
                                             PlaceCode = x.PlaceCode,
-                                            RbTaskType = (int)RbTaskTypeEnum.鍑哄簱浠诲姟,
-                                            RbTaskTypeEnumName = RbTaskTypeEnum.鍑哄簱浠诲姟.ToString(),
+                                            RbTaskType = (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟,
+                                            RbTaskTypeEnumName = RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟.ToString(),
                                             TaskStatus = (int)TaskStatusEnum.鏂板缓,
                                             TaskStatusName = TaskStatusEnum.鏂板缓.ToString(),
                                             TaskMsg = "鍑哄簱浠诲姟",
diff --git "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.cs" "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.cs"
index 3810906..d0f5d80 100644
--- "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.cs"
@@ -57,7 +57,7 @@
                             if (string.IsNullOrEmpty(FormCC.currHandlerPackageCodeForIssueOutboundTask))
                             {
                                 var firstTask = wmsDB.wms_rbline_task.Where(x =>
-                           x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                           (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                           && x.TaskStatus == (int)TaskStatusEnum.鏂板缓).OrderBy(x => x.CreateTime).FirstOrDefault();
                                 if (firstTask == null)
                                 {
@@ -70,7 +70,7 @@
                             else
                             {
                                 var firstTask = wmsDB.wms_rbline_task.Where(x =>
-                           x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                           (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                           && x.TaskStatus == (int)TaskStatusEnum.鏂板缓
                           && x.PackageCode == FormCC.currHandlerPackageCodeForIssueOutboundTask
                           ).OrderBy(x => x.CreateTime).FirstOrDefault();
@@ -83,7 +83,7 @@
                             }
 
                             var taskList = wmsDB.wms_rbline_task.Where(x =>
-                           x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                          (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                           && x.TaskStatus == (int)TaskStatusEnum.鏂板缓).Where(x => x.PackageCode == FormCC.currHandlerPackageCodeForIssueOutboundTask).OrderBy(x => x.CreateTime).ToList();
                             if (taskList == null)
                             {
diff --git "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.cs" "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.cs"
index 5b01710..7319dcb 100644
--- "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.cs"
@@ -52,7 +52,7 @@
                             {
                                 var task = wmsDB.wms_rbline_task.Where(x =>
                                  x.TaskNo == obj.R_Outbound_TaskID.ToString()
-                                && x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                                && (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                                 ).OrderByDescending(x => x.Id).FirstOrDefault();
                                 if (task == null)
                                 {
@@ -79,6 +79,18 @@
                                     SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌瀵硅薄 ";
                                     continue;
                                 }
+                                //鏇存柊鏉夸欢鐨勭姸鎬佸拰鍖哄煙
+                                if (task.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟)
+                                {
+                                    upiObj.UpiStatus = (int)UpiStatusEnum.宸查綈鍖�;
+                                    upiObj.AreaCode = (int)AreaCodeEnum.鐮佸灈鍖哄煙;
+                                }
+                                else if (task.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+                                {
+                                    upiObj.UpiStatus = (int)UpiStatusEnum.宸蹭笅绾�;
+                                    upiObj.AreaCode = (int)AreaCodeEnum.涓嬬嚎鍖哄煙;
+                                }
+
                                 //搴撳瓨鍑忓皯
                                 wms_stock_quan qun = wmsDB.wms_stock_quan.Where(x => x.PlaceCode == task.PlaceCode).FirstOrDefault();
                                 wmsDB.wms_stock_quan.Remove(qun);
@@ -105,7 +117,7 @@
                                     }
                                 }
 
-                                WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, task.PlaceCode, $"鍑虹紦瀛樺簱锛歿task.PlaceCode},"+task.TaskMsg);
+                                WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, task.PlaceCode, $"鍑虹紦瀛樺簱锛歿task.PlaceCode}," + task.TaskMsg);
 
                                 wmsDB.SaveChanges();
                             }
diff --git "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/4\343\200\201DataProcess_RobotBuffer_ForceOutbound.cs" "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/4\343\200\201DataProcess_RobotBuffer_ForceOutbound.cs"
index 0fc6213..7d144ce 100644
--- "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/4\343\200\201DataProcess_RobotBuffer_ForceOutbound.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Outbound/4\343\200\201DataProcess_RobotBuffer_ForceOutbound.cs"
@@ -60,8 +60,8 @@
                             OrderId = x.OrderId,
                             PackageCode = x.PackageCode,
                             PlaceCode = x.PlaceCode,
-                            RbTaskType = (int)RbTaskTypeEnum.鍑哄簱浠诲姟,
-                            RbTaskTypeEnumName = RbTaskTypeEnum.鍑哄簱浠诲姟.ToString(),
+                            RbTaskType = (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟,
+                            RbTaskTypeEnumName = RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟.ToString(),
                             TaskStatus = (int)TaskStatusEnum.鏂板缓,
                             TaskStatusName = TaskStatusEnum.鏂板缓.ToString(),
                             TaskMsg = "浜哄伐寮哄埗寰呭嚭搴�",
diff --git a/CC/iWareModel/EnumType/WMS/RbTaskTypeEnum.cs b/CC/iWareModel/EnumType/WMS/RbTaskTypeEnum.cs
index 8337406..6cab396 100644
--- a/CC/iWareModel/EnumType/WMS/RbTaskTypeEnum.cs
+++ b/CC/iWareModel/EnumType/WMS/RbTaskTypeEnum.cs
@@ -18,22 +18,28 @@
         鍏ュ簱浠诲姟 = 1,
 
         /// <summary>
-        /// 鍑哄簱浠诲姟
+        /// 榻愬寘鍑哄簱浠诲姟
         /// </summary>
-        [Description("鍑哄簱浠诲姟")]
-        鍑哄簱浠诲姟 = 2,
+        [Description("榻愬寘鍑哄簱浠诲姟")]
+        榻愬寘鍑哄簱浠诲姟 = 2,
+
+        /// <summary>
+        /// 寮哄埗鍑哄簱浠诲姟
+        /// </summary>
+        [Description("寮哄埗鍑哄簱浠诲姟")]
+        寮哄埗鍑哄簱浠诲姟 = 3,
 
         /// <summary>
         /// 鐮佹澘浠诲姟
         /// </summary>
         [Description("鐮佹澘浠诲姟")]
-        鐮佹澘浠诲姟 = 3,
+        鐮佹澘浠诲姟 = 4,
 
         /// <summary>
         /// 鍚堝寘浠诲姟
         /// </summary>
         [Description("鍚堝寘浠诲姟")]
-        鍚堝寘浠诲姟 = 4
+        鍚堝寘浠诲姟 = 5
 
     }
 }
\ No newline at end of file
diff --git a/CC/iWareSql/DataAccess/TaskHandler.cs b/CC/iWareSql/DataAccess/TaskHandler.cs
index 97727dc..c55d91b 100644
--- a/CC/iWareSql/DataAccess/TaskHandler.cs
+++ b/CC/iWareSql/DataAccess/TaskHandler.cs
@@ -43,7 +43,7 @@
                 && (
                   x.RbTaskType == (int)RbTaskTypeEnum.鍏ュ簱浠诲姟
                   ||
-                   x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                  (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                 ) && x.UPI == UPI
               ).ToList();
 
@@ -64,7 +64,7 @@
                 && (
                   x.RbTaskType == (int)RbTaskTypeEnum.鍏ュ簱浠诲姟
                   ||
-                   x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                   (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                 )
               ).ToList();
 
@@ -109,7 +109,7 @@
             var isExist = wmsDB.wms_rbline_task.Where(x => x.TaskStatus != (int)TaskStatusEnum.宸插畬鎴�
                 && x.TaskStatus != (int)TaskStatusEnum.宸插彇娑�
                 && (
-                   x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                  (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                 )
               ).ToList();
 
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Configuration/Database.json b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Configuration/Database.json
index 3491b79..f3800af 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Configuration/Database.json
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Configuration/Database.json
@@ -26,11 +26,11 @@
           "EnableUnderLine": false // 鍚敤椹煎嘲杞笅鍒掔嚎
         },
         "TableSettings": {
-          "EnableInitTable": false, // 鍚敤琛ㄥ垵濮嬪寲
+          "EnableInitTable": true, // 鍚敤琛ㄥ垵濮嬪寲
           "EnableIncreTable": false // 鍚敤琛ㄥ閲忔洿鏂�-鐗规�IncreTable]
         },
         "SeedSettings": {
-          "EnableInitSeed": false, // 鍚敤绉嶅瓙鍒濆鍖�
+          "EnableInitSeed": true, // 鍚敤绉嶅瓙鍒濆鍖�
           "EnableIncreSeed": false // 鍚敤绉嶅瓙澧為噺鏇存柊-鐗规�IncreSeed]
         }
       }
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Enum/ReportCenter/RbTaskTypeEnum.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Enum/ReportCenter/RbTaskTypeEnum.cs
index 100f306..f1ffc3a 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Enum/ReportCenter/RbTaskTypeEnum.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Enum/ReportCenter/RbTaskTypeEnum.cs
@@ -15,21 +15,27 @@
     鍏ュ簱浠诲姟 = 1,
 
     /// <summary>
-    /// 鍑哄簱浠诲姟
+    /// 榻愬寘鍑哄簱浠诲姟
     /// </summary>
-    [Description("鍑哄簱浠诲姟")]
-    鍑哄簱浠诲姟 = 2,
+    [Description("榻愬寘鍑哄簱浠诲姟")]
+    榻愬寘鍑哄簱浠诲姟 = 2,
+
+    /// <summary>
+    /// 寮哄埗鍑哄簱浠诲姟
+    /// </summary>
+    [Description("寮哄埗鍑哄簱浠诲姟")]
+    寮哄埗鍑哄簱浠诲姟 = 3,
 
     /// <summary>
     /// 鐮佹澘浠诲姟
     /// </summary>
     [Description("鐮佹澘浠诲姟")]
-    鐮佹澘浠诲姟 = 3,
+    鐮佹澘浠诲姟 = 4,
 
     /// <summary>
     /// 鍚堝寘浠诲姟
     /// </summary>
     [Description("鍚堝寘浠诲姟")]
-    鍚堝寘浠诲姟 = 4
+    鍚堝寘浠诲姟 = 5
 
 }
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOperationTask/WmsOperationTaskService.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOperationTask/WmsOperationTaskService.cs
index a1bc049..306a960 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOperationTask/WmsOperationTaskService.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOperationTask/WmsOperationTaskService.cs
@@ -54,6 +54,7 @@
     [HttpPost]
     [ApiDescriptionSettings(Name = "ForceOutbound")]
     [Description("WmsOperationTask/ForceOutbound")]
+    [UnitOfWork]
     public async Task ForceOutbound(ForceOutboundInput input)
     {
         if (input == null || input.PackageCodeList?.Count == 0)
@@ -179,6 +180,7 @@
     [HttpPost]
     [ApiDescriptionSettings(Name = "ValdateLabel")]
     [Description("WmsOperationTask/ValdateLabel")]
+    [UnitOfWork]
     public async Task<Mes_Package_Gather> ValdateLabel(ValidateLabelInput input)
     {
         if (input == null || input.PackageCode == null || input.Upi == null)
@@ -228,41 +230,63 @@
     [HttpPost]
     [ApiDescriptionSettings(Name = "UnlineForNGPackage")]
     [Description("WmsOperationTask/UnlineForNGPackage")]
+    [UnitOfWork]
     public async Task UnlineForNGPackage(UnlineForNGPackageInput input)
     {
-        //if (input == null)
-        //{
-        //    throw Oops.Oh("鍙傛暟涓嶈兘涓虹┖");
-        //}
-        //if (string.IsNullOrEmpty(input.PackageCode))
-        //{
-        //    throw Oops.Oh("鍖呭彿涓嶈兘涓虹┖");
-        //}
-        //if (string.IsNullOrEmpty(input.Reason))
-        //{
-        //    throw Oops.Oh("鍘熷洜涓嶈兘涓虹┖");
-        //}
-        //List<WmsStockQuan> updateQuanList = new List<WmsStockQuan>();
-        //foreach (var item in input.PackageCodeList)
-        //{
-        //    var quanList = await _wmsStockQuanRep.AsQueryable().Where(x => x.PackageCode == item).ToListAsync();
-        //    var isExist = quanList.Where(x => x.StockStatus == StockStatusEnum.榻愬寘寰呭嚭搴�).Count();
-        //    if (isExist > 0)
-        //    {
-        //        throw Oops.Oh($"鍖厈item}涓叾涓湁鏉跨姸鎬佹槸'{StockStatusEnum.榻愬寘寰呭嚭搴�.ToString()}'锛屼笉鍏佽寮哄埗鍑哄簱");
-        //    }
+        if (input == null)
+        {
+            throw Oops.Oh("鍙傛暟涓嶈兘涓虹┖");
+        }
+        if (string.IsNullOrEmpty(input.PackageCode))
+        {
+            throw Oops.Oh("鍖呭彿涓嶈兘涓虹┖");
+        }
+        if (string.IsNullOrEmpty(input.Reason))
+        {
+            throw Oops.Oh("鍘熷洜涓嶈兘涓虹┖");
+        }
 
-        //    鏇存柊鐘舵��
-        //    foreach (var quan in quanList)
-        //    {
-        //        quan.StockStatus = StockStatusEnum.浜哄伐寮哄埗寰呭嚭搴�;
-        //        quan.UpdateTime = DateTime.Now;
-        //        quan.OperReason = "浜哄伐寮哄埗寰呭嚭搴�";
-        //    }
-        //    updateQuanList.AddRange(quanList);
-        //}
+        var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync();
+        if (singlePackage == null)
+        {
+            throw Oops.Oh($"娌℃湁鎵惧埌鍖呭彿{input.PackageCode}鐨勬眹鎬绘暟鎹�");
+        }
 
-        //await _wmsStockQuanRep.UpdateRangeAsync(updateQuanList);
+        singlePackage.UpiFlag = UpiFlagEnum.NG;
+        singlePackage.UpdateTime = DateTime.Now;
+        singlePackage.UpiStatus = UpiStatusEnum.宸蹭笅绾�;
+        singlePackage.AreaCode = AreaCodeEnum.涓嬬嚎鍖哄煙;
+
+        var upiList = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).ToListAsync();
+        if (upiList == null)
+        {
+            throw Oops.Oh($"娌℃湁鎵惧埌鍖呭彿{input.PackageCode}鐨勬澘浠舵暟鎹�");
+        }
+        foreach (var item in upiList)
+        {
+            item.UpiFlag = UpiFlagEnum.NG;
+            item.UpdateTime = DateTime.Now;
+            item.UpiStatus = UpiStatusEnum.宸蹭笅绾�;
+            item.AreaCode = AreaCodeEnum.涓嬬嚎鍖哄煙;
+
+            WmsRecordUpiProcess wmsRecordUpi = new WmsRecordUpiProcess();
+            wmsRecordUpi = item.Adapt<WmsRecordUpiProcess>();
+            wmsRecordUpi.CreateTime = DateTime.Now;
+            wmsRecordUpi.Location = "";
+            wmsRecordUpi.OperRemark = "NG涓嬬嚎";
+            await _wmsRecordUpiProcessRep.InsertAsync(wmsRecordUpi);
+        }
+
+
+        WmsRecordPackageProcess wmsRecordPackage = new WmsRecordPackageProcess();
+        wmsRecordPackage = singlePackage.Adapt<WmsRecordPackageProcess>();
+        wmsRecordPackage.Location = "";
+        wmsRecordPackage.OperRemark = "NG涓嬬嚎";
+        await _wmsRecordPackageProcessRep.InsertAsync(wmsRecordPackage);
+
+
+        await _mesPackageGatherRep.UpdateAsync(singlePackage);
+        await _mesBatchOrderUpiRep.UpdateRangeAsync(upiList);
 
     }
 

--
Gitblit v1.9.3