From 5a03e3053f7958f78f280f6da3c8b68cd0b491dc Mon Sep 17 00:00:00 2001 From: Demo <Demo@DESKTOP-CPA90BF> Date: 星期五, 02 二月 2024 16:46:04 +0800 Subject: [PATCH] Merge branch 'csc' --- Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs | 431 +++++++++++++++++++++----------------- Wms/Wms/Controllers/BllAsnController.cs | 30 ++ HTML/views/ASNSetting/ArrivalNotice.html | 4 Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs | 30 ++ HTML/views/ASNSetting/LabelPrint.html | 41 +++ Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs | 25 + HTML/views/ASNSetting/LabelBox.html | 76 ++++-- 7 files changed, 403 insertions(+), 234 deletions(-) diff --git a/HTML/views/ASNSetting/ArrivalNotice.html b/HTML/views/ASNSetting/ArrivalNotice.html index f6fbcab..53e718c 100644 --- a/HTML/views/ASNSetting/ArrivalNotice.html +++ b/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>`; } diff --git a/HTML/views/ASNSetting/LabelBox.html b/HTML/views/ASNSetting/LabelBox.html index 8f4ecf4..5800979 100644 --- a/HTML/views/ASNSetting/LabelBox.html +++ b/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)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜 @@ -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', diff --git a/HTML/views/ASNSetting/LabelPrint.html b/HTML/views/ASNSetting/LabelPrint.html index 1704e72..5e7b775 100644 --- a/HTML/views/ASNSetting/LabelPrint.html +++ b/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, diff --git a/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs b/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs index 08e1757..aa41732 100644 --- a/Wms/Model/ModelVm/BllAsnVm/BoxInfoVm.cs +++ b/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; } + + } + } diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs index e9f9f90..fe47e52 100644 --- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs +++ b/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); + } + } + + //鑾峰彇鏍囩妯℃澘鏍规嵁鍏ュ簱鍗曟槑缁咺D + 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); - - // 娣诲姞鍒發ist闆嗗悎 - 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); - - // 娣诲姞鍒發ist闆嗗悎 - 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浠g爜 - //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); - //// 娣诲姞鍒發ist闆嗗悎 - - //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(); diff --git a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs b/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs index 23e97e8..d0c6632 100644 --- a/Wms/WMS.IBLL/IBllAsnServer/IBllBoxInfoServer.cs +++ b/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> + /// 鑾峰彇鏍囩妯℃澘鏍规嵁鍏ュ簱鍗曟槑缁咺D + /// </summary> + /// <param name="id">鍏ュ簱鍗曟槑缁咺D</param> + /// <returns>鏍囩淇℃伅妯℃澘</returns> + BoxInfoDto GetLabelBoxModel(int id); + + /// <summary> /// 鑾峰彇鏍囩淇℃伅(鐢熸垚鏍囩) /// </summary> /// <param name="imId">鍏ュ簱鍗曟槑缁咺D</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); } } diff --git a/Wms/Wms/Controllers/BllAsnController.cs b/Wms/Wms/Controllers/BllAsnController.cs index fee616f..f1e307f 100644 --- a/Wms/Wms/Controllers/BllAsnController.cs +++ b/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 + { + //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D + 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 } -- Gitblit v1.8.0