From f2bc08e28dda7022202f07217f6a3c150f818af7 Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期一, 20 一月 2025 08:32:16 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/liudongl/jc24-wms

---
 Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs |  107 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 98 insertions(+), 9 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index 7a2a466..50a3dd7 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -21,6 +21,7 @@
 using WMS.Entity.SysEntity;
 using WMS.IBLL.IBllAsnServer;
 using WMS.Entity.BllQualityEntity;
+using WMS.Entity.BllCheckEntity;
 
 namespace WMS.BLL.BllAsnServer
 {
@@ -180,6 +181,7 @@
                 //鍒ゆ柇鎵樼洏缁戝畾淇℃伅涓槸鍚︽湁
                 var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == detail.Id && m.PalletNo == model.PalletNo && m.Status != "2");
                 var bindId = 0;
+                var boxQtyZong = model.Detail.Sum(m => m.Qty);
                 if (bind == null)
                 {
                     bind = new BllPalletBind
@@ -189,7 +191,7 @@
                         PalletNo = model.PalletNo,
                         PalletNo2 = "",
                         PalletNo3 = "",
-                        Qty = model.Qty,
+                        Qty = boxQtyZong,
                         FullQty = pNum,
                         Status = "0",//绛夊緟鎵ц
                         Type = model.Type, //鎵樼洏绫诲瀷  0鐗╂枡鎵�  1绌烘墭鐩樻墭
@@ -213,7 +215,8 @@
                 }
                 else
                 {
-                    throw new Exception("缁勭洏淇℃伅閲嶅");
+                    //throw new Exception("缁勭洏淇℃伅閲嶅");
+                    return;
                 }
 
 
@@ -316,8 +319,8 @@
                                 Standard = box.Standard,
                                 PackageStandard = box.PackageStandard,
                                 StoreTime = box.StoreTime,
-                                QtyCount = (int)box.QtyCount,
-                                QtyOrd = (int)box.QtyOrd,
+                                QtyCount = box.QtyCount.HasValue? (int)box.QtyCount : 0,
+                                QtyOrd = box.QtyOrd.HasValue ? (int)box.QtyOrd : 0,
                                 CreateUser = userId,
                                 CreateTime = comTime,
                             };
@@ -493,6 +496,7 @@
                     .GroupBy((a, b) => new
                     {
                         a.PalletNo,
+                        a.BindNo,
                         a.BoxNo,
                         a.SkuNo,
                         a.SkuName,
@@ -510,6 +514,7 @@
                     .Select((a, b) => new BoxInfoDto()
                     {
                         BoxNo = a.BoxNo,
+                        BindNo = a.BindNo,
                         PalletNo = a.PalletNo,
                         Qty = SqlFunc.AggregateSum(a.Qty),
                         FullQty = a.FullQty,
@@ -540,9 +545,10 @@
         /// <param name="boxNo">绠辩爜</param>
         /// <param name="boxNo3">鏀爜</param>
         /// <returns></returns>
-        public List<BoxInfoDto> GetBoxInfoByBoxNo(string boxNo, string boxNo3)
+        public List<BoxInfoDto> GetBoxInfoByBoxNo(string bindNo, string boxNo, string boxNo3)
         {
             Expression<Func<BllBoxInfo, bool>> item = Expressionable.Create<BllBoxInfo>()
+                .AndIF(!string.IsNullOrWhiteSpace(bindNo), it => it.BindNo == int.Parse(bindNo))
                 .AndIF(!string.IsNullOrWhiteSpace(boxNo), it => it.BoxNo == boxNo.Trim())
                 .AndIF(!string.IsNullOrWhiteSpace(boxNo3), it => it.BoxNo3.Contains(boxNo3.Trim()))
                 .And(m => m.IsDel == "0")
@@ -1181,7 +1187,7 @@
                             EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
                             EndRoadway = beingTask.EndRoadway, //  鐩爣宸烽亾
                             TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
-                            TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+                            TaskType = "0",// 浠诲姟绫诲瀷 (鍏ュ簱)
                             OutMode = "",  //鐩爣鍦板潃
                             Order = 1
                         };
@@ -1618,7 +1624,7 @@
 
 
 
-                var areaNoStr = "A03";
+                var areaNoStr = "A07";
                 var allotLocate = new AllotLocation();
                 
                 #region 鏍规嵁sku纭鍖哄煙鍒掑垎
@@ -1903,9 +1909,9 @@
                                 EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
                                 EndRoadway = beingTask.EndRoadway,                           //  鐩爣宸烽亾
                                 TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
-                                TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+                                TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)                            
                                 OutMode = "",  //鐩爣鍦板潃
-                                Order = 1
+                                Order = 1                                             
                             };
                             if (beingTask.IsSuccess == 0)
                             {
@@ -2522,6 +2528,7 @@
                                 SkuName = boxInfo.SkuName,
                                 Standard = sku.Standard,
                                 ProductionTime = boxInfo.ProductionTime,
+                                ExpirationTime = boxInfo.ExpirationTime,
                                 SupplierLot = boxInfo.SupplierLot,
                                 InspectStatus = boxInfo.InspectStatus,
                                 InspectMark = boxInfo.InspectMark,
@@ -2695,6 +2702,7 @@
                                     SkuName = demo.SkuName,
                                     Standard = noticeDetail.Standard,
                                     ProductionTime = demo.ProductionTime,
+                                    ExpirationTime = demo.ExpirationTime,
                                     SupplierLot = demo.SupplierLot,
                                     InspectStatus = demo.InspectStatus,
                                     InspectMark = demo.InspectMark,
@@ -3180,6 +3188,87 @@
         }
 
 
+        //鐢宠缂犺啘鍏ュ簱
+        public int RequestPackWcs(string palletNo)
+        {
+            try
+            {
+                int t = -1;
+                //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+                if (string.IsNullOrEmpty(palletNo))
+                {
+                    throw new Exception("鏈壘鍒拌鎵樼洏鏉$爜锛�"+ palletNo);
+                }
+                var palletBindList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Status == "1").OrderByDescending(m=>m.CreateTime).First();
+                if (palletBindList.IsBale == "1")
+                {
+                    t = 1;
+                }
+                return t;
+
+            }
+            catch  (Exception e)
+            {
+                throw new Exception(e.Message);
+
+            }
+        }
+
+        //鐢宠鎷嗚啘鍑哄簱
+        public int RequestUnPackWcs(string palletNo)
+        {
+            try
+            {
+                int t = -1;
+                //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+                if (string.IsNullOrEmpty(palletNo))
+                {
+                    throw new Exception("鏈壘鍒拌鎵樼洏鏉$爜锛�" + palletNo);
+                }
+                var palletBindList = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.LocatNo.Substring(0,1) != "B").First();
+                if (palletBindList.IsBale == "2")
+                {
+                    palletBindList.IsBale = "0";
+                    Db.Updateable(palletBindList).ExecuteCommand();
+                    t = 1;
+                }
+                
+                return t;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+
+            }
+        }
+
+        //缂犺啘瀹屾垚
+        public int RequestPackedWcs(string palletNo)
+        {
+            try
+            {
+                int t = -1;
+                //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+                if (string.IsNullOrEmpty(palletNo))
+                {
+                    throw new Exception("鏈壘鍒拌鎵樼洏鏉$爜锛�" + palletNo);
+                }
+                var palletBindList = Db.Queryable<BllPalletBind>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo && m.Status == "1").OrderByDescending(m => m.CreateTime).First();
+                if (palletBindList.IsBale == "1")
+                {
+                    palletBindList.IsBale = "2";
+                    Db.Updateable(palletBindList).ExecuteCommand();
+                    t = 1;
+                }
+                
+                return t;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+
+            }
+        }
 
         ////閲嶆柊涓嬪彂鍏ュ簱浠诲姟
         //public OutCommandDto AgainSendAsnTask(string taskNo, int userId, string url)

--
Gitblit v1.8.0