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 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 154 insertions(+), 19 deletions(-)

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>

--
Gitblit v1.8.0