zhaowc
2025-03-27 d07f25c163706ac46a83bd2c63db1e3c52715222
Pda/View/SoSetting/SampleOut.html
@@ -169,12 +169,13 @@
            </ul>
         </div>
         <ul>
         <!-- <ul>
                <li id="option1">标签</li>
                <li id="option2">数量</li>
            </ul>
            <br />
            </ul> -->
         <button id="option1" class="layout-btn" type="button">标签</button>
            <button id="option2" class="layout-btn" type="button">数量</button>
            <br /><br />
         <!-- 有码 -->
         <div id="content1">
@@ -287,8 +288,8 @@
                              <div class="layui-form-item layout-input" style="margin-top: 6px;">
                                 <label class="layui-form-label lableWidth">拣货数量:</label>
                                 <div class="layui-input-block">
                                    <input id="pickQty1" type="number" placeholder="请输入拣货数量"autocomplete="off"
                                       class="layui-input" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
                                    <input id="pickQty1" type="text" placeholder="请输入拣货数量"autocomplete="off"
                                       class="layui-input" >
                                 </div>
                              </div>
                           </td>
@@ -481,9 +482,9 @@
                                 <label class="layui-form-label lableWidth" >拣货数量:</label>
                                 <div id="" class="local-input">
                                    <div class="layui-input-block">
                                       <input id="pickQty2" type="number" placeholder="请输入拣货数量"
                                       <input id="pickQty2" type="text" placeholder="请输入拣货数量"
                                          autocomplete="off" class="layui-input" style="padding-left:0.1rem;"
                                          oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
                                          >
                                    </div>
                                 </div>
                                 <div id="" class="local-ok">
@@ -549,8 +550,9 @@
         var form = layui.form;
         /* 标签切换代码 */
         var xianshiyemian = 0;
            /* 标签切换代码 */
         var sampleType = "";  //0 库内取样; 1 库前取样
            
            $('#kuneilabel').hide();
            $('#kuqianlabel').hide();
@@ -559,18 +561,18 @@
            
            $('#kuneiQty').hide();
         $('#option1').attr("style", "background-color: aqua;width: 45.77%;float: left;text-align: center;"); //选中后颜色
         $('#option2').attr("style", "background-color: #999;width: 45.77%;float: right;text-align: center;"); //默认颜色
         $('#option1').attr("style", "background-color: red;width: 50%;float: left;text-align: center;"); //选中后颜色
         $('#option2').attr("style", "background-color: #999;width: 50%;float: right;text-align: center;"); //默认颜色
         $('#content2').hide();
         $(document).ready(function () {
            $('#option1').click(function () {
               // qingkong();
               // qingkong();aqua
               xianshiyemian = 0;
               $('#content1').show();
               $('#option1').attr("style", "background-color: aqua;width: 45.77%;float: left;text-align: center;"); //选中后颜色
               $('#option1').attr("style", "background-color: red;width: 50%;float: left;text-align: center;"); //选中后颜色
               $('#content2').hide();
               $('#option2').attr("style", "background-color: #999;width: 45.77%;float: right;text-align: center;"); //默认颜色
               $('#option2').attr("style", "background-color: #999;width: 50%;float: right;text-align: center;"); //默认颜色
               $("#palletNo").focus();//光标默认选中
            });
@@ -578,10 +580,10 @@
               // qingkong();
               xianshiyemian = 1;
               $('#content1').hide();
               $('#option1').attr("style", "background-color: #999;width: 45.77%;float: left;text-align: center;"); //默认颜色
               $('#option1').attr("style", "background-color: #999;width: 50%;float: left;text-align: center;"); //默认颜色
               $('#content2').show();
               $('#option2').attr("style", "background-color: aqua;width: 45.77%;float: right;text-align: center;"); //选中后颜色
               $('#option2').attr("style", "background-color: red;width: 50%;float: right;text-align: center;"); //选中后颜色
               $("#palletNo2").focus();//光标默认选中
            });
         });
@@ -655,6 +657,17 @@
                                    $('#kuneilabel').show();
                                    $('#kuneiQty').show();
                                    $('#kuqianlabel').hide();
                                    updateBillList();
                                    if ($('#bar').val() == "") {
                                        clear1();
                                        return;
                                    } else {
                                        updateSkuLotNoList();
                                        updateQtyList();
                                        getBar();
                                        GetBoxInfo();
                                    }
                                    sampleType = "0";
                                }
                                if (res.data == "1") {//库前取样
                                    $('#kuqianlabel').show();
@@ -662,17 +675,10 @@
                                    $('#kuneiQty').hide();
                                    
                                    updateAsnBillList();
                                    GetBoxInfo();
                                    sampleType = "1";
                                }
                                // updateBillList();
                                // if ($('#bar').val() == "") {
                                //     clear1();
                                //     return;
                                // } else {
                                //     updateSkuLotNoList();
                                //     updateQtyList();
                                //     getBar();
                                //     GetBoxInfo();
                                // }
                            }else { //不成功
                                layer.msg(res.msg, {
                                    icon: 2,
@@ -941,101 +947,150 @@
         //单拣货(确认按钮)
         form.on('submit(formPickScatter)', function (data) {
            if ($('#bar').val() == "") {
               layer.msg("请选择出库单", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               }); return;
            }
            if ($('#bar').val() == "") {
               layer.msg("请选择物料-批次", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               }); return;
            }
            if ($('#palletNo').val() == "") {
               layer.msg("请输入托盘码", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               }); return;
            }
            if(isContinue=="0"){
               if ($('#boxNo').val() == "") {
                  layer.msg("请输入箱码", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  }); return;
               }
               if ($('#boxQty').val() == "") {
                  layer.msg("箱内数量为空,不能拣货", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return;
               }
               if(($('#boxNo3').val() != "" && ($('#pickQty1').val() != "" || $('#pickQty1').val() != 0))){
                  layer.msg("追溯条码和拣货数量不能同时输入!", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return;
               }
               if($('#pickQty1').val() != "" && $('#pickQty1').val()>parseInt($('#pickQty').val())){
                  layer.msg("拣货数量不能大于待拣数量!", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return;
               }
            }
            // let boxQty = parseInt($('#boxQty').val())
            // let qty = parseInt($('#qty').val())
            // if (qty <= 0 || qty > boxQty) {
            //    layer.msg("拣货数量需大于0,并且不能超过待拣箱内数量", {
            //       icon: 2,
            //       time: 2000 //2秒关闭(如果不配置,默认是3秒)
            //    });
            //    return;
            // }
                if (sampleType == "0") {
                    if ($('#bar').val() == "") {
                        layer.msg("请选择出库单", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }); return;
                    }
                    if ($('#bar').val() == "") {
                        layer.msg("请选择物料-批次", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }); return;
                    }
                    if ($('#palletNo').val() == "") {
                        layer.msg("请输入托盘码", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }); return;
                    }
                    if(isContinue=="0"){
                        if ($('#boxNo').val() == "") {
                            layer.msg("请输入箱码", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }); return;
                        }
                        if ($('#boxQty').val() == "") {
                            layer.msg("箱内数量为空,不能拣货", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                            return;
                        }
                        if(($('#boxNo3').val() != "" && ($('#pickQty1').val() != "" || $('#pickQty1').val() != 0))){
                            layer.msg("追溯条码和拣货数量不能同时输入!", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                            return;
                        }
                        if($('#pickQty1').val() != "" && $('#pickQty1').val()>parseFloat($('#pickQty').val())){
                            layer.msg("拣货数量不能大于待拣数量!", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                            return;
                        }
                    }
                }
                else if (sampleType == "1") {
                    if ($('#AsnBar').val() == "") {
                        layer.msg("请选择入库单", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }); return;
                    }
                    if ($('#boxNo').val() == "") {
                        layer.msg("请输入箱码", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }); return;
                    }
                    if(($('#boxNo3').val() != "" && ($('#pickQty1').val() != "" || $('#pickQty1').val() != 0))){
                        layer.msg("追溯条码和拣货数量不能同时输入!", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
                    }
                }
                else {
                    layer.msg("类型错误,请刷新页面重试", {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    });
                    return;
                }
                if (canPickBox == false) {
            if (canPickBox == false) {
                    layer.msg("请求未完成,不要重复请求", {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    });
                    return;
                }
               layer.msg("请求未完成,不要重复请求", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               });
               return;
            }
            reqPickScatter()
                reqPickScatter()
            return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
         });
         //确认拣货 
         function reqPickScatter() {
                canPickBox = false//回调
            if($('#pickQty1').val()!= "" && $('#pickQty1').val()!= undefined){
               console.log("111111111111111111"+$('#pickQty1').val());
               var reg = /^[1-9]\d*(\.\d{1,4})?$|^0\.\d{1,4}[1-9]\d*$/;
               if (!reg.test($("#pickQty1").val())) {
                  layer.msg("数量必须大于0(可保留4位小数)", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return -1;
               }
            }
            var param = {
               "SoNo": $("#bar").val(),
               "SoDetailId": $("#skuLotNo").val(),
               "PalletNo": $('#palletNo').val(),
               "BoxNo": $('#boxNo').val(),
               "BoxNo3": $('#boxNo3').val(),
               "PickQty":$('#pickQty1').val()
               "PickQty":$('#pickQty1').val(),
               "AsnNo":$('#AsnBar').val(),
                    "Type":sampleType
            }
            sendData(IP + "/PdaSo/SoSetPick", param, 'post', function (res) {
               //console.log(res);
            sendData(IP + "/PdaSo/SampleSoSetPick", param, 'post', function (res) {
               
               if (res.code == 0) { //成功
                  layer.msg(res.msg, {
                     icon: 1,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  }, function () {
                     canPickBox = true//回调
                     $("#boxNo").val('');
                     $("#boxNo3").val('');
                     updateQtyList();
                     getBar();
                     GetBoxInfo();
                            if (sampleType == "0") {
                                canPickBox = true//回调
                                $("#boxNo").val('');
                                $("#boxNo3").val('');
                                updateQtyList();
                                getBar();
                                GetBoxInfo();
                            }
                            if (sampleType == "1") {
                                canPickBox = true//回调
                                $("#boxNo").val('');
                                $("#boxNo3").val('');
                                $("#pickQty1").val('');
                                GetBoxInfo();
                            }
                  });
               } else { //不成功
                  layer.msg(res.msg, {
@@ -1273,25 +1328,29 @@
                                if (res.data == "0") {//库内取样
                                    $('#kuneilabel2').show();
                                    $('#kuqianlabel2').hide();
                           updateBillList2();
                           console.log($('#bar2').val())
                           if ($('#bar2').val() == "") {
                              console.log(1)
                              clear21();
                              return;
                           } else {
                              console.log(2)
                              updateSkuLotNoList2();
                              updateQtyList2();
                              getBar2();
                              GetDataInfo();
                           }
                           sampleType = "0";
                                }
                                if (res.data == "1") {//库前取样
                                    $('#kuqianlabel2').show();
                                    $('#kuneilabel2').hide();
                                    updateAsnBillList2();
                           GetDataInfo();
                                    sampleType = "1";
                                }
                                // updateBillList2();
                                // console.log($('#bar2').val())
                                // if ($('#bar2').val() == "") {
                                //    console.log(1)
                                //    clear21();
                                //    return;
                                // } else {
                                //    console.log(2)
                                //    updateSkuLotNoList2();
                                //    updateQtyList2();
                                //    getBar2();
                                //    GetDataInfo();
                                // }
                            }else { //不成功
                                layer.msg(res.msg, {
                                    icon: 2,
@@ -1491,33 +1550,60 @@
         //单拣货(确认按钮)
         form.on('submit(formPickScatter2)', function (data) {
            if ($('#bar2').val() == "") {
               layer.msg("请选择出库单", {
                  icon: 2,
                  time: 2000 //2秒关闭(如果不配置,默认是3秒)
               }); return;
            if (sampleType == "0") {
               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 = parseFloat($('#pickedQty2').val()) //已拣数量
               let pickQty = parseFloat($('#pickQty2').val())  //拣货数量
               if (pickQty <= 0) {
                  layer.msg("拣货数量需大于0", {
                     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;
            }
            else if (sampleType == "1") {
                    if ($('#AsnBar').val() == "") {
                        layer.msg("请选择入库单", {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }); return;
                    }
               let pickedQty = parseFloat($('#pickedQty2').val()) //已拣数量
               let pickQty = parseFloat($('#pickQty2').val())  //拣货数量
               if (pickQty <= 0) {
                  layer.msg("拣货数量需大于0", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return;
               }
                }
                else {
                    layer.msg("类型错误,请刷新页面重试", {
                        icon: 2,
                        time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    });
                    return;
                }
            if (canPickBox == false) {
@@ -1535,24 +1621,45 @@
         //确认拣货 
         function reqPickScatter2() {
            canPickBox = false//回调
            if($('#pickQty2').val()!= "" && $('#pickQty2').val()!= undefined){
               var reg = /^[1-9]\d*(\.\d{1,4})?$|^0\.\d{1,4}[1-9]\d*$/;
               if (!reg.test($("#pickQty2").val())) {
                  layer.msg("数量必须大于0(可保留4位小数)", {
                     icon: 2,
                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
                  });
                  return -1;
               }
            }
            var param = {
               "SoNo": $("#bar2").val(),
               "SoDetailId": $("#skuLotNo2").val(),
               "PalletNo": $('#palletNo2').val(),
               "PickQty": $('#pickQty2').val(),
               "AsnNo":$('#AsnBar').val(),
                    "Type":sampleType
            }
            sendData(IP + "/PdaSo/SoSetQtyPick", param, 'post', function (res) {
            sendData(IP + "/PdaSo/SampleSoSetQtyPick", 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();
                     if (sampleType == "0") {
                        canPickBox = true//回调
                        updateQtyList2();
                        getBar2();
                        GetDataInfo();
                     }
                     if (sampleType == "1") {
                        canPickBox = true//回调
                        GetDataInfo();
                     }
                  });
               } else { //不成功
                  layer.msg(res.msg, {