From 888f7454c065b6cedc3aa254bf8d3326f42422ec Mon Sep 17 00:00:00 2001
From: yuyou_x <2336760928@qq.com>
Date: 星期日, 04 二月 2024 09:03:29 +0800
Subject: [PATCH] 合并代码

---
 Pda/View/AsnSetting/productEnter1.html   |  325 ++++++++++++++++++++++-------------
 Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs |    7 
 HTML/views/ASNSetting/ArrivalNotice.html |    2 
 Wms/Wms/Controllers/PdaAsnController.cs  |   62 ++++++
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs |  144 +++++++++++++++
 5 files changed, 415 insertions(+), 125 deletions(-)

diff --git a/HTML/views/ASNSetting/ArrivalNotice.html b/HTML/views/ASNSetting/ArrivalNotice.html
index ce15fdb..cf542ff 100644
--- a/HTML/views/ASNSetting/ArrivalNotice.html
+++ b/HTML/views/ASNSetting/ArrivalNotice.html
@@ -178,8 +178,6 @@
 										<i class="layui-icon layui-icon-edit"></i>缂栬緫</a>
 										<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del">
 										<i class="layui-icon layui-icon-delete"></i>鍒犻櫎</a>
-										<a class="layui-btn layui-btn-normal layui-btn-xs clossClass" lay-event="closs"> 
-										<i class="layui-icon layui-icon-ok"></i>璁㈠崟鍏抽棴</a>`;
 									break; 
 								case "1" : 
 								html += `<a class="layui-btn layui-btn-normal layui-btn-xs clossClass" lay-event="closs">  <i class="layui-icon layui-icon-ok"></i>璁㈠崟鍏抽棴</a>
diff --git a/Pda/View/AsnSetting/productEnter1.html b/Pda/View/AsnSetting/productEnter1.html
index 137b213..c45e971 100644
--- a/Pda/View/AsnSetting/productEnter1.html
+++ b/Pda/View/AsnSetting/productEnter1.html
@@ -110,8 +110,8 @@
             <br />
             <!-- 鏈夌爜 -->
             <div id="content1">
-                <div id="zongDiv" class="layout-bill-info" style="height: 255px;">
-                    <form class="layui-form" id="form1" action="">
+                <div id="zongDiv" class="layout-bill-info" style="height: 285px;">
+                    <form class="layui-form" action="">
                         <div id="" class="layui-form-item layout-dropdownlist">
                             <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label>
                             <div class="layui-input-block" id="selectDiv">
@@ -130,7 +130,7 @@
                                 <img src="/assets/down_arraw.png">
                             </div>
                         </div>
-
+    
                         <div id="" class="layui-form-item layout-input">
                             <label class="layui-form-label" lang>鎵樼洏鏉$爜锛�</label>
                             <div class="layui-input-block">
@@ -159,12 +159,12 @@
                                     class="layui-input">
                             </div>
                         </div>
-
+    
                         <table class="layout-tbl-input" border="" cellspacing="" cellpadding="">
                             <tr>
                                 <td>
                                     <div id="" class="layui-form-item layout-boxinfo">
-                                        <label class="layui-form-label" lang>瑙勬牸/鍨嬪彿锛�</label>
+                                        <label class="layui-form-label" lang>鐗╂枡瑙勬牸锛�</label>
                                         <div class="layui-input-block">
                                             <input id="Standard" type="text" disabled placeholder="" autocomplete="off"
                                                 class="layui-input">
@@ -180,7 +180,7 @@
                                         </div>
                                     </div>
                                 </td>
-
+    
                             </tr>
                             <tr>
                                 <td>
@@ -202,9 +202,9 @@
                                     </div>
                                 </td>
                             </tr>
-
+    
                         </table>
-
+    
                         <table class="layout-tbl-submit" border="" cellspacing="" cellpadding="">
                             <tr>
                                 <td style="width: 23%;"></td>
@@ -213,10 +213,9 @@
                                         lay-filter="formBind">缁戝畾鍒版墭鐩�</button>
                                 </td>
                                 <td style="width: 33%;"></td>
-            
+    
                             </tr>
                         </table>
-                        
                     </form>
                 </div>
 
@@ -269,7 +268,7 @@
                         <div id="" class="layui-form-item layout-dropdownlist">
                             <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label>
                             <div class="layui-input-block" id="selectDiv1">
-                                <select id="bar1" lay-filter="getbar" lay-search>
+                                <select id="bar1" lay-filter="getbar1" lay-search>
                                     <option value=""></option>
                                 </select>
                                 <img src="/assets/down_arraw.png">
@@ -277,7 +276,7 @@
                         </div>
                         <div class="layui-form-item layout-dropdownlist" style="margin-top: 10px;">
                             <label class="layui-form-label">鐗╂枡-鎵规锛�</label>
-                            <div class="layui-input-block" id="goodDiv">
+                            <div class="layui-input-block" id="goodDiv1">
                                 <select id="goodSelect1" lay-filter="goodSelect1" lay-search>
                                     <option value=""></option>
                                 </select>
@@ -363,10 +362,10 @@
                 <div class="layout-tbl-paging" id="">
                     <table id="tableBoxList1" class="tbl-box-list" border="" cellspacing="" cellpadding="">
                         <tr>
-                            <th lang style="width: 15%;">缂栫爜</th>
-                            <th lang style="width: 35%;">鍚嶇О</th>
+                            <th lang style="width: 15%;">鐗╂枡缂栫爜</th>
+                            <th lang style="width: 35%;">鐗╂枡鍚嶇О</th>
                             <th lang style="width: 25%;">鎵规</th>
-                            <th lang style="width: 15%;">鏁伴噺</th>
+                            <th lang style="width: 15%;">鐗╂枡鏁伴噺</th>
                             <th lang style="width: 10%;">鎿嶄綔</th>
                         </tr>
                         <tr id="boxCell" style="display: none;">
@@ -438,27 +437,30 @@
                 });
             });
 
-            //娓呯┖涓や釜鏍囩椤靛唴瀹�
-            function qingkong()
-            {
-                //鍏ュ簱鍗曟嵁
-                // $('#form1').reset()
-                // $('#form2').reset()
+            //娓呮鏂囨湰妗嗕腑鏁版嵁
+			// function clear() {	
+            //     if (xianshiyemian == "0")
+            //     {
+            //         $("#BOXCODE").val("");
+            //         $("#BOXCODE2").val("");
 
-                // //琛ㄦ牸鍐呭
-                // let trs = $("#tableBoxList tr")
-                // let len = trs.length
+            //         $("#ImportQuantity").val("");
+            //         $("#Standard").val("");
+            //         $("#ImportFactQuantity").val("");
+            //         $("#BoxQty").val("");
+            //     }
+            //     else if (xianshiyemian == "1")
+            //     {
+            //         $("#BOXCODE").val("");
+            //         $("#BOXCODE2").val("");
 
-                // for (i = len - 1; i >= 2; i--) {
-                //     trs[i].remove();
-                // }
-                // let trs1 = $("#tableBoxList1 tr")
-                // let len1 = trs1.length
-
-                // for (i = len1 - 1; i >= 2; i--) {
-                //     trs1[i].remove();
-                // }
-            }
+            //         $("#ImportQuantity").val("");
+            //         $("#Standard").val("");
+            //         $("#ImportFactQuantity").val("");
+            //         $("#BoxQty").val("");
+            //     }
+				
+			// }
             
             /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/
 
@@ -469,15 +471,6 @@
 			var curPageIndex = 1;
 			//鏄惁杩炵画缁勬墭
 			isContinue = "0";
-			//娓呮鏂囨湰妗嗕腑鏁版嵁
-			function clear() {
-				$("#ImportQuantity").val("");
-				$("#GoodsCode").val("");
-				$("#Standard").val("");
-				$("#ImportFactQuantity").val("");
-				$("#ImportQty").val("");
-				$("#BoxQty").val("");
-			}
 
 			// 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂
 			$("#STOCKCODE").on('input', function () {
@@ -490,7 +483,7 @@
 				}
 				checkPalletStat()
 			})
-            // 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂
+            // 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂-鏁伴噺
 			$("#STOCKCODE1").on('input', function () {
 
                 if ($("#STOCKCODE1").val() == "" || $("#STOCKCODE1").val().length < 8) {
@@ -506,22 +499,25 @@
 			$("#BOXCODE").keydown(function (e) {
 				if (e.keyCode === 13) {
 					if ($("#BOXCODE").val() == "") {
-						return
-					}
-
-					if ($("#STOCKCODE").val() == "") {
-						layer.msg('璇峰厛鎵弿鎵樼洏鐮�', {
+                        layer.msg('璇峰厛鎵弿绠辩爜', {
 							icon: 2,
 							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 						});
-						$("#BOXCODE").val("");
-						$("#STOCKCODE").focus();
-						return;
+						return
 					}
+
+					// if ($("#STOCKCODE").val() == "") {
+					// 	layer.msg('璇峰厛鎵弿鎵樼洏鐮�', {
+					// 		icon: 2,
+					// 		time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+					// 	});
+					// 	$("#BOXCODE").val("");
+					// 	$("#STOCKCODE").focus();
+					// 	return;
+					// }
 					checkBoxInfo()
 				}
 			});
-
 
             /* 鍏ュ簱鍗曟嵁涓嬫媺妗� */
 			//鐐瑰嚮鍏ュ簱鍗曟嵁涓嬫媺妗嗕簨浠�
@@ -566,7 +562,7 @@
                     form.render('select');
 
                     var param = {
-                        Type: "0,1"
+                        Type: "0,1,3"
                     };
                     sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) {
                         if (res.code == 0) { //鎴愬姛
@@ -643,8 +639,22 @@
 					}, function () { });
 				}
 			})
+            //鐐瑰嚮鐗╂枡涓嬫媺妗嗕簨浠�-鏁伴噺
+			$("#goodDiv1").click(function () {
+				if ($("#bar1").val() == null || $("#bar1").val() == "" || $("#bar1").val() == undefined) {
+					layer.msg("璇峰厛閫夋嫨鍏ュ簱鍗�", {
+						icon: 2,
+						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+					}, function () { });
+				}
+			})
 			//閫変腑鍏ュ簱鍗曚簨浠�
 			form.on('select(getbar)', function (data) {
+				updateGoodList()
+				setOrderGoods();
+			});
+            //閫変腑鍏ュ簱鍗曚簨浠�-鏁伴噺
+			form.on('select(getbar1)', function (data) {
 				updateGoodList()
 				setOrderGoods();
 			});
@@ -662,7 +672,6 @@
 			form.on('submit(formBind)', function (data) {
                 if(xianshiyemian == 0)
                 {
-                    console.log(isContinue);
 				    console.log($("#goodSelect").val());
                     if ($("#bar").val() == "") {
                         layer.msg('璇烽�夋嫨鍏ュ簱鍗�', {
@@ -693,36 +702,36 @@
                         return;
                     }
                     var param = {
-                        AsnNo: $("#bar").val(),
-                        PalletNo: $("#STOCKCODE").val(),
-                        AsnDetailId: parseInt($("#goodSelect").val()),
-                        BoxNo: $("#BOXCODE").val(),
-                        IsContinue: isContinue,
-                        TailBoxNo: $("#BOXCODE2").val(),
-                        Origin:"PDA"
-                    }
-                    //缁勭洏
-                    sendData(IP + "/PdaAsn/BindPallet", param, 'post', function (res) {
-                        if (res.code == 0) { //鎴愬姛 
-                            layer.msg(res.msg, {
-                                icon: 1,
-                                time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-                            }, function () {
-                                setOrderGoods();
-                                refreshTable();
-                                $("#BOXCODE").val("");
-                                $("#BOXCODE2").val("");
-                                $("#QTY").val("");
-                            });
-                        } else { //涓嶆垚鍔�
-                            layer.msg(res.msg, {
-                                icon: 2,
-                                time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-                            }, function () {
-                                //鍥炶皟
-                            });
-                        }
-                    });
+					AsnNo: $("#bar").val(),
+					PalletNo: $("#STOCKCODE").val(),
+					AsnDetailId: parseInt($("#goodSelect").val()),
+					BoxNo: $("#BOXCODE").val(),
+					IsContinue: isContinue,
+					TailBoxNo: $("#BOXCODE2").val(),
+					Origin:"PDA"
+				}
+                //缁勭洏
+				sendData(IP + "/PdaAsn/BindPallet", param, 'post', function (res) {
+					if (res.code == 0) { //鎴愬姛 
+						layer.msg(res.msg, {
+							icon: 1,
+							time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}, function () {
+							setOrderGoods();
+							refreshTable();
+							$("#BOXCODE").val("");
+							$("#BOXCODE2").val("");
+							$("#QTY").val("");
+						});
+					} else { //涓嶆垚鍔�
+						layer.msg(res.msg, {
+							icon: 2,
+							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+						}, function () {
+							//鍥炶皟
+						});
+					}
+				});
                 }
                 else if(xianshiyemian == 1)
                 {
@@ -829,7 +838,7 @@
 			var asnDetails = "";
 
 			/* 缁戝畾鍏ュ簱鍗曠墿鏂欏強鎵规 */ 
-			function updateGoodList() {
+			function updateGoodList(skuNo) {
                 if (xianshiyemian == 0)
                 {
                     console.log("aaaa");
@@ -847,16 +856,21 @@
                         if (res.code == 0) { //鎴愬姛
                             asnDetails = res.data;
                             for (var i = 0; i < res.data.length; i++) {
-                                if (i == 0) {
+                                if(skuNo!='' && skuNo==res.data[i].SkuNo){
                                     $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
                                         .SkuName + "-" + res.data[i].LotNo +
                                         '</option>');
-                                } else {
-                                    $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i]
-                                        .SkuName + "-" + res.data[i].LotNo +
-                                        '</option>');
-                                }
-
+                                }else{
+                                    if (i == 0) {
+                                        $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i]
+                                            .SkuName + "-" + res.data[i].LotNo +
+                                            '</option>');
+                                        } else {
+                                            $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i]
+                                                .SkuName + "-" + res.data[i].LotNo +
+                                                '</option>');
+                                        }
+                                }							
                             }
                             form.render('select');
 
@@ -917,7 +931,6 @@
 			function refreshTable() {
                 if (xianshiyemian == 0)
                 {
-
                     //鍏堟竻绌轰竴涓嬬瀛愬垪琛�
                     let trs = $("#tableBoxList tr")
                     let len = trs.length
@@ -964,7 +977,7 @@
                                             var param = {
                                                 Id: Id,
                                             };
-                                            sendData(IP + "/PdaAsn/DelBoxInfo", param, 'post', function (res) {
+                                            sendData(IP + "/BllAsn//DelBindBoxInfo'", param, 'post', function (res) {
                                                 if (res.code == 0) { //鎴愬姛
                                                     layer.msg(res.msg, {
                                                         icon: 1,
@@ -987,18 +1000,15 @@
                                 arrTrs[i] = tr
                             }
 
-                            //璁剧疆鍒嗛〉
-                            setPages(1, list.length)
+
                         } else { //涓嶆垚鍔�
                             layer.msg("鏃犳暟鎹�", {
                                 icon: 2,
                                 time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
                             }, function () { });
                             $("#boxNum").val(0)
-                            setPages(1, 0)
                         }
                     });
-
                 }
                 else if (xianshiyemian == 1)
                 {
@@ -1017,7 +1027,7 @@
                         PalletNo: $.cookie('stockCode1')
                     };
                     //  鏍规嵁鎵樼洏鍙疯幏鍙栫鐮佷俊鎭�
-                    sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) {
+                    sendData(IP + "/PdaAsn/GetPalletBindInfo", param, 'post', function (res) {
                         if (res.code == 0) { //鎴愬姛
                             var list = res
                             var arrTrs = new Array()
@@ -1030,40 +1040,43 @@
                                 tr.attr('BindNo', res.data[i].BindNo)
                                 idx++;
                                 tr.attr('index', idx)
-                                tr.find("td[name='code']").html(res.data[i].BoxNo);
+                                tr.find("td[name='code']").html(res.data[i].SkuNo);
                                 tr.find("td[name='name']").html(res.data[i].SkuName);
                                 tr.find("td[name='lotNo']").html(res.data[i].LotNo);
                                 tr.find("td[name='num']").html(res.data[i].Qty);
                                 tr.find("td[name='del']").click(function () {
                                     var elem = $(this).parent()
-                                    var boxno = elem.attr('boxno')
+                                    // var boxno = elem.attr('boxno')
                                     var BindNo = elem.attr('BindNo')
+                                    console.log(res)
                                     var Id = elem.attr('id')
-                                    layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖鎵樼墿鏂欏悧锛�<br>" + boxno, {
+                                    layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖鎵樼墿鏂欏悧锛�<br>" + res.data[0].PalletNo, {
                                         icon: 2,
                                         time: 0, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
                                         btn: ['鍒犻櫎', '鍙栨秷'],
                                         yes: function () {
 
                                             var param = {
-                                                Id: Id,
+                                                PalletNo: res.data[0].PalletNo,
                                             };
-                                            sendData(IP + "/PdaAsn/DelBoxInfo", param, 'post', function (res) {
-                                                if (res.code == 0) { //鎴愬姛
-                                                    layer.msg(res.msg, {
-                                                        icon: 1,
-                                                        time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-                                                    });
-                                                    elem.remove()
-                                                    setOrderGoods();
-                                                    refreshTable();
-                                                } else { //涓嶆垚鍔�
-                                                    layer.msg(res.msg, {
-                                                        icon: 2,
-                                                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-                                                    }, function () { });
-                                                }
-                                            });
+                                            console.log(Id)
+                                            console.log(param)
+                                            // sendData(IP + "/PdaAsn/DelBoxInfo", param, 'post', function (res) {
+                                            //     if (res.code == 0) { //鎴愬姛
+                                            //         layer.msg(res.msg, {
+                                            //             icon: 1,
+                                            //             time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                                            //         });
+                                            //         elem.remove()
+                                            //         setOrderGoods();
+                                            //         refreshTable();
+                                            //     } else { //涓嶆垚鍔�
+                                            //         layer.msg(res.msg, {
+                                            //             icon: 2,
+                                            //             time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                                            //         }, function () { });
+                                            //     }
+                                            // });
                                         }
                                     })
                                 })
@@ -1137,15 +1150,33 @@
 				var param = {
 					"BoxNo": $("#BOXCODE").val(),
 				}
-				sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) {
+				sendData(IP + "/PdaAsn/GetBindBoxInfos", param, 'post', function (res) {
 					if (res.code == 0) { //鎴愬姛
-						var bl = false; console.log(res.data);
+						var bl = false;
 						if (res.data.length == 0) {
 							layer.msg("鏈煡璇㈠埌姝ょ鐗╂枡淇℃伅锛岃鏍稿疄!", {
 								icon: 2,
 								time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 							});
 							return;
+						}
+						if(res.data[0].ASNNo!='' && res.data[0].ASNNo!=null){
+							$("#bar").empty()
+							$("#bar").append('<option value =>' + '</option>');
+							form.render('select');
+
+							$("#bar").append('<option value =' + res.data[0].ASNNo + ' selected>' + res.data[0].ASNNo +'</option>');
+
+							updateGoodList(res.data[0].SkuNo)
+							setOrderGoods();
+						}else{
+							if(asnDetails==''){
+								layer.msg("璇峰厛閫夋嫨鍏ュ簱鍗曟嵁!", {
+									icon: 2,
+									time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+								});
+								return;
+							}
 						}
 						asnDetails.forEach(element => {
 							console.log(element);
@@ -1365,6 +1396,56 @@
                 }
                 
             }
+
+            function getBoxPageNum()
+            {
+                if (xianshiyemian == 0)
+                {
+                    let num = $("#tableBoxList tr").length
+                    if(num <= 2 ){
+                        return 0
+                    }
+                    
+                    let pageNum = Math.floor(num / 10);
+                    if(num % 10 > 0){
+                        pageNum += 1;
+                    }
+                    
+                    return pageNum
+                }
+                else if (xianshiyemian == 1)
+                {
+                    let num = $("#tableBoxList1 tr").length
+                    if(num <= 2 ){
+                        return 0
+                    }
+                    
+                    let pageNum = Math.floor(num / 10);
+                    if(num % 10 > 0){
+                        pageNum += 1;
+                    }
+                    
+                    return pageNum
+                }
+                
+            }
+
+            function onClickPrevPage(){
+                //console.log("涓婁竴椤垫寜閽鐐瑰嚮")
+                if(curPageIndex == 1){
+                    return
+                }
+                setCurPage(curPageIndex - 1)
+            }
+
+            function onClickNextPage(){
+                //console.log("涓嬩竴椤垫寜閽鐐瑰嚮")
+                let n = getBoxPageNum()
+                if(curPageIndex == n){
+                    return
+                }
+                setCurPage(curPageIndex + 1)
+            }
           
             /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/
 
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index d9f5223..d7d5e2d 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -15,6 +15,8 @@
 using WMS.Entity.BllSoEntity;
 using Model.ModelVm.PdaVm;
 using Model.ModelDto.PdaDto;
+using Dm;
+using Model.InterFaceModel;
 
 namespace WMS.BLL.BllPdaServer
 {
@@ -157,6 +159,31 @@
                     sqlString += $"group by BoxNo,SkuNo,SkuName,LotNo; ";
                 }
                 var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString);
+
+                return models;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        // 鏍规嵁鎵樼洏鍙锋垨绠辩爜鑾峰彇鎵樼洏淇℃伅   liudl 
+        public List<PalletBindDto> GetPalletBindInfo(BllPalletBind model)
+        {
+            try
+            {
+                string sqlString = string.Empty;
+                sqlString = "select b.SkuNo,b.SkuName,a.LotNo,a.Qty,a.PalletNo,a.Id from BllPalletBind a left join BllArrivalNoticeDetail b on a.ASNDetailNo = b.Id where a.IsDel = '0' and b.IsDel = '0' ";
+                if (!string.IsNullOrEmpty(model.PalletNo))
+                {
+                    sqlString += $"and PalletNo = '{model.PalletNo}' and a.Status = '0' ";
+                }
+                else
+                {
+                    throw new Exception("鎵樼洏鍙峰紓甯革紒");
+                }
+                var models = Db.Ado.SqlQuery<PalletBindDto>(sqlString);
 
                 return models;
             }
@@ -474,6 +501,121 @@
                     sqlString = $"update SysPallets set Status = '0' where PalletNo = '{boxModel[0].PalletNo}';";
                     Db.Ado.ExecuteCommand(sqlString);
                 }
+
+                Db.CommitTran();
+                return strMsg;
+            }
+            catch (Exception ex)
+            {
+                Db.RollbackTran();
+                throw ex;
+            }
+        }
+
+        // 鍒犻櫎宸茬粍淇℃伅
+        public string DelPalletBind(BllPalletBind model)
+        {
+            string strMsg = "";
+            string sqlString = string.Empty;
+            try
+            {
+                if (model.Id == 0)
+                {
+                    throw new Exception("-1:鎵樼洏ID涓嶅彲涓�0锛�");
+                }
+
+                //鑾峰彇鎵樼洏缁戝畾淇℃伅
+                var bind = Db.Queryable<BllPalletBind>().First(a => a.IsDel == "0" && a.Status == "0" && a.Id == model.Id);
+                //楠岃瘉鎵樼洏缁戝畾淇℃伅鏄惁涓虹┖
+                if (bind == null)
+                {
+                    throw new Exception("-1:鏈幏鍙栧埌瀵瑰簲鎵樼洏淇℃伅锛岃鏍稿疄锛�");
+                }
+                //鍒ゆ柇鎵樼洏缁戝畾淇℃伅鏄惁涓嶆槸绛夊緟鎵ц
+                if (bind.Status != "0")
+                {
+                    throw new Exception("-1:璇ユ墭鐩樺凡姝e湪鍏ュ簱锛岃鏍稿疄锛�");
+                }
+                //鑾峰彇鏄惁鏈夋寚瀹氬簱浣�
+                SysStorageLocat locat = new SysStorageLocat();
+                int isNullLocat = 0;
+                //鍒ゆ柇鍌ㄤ綅鏄惁涓虹┖
+                if (!string.IsNullOrWhiteSpace(bind.LocatNo))
+                {
+                    isNullLocat = 1;
+                    locat = Db.Queryable<SysStorageLocat>().First(a=>a.IsDel == "0" && a.WareHouseNo == bind.WareHouseNo && a.RoadwayNo == bind.RoadwayNo && a.LocatNo == bind.LocatNo);
+                    //鍒ゆ柇鍌ㄤ綅鍦板潃鏄惁涓烘鍦ㄥ叆搴�
+                    if (locat.Status != "2")
+                    {
+                        throw new Exception("-1:褰撳墠鎵樼洏缁戝畾鐨勫偍浣嶅湴鍧�涓嶆槸姝e湪鍏ュ簱锛岃鏍稿疄锛�");
+                    }
+                }
+                //鑾峰彇鎵樼洏淇℃伅
+                var pallet = Db.Queryable<SysPallets>().First(a => a.IsDel == "0" && a.PalletNo == model.PalletNo);
+                //鍒ゆ柇鎵樼洏淇℃伅鏄惁涓虹┖
+                if (pallet == null)
+                {
+                    throw new Exception("-1:鏈幏鍙栧埌瀵瑰簲鎵樼洏淇℃伅锛岃鏍稿疄锛�");
+                }
+                //鑾峰彇瀵瑰簲鍏ュ簱鍗曟嵁鎬诲崟
+                var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == bind.ASNNo);
+                //楠岃瘉鍏ュ簱鍗曟�诲崟淇℃伅
+                if (notice == null)
+                {
+                    throw new Exception("-1:鏈幏鍙栧埌瀵瑰簲鍏ュ簱鍗曟�诲崟淇℃伅锛岃鏍稿疄锛�");
+                }
+                //鑾峰彇瀵瑰簲鍏ュ簱鍗曟嵁鏄庣粏
+                var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(a => a.IsDel == "0" && a.Id == bind.ASNDetailNo);
+                //楠岃瘉鍏ュ簱鍗曞崟鎹槑缁�
+                if (noticeDetail == null)
+                {
+                    throw new Exception("-1:鏈幏鍙栧埌瀵瑰簲鍏ュ簱鍗曞崟鎹槑缁嗕俊鎭紝璇锋牳瀹烇紒");
+                }
+
+
+                Db.BeginTran();
+                //鍑忓皯鍏ュ簱鍗曟槑缁嗘暟閲� 鍒ゆ柇宸茬粍鏁伴噺鏄惁涓�0 鍐嶅垽鏂畬鎴愭暟閲忔槸鍚︿负0
+                noticeDetail.FactQty -= bind.Qty;
+                //鍒ゆ柇宸茬粍鏁伴噺鏄惁涓�0
+                if (noticeDetail.FactQty == 0)
+                {
+                    //鍒ゆ柇鏄惁鏈夊畬鎴愭暟閲�
+                    if (noticeDetail.CompleteQty == 0)
+                    {
+                        noticeDetail.Status = "0"; //鍏ュ簱鍗曟槑缁嗙姸鎬�
+                        notice.Status = "0"; //鍏ュ簱鍗曟�诲崟鐘舵��
+                    }
+                }
+                Db.Updateable(noticeDetail).ExecuteCommand();
+                Db.Updateable(notice).ExecuteCommand();
+
+
+                // 娓呴櫎鎵樼洏缁戝畾涓婁俊鎭�
+                //ASNNo,ASNDetailNo,Qty,FullQty,LotNo,LotText,SupplierLot,IsDel,UpdateTime,UpdateUser
+                bind.ASNNo = ""; //鍏ュ簱鍗曞彿
+                bind.ASNDetailNo = 0; //鍏ュ簱鍗曟槑缁唅d
+                bind.Qty = 0; //鏁伴噺
+                bind.FullQty = 0; //鏁存墭鏁伴噺
+                bind.LotNo = ""; //鎵规
+                bind.LotText = ""; //鎵规鎻忚堪
+                bind.SupplierLot = ""; //渚涜揣鎵规
+                bind.IsDel = "1"; //鏄惁鍒犻櫎
+                bind.UpdateTime = Db.GetDate(); //淇敼鏃堕棿
+                bind.UpdateUser = model.CreateUser; //淇敼浜�
+                if (isNullLocat == 1)
+                {
+                    bind.LocatNo = ""; //鍌ㄤ綅鍦板潃
+                    bind.RoadwayNo = ""; //鎵�灞炲贩閬�
+                    bind.WareHouseNo = ""; //鎵�灞炰粨搴�
+                    //淇敼鍌ㄤ綅淇℃伅鐘舵��
+                    locat.Status = "0"; //鍌ㄤ綅鐘舵�� 0锛氱┖鍌ㄤ綅
+                    Db.Updateable(locat).ExecuteCommand();
+                }
+                Db.Updateable(bind).ExecuteCommand();
+
+                //淇敼鎵樼洏淇℃伅鐘舵��
+                pallet.Status = "0"; //0锛氭湭浣跨敤
+                Db.Updateable(pallet).ExecuteCommand();
 
                 Db.CommitTran();
                 return strMsg;
@@ -1773,7 +1915,7 @@
                 //娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹�
                 sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);";
                 Db.Ado.ExecuteCommand(sqlStr);
-                new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "浜у搧缁勬墭", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}銆亄msgStr}鐨勭粍鐩樹俊鎭�", userId);
+                new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎵樼洏缁戝畾1", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}銆亄msgStr}鐨勭粍鐩樹俊鎭�", userId);
 
                 Db.CommitTran();
             }
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index 089a317..e30184c 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -5,6 +5,7 @@
 using System.Text;
 using Model.ModelVm.PdaVm;
 using Model.ModelDto.PdaDto;
+using WMS.Entity.BllAsnEntity;
 
 namespace WMS.IBLL.IPdaServer
 {
@@ -25,6 +26,9 @@
         // 鏍规嵁绠辩爜鎴栨墭鐩樺彿鑾峰彇绠辨敮淇℃伅
         List<BoxInfoDto> GetBoxInfos(BoxInfoVm model);
 
+        // 鏍规嵁鎵樼洏鍙锋垨绠辩爜鑾峰彇鎵樼洏淇℃伅
+        List<PalletBindDto> GetPalletBindInfo(BllPalletBind model);
+
         // 缁戝畾鐗╂枡鎵樼洏
         void BindPallet(PdaPalletBindVm model,int userId, string origin);
 
@@ -42,6 +46,9 @@
         // 鍒犻櫎宸茬粍淇℃伅
         string DelBoxInfo(BoxInfoVm model);
 
+        // 鍒犻櫎宸茬粍淇℃伅
+        string DelPalletBind(BllPalletBind model);
+
         // 骞冲簱瀹屾垚鍏ュ簱鎿嶄綔
         string CompleteInStock(PalletBindVm model);
 
diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index 1fd89c2..384d831 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -5,6 +5,7 @@
 using Model.ModelVm.PdaVm;
 using System;
 using System.Security.Claims;
+using WMS.Entity.BllAsnEntity;
 using WMS.IBLL.IPdaServer;
 
 namespace Wms.Controllers
@@ -132,6 +133,26 @@
         }
 
         /// <summary>
+        /// 鏍规嵁鎵樼洏鍙锋垨绠辩爜鑾峰彇鎵樼洏淇℃伅
+        /// </summary>
+        /// <param name="model">PalletNo:鎵樼洏鍙�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult GetPalletBindInfo(BllPalletBind model)
+        {
+            try
+            {
+                var models = _PdaAsnSvc.GetPalletBindInfo(model);
+
+                return Ok(new { code = 0, msg = "鎵樼洏淇℃伅", data = models });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
         /// 鍒犻櫎绠卞瓙淇℃伅
         /// </summary>
         /// <param name="model">Id锛氱瀛愪富閿�</param>
@@ -171,6 +192,47 @@
             }
 
         }
+
+        /// <summary>
+        /// 鍒犻櫎鎵樼洏淇℃伅
+        /// </summary>
+        /// <param name="model">ID\鎵樼洏鍙�</param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult DelPalletBind(BllPalletBind model)
+        {
+            try
+            {
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                if (claimsIdentity == null)
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                if (string.IsNullOrWhiteSpace(UserId))
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+
+                model.CreateUser = int.Parse(UserId);
+
+                var strMsg = _PdaAsnSvc.DelPalletBind(model);
+
+                if (strMsg == "")
+                {
+                    return Ok(new { code = 0, msg = "鍒犻櫎缁勬墭鎴愬姛!" });
+                }
+                else
+                {
+                    return Ok(new { code = 1, msg = strMsg });
+                }
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
+
+        }
         #endregion
 
         #region 鐢熶骇鍏ュ簱

--
Gitblit v1.8.0