From 753361f589444455fe1b20476c658201ccd92c38 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期三, 30 七月 2025 09:53:19 +0800
Subject: [PATCH] 更新优化

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs |   99 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 89 insertions(+), 10 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index 2a0977a..c1b9d98 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -16,6 +16,7 @@
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
+using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
 using WIDESEA_DTO;
 using WIDESEA_DTO.MES;
@@ -60,7 +61,7 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�");
                 }
-                if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt())
+                if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt())
                 {
                     return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱");
                 }
@@ -99,6 +100,7 @@
                         PalletType = stockInfo.PalletType,
                         MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode,
                         Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity),
+                        BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo
                     };
                     //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗�
                     Dt_InboundOrder? inboundOrder =  null;
@@ -134,6 +136,16 @@
                         stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
                         newTask.TaskType = TaskTypeEnum.InPick.ObjToInt();
                     }
+                    else if (stockInfo.StockStatus == StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt())
+                    {
+                        stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt();
+                        newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt();
+                    }
+                    else if(stockInfo.StockStatus == StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt())
+                    {
+                        stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt();
+                        newTask.TaskType = TaskTypeEnum.InInventory.ObjToInt();
+                    }
                     else
                     {
                         stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
@@ -162,7 +174,52 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-
+        /// <summary>
+        /// 鏌ヨ璐ㄦ鏁伴噺
+        /// </summary>
+        /// <param name="palletCode">鎵樼洏鍙�</param>
+        /// <returns></returns>
+        public WebResponseContent InQualityConfirm(string palletCode)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(palletCode);
+                if (stockInfo == null)
+                {
+                    return content.Error($"鏈壘鍒拌鎵樼洏搴撳瓨淇℃伅");
+                }
+                if (stockInfo.Details.Count<=0)
+                {
+                    return content.Error($"璇ユ墭鐩樺簱瀛樻槑缁嗕负绌�");
+                }
+                if (stockInfo.StockStatus != StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt())
+                {
+                    return content.Error($"璇ユ墭鐩樿繕鏈�佹妫�楠屽畬鎴�");
+                }
+                Dt_OutStockLockInfo? outStockLockInfo = _outboundRepository.OutboundStockLockInfoRepository.QueryData(x => x.PalletCode == palletCode && x.Status == OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && x.OrderType== OutOrderTypeEnum.Quality.ObjToInt()).OrderByDescending(x=>x.Id).FirstOrDefault();
+                if (outStockLockInfo != null)
+                {
+                    //鑾峰彇瀵瑰簲妫�楠屽崟
+                    Dt_CheckOrder checkOrder = _checkOrderRepository.QueryFirst(x=>x.ReceiveDetailRowNo== outStockLockInfo.Id && x.CheckOrderStatus==CheckOrderStatusEnum.Checked.ObjToInt());
+                    if (checkOrder == null)
+                    {
+                        return content.Error($"璇ユ墭鐩橀�佹淇℃伅鏈");
+                    }
+                    content.OK("鎴愬姛", data:new { stockInfo.Details.FirstOrDefault()?.MaterielCode,checkOrder.ReceivedQuantity,checkOrder.ScrappedQuantity,checkOrder.DefectedQuantity,checkOrder.QualifiedQuantity,stockQuantity= stockInfo.Details.Sum(x=>x.StockQuantity) }) ;
+                }
+                else
+                {
+                    content.Error("璇ユ墭鐩橀�佹鍑哄簱璇︽儏涓嶅瓨鍦�");
+                }
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                content.Error(ex.Message);
+            }
+            return content;
+        }
         /// <summary>
         /// 鍏ョ┖绠�
         /// </summary>
@@ -339,10 +396,12 @@
                     };
                     string MaterielCodeGMPP = stockInfoPPorGM.Details?.Where(x => x.StockId == stockInfoPPorGM.Id).FirstOrDefault()?.MaterielCode;
                     float QuantityGMPP = (float)stockInfoPPorGM.Details?.Where(x => x.StockId == stockInfoPPorGM.Id).Sum(x => x.StockQuantity);
-                    if (MaterielCodeGMPP != null && QuantityGMPP != null)
+                    string batchNo = stockInfoPPorGM.Details?.Where(x => x.StockId == stockInfoPPorGM.Id).FirstOrDefault()?.BatchNo;
+                    if (MaterielCodeGMPP != null && QuantityGMPP != null && batchNo != null)
                     {
                         newTaskPPorGM.MaterielCode = MaterielCodeGMPP;
                         newTaskPPorGM.Quantity = QuantityGMPP;
+                        newTaskPPorGM.BatchNo = batchNo;
                     }
 
                     //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗�
@@ -382,7 +441,7 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�");
                 }
-                if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt())
+                if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt() && stockInfo.StockStatus!=StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt())
                 {
                     return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱");
                 }
@@ -413,10 +472,12 @@
                 };
                 string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
                 float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
-                if (MaterielCode != null && Quantity != null)
+                string BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo;
+                if (MaterielCode != null && Quantity != null && BatchNo != null)
                 {
                     newTask.MaterielCode = MaterielCode;
                     newTask.Quantity = Quantity;
+                    newTask.BatchNo = BatchNo;
                 }
 
                 //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗�
@@ -450,6 +511,16 @@
                 {
                     stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
                     newTask.TaskType = TaskTypeEnum.InPick.ObjToInt();
+                }
+                else if (stockInfo.StockStatus == StockStatusEmun.閫佹搴撳瓨瀹屾垚.ObjToInt())
+                {
+                    stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt();
+                    newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt();
+                }
+                else if (stockInfo.StockStatus == StockStatusEmun.鐩樼偣搴撳瓨瀹屾垚.ObjToInt())
+                {
+                    stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt();
+                    newTask.TaskType = TaskTypeEnum.InInventory.ObjToInt();
                 }
                 else
                 {
@@ -528,10 +599,12 @@
                 };
                 string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
                 float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
-                if (MaterielCode != null && Quantity != null)
+                string BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo;
+                if (MaterielCode != null && Quantity != null && BatchNo != null)
                 {
                     newTask.MaterielCode = MaterielCode;
-                    newTask.Quantity = (float)Quantity;
+                    newTask.Quantity = Quantity;
+                    newTask.BatchNo = BatchNo;
                 }
 
                 if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt())
@@ -544,8 +617,9 @@
                 }
                 else if (stockInfo.StockStatus == StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt())
                 {
+                    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.WarehouseId==stockInfo.WarehouseId && x.PalletType==stockInfo.PalletType);
                     //todo 灏忔墭鐩樻殏鏃舵湭鍚敤
-                    if (stockInfo.PalletType == PalletTypeEnum.MediumPallet.ObjToInt())
+                    if (palletTypeInfo.LocaitonCount==2)
                     {
                         newTask.TaskType = TaskTypeEnum.MesPalletLargeReturn.ObjToInt();
                     }
@@ -633,10 +707,12 @@
                 };
                 string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
                 float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
-                if (MaterielCode != null && Quantity != null)
+                string BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo;
+                if (MaterielCode != null && Quantity != null && BatchNo != null)
                 {
                     newTask.MaterielCode = MaterielCode;
                     newTask.Quantity = Quantity;
+                    newTask.BatchNo = BatchNo;
                 }
                 if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt())
                 {
@@ -854,6 +930,7 @@
                     WarehouseId = warehouse.WarehouseId,
                     MaterielCode = mesLotInfo.Product,
                     Quantity = (float)mesLotInfo.Qty,
+                    BatchNo = mesLotInfo.LotNo
                 };
                 _unitOfWorkManage.BeginTran();
                 Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand();
@@ -966,7 +1043,9 @@
                     WarehouseId = warePoint.WarehouseId,
                     PalletType = proStockInfo.PalletType,
                     MaterielCode = proStockInfo.proStockInfoDetails?.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode,
-                    Quantity = (float)proStockInfo.proStockInfoDetails?.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty)
+                    Quantity = (float)proStockInfo.proStockInfoDetails?.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty),
+                    BatchNo = proStockInfo.proStockInfoDetails?.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.LotNumber
+                
                 };
                 _unitOfWorkManage.BeginTran();
                 int taskId = BaseDal.AddData(newTask);

--
Gitblit v1.9.3