入库业务增加库位与载具规格关联的限制
This commit is contained in:
@@ -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<WmsCarryH>().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString());
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == endLocations[0].id);
|
||||
var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc);
|
||||
if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500);
|
||||
ePoint = await _db.Queryable<WmsPointH>().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<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
|
||||
var loc = await _db.Queryable<BasLocation>().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<WmsEmptyInstock>().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<string>();
|
||||
var dic = new Dictionary<string, object>();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user