From 0daf7fe6632ebeed7515c089e3617f8487b691af Mon Sep 17 00:00:00 2001 From: FanLian Date: Tue, 18 Jul 2023 11:17:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E4=B8=9A=E5=8A=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BA=93=E4=BD=8D=E4=B8=8E=E8=BD=BD=E5=85=B7=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E5=85=B3=E8=81=94=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WmsCarryMoveInStockService.cs | 11 ++++++++-- .../WmsEmptyInstockService.cs | 20 +++++++++++++------ .../Tnb.WarehouseMgr/WmsInStockService.cs | 2 ++ .../WmsKittingInStkService.cs | 9 +++++++-- .../WmsPDACarryMoveInStockService.cs | 13 ++++++++---- .../WmsPDAEmptyInstockService.cs | 11 +++++++--- .../Tnb.WarehouseMgr/WmsPDAInbaleService.cs | 4 ++++ 7 files changed, 53 insertions(+), 17 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs index 93da5a11..eb71689f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs @@ -66,8 +66,6 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID, true); - await _runService.Create(templateEntity, input); //入库取终点 //出库起点 var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); @@ -79,9 +77,18 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { + var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } + + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID, true); + await _runService.Create(templateEntity, input); + + if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs index 1af501e8..0909866f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs @@ -68,8 +68,6 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID, true); - await _runService.Create(templateEntity, input); //入库取终点 var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); @@ -81,8 +79,16 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { + var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } + + //在线开发 + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYINSTOCK_ID, true); + await _runService.Create(templateEntity, input); if (sPoint != null && ePoint != null) { @@ -180,19 +186,21 @@ namespace Tnb.WarehouseMgr try { var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); - var location = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code); + var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); var emptyInstock = await _db.Queryable().FirstAsync(it => it.carry_code == input.carry_code && it.status == WmsWareHouseConst.BILLSTATUS_ADD_ID); if (emptyInstock != null) { - return ToApiResult(HttpStatusCode.InternalServerError, $"空载具{emptyInstock.carry_code},预任务已生成"); + return isSuccessful; } - if (carry != null && location != null) + if (carry != null && loc != null) { var cols = new List(); var dic = new Dictionary(); dic[nameof(WmsEmptyInstock.id)] = SnowflakeIdHelper.NextId(); dic[nameof(WmsEmptyInstock.org_id)] = input.org_id ?? _userManager.User.OrganizeId; - dic[nameof(WmsEmptyInstock.location_id)] = location.id; + dic[nameof(WmsEmptyInstock.location_id)] = loc.id; dic[nameof(WmsEmptyInstock.bill_code)] = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYINSTK_ENCODE); dic[nameof(WmsEmptyInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID; dic[nameof(WmsEmptyInstock.carry_id)] = carry.id; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index e0b3ecb9..2915a375 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -272,6 +272,8 @@ namespace Tnb.WarehouseMgr var loc = await _db.Queryable().FirstAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType.存储库位.ToString()); var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.instock.carry_code); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); //如果数据不全或有误, if (carry.IsNull() || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs index 7ad379ee..0a37f8c1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs @@ -67,8 +67,6 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSKITTINGINSTK_ID, true); - await _runService.Create(templateEntity, input); //入库取终点 //出库起点 var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); @@ -80,9 +78,16 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { + var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSKITTINGINSTK_ID, true); + await _runService.Create(templateEntity, input); + if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs index 6b87d88e..d89d3c80 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs @@ -66,22 +66,27 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); - await _runService.Create(templateEntity, input); //入库取终点 //出库起点 var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); - WmsPointH? sPoint = null; - WmsPointH? ePoint = null; + WmsPointH sPoint = null!; + WmsPointH ePoint = null!; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) { sPoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); } if (endLocations?.Count > 0) { + var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); + await _runService.Create(templateEntity, input); + if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs index 051aa9d9..ad2de004 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs @@ -65,9 +65,7 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYINSTKPDA_ID, true); - await _runService.Create(templateEntity, input); - //入库取终点 + //入库取终点 //出库起点 var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = null!; @@ -78,9 +76,16 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { + var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYINSTKPDA_ID, true); + await _runService.Create(templateEntity, input); + if (sPoint != null && ePoint != null) { var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs index 7322f013..6e4c6ca2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs @@ -80,6 +80,10 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { + var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); }