From fd7b2deaaded8b6c56b082e9d64fed008e685c25 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 29 Jun 2023 09:22:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93=E7=94=B3=E8=AF=B7=EF=BC=8C?= =?UTF-8?q?=E5=9B=9E=E6=9B=B4=E8=BD=BD=E5=85=B7=E6=9D=A1=E7=A0=81=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index bb11970a..bde47097 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -338,7 +338,8 @@ namespace Tnb.WarehouseMgr await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); //如果是自动单据,需要回更上层系统 } - else { + else + { //如果没有完成,修改为工作中 await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); } @@ -411,11 +412,15 @@ namespace Tnb.WarehouseMgr } if (dicUpdate.Count > 0) { + //var dicCarryCodes = carryCodes.FindAll(x => dicUpdate.Keys.Contains(x.barcode)).GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.FirstOrDefault()); foreach (var pair in dicUpdate) { - WmsCarryCode carryCode = new(); - carryCode.codeqty = pair.Value; - await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).Where(it => it.barcode == pair.Key).ExecuteCommandAsync(); + WmsCarryCode carryCode = carryCodes.Find(x => x.barcode == pair.Key); + if (carryCode != null) + { + carryCode.codeqty = pair.Value; + await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).ExecuteCommandAsync(); + } } await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync(); await _db.Deleteable().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();