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();