1
yuyou_x
2024-02-02 1403ec7e5c62962fd5d20123defedae97a4abb75
1
4个文件已修改
1175 ■■■■ 已修改文件
HTML/views/ASNSetting/ArrivalNotice.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Pda/View/AsnSetting/productEnter1.html 855 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs 303 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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">代储入库</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>
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) {
Wms/Model/ModelVm/PdaVm/PdaAsnVm.cs
@@ -60,5 +60,10 @@
        /// </summary>           
        public string TailBoxNo01 { get; set; }
        /// <summary>
        /// Desc:物料数量
        /// </summary>
        public int SkuQty { get; set; }
    }
}
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);
                // 更改入库单及入库明细状态