From 6adff8858994ce0f2dabc74166c99c8879ea950d Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 11 Jul 2023 17:09:43 +0800 Subject: [PATCH] 1 --- WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 2c4b2875..ea6d7166 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -256,14 +256,16 @@ namespace Tnb.WarehouseMgr List instockcodes = input.instockcodes.Adapt>(); var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.instock.location_code); + var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.instock.carry_code); //如果数据不全, - if ((instock?.carry_id.IsNullOrWhiteSpace() ?? true) || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1) + if (carry.IsNull() || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1) { //报错, 提示数据不全。 throw new AppFriendlyException("数据不全!", 500); } // 生成入库申请数据,添加其他数据 主表 instock.id = SnowflakeIdHelper.NextId(); + instock.carry_id = carry.id; instock.location_id = loc.id; instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID; instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult(); @@ -310,14 +312,14 @@ namespace Tnb.WarehouseMgr var orgId = _userManager.User.OrganizeId; await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); - //生成预任务申请 //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock.warehouse_id, Size = 1 }; + var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock?.warehouse_id!, Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = await _db.Queryable().FirstAsync(it => it.location_id == instock.location_id); WmsPointH ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); + if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); @@ -380,8 +382,8 @@ namespace Tnb.WarehouseMgr { var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = instock.id; - preTaskUpInput.CarryId = instock.carry_id!; + preTaskUpInput.RquireId = instock?.id; + preTaskUpInput.CarryId = instock?.carry_id!; preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()?.location_id; preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()?.location_code; preTaskUpInput.LocationIds = (points?.Select(x => x.location_id)?.ToList() ?? Enumerable.Empty().ToList()) as List;