Demo
2024-02-02 e91b60bf41064a456e398064c87b38adf0467eff
修改标签
8个文件已修改
1045 ■■■■ 已修改文件
HTML/views/ASNSetting/ArrivalNotice.html 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/LabelPrint.html 110 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/LabelPrintSelect.html 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelDto/BllAsnDto/LabelBoxDto.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllAsnServer/BllLabelBoxNoServer.cs 722 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.Entity/BllAsnEntity/BllLabelBoxNo.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.IBLL/IBllAsnServer/IBllLabelBoxNoServer.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/BllAsnController.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/ArrivalNotice.html
@@ -1136,6 +1136,7 @@
            //明细表操作栏事件
            table.on('tool(LAY-app-content-list2)', function (obj) {
                var data = obj.data;
                var id = data.Id;
                switch(obj.event)
                {
                    case "del" :
@@ -1171,7 +1172,7 @@
                            title: '生成标签',
                            content: 'LabelPrintSelect.html',
                            maxmin: true,
                            area: ['460px', '460px'],
                            area: ['480px', '615px'],
                            btn: ['确定','取消'],
                            yes: function(index, layero){
                                var iframeWindow = window['layui-layer-iframe'+ index]
@@ -1182,20 +1183,13 @@
                                    var field = data.field; //获取提交的字段
                                    console.log(field);
                                    //提交 Ajax 成功后,静态更新表格中的数据
                                    var param = {
                                        Id: data.Id,
                                        Reset: field.reset, //重置批号
                                        Level: field.level,  //标签级别  1/2级
                                        Type:field.type,  //关系层级  有/无层级
                                        ArriveQty:field.arriveQty, //到货数量
                                        BoxType:field.boxType ,// 箱支类型  箱/支
                                        Qty:field.qty //箱/支数量
                                    };
                                    console.log(param);
                                    //"&Level="+field.level+"&Type="+field.type+"&BoxType="+field.boxType+"&Qty="+field.qty+
                                    var str = "Id="+id+"&Reset="+field.reset+"&ArriveQty="+field.arriveQty+"&ProductionTime="+field.productionTime+"&ExpirationTime="+field.expirationTime+"&StoreTime="+field.storeTime;
                                    layer.open({
                                        type: 2,
                                        title: '生成标签',
                                        content: 'LabelPrint.html',
                                        content: 'LabelPrint.html?'+str,
                                        maxmin: true,
                                        area: ['660px', '660px'],
                                        btn: ['取消'],
HTML/views/ASNSetting/LabelPrint.html
@@ -27,6 +27,16 @@
<body>
    <div style="width:100%;text-align: center;">
        <div style="padding-top: 10px;text-align: left; margin-left: 5%;" id="button">
            <div class="layui-inline">
                <button id="btnAdd" class="layui-btn layui-btn-sm" lay-event="Add2"><i
                        class="layui-icon">&#xe654;</i>生成标签</button>
            </div>
            <div class="layui-inline">
                <button id="btnPrint" class="layui-btn layui-btn-sm" lay-event="Add"><i
                        class="layui-icon">&#xe654;</i>打印</button>
            </div>
        </div>
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="print"
            style="width: 100%;height:100%; text-align: right;padding-top: 5px;margin-left: 0%;">
            <div>
@@ -44,7 +54,7 @@
                    </tr>
                    <tr>
                        <td>品名</td>
                        <td colspan="3" id="goodName"></td>
                        <td colspan="3" id="SkuName"></td>
                    </tr>
                    <tr>
                        <td>规格/型号</td>
@@ -56,7 +66,7 @@
                        <td>进厂编号</td>
                        <td style="padding: 1px 0px;"></td>
                        <td>物料代码</td>
                        <td style="padding: 1px 0px;"> </td>
                        <td id="SkuNo"> </td>
                    </tr>
                    <tr>
                        <td>原厂批号</td>
@@ -81,47 +91,6 @@
            </div>
            <div style="page-break-after: always;"></div>
        </div>
        <hr>
        <div style="padding-top: 10px;text-align: left;" id="button">
            <div class="layui-inline" style="margin-right: 10px;">
                <span style="padding-right: 5px;">是否重置批次:</span>
                <span style="padding-right: 5px;">是</span><input type="radio" checked="true" name="isprint" value="1">
                <span style="padding-right: 5px;">否</span><input type="radio" name="isprint" value="0">
            </div>
            <div class="layui-inline">
                到货数量:<div class="layui-input-inline">
                    <input type="text"
                        oninput="value=value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d).*$/,'$1$2.$3')"
                        onafterpaste="this.value=this.value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d).*$/,'$1$2.$3')"
                        name="skuNum" id="skuNum" lay-verify="skuNum" placeholder="" style="width: 100px;"
                        autocomplete="off" class="layui-input InputCss">
                </div>&nbsp;&nbsp;
            </div>
            <div class="layui-inline">
                箱标签数量:<div class="layui-input-inline">
                    <input type="text" onkeyup="this.value=this.value.replace(/^0{1,}/g,'')"
                        onafterpaste="this.value=this.value.replace(/^0{1,}/g,'')" name="bQNum" id="bQNum"
                        lay-verify="bQNum" placeholder="" style="width: 100px;" autocomplete="off"
                        class="layui-input InputCss">
                </div>&nbsp;&nbsp;
            </div>
            <div>
                <div class="layui-inline" style="padding-top: 5px">
                    一级标签必录参数:箱内数量:<div class="layui-input-inline">
                        <input type="text"
                            oninput="value=value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d).*$/,'$1$2.$3')"
                            onafterpaste="this.value=this.value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d).*$/,'$1$2.$3')"
                            name="number" id="number" lay-verify="number" placeholder="" style="width: 70px;"
                            autocomplete="off" class="layui-input InputCss">
                    </div>&nbsp;&nbsp;
                </div>
                <div class="layui-inline">
                    <button id="btnPrint" class="layui-btn layui-btn-sm" lay-event="Add"><i
                            class="layui-icon">&#xe654;</i>打印</button>
                </div>
            </div>
        </div>
    </div>
    <script src="../../layuiadmin/layui/layui.js"></script>
@@ -141,20 +110,22 @@
                form = layui.form,
                layer = layui.layer;
            var laydate = layui.laydate;
            laydate.render({
                elem: '#ProductionDate'
                , format: 'yyyy-MM-dd' //可任意组合
            });
            laydate.render({
                elem: '#InspectTime'
                , format: 'yyyy-MM-dd' //可任意组合
            });
            laydate.render({
                elem: '#ExpirationTime'
                , format: 'yyyy-MM-dd' //可任意组合
            });
            var id = getQueryString('id');
            var xun = 0;
            var id = getQueryString('Id');
            var reset = getQueryString('Reset');
            var arriveQty = getQueryString('ArriveQty');
            var productionTime = getQueryString('ProductionTime');
            var expirationTime = getQueryString('ExpirationTime');
            var storeTime = getQueryString('StoreTime');
            // var level = getQueryString('Level');
            // var type = getQueryString('Type');
            // var boxType = getQueryString('BoxType');
            // var qty = getQueryString('Qty');
            console.log(productionTime);
            console.log(expirationTime);
            console.log(storeTime);
            $('#btnPrint').on('click', function () {
                var param = {
@@ -204,7 +175,30 @@
                id = 0;
            }
            else {
                div(-1, 1, 0);
                var param = {
                    id: id,
                };
                synData(IP + "/BllAsn/GetLabelBoxModel", param , 'get', function (res) {
                    if (res.code == 0) { //成功
                        $("#SkuName").html(res.data.SkuName);
                        $("#Standard").html(res.data.Standard);
                        $("#PackageStandard").html(res.data.PackageStandard);
                        $("#SkuNo").html(res.data.SkuNo);
                        $("#SupplierLot").html(res.data.SupplierLot);
                        $("#ExpirationTime").html(expirationTime);
                        $("#StoreTime").html( storeTime);
                        // $("#imgBar").attr("src", res.data[0].imageStr);
                    } else { //不成功
                        layer.msg(res.msg, {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function () { });
                    }
                });
                // div(-1, 1, 0);
            }
HTML/views/ASNSetting/LabelPrintSelect.html
@@ -10,6 +10,25 @@
    </head>
    <body>
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
            <div class="layui-form-item">
                <label class="layui-form-label">生产日期</label>
                <div class="layui-input-block">
                    <input type="text" name="productionTime" id="productionTime" placeholder="请输入生产日期" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">有效期至</label>
                <div class="layui-input-block">
                    <input type="text" name="expirationTime" id="expirationTime" placeholder="请输入有效期至" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">储存期至</label>
                <div class="layui-input-block">
                    <input type="text" name="storeTime" id="storeTime"  placeholder="请输入储存期至" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">重置批号</label>
                <div class="layui-input-block">
@@ -19,7 +38,7 @@
                    </select>
                </div> 
            </div>
            <div class="layui-form-item">
            <!-- <div class="layui-form-item">
                <label class="layui-form-label">标签级别</label>
                <div class="layui-input-block">
                    <select name="level" id="level" lay-filter="levelFil" lay-verify="required">
@@ -36,14 +55,16 @@
                        <option value="0">无层级</option> 
                    </select>
                </div>
            </div>
            </div> -->
            <div class="layui-form-item">
                <label class="layui-form-label">到货数量</label>
                <div class="layui-input-block">
                    <input type="text" name=arriveQty" id="arriveQty" lay-verify="required"  placeholder="请输入巷道名称" autocomplete="off" class="layui-input">
                    <input type="text" name="arriveQty" id="arriveQty" lay-verify="required"  placeholder="请输入到货数量" autocomplete="off" class="layui-input"  oninput="value=value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/,'$1$2.$3')"
                     onafterpaste="this.value=this.value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/,'$1$2.$3')">
                </div>
            </div>
            <div class="layui-form-item" id="boxTypeDiv" style="display: none;">
            <!-- <div class="layui-form-item" id="boxTypeDiv" style="display: none;">
                <label class="layui-form-label">箱支类型</label>
                <div class="layui-input-block">
                    <select name="boxType" id="boxType" lay-filter="boxTypeFil" lay-search>
@@ -56,9 +77,10 @@
            <div class="layui-form-item" id="qtyDiv" style="display: none;">
                <label class="layui-form-label">数量</label>
                <div class="layui-input-block">
                    <input type="text" name="qty" id="qty"   placeholder="请输入巷道名称" autocomplete="off" class="layui-input">
                    <input type="text" name="qty" id="qty" placeholder="请输入数量" autocomplete="off" class="layui-input"  oninput="value=value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/,'$1$2.$3')"
                    onafterpaste="this.value=this.value.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/,'$1$2.$3')">
                </div>
            </div>
            </div> -->
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
@@ -75,64 +97,78 @@
                    base: '../../layuiadmin/' //静态资源所在路径
                }).extend({
                    index: 'lib/index' //主入口模块
                }).use(['index', 'form', 'layer'], function() {
                }).use(['index', 'form', 'layer', 'laydate'], function() {
                    var $ = layui.$;
                    var    form = layui.form;
                    var    layer = layui.layer;
                    form.on('select(levelFil)', function(data){
                        console.log($("#type").val());
                        var type = $("#type").val();
                        if (data.value == "1" ) {
                            $("#boxTypeDiv").css("display","none");
                            form.val("layuiadmin-app-form-list", {
                                "boxType": ""
                    var laydate = layui.laydate;
                    laydate.render({
                        elem: '#productionTime'
                        , format: 'yyyy-MM-dd' //可任意组合
                            });
                            $("#boxType").removeAttr("lay-verify");
                            $("#qtyDiv").css("display","none");
                            $("#qty").removeAttr("lay-verify");
                            $("#qty").val("");
                            form.render('select');
                        }
                        if (data.value == "2" && type == "0") {
                            $("#boxTypeDiv").css("display","block");
                            $("#boxType").attr("lay-verify","required");
                        }
                    laydate.render({
                        elem: '#expirationTime'
                        , format: 'yyyy-MM-dd' //可任意组合
                    });   
                    form.on('select(typeFil)', function(data){
                        var level = $("#level").val();
                        if (data.value == "1") {
                            $("#boxTypeDiv").css("display","none");
                            form.val("layuiadmin-app-form-list", {
                                "boxType": ""
                    laydate.render({
                        elem: '#storeTime'
                        , format: 'yyyy-MM-dd' //可任意组合
                            });
                            $("#boxType").removeAttr("lay-verify");
                            
                            $("#qtyDiv").css("display","none");
                            $("#qty").removeAttr("lay-verify");
                            $("#qty").val("");
                            form.render('select');
                        }
                        if (data.value == "0" && level == "2") {
                            $("#boxTypeDiv").css("display","block");
                            $("#boxType").attr("lay-verify","required");
                    // form.on('select(levelFil)', function(data){
                    //     console.log($("#type").val());
                    //     var type = $("#type").val();
                    //     if (data.value == "1" ) {
                    //         $("#boxTypeDiv").css("display","none");
                    //         form.val("layuiadmin-app-form-list", {
                    //             "boxType": ""
                    //         });
                    //         $("#boxType").removeAttr("lay-verify");
                        }
                    });
                    form.on('select(boxTypeFil)', function(data){
                        if (data.value == "1") { //箱
                            $("#qtyDiv").css("display","none");
                            $("#qty").removeAttr("lay-verify");
                            $("#qty").val("");
                        }
                        if (data.value == "2" ) {
                            $("#qtyDiv").css("display","block");
                            $("#qty").attr("lay-verify","required");
                        }
                    });
                    //         $("#qtyDiv").css("display","none");
                    //         $("#qty").removeAttr("lay-verify");
                    //         $("#qty").val("");
                    //         form.render('select');
                    //     }
                    //     if (data.value == "2" && type == "0") {
                    //         $("#boxTypeDiv").css("display","block");
                    //         $("#boxType").attr("lay-verify","required");
                    //     }
                    // });
                    // form.on('select(typeFil)', function(data){
                    //     var level = $("#level").val();
                    //     if (data.value == "1") {
                    //         $("#boxTypeDiv").css("display","none");
                    //         form.val("layuiadmin-app-form-list", {
                    //             "boxType": ""
                    //         });
                    //         $("#boxType").removeAttr("lay-verify");
                    //         $("#qtyDiv").css("display","none");
                    //         $("#qty").removeAttr("lay-verify");
                    //         $("#qty").val("");
                    //         form.render('select');
                    //     }
                    //     if (data.value == "0" && level == "2") {
                    //         $("#boxTypeDiv").css("display","block");
                    //         $("#boxType").attr("lay-verify","required");
                    //     }
                    // });
                    // form.on('select(boxTypeFil)', function(data){
                    //     if (data.value == "1") { //箱
                    //         $("#qtyDiv").css("display","none");
                    //         $("#qty").removeAttr("lay-verify");
                    //         $("#qty").val("");
                    //     }
                    //     if (data.value == "2" ) {
                    //         $("#qtyDiv").css("display","block");
                    //         $("#qty").attr("lay-verify","required");
                    //     }
                    // });
                })
Wms/Model/ModelDto/BllAsnDto/LabelBoxDto.cs
@@ -18,6 +18,9 @@
        public decimal Qty { get; set; }
        public string SkuNo { get; set; }
        public string SkuName { get; set; }
        public string Standard { get; set; }
        public string PackageStandard { get; set; }
        public DateTime? StoreTime { get; set; }
        public string LotNo { get; set; }
        public string LotText { get; set; }
        public string SupplierName { get; set; }
Wms/WMS.BLL/BllAsnServer/BllLabelBoxNoServer.cs
@@ -47,6 +47,9 @@
                        Qty = a.Qty,
                        SkuNo = a.SkuNo,
                        SkuName = a.SkuName,
                        Standard = a.Standard,
                        PackageStandard = a.PackageStandard,
                        StoreTime = a.StoreTime,
                        LotNo = a.LotNo,
                        LotText = a.LotText,
                        SupplierName = a.SupplierName,
@@ -79,5 +82,724 @@
                throw new Exception(e.Message);
            }
        }
        //获取标签模板根据入库单明细ID
        public LabelBoxDto GetLabelBoxModel(int id)
        {
            try
            {
                var asnDetail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.Id == id && m.IsDel == "0");
                if (asnDetail == null)
                {
                    throw new Exception("未查询到单据明细信息,请核实");
                }
                var packInfo = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == asnDetail.PackagNo);
                if (packInfo == null)
                {
                    throw new Exception("未查询到单据明细中的物料包装信息");
                }
                var str = "";
                if (!string.IsNullOrWhiteSpace(packInfo.L1Name))
                {
                    str += packInfo.L1Num + "/" + packInfo.L1Name;
                }
                if (!string.IsNullOrWhiteSpace(packInfo.L2Name))
                {
                    str += "-" + packInfo.L2Num + "/" + packInfo.L2Name;
                }
                if (!string.IsNullOrWhiteSpace(packInfo.L3Name))
                {
                    str += "-" + packInfo.L3Num + "/" + packInfo.L3Name;
                }
                if (!string.IsNullOrWhiteSpace(packInfo.L4Name))
                {
                    str += "-" + packInfo.L4Num + "/" + packInfo.L4Name;
                }
                if (!string.IsNullOrWhiteSpace(packInfo.L5Name))
                {
                    str += "-" + packInfo.L5Num + "/" + packInfo.L5Name;
                }
                var data = new LabelBoxDto();
                data.SkuNo = asnDetail.SkuNo;
                data.SkuName = asnDetail.SkuName;
                data.Standard = asnDetail.Standard;
                data.SupplierLot = asnDetail.SupplierLot;
                data.PackageStandard = str;
                return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        ///// <summary>
        /////  获取物料标签信息JC06
        ///// </summary>
        ///// <param name="imId"></param>
        ///// <param name="isPrint">是否重新生成自有批次 0:否 1:是 </param>
        ///// <param name="createUser">创建人</param>
        ///// <param name="number">箱内数量(一级标签必填)</param>
        ///// <param name="productionDate">生产日期</param>
        ///// <param name="supplierName">生产厂家</param>
        ///// <param name="supplierLot">生产厂家批号</param>
        ///// <param name="inspectTime">有效期</param>
        ///// <param name="expirationTime">保质期</param>
        ///// <param name="bQNum">外箱标签数量</param>
        ///// <param name="skuNum">到货数量</param>
        ///// <returns></returns>
        //public List<LabelPrint5Model> GetImport5Id(string imId, string isPrint, string createUser, decimal number, string productionDate,
        //    string supplierName, string supplierLot, string inspectTime, string expirationTime, int? bQNum, string skuNum)
        //{
        //    try
        //    {
        //        using (LinqModelDataContext DataContext = new LinqModelDataContext(DataConnection.GetDataConnection))
        //        {
        //            #region 必填验证
        //            if (string.IsNullOrWhiteSpace(productionDate))
        //            {
        //                throw new Exception("生产日期需必填,不能为空");
        //            }
        //            var twoSeletOne = true;//有效期、复验期二选一
        //            if (string.IsNullOrWhiteSpace(expirationTime))
        //            {
        //                twoSeletOne = false;
        //            }
        //            if (string.IsNullOrWhiteSpace(inspectTime))
        //            {
        //                twoSeletOne = false;
        //            }
        //            if (twoSeletOne)
        //            {
        //                throw new Exception("有效期、复验期最好填写一个");
        //            }
        //            if (string.IsNullOrWhiteSpace(supplierName))
        //            {
        //                throw new Exception("生产厂家需必填,不能为空");
        //            }
        //            if (string.IsNullOrWhiteSpace(supplierLot))
        //            {
        //                throw new Exception("厂家批号需必填,不能为空");
        //            }
        //            if (bQNum <= 0)
        //            {
        //                throw new Exception("外箱标签数量不能为空或小于等于0");
        //            }
        //            #endregion
        //            #region MyRegion
        //            var list = DataContext.View_ImportNotify.FirstOrDefault(a => a.ImportId == imId && a.IsDel == 0);
        //            List<LabelPrint5Model> printModel = new List<LabelPrint5Model>();
        //            if (list == null)
        //            {
        //                throw new Exception("未查询到单据信息");
        //            }
        //            var goodMap = DataContext.GoodMapAndMes.FirstOrDefault(m => m.WmsGoodCode == list.GoodsCode && m.IsDel == 0);
        //            var mesGood = "AAAA";
        //            if (goodMap != null)
        //            {
        //                mesGood = goodMap.MesGoodCode;
        //            }
        //            //物料
        //            var good = DataContext.WmsBaseGoods.FirstOrDefault(m => m.GoodsDeleteFlag == 0 && m.GoodsCode == list.GoodsCode);
        //            var pack = DataContext.WmsBasePackaging.FirstOrDefault(m => m.IsDel == 0 && m.Id == good.GoodsPackaging);
        //            if (pack == null)
        //            {
        //                throw new Exception("未查询到当前单据中物料的包装信息");
        //            }
        //            //标签表
        //            var labelData = DataContext.LabelPrint.Where(m => m.ImportId == imId).ToList();
        //            if (bQNum == null)
        //            {
        //                bQNum = 0;
        //            }
        //            var bNum = 0;//箱物品数量
        //            var zNum = 0;//支物品数量
        //            var packLevel = 0;
        //            var isGo = false;
        //            #endregion
        //            #region 包装查询
        //            //if (!string.IsNullOrWhiteSpace(pack.FivelevelNum))
        //            //{
        //            //    if (pack.FivelevelUnit != "托")
        //            //    {
        //            //        isGo = false;
        //            //        packLevel = 5;
        //            //        bNum = Convert.ToInt32(pack.FivelevelNum);
        //            //    }
        //            //}
        //            //if (!string.IsNullOrWhiteSpace(pack.FourlevelNum) && isGo)
        //            //{
        //            //    if (pack.FourlevelUnit != "托")
        //            //    {
        //            //        isGo = false;
        //            //        packLevel = 4;
        //            //        bNum = Convert.ToInt32(pack.FourlevelNum);
        //            //    }
        //            //}
        //            //if (!string.IsNullOrWhiteSpace(pack.ThreelevelNum) && isGo)
        //            //{
        //            //    if (pack.ThreelevelUnit != "托")
        //            //    {
        //            //        isGo = false;
        //            //        packLevel = 3;
        //            //        bNum = Convert.ToInt32(pack.ThreelevelNum);
        //            //    }
        //            //}
        //            if (!string.IsNullOrWhiteSpace(pack.TwolevelNum))
        //            {
        //                packLevel = 2;
        //                bNum = Convert.ToInt32(pack.TwolevelNum);
        //            }
        //            if (!string.IsNullOrWhiteSpace(pack.OnelevelNum))
        //            {
        //                if (packLevel == 0)
        //                {
        //                    packLevel = 1;
        //                    bNum = Convert.ToInt32(pack.OnelevelNum);
        //                }
        //                zNum = Convert.ToInt32(pack.OnelevelNum);
        //            }
        //            if (packLevel <= 1)//包装等级小于1,按照1级标签打印
        //            {
        //                packLevel = 1;
        //            }
        //            #endregion
        //            if (packLevel == 1)
        //            {
        //                #region 一级包装
        //                // 根据用户输入的箱数量计算需要的条码数
        //                var labQty = labelData.Sum(m => m.Qty);
        //                var qty = Convert.ToDecimal(list.ImportQuantity) - (decimal)labQty;//当前单据剩余需要打印的数量
        //                if (qty <= 0)
        //                {
        //                    throw new Exception("当前单据物料标签已打印完毕,如有需要请补打");
        //                }
        //                #region 增加到货数量
        //                if (skuNum != "")
        //                {
        //                    if (qty - Convert.ToDecimal(skuNum) < 0)
        //                    {
        //                        throw new Exception("到货数量大于未打标签数量,请重新输入到货数量!");
        //                    }
        //                    else
        //                    {
        //                        qty = Convert.ToDecimal(skuNum);
        //                    }
        //                }
        //                #endregion
        //                int labelNum = 1; //生产条码数量
        //                if (number > 0)
        //                {
        //                    labelNum = int.Parse(Math.Ceiling(qty / number).ToString());//标签数量
        //                }
        //                else
        //                {
        //                    throw new Exception("当前单据物料是一级包装,请输入箱内数量且大于0");
        //                }
        //                if (bQNum >= 1)//打印标签数量是否大于1 (有打印标签数量)
        //                {
        //                    if (bQNum > 100)
        //                    {
        //                        throw new Exception("打印标签数量建议在100张以内");
        //                    }
        //                    if (bQNum < labelNum) //打印的标签数量大于等于剩余能打印的张数量
        //                    {
        //                        labelNum = (int)bQNum;
        //                    }
        //                }
        //                if (labelNum > 100)
        //                {
        //                    labelNum = 100;
        //                }
        //                string maxCodestr = "";
        //                string maxboxcode = "";
        //                // 生成自编批号
        //                string toDayTime = DateTime.Now.ToString("yyyyMMdd");
        //                var diJiJian = 0;
        //                if (isPrint == "0")
        //                {
        //                    var maxCode = DataContext.LabelPrint.Where(b => b.ImportId == imId).ToList().Max(a => a.ImportLotNo);
        //                    var boxCode1 = DataContext.LabelPrint.Where(b => b.ImportId == imId).ToList().Max(a => a.LabelStream);
        //                    maxCodestr = maxCode;
        //                    maxboxcode = boxCode1;
        //                    if (string.IsNullOrWhiteSpace(maxCodestr))
        //                    {
        //                        maxCodestr = toDayTime.Substring(2, 6) + "0001";
        //                    }
        //                    else
        //                    {
        //                        var q = DataContext.LabelPrint
        //                            .Where(m => m.ImportId == imId && m.ImportLotNo == maxCodestr)
        //                            .GroupBy(m => m.LabelStream).ToList();
        //                        diJiJian = q.Count;
        //                    }
        //                }
        //                else
        //                {
        //                    var maxCode = DataContext.LabelPrint.Max(a => a.ImportLotNo);                        // 获取今天最大批次号
        //                    if (string.IsNullOrWhiteSpace(maxCode))
        //                    {
        //                        maxCodestr = toDayTime.Substring(2, 6) + "0001";
        //                    }
        //                    else
        //                    {
        //                        var lotStr = maxCode.Substring(0, 6);
        //                        var timeStr = toDayTime.Substring(2, 6);
        //                        if (lotStr == timeStr)
        //                        {
        //                            maxCodestr = toDayTime.Substring(2, 6) + (int.Parse(maxCode.Substring(6, 4)) + 1).ToString().PadLeft(4, '0');
        //                        }
        //                        else
        //                        {
        //                            maxCodestr = timeStr + "0001";
        //                        }
        //                    }
        //                }
        //                var sapNo = "";
        //                if (!string.IsNullOrWhiteSpace(list.OuterBillCode) && !string.IsNullOrWhiteSpace(list.SequenceNo))
        //                {
        //                    sapNo = list.OuterBillCode + "-" + list.SequenceNo;
        //                }
        //                for (int i = 1; i <= labelNum; i++)
        //                {
        //                    // 物料条码信息赋值
        //                    LabelPrint5Model model = new LabelPrint5Model();
        //                    model.ImportId = imId;
        //                    model.OuterBillCode = list.OuterBillCode;
        //                    model.ImportBillCode = list.ImportBillCode;
        //                    model.SkuNo = list.GoodsCode;
        //                    model.SkuName = list.GoodsName;
        //                    model.QtyCount = (int)bQNum;                          // 总件数
        //                    model.SupplierName = supplierName;                        // 生产厂家
        //                    model.ProductionDate = productionDate;                      // 生产日期
        //                    model.SapSkuNo = sapNo;                            // SAP代码  SAP单号+行号
        //                    model.Standard = good.GoodsStandard;                            // 规格
        //                    model.SupplierLot = supplierLot;                         // 厂家批号
        //                    model.LotNo = maxCodestr;                      //批次
        //                    model.InspectTime = inspectTime;                     // 复验期至
        //                    model.ExpirationTime = expirationTime;                  // 有效期至/贮存期
        //                    model.ExpirationType = good.GoodsTemp;                  // 贮存条件
        //                    if (i == labelNum)
        //                    {
        //                        // 最后一个条码
        //                        var s = number * (i - 1);
        //                        if (number > qty - s)
        //                        {
        //                            model.Qty = qty - s;// 数量
        //                        }
        //                        else
        //                        {
        //                            model.Qty = number;// 数量
        //                        }
        //                    }
        //                    else
        //                    {
        //                        model.Qty = number;                                                         // 数量
        //                    }
        //                    model.QtyOrd = i + diJiJian;                                               // 第几件
        //                    if (maxboxcode == "")
        //                    {
        //                        var str = mesGood.PadRight(16, ' ') + model.LotNo.PadRight(12, ' ') + "0001";
        //                        model.BoxCode = str;                 // 支号     批号+第几箱
        //                        maxboxcode = model.BoxCode;
        //                    }
        //                    else
        //                    {
        //                        model.BoxCode = maxboxcode.Substring(0, 28) + (int.Parse(maxboxcode.Substring(28, 4)) + 1).ToString().PadLeft(4, '0');
        //                        maxboxcode = model.BoxCode;
        //                    }
        //                    model.imageStr = Utility.Extra.BarcodeHelper.GetQrCodeBase64(model.BoxCode, 85, 85);
        //                    // 添加到list集合
        //                    printModel.Add(model);
        //                    //if (number <= 0)
        //                    //{
        //                    //    return printModel;
        //                    //}
        //                    var guid = Guid.NewGuid().ToString("N");
        //                    // 将条码保存到原料条码表
        //                    var LabelModel = new LabelPrint
        //                    {
        //                        LabelID = guid,
        //                        LabelStream = model.BoxCode,
        //                        GoodsCode = model.SkuNo,
        //                        GoodsName = model.SkuName,
        //                        GoodsStandard = model.Standard,
        //                        ImportLotNo = model.LotNo,
        //                        SupplierName = model.SupplierName,
        //                        ImportId = model.ImportId,
        //                        OuterBillCode = model.OuterBillCode,
        //                        ImportBillCode = model.ImportBillCode,
        //                        ProductionDate = model.ProductionDate,
        //                        SapSkuNo = model.SapSkuNo,
        //                        Qty = model.Qty,
        //                        SupplierLot = model.SupplierLot,
        //                        InspectTime = model.InspectTime,
        //                        ExpirationTime = model.ExpirationTime,
        //                        QtyCount = model.QtyCount,
        //                        QtyOrd = model.QtyOrd,
        //                        ExpirationType = model.ExpirationType,
        //                        BoxNum = number,// model.Qty,
        //                        BulkTank = model.Qty == number ? 0 : 1,//零头箱
        //                        BulkCase = 0,//零头盒
        //                        CreateUser = createUser,
        //                        CreateTime = DateTime.Now,
        //                        IsUse = 0
        //                    };
        //                    DataContext.LabelPrint.InsertOnSubmit(LabelModel);
        //                }
        //                DataContext.SubmitChanges();
        //                #endregion
        //            }
        //            else //(packLevel == 2)
        //            {
        //                #region 二级包装
        //                // 根据用户输入的箱数量计算需要的条码数
        //                var labQty = labelData.Sum(m => m.Qty);
        //                var qty2 = Convert.ToDecimal(list.ImportQuantity) - (decimal)labQty;
        //                if (qty2 <= 0)
        //                {
        //                    throw new Exception("当前单据物料标签已打印完毕,如有需要请补打");
        //                }
        //                #region 增加到货数量
        //                if (skuNum != "")
        //                {
        //                    if (qty2 - Convert.ToDecimal(skuNum) < 0)
        //                    {
        //                        throw new Exception("到货数量大于未打标签数量,请重新输入到货数量!");
        //                    }
        //                    else
        //                    {
        //                        qty2 = Convert.ToDecimal(skuNum);
        //                    }
        //                }
        //                #endregion
        //                int labelNum2 = 1; //生产箱条码数量
        //                labelNum2 = int.Parse(Math.Ceiling(qty2 / bNum).ToString());
        //                if (bQNum >= 1)//打印标签数量是否大于1 (有打印标签数量)
        //                {
        //                    if (bQNum > 100)
        //                    {
        //                        throw new Exception("打印标签数量建议在100张以内");
        //                    }
        //                    if (bQNum < labelNum2) //打印的标签数量大于等于剩余能打印的张数量
        //                    {
        //                        labelNum2 = (int)bQNum;
        //                    }
        //                }
        //                //var bCount = Math.Floor(qty2 / bNum); //整箱的数量
        //                //var zCount = qty2 - bCount* bNum; //剩余数量
        //                var ss = bNum / zNum; //每箱支标签数量
        //                var labelNumZ2 = Math.Ceiling((decimal)ss);
        //                if (labelNum2 * labelNumZ2 > 100)
        //                {
        //                    if (labelNumZ2 <= 100)
        //                    {
        //                        labelNum2 = (int)Math.Floor((decimal)(100 / labelNumZ2));
        //                    }
        //                    else
        //                    {
        //                        labelNum2 = 1;
        //                    }
        //                }
        //                string maxCodestr2 = "";    //批次
        //                string maxboxcode2 = "";    //箱码
        //                string maxboxcode3 = "";    //支码
        //                                            // 生成自编批号
        //                string toDayTime2 = DateTime.Now.ToString("yyyyMMdd");
        //                var diJiJian = 0;
        //                if (isPrint == "0")
        //                {
        //                    var maxCode = DataContext.LabelPrint.Where(b => b.ImportId == imId).ToList().Max(a => a.ImportLotNo);
        //                    var boxCode1 = DataContext.LabelPrint.Where(b => b.ImportId == imId).ToList().Max(a => a.LabelStream);
        //                    var boxCode2 = DataContext.LabelPrint.Where(b => b.ImportId == imId).ToList().Max(a => a.BoxCode1);//支号
        //                    maxCodestr2 = maxCode;
        //                    maxboxcode2 = boxCode1;
        //                    maxboxcode3 = boxCode2;
        //                    if (string.IsNullOrWhiteSpace(maxCodestr2))
        //                    {
        //                        maxCodestr2 = toDayTime2.Substring(2, 6) + "0001";
        //                    }
        //                    else
        //                    {
        //                        var q = DataContext.LabelPrint
        //                            .Where(m => m.ImportId == imId && m.ImportLotNo == maxCodestr2)
        //                            .GroupBy(m => m.LabelStream).ToList();
        //                        diJiJian = q.Count;
        //                    }
        //                }
        //                else
        //                {
        //                    var maxCode = DataContext.LabelPrint.Max(a => a.ImportLotNo);                        // 获取今天最大批次号
        //                    if (string.IsNullOrWhiteSpace(maxCode))
        //                    {
        //                        maxCodestr2 = toDayTime2.Substring(2, 6) + "0001";
        //                    }
        //                    else
        //                    {
        //                        var lotStr = maxCode.Substring(0, 6);
        //                        var timeStr = toDayTime2.Substring(2, 6);
        //                        if (lotStr == timeStr)
        //                        {
        //                            maxCodestr2 = timeStr + (int.Parse(maxCode.Substring(6, 4)) + 1).ToString().PadLeft(4, '0');
        //                        }
        //                        else
        //                        {
        //                            maxCodestr2 = timeStr + "0001";
        //                        }
        //                    }
        //                }
        //                var sapNo = "";
        //                if (!string.IsNullOrWhiteSpace(list.OuterBillCode) && !string.IsNullOrWhiteSpace(list.SequenceNo))
        //                {
        //                    sapNo = list.OuterBillCode + "-" + list.SequenceNo;
        //                }
        //                for (int i = 1; i <= labelNum2; i++)//箱码标签
        //                {
        //                    // 物料条码信息赋值
        //                    LabelPrint5Model model = new LabelPrint5Model();
        //                    model.ImportId = imId;
        //                    model.OuterBillCode = list.OuterBillCode;
        //                    model.ImportBillCode = list.ImportBillCode;
        //                    model.SkuNo = list.GoodsCode;
        //                    model.SkuName = list.GoodsName;
        //                    model.QtyCount = (int)bQNum;                          // 总件数
        //                    model.SupplierName = supplierName;                        // 生产厂家
        //                    model.ProductionDate = productionDate;                      // 生产日期
        //                    model.SapSkuNo = sapNo;                            // SAP代码
        //                    model.Standard = good.GoodsStandard;                            // 规格
        //                    model.SupplierLot = supplierLot;                         // 厂家批号
        //                    model.LotNo = maxCodestr2;                      //批次
        //                    model.InspectTime = inspectTime;                     // 复验期至
        //                    model.ExpirationTime = expirationTime;                  // 有效期至/贮存期
        //                    model.ExpirationType = good.GoodsTemp;                  // 贮存条件
        //                    if (i == labelNum2)
        //                    {
        //                        // 最后一个条码
        //                        var s = bNum * (i - 1);
        //                        if (bNum > qty2 - s)
        //                        {
        //                            model.Qty = qty2 - s;// 数量
        //                        }
        //                        else
        //                        {
        //                            model.Qty = bNum;// 数量
        //                        }
        //                    }
        //                    else
        //                    {
        //                        model.Qty = bNum;                                                         // 数量
        //                    }
        //                    model.QtyOrd = i + diJiJian;                                               // 第几件
        //                    if (maxboxcode2 == "")
        //                    {
        //                        maxboxcode2 = "B" + model.LotNo + i.ToString().PadLeft(5, '0');
        //                        model.BoxCode = maxboxcode2;                                // 箱号     批号+第几箱
        //                    }
        //                    else
        //                    {
        //                        maxboxcode2 = maxboxcode2.Substring(0, 11) + (int.Parse(maxboxcode2.Substring(11, 5)) + 1).ToString().PadLeft(5, '0');
        //                        model.BoxCode = maxboxcode2;
        //                    }
        //                    model.imageStr = Utility.Extra.BarcodeHelper.GetQrCodeBase64(model.BoxCode, 85, 85);
        //                    // 添加到list集合
        //                    printModel.Add(model);
        //                    if (i == labelNum2)
        //                    {
        //                        var isGo2 = false;
        //                        var sl = 0;
        //                        for (int j = 1; j <= labelNumZ2; j++)
        //                        {
        //                            if (isGo2)
        //                            {
        //                                break;
        //                            }
        //                            var d = zNum;
        //                            if (i == labelNum2)
        //                            {
        //                                var s = bNum * (i - 1);
        //                                var s2 = zNum * (j - 1);
        //                                if (zNum >= qty2 - s - s2)
        //                                {
        //                                    d = (int)(qty2 - s - s2);    // 数量
        //                                    isGo2 = true;
        //                                }
        //                            }
        //                            sl++;
        //                        }
        //                        labelNumZ2 = sl;
        //                    }
        //                    for (int j = 1; j <= labelNumZ2; j++)//最小单位标签
        //                    {
        //                        if (isGo)
        //                        {
        //                            break;
        //                        }
        //                        var d = zNum;
        //                        if (i == labelNum2)
        //                        {
        //                            var s = bNum * (i - 1);
        //                            var s2 = zNum * (j - 1);
        //                            if (zNum >= qty2 - s - s2)
        //                            {
        //                                d = (int)(qty2 - s - s2);    // 数量
        //                                isGo = true;
        //                            }
        //                        }
        //                        // 物料条码信息赋值
        //                        LabelPrint5Model model2 = new LabelPrint5Model();
        //                        model2.ImportId = imId;
        //                        model2.OuterBillCode = list.OuterBillCode;
        //                        model2.ImportBillCode = list.ImportBillCode;
        //                        model2.SkuNo = list.GoodsCode;
        //                        model2.SkuName = list.GoodsName;
        //                        model2.QtyCount = (int)labelNumZ2;                          // 总件数(int)labelNumZ2
        //                        model2.SupplierName = supplierName;                        // 生产厂家
        //                        model2.ProductionDate = productionDate;                      // 生产日期
        //                        model2.SapSkuNo = sapNo;                            // SAP代码
        //                        model2.Standard = good.GoodsStandard;                            // 规格
        //                        model2.SupplierLot = supplierLot;                         // 厂家批号
        //                        model2.LotNo = maxCodestr2;                      //批次
        //                        model2.InspectTime = inspectTime;                     // 复验期至
        //                        model2.ExpirationTime = expirationTime;                  // 有效期至/贮存期
        //                        model2.ExpirationType = good.GoodsTemp;                  // 贮存条件
        //                        model2.Qty = d;                                                         // 数量
        //                        model2.QtyOrd = j;                                               // 第几件
        //                        if (maxboxcode3 == "")
        //                        {
        //                            var str = mesGood.PadRight(16, ' ') + model.LotNo.PadRight(12, ' ') + "0001";
        //                            model2.BoxCode = str;                 // 支号     批号+第几箱
        //                            maxboxcode3 = model2.BoxCode;
        //                        }
        //                        else
        //                        {
        //                            model2.BoxCode = maxboxcode3.Substring(0, 28) + (int.Parse(maxboxcode3.Substring(28, 4)) + 1).ToString().PadLeft(4, '0');
        //                            maxboxcode3 = model2.BoxCode;
        //                        }
        //                        model2.imageStr = Utility.Extra.BarcodeHelper.GetQrCodeBase64(model2.BoxCode, 85, 85);
        //                        // 添加到list集合
        //                        if (printModel.Count(m => m.BoxCode.Length > 17) <= 100)//排除待箱码判断支码是否小于100
        //                        {
        //                            printModel.Add(model2);
        //                        }
        //                        var guid = Guid.NewGuid().ToString("N");
        //                        // 将条码保存到原料条码表
        //                        var LabelModel2 = new LabelPrint
        //                        {
        //                            LabelID = guid,
        //                            LabelStream = model.BoxCode,
        //                            BoxCode1 = model2.BoxCode,
        //                            GoodsCode = model2.SkuNo,
        //                            GoodsName = model2.SkuName,
        //                            GoodsStandard = model2.Standard,
        //                            ImportLotNo = model2.LotNo,
        //                            SupplierName = model2.SupplierName,
        //                            ImportId = model2.ImportId,
        //                            OuterBillCode = model2.OuterBillCode,
        //                            ImportBillCode = model2.ImportBillCode,
        //                            ProductionDate = model2.ProductionDate,
        //                            SapSkuNo = model2.SapSkuNo,
        //                            Qty = model2.Qty,
        //                            SupplierLot = model2.SupplierLot,
        //                            InspectTime = model2.InspectTime,
        //                            ExpirationTime = model2.ExpirationTime,
        //                            QtyCount = model2.QtyCount,
        //                            QtyOrd = model2.QtyOrd,
        //                            ExpirationType = model2.ExpirationType,
        //                            BoxNum = bNum,//model.Qty,
        //                            BulkTank = model.Qty == bNum ? 0 : 1,//零头箱
        //                            BulkCase = 0,//零头盒
        //                            CreateUser = createUser,
        //                            CreateTime = DateTime.Now,
        //                            IsUse = 0
        //                        };
        //                        DataContext.LabelPrint.InsertOnSubmit(LabelModel2);
        //                    }
        //                }
        //                DataContext.SubmitChanges();
        //                #endregion
        //            }
        //            return printModel;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message);
        //    }
        //}
    }
}
Wms/WMS.Entity/BllAsnEntity/BllLabelBoxNo.cs
@@ -61,6 +61,27 @@
        public string SkuName { get; set; }
        /// <summary>
        /// Desc:物料规格
        /// Default:
        /// Nullable:True
        /// </summary>
        public string Standard { get; set; }
        /// <summary>
        /// Desc:包装规格
        /// Default:
        /// Nullable:True
        /// </summary>
        public string PackageStandard { get; set; }
        /// <summary>
        /// Desc:储存期至
        /// Default:
        /// Nullable:True
        /// </summary>
        public DateTime? StoreTime { get; set; }
        /// <summary>
        /// Desc:批次号
        /// Default:
        /// Nullable:True
Wms/WMS.IBLL/IBllAsnServer/IBllLabelBoxNoServer.cs
@@ -16,5 +16,13 @@
        /// <param name="count">数量</param>
        /// <returns>标签箱码信息</returns>
        List<LabelBoxDto> GetLabelBoxList(LabelBoxVm model, out int count);
        /// <summary>
        /// 获取标签模板根据入库单明细ID
        /// </summary>
        /// <param name="id">入库单明细ID</param>
        /// <returns>标签信息模板</returns>
        LabelBoxDto GetLabelBoxModel(int id);
    }
}
Wms/Wms/Controllers/BllAsnController.cs
@@ -862,6 +862,21 @@
            }
        }
        [HttpGet]
        public IActionResult GetLabelBoxModel(int id)
        {
            try
            {
                var list = _labelBox.GetLabelBoxModel(id);
                return Ok(new { code = 0, msg = "箱码模板信息", data = list });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        #endregion
    }