From 38d24bdd00d8dd9e416fc5988831ec4b62e696ca Mon Sep 17 00:00:00 2001
From: yuyou_x <2336760928@qq.com>
Date: 星期三, 06 三月 2024 09:39:30 +0800
Subject: [PATCH] 合并数据

---
 Pda/View/SoSetting/productOut.html      |  173 +++++++++++++++++--
 HTML/views/SOSetting/ComBoxInfo.html    |    1 
 Wms/Wms/Controllers/PdaSoController.cs  |   54 +++++
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs |  265 ++++++++++++++++++++++++++++-
 Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs |   12 +
 5 files changed, 471 insertions(+), 34 deletions(-)

diff --git a/HTML/views/SOSetting/ComBoxInfo.html b/HTML/views/SOSetting/ComBoxInfo.html
index e127a6b..187ee4d 100644
--- a/HTML/views/SOSetting/ComBoxInfo.html
+++ b/HTML/views/SOSetting/ComBoxInfo.html
@@ -97,6 +97,7 @@
                 // 琛ㄥ崟闇�瑕佺殑鍙橀噺
 				var infoOptions = {
 					elem: '#LAY-app-content-list',
+					// height: h1,
 					height: 'full-100',
 					id: 'LAY-app-content-list',
 					page: true,
diff --git a/Pda/View/SoSetting/productOut.html b/Pda/View/SoSetting/productOut.html
index dbc2b7b..78e1a8b 100644
--- a/Pda/View/SoSetting/productOut.html
+++ b/Pda/View/SoSetting/productOut.html
@@ -471,14 +471,14 @@
 							</div>
 						</div>
 						<div class="layui-form-item layout-input" style="display: flex; justify-content: space-between;">
-							<div style="width: 48%;">
+							<div style="width: 49%;">
 								<label class="layui-form-label" style="width: 34%;">鍑哄簱鍙o細</label>
-								<div class="layui-input-block" style="width: 66%;margin-left:34%;">
+								<div class="layui-input-block" style="width: 62%;margin-left:34%;">
 									<input id="outModel2" type="text" lay-verify="" disabled placeholder=""
 										class="layui-input" > <!-- style="border: 0px;" -->
 								</div>
 							</div>
-							<div style="width: 48%;">
+							<div style="width: 49%;">
 								<label class="layui-form-label" style="width: 70px;">宸叉嫞鏁伴噺锛�</label>
 								<div class="layui-input-block" style="width: 120px; margin-left:70px;">
 									<input id="pickedQty2" type="text" lay-verify="" disabled
@@ -519,8 +519,8 @@
 				</div>
 
 				<div class="layout-tbl-paging" id="">
-					<table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding="">
-						<tr id="tableHead">
+					<table id="tableBoxList2" class="tbl-box-list" border="" cellspacing="" cellpadding="">
+						<tr id="tableHead2">
 							<th style="width: 54%;">鐗╂枡缂栫爜</th>
 							<th style="width: 20%;">鎵樺唴<br>鏁伴噺</th>
 							<th style="width: 20%;">宸叉嫞<br>鏁伴噺</th>
@@ -528,9 +528,9 @@
 							<!-- <th style="width: 8%;">鎷h揣</th> -->
 						</tr>
 						<tr id="boxCell2" style="display: none;">
-							<td name="SkuNo2">AG000001</td> 
-							<td name="qty2">30</td>
-							<td name="pickedQty2">30</td> 
+							<td name="SkuNo">AG000001</td> 
+							<td name="Qty">30</td>
+							<td name="pickedQty">30</td> 
 						</tr>
 					</table>
 
@@ -600,6 +600,7 @@
 			//鏄惁鏁存墭鎷h揣
 			var isContinue = "0";
 			var tableData = null
+			var tableData2 = null
 			var canPickBox = true
 			$("#palletNo").focus();//鍏夋爣榛樿閫変腑		
 
@@ -1191,14 +1192,17 @@
 				synData(IP + "/PdaSo/IsEnableOkPalletNo", param, 'post', function (res) {
 					if (res.code == 0) { //鎴愬姛 
 						updateBillList2();
-						if ($('#bar').val() == "") {
+						console.log($('#bar2').val())
+						if ($('#bar2').val() == "") {
+							console.log(1)
 							clear21();
 							return;
 						} else {
+							console.log(2)
 							updateSkuLotNoList2();
 							updateQtyList2();
 							getBar2();
-							GetBoxInfo();
+							GetDataInfo();
 						}
 
 					} else { //涓嶆垚鍔�
@@ -1250,10 +1254,20 @@
 					if (res.code == 0) { //鎴愬姛
 						for (var i = 0; i < res.data.length; i++) {
 							if (i == 0) {
-								$("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + ' selected>' + res.data[i].SkuName + " - " + res.data[i].LotNo + '</option>');
+								$("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + ' selected>' + res.data[i].SkuName);
+									if(res.data[i].LotNo == null)
+									{
+										$("#skuLotNo2").append(" - " + res.data[i].LotNo);
+									}
+								$("#skuLotNo2").append('</option>');
 
 							} else {
-								$("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + '>' + res.data[i].SkuName + " - " + res.data[i].LotNo + '</option>');
+								$("#skuLotNo2").append('<option value =' + res.data[i].SoDetailId + '>' + res.data[i].SkuName);
+									if(res.data[i].LotNo == null)
+									{
+										$("#skuLotNo2").append(" - " + res.data[i].LotNo);
+									}
+								$("#skuLotNo2").append('</option>');
 							}
 						}
 						form.render('select');
@@ -1302,7 +1316,7 @@
 						$('#outModel2').val(res.data.OutModel);
 						$('#standard2').val(res.data.Standard);
 
-						$('#pickQty2').val(res.data.PickQty);
+						$('#pickQty2').val(res.data.PickQty - res.data.PickedQty);
 						$('#pickedQty2').val(res.data.PickedQty);
 					} else { //涓嶆垚鍔�
 						layer.msg(res.msg, {
@@ -1315,18 +1329,17 @@
 			}
 
 			//鑾峰彇鎵樼洏鐗╂枡鍚嶇粏
-			function GetBoxInfo() { 
+			function GetDataInfo() { 
 				let param2 = {
 					"SoDetailId": $("#skuLotNo2").val(),
 					"PalletNo": $("#palletNo2").val(),
-					"BoxNo": $("#boxNo").val(),
-					"BoxNo3": $("#boxNo3").val(),
 				}
-				synData(IP + "/PdaSo/GetDataComBoxInfo", param2, 'post', function (res) {
+				console.log(param2);
+				synData(IP + "/PdaSo/GetAllotPlnInfo", param2, 'post', function (res) {
 					if (res.code == 0) {
-						tableData = deepCopy(res.data)
+						tableData2 = deepCopy(res.data)
 
-						refreshTable(tableData)
+						refreshTable2(tableData2)
 					} else {
 						layer.msg(res.msg, {
 							icon: 2,
@@ -1336,6 +1349,128 @@
 				});
 			}
 
+			//娓叉煋琛ㄦ牸鏁版嵁				
+			function refreshTable2(list) {
+				//鍏堟竻绌轰竴涓嬩俊鎭垪琛�
+				let trs = $("#tableBoxList2 tr")
+				let len = trs.length
+				//console.log("tr 鏁伴噺 + " + trs.length)
+				for (i = len - 1; i >= 2; i--) {
+					trs[i].remove();
+				}
+
+				console.log(list != null);
+				console.log(list);
+				if (list != null && list.length > 0) { //鎴愬姛
+
+					var arrTrs = new Array()
+					let idx = 0
+					for (var i in list) {
+						// list[i].BoxCode
+						var tr = $("#boxCell2").eq(0).clone();
+						tr.appendTo("#tableBoxList2");
+						// tr.attr('id', list[i].BoxCode)
+						idx++;
+						tr.attr('index', idx)
+						// tr.find("td[name='skuNo']").attr('style', 'max-width:90px;');
+						// tr.find("td[name='skuName']").attr('style', 'max-width:120px;');
+						tr.find("td[name='SkuNo']").html(list[i].BoxNo); 
+						tr.find("td[name='Qty']").html(list[i].Qty);
+						tr.find("td[name='pickedQty']").html(list[i].PickedQty);
+
+						tr.show();
+						arrTrs[i] = tr
+					}
+					setPages(1, list.length)
+					canPickBox = true
+
+				} else { //涓嶆垚鍔�
+					layer.msg("鏃犳暟鎹�", {
+						icon: 2,
+						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+					}, function () { });
+					// $("#boxNum").val(0)
+					setPages(1, 0)
+				}
+			}
+
+			//鍗曟嫞璐э紙纭鎸夐挳锛�
+			form.on('submit(formPickScatter2)', function (data) {
+
+				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 (canPickBox == false) {
+
+					layer.msg("璇锋眰鏈畬鎴愶紝涓嶈閲嶅璇锋眰", {
+						icon: 2,
+						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+					});
+					return;
+				}
+
+				reqPickScatter2()
+
+				return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆�
+			});
+
+			//纭鎷h揣 
+			function reqPickScatter2() {
+				var param = {
+					"SoNo": $("#bar2").val(),
+					"SoDetailId": $("#skuLotNo2").val(),
+					"PalletNo": $('#palletNo2').val(),
+					"PickQty": $('#pickQty2').val(),
+				}
+				sendData(IP + "/PdaSo/SoSetQtyPick", 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();
+						});
+					} else { //涓嶆垚鍔�
+						layer.msg(res.msg, {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}, function () {
+							canPickBox = true;//鍥炶皟
+						});
+					}
+				});
+			}
+
 
 		})
 	</script>
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index 3b6a538..a2bdd98 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -243,7 +243,7 @@
                             foreach (var demo in list)
                             {
                                 var com = comInfo.FirstOrDefault(m => m.IsDel == "0" && m.BoxNo3 == demo.BoxNo);
-                                if (com!=null)
+                                if (com != null)
                                 {
                                     demo.PickedQty = com.CompleteQty;
                                 }
@@ -279,10 +279,62 @@
         }
 
         //鑾峰彇搴撳唴鏃犵鐮佺殑鎵樼洏鍒嗛厤淇℃伅
-        public List<OutPdaInfo> GetAllotPlnInfo(string soDetailId, string palletNo)
+        public List<BoxInfo> GetAllotPlnInfo(string soDetailId, string palletNo)
         {
             try
             {
+                #region 鍒ゆ柇
+
+                //鏍规嵁id鍙婃墭鐩樿幏鍙栧嚭搴撳崟鍜屾墭鐩樻嫞璐т俊鎭�
+                if (string.IsNullOrWhiteSpace(palletNo))
+                {
+                    throw new Exception("鎵樼洏鍙蜂笉鑳戒负绌�");
+                }
+                //鑾峰彇瀵瑰簲鎵樼洏涓嬫槸鍚﹀瓨鍦ㄧ鐮佷俊鎭�
+                var boxInfo = Db.Queryable<DataBoxInfo>().First(b => b.IsDel == "0" && b.PalletNo == palletNo);
+                if (boxInfo != null)
+                {
+                    throw new Exception($"{palletNo}鎵樼洏涓婂瓨鍦ㄧ鐮佷俊鎭紝鏃犳硶鍦ㄦ暟閲忔嫞璐ц繘琛屾搷浣滐紒");
+                }
+                //鍑哄簱鍗曟槑缁�
+                var noticeDetail = Db.Queryable<BllExportNoticeDetail>().First(a => a.Id == int.Parse(soDetailId) && a.IsDel == "0");
+                if (noticeDetail == null)
+                {
+                    throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍑哄簱鍗曟槑缁嗕俊鎭紝璇锋牳瀹烇紒");
+                }
+                //鍑哄簱鍗曟�诲崟
+                var notice = Db.Queryable<BllExportNotice>().First(a => a.IsDel == "0" && a.SONo == noticeDetail.SONo);
+                if (notice == null)
+                {
+                    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");
+                if (allot == null)
+                {
+                    throw new Exception($"鏈煡璇㈠埌瀵瑰簲鍒嗛厤淇℃伅锛岃鏍稿疄锛�");
+                }
+                //搴撳瓨鏄庣粏
+                var detail = Db.Queryable<DataStockDetail>().First(a => a.IsDel == "0" && a.PalletNo == palletNo);
+                if (detail == null)
+                {
+                    throw new Exception($"鏈煡璇㈠埌搴撳瓨鏄庣粏淇℃伅锛岃鏍稿疄锛�");
+                }
+
+                #endregion
+
+                List<BoxInfo> pdaInfo = new List<BoxInfo>();
+
+                BoxInfo info = new BoxInfo()
+                {
+                    SkuNo = detail.SkuNo,
+                    BoxNo = detail.SkuNo,
+                    Qty = (int)allot.Qty,
+                    PickedQty = (int)allot.CompleteQty,
+                };
+
+                pdaInfo.Add(info);
+                return pdaInfo;
 
             }
             catch (Exception e)
@@ -312,7 +364,7 @@
                 {
                     throw new Exception("鎵樼洏鐮佷笉鑳戒负绌�");
                 }
-                
+
                 //鍑哄簱鍗�
                 var notice = Db.Queryable<BllExportNotice>().First(m => m.IsDel == "0" && m.SONo == soNo);
                 if (notice == null)
@@ -413,7 +465,7 @@
                     Db.Insertable(comList).ExecuteCommand();
                     //淇敼鍑哄簱鍒嗛厤淇℃伅
                     allot.CompleteQty += pickQty;
-                    allot.Status = allot.Qty == allot.CompleteQty ? "5" : "3";                    
+                    allot.Status = allot.Qty == allot.CompleteQty ? "5" : "3";
                     Db.Updateable(allot).ExecuteCommand();
                     //鍒犻櫎搴撳瓨鏄庣粏
                     Db.Deleteable(stockDetail).ExecuteCommand();
@@ -627,6 +679,193 @@
             }
         }
 
+        //鍑哄簱pda鎷h揣
+        public void SoSetQtyPick(string soNo, string soDetailId, string palletNo, string PickQty, int userId)
+        {
+            Db.BeginTran();
+            try
+            {
+                #region 鍒ゆ柇
+
+                if (string.IsNullOrWhiteSpace(soNo))
+                {
+                    throw new Exception("鍑哄簱鍗曟嵁涓嶈兘涓虹┖");
+                }
+                //if (string.IsNullOrWhiteSpace(soDetailId))
+                //{
+                //    throw new Exception("鍑哄簱鐗╂枡-鎵规涓嶈兘涓虹┖");
+                //}
+                if (string.IsNullOrWhiteSpace(palletNo))
+                {
+                    throw new Exception("鎵樼洏鐮佷笉鑳戒负绌�");
+                }
+
+                //鍑哄簱鍗�
+                var notice = Db.Queryable<BllExportNotice>().First(m => m.IsDel == "0" && m.SONo == soNo);
+                if (notice == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ュ嚭搴撳崟鐨勪俊鎭�");
+                }
+                if (notice.Status != "3")
+                {
+                    throw new Exception("鍑哄簱鍗曠殑鐘舵�佷笉鏄鍦ㄦ墽琛岋紝涓嶈兘鎷h揣");
+                }
+                //鍑哄簱鍗曟槑缁�
+                var noticeDetail = Db.Queryable<BllExportNoticeDetail>()
+                    .First(m => m.IsDel == "0" && m.Id == int.Parse(soDetailId));
+                if (noticeDetail == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ュ嚭搴撳崟鏄庣粏鐨勪俊鎭�");
+                }
+                //鍑哄簱鍒嗛厤淇℃伅
+                var allot = Db.Queryable<BllExportAllot>().First(m =>
+                    m.IsDel == "0" && (m.Status == "2" || m.Status == "3") && m.SONo == soNo &&
+                    m.SODetailNo == int.Parse(soDetailId) && m.PalletNo == palletNo);
+                if (allot == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樼殑鍒嗛厤淇℃伅");
+                }
+                //鍓╀綑鎷h揣鏁伴噺锛堝緟鎷e噺鍘诲凡鎷o級
+                var needQty = allot.Qty - allot.CompleteQty;
+                if (int.Parse(PickQty) > needQty)
+                {
+                    throw new Exception("鎷h揣鏁伴噺涓嶈兘澶т簬鎵樺唴鍓╀綑寰呮嫞鏁伴噺");
+                }
+
+                //搴撳瓨鏄庣粏
+                var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.Id == allot.StockId);
+                if (stockDetail == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樺垎閰嶇殑搴撳瓨鏄庣粏淇℃伅锛�");
+                }
+                //搴撳瓨鎬昏〃
+                var stock = Db.Queryable<DataStock>().First(a => a.IsDel == "0" && a.SkuNo == stockDetail.SkuNo && a.LotNo == stockDetail.LotNo);
+                if (stock == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌璇ユ墭鐩樺垎閰嶇殑搴撳瓨淇℃伅锛�");
+                }
+                #endregion
+                //鑾峰彇褰撳墠鎵樼洏鎷h揣鏄庣粏
+                var complete = Db.Queryable<BllCompleteDetail>().First(a => a.IsDel == "0" && a.PalletNo == palletNo && a.SONo == notice.SONo && a.SODetailNo == noticeDetail.Id && a.ExportAllotId == allot.Id && a.StockId == stockDetail.Id);
+
+                //鍒よ鏄惁瀛樺湪鎷h揣鏄庣粏
+                int isComplete = 0;
+                if (complete != null)
+                {
+                    isComplete = 1;
+                }
+
+                var comList = new List<BllCompleteDetail>();
+                //鍒ゆ柇鏄惁瀛樺湪鎷h揣鏄庣粏
+                if (isComplete == 0)
+                {
+                    //娣诲姞鎷h揣鏄庣粏
+                    var completeDetail = new BllCompleteDetail()
+                    {
+                        SONo = soNo,
+                        SODetailNo = int.Parse(soDetailId),
+                        ExportAllotId = allot.Id,
+                        StockId = allot.StockId,
+                        BoxNo = "",
+                        BoxNo2 = "",
+                        BoxNo3 = "",
+
+                        LotNo = allot.LotNo,
+                        LotText = allot.LotText,
+                        SupplierLot = allot.SupplierLot,
+                        SkuNo = allot.SkuNo,
+                        SkuName = allot.SkuName,
+                        Standard = allot.Standard,
+                        PalletNo = palletNo,
+                        CompleteQty = int.Parse(PickQty),
+
+                        CreateUser = userId,
+                        CreateTime = Db.GetDate(),
+                    };
+                    comList.Add(completeDetail);
+
+                    //娣诲姞鎷h揣鏄庣粏
+                    Db.Insertable(comList).ExecuteCommand();
+                }
+                else if (isComplete == 1)
+                {
+                    complete.CompleteQty += int.Parse(PickQty);
+                    complete.UpdateUser = userId;
+                    complete.UpdateTime = Db.GetDate();
+
+                    Db.Updateable(complete).ExecuteCommand();
+                }
+                
+
+
+                //淇敼鍑哄簱鍒嗛厤淇℃伅
+                allot.CompleteQty += int.Parse(PickQty);
+                allot.Status = allot.Qty == allot.CompleteQty ? "5" : "3";
+                Db.Updateable(allot).ExecuteCommand();
+
+                int isDel = 0;
+
+                //鍒犻櫎鎴栦慨鏀瑰簱瀛樻槑缁�
+                stockDetail.Qty -= int.Parse(PickQty);
+                stockDetail.LockQty -= int.Parse(PickQty);
+                if (stockDetail.Qty <= 0)
+                {
+                    Db.Deleteable(stockDetail).ExecuteCommand();
+                }
+                else
+                {
+                    isDel = 1;
+                    Db.Updateable(stockDetail).ExecuteCommand();
+                }
+                //鍒犻櫎鎴栦慨鏀瑰簱瀛�
+                stock.Qty -= int.Parse(PickQty);
+                stock.LockQty -= int.Parse(PickQty);
+                if (stock.Qty <= 0)
+                {
+                    Db.Deleteable(stock).ExecuteCommand();
+                }
+                else
+                {
+                    Db.Updateable(stock).ExecuteCommand();
+                }
+
+                //鏀瑰彉鎵樼洏鐘舵�佷负锛氭湭浣跨敤
+                var pallet = Db.Queryable<SysPallets>().First(m => m.PalletNo == palletNo && m.IsDel == "0");
+                if (pallet == null)
+                {
+                    throw new Exception("鏈湪鎵樼洏琛ㄤ腑鏌ヨ鍒版墭鐩樹俊鎭�");
+                }
+
+                //鍒ゆ柇鎵樼洏涓婄墿鏂欐槸鍚︽嫞璐у畬姣�
+                if (isDel == 0)
+                {
+                    pallet.Status = "0";
+                    Db.Updateable(pallet).ExecuteCommand();
+                }
+                
+                //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲�
+                noticeDetail.CompleteQty += int.Parse(PickQty);
+                Db.Updateable(noticeDetail).ExecuteCommand();
+
+                var num = Db.Queryable<BllExportNoticeDetail>()
+                    .Count(m => m.IsDel == "0" && m.SONo == soNo && m.CompleteQty < m.Qty);
+                if (num <= 0)
+                {
+                    notice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴�
+                }
+                //淇敼鍑哄簱鍗曚俊鎭�
+                Db.Updateable(notice).ExecuteCommand();
+
+
+                Db.CommitTran();
+            }
+            catch (Exception e)
+            {
+                Db.RollbackTran();
+                throw new Exception(e.Message);
+            }
+        }
+
         /// <summary>
         /// 涓嬪彂绌烘墭鍑哄簱
         /// </summary>
@@ -635,7 +874,7 @@
         /// <param name="url"> </param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        public string IssuePlnOutHouse(OutModePalletVm model, int userId,string url)
+        public string IssuePlnOutHouse(OutModePalletVm model, int userId, string url)
         {
             try
             {
@@ -649,7 +888,7 @@
                 if (stockDetail.Count > 0)
                 {
                     //鍒ゆ柇鏄惁澶т簬闇�瑕佸灈鏁�
-                    if (stockDetail.Count< int.Parse(model.Num))
+                    if (stockDetail.Count < int.Parse(model.Num))
                     {
                         strMsg = "闇�瑕佸灈鏁板ぇ浜庡簱瀛樺灈鏁帮紝璇烽噸鏂拌緭鍏�!";
                         return strMsg;
@@ -704,7 +943,7 @@
                     s.Status = "2"; //2 宸插垎閰�
                     //淇敼搴撳瓨鏄庣粏淇℃伅
                     Db.Updateable(s).ExecuteCommand();
-                    
+
                     #region 鍒嗛厤
 
                     //娣诲姞鍒嗛厤琛ㄤ俊鎭�
@@ -738,7 +977,7 @@
                     Db.Insertable(allot).ExecuteCommand();
 
                     #endregion
-                    
+
                     #region 娣诲姞鍑哄簱浠诲姟淇℃伅
 
                     var taskNo = new Common().GetMaxNo("TK");
@@ -804,7 +1043,7 @@
                         {
                             //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�//
                             new TaskServer().EditTaskIssueOk(list2, time1, time2);
-                                str += "涓嬪彂鎴愬姛";
+                            str += "涓嬪彂鎴愬姛";
                         }
                         if (wcsModel.StatusCode == -1)
                         {
@@ -820,7 +1059,7 @@
                 }
 
                 //娣诲姞鎿嶄綔鏃ュ織璁板綍
-                var k = new OperationSOServer().AddLogOperationSo("PDA妯″潡", "绌烘墭鍑哄簱", i+"", "涓嬪彂", $"鐢≒DA涓嬪彂浜� {i} 涓┖鎵樺灈", userId);
+                var k = new OperationSOServer().AddLogOperationSo("PDA妯″潡", "绌烘墭鍑哄簱", i + "", "涓嬪彂", $"鐢≒DA涓嬪彂浜� {i} 涓┖鎵樺灈", userId);
                 Db.CommitTran();
 
                 return "";
@@ -893,7 +1132,7 @@
                     throw new Exception("搴撳瓨淇℃伅涓笉瀛樺湪璇ユ墭鐩樹俊鎭紝璇锋鏌�!");
                 }
 
-                if (result.WareHouseNo!="W02")//W02锛氶浂绠卞簱
+                if (result.WareHouseNo != "W02")//W02锛氶浂绠卞簱
                 {
                     throw new Exception("璇ユ墭鐩樻湭鍦ㄩ浂绠卞簱锛岃妫�鏌�!");
                 }
@@ -901,7 +1140,7 @@
                 #endregion
 
                 //鑾峰彇搴撳瓨鏄庣粏淇℃伅
-                var stockDetail = Db.Queryable<DataStockDetail>().Where(s => s.IsDel == "0" &&  s.PalletNo == palletNo).ToList();
+                var stockDetail = Db.Queryable<DataStockDetail>().Where(s => s.IsDel == "0" && s.PalletNo == palletNo).ToList();
                 //楠岃瘉搴撳瓨鏄庣粏淇℃伅鏄惁瀛樺湪
                 if (stockDetail == null)
                 {
@@ -990,6 +1229,6 @@
             }
         }
 
-        
+
     }
 }
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
index 9f96645..62a070b 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaSoServer.cs
@@ -63,7 +63,7 @@
         /// <param name="soDetailId">鍑哄簱鍗曟槑缁咺D</param>
         /// <param name="palletNo">鎵樼洏鍙�</param>
         /// <returns></returns>
-        List<OutPdaInfo> GetAllotPlnInfo(string soDetailId,string palletNo);
+        List<BoxInfo> GetAllotPlnInfo(string soDetailId,string palletNo);
 
         /// <summary>
         /// 鍑哄簱pda鎷h揣
@@ -78,6 +78,16 @@
         void SoSetPick(string soNo, string soDetailId, string palletNo, string boxNo, string boxNo3, int userId);
 
         /// <summary>
+        /// 鍑哄簱pda鎷h揣
+        /// </summary>
+        /// <param name="soNo">鍑哄簱鍗�</param>
+        /// <param name="soDetailId">鍑哄簱鍗曟槑缁咺D</param>
+        /// <param name="palletNo">鎵樼洏鍙�</param> 
+        /// <param name="PickQty">鎷h揣鏁伴噺</param>
+        /// <param name="userId">鎿嶄綔浜�</param>
+        void SoSetQtyPick(string soNo, string soDetailId, string palletNo, string PickQty, int userId);
+
+        /// <summary>
         /// 涓嬪彂绌烘墭鍑哄簱
         /// </summary>
         /// <param name="model">鎵樼洏璺烘暟</param>
diff --git a/Wms/Wms/Controllers/PdaSoController.cs b/Wms/Wms/Controllers/PdaSoController.cs
index e68aed2..de7edbc 100644
--- a/Wms/Wms/Controllers/PdaSoController.cs
+++ b/Wms/Wms/Controllers/PdaSoController.cs
@@ -159,7 +159,27 @@
                 return Ok(new { code = 1, msg = e.Message });
             }
         }
-        
+
+        /// <summary>
+        /// 鑾峰彇绠辩爜淇℃伅锛堣幏鍙栧簱鍐呮棤绠辩爜鐨勬墭鐩樺垎閰嶄俊鎭級
+        /// </summary>
+        /// <param name="model">BoxNo:绠辩爜鍙�</param> 
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetAllotPlnInfo(PdaSoVm model)
+        {
+            try
+            {
+                var models = _pdaSoSvc.GetAllotPlnInfo(model.SoDetailId, model.PalletNo);
+
+                return Ok(new { code = 0, msg = "绠辩爜淇℃伅", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
 
         /// <summary>
         /// 鍑哄簱pda鎷h揣
@@ -193,6 +213,38 @@
             }
         }
 
+        /// <summary>
+        /// 鍑哄簱pda鎷h揣
+        /// </summary>
+        /// <param name="model">SoDetailId:鍑哄簱鍗曟槑缁咺D銆丳alletNo:鎵樼洏鐮�</param> 
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SoSetQtyPick(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.SoSetQtyPick(model.SoNo, model.SoDetailId, model.PalletNo, model.PickQty,  int.Parse(userId));
+
+                return Ok(new { code = 0, msg = "鎷h揣瀹屾垚", data = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
 
         /// <summary>
         /// 绌烘墭鍑哄簱

--
Gitblit v1.8.0