From ec3e4e46da50f911b9d3eaef98b399962f3e4c70 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-5BIMHQ3> Date: 星期五, 02 二月 2024 14:56:16 +0800 Subject: [PATCH] Merge branch 'wxw' --- Pda/View/AsnSetting/productEnter.html | 56 ------- Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs | 326 ++-------------------------------------------- 2 files changed, 19 insertions(+), 363 deletions(-) diff --git a/Pda/View/AsnSetting/productEnter.html b/Pda/View/AsnSetting/productEnter.html index 65c4bb9..47ee0eb 100644 --- a/Pda/View/AsnSetting/productEnter.html +++ b/Pda/View/AsnSetting/productEnter.html @@ -46,7 +46,7 @@ </ul> </div> - <div id="zongDiv" class="layout-bill-info" style="height: 335px;"> + <div id="zongDiv" class="layout-bill-info" style="height: 285px;"> <form class="layui-form" action=""> <div id="" class="layui-form-item layout-dropdownlist"> <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> @@ -92,28 +92,6 @@ <label class="layui-form-label" lang>灏剧鏉$爜锛�</label> <div class="layui-input-block"> <input id="BOXCODE2" type="text" lang langholder placeholder="璇锋壂鎻忓绠辨潯鐮�" autocomplete="off" - class="layui-input"> - </div> - </div> - - <div id="" class="layui-form-item layout-input BOX01"> - <label class="layui-form-label" lang>浜岀骇鏉$爜锛�</label> - <div class="layui-input-block"> - <input id="BOXCODE01" type="text" lang langholder placeholder="璇锋壂鎻忎簩绾ф潯鐮�" autocomplete="off" - class="layui-input"> - </div> - </div> - <div id="" class="layui-form-item layout-input BOX01"> - <label class="layui-form-label" lang>浜岀骇杩炵粍锛�</label> - <div class="layui-input-block"> - <input type="checkbox" name="IsLianXu2" id="IsLianXu2" lay-skin="switch" lay-text="鏄瘄鍚�" - lay-filter="IsLianXu2"> - </div> - </div> - <div id="" class="layui-form-item layout-input BOX02" style="display: none;"> - <label class="layui-form-label" lang>浜岀骇灏剧爜锛�</label> - <div class="layui-input-block"> - <input id="BOXCODE02" type="text" lang langholder placeholder="璇锋壂鎻忎簩绾ф潯鐮佸熬鐮�" autocomplete="off" class="layui-input"> </div> </div> @@ -201,7 +179,7 @@ </div> <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding=""> <tr> - <th lang style="width: 15%;">缂栫爜</th> + <th lang style="width: 15%;">绠辩爜</th> <th lang style="width: 35%;">鍚嶇О</th> <th lang style="width: 25%;">鎵规</th> <th lang style="width: 15%;">鏁伴噺</th> @@ -238,14 +216,10 @@ var curPageIndex = 1; //鏄惁杩炵画澶栫缁勬墭 isContinue = "0"; - //鏄惁杩炵画浜岀骇鐮佺粍鎵� - isContinue2 = "0"; //娓呮鏂囨湰妗嗕腑鏁版嵁 function clear() { $("#BOXCODE").val(""); $("#BOXCODE2").val(""); - $("#BOXCODE01").val(""); - $("#BOXCODE02").val(""); $("#ImportQuantity").val(""); $("#Standard").val(""); @@ -358,9 +332,6 @@ BoxNo: $("#BOXCODE").val(), IsContinue: isContinue, TailBoxNo: $("#BOXCODE2").val(), - BoxNo01:$("#BOXCODE01").val(), - IsContinue2:isContinue2, - TailBoxNo01:$("#BOXCODE02").val(), Origin:"PDA" } //缁勭洏 @@ -450,7 +421,6 @@ // 缁戝畾鍏ュ簱鍗曠墿鏂欏強鎵规 function updateGoodList(skuNo) { - console.log("aaaa"); var input = $('select[id="goodSelect"]').next().find('.layui-select-title input') var val = input.val() @@ -660,7 +630,7 @@ form.on('switch(IsLianXu)', function (obj) { if (obj.elem.checked) { $('#BOX2').attr("style", "display:block") - $('#zongDiv').attr("style", "height: 335px;") + $('#zongDiv').attr("style", "height: 305px;") isContinue = "1"; $('.BOX01').attr("style", "display:none") @@ -668,30 +638,12 @@ } else { $('#BOX2').attr("style", "display:none") - $('#zongDiv').attr("style", "height: 315px;") + $('#zongDiv').attr("style", "height: 285px;") isContinue = "0"; $('.BOX01').attr("style", "display:block"); } $('#BOXCODE2').val(""); - - $('#BOXCODE01').val(""); - $('#BOXCODE02').val(""); - $('#IsLianXu2').attr("checked", false); - isContinue2 = "0"; - }); - - form.on('switch(IsLianXu2)', function (obj) { - if (obj.elem.checked) { - $('.BOX02').attr("style", "display:block") - $('#zongDiv').attr("style", "height: 345px;") - isContinue = "1"; - } else { - $('.BOX02').attr("style", "display:none") - $('#zongDiv').attr("style", "height: 315px;") - isContinue2 = "0"; - } - $('#BOXCODE02').val(""); }); $("#menuImg").click(function (e) { diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs index 05d0bac..b3b186d 100644 --- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs +++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs @@ -1494,18 +1494,19 @@ { throw new Exception("璇锋壂鎻忓绠辨潯鐮�!"); } - string sqlString = string.Empty; - sqlString = "select ASNNo,BoxNo, SkuNo,SkuName, LotNo, Qty from BLLLabelBoxNo where IsDel = '0' "; - sqlString += $"and BoxNo = '{model.BoxNo}' "; + string sqlString = $@"SELECT + ASNNo, + BoxNo, + SkuNo, + SkuName, + LotNo, + SUM(Qty) as Qty + FROM BllBoxInfo + WHERE IsDel = '0' + AND Status='0' + AND BoxNo = '{model.BoxNo}' + GROUP BY ASNNo,BoxNo,SkuNo,SkuName,LotNo; "; var models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString); - if (models == null || models.Count <= 0) - { - sqlString = "select BoxNo, SkuNo,SkuName, LotNo, SUM(Qty) as Qty from BllBoxInfo where IsDel = '0' "; - sqlString += $"and BoxNo = '{model.BoxNo}' and Status='0' "; - sqlString += $"group by BoxNo,SkuNo,SkuName,LotNo; "; - - models = Db.Ado.SqlQuery<BoxInfoDto>(sqlString); - } if (models == null) { throw new Exception("绠辩爜淇℃伅涓嶅瓨鍦�!"); @@ -1554,34 +1555,8 @@ } } - #endregion - // 楠岃瘉鍏ュ簱鍗曟�昏〃 - var notice = Db.Queryable<BllArrivalNotice>().First(m => m.IsDel == "0" && m.ASNNo == model.AsnNo); - if (notice == null) - { - throw new Exception("-1:褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!"); - } - //鍏ュ簱鍗曠被鍨嬶紝0锛氭垚鍝佸叆搴� 1锛氶噰璐叆搴� 2锛氫腑闂村搧鍏ュ簱 3锛氶��璐у叆搴� 4锛氳溅闂翠綑鏂欓��鍥炲叆搴� 5锛氬叾瀹冨叆搴� 6锛氫唬鍌ㄥ叆搴� - if (notice.Type == "0" || notice.Type == "3" || notice.Type == "5" || notice.Type == "6") - { - BindPalletForBox(model, userId, origin); - } - else - { - BindPalletForLabelBox(model, userId); - } - } - catch (Exception ex) - { - throw ex; - } - } - // 缁戝畾鐗╂枡鎵樼洏 - private void BindPalletForBox(PdaPalletBindVm model, int userId, string origin) - { - try - { + Db.BeginTran(); //鎵樼洏鏄惁瀛樺湪 @@ -1689,7 +1664,6 @@ } #region 绠辩爜淇℃伅 - var msgStr = $"绠卞彿涓簕model.BoxNo}"; var boxInfoList = new List<BllBoxInfo>(); //棣栫 @@ -1717,7 +1691,7 @@ #endregion // 鏇存敼绠辨敮鍏崇郴琛� - var factQty = 0;//鎵樼洏鎬绘暟閲� + decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲� var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList(); foreach (var g in boxGroup) { @@ -1768,7 +1742,7 @@ // 鏇存敼鍏ュ簱鍗曟槑缁嗗凡缁勬暟閲� var sqlString = string.Empty; - sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';"; + sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{factQty}' where id = '{model.AsnDetailId}';"; Db.Ado.ExecuteCommand(sqlString); // 鏇存敼鍏ュ簱鍗曞強鍏ュ簱鏄庣粏鐘舵�� @@ -1788,279 +1762,9 @@ new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "浜у搧缁勬墭", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}銆亄msgStr}鐨勭粍鐩樹俊鎭�", userId); Db.CommitTran(); - } catch (Exception ex) { - Db.Ado.RollbackTran(); - throw ex; - } - } - // 缁戝畾鐗╂枡鎵樼洏 - public void BindPalletForLabelBox(PdaPalletBindVm model, int userId) - { - try - { - Db.BeginTran(); - - //鎵樼洏鏄惁瀛樺湪 - var pallet = Db.Queryable<SysPallets>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo); - if (pallet == null) - { - throw new Exception("鏈煡璇㈠埌鎵樼洏淇℃伅锛岃鏍稿疄锛�"); - } - // 楠岃瘉鍏ュ簱鍗曟槑缁嗘槸鍚﹀瓨鍦� - var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo); - if (detail == null) - { - throw new Exception("-1:褰撳墠鐗╂枡鍙婃壒娆′笌鍗曟嵁鏃犲叧鑱旓紝璇锋牳瀹�!"); - } - #region 鍖呰 - var package = Db.Queryable<SysPackag>().Where(m => m.IsDel == "0"); - var sku = Db.Queryable<SysMaterials>().First(m => m.IsDel == "0" && m.SkuNo == detail.SkuNo); - var pack = package.First(m => m.IsDel == "0" && m.PackagNo == sku.PackagNo); - if (pack == null) - { - throw new Exception("-1:鑾峰彇鐗╂枡鍖呰澶辫触锛岃鏍稿疄!"); - } - var pNum = 0;//鎵樼洏鐗╁搧鏁伴噺 - var bNum = 0;//绠辩爜鐗╁搧鏁伴噺 - if (pack.L5Num.HasValue) - { - pNum = (int)pack.L5Num; - bNum = (int)pack.L4Num; - } - else if (pack.L4Num.HasValue) - { - pNum = (int)pack.L4Num; - bNum = (int)pack.L3Num; - } - else if (pack.L3Num.HasValue) - { - pNum = (int)pack.L3Num; - bNum = (int)pack.L2Num; - } - else if (pack.L2Num.HasValue) - { - pNum = (int)pack.L2Num; - bNum = (int)pack.L1Num; - } - else if (pack.L1Num.HasValue) - { - pNum = (int)pack.L1Num; - bNum = (int)pack.L1Num; - } - if (pNum == 0 || bNum == 0) - { - throw new Exception($"缁戝畾澶辫触锛寋detail.SkuNo}鐗╁搧鍖呰鏈壘鍒帮紒"); - } - #region 楠岃瘉鏄惁鍏佽绔嬪簱鍚屾墭鐩樹笉鍚岀墿鏂欏叆搴撴垨鍚屾墭鐩樺悓鐗╂枡涓嶅悓鎵规鍏ュ簱 - var palletBind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNNo == model.AsnNo && m.PalletNo == model.PalletNo && m.ASNDetailNo != model.AsnDetailId); - if (palletBind != null) - { - var box = Db.Queryable<BllBoxInfo>().First(m => m.IsDel == "0" && m.BindNo == palletBind.Id && m.BitBoxMark == "0"); - if (box != null && (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo)) - { - var funSetting = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == "Fun045"); - if (funSetting == null || funSetting.IsEnable == "OFF") - { - throw new Exception($"涓嶅厑璁哥珛搴撳悓鎵樼洏涓嶅悓鐗╂枡鍏ュ簱鎴栧悓鎵樼洏涓嶅悓鎵规鍏ュ簱锛�"); - } - } - } - #endregion - var bind = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.ASNDetailNo == model.AsnDetailId && m.PalletNo == model.PalletNo); - var bindId = 0; - if (bind == null) - { - bind = new BllPalletBind - { - ASNNo = model.AsnNo, - ASNDetailNo = (int)model.AsnDetailId, - PalletNo = model.PalletNo, - PalletNo2 = "", - PalletNo3 = "", - Qty = model.SkuQty, - FullQty = pNum, - Status = "0", - Type = "0", - LotNo = detail.LotNo, - LotText = detail.LotText, - SupplierLot = "", - InspectMark = "0", - BitPalletMark = "1", - IsBale = "0", - IsBelt = "0", - CreateUser = userId - }; - // 鎻掑叆鎵樼洏缁戝畾琛� - bindId = Db.Insertable(bind).ExecuteReturnIdentity(); - } - else - { - if (bind.Status != "0") - { - throw new Exception("-1:褰撳墠鎵樼洏姝e湪鎵ц涓紝缁戝畾澶辫触锛岃鏍稿疄!"); - } - bindId = bind.Id; - } - - #region 绠辩爜淇℃伅 - var boxInfoList = new List<BllLabelBoxNo>(); - var msgStr = $"绠卞彿涓簕model.BoxNo}"; - //棣栫 - var boxInfo = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo && m.Level == "1").ToList(); - if (boxInfo.Count == 0) - { - throw new Exception("-1:绠辩爜淇℃伅涓嶅瓨鍦�!"); - } - //鏄惁杩炵画缁勬墭 - if (model.IsContinue == "1") - { - boxInfoList.AddRange(boxInfo); - //灏剧 - var boxInfo2 = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo && m.Level == "1").ToList(); - if (boxInfo2.Count == 0) - { - throw new Exception("-1:灏剧鐮佷俊鎭笉瀛樺湪!"); - } - boxInfoList.AddRange(boxInfo2); - var sql = $"select * from BllLabelBoxNo where IsDel = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}' and Level='1'; "; - var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList.AddRange(list); - - //鎵惧埌鐩稿叧鐨勪簩绾х爜 - foreach (var item in boxInfoList) - { - sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and ParentBoxNo='{item.BoxNo}' and Level = '2' "; - list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList.AddRange(list); - } - msgStr += $"灏剧鍙蜂负{model.TailBoxNo}"; - } - else - { - var boxInfoList2 = new List<BllLabelBoxNo>();//鎵�鏈変簩绾х爜 - decimal boxQty = 0.00m;//绠卞唴浜岀骇鐮佹暟閲� - if (!string.IsNullOrEmpty(model.BoxNo01)) - { - //浜岀骇鐮侀鐮� - var box01Info = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.BoxNo01 && m.IsUse == "0" && m.Level == "2" && (string.IsNullOrEmpty(m.ParentBoxNo) || m.ParentBoxNo == model.BoxNo)).ToList(); - if (box01Info.Count == 0) - { - throw new Exception("-1:浜岀骇鐮侀鐮佷俊鎭笉瀛樺湪!"); - } - boxInfoList2.AddRange(box01Info); - if (model.IsContinue2 == "1") - { - //浜岀骇鐮佸熬鐮� - var box01Info2 = Db.Queryable<BllLabelBoxNo>().Where(m => m.IsDel == "0" && m.BoxNo == model.TailBoxNo01 && m.IsUse == "0" && m.Level == "2" && (string.IsNullOrEmpty(m.ParentBoxNo) || m.ParentBoxNo == model.BoxNo)).ToList(); - if (box01Info2.Count == 0) - { - throw new Exception("-1:浜岀骇鐮佸熬鐮佷俊鎭笉瀛樺湪!"); - } - boxInfoList2.AddRange(box01Info2); - //涓棿鐮� - var sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and boxNo>'{model.BoxNo}' and boxNo<'{model.TailBoxNo}' and Level='2' and (ParentBoxNo='' || ParentBoxNo='{model.BoxNo}'); "; - var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList2.AddRange(list); - } - foreach (var item in boxInfoList2) - { - item.ParentBoxNo = model.BoxNo; - boxQty += item.Qty; - } - boxInfoList.AddRange(boxInfoList2); - foreach (var item in boxInfo) - { - item.Qty += boxQty; - } - } - else - { - //鎵惧埌鐩稿叧鐨勪簩绾х爜 - foreach (var item in boxInfo) - { - string sql = $"select * from BllLabelBoxNo where IsDel = '0' and IsUse = '0' and ParentBoxNo='{item.BoxNo}' and Level = '2' "; - var list = Db.Ado.SqlQuery<BllLabelBoxNo>(sql); - boxInfoList.AddRange(list); - } - } - boxInfoList.AddRange(boxInfo); - } - #endregion - - #endregion - // 鏇存敼绠辨敮鍏崇郴琛� - decimal factQty = 0.00m;//鎵樼洏鎬绘暟閲� - foreach (var box in boxInfoList) - { - //绠卞唴鐗╂枡鎵规涓庡崟鎹槑缁嗕笉绗﹀悎 - if (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo) - { - throw new Exception($"-1:{box.BoxNo}绠卞唴鐗╂枡鍙婃壒娆′笌鍗曟嵁涓嶄竴鑷达紝璇锋牳瀹�!"); - } - if (box.IsUse != "0") - { - continue; - } - if (box.Level == "1") - { - if (box.Qty > bNum) - { - throw new Exception($"缁戝畾澶辫触锛寋box.BoxNo}绠辩爜缁戝畾鏁伴噺澶т簬璇ョ墿鍝佸寘瑁呮暟閲忥紒"); - } - factQty += box.Qty; - } - //box.ASNNo = model.AsnNo; - //box.ASNDetailNo = model.AsnDetailId; - box.IsUse = "1"; - box.CompleteTime = DateTime.Now; - box.UpdateTime = DateTime.Now; - box.UpdateUser = userId; - } - Db.Updateable(boxInfoList).ExecuteCommand(); - - // 鏇存柊鎵樼洏缁戝畾琛� - bind.Qty += factQty; - if (bind.FullQty < bind.Qty) - { - throw new Exception("鎵樼洏缁戝畾鏁伴噺宸茶秴鍑鸿鐗╂枡鍖呰鏁伴噺"); - } - - if (bind.FullQty == bind.Qty) - { - bind.BitPalletMark = "0"; - } - Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand(); - - // 鏇存敼鍏ュ簱鍗曟槑缁嗗凡缁勬暟閲� - var sqlString = string.Empty; - sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';"; - Db.Ado.ExecuteCommand(sqlString); - - // 鏇存敼鍏ュ簱鍗曞強鍏ュ簱鏄庣粏鐘舵�� - if (detail.Status == "0") - { - var sqlString2 = string.Empty; - sqlString2 += $"update BllArrivalNotice set Status = '1',CompleteTime= getDate() where ASNNo = '{model.AsnNo}' and Status ='0';"; - sqlString2 += $"update BllArrivalNoticeDetail set Status = '1',CompleteTime= getDate() where id = '{model.AsnDetailId}' and Status ='0';"; - Db.Ado.ExecuteCommand(sqlString2); - } - - // 鏇存敼鎵樼洏浣跨敤鐘舵�� - var sqlStr = $"update SysPallets set Status = '1' where PalletNo = '{model.PalletNo}';"; - //娣诲姞鎵樼洏璁板綍琛ㄦ暟鎹� - sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','缁勭洏','0',getDate(),{userId},NULL,NULL);"; - Db.Ado.ExecuteCommand(sqlStr); - new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "浜у搧缁勬墭", model.AsnNo, "娣诲姞", $"娣诲姞浜嗘墭鐩樼爜涓猴細{model.PalletNo}銆亄msgStr}鐨勭粍鐩樹俊鎭�", userId); - - Db.CommitTran(); - - } - catch (Exception ex) - { - Db.Ado.RollbackTran(); throw ex; } } -- Gitblit v1.8.0