From f4bb9bfee217eb0004ad121a6ad92065fc2acb4f Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 18 九月 2025 14:24:23 +0800
Subject: [PATCH] 修改PDA拣货出库功能,合并箱码盒码支码输入框

---
 Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs |   62 ++++++++++++++++++++++++++-----
 1 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
index e57b70b..6296674 100644
--- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -534,8 +534,17 @@
                 {
                     throw new Exception("鏈煡璇㈠埌鍗曟嵁鏄庣粏淇℃伅锛岃鏍稿疄");
                 }
+                var skuInfo = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == asnDetail.SkuNo);
+                if (skuInfo == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌鐗╂枡淇℃伅锛岃鏍稿疄");
+                }
+                if (string.IsNullOrEmpty(skuInfo.PackagNo))
+                {
+                    throw new Exception("鏈煡璇㈠埌鐗╂枡鐨勫寘瑁呬俊鎭紝璇锋牳瀹�");
+                }
 
-                var packInfo = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == asnDetail.PackagNo);
+                var packInfo = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == skuInfo.PackagNo);
                 if (packInfo == null)
                 {
                     throw new Exception("鏈煡璇㈠埌鍗曟嵁鏄庣粏涓殑鐗╂枡鍖呰淇℃伅");
@@ -610,8 +619,18 @@
                 {
                     throw new Exception("鏈煡璇㈠埌鍗曟嵁淇℃伅");
                 }
-
-                var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == asnList.PackagNo);
+                //鍖呰缂栫爜
+                var packagNo = asnList.PackagNo;
+                if (string.IsNullOrEmpty(packagNo))
+                {
+                    var skuInfo = Db.Queryable<SysMaterials>().First(w => w.IsDel == "0" && w.SkuNo == asnList.SkuNo);
+                    if (skuInfo == null)
+                    {
+                        throw new Exception("鏈煡璇㈠埌鐗╂枡淇℃伅");
+                    }
+                    packagNo = skuInfo.PackagNo;
+                }
+                var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == packagNo);
                 if (pack == null)
                 {
                     throw new Exception("鏈煡璇㈠埌褰撳墠鍗曟嵁涓墿鏂欑殑鍖呰淇℃伅");
@@ -771,7 +790,6 @@
                             maxBoxCode = maxBoxCode.Substring(0, maxBoxCode.Length-6) + (int.Parse(maxBoxCode.Substring(maxBoxCode.Length - 6, 6)) + 1).ToString().PadLeft(6, '0');
                         }
 
-                        DateTime? storeTime2 = null;
                         // 灏嗘潯鐮佷繚瀛樺埌鍘熸枡鏉$爜琛�
                         var labelModel = new BllBoxInfo()
                         {
@@ -791,14 +809,26 @@
                             BitBoxMark = bNum > boxQty ? "1" : "0",
                             InspectStatus = "0",
 
-                            ProductionTime = DateTime.Parse(productionTime),
-                            StoreTime = string.IsNullOrWhiteSpace(storeTime) ? storeTime2 : DateTime.Parse(storeTime ),
-                            ExpirationTime = DateTime.Parse(expirationTime),
+                            ProductionTime = null,
+                            StoreTime = null,
+                            ExpirationTime = null,
 
                             Origin = "WMS鐢熸垚",
                             CreateUser = userId,
                             CreateTime = DateTime.Now,
                         };
+                        if (!string.IsNullOrEmpty(productionTime))
+                        {
+                            labelModel.ProductionTime = DateTime.Parse(productionTime);
+                        }
+                        if (!string.IsNullOrEmpty(storeTime))
+                        {
+                            labelModel.StoreTime = DateTime.Parse(storeTime);
+                        }
+                        if (!string.IsNullOrEmpty(expirationTime))
+                        {
+                            labelModel.ExpirationTime = DateTime.Parse(expirationTime);
+                        }
 
                         Db.Insertable(labelModel).ExecuteCommand();
                         modelList.Add(labelModel);
@@ -943,14 +973,26 @@
                                 BitBoxMark = bNum > boxQty ? "1" : "0",
                                 InspectStatus = "0",
 
-                                ProductionTime = DateTime.Parse(productionTime),
-                                StoreTime = DateTime.Parse(storeTime),
-                                ExpirationTime = DateTime.Parse(expirationTime),
+                                ProductionTime = null,
+                                StoreTime = null,
+                                ExpirationTime = null,
 
                                 Origin = "WMS鐢熸垚",
                                 CreateUser = userId,
                                 CreateTime = DateTime.Now,
                             };
+                            if (!string.IsNullOrEmpty(productionTime))
+                            {
+                                labelModel.ProductionTime = DateTime.Parse(productionTime);
+                            }
+                            if (!string.IsNullOrEmpty(storeTime))
+                            {
+                                labelModel.StoreTime = DateTime.Parse(storeTime);
+                            }
+                            if (!string.IsNullOrEmpty(expirationTime))
+                            {
+                                labelModel.ExpirationTime = DateTime.Parse(expirationTime);
+                            }
 
                             Db.Insertable(labelModel).ExecuteCommand();
                             modelList.Add(labelModel);

--
Gitblit v1.8.0