From 9984bb1eb673f4ea6d952e191040a674583d2f20 Mon Sep 17 00:00:00 2001 From: YangYuGang <1378265336@qq.com> Date: 星期五, 21 三月 2025 15:53:52 +0800 Subject: [PATCH] 添加声音 --- Tiger.Business.WMS/Transaction/ReprintLabel.cs | 106 +++++++++++++++++++++++++++++----------------------- 1 files changed, 59 insertions(+), 47 deletions(-) diff --git a/Tiger.Business.WMS/Transaction/ReprintLabel.cs b/Tiger.Business.WMS/Transaction/ReprintLabel.cs index 8ec081f..143253e 100644 --- a/Tiger.Business.WMS/Transaction/ReprintLabel.cs +++ b/Tiger.Business.WMS/Transaction/ReprintLabel.cs @@ -15,6 +15,7 @@ using Tiger.IBusiness; using Tiger.Model.MES.Yada; using Apache.NMS.ActiveMQ.Commands; +using System.Diagnostics; namespace Tiger.Business.WMS.Transaction { @@ -58,7 +59,8 @@ action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.SnEmptyFailure"); return SetOutPutMqttMsg(action, input.Locale); } - var LotNos = Biz.DataSource["YadaU9C"].Client.Queryable<mes_WhLotCodeQtyInfo>().Where(t => t.Bin == input.SN).ToList(); + var LotNos = Biz.DataSource["YadaU9C"].Client.Ado.SqlQuery<mes_WhLotCodeQtyInfo>($"select *,'' as ID from mes_WhLotCodeQtyInfo where Bin = '{input.SN}'"); + //Biz.DataSource["YadaU9C"].Client.Queryable<mes_WhLotCodeQtyInfo>().Where(t => t.Bin == input.SN).ToList(); CurScanShelf = new ScanShelfInfo(); // 鏌ヨ璐ф灦淇℃伅 var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); @@ -91,6 +93,12 @@ CurScanShelf.IsSmartRack = false; LocationCode = whUnit.LOCATION_CODE; } + else { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L("璇疯緭鍏ユ垨鎵弿鏈夋晥鐨勮揣鏋�/鍌ㄤ綅鐮�"); + action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); + return action; + } var temps = new List<TemplateInput>(); foreach (var item in LotNos) { @@ -106,7 +114,12 @@ }; temps.Add(temp); } - Biz.Db.Storageable(LotNos, UserCode).ExecuteCommand(); + + var y = Biz.Db.Storageable(LotNos, UserCode) + .WhereColumns(t => new { t.ItemCode, t.LotCode }) + .ToStorage(); + y.AsInsertable.ExecuteCommand(); + y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); action.Data.Data = temps; action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.ScanSuccessed"); } @@ -137,11 +150,11 @@ } else { - if (Biz.Db.Queryable<WMS_ITEM>().Any(q=>q.SUPP_LOTNO == rePrints.BatchNo) && (Biz.Db.Queryable<WMS_ITEM>().Where(q=>q.SUPP_LOTNO == rePrints.BatchNo).Sum(x=>x.QTY)>= rePrints.BatchQty)) { - action.IsSuccessed = false; - action.LocaleMsg = Biz.L($"姝ゅ簱浣峓{LocationCode}]涓婄殑鎵规[{rePrints.BatchNo}]鏁伴噺宸茬粡澶熸暟锛屼笉鑳藉啀涓婃灦鐢熸垚鏍囩"); - return action; - } + //if (Biz.Db.Queryable<WMS_ITEM>().Any(q=>q.SUPP_LOTNO == rePrints.BatchNo) && (Biz.Db.Queryable<WMS_ITEM>().Where(q=>q.SUPP_LOTNO == rePrints.BatchNo && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()).Sum(x=>x.QTY)>= rePrints.BatchQty)) { + // action.IsSuccessed = false; + // action.LocaleMsg = Biz.L($"姝ゅ簱浣峓{LocationCode}]涓婄殑鎵规[{rePrints.BatchNo}]鏁伴噺宸茬粡澶熸暟锛屼笉鑳藉啀涓婃灦鐢熸垚鏍囩"); + // return action; + //} foreach (var ent in rePrints.SnList) { string CurSN = DI.Resolve<ICodeRuleCache>()["InitialBarcode"]?.Generate($"{ent.SN}").Data.ToString() ?? ""; @@ -186,7 +199,7 @@ ITEM_CODE = inv.Barcode.ItemCode, AUTH_ORG = input.AuthOption.CurOrg, STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(), - QTY = inv.Barcode.Qty.ToDecimal(), + QTY = inv.Barcode.Qty.ToDouble(), PROD_DATE = inv.Barcode.DateCode.ToDateTime(), ERP_WH = CurScanShelf.WarehouseCode, UNIT = inv.Barcode.Unit, @@ -199,7 +212,7 @@ SN = inv.Barcode.SN, AUTH_ORG = input.AuthOption.CurOrg, ITEM_CODE = inv.Barcode.ItemCode, - QTY = inv.Barcode.Qty.ToDecimal(), + QTY = inv.Barcode.Qty.ToDouble(), ERP_WH = CurScanShelf.WarehouseCode, UNIT = inv.Barcode.Unit, }; @@ -222,11 +235,11 @@ } else if (inv.Items.Count == 1) { - inv.Items.First().QTY = inv.Barcode.Qty.ToDecimal(); + inv.Items.First().QTY = inv.Barcode.Qty.ToDouble(); inv.Items.First().ERP_WH = CurScanShelf.WarehouseCode; inv.Items.First().AUTH_ORG = input.AuthOption.CurOrg; - inv.Packages.First().QTY = inv.Barcode.Qty.ToDecimal(); + inv.Packages.First().QTY = inv.Barcode.Qty.ToDouble(); inv.Packages.First().ERP_WH = CurScanShelf.WarehouseCode; inv.Packages.First().AUTH_ORG = input.AuthOption.CurOrg; } @@ -276,45 +289,44 @@ //} //鎵ц涓婃灦 - foreach (var item in inv.Items) - { - item.TRANS_CODE = "ReprintLabel"; - item.TRANS_NO = $"ReprintLabel{DateTime.Now:yyyyMMdd}"; - } - Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE); - if (!putonResult.IsSuccessed) - { - action.IsSuccessed = false; - action.LocaleMsg = putonResult.LocaleMsg; - inv = null; - CurSN = ""; - return action; - } - PutOnInfo putOnInfo = putonResult.Data; - items.AddRange(putOnInfo.Items); - itemhiss.AddRange(putOnInfo.History); - itemPkgs.AddRange(putOnInfo.Packages); - itemExts.AddRange(putOnInfo.ItemsExt); + //foreach (var item in inv.Items) + //{ + // item.TRANS_CODE = "ReprintLabel"; + // item.TRANS_NO = $"ReprintLabel{DateTime.Now:yyyyMMdd}"; + //} + //Result<PutOnInfo> putonResult = WMS_ITEM_Biz.WmsItem.PutOn(inv, input.AuthOption, nLocation.LOCATION_CODE); + //if (!putonResult.IsSuccessed) + //{ + // action.IsSuccessed = false; + // action.LocaleMsg = putonResult.LocaleMsg; + // inv = null; + // CurSN = ""; + // return action; + //} + //PutOnInfo putOnInfo = putonResult.Data; + //items.AddRange(putOnInfo.Items); + //itemhiss.AddRange(putOnInfo.History); + //itemPkgs.AddRange(putOnInfo.Packages); + //itemExts.AddRange(putOnInfo.ItemsExt); } //淇濆瓨鍒版暟鎹簱 - var db = Business.Biz.Db; - var dbTran = db.UseTran(() => - { - //鍏ュ簱 - db.Storageable(items, UserCode).ExecuteCommand(); - db.Storageable(itemPkgs, UserCode).ExecuteCommand(); - db.Insertable(itemhiss, UserCode).ExecuteCommand(); - var x = db.Storageable(itemExts, UserCode).ToStorage(); - x.AsInsertable.ExecuteCommand();//涓嶅瓨鍦ㄦ彃鍏� - x.AsUpdateable.ExecuteCommand();//瀛樺湪鏇存柊 - }); - if (!dbTran.IsSuccess) - { - Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception"); - throw dbTran.ErrorException; - } + //var db = Business.Biz.Db; + //var dbTran = db.UseTran(() => + //{ + // //鍏ュ簱 + // db.Storageable(items, UserCode).ExecuteCommand(); + // db.Storageable(itemPkgs, UserCode).ExecuteCommand(); + // db.Insertable(itemhiss, UserCode).ExecuteCommand(); + // var x = db.Storageable(itemExts, UserCode).ToStorage(); + // x.AsInsertable.ExecuteCommand();//涓嶅瓨鍦ㄦ彃鍏� + // x.AsUpdateable.ExecuteCommand();//瀛樺湪鏇存柊 + //}); + //if (!dbTran.IsSuccess) + //{ + // Logger.Default.Fatal(dbTran.ErrorException, "Database transaction save exception"); + // throw dbTran.ErrorException; + //} - LocationCode = ""; action.Data.Data = rePrints; action.LocaleMsg = Biz.L("搴撲綅鎵规鏉$爜涓婃灦鎴愬姛"); } -- Gitblit v1.9.3