diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index cb4b50e4..010e52b9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -121,7 +121,7 @@ namespace Tnb.WarehouseMgr x.bill_d_id = instockD.id; }); } - return await _update(instockD, stockCodes!); + return await Update(instockD, stockCodes!); } var isOk = input.inoutStockType switch @@ -723,7 +723,7 @@ namespace Tnb.WarehouseMgr } } - private async Task _update(T1 entity, List entities) where T1 : BaseEntity, new() where T2 : BaseEntity, new() + private async Task Update(T1 entity, List entities) where T1 : BaseEntity, new() where T2 : BaseEntity, new() { var isOk = false; try diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 80a51fb0..2c4b2875 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -254,14 +254,17 @@ namespace Tnb.WarehouseMgr List instockds = input.instockds.Adapt>(); //入库申请条码明细表 List instockcodes = input.instockcodes.Adapt>(); + + var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.instock.location_code); //如果数据不全, - if ((instock?.carry_id.IsNullOrWhiteSpace() ?? true) || (instock?.location_id.IsNullOrWhiteSpace() ?? true) || instockds?.Count < 1 || instockcodes?.Count < 1) + if ((instock?.carry_id.IsNullOrWhiteSpace() ?? true) || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1) { //报错, 提示数据不全。 throw new AppFriendlyException("数据不全!", 500); } // 生成入库申请数据,添加其他数据 主表 instock.id = SnowflakeIdHelper.NextId(); + instock.location_id = loc.id; instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID; instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult(); instock.generate_type = "1";// 自动 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 3b5969ca..01c2911f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -296,14 +296,17 @@ namespace Tnb.WarehouseMgr WmsOutstockH outstock = input.outstock.Adapt(); //出库申请明细表 List outstockDs = input.outstockDs.Adapt>(); + + var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.outstock.location_code); //如果数据不全, - if ((outstock?.location_id.IsNullOrWhiteSpace() ?? true) || outstockDs?.Count < 1) + if (loc.IsNull() || outstockDs?.Count < 1) { //报错, 提示数据不全。 throw new AppFriendlyException("数据不全!", 500); } // 生成入库申请数据,添加其他数据 主表 outstock.id = SnowflakeIdHelper.NextId(); + outstock.location_id = loc.id; outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID; outstock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_OUTSTOCK_ENCODE).GetAwaiter().GetResult(); outstock.generate_type = "1";// 自动 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index d48c1ac6..e739e14f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -135,12 +135,12 @@ namespace Tnb.WarehouseMgr { var leftCarrys = carrys[..6]; var rightCarrys = carrys[6..]; - await _genPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks); - await _genPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks); + await InnerGenPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks); + await InnerGenPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks); } else { - await _genPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks); + await InnerGenPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks); } List pretaskCodes = new(); foreach (var pt in preTasks) @@ -175,7 +175,7 @@ namespace Tnb.WarehouseMgr } } - private async Task _genPreTask(WmsCarryH[] carrys, List locIds, string eLocationId, string requireId, string requireCode, List preTasks) + private async Task InnerGenPreTask(WmsCarryH[] carrys, List locIds, string eLocationId, string requireId, string requireCode, List preTasks) { var loc = await _db.Queryable().SingleAsync(it => it.id == eLocationId); foreach (var carry in carrys)