chengsc
2025-02-28 f9a9a948cd138ad0877c54319857c327c0c0c402
Pda/View/AsnSetting/productEnterQuantity.html
@@ -358,7 +358,7 @@
                            <label class="layui-form-label" lang>寄存备注:</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" id="Demo" name="Demo" class="layui-textarea" ></textarea>
                            </div>
                        </div> -->
                        <!-- 维护备注弹框 -->
@@ -418,7 +418,7 @@
                            </td>
                        </tr>
                    </table>
                    <table id="tableBoxPages1" class="tbl-box-pages" border="" cellspacing="" cellpadding="">
                        <tr>
                            <td class="page-prev">上一页</td>
@@ -477,38 +477,12 @@
                });
            });
            //清楚文本框中数据
            // function clear() {
            //     if (xianshiyemian == "0")
            //     {
            //         $("#BOXCODE").val("");
            //         $("#BOXCODE2").val("");
            //         $("#ImportQuantity").val("");
            //         $("#Standard").val("");
            //         $("#ImportFactQuantity").val("");
            //         $("#BoxQty").val("");
            //     }
            //     else if (xianshiyemian == "1")
            //     {
            //         $("#BOXCODE").val("");
            //         $("#BOXCODE2").val("");
            //         $("#ImportQuantity").val("");
            //         $("#Standard").val("");
            //         $("#ImportFactQuantity").val("");
            //         $("#BoxQty").val("");
            //     }
            // }
            /*——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————*/
            initLanguage()
            setLanguage()
            //当前分页
            var curPageIndex = 1;
            //是否连续组托
            isContinue = "0";
@@ -536,6 +510,50 @@
                checkPalletStat()
            })
            // 判断托盘码是否可用
            function checkPalletStat() {
                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();
                        } 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 () { });
                        }
                    });
                }
            }
            //箱码回车事件
            $("#BOXCODE").keydown(function (e) {
                if (e.keyCode === 13) {
@@ -547,20 +565,11 @@
                        return
                    }
                    // if ($("#STOCKCODE").val() == "") {
                    //    layer.msg('请先扫描托盘码', {
                    //       icon: 2,
                    //       time: 2000 //2秒关闭(如果不配置,默认是3秒)
                    //    });
                    //    $("#BOXCODE").val("");
                    //    $("#STOCKCODE").focus();
                    //    return;
                    // }
                    checkBoxInfo()
                }
            });
            /* 入库单据下拉框 */
            //点击入库单据下拉框事件
            $("#selectDiv").click(function () {
                if (xianshiyemian == 0) {
@@ -586,11 +595,7 @@
                }
            })
            /*————————————————————————————————————————————————————————————————————————————————————————————————*/
            /* 绑定入库单信息 */
            /* 获取入库单信息 */
            function updateBillList(callback) {
                if (xianshiyemian == 0) {
                    var input = $('select[id="bar"]').next().find('.layui-select-title input')
@@ -600,14 +605,12 @@
                    form.render('select');
                    var param = {
                        Type: "0,3"
                        //Type: "0,3"
                    };
                    sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) {
                    sendData(IP + "/PdaAsn/GetPasteAsnNoStrList", param, 'post', function (res) {
                        if (res.code == 0) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                $("#bar").append('<option value =' + res.data[i].ASNNo + '>' + res.data[i]
                                    .ASNNo +
                                    '</option>');
                                $("#bar").append('<option value =' + res.data[i] + '>' + res.data[i] +'</option>');
                            }
                            form.render('select');
@@ -635,14 +638,12 @@
                    form.render('select');
                    var param = {
                        Type: "1,2,4"
                        //Type: "1,2,4"
                    };
                    sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) {
                    sendData(IP + "/PdaAsn/GetNoPasteAsnNoStrList", param, 'post', function (res) {
                        if (res.code == 0) { //成功
                            for (var i = 0; i < res.data.length; i++) {
                                $("#bar1").append('<option value =' + res.data[i].ASNNo + '>' + res.data[i]
                                    .ASNNo +
                                    '</option>');
                                $("#bar1").append('<option value =' + res.data[i] + '>' + res.data[i] + '</option>');
                            }
                            form.render('select');
@@ -665,8 +666,6 @@
            }
            /*————————————————————————————————————————————————————————————————————————————————————————————————*/
            //点击物料下拉框事件
            $("#goodDiv").click(function () {
                if ($("#bar").val() == null || $("#bar").val() == "" || $("#bar").val() == undefined) {
@@ -685,6 +684,7 @@
                    }, function () { });
                }
            })
            //选中入库单事件
            form.on('select(getbar)', function (data) {
                updateGoodList()
@@ -692,7 +692,7 @@
            });
            //选中入库单事件-数量
            form.on('select(getbar1)', function (data) {
                updateDemoDiv();
                //updateDemoDiv();
                updateGoodList()
                setOrderGoods();
            });
@@ -705,212 +705,7 @@
            form.on('select(goodSelect1)', function (data) {
                setOrderGoods();
            });
            //绑定到托盘事件
            form.on('submit(formBind)', function (data) {
                if (xianshiyemian == 0) {
                    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()),
                        LotNo: $("#goodSelect").find("option:selected").text(),
                        BoxNo: $("#BOXCODE").val(),
                        IsContinue: isContinue,
                        TailBoxNo: $("#BOXCODE2").val(),
                        Origin: "PDA",
                        TableType: xianshiyemian,
                    }
                    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();
                                $("#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()), //入库单明细ID
                        LotNo: $("#goodSelect1").find("option:selected").text(),  //物料批次
                        SkuQty: parseInt($("#SkuQty").val()), //物料数量
                        Demo: $("#NoticeDemo").val(), //物料数量
                        Origin: "PDA",
                        TableType: xianshiyemian,
                    }
                    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; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
            });
            // 根据入库单号 获取备注是否显示及备注信息
            function updateDemoDiv() {
                var param = {
                    AsnNo: $("#bar1").val(),
                };
                synData(IP + "/PdaAsn/GetArrivalNotice", param, 'post', function (res) {
                    console.log(res)
                    if (res.code == 0 && res.data != null) { //成功
                        //判断默认选中是否为寄存物料
                        if (res.data[0].Type == "7") {
                            $("textarea[name='NoticeDemo']").val(res.data[0].Demo); //备注
                            $('#demodiv').show();
                            $('#demodiv1').show();
                        }
                        else {
                            $('#demodiv').hide();
                            $('#demodiv1').hide();
                        }
                    }
                    else {
                        $('#demodiv').hide();
                        $('#demodiv1').hide();
                    }
                });
            }
            // 根据入库明细ID 获取详细信息
            function setOrderGoods() {
                if (xianshiyemian == 0) {
                    $("#ImportQuantity").val("");
                    $("#Standard").val("");
                    $("#ImportFactQuantity").val("");
                    $("#BoxQty").val("");
                    //$("#FullQty").val("123");
                    // $("#BOXCODE").val("");
                    var param = {
                        Id: parseInt($("#goodSelect").val())
                    };
                    synData(IP + "/PdaAsn/GetArrivalNoticeDetail", param, 'post', function (res) {
                        console.log(JSON.stringify(res))
                        if (res.code == 0 && res.data != null) { //成功
                            $("#ImportQuantity").val(res.data.Qty);
                            $("#Standard").val(res.data.Standard);
                            $("#ImportFactQuantity").val(res.data.FactQty + "");
                        }
                    });
                }
                else if (xianshiyemian == 1) {
                    // 数量
                    $("#ImportQuantity1").val("");
                    $("#Standard1").val("");
                    $("#ImportFactQuantity1").val("");
                    $("#FullQty").val("");
                    var param = {
                        Id: parseInt($("#goodSelect1").val())
                    };
                    synData(IP + "/PdaAsn/GetArrivalNoticeDetail", param, 'post', function (res) {
                        console.log(JSON.stringify(res))
                        if (res.code == 0 && res.data != null) { //成功
                            $("#ImportQuantity1").val(res.data.Qty);
                            $("#Standard1").val(res.data.Standard);
                            $("#ImportFactQuantity1").val(res.data.FactQty + "");
                            $("#FullQty").val(res.data.UDF1);
                        }
                        else { }
                    });
                }
            }
            var asnDetails = "";
            /* 绑定入库单物料及批次 */
            function updateGoodList(skuNo) {
                if (xianshiyemian == 0) {
@@ -1048,224 +843,390 @@
            }
            // 根据入库明细ID 获取详细信息
            function setOrderGoods() {
                if (xianshiyemian == 0) {
                    $("#ImportQuantity").val("");
                    $("#Standard").val("");
                    $("#ImportFactQuantity").val("");
                    $("#BoxQty").val("");
                    //$("#FullQty").val("123");
                    // $("#BOXCODE").val("");
                    var param = {
                        Id: parseInt($("#goodSelect").val())
                    };
                    synData(IP + "/PdaAsn/GetArrivalNoticeDetail", param, 'post', function (res) {
                        console.log(JSON.stringify(res))
                        if (res.code == 0 && res.data != null) { //成功
                            $("#ImportQuantity").val(res.data.Qty);
                            $("#Standard").val(res.data.Standard);
                            $("#ImportFactQuantity").val(res.data.FactQty + "");
                        }
                    });
                }
                else if (xianshiyemian == 1) {
                    // 数量
                    $("#ImportQuantity1").val("");
                    $("#Standard1").val("");
                    $("#ImportFactQuantity1").val("");
                    $("#FullQty").val("");
                    var param = {
                        Id: parseInt($("#goodSelect1").val())
                    };
                    synData(IP + "/PdaAsn/GetArrivalNoticeDetail", param, 'post', function (res) {
                        console.log(JSON.stringify(res))
                        if (res.code == 0 && res.data != null) { //成功
                            $("#ImportQuantity1").val(res.data.Qty);
                            $("#Standard1").val(res.data.Standard);
                            $("#ImportFactQuantity1").val(res.data.FactQty + "");
                            $("#FullQty").val(res.data.UDF1);
                        }
                        else { }
                    });
                }
            }
            //绑定到托盘事件
            form.on('submit(formBind)', function (data) {
                if (xianshiyemian == 0) {
                    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()),
                        LotNo: $("#goodSelect").find("option:selected").text(),
                        BoxNo: $("#BOXCODE").val(),
                        IsContinue: isContinue,
                        TailBoxNo: $("#BOXCODE2").val(),
                        Origin: "PDA",
                        TableType: xianshiyemian,
                    }
                    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();
                                $("#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()), //入库单明细ID
                        LotNo: $("#goodSelect1").find("option:selected").text(),  //物料批次
                        SkuQty: parseInt($("#SkuQty").val()), //物料数量
                        Demo: $("#NoticeDemo").val(), //物料数量
                        Origin: "PDA",
                        TableType: xianshiyemian,
                    }
                    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; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
            });
            // 根据入库单号 获取备注是否显示及备注信息
            function updateDemoDiv() {
                var param = {
                    AsnNo: $("#bar1").val(),
                };
                synData(IP + "/PdaAsn/GetArrivalNotice", param, 'post', function (res) {
                    console.log(res)
                    if (res.code == 0 && res.data != null) { //成功
                        //判断默认选中是否为寄存物料
                        if (res.data[0].Type == "7") {
                            $("textarea[name='NoticeDemo']").val(res.data[0].Demo); //备注
                            $('#demodiv').show();
                            $('#demodiv1').show();
                        }
                        else {
                            $('#demodiv').hide();
                            $('#demodiv1').hide();
                        }
                    }
                    else {
                        $('#demodiv').hide();
                        $('#demodiv1').hide();
                    }
                });
            }
            // 渲染箱码信息
            function refreshTable() {
                if (xianshiyemian == 0) {
                    //先清空一下箱子列表
                    let trs = $("#tableBoxList tr")
                    let len = trs.length
            // function refreshTable() {
            //     if (xianshiyemian == 0) {
            //         //先清空一下箱子列表
            //         let trs = $("#tableBoxList tr")
            //         let len = trs.length
                    for (i = len - 1; i >= 2; i--) {
                        trs[i].remove();
                    }
            //         for (i = len - 1; i >= 2; i--) {
            //             trs[i].remove();
            //         }
                    //设置托盘号
                    $("#palletCode").val($.cookie('stockCode'))
            //         //设置托盘号
            //         $("#palletCode").val($.cookie('stockCode'))
                    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 = {
            //             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 = {
                                                boxNo: boxno,
                                            };
                                            sendData(IP + "/BllAsn/DelBindBoxInfo", param, 'get', 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, res.data.length)
            //                                 var param = {
            //                                     boxNo: boxno,
            //                                 };
            //                                 sendData(IP + "/BllAsn/DelBindBoxInfo", param, 'get', 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, res.data.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
            //             } 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();
                    }
            //         for (i = len - 1; i >= 2; i--) {
            //             trs[i].remove();
            //         }
                    //设置托盘号
                    $("#palletCode").val($.cookie('stockCode1'))
            //         //设置托盘号
            //         $("#palletCode").val($.cookie('stockCode1'))
                    var param = {
                        PalletNo: $.cookie('stockCode1')
                    };
                    //  根据托盘号获取箱码信息
                    sendData(IP + "/PdaAsn/GetPalletBindInfo", 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].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 BindNo = elem.attr('BindNo')
                                    console.log(res)
                                    var Id = elem.attr('id')
                                    layer.alert("确定要从托盘上删除这托物料吗?<br>" + res.data[0].PalletNo, {
                                        icon: 2,
                                        time: 0, //2秒关闭(如果不配置,默认是3秒)
                                        btn: ['删除', '取消'],
                                        yes: function () {
            //         var param = {
            //             PalletNo: $.cookie('stockCode1')
            //         };
            //         //  根据托盘号获取箱码信息
            //         sendData(IP + "/PdaAsn/GetPalletBindInfo", 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].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 BindNo = elem.attr('BindNo')
            //                         console.log(res)
            //                         var Id = elem.attr('id')
            //                         layer.alert("确定要从托盘上删除这托物料吗?<br>" + res.data[0].PalletNo, {
            //                             icon: 2,
            //                             time: 0, //2秒关闭(如果不配置,默认是3秒)
            //                             btn: ['删除', '取消'],
            //                             yes: function () {
                                            var param = {
                                                Id: parseInt(Id),
                                                PalletNo: res.data[0].PalletNo,
                                            };
                                            console.log(Id)
                                            console.log(param)
                                            sendData(IP + "/PdaAsn/DelPalletBind", 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 = {
            //                                     Id: parseInt(Id),
            //                                     PalletNo: res.data[0].PalletNo,
            //                                 };
            //                                 console.log(Id)
            //                                 console.log(param)
            //                                 sendData(IP + "/PdaAsn/DelPalletBind", 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, res.data.length)
            //                 //设置分页
            //                 setPages(1, res.data.length)
                        } else { //不成功
                            layer.msg("无数据", {
                                icon: 2,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            }, function () { });
                            $("#boxNum").val(0)
                            setPages(1, 0)
                        }
                    });
                }
            //             } else { //不成功
            //                 layer.msg("无数据", {
            //                     icon: 2,
            //                     time: 2000 //2秒关闭(如果不配置,默认是3秒)
            //                 }, function () { });
            //                 $("#boxNum").val(0)
            //                 setPages(1, 0)
            //             }
            //         });
            //     }
            }
            // }
            // 判断托盘码是否可用
            function checkPalletStat() {
                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();
                        } 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 () { });
                        }
                    });
                }
            }
            //箱回车事件
            function checkBoxInfo() {
                var param = {
                    "BoxNo": $("#BOXCODE").val(),
@@ -1285,7 +1246,7 @@
                                });
                                return;
                            }
                            if (res.data[0].ASNNo != '' && res.data[0].ASNNo != null) {
                                $("#bar").empty()
                                $("#bar").append('<option value =>' + '</option>');
@@ -1388,133 +1349,6 @@
                })
            }
            /* 分页 */
            //设置分页
            function setPages(pageIndex, boxNum) {
                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)
            }
            //设置当前分页
            function setCurPage(pageIndex) {
                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
                }
                //console.log("startIndex is "+startIndex)
                //console.log("endIndex is "+endIndex)
                //startIndex =2
                //endIndex = 2
                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")
                    }
                }
                //console.log("totalTrNum is " + totalTrNum)
            }
            function onClickPrevPage() {
                //console.log("上一页按钮被点击")
                if (curPageIndex == 1) {
                    return
                }
                setCurPage(curPageIndex - 1)
            }
            function onClickNextPage() {
                //console.log("下一页按钮被点击")
                let n = getBoxPageNum()
                if (curPageIndex == n - 1) {
                    return
                }
                setCurPage(curPageIndex + 1)
            }
            function getBoxPageNum() {
                let num = $("#tableBoxList tr").length
                if (num <= 2) {
                    return 0
                }
                let pageNum = Math.floor(num / 10);
                if (num % 10 > 0) {
                    pageNum += 1;
                }
                return pageNum
            }
            /*——————————————————————————————————————————————————————————*/