From 03214febb52b6e0f6f03248d3ef3cbe08967a116 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期五, 27 三月 2026 10:17:42 +0800
Subject: [PATCH]  1

---
 WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs |   72 +++++++++++++-----------------------
 1 files changed, 26 insertions(+), 46 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
index 5fbfda3..2d7c7d1 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -20,6 +20,7 @@
 using WIDESEA_Core.CodeConfigEnum;
 using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
+using WIDESEA_Core.Log;
 using WIDESEA_Core.Utilities;
 using WIDESEA_DTO;
 using WIDESEA_DTO.Basic;
@@ -110,7 +111,7 @@
                     {
                         string serialNumber = serialNumberObj?.ToString();
                         if (!string.IsNullOrEmpty(serialNumber))
-                        {
+                        { 
                             serialNumbers.Add(serialNumber);
                         }
                         else
@@ -322,7 +323,7 @@
                 decimal totalQuantity = stockInfo.Details.Sum(x => x.StockQuantity);
 
                 inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱涓�.ObjToInt();
-
+                                
                 _unitOfWorkManage.BeginTran();
                 if (stockInfo.Id == 0)
                 {
@@ -469,7 +470,8 @@
 
                     Dt_InboundOrderDetail notGroupDetail = new Dt_InboundOrderDetail();
 
-                    notGroupDetail = inboundOrder.Details.Where(x => x.OrderDetailStatus <= OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode == model.MaterielCode && x.BatchNo == model.LotNo).FirstOrDefault();
+                    notGroupDetail = inboundOrder.Details.Where(x => x.OrderDetailStatus <= OrderDetailStatusEnum.Inbounding.ObjToInt() && x.MaterielCode == model.MaterielCode && x.BatchNo == model.LotNo && x.OrderQuantity > x.ReceiptQuantity).FirstOrDefault();
+
                     if (notGroupDetail.MaterielType == 1)
                     {
                         stockInfo.WarehouseId = 6;
@@ -743,6 +745,8 @@
                             QtyOfpcs = item.QtyOfpcs,
                             QtyOfxout = item.QtyOfxout,
                             CPStockDetailStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨,
+                            LPNNO = item.LPNNO,
+                            OrinalLocation = item.OrinalLocation,
                             Creater = "涓婃父WMS",
                         };
                         stockInfoDetailCP.Add(stockInfoDetailCP1);
@@ -1136,6 +1140,7 @@
         #endregion
 
         public string ReceiveWMSTaskin = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTaskin"];
+
         /// <summary>
         /// 缁勭洏鍚堟墭
         /// </summary>
@@ -1295,7 +1300,7 @@
 
         public int GetPalletType(Dt_Warehouse warehouse, string palletCode)
         {
-            if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ObjToString())
+            if (warehouse.WarehouseCode.Contains("BC"))
             {
                 Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3));
                 if (palletTypeInfo == null)
@@ -1313,35 +1318,7 @@
                 }
                 return palletTypeInfo.PalletType;
             }
-
-            //else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString())
-            //{
-            //    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2));
-            //    if (palletTypeInfo == null)
-            //    {
-            //        throw new Exception($"鎵樼洏鍙烽敊璇�");
-            //    }
-            //    return palletTypeInfo.PalletType;
-            //}
-            //else if (warehouse.WarehouseCode == WarehouseEnum.HA57.ObjToString())
-            //{
-            //    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3));
-            //    if (palletTypeInfo == null)
-            //    {
-            //        throw new Exception($"鎵樼洏鍙烽敊璇�");
-            //    }
-            //    return palletTypeInfo.PalletType;
-            //}
-            //else if (warehouse.WarehouseCode == WarehouseEnum.HA58.ObjToString())
-            //{
-            //    Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2));
-            //    if (palletTypeInfo == null)
-            //    {
-            //        throw new Exception($"鎵樼洏鍙烽敊璇�");
-            //    }
-            //    return palletTypeInfo.PalletType;
-            //}
-            return -1;
+            return 0;
         }
         /// <summary>
         /// 鍒ゆ柇姝g‘鏃堕棿鏍煎紡
@@ -1415,10 +1392,6 @@
                     }
                     if (warehouse.WarehouseCode.Contains("CP"))
                     {
-                        if (item.SupplierBatch == null)
-                        {
-                            return content.Error("渚涘簲鍟嗘壒娆′笉鍙负绌�");
-                        }
                         Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First();
 
                         if (inboundOrderOld != null)
@@ -1450,6 +1423,8 @@
                                         QtyOfpcs = (float)list.QtyOfpcs,
                                         QtyOfxout = (float)list.QtyOfxout,
                                         CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
+                                        LPNNO = list.LPNNO,
+                                        OrinalLocation = list.OrinalLocation,
                                         Creater = "涓婃父WMS",
                                     };
                                     cPInboundOrderDetail.Add(cPInboundOrderDetail1);
@@ -1492,6 +1467,8 @@
                                     QtyOfpcs = (float)list.QtyOfpcs,
                                     QtyOfxout = (float)list.QtyOfxout,
                                     CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
+                                    LPNNO = list.LPNNO,
+                                    OrinalLocation = list.OrinalLocation,
                                     Creater = "涓婃父WMS",
                                 };
                                 cPInboundOrderDetail.Add(cPInboundOrderDetail1);
@@ -1514,7 +1491,6 @@
                                 OrinalLocation = item.OrinalLocation,
                                 CPDetails = cPInboundOrderDetail
                             };
-
                             Dt_InboundOrder inboundOrder = new Dt_InboundOrder()
                             {
                                 OrderNo = model.AsnNo,
@@ -1552,10 +1528,10 @@
                     }
                     else
                     {
-                        if (item.SupplierBatch == null)
-                        {
-                            return content.Error("渚涘簲鍟嗘壒娆′笉鍙负绌�");
-                        }
+                        //if (item.SupplierBatch == null)
+                        //{
+                        //    return content.Error("渚涘簲鍟嗘壒娆′笉鍙负绌�");
+                        //}
                         Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First();
 
                         if (inboundOrderOld != null)
@@ -1579,7 +1555,7 @@
                                 {
                                     OrderId = orderDetail1.OrderId,
                                     MaterielCode = item.MaterielCode,
-                                    MaterielType=item.MaterielType,
+                                    MaterielType = item.MaterielType,
                                     BatchNo = item.BatchNo,
                                     OrderQuantity = item.OrderQuantity,
                                     ReceiptQuantity = 0,
@@ -1751,6 +1727,7 @@
                     _inboundOrderDetailService.DeleteData(item);
                 }
                 BaseDal.DeleteData(oldOutboundOrder);
+                WriteLog.Write_Log("API", "SMOM鎺ㄩ�佸叆搴撳崟鎹彇娑�", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = oldOutboundOrder, 鎺ユ敹鎶ユ枃 = content });
                 content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
@@ -1775,11 +1752,11 @@
                 List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>();
                 if (string.IsNullOrEmpty(orderNo))
                 {
-                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10);
+                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 50);
                 }
                 else
                 {
-                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 10);
+                    dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 50);
                 }
 
                 content.OK(data: dt_ReceiveOrders);
@@ -1843,7 +1820,10 @@
                 };
                 _unitOfWorkManage.BeginTran();
                 Db.InsertNav(erpProScrapSheet).Include(x => x.Details).ExecuteCommand();
+                WriteLog.Write_Log("API", "erp鍗曟嵁涓嬪彂", "璇锋眰鎴愬姛", new { 璇锋眰鎶ユ枃 = erpProScrapSheet, 鎺ユ敹鎶ユ枃 = WebResponseContent.Instance.OK() });
+
                 _unitOfWorkManage.CommitTran();
+
                 return WebResponseContent.Instance.OK();
 
             }
@@ -1942,7 +1922,7 @@
         }
         //鍙嶆嫞鍥炲簱鍗�
         public WebResponseContent ReceiveReturnOrder(List<HouseReturnOrder> houseReturnOrder)
-       {
+        {
             try
             {
                 Random random = new Random();

--
Gitblit v1.9.3