Demo
2024-02-02 5a03e3053f7958f78f280f6da3c8b68cd0b491dc
Merge branch 'csc'
7个文件已修改
637 ■■■■■ 已修改文件
HTML/views/ASNSetting/ArrivalNotice.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/LabelBox.html 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/LabelPrint.html 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs 431 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/BllAsnController.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/ASNSetting/ArrivalNotice.html
@@ -302,13 +302,13 @@
                    </script>
 
                    <script type="text/html" id="toolbarDemoList">
                        {{# function GetBtn2(d){
                        {{# function GetBtn2(d){
                                var html = ``;
                                if(d.Status == "0"){ 
                                    html = `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del"> 
                                        <i class="layui-icon layui-icon-delete"></i>删除</a>`; 
                                }
                                if(d.Status == "0" || d.Status == "1"){
                                if(d.Status == "0" || d.Status == "1"){
                                    html += `<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="Addlabel"> 
                                        <i class="layui-icon layui-icon-edit"></i>生成标签</a>`; 
                                }
HTML/views/ASNSetting/LabelBox.html
@@ -97,7 +97,7 @@
                        <label class="layui-form-label">是否使用</label>
                        <div class="layui-input-inline" style="margin-right: 0;">
                            <div class="layui-input-inline" style="margin-right: 0;">
                                <select name="IsUse" id="IsUse" lay-filter="IsUse" lay-search>
                                <select name="Status" id="Status" lay-filter="Status" lay-search>
                                    <option value=""></option>
                                    <option value="0">否</option>
                                    <option value="1">是</option>
@@ -152,9 +152,9 @@
                        {{ GetBtn4(d) }}
                    </script>
                    <script type="text/html" id="templetInspectTime">
                    <script type="text/html" id="templetStoreTimeTime">
                        {{# function GetBtn5(d){
                                return formatDate2(d.InspectTime);
                                return formatDate2(d.StoreTimeTime);
                            }    
                        }}
                        {{ GetBtn5(d) }}
@@ -168,18 +168,41 @@
                        {{ GetBtn6(d) }}
                    </script>
                    <script type="text/html" id="templetIsUse">
                    <script type="text/html" id="templetStatus">
                        {{# function GetBtn7(d){
                                switch (d.IsUse) {
                                    case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>';
                                    case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger ">是</button>';
                                switch (d.Status) {
                                    case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">未组托</button>';
                                    case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger ">已组托</button>';
                                    case "2": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-normal ">已入库</button>';
                                    default: return "";
                                }    
                            }    
                        }}
                        {{ GetBtn7(d) }}
                    </script>
                    <script type="text/html" id="templetInspectMark">
                        {{# function GetBtn9(d){
                                switch (d.InspectMark) {
                                    case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>';
                                    case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger ">是</button>';
                                    default: return "";
                                }
                            }
                        }}
                        {{ GetBtn9(d) }}
                    </script>
                    <script type="text/html" id="templetBitBoxMark">
                        {{# function GetBtn10(d){
                                switch (d.BitBoxMark) {
                                    case "0": return '<button class="layui-btn layui-btn-radius layui-btn-xs">否</button>';
                                    case "1": return '<button class="layui-btn layui-btn-radius layui-btn-xs layui-btn-danger ">是</button>';
                                    default: return "";
                                }
                            }
                        }}
                        {{ GetBtn10(d) }}
                    </script>
                    <script type="text/html" id="templetCreateTime">
@@ -204,7 +227,7 @@
                <script type="text/html" id="toolbarDemoList">
                    {{# function GetBtn2(d){
                            var html = '';
                            if(d.Origin == "录入" || d.Origin == "导入"){
                            if(d.Origin == "WMS生成" || d.Status == "0"){
                                html = `<a class="layui-btn layui-btn-danger layui-btn-xs delClass" lay-event="del"> 
                                    <i class="layui-icon layui-icon-delete"></i>删除</a>`; 
                                
@@ -322,26 +345,34 @@
            //#region 自定义表头
            var TotalColsArr = [[
                { field: 'AsnNo', title: '入库单号', align: 'center', width: 155, "disabled": true },
                { field: 'ASNNo', title: '入库单号', align: 'center',fixed: 'left', width: 180, "disabled": true },
                { field: 'BoxNo', title: '箱号', align: 'center', fixed: 'left', width: 220, "disabled": true },
                { field: 'ParentBoxNo', title: '父级箱号', align: 'center', fixed: 'left', width: 220, "disabled": true },
                { field: 'BoxNo2', title: '盒号', align: 'center', fixed: 'left', width: 220,  },
                { field: 'BoxNo3', title: '支号', align: 'center', fixed: 'left', width: 220, "disabled": true },
                { field: 'SkuNo', title: '物料编码', align: 'center', fixed: 'left', width: 140, "disabled": true },
                { field: 'SkuName', title: '物料名称', align: 'center', width: 240, },
                { field: 'Qty', title: '数量', align: 'center', width: 100, },
                { field: 'FullQty', title: '整箱数量', align: 'center', width: 100, },
                { field: 'LotNo', title: '批次号', align: 'center', width: 155, },
                { field: 'LotText', title: '批次描述', align: 'center', width: 165 },
                { field: 'IsUse', title: '是否使用', align: 'center', templet: '#templetIsUse', width: 90 },
                { field: 'Level', title: '级别', align: 'center', width: 90 },
                { field: 'SupplierLot', title: '供货批次', align: 'center', width: 155 },
                { field: 'Status', title: '状态', align: 'center', templet: '#templetStatus', width: 90 },
                { field: 'Standard', title: '规格/型号', align: 'center', width: 165 },
                { field: 'PackageStandard', title: '包装规格', align: 'center', width: 165 },
                { field: 'ProductionTime', title: '生产日期', align: 'center', width: 160, templet: '#templetProductionTime' },
                { field: 'ExpirationTime', title: '过期日期', align: 'center', width: 160, templet: '#templetExpirationTime' },
                { field: 'InspectTime', title: '复验日期', align: 'center', width: 160, templet: '#templetInspectTime' },
                { field: 'CompleteTime', title: '完成日期', align: 'center', width: 160, templet: '#templetCompleteTime' },
                { field: 'SupplierName', title: '供应商', align: 'center', width: 155 },
                { field: 'SupplierLot', title: '供货批次', align: 'center', width: 155 },
                { field: 'StoreTime', title: '储存期至', align: 'center', width: 160, templet: '#templetStoreTime' },
                { field: 'CompleteTime', title: '完成日期', align: 'center', width: 160, templet: '#templetCompleteTime' },
                {field: 'InspectMark',title: '抽检标记',align: 'center',templet: '#templetInspectMark',width: 90},
                {field: 'BitBoxMark',title: '零箱标记',align: 'center',templet: '#templetBitBoxMark',width: 90},
                {field: 'Origin',title: '来源',align: 'center',width: 90},
                { field: 'CreateUserName', title: '创建人', align: 'center', width: 100 },
                { field: 'CreateTime', title: '创建时间', align: 'center', width: 160, templet: '#templetCreateTime' },
                { field: 'caozuo', title: '操作', fixed: 'right', width: 100, align: 'center', toolbar: '#toolbarDemoList', "disabled": true }
                //{ field: 'caozuo', title: '操作', fixed: 'right', width: 100, align: 'center', toolbar: '#toolbarDemoList', "disabled": true }
            ]];
            //url编码
            var TotalColsSysArr = encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
@@ -365,14 +396,13 @@
                        colsJson = TotalColsArr
                    }
                    var param = {
                        AsnNo:$("#ASNNo").val(),
                        BoxNo: $("#BoxNo").val(),
                        BoxNo3: $("#BoxNo3").val(),
                        Status: $("#Status").val(),
                        SkuNo: $("#SkuNo").val(),
                        LotNo: $("#LotNo").val(),
                        LotText: $("#LotText").val(),
                        LotNo: $("#LotNo").val(),
                        ProductionTime: $("#ProductionTime").val(),
                        InspectMark: $("#InspectMark").val(),
                        BitBoxMark: $("#BitBoxMark").val(),
                        SupplierLot: $("#SupplierLot").val(),
                    };
                    table.render({
                        elem: '#Box-list',
HTML/views/ASNSetting/LabelPrint.html
@@ -117,16 +117,47 @@
            
            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');
            var storeTime = getQueryString('StoreTime');
            
            console.log(productionTime);
            console.log(expirationTime);
            console.log(storeTime);
            //生成
            $('#btnAdd').on('click', function () {
                var param = {
                    Id: parseInt(id),
                    IsReset:reset,
                    ArriveQty:arriveQty,
                    ProductionTime:productionTime,
                    ExpirationTime:expirationTime,
                    StoreTime:storeTime
                };
                console.log(param);
                synData(IP + "/BllAsn/AddLabelBox", param , 'post', function (res) {
                    if (res.code == 0) { //成功
                        layer.msg(res.msg, {
                            icon: 2,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        }, function () { });
                        // $("#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 () { });
                    }
                });
            });
            //打印
            $('#btnPrint').on('click', function () {
                var param = {
                    ImportId: id,
Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs
@@ -178,4 +178,34 @@
        public int realQty { get; set; }
        public string bitBoxMark { get; set; }
    }
    /// <summary>
    /// 物料标签Vm
    /// </summary>
    public class LabelBoxInfoVm : IndexPage
    {
        public string AsnNo { get; set; }
        public string BoxNo { get; set; }
        public string SkuNo { get; set; }
        public string LotNo { get; set; }
        public string SupplierLot { get; set; }
        public string Status { get; set; }
        public string ProductionTime { get; set; }
    }
    /// <summary>
    /// 生成物料标签Vm
    /// </summary>
    public class AddLabelBoxInfoVm
    {
        public int Id { get; set; }
        public string IsReset { get; set; }
        public string ArriveQty { get; set; }
        public string ProductionTime { get; set; }
        public string ExpirationTime { get; set; }
        public string StoreTime { get; set; }
    }
}
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -7,6 +7,7 @@
using System.Linq;
using System.Linq.Expressions;
using Model.ModelDto.BllAsnDto;
using Model.ModelVm.BllAsnVm;
using Utility.Tools;
using WMS.BLL.LogServer;
using WMS.DAL;
@@ -399,9 +400,136 @@
        }
        //获取标签箱码信息
        public List<BoxInfoDto> GetLabelBoxList(LabelBoxInfoVm model, out int count)
        {
            try
            {
                Expression<Func<BllBoxInfo, bool>> item = Expressionable.Create<BllBoxInfo>()
                    .AndIF(!string.IsNullOrWhiteSpace(model.AsnNo), it => it.ASNNo.Contains(model.AsnNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.BoxNo), it => it.BoxNo.Contains(model.BoxNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.SkuNo), it => it.SkuNo.Contains(model.SkuNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.LotNo), it => it.LotNo.Contains(model.LotNo.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.SupplierLot), it => it.SupplierLot.Contains(model.SupplierLot.Trim()))
                    .AndIF(!string.IsNullOrWhiteSpace(model.Status), it => it.Status == model.SupplierLot)
                    .AndIF(!string.IsNullOrWhiteSpace(model.ProductionTime), it => it.ProductionTime >= Convert.ToDateTime(model.ProductionTime))
                    .AndIF(!string.IsNullOrWhiteSpace(model.ProductionTime), it => it.ProductionTime <= Convert.ToDateTime(model.ProductionTime).AddDays(1))
                    .And(it => it.IsDel == "0")
                    .ToExpression();
                var total = 0;
                var data = GetAllWhereAsync(item)
                    .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id)
                    .LeftJoin<SysUserInfor>((a, b, c) => a.UpdateUser == c.Id)
                    .Select((a, b, c) => new BoxInfoDto()
                    {
                        Id = a.Id,
                        ASNNo = a.ASNNo,
                        ASNDetailNo = a.ASNDetailNo,
                        BoxNo = a.BoxNo,
                        BoxNo2 = a.BoxNo2,
                        BoxNo3 = a.BoxNo3,
                        Qty = a.Qty,
                        FullQty = a.FullQty,
                        SkuNo = a.SkuNo,
                        SkuName = a.SkuName,
                        Standard = a.Standard,
                        PackageStandard = a.PackageStandard,
                        LotNo = a.LotNo,
                        LotText = a.LotText,
                        Status = a.Status,
                        SupplierLot = a.SupplierLot,
                        ProductionTime = a.ProductionTime,
                        ExpirationTime = a.ExpirationTime,
                        StoreTime = a.StoreTime,
                        CompleteTime = a.CompleteTime,
                        InspectMark = a.InspectMark,
                        BitBoxMark = a.BitBoxMark,
                        InspectStatus = a.InspectStatus,
                        Origin = a.Origin,
                        QtyCount = a.QtyCount,
                        QtyOrd = a.QtyOrd,
                        CreateUserName = b.RealName,
                        UpdateUserName = c.RealName,
                        CreateTime = a.CreateTime,
                        UpdateTime = a.UpdateTime
                    }).OrderByDescending(a => a.CreateTime).OrderBy(a => a.BoxNo).ToOffsetPage(model.Page, model.Limit, ref total);
                count = total;
                return data;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        //获取标签模板根据入库单明细ID
        public BoxInfoDto 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 BoxInfoDto();
                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);
            }
        }
        //获取标签信息(生成标签)
        public List<LabelBoxDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string skuName, string standard, string packStandard, string skuNo,
            string supplierLot, string productionTime, string expirationTime, string storeTime, int userId)
        public List<BoxInfoDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId)
        {
            try
            { 
@@ -418,15 +546,37 @@
                {
                    throw new Exception("未查询到单据信息");
                }
                //物料
                var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == asnList.SkuNo);
                var pack = Db.Queryable<SysPackag>().First(m => m.IsDel == "0" && m.PackagNo == asnList.PackagNo);
                if (pack == null)
                {
                    throw new Exception("未查询到当前单据中物料的包装信息");
                }
                var packStr = "";
                if (!string.IsNullOrWhiteSpace(pack.L1Name))
                {
                    packStr += pack.L1Num + "/" + pack.L1Name;
                }
                if (!string.IsNullOrWhiteSpace(pack.L2Name))
                {
                    packStr += "-" + pack.L2Num + "/" + pack.L2Name;
                }
                if (!string.IsNullOrWhiteSpace(pack.L3Name))
                {
                    packStr += "-" + pack.L3Num + "/" + pack.L3Name;
                }
                if (!string.IsNullOrWhiteSpace(pack.L4Name))
                {
                    packStr += "-" + pack.L4Num + "/" + pack.L4Name;
                }
                if (!string.IsNullOrWhiteSpace(pack.L5Name))
                {
                    packStr += "-" + pack.L5Num + "/" + pack.L5Name;
                }
                //标签表
                var label = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.ASNDetailNo == imId).ToList();
                var label = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNDetailNo == imId).ToList();
                #endregion
@@ -487,7 +637,7 @@
                }
                #endregion
                var modelList = new List<BllBoxInfo>();
                if (packLevel == 1)
                {
                    #region 一级包装
@@ -529,7 +679,7 @@
                    string maxBoxCode = ""; //箱码号
                    // 生成自编批号
                    string toDayTime = DateTime.Now.ToString("yyyyMMdd");
                    var diJiJian = 0;
                    var maxLotNo = label.Max(a => a.LotNo);
                    var maxBoxNo = label.Max(a => a.BoxNo);
@@ -568,89 +718,70 @@
                    #endregion
                    var modelList = new List<LabelBoxDto>();
                    for (int i = 1; i <= labelNum; i++)
                    {
                        // 物料条码信息赋值
                        LabelBoxDto model = new LabelBoxDto();
                        model.AsnDetailNo = imId;
                        model.SkuNo = asnList.SkuNo;
                        model.SkuName = asnList.SkuName;
                        model.SupplierName = asn.CustomerName;                        // 供应商
                        model.Standard = asnList.Standard;                            // 规格
                        model.PackageStandard = packStandard;
                        model.SupplierLot = supplierLot;                         // 厂家批号
                        model.LotNo = maxLotNoStr;                      //批次
                        model.ProductionTime = DateTime.Parse(productionTime);          // 生产日期
                        model.StoreTime = DateTime.Parse(storeTime);                     // 储存期至
                        model.ExpirationTime = DateTime.Parse(expirationTime);          // 有效期至/贮存期
                        decimal boxQty = 0;
                        if (i == labelNum)
                        {
                            // 最后一个条码
                            var s = zNum * (i - 1);
                            if (zNum > qty - s)
                            {
                                model.Qty = qty - s;// 数量
                                boxQty = qty - s;// 数量
                            }
                            else
                            {
                                model.Qty = zNum;// 数量
                                boxQty = zNum;// 数量
                            }
                        }
                        else
                        {
                            model.Qty = zNum;         // 数量
                            boxQty = zNum;         // 数量
                        }
                        //获取箱码
                        if (maxBoxCode == "")
                        {
                            var str = model.LotNo + "000001";
                            model.BoxNo = str;                 // 支号     批号+ 流水  2302010001000001
                            maxBoxCode = model.BoxNo;
                            var str = maxLotNoStr + "000001"; //批号+ 流水  2302010001000001
                            maxBoxCode = str;
                        }
                        else
                        {
                            model.BoxNo = maxBoxCode.Substring(0, 10) + (int.Parse(maxBoxCode.Substring(10, 6)) + 1).ToString().PadLeft(6, '0');
                            maxBoxCode = model.BoxNo;
                        }
                        model.ImgStr = BarcodeHelper.GetCodeBarBase64(model.BoxNo, 80, 50);
                        // 添加到list集合
                        modelList.Add(model);
                            maxBoxCode = maxBoxCode.Substring(0, 10) + (int.Parse(maxBoxCode.Substring(10, 6)) + 1).ToString().PadLeft(6, '0');
                        }
                        // 将条码保存到原料条码表
                        var labelModel = new BllLabelBoxNo()
                        var labelModel = new BllBoxInfo()
                        {
                            ASNNo = asnList.ASNNo,
                            ASNDetailNo = asnList.Id,
                            BoxNo = model.BoxNo,
                            ParentBoxNo = "",
                            Qty = model.Qty,
                            SkuNo = model.SkuNo,
                            SkuName = model.SkuName,
                            Standard = model.Standard,
                            PackageStandard = model.PackageStandard,
                            BoxNo = maxBoxCode,
                            Qty = int.Parse(boxQty.ToString()),
                            FullQty = bNum,
                            Status = "0",
                            SkuNo = asnList.SkuNo,
                            SkuName = asnList.SkuName,
                            LotNo = maxLotNoStr,
                            Standard = asnList.Standard,
                            PackageStandard = packStr,
                            SupplierLot = asnList.SupplierLot,
                            InspectMark = "0",
                            BitBoxMark = bNum > boxQty ? "1":"0",
                            InspectStatus = "",
                            LotNo = model.LotNo,
                            SupplierName = asn.CustomerName,
                            ProductionTime = model.ProductionTime,
                            SupplierLot = model.SupplierLot,
                            StoreTime = model.StoreTime,
                            ExpirationTime = model.ExpirationTime,
                            IsUse = "0",
                            Level = "1",
                            ProductionTime = DateTime.Parse(productionTime),
                            StoreTime = DateTime.Parse(storeTime),
                            ExpirationTime = DateTime.Parse(expirationTime),
                            Origin = "WMS生成",
                            CreateUser = userId,
                            CreateTime = DateTime.Now,
                        };
                        Db.Insertable(labelModel).ExecuteCommand();
                        modelList.Add(labelModel);
                    }
                    #endregion
@@ -698,8 +829,8 @@
                    if (isReset == "0")
                    {
                        var maxCode = label.Max(a => a.LotNo);
                        var boxCode1 = label.Where(m => m.Level == "1").Max(a => a.BoxNo);//箱号
                        var boxCode2 = label.Where(m => m.Level == "2").Max(a => a.BoxNo);//支号
                        var boxCode1 = label.Max(a => a.BoxNo);//箱号
                        var boxCode2 = label.Max(a => a.BoxNo3);//支号
                        maxCodestr2 = maxCode;
                        maxboxcode2 = boxCode1;
                        maxboxcode3 = boxCode2;
@@ -733,59 +864,21 @@
                    #endregion
                    var modelList = new List<LabelBoxDto>();
                    for (int i = 1; i <= labelNum2; i++)//箱码标签
                    {
                        // 物料条码信息赋值
                        LabelBoxDto model = new LabelBoxDto();
                        model.AsnDetailNo = imId;
                        model.SkuNo = asnList.SkuNo;
                        model.SkuName = asnList.SkuName;
                        model.Standard = asnList.Standard;               // 规格
                        model.PackageStandard = packStandard;
                        model.SupplierLot = supplierLot;                 // 厂家批号
                        model.LotNo = maxCodestr2;                      //批次
                        model.ProductionTime = DateTime.Parse(productionTime);          // 生产日期
                        model.StoreTime = DateTime.Parse(storeTime);                     // 储存期至
                        model.ExpirationTime = DateTime.Parse(expirationTime);          // 有效期至/贮存期
                        if (i == labelNum2)
                        {
                            // 最后一个条码
                            var s = bNum * (i - 1);
                            if (bNum > qty2 - s)
                            {
                                model.Qty = qty2 - s;// 数量
                            }
                            else
                            {
                                model.Qty = bNum;// 数量
                            }
                        }
                        else
                        {
                            model.Qty = bNum;                                                         // 数量
                        }
                        //获取箱码
                        if (maxboxcode2 == "")
                        {
                            maxboxcode2 = model.LotNo + "000001";
                            model.BoxNo = maxboxcode2;        // 箱号     批号+第几箱
                            maxboxcode2 = model.BoxNo;
                            maxboxcode2 = maxCodestr2 + "000001"; // 箱号     批号+第几箱
                        }
                        else
                        {
                            model.BoxNo = maxboxcode2.Substring(0, 10) + (int.Parse(maxboxcode2.Substring(10, 6)) + 1).ToString().PadLeft(6, '0');
                            maxboxcode2 = model.BoxNo;
                            maxboxcode2 = maxboxcode2.Substring(0, 10) + (int.Parse(maxboxcode2.Substring(10, 6)) + 1).ToString().PadLeft(6, '0');
                        }
                        model.ImgStr = BarcodeHelper.GetCodeBarBase64(model.BoxNo, 80, 50);
                        // 添加到list集合
                        modelList.Add(model);
                        //获取箱内支标签数量
                        if (i == labelNum2)
                        {
                            var isGo2 = false;
@@ -796,17 +889,6 @@
                                {
                                    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;
@@ -814,99 +896,58 @@
                        for (int j = 1; j <= labelNumZ2; j++)//最小单位标签
                        {
                            if (isGo)
                            {
                                break;
                            }
                            var d = zNum;
                            decimal 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;
                                    d = qty2 - s - s2;    // 数量
                                }
                            }
                            //// 物料条码信息赋值
                            //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
                            if (maxboxcode3 == "")
                            {
                                maxboxcode3 = maxCodestr2 + "0001"; // 支号     批号+第几箱
                            }
                            else
                            {
                                maxboxcode3 = maxboxcode3.Substring(0, 28) + (int.Parse(maxboxcode3.Substring(28, 4)) + 1).ToString().PadLeft(4, '0');
                            }
                            //model2.SupplierName = supplierName;                        // 生产厂家
                            //model2.ProductionDate = productionDate;                      // 生产日期
                            //model2.SapSkuNo = sapNo;                            // SAP代码
                            //model2.Standard = good.GoodsStandard;                            // 规格
                            //model2.SupplierLot = supplierLot;                         // 厂家批号
                            // 将条码保存到原料条码表
                            var labelModel = new BllBoxInfo()
                            {
                                ASNNo = asnList.ASNNo,
                                ASNDetailNo = asnList.Id,
                                BoxNo = maxboxcode2,
                                BoxNo3 = maxboxcode3,
                                Qty = int.Parse(d.ToString()),
                                FullQty = bNum,
                                Status = "0",
                                SkuNo = asnList.SkuNo,
                                SkuName = asnList.SkuName,
                                LotNo = maxCodestr2,
                                Standard = asnList.Standard,
                                PackageStandard = packStr,
                                SupplierLot = asnList.SupplierLot,
                                InspectMark = "0",
                                BitBoxMark = bNum > d ? "1" : "0",
                                InspectStatus = "0",
                            //model2.LotNo = maxCodestr2;                      //批次
                                ProductionTime = DateTime.Parse(productionTime),
                                StoreTime = DateTime.Parse(storeTime),
                                ExpirationTime = DateTime.Parse(expirationTime),
                                Origin = "WMS生成",
                                CreateUser = userId,
                                CreateTime = DateTime.Now,
                            };
                            //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);
                            Db.Insertable(labelModel).ExecuteCommand();
                            modelList.Add(labelModel);
                        }
@@ -915,7 +956,7 @@
                    #endregion
                }
                //return printModel;
                //return labelModel;
                throw new NotImplementedException();
Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs
@@ -25,23 +25,36 @@
        /// <returns></returns>
        List<BoxInfoDto> GetBoxInfoList(string boxCode,string isContinue, string boxCode2);
        /// <summary>
        /// 获取标签箱码信息
        /// </summary>
        /// <param name="model">查询条件</param>
        /// <param name="count">数量</param>
        /// <returns>标签箱码信息</returns>
        List<BoxInfoDto> GetLabelBoxList(LabelBoxInfoVm model, out int count);
        /// <summary>
        /// 获取标签模板根据入库单明细ID
        /// </summary>
        /// <param name="id">入库单明细ID</param>
        /// <returns>标签信息模板</returns>
        BoxInfoDto GetLabelBoxModel(int id);
        /// <summary>
        /// 获取标签信息(生成标签)
        /// </summary>
        /// <param name="imId">入库单明细ID</param>
        /// <param name="isReset">是否重新生成自有批次 0:否 1:是</param>
        /// <param name="arriveQty">到货数量</param>
        /// <param name="skuName">物料名称</param>
        /// <param name="standard">规格/型号</param>
        /// <param name="packStandard">包装规格</param>
        /// <param name="skuNo">物料编码</param>
        /// <param name="supplierLot">供应商批次</param>
        /// <param name="productionTime">生产日期</param>
        /// <param name="expirationTime">有效期至</param>
        /// <param name="storeTime">储存期至</param>
        /// <param name="userId">操作人</param>
        /// <returns></returns>
        List<LabelBoxDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string skuName, string standard, string packStandard, string skuNo, string supplierLot, string productionTime, string expirationTime, string storeTime, int userId);
        List<BoxInfoDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId);
    }
}
Wms/Wms/Controllers/BllAsnController.cs
@@ -849,11 +849,11 @@
        #region 箱码标签
        [HttpPost]
        public IActionResult GetLabelBoxList(LabelBoxVm model)
        public IActionResult GetLabelBoxList(LabelBoxInfoVm model)
        {
            try
            {
                var list = _labelBox.GetLabelBoxList(model, out int count);
                var list = _BoxInfoSvc.GetLabelBoxList(model, out int count);
                return Ok(new { code = 0, count, msg = "箱码标签列表", data = list });
            }
            catch (Exception e)
@@ -867,7 +867,7 @@
        {
            try
            {
                var list = _labelBox.GetLabelBoxModel(id);
                var list = _BoxInfoSvc.GetLabelBoxModel(id);
                return Ok(new { code = 0, msg = "箱码模板信息", data = list });
            }
            catch (Exception e)
@@ -876,6 +876,30 @@
            }
        }
        [HttpPost]
        public IActionResult AddLabelBox(AddLabelBoxInfoVm model)
        {
            try
            {
                //获取当前登录的用户ID
                var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(userId))
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var list = _BoxInfoSvc.AddLabelBoxReturn(model.Id, model.IsReset, decimal.Parse(model.ArriveQty),  model.ProductionTime, model.ExpirationTime, model.StoreTime, int.Parse(userId));
                return Ok(new { code = 0,  msg = "箱码标签列表", data = list });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, count = 0, msg = e.Message });
            }
        }
        #endregion
    }