From 1403ec7e5c62962fd5d20123defedae97a4abb75 Mon Sep 17 00:00:00 2001 From: yuyou_x <2336760928@qq.com> Date: 星期五, 02 二月 2024 09:12:49 +0800 Subject: [PATCH] 1 --- Pda/View/AsnSetting/productEnter1.html | 855 +++++++++++++++++++++++++++++++++--------- Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs | 5 HTML/views/ASNSetting/ArrivalNotice.html | 12 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 303 +++++++------- 4 files changed, 833 insertions(+), 342 deletions(-) diff --git a/HTML/views/ASNSetting/ArrivalNotice.html b/HTML/views/ASNSetting/ArrivalNotice.html index 825e782..3ddf22a 100644 --- a/HTML/views/ASNSetting/ArrivalNotice.html +++ b/HTML/views/ASNSetting/ArrivalNotice.html @@ -92,9 +92,17 @@ <div class="layui-input-inline"> <select name="Type" id="Type" lay-filter="Type" lay-search> <option value=""></option> + <!-- JC24 --> + <option value="0">鎴愬搧鍏ュ簱</option> + <option value="1">閲囪喘鍏ュ簱</option> + <option value="2">涓棿鍝佸叆搴�</option> + <option value="3">閫�璐у叆搴�</option> + <option value="4">杞﹂棿浣欐枡閫�鍥炲叆搴�</option> + <option value="5">鍏跺畠鍏ュ簱</option> + <option value="6">浠e偍鍏ュ簱</option> <!-- JC09 --> - <option value="0">鏍囧噯浜у搧鍏ュ簱</option> - <option value="1">闈炴爣浜у搧鍏ュ簱</option> + <!-- <option value="0">鏍囧噯浜у搧鍏ュ簱</option> + <option value="1">闈炴爣浜у搧鍏ュ簱</option> --> <!-- JC08 --> <!-- <option value="0">鎴愬搧鍏ュ簱</option> <option value="1">鍘熸枡鍏ュ簱</option> diff --git a/Pda/View/AsnSetting/productEnter1.html b/Pda/View/AsnSetting/productEnter1.html index 62b99be..8cdd898 100644 --- a/Pda/View/AsnSetting/productEnter1.html +++ b/Pda/View/AsnSetting/productEnter1.html @@ -111,7 +111,7 @@ <!-- 鏈夌爜 --> <div id="content1"> <div id="zongDiv" class="layout-bill-info" style="height: 255px;"> - <form class="layui-form" action=""> + <form class="layui-form" id="form1" action=""> <div id="" class="layui-form-item layout-dropdownlist"> <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> <div class="layui-input-block" id="selectDiv"> @@ -204,15 +204,68 @@ </tr> </table> + + <table class="layout-tbl-submit" border="" cellspacing="" cellpadding=""> + <tr> + <td style="width: 23%;"></td> + <td> + <button class="layout-btn layout-btn-red" lang type="button" lay-submit + lay-filter="formBind">缁戝畾鍒版墭鐩�</button> + </td> + <td style="width: 33%;"></td> + + </tr> + </table> </form> + </div> + + <br> + + <div id="" class="cut-line"> + <img src="/assets/fengexian.png"> + </div> + + <div class="layout-tbl-paging" id=""> + <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding=""> + <tr> + <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: 10%;">鎿嶄綔</th> + </tr> + <tr id="boxCell" style="display: none;"> + <td name="code">AG000001</td> + <td name="name">鐤嫍鍚嶇О鍚嶇О鍚嶇О</td> + <td name="lotNo">鎵规鍙�</td> + <td name="num">30</td> + <td name="del"> + <div id="" class="tbl-btn-del" lang> + 鍒犻櫎 + </div> + </td> + </tr> + </table> + <!-- 鍒嗛〉 --> + <table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding=""> + <tr style="display: ;"> + <td class="page-prev">涓婁竴椤�</td> + <td class="page-num page-num-select">1</td> + <td class="page-num">2</td> + <td class="page-num">3</td> + <td class="page-num">4</td> + <td class="page-num">5</td> + <td class="page-next">涓嬩竴椤�</td> + </tr> + </table> </div> </div> <!-- 鏃犵爜 --> <div id="content2"> <div id="zongDiv" class="layout-bill-info" style="height: 255px;"> - <form class="layui-form" action=""> + <form class="layui-form" id="form2" action=""> <div id="" class="layui-form-item layout-dropdownlist"> <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> <div class="layui-input-block" id="selectDiv1"> @@ -235,7 +288,7 @@ <div id="" class="layui-form-item layout-input"> <label class="layui-form-label" lang>鎵樼洏鏉$爜锛�</label> <div class="layui-input-block"> - <input id="STOCKCODE" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" + <input id="STOCKCODE1" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" autocomplete="off" class="layui-input"> </div> </div> @@ -286,52 +339,63 @@ </table> + <table class="layout-tbl-submit" border="" cellspacing="" cellpadding=""> + <tr> + <td style="width: 23%;"></td> + <td> + <button class="layout-btn layout-btn-red" lang type="button" lay-submit + lay-filter="formBind">缁戝畾鍒版墭鐩�</button> + </td> + <td style="width: 33%;"></td> + + </tr> + </table> + </form> </div> + <br> + + <div id="" class="cut-line"> + <img src="/assets/fengexian.png"> + </div> + + <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: 25%;">鎵规</th> + <th lang style="width: 15%;">鏁伴噺</th> + <th lang style="width: 10%;">鎿嶄綔</th> + </tr> + <tr id="boxCell" style="display: none;"> + <td name="code">AG000001</td> + <td name="name">鐤嫍鍚嶇О鍚嶇О鍚嶇О</td> + <td name="lotNo">鎵规鍙�</td> + <td name="num">30</td> + <td name="del"> + <div id="" class="tbl-btn-del" lang> + 鍒犻櫎 + </div> + </td> + </tr> + </table> + <!-- 鍒嗛〉 --> + <table id="tableBoxPages1" class="tbl-box-pages" border="" cellspacing="" cellpadding=""> + <tr style="display: ;"> + <td class="page-prev">涓婁竴椤�</td> + <td class="page-num page-num-select">1</td> + <td class="page-num">2</td> + <td class="page-num">3</td> + <td class="page-num">4</td> + <td class="page-num">5</td> + <td class="page-next">涓嬩竴椤�</td> + </tr> + </table> + </div> + </div> - - <table class="layout-tbl-submit" border="" cellspacing="" cellpadding=""> - <tr> - <td style="width: 23%;"></td> - <td> - <button class="layout-btn layout-btn-red" lang type="button" lay-submit - lay-filter="formBind">缁戝畾鍒版墭鐩�</button> - </td> - <td style="width: 33%;"></td> - - </tr> - </table> - - <br> - - <div id="" class="cut-line"> - <img src="/assets/fengexian.png"> - </div> - - <div class="layout-tbl-paging" id=""> - <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding=""> - <tr> - <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: 10%;">鎿嶄綔</th> - </tr> - <tr id="boxCell" style="display: none;"> - <td name="code">AG000001</td> - <td name="name">鐤嫍鍚嶇О鍚嶇О鍚嶇О</td> - <td name="lotNo">鎵规鍙�</td> - <td name="num">30</td> - <td name="del"> - <div id="" class="tbl-btn-del" lang> - 鍒犻櫎 - </div> - </td> - </tr> - </table> - </div> - </div> </div> @@ -353,6 +417,7 @@ $('#content2').hide(); $(document).ready(function() { $('#option1').click(function() { + // qingkong(); xianshiyemian = 0; $('#content1').show(); $('#option1').attr("style", "background-color: aqua;width: 45.77%;float: left;text-align: center;"); //閫変腑鍚庨鑹� @@ -362,6 +427,7 @@ }); $('#option2').click(function() { + // qingkong(); xianshiyemian = 1; $('#content1').hide(); $('#option1').attr("style", "background-color: #999;width: 45.77%;float: left;text-align: center;"); //榛樿棰滆壊 @@ -371,7 +437,30 @@ }); }); - + + //娓呯┖涓や釜鏍囩椤靛唴瀹� + function qingkong() + { + //鍏ュ簱鍗曟嵁 + // $('#form1').reset() + // $('#form2').reset() + + // //琛ㄦ牸鍐呭 + // let trs = $("#tableBoxList tr") + // let len = trs.length + + // 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(); + // } + } + + /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/ initLanguage() setLanguage() @@ -401,6 +490,17 @@ } checkPalletStat() }) + // 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂 + $("#STOCKCODE1").on('input', function () { + + if ($("#STOCKCODE1").val() == "" || $("#STOCKCODE1").val().length < 8) { + return + } + if ($("#STOCKCODE1").val().length >= 8) { + $("#STOCKCODE1").val($("#STOCKCODE1").val().substr(-8)) + } + checkPalletStat() + }) //绠辩爜鍥炶溅浜嬩欢 $("#BOXCODE").keydown(function (e) { @@ -502,7 +602,7 @@ form.render('select'); var param = { - Type: "0,1" + Type: "2" }; sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) { if (res.code == 0) { //鎴愬姛 @@ -560,67 +660,125 @@ //缁戝畾鍒版墭鐩樹簨浠� form.on('submit(formBind)', function (data) { - console.log(isContinue); - console.log($("#goodSelect").val()); - if ($("#bar").val() == "") { - layer.msg('璇烽�夋嫨鍏ュ簱鍗�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - if ($("#goodSelect").val() == "") { - layer.msg('璇烽�夋嫨鐗╂枡鍙婃槑缁�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - if ($("#STOCKCODE").val() == "") { - layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - if ($("#BOXCODE").val() == "") { - layer.msg('璇锋壂鎻忓绠辨潯鐮�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - 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 () { - //鍥炶皟 - }); - } - }); + if(xianshiyemian == 0) + { + console.log(isContinue); + console.log($("#goodSelect").val()); + if ($("#bar").val() == "") { + layer.msg('璇烽�夋嫨鍏ュ簱鍗�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if ($("#goodSelect").val() == "") { + layer.msg('璇烽�夋嫨鐗╂枡鍙婃槑缁�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if ($("#STOCKCODE").val() == "") { + layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if ($("#BOXCODE").val() == "") { + layer.msg('璇锋壂鎻忓绠辨潯鐮�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + 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 () { + //鍥炶皟 + }); + } + }); + } + else if(xianshiyemian == 1) + { + if ($("#bar1").val() == "") { + layer.msg('璇烽�夋嫨鍏ュ簱鍗�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if ($("#goodSelect1").val() == "") { + layer.msg('璇烽�夋嫨鐗╂枡鍙婃槑缁�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if ($("#STOCKCODE1").val() == "") { + layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + var param = { + AsnNo: $("#bar1").val(), //鍑哄簱鍗曟嵁 + PalletNo: $("#STOCKCODE1").val(), //鎵樼洏鏉$爜 + AsnDetailId: parseInt($("#goodSelect1").val()), //鐗╂枡鎵规 + SkuQty: parseInt($("#SkuQty").val()), //鐗╂枡鏁伴噺 + Origin:"PDA" + } + + console.log(param) + //缁勭洏 + 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(); + $("#STOCKCODE").val(""); + $("#SkuQty").val(""); + }); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + //鍥炶皟 + }); + } + }); + } + return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆� }); @@ -757,105 +915,221 @@ // 娓叉煋绠辩爜淇℃伅 function refreshTable() { - //鍏堟竻绌轰竴涓嬬瀛愬垪琛� - let trs = $("#tableBoxList tr") - let len = trs.length + if (xianshiyemian == 0) + { - for (i = len - 1; i >= 2; i--) { - trs[i].remove(); - } + //鍏堟竻绌轰竴涓嬬瀛愬垪琛� + let trs = $("#tableBoxList tr") + let len = trs.length - //璁剧疆鎵樼洏鍙� - $("#palletCode").val($.cookie('stockCode')) + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } - var param = { - PalletNo: $.cookie('stockCode') - }; - // 鏍规嵁鎵樼洏鍙疯幏鍙栫鐮佷俊鎭� - sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) { - if (res.code == 0) { //鎴愬姛 - var list = res - var arrTrs = new Array() - let idx = 0 - for (var i in res.data) { - var tr = $("#boxCell").eq(0).clone(); - tr.appendTo("#tableBoxList"); - tr.attr('id', res.data[i].Id) - tr.attr('boxno', res.data[i].BoxNo) - 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='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 BindNo = elem.attr('BindNo') - var Id = elem.attr('id') - layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖涓鐗╂枡鍚楋紵<br>" + boxno, { - icon: 2, - time: 0, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - btn: ['鍒犻櫎', '鍙栨秷'], - yes: function () { + //璁剧疆鎵樼洏鍙� + $("#palletCode").val($.cookie('stockCode')) - var param = { - Id: Id, - }; - 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 () { }); - } - }); - } - }) - }) - tr.show(); - arrTrs[i] = tr - } + var param = { + PalletNo: $.cookie('stockCode') + }; + // 鏍规嵁鎵樼洏鍙疯幏鍙栫鐮佷俊鎭� + sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + var list = res + var arrTrs = new Array() + let idx = 0 + for (var i in res.data) { + var tr = $("#boxCell").eq(0).clone(); + tr.appendTo("#tableBoxList"); + tr.attr('id', res.data[i].Id) + tr.attr('boxno', res.data[i].BoxNo) + 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='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 BindNo = elem.attr('BindNo') + var Id = elem.attr('id') + layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖涓鐗╂枡鍚楋紵<br>" + boxno, { + icon: 2, + time: 0, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + btn: ['鍒犻櫎', '鍙栨秷'], + yes: function () { + var param = { + Id: Id, + }; + 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 () { }); + } + }); + } + }) + }) + tr.show(); + arrTrs[i] = tr + } - } else { //涓嶆垚鍔� - layer.msg("鏃犳暟鎹�", { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - $("#boxNum").val(0) - } - }); + //璁剧疆鍒嗛〉 + setPages(1, list.length) + } else { //涓嶆垚鍔� + layer.msg("鏃犳暟鎹�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + $("#boxNum").val(0) + setPages(1, 0) + } + }); + + } + else if (xianshiyemian == 1) + { + //鍏堟竻绌轰竴涓嬬瀛愬垪琛� + let trs = $("#tableBoxList1 tr") + let len = trs.length + + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + + //璁剧疆鎵樼洏鍙� + $("#palletCode").val($.cookie('stockCode1')) + + var param = { + PalletNo: $.cookie('stockCode1') + }; + // 鏍规嵁鎵樼洏鍙疯幏鍙栫鐮佷俊鎭� + sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + var list = res + var arrTrs = new Array() + let idx = 0 + for (var i in res.data) { + var tr = $("#boxCell").eq(0).clone(); + tr.appendTo("#tableBoxList1"); + tr.attr('id', res.data[i].Id) + tr.attr('boxno', res.data[i].BoxNo) + 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='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 BindNo = elem.attr('BindNo') + var Id = elem.attr('id') + layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖鎵樼墿鏂欏悧锛�<br>" + boxno, { + icon: 2, + time: 0, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + btn: ['鍒犻櫎', '鍙栨秷'], + yes: function () { + + var param = { + Id: Id, + }; + 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 () { }); + } + }); + } + }) + }) + tr.show(); + arrTrs[i] = tr + } + + //璁剧疆鍒嗛〉 + setPages(1, list.length) + + } else { //涓嶆垚鍔� + layer.msg("鏃犳暟鎹�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + $("#boxNum").val(0) + setPages(1, 0) + } + }); + } + } // 鍒ゆ柇鎵樼洏鐮佹槸鍚﹀彲鐢� function checkPalletStat() { - var param = { - "PalletNo": $("#STOCKCODE").val() - } - sendData(IP + "/PdaAsn/IsEnablePalletNo", param, 'post', function (res) { - if (res.code == 0) { + if (xianshiyemian == 0) + { + var param = { + "PalletNo": $("#STOCKCODE").val() + } + sendData(IP + "/PdaAsn/IsEnablePalletNo", param, 'post', function (res) { + if (res.code == 0) { - $.cookie('stockCode', $("#STOCKCODE").val()); - refreshTable() - $("#BOXCODE").focus(); + $.cookie('stockCode', $("#STOCKCODE").val()); + refreshTable() + $("#BOXCODE").focus(); - } else { - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); + } else { + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + else if (xianshiyemian == 1) + { + var param = { + "PalletNo": $("#STOCKCODE1").val() + } + sendData(IP + "/PdaAsn/IsEnablePalletNo", param, 'post', function (res) { + if (res.code == 0) { + + $.cookie('stockCode1', $("#STOCKCODE1").val()); + refreshTable() + $("#SkuQty").focus(); + + } else { + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } + } @@ -901,7 +1175,198 @@ } + + /* 鍒嗛〉 */ + //璁剧疆鍒嗛〉 + function setPages(pageIndex, boxNum){ + + if (xianshiyemian == 0) + { + if(boxNum <= 0){ + //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� + $("#tableBoxPages").hide() + return + } + + let pageNum = Math.floor(boxNum / 10); + if(boxNum % 10 > 0){ + pageNum += 1; + } + //console.log("pageNum is " + pageNum) + + $("#tableBoxPages").find("tr").remove() + let table = $("#tableBoxPages") + $("<tr></tr>").appendTo("#tableBoxPages") + + // let newTr = table.append("<tr></tr>") + // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") + $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function(){ + onClickPrevPage() + }) + for(i=1; i < pageNum + 1; i++){ + // newTr.append("<td class='page-num'>"+ i +"</td>") + $("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages tr") + } + // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") + $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function(){ + onClickNextPage() + }) + // pages.show() + $("#tableBoxPages").show() + + setCurPage(1) + } + else if (xianshiyemian == 1) + { + if(boxNum <= 0){ + //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� + $("#tableBoxPages1").hide() + return + } + + let pageNum = Math.floor(boxNum / 10); + if(boxNum % 10 > 0){ + pageNum += 1; + } + //console.log("pageNum is " + pageNum) + + $("#tableBoxPages1").find("tr").remove() + let table = $("#tableBoxPages1") + $("<tr></tr>").appendTo("#tableBoxPages1") + + // let newTr = table.append("<tr></tr>") + // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") + $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages1 tr") + $("#tableBoxPages1 tr").eq(0).find("td[id^='prevPage']").click(function(){ + onClickPrevPage() + }) + for(i=1; i < pageNum + 1; i++){ + // newTr.append("<td class='page-num'>"+ i +"</td>") + $("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages1 tr") + } + // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") + $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages1 tr") + $("#tableBoxPages1 tr").eq(0).find("td[id^='nextPage']").click(function(){ + onClickNextPage() + }) + // pages.show() + $("#tableBoxPages1").show() + + setCurPage(1) + } + + } + + //璁剧疆褰撳墠鍒嗛〉 + function setCurPage(pageIndex){ + if (xianshiyemian == 0) + { + let totalTrNum = $("#tableBoxList tr").length + if(totalTrNum <= 2 ){ + //console.log("tableBoxList 涓虹┖ totalTrNum: " + totalTrNum) + //curPageIndex = 1 + return + } + + let pageNum = getBoxPageNum() + if(pageIndex > pageNum){ + //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) + //curPageIndex = 1 + return + } + + let startIndex = (pageIndex - 1) * 10 + 1 + let n = totalTrNum - startIndex + let endIndex = 0 + if(n > 9){ + endIndex = startIndex + 9 + }else{ + endIndex = startIndex + n + } + + let trs = $("#tableBoxList tr") + //console.log("琛屾暟 "+trs.length) + let d = 0 + for(let i = 2; i < trs.length; i++){ + //console.log("琛岀储寮� " + trs.eq(i).attr('index')) + let t = trs.eq(i) + d = t.attr('index') + if(d >= startIndex && d <= endIndex){ + //console.log("闇�瑕佹樉绀�") + //鏄剧ず琛� + t.show() + }else{ + //闅愯棌琛� + t.hide() + } + } + + curPageIndex = pageIndex + + let ptr = $("#tableBoxPages tr") + for(let i = 1; i < pageNum+1; i++){ + ptr.eq(0).find("td").eq(i).removeClass("page-num-select") + if(i == curPageIndex){ + ptr.eq(0).find("td").eq(i).addClass("page-num-select") + } + } + } + else if (xianshiyemian == 1) + { + let totalTrNum = $("#tableBoxList1 tr").length + if(totalTrNum <= 2 ){ + return + } + + let pageNum = getBoxPageNum() + if(pageIndex > pageNum){ + //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) + //curPageIndex = 1 + return + } + + let startIndex = (pageIndex - 1) * 10 + 1 + let n = totalTrNum - startIndex + let endIndex = 0 + if(n > 9){ + endIndex = startIndex + 9 + }else{ + endIndex = startIndex + n + } + + let trs = $("#tableBoxList1 tr") + //console.log("琛屾暟 "+trs.length) + let d = 0 + for(let i = 2; i < trs.length; i++){ + //console.log("琛岀储寮� " + trs.eq(i).attr('index')) + let t = trs.eq(i) + d = t.attr('index') + if(d >= startIndex && d <= endIndex){ + //console.log("闇�瑕佹樉绀�") + //鏄剧ず琛� + t.show() + }else{ + //闅愯棌琛� + t.hide() + } + } + + curPageIndex = pageIndex + + let ptr = $("#tableBoxPages1 tr") + for(let i = 1; i < pageNum+1; i++){ + ptr.eq(0).find("td").eq(i).removeClass("page-num-select") + if(i == curPageIndex){ + ptr.eq(0).find("td").eq(i).addClass("page-num-select") + } + } + } + + } + /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/ form.on('switch(IsLianXu)', function (obj) { if (obj.elem.checked) { diff --git a/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs b/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs index 3f9b194..b57c800 100644 --- a/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs +++ b/Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs @@ -60,5 +60,10 @@ /// </summary> public string TailBoxNo01 { get; set; } + /// <summary> + /// Desc:鐗╂枡鏁伴噺 + /// </summary> + public int SkuQty { get; set; } + } } diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs index 5d15df5..fddc652 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs @@ -132,7 +132,7 @@ public List<BoxInfoDto> GetBoxInfos(BoxInfoVm model) { try - { + { string sqlString = string.Empty; if (model.IsHuiKu == 0) { @@ -517,7 +517,7 @@ #region 鏄惁鍥炴祦鍏ュ簱 int iscount = 0; //搴撳瓨鏄庣粏淇℃伅 - var stockDetail = Db.Queryable<DataStockDetail>().Where(a => a.IsDel == "0" && a.PalletNo == model.PalletNo).ToList(); + var stockDetail = Db.Queryable<DataStockDetail>().Where(a => a.IsDel == "0" && a.PalletNo == model.PalletNo).ToList(); //楠岃瘉搴撳瓨鏄惁鎷ユ湁璇ユ墭淇℃伅 if (stockDetail != null && stockDetail.Count > 0) { @@ -635,7 +635,7 @@ strMsg = "-1:绠辩爜淇℃伅涓嶅瓨鍦紝璇锋牳鏌�!"; return strMsg; } - else + else { // 鏀瑰彉绠辨敮鍏崇郴琛ㄧ姸鎬侊細宸插叆搴� sqlString = $"Update BllBoxInfo set Status = '2' where PalletNo = '{model.PalletNo}' and ASNNo = '{model.ASNNo}' and Status = '1'"; @@ -644,7 +644,7 @@ pallQty = boxinfo2.Sum(w => w.Qty); //鍏ュ簱鍗曟槑缁嗗畬鎴愭暟閲忓鍔� noticeItem.CompleteQty += pallQty; - } + } //鍒ゆ柇鍏ュ簱鏁伴噺澧炲姞鍚庢槸鍚﹀ぇ浜庣瓑浜庡崟鎹暟閲� if (noticeItem.CompleteQty >= noticeItem.Qty) { @@ -703,7 +703,7 @@ sqlString = "select sum(qty) from BllBoxInfo where isdel = 0 and "; sqlString += $"BindNo = '{palletbindInfo.Id}'"; int inspectQty = Db.Ado.GetInt(sqlString); - + // 娣诲姞搴撳瓨鏄庣粏琛� detailModel = new DataStockDetail() { @@ -1109,7 +1109,7 @@ try { //鍏ュ簱涓� - var aSNNoList= Db.Ado.SqlQuery<string>($"SELECT DISTINCT ASNNo from BllPalletBind where IsDel=0 and Status=0 and PalletNo='{palletNo}' ").ToList(); + var aSNNoList = Db.Ado.SqlQuery<string>($"SELECT DISTINCT ASNNo from BllPalletBind where IsDel=0 and Status=0 and PalletNo='{palletNo}' ").ToList(); if (aSNNoList.Count <= 0) { //搴撳鎵樼洏鎴栧钩搴撴墭鐩� @@ -1166,7 +1166,7 @@ //鎷兼墭鍏ュ簱 public void CompleteInStockLing(PdaLingAsnVm model, int userId) { - try + try { if (string.IsNullOrWhiteSpace(model.AsnNo)) { @@ -1203,10 +1203,10 @@ foreach (var item in boxinfo) { if (!string.IsNullOrEmpty(item.PalletNo)) - { + { throw new Exception("-1:璇ョ鐮佸凡缁戝畾鍏朵粬鎵樼洏锛岃鍏堣В缁戞墭鐩�!"); } - bNum += item.Qty; + bNum += item.Qty; } if (bNum == boxinfo[0].FullQty) { @@ -1267,7 +1267,7 @@ //淇敼鍏ュ簱鍗曟�诲崟淇℃伅 arrival.Status = "2"; arrival.CompleteTime = serverTime; - arrival.UpdateUser =userId; + arrival.UpdateUser = userId; arrival.UpdateTime = serverTime; Db.Updateable(arrival).ExecuteCommand(); } @@ -1373,7 +1373,7 @@ #region 搴撳瓨鏄庣粏琛� var boxinfoItem = boxinfo.First(); - var detailModel = Db.Queryable<DataStockDetail>() .First(it => it.PalletNo == model.PalletNo && it.LotNo == arrivalnotice.LotNo + var detailModel = Db.Queryable<DataStockDetail>().First(it => it.PalletNo == model.PalletNo && it.LotNo == arrivalnotice.LotNo && it.SkuNo == arrivalnotice.SkuNo && it.Standard == arrivalnotice.Standard && it.IsDel == "0"); var stId = 0; if (detailModel == null || detailModel.Id == 0) @@ -1512,10 +1512,10 @@ sqlString += $"group by BoxNo,SkuNo,SkuName,LotNo; "; } else - { + { sqlString = "select BoxNo, SkuNo,SkuName, LotNo, SUM(Qty) as Qty from BLLLabelBoxNo where IsDel = '0' "; sqlString += $"and BoxNo = '{model.BoxNo}' and IsUse='0' "; - sqlString += $"group by BoxNo,SkuNo,SkuName,LotNo; "; + sqlString += $"group by BoxNo,SkuNo,SkuName,LotNo; "; } var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString); if (models == null) @@ -1548,19 +1548,24 @@ { throw new Exception("-1:鎵樼洏鍙蜂笉鍙负绌�!"); } - if (string.IsNullOrEmpty(model.BoxNo)) + //鍒ゆ柇鐗╂枡鏁伴噺鏄惁涓�0 涓�0鍒ゆ柇绠辩爜淇℃伅 涓嶄负0缁х画 + if (model.SkuQty == 0) { - throw new Exception("-1:绠辩爜淇℃伅涓嶅彲涓虹┖!"); - } - - if (model.IsContinue == "1") - { - if (string.IsNullOrWhiteSpace(model.TailBoxNo)) + if (string.IsNullOrEmpty(model.BoxNo)) { - throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屽熬绠辩爜淇℃伅涓嶅彲涓虹┖!"); + throw new Exception("-1:绠辩爜淇℃伅涓嶅彲涓虹┖!"); } + if (model.IsContinue == "1") + { + if (string.IsNullOrWhiteSpace(model.TailBoxNo)) + { + throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屽熬绠辩爜淇℃伅涓嶅彲涓虹┖!"); + } + + } } + #endregion // 楠岃瘉鍏ュ簱鍗曟�昏〃 var notice = Db.Queryable<BllArrivalNotice>().First(m => m.IsDel == "0" && m.ASNNo == model.AsnNo); @@ -1571,11 +1576,11 @@ //鍏ュ簱鍗曠被鍨嬶紝0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 2锛氫腑闂村搧鍏ュ簱 3锛氶��璐у叆搴� 4锛氳溅闂翠綑鏂欓��鍥炲叆搴� 5锛氬叾瀹冨叆搴� 6锛氫唬鍌ㄥ叆搴� if (notice.Type == "0" || notice.Type == "3" || notice.Type == "5" || notice.Type == "6") { - BindPalletForBox(model,userId,origin); + BindPalletForBox(model, userId, origin); } else { - BindPalletForLabelBox(model,userId); + BindPalletForLabelBox(model, userId); } } catch (Exception ex) @@ -1774,7 +1779,7 @@ // 鏇存敼鍏ュ簱鍗曟槑缁嗗凡缁勬暟閲� var sqlString = string.Empty; - sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{factQty}' where id = '{model.AsnDetailId}';"; + sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';"; Db.Ado.ExecuteCommand(sqlString); // 鏇存敼鍏ュ簱鍗曞強鍏ュ簱鏄庣粏鐘舵�� @@ -1821,27 +1826,31 @@ { throw new Exception("-1:鎵樼洏鍙蜂笉鍙负绌�!"); } - if (string.IsNullOrEmpty(model.BoxNo)) + if (model.SkuQty == 0) { - throw new Exception("-1:绠辩爜淇℃伅涓嶅彲涓虹┖!"); - } - - if (model.IsContinue == "1") - { - if (string.IsNullOrWhiteSpace(model.TailBoxNo)) + if (string.IsNullOrEmpty(model.BoxNo)) { - throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屽熬绠辩爜淇℃伅涓嶅彲涓虹┖!"); + throw new Exception("-1:绠辩爜淇℃伅涓嶅彲涓虹┖!"); } - } - if (model.IsContinue == "0" && model.IsContinue2 == "1") - { - if (string.IsNullOrWhiteSpace(model.TailBoxNo01)) + if (model.IsContinue == "1") { - throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屼簩绾х爜灏剧爜淇℃伅涓嶅彲涓虹┖!"); - } + if (string.IsNullOrWhiteSpace(model.TailBoxNo)) + { + throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屽熬绠辩爜淇℃伅涓嶅彲涓虹┖!"); + } + } + if (model.IsContinue == "0" && model.IsContinue2 == "1") + { + if (string.IsNullOrWhiteSpace(model.TailBoxNo01)) + { + throw new Exception("-1:寮�鍚繛缁粍鎵樻椂锛屼簩绾х爜灏剧爜淇℃伅涓嶅彲涓虹┖!"); + } + + } } + #endregion Db.BeginTran(); @@ -1923,7 +1932,7 @@ PalletNo = model.PalletNo, PalletNo2 = "", PalletNo3 = "", - Qty = 0, + Qty = model.SkuQty, FullQty = pNum, Status = "0", Type = "0", @@ -1949,119 +1958,123 @@ } #region 绠辩爜淇℃伅 - - var msgStr = $"绠卞彿涓簕model.BoxNo}"; var boxInfoList = new List<BllLabelBoxNo>(); - //棣栫 - var boxInfo = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo && m.IsUse == "0" && m.Level == "1").ToList(); - if (boxInfo.Count == 0) - { - throw new Exception("-1:绠辩爜淇℃伅涓嶅瓨鍦�!"); - } - //鏄惁杩炵画缁勬墭 - if (model.IsContinue == "1") - { - boxInfoList.AddRange(boxInfo); - //灏剧 - var boxInfo2 = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo && m.IsUse == "0" && m.Level == "1").ToList(); - if (boxInfo2.Count == 0) - { - throw new Exception("-1:灏剧鐮佷俊鎭笉瀛樺湪!"); - } - boxInfoList.AddRange(boxInfo2); - var sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}' and Level='1'; "; - var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList.AddRange(list); - - //鎵惧埌鐩稿叧鐨勪簩绾х爜 - foreach (var item in boxInfoList) - { - sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and ParentBoxNo='{item.BoxNo}' and Level = '2' "; - list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList.AddRange(list); - } - msgStr += $"灏剧鍙蜂负{model.TailBoxNo}"; - } - else - { - var boxInfoList2 = new List<BllLabelBoxNo>();//鎵�鏈変簩绾х爜 - decimal boxQty = 0.00m;//绠卞唴浜岀骇鐮佹暟閲� - if (!string.IsNullOrEmpty(model.BoxNo01)) - { - //浜岀骇鐮侀鐮� - var box01Info = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo01 && m.IsUse == "0" && m.Level == "2" && (string.IsNullOrEmpty(m.ParentBoxNo) || m.ParentBoxNo == model.BoxNo)).ToList(); - if (box01Info.Count == 0) - { - throw new Exception("-1:浜岀骇鐮侀鐮佷俊鎭笉瀛樺湪!"); - } - boxInfoList2.AddRange(box01Info); - if (model.IsContinue2 == "1") - { - //浜岀骇鐮佸熬鐮� - var box01Info2 = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo01 && m.IsUse == "0" && m.Level == "2" && (string.IsNullOrEmpty(m.ParentBoxNo) || m.ParentBoxNo == model.BoxNo)).ToList(); - if (box01Info2.Count == 0) - { - throw new Exception("-1:浜岀骇鐮佸熬鐮佷俊鎭笉瀛樺湪!"); - } - boxInfoList2.AddRange(box01Info2); - //涓棿鐮� - var sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}' and Level='2' and (ParentBoxNo='' || ParentBoxNo='{model.BoxNo}'); "; - var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList2.AddRange(list); - } - foreach (var item in boxInfoList2) - { - item.ParentBoxNo = model.BoxNo; - boxQty += item.Qty; - } - boxInfoList.AddRange(boxInfoList2); - foreach (var item in boxInfo) - { - item.Qty = boxQty; - } - } - boxInfoList.AddRange(boxInfo); - } - #endregion - #endregion - // 鏇存敼绠辨敮鍏崇郴琛� + var msgStr = $"绠卞彿涓簕model.BoxNo}"; decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲� - var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList(); - foreach (var g in boxGroup) + if (model.SkuQty == 0) { - decimal boxFullQty = 0.00m;//绠卞唴鎬绘暟閲� - foreach (var box in g) + //棣栫 + var boxInfo = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo && m.IsUse == "0" && m.Level == "1").ToList(); + if (boxInfo.Count == 0) { - if (box.IsUse != "0") - { - continue; - } - //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎 - if (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo) - { - throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!"); - } - - box.ASNNo = model.AsnNo; - box.ASNDetailNo = model.AsnDetailId; - box.IsUse = "1"; - box.CompleteTime = DateTime.Now; - box.UpdateTime = DateTime.Now; - box.UpdateUser = userId; - - if (box.ParentBoxNo == "" && box.Level == "1") - { - factQty += box.Qty; - boxFullQty += box.Qty; - } + throw new Exception("-1:绠辩爜淇℃伅涓嶅瓨鍦�!"); } - if (boxFullQty > bNum) + //鏄惁杩炵画缁勬墭 + if (model.IsContinue == "1") { - throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒"); + boxInfoList.AddRange(boxInfo); + //灏剧 + var boxInfo2 = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo && m.IsUse == "0" && m.Level == "1").ToList(); + if (boxInfo2.Count == 0) + { + throw new Exception("-1:灏剧鐮佷俊鎭笉瀛樺湪!"); + } + boxInfoList.AddRange(boxInfo2); + var sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}' and Level='1'; "; + var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); + boxInfoList.AddRange(list); + + //鎵惧埌鐩稿叧鐨勪簩绾х爜 + foreach (var item in boxInfoList) + { + sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and ParentBoxNo='{item.BoxNo}' and Level = '2' "; + list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); + boxInfoList.AddRange(list); + } + msgStr += $"灏剧鍙蜂负{model.TailBoxNo}"; } + else + { + var boxInfoList2 = new List<BllLabelBoxNo>();//鎵�鏈変簩绾х爜 + decimal boxQty = 0.00m;//绠卞唴浜岀骇鐮佹暟閲� + if (!string.IsNullOrEmpty(model.BoxNo01)) + { + //浜岀骇鐮侀鐮� + var box01Info = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo01 && m.IsUse == "0" && m.Level == "2" && (string.IsNullOrEmpty(m.ParentBoxNo) || m.ParentBoxNo == model.BoxNo)).ToList(); + if (box01Info.Count == 0) + { + throw new Exception("-1:浜岀骇鐮侀鐮佷俊鎭笉瀛樺湪!"); + } + boxInfoList2.AddRange(box01Info); + if (model.IsContinue2 == "1") + { + //浜岀骇鐮佸熬鐮� + var box01Info2 = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo01 && m.IsUse == "0" && m.Level == "2" && (string.IsNullOrEmpty(m.ParentBoxNo) || m.ParentBoxNo == model.BoxNo)).ToList(); + if (box01Info2.Count == 0) + { + throw new Exception("-1:浜岀骇鐮佸熬鐮佷俊鎭笉瀛樺湪!"); + } + boxInfoList2.AddRange(box01Info2); + //涓棿鐮� + var sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}' and Level='2' and (ParentBoxNo='' || ParentBoxNo='{model.BoxNo}'); "; + var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); + boxInfoList2.AddRange(list); + } + foreach (var item in boxInfoList2) + { + item.ParentBoxNo = model.BoxNo; + boxQty += item.Qty; + } + boxInfoList.AddRange(boxInfoList2); + foreach (var item in boxInfo) + { + item.Qty = boxQty; + } + } + boxInfoList.AddRange(boxInfo); + } + + + + #endregion + #endregion + // 鏇存敼绠辨敮鍏崇郴琛� + var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList(); + foreach (var g in boxGroup) + { + decimal boxFullQty = 0.00m;//绠卞唴鎬绘暟閲� + foreach (var box in g) + { + if (box.IsUse != "0") + { + continue; + } + //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎 + if (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo) + { + throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!"); + } + + box.ASNNo = model.AsnNo; + box.ASNDetailNo = model.AsnDetailId; + box.IsUse = "1"; + box.CompleteTime = DateTime.Now; + box.UpdateTime = DateTime.Now; + box.UpdateUser = userId; + + if (box.ParentBoxNo == "" && box.Level == "1") + { + factQty += box.Qty; + boxFullQty += box.Qty; + } + } + if (boxFullQty > bNum) + { + throw new Exception($"缁戝畾澶辫触锛寋g.Key}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒"); + } + } + Db.Updateable(boxInfoList).ExecuteCommand(); } - Db.Updateable(boxInfoList).ExecuteCommand(); - // 鏇存柊鎵樼洏缁戝畾琛� bind.Qty += factQty; if (bind.FullQty < bind.Qty) @@ -2077,7 +2090,7 @@ // 鏇存敼鍏ュ簱鍗曟槑缁嗗凡缁勬暟閲� var sqlString = string.Empty; - sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{factQty}' where id = '{model.AsnDetailId}';"; + sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';"; Db.Ado.ExecuteCommand(sqlString); // 鏇存敼鍏ュ簱鍗曞強鍏ュ簱鏄庣粏鐘舵�� -- Gitblit v1.8.0