yuyou_x
2024-03-06 38d24bdd00d8dd9e416fc5988831ec4b62e696ca
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%;">出库口:</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%;">拣货</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 @@
         //是否整托拣货
         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())  //拣货数量
            if (pickQty <= 0) {
               layer.msg("拣货数量需大于0", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               });
               return;
            }
            if (canPickBox == false) {
               layer.msg("请求未完成,不要重复请求", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               });
               return;
            }
            reqPickScatter2()
            return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
         });
         //确认拣货
         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>