From 5078a70f3972915dc887916e5c828b268671d004 Mon Sep 17 00:00:00 2001
From: Demo <Demo@DESKTOP-CPA90BF>
Date: 星期二, 19 三月 2024 18:54:16 +0800
Subject: [PATCH] 修改BUG问题

---
 Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs |    2 
 Wms/Wms/Controllers/PdaSoController.cs        |   30 +++++++
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs       |   56 ++++++++++---
 Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs       |   14 +++
 Pda/View/SoSetting/SampleOut.html             |  130 +++++++++++++++++++++-----------
 5 files changed, 172 insertions(+), 60 deletions(-)

diff --git a/Pda/View/SoSetting/SampleOut.html b/Pda/View/SoSetting/SampleOut.html
index fd4cac1..0daa6f8 100644
--- a/Pda/View/SoSetting/SampleOut.html
+++ b/Pda/View/SoSetting/SampleOut.html
@@ -1314,25 +1314,29 @@
                                 if (res.data == "0") {//搴撳唴鍙栨牱
                                     $('#kuneilabel2').show();
                                     $('#kuqianlabel2').hide();
+									updateBillList2();
+									// console.log($('#bar2').val())
+									if ($('#bar2').val() == "") {
+										console.log(1)
+										clear21();
+										return;
+									} else {
+										console.log(2)
+										updateSkuLotNoList2();
+										updateQtyList2();
+										getBar2();
+										GetDataInfo();
+									}
+									sampleType = "0";
                                 }
                                 if (res.data == "1") {//搴撳墠鍙栨牱
                                     $('#kuqianlabel2').show();
                                     $('#kuneilabel2').hide();
                                     updateAsnBillList2();
+									GetBoxInfo();
+                                    sampleType = "1";
                                 }
-                                // updateBillList2();
-                                // console.log($('#bar2').val())
-                                // if ($('#bar2').val() == "") {
-                                // 	console.log(1)
-                                // 	clear21();
-                                // 	return;
-                                // } else {
-                                // 	console.log(2)
-                                // 	updateSkuLotNoList2();
-                                // 	updateQtyList2();
-                                // 	getBar2();
-                                // 	GetDataInfo();
-                                // }
+                                
                             }else { //涓嶆垚鍔�
                                 layer.msg(res.msg, {
                                     icon: 2,
@@ -1532,33 +1536,60 @@
 			//鍗曟嫞璐э紙纭鎸夐挳锛�
 			form.on('submit(formPickScatter2)', function (data) {
 
-				if ($('#bar2').val() == "") {
-					layer.msg("璇烽�夋嫨鍑哄簱鍗�", {
-						icon: 2,
-						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-					}); return;
+				if (sampleType == "0") {
+					if ($('#bar2').val() == "") {
+						layer.msg("璇烽�夋嫨鍑哄簱鍗�", {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}); return;
+					}
+					if ($('#skuLotNo2').val() == "") {
+						layer.msg("璇烽�夋嫨鐗╂枡-鎵规", {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}); return;
+					}
+					if ($('#palletNo2').val() == "") {
+						layer.msg("璇疯緭鍏ユ墭鐩樼爜", {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}); return;
+					}			
+					let pickedQty = parseInt($('#pickedQty2').val()) //宸叉嫞鏁伴噺
+					let pickQty = parseInt($('#pickQty2').val())  //鎷h揣鏁伴噺
+					if (pickQty <= 0) {
+						layer.msg("鎷h揣鏁伴噺闇�澶т簬0", {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						});
+						return;
+					}
 				}
-				if ($('#skuLotNo2').val() == "") {
-					layer.msg("璇烽�夋嫨鐗╂枡-鎵规", {
-						icon: 2,
-						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-					}); return;
-				}
-				if ($('#palletNo2').val() == "") {
-					layer.msg("璇疯緭鍏ユ墭鐩樼爜", {
-						icon: 2,
-						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-					}); return;
-				}			
-				let pickedQty = parseInt($('#pickedQty2').val()) //宸叉嫞鏁伴噺
-				let pickQty = parseInt($('#pickQty2').val())  //鎷h揣鏁伴噺
-				if (pickQty <= 0) {
-					layer.msg("鎷h揣鏁伴噺闇�澶т簬0", {
-						icon: 2,
-						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-					});
-					return;
-				}
+				else if (sampleType == "1") {
+                    if ($('#AsnBar').val() == "") {
+                        layer.msg("璇烽�夋嫨鍏ュ簱鍗�", {
+                            icon: 2,
+                            time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        }); return;
+                    }
+					let pickedQty = parseInt($('#pickedQty2').val()) //宸叉嫞鏁伴噺
+					let pickQty = parseInt($('#pickQty2').val())  //鎷h揣鏁伴噺
+					if (pickQty <= 0) {
+						layer.msg("鎷h揣鏁伴噺闇�澶т簬0", {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						});
+						return;
+					}
+                }
+                else {
+                    layer.msg("绫诲瀷閿欒锛岃鍒锋柊椤甸潰閲嶈瘯", {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return;
+                }
+				
 
 				if (canPickBox == false) {
 
@@ -1576,24 +1607,35 @@
 
 			//纭鎷h揣 
 			function reqPickScatter2() {
+				canPickBox = false//鍥炶皟
 				var param = {
 					"SoNo": $("#bar2").val(),
 					"SoDetailId": $("#skuLotNo2").val(),
 					"PalletNo": $('#palletNo2').val(),
 					"PickQty": $('#pickQty2').val(),
+					"AsnNo":$('#AsnBar').val(),
+                    "Type":sampleType
 				}
-				sendData(IP + "/PdaSo/SoSetQtyPick", param, 'post', function (res) {
+				sendData(IP + "/PdaSo/SampleSoSetQtyPick", param, 'post', function (res) {
 					//console.log(res);
 					
 					if (res.code == 0) { //鎴愬姛
+						
 						layer.msg(res.msg, {
 							icon: 1,
 							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 						}, function () {
-							canPickBox = true//鍥炶皟
-							updateQtyList2();
-							getBar2();
-							GetDataInfo();
+							
+							if (sampleType == "0") {
+								canPickBox = true//鍥炶皟
+								updateQtyList2();
+								getBar2();
+								GetDataInfo();
+							}
+							if (sampleType == "1") {
+								canPickBox = true//鍥炶皟
+								GetDataInfo();
+							}
 						});
 					} else { //涓嶆垚鍔�
 						layer.msg(res.msg, {
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 3eaa00c..43a9406 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -309,7 +309,7 @@
                     throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍑哄簱鍗曟�诲崟淇℃伅锛岃鏍稿疄锛�");
                 }
                 //鍒嗛厤淇℃伅
-                var allot = Db.Queryable<BllExportAllot>().First(a => a.IsDel == "0" && a.SONo == notice.SONo && a.SODetailNo == noticeDetail.Id && a.PalletNo == palletNo && a.Status == "2" || a.Status == "3");
+                var allot = Db.Queryable<BllExportAllot>().First(a => a.IsDel == "0" && a.SONo == notice.SONo && a.SODetailNo == noticeDetail.Id && a.PalletNo == palletNo && (a.Status == "2" || a.Status == "3"));
                 if (allot == null)
                 {
                     throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍒嗛厤淇℃伅锛岃鏍稿疄锛�");
@@ -1541,7 +1541,7 @@
                         throw new Exception("鏈煡璇㈠埌璇ョ鐮佸強杩芥函鐮佺殑淇℃伅");
                     }
                     boxInfos = boxInfo.ToList();
-
+                    var comDetailList = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.ExportAllotId == allot2.Id && m.PalletNo == palletNo).ToList();
                     if (!string.IsNullOrWhiteSpace(boxNo3)) //鏁f敮鎷h揣
                     {
                         boxInfos = boxInfos.Where(m => m.BoxNo3 == boxNo3).ToList();
@@ -1559,7 +1559,13 @@
                         {
                             throw new Exception("璇ユ墭鐩樹笌绠辩爜娌℃湁缁戝畾鍏崇郴");
                         }
-
+                        foreach (var item in boxInfos)
+                        {
+                            if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3))
+                            {
+                                throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
+                            }
+                        }
                         biaoShi = "1";
                     }
                     else if (!string.IsNullOrEmpty(pickQty1) && int.Parse(pickQty1) > 0)//鏁伴噺鎷h揣
@@ -1586,17 +1592,23 @@
                         {
                             throw new Exception("璇ユ墭鐩樹笌绠辩爜娌℃湁缁戝畾鍏崇郴");
                         }
-                        
+                        foreach (var item in boxInfos)
+                        {
+                            if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo == item.BoxNo))
+                            {
+                                throw new Exception($"褰撳墠{item.BoxNo}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
+                            }
+                        }
                     }
                     var pickQty = 0;//鎷h揣鐨勬暟閲�
-                    var comDetailList = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.ExportAllotId == allot2.Id && m.PalletNo == palletNo).ToList();
+                    
                     var comList = new List<BllCompleteDetail>();
                     foreach (var item in boxInfos)
                     {
-                        if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3))
-                        {
-                            throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
-                        }
+                        //if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3))
+                        //{
+                        //    throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
+                        //}
                         //娣诲姞鎷h揣鏄庣粏
                         var completeDetail = new BllCompleteDetail()
                         {
@@ -1778,6 +1790,7 @@
                         throw new Exception("鏈煡璇㈠埌璇ョ鐮佸強杩芥函鐮佺殑淇℃伅");
                     }
                     boxInfos = boxInfo.ToList();
+                    var comDetailList = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.ExportAllotId == allot.Id && m.PalletNo == palletNo).ToList();
                     if (!string.IsNullOrWhiteSpace(boxNo3)) //鏁f敮鎷h揣
                     {
                         boxInfos = boxInfos.Where(m => m.BoxNo3 == boxNo3).ToList();
@@ -1800,7 +1813,13 @@
                         {
                             throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬鍓╀綑寰呮嫞鏁伴噺");
                         }
-
+                        foreach (var item in boxInfos)
+                        {
+                            if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3))
+                            {
+                                throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
+                            }
+                        }
                         biaoShi = "1";
                     }
                     else if (!string.IsNullOrEmpty(pickQty1) && int.Parse(pickQty1) > 0)//鏁伴噺鎷h揣
@@ -1836,16 +1855,23 @@
                         {
                             throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬绠卞唴鍓╀綑寰呮嫞鏁伴噺");
                         }
+                        foreach (var item in boxInfos)
+                        {
+                            if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo == item.BoxNo))
+                            {
+                                throw new Exception($"褰撳墠{item.BoxNo}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
+                            }
+                        }
                     }
                     var pickQty = 0;//鎷h揣鐨勬暟閲�
-                    var comDetailList = Db.Queryable<BllCompleteDetail>().Where(m => m.IsDel == "0" && m.ExportAllotId == allot.Id && m.PalletNo == palletNo).ToList();
+                   
                     var comList = new List<BllCompleteDetail>();
                     foreach (var item in boxInfos)
                     {
-                        if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3))
-                        {
-                            throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
-                        }
+                        //if (biaoShi != "2" && comDetailList.Any(m => m.BoxNo3 == item.BoxNo3))
+                        //{
+                        //    throw new Exception($"褰撳墠{item.BoxNo}涓瓄item.BoxNo3}宸叉嫞璐у畬鎴愶紝璇峰嬁閲嶅鎷h揣");
+                        //}
                         //娣诲姞鎷h揣鏄庣粏
                         var completeDetail = new BllCompleteDetail()
                         {
diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
index e40b61e..3209e53 100644
--- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
+++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -2838,7 +2838,7 @@
                         }
                         else
                         {
-                            stockDetail = stockDetail.Where(m => m.SkuNo == detail.SkuNo && m.IsDel == "0").ToList(); //&& string.IsNullOrWhiteSpace(m.LotNo)
+                            stockDetail = stockDetail.Where(m => m.SkuNo == detail.SkuNo && m.IsDel == "0" && string.IsNullOrWhiteSpace(m.LotNo)).ToList(); //
                         }
 
                         if (stockDetail.Count < 1)
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
index a1481b1..42dc995 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
@@ -144,5 +144,19 @@
         void SampleSoSetPick(string soType, string soNo, string soDetailId, string palletNo, string boxNo,
             string boxNo3, string pickQty1, string asnNo, int userId);
 
+        /// <summary>
+        ///  鍙栨牱鍑哄簱鎷h揣(鏃犳爣绛�)
+        /// </summary>
+        /// <param name="soType">鎷h揣绫诲瀷 0搴撳唴鍙栨牱锛屾湁鍑哄簱鍗曞強鍒嗛厤淇℃伅锛� 1搴撳墠鍙栨牱锛屽弽鍚戞坊鍔犲嚭搴撳崟鍙婂垎閰嶄俊鎭�</param>
+        /// <param name="soNo">鍑哄簱鍗�</param>
+        /// <param name="soDetailId">鍑哄簱鍗曟槑缁�</param>
+        /// <param name="palletNo">鎵樼洏鍙�</param>
+        /// <param name="PickQty">鎷h揣鏁伴噺</param>
+        /// <param name="asnNo">鍏ュ簱鍗�</param>
+        /// <param name="userId">鎿嶄綔浜篒D</param>
+        void SampleSoSetQtyPick(string soType, string soNo, string soDetailId, string palletNo, string PickQty,
+            string asnNo, int userId);
+
+
     }
 }
diff --git a/Wms/Wms/Controllers/PdaSoController.cs b/Wms/Wms/Controllers/PdaSoController.cs
index b357110..a122f87 100644
--- a/Wms/Wms/Controllers/PdaSoController.cs
+++ b/Wms/Wms/Controllers/PdaSoController.cs
@@ -425,7 +425,37 @@
             }
 
         }
+        /// <summary>
+        /// 鍙栨牱鍑哄簱鎷h揣(鏃犳爣绛�)
+        /// </summary>
+        /// <param name="model">SoDetailId:鍑哄簱鍗曟槑缁咺D銆丳alletNo:鎵樼洏鐮�</param> 
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SampleSoSetQtyPick(PdaSoVm model)
+        {
+            try
+            {
+                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                if (claimsIdentity == null)
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                if (string.IsNullOrWhiteSpace(userId))
+                {
+                    return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
 
+                _pdaSoSvc.SampleSoSetQtyPick(model.Type,model.SoNo, model.SoDetailId, model.PalletNo, model.PickQty, model.AsnNo, int.Parse(userId));
+
+                return Ok(new { code = 0, msg = "鎷h揣瀹屾垚", data = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
 
     }
 }

--
Gitblit v1.8.0