From 87a1c3fda0360a3890f36eebf4fefb8b0621e61e Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 12 十一月 2025 08:00:11 +0800
Subject: [PATCH] 处理同托盘再次绑定同物料批次不增加库存问题;修改同物料批次拣货异常问题

---
 HTML/js/public.js                        |    4 +-
 Wms/Wms/appsettings.json                 |    8 ++--
 HTML/views/home/console2.html            |    4 +-
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs  |   32 +++++++++-------
 Pda/js/public.js                         |    4 +-
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs |   37 +++++++-----------
 Wms/WMS.BLL/DataServer/StockServer.cs    |    4 +-
 7 files changed, 44 insertions(+), 49 deletions(-)

diff --git a/HTML/js/public.js b/HTML/js/public.js
index 480c11d..5290464 100644
--- a/HTML/js/public.js
+++ b/HTML/js/public.js
@@ -7,9 +7,9 @@
 //var IP = "http://192.168.1.226:8086";  
 //var IP = "http://192.168.62.200:8888/api";//bkl鏈嶅姟鍣�
 //杩愯
-//var IP="https://localhost:44363/api";
+var IP="https://localhost:44363/api";
 //鏈湴鍙戝竷
-var IP="http://localhost:8034/api";
+//var IP="http://localhost:8034/api";
 
 
 
diff --git a/HTML/views/home/console2.html b/HTML/views/home/console2.html
index c71b123..a776257 100644
--- a/HTML/views/home/console2.html
+++ b/HTML/views/home/console2.html
@@ -231,7 +231,7 @@
             <!-- 宸� -->
             <div class="layui-col-md4" style="height: 100%;margin-top: 10px;">
                 <div class="layui-card" style="height: 100%;border-radius: 15px;box-shadow: 0px 0px 10px 1px #a4a3a3;">
-                    <div style="width: 100%;height: 23.33%;">
+                    <!-- <div style="width: 100%;height: 23.33%;">
                         <div class="layui-card-header">
                             <img src="../../img/console/xiexian.png" style="height: 20px;">
                             绯荤粺鐩戞帶
@@ -263,7 +263,7 @@
                                 <label style="font-size: 32px;color: #009688;">109</label>
                             </div>
                         </div>
-                    </div>
+                    </div> -->
                     <div style="width: 100%;height: 38.33%;">
                         <div class="layui-card-header">
                             <img src="../../img/console/xiexian.png" style="height: 20px;">
diff --git a/Pda/js/public.js b/Pda/js/public.js
index 1abbbf9..034868a 100644
--- a/Pda/js/public.js
+++ b/Pda/js/public.js
@@ -7,9 +7,9 @@
 //var IP = "http://192.168.1.226:8086";
 //var IP = "http://192.168.62.200:8888/api";  
 //杩愯
-//var IP = "https://localhost:44363/api";
+var IP = "https://localhost:44363/api";
 //鏈湴鍙戝竷
-var IP = "http://localhost:8034/api";
+//var IP = "http://localhost:8034/api";
 
 
 
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index f0caa6c..2bbd99e 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -274,19 +274,8 @@
                     // 鍒ゆ柇搴撳瓨鏄庣粏鏄惁宸叉湁姝ゆ墭鐩樹俊鎭�  
                     var sd1 = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo && m.LotNo == detail.LotNo && m.SkuNo == detail.SkuNo);// && m.ASNDetailNo == bind.ASNDetailNo
                     var sdId1 = 0;
-                    if (sd1 != null)
+                    if (sd1 == null)
                     {
-                        sdId1 = sd1.Id;
-                        // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
-                        sd1.Qty += bind.Qty;
-                        sd1.CompleteTime = comTime;
-                        sd1.UpdateUser = userId;
-                        sd1.UpdateTime = comTime;
-
-                        Db.Updateable(sd1).ExecuteCommand();
-                    }
-                    else
-                    {                        
                         // 搴撳瓨涓嶅瓨鍦� 鎻掑叆鏁版嵁
                         sd1 = new DataStockDetail()
                         {
@@ -296,7 +285,7 @@
                             SkuNo = sku.SkuNo,
                             SkuName = sku.SkuName,
                             Standard = sku.Standard,
-                            Qty = bind.Qty,
+                            Qty = 0,
                             LockQty = 0,
                             FrozenQty = 0,
                             InspectQty = 0,
@@ -317,7 +306,7 @@
                             InspectMark = bind.InspectMark,
                             InspectStatus = sku.IsInspect,
                             BitPalletMark = bind.BitPalletMark,
-                            PackagNo = sku.PackagNo,                    
+                            PackagNo = sku.PackagNo,
                             IsBale = bind.IsBale,
                             IsBelt = bind.IsBelt,
 
@@ -358,20 +347,19 @@
                             //淇敼鍚堟牸涓嶅悎鏍兼暟閲�
                             if (quality.IsQualified == "1") //鍚堟牸
                             {
-                                //澧炲姞鍚堟牸鏁伴噺
-                                quality.PassQty += bind.Qty;
                                 sd1.InspectStatus = "1";
                             }
                             else if (quality.IsQualified == "0") //涓嶅悎鏍�
                             {
-                                //澧炲姞涓嶅悎鏍兼暟閲�
-                                quality.FailQty += bind.Qty;
                                 sd1.InspectStatus = "2";
                             }
-                            Db.Updateable(quality).ExecuteCommand(); //淇敼璐ㄦ淇℃伅
                         }
                         //娣诲姞搴撳瓨鏄庣粏
                         sdId1 = Db.Insertable(sd1).ExecuteReturnIdentity();
+                    }
+                    else
+                    {
+                        sdId1 = sd1.Id;
                     }
                     #endregion
 
@@ -524,10 +512,13 @@
                     #endregion
 
                     #region 搴撳瓨鏄庣粏
-                    if (sd1.Qty <= 0)
-                    {
-                        sd1.Qty = bind.Qty;
-                    }
+                    
+                    // 搴撳瓨宸插瓨鍦� 鏇存柊鏁版嵁
+                    sd1.Qty += bind.Qty;
+                    sd1.CompleteTime = comTime;
+                    sd1.UpdateUser = userId;
+                    sd1.UpdateTime = comTime;
+
                     //鏇存敼搴撳瓨鏄庣粏鏁伴噺
                     Db.Updateable(sd1).Where(m => m.Id == sdId1).ExecuteCommand();
                     #endregion
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index bf46865..76aa178 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -446,22 +446,26 @@
                         var locateStr = stockDetail.LocatNo;
                         await Db.Deleteable(stockDetail).ExecuteCommandAsync();
 
-                        //鏀瑰彉鎵樼洏鐘舵��
-                        var pallet = await Db.Queryable<SysPallets>().FirstAsync(m => m.PalletNo == palletNo && m.IsDel == "0");
-                        if (pallet == null)
+                        var detailOther = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.PalletNo == stockDetail.PalletNo && w.Id != stockDetail.Id).ToList();
+                        if (detailOther.Count <= 0)
                         {
-                            throw Oops.Bah("鏈湪鎵樼洏琛ㄤ腑鏌ヨ鍒版墭鐩樹俊鎭�");
-                        }
-                        pallet.Status = "0";
-                        await Db.Updateable(pallet).ExecuteCommandAsync();
+                            //鏀瑰彉鎵樼洏鐘舵��
+                            var pallet = await Db.Queryable<SysPallets>().FirstAsync(m => m.PalletNo == palletNo && m.IsDel == "0");
+                            if (pallet == null)
+                            {
+                                throw Oops.Bah("鏈湪鎵樼洏琛ㄤ腑鏌ヨ鍒版墭鐩樹俊鎭�");
+                            }
+                            pallet.Status = "0";
+                            await Db.Updateable(pallet).ExecuteCommandAsync();
 
-                        //鏇存敼鍌ㄤ綅鐘舵�佷负绌哄偍浣�
-                        var locate = Db.Queryable<SysStorageLocat>().First(m => m.IsDel == "0" && m.LocatNo == locateStr);
-                        if (locate != null)
-                        {
-                            locate.Status = "0";
-                            Db.Updateable(locate).ExecuteCommand();
-                        }
+                            //鏇存敼鍌ㄤ綅鐘舵�佷负绌哄偍浣�
+                            var locate = Db.Queryable<SysStorageLocat>().First(m => m.IsDel == "0" && m.LocatNo == locateStr);
+                            if (locate != null)
+                            {
+                                locate.Status = "0";
+                                Db.Updateable(locate).ExecuteCommand();
+                            }
+                        }                        
                     }
                     else
                     {
diff --git a/Wms/WMS.BLL/DataServer/StockServer.cs b/Wms/WMS.BLL/DataServer/StockServer.cs
index 093a005..f3c181a 100644
--- a/Wms/WMS.BLL/DataServer/StockServer.cs
+++ b/Wms/WMS.BLL/DataServer/StockServer.cs
@@ -164,8 +164,8 @@
         {
             string stockUseSql = $@"select a.Id,a.WareHouseNo,a.WareHouseName,b.num as stockNum,c.num as useNum
 	from SysWareHouse a
-	left join (select WareHouseNo,count(Id) as num from SysStorageLocat where IsDel='0' group by WareHouseNo) b on b.WareHouseNo=a.WareHouseNo
-	left join (select WareHouseNo,count(Id) as num from SysStorageLocat where IsDel='0' and Status='1' group by WareHouseNo) c on c.WareHouseNo=a.WareHouseNo
+	left join (select WareHouseNo,count(Id) as num from SysStorageLocat where IsDel='0' and Make=1 group by WareHouseNo) b on b.WareHouseNo=a.WareHouseNo 
+	left join (select WareHouseNo,count(Id) as num from SysStorageLocat where IsDel='0' and Make=1 and Status='1' group by WareHouseNo) c on c.WareHouseNo=a.WareHouseNo
 	where a.IsDel='0'
 	order by a.WareHouseNo";
             DataTable stockUseDt = Db.Ado.GetDataTable(stockUseSql);
diff --git a/Wms/Wms/appsettings.json b/Wms/Wms/appsettings.json
index 00d8855..5d08764 100644
--- a/Wms/Wms/appsettings.json
+++ b/Wms/Wms/appsettings.json
@@ -15,9 +15,9 @@
     //"ConnectionString": "Server=192.168.62.200;Database=WMS_JC34;User ID=sa;Password=sql2019;Integrated Security=False;"
     //"ConnectionString": "Server=.;Database=WMS_JC09;User ID=sa;Password=sql2019;Integrated Security=False;"
     //"ConnectionString": "Data Source=DESKTOP-0EJDG95\\MSSQLSERVER1;Initial Catalog=WMS_V01;Integrated Security=True;"
-    //"ConnectionString": "Server=.\\MSSQLSERVER2019;Database=WMS_JC34;User ID=sa;Password=admin2023@;Integrated Security=False;",
+    "ConnectionString": "Server=.\\MSSQLSERVER2019;Database=WMS_JC34;User ID=sa;Password=admin2023@;Integrated Security=False;",
     //鏈湴鍦板潃
-    "ConnectionString": "Server=localhost;Database=WMS_JC34;User ID=sa;Password=root1234;Integrated Security=False;"
+    //"ConnectionString": "Server=localhost;Database=WMS_JC34;User ID=sa;Password=root1234;Integrated Security=False;"
   },
   "JWTConfig": {
     "Issuer": "WYY", //Token      
@@ -54,9 +54,9 @@
   },
   "Quartz": {
     "dbProviderName": "SqlServer",
-    //"ConnectionString": "Server=.\\MSSQLSERVER2019;Database=QRTZ;User ID=sa;Password=admin2023@;Integrated Security=False;"
+    "ConnectionString": "Server=.\\MSSQLSERVER2019;Database=QRTZ;User ID=sa;Password=admin2023@;Integrated Security=False;"
     //鏈湴鍦板潃
-    "ConnectionString": "Server=localhost;Database=WMS_JC34QRTZ;User ID=sa;Password=root1234;Integrated Security=False;"
+    //"ConnectionString": "Server=localhost;Database=WMS_JC34QRTZ;User ID=sa;Password=root1234;Integrated Security=False;"
     //"connectionString": "Server=192.168.62.200;Database=WMS_JC34QRTZ;User ID=sa;Password=sql2019;Integrated Security=False;"
     //"connectionString": "Server=10.26.200.29;Database=WMS_JC34QRTZ;User ID=sa;Password=boxline@2016;Integrated Security=False;"
   }

--
Gitblit v1.8.0