This commit is contained in:
alex
2023-07-18 11:22:01 +08:00
8 changed files with 58 additions and 22 deletions

View File

@@ -66,8 +66,6 @@ namespace Tnb.WarehouseMgr
{ {
await _db.Ado.BeginTranAsync(); 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 inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
@@ -79,9 +77,18 @@ namespace Tnb.WarehouseMgr
} }
if (endLocations?.Count > 0) 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); ePoint = await _db.Queryable<WmsPointH>().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) if (sPoint != null && ePoint != null)
{ {
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);

View File

@@ -68,8 +68,6 @@ namespace Tnb.WarehouseMgr
{ {
await _db.Ado.BeginTranAsync(); 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 inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
@@ -81,9 +79,17 @@ namespace Tnb.WarehouseMgr
} }
if (endLocations?.Count > 0) 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); 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) if (sPoint != null && ePoint != null)
{ {
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
@@ -180,19 +186,21 @@ namespace Tnb.WarehouseMgr
try try
{ {
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code); 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); var emptyInstock = await _db.Queryable<WmsEmptyInstock>().FirstAsync(it => it.carry_code == input.carry_code && it.status == WmsWareHouseConst.BILLSTATUS_ADD_ID);
if (emptyInstock != null) 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 cols = new List<string>();
var dic = new Dictionary<string, object>(); var dic = new Dictionary<string, object>();
dic[nameof(WmsEmptyInstock.id)] = SnowflakeIdHelper.NextId(); dic[nameof(WmsEmptyInstock.id)] = SnowflakeIdHelper.NextId();
dic[nameof(WmsEmptyInstock.org_id)] = input.org_id ?? _userManager.User.OrganizeId; 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.bill_code)] = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYINSTK_ENCODE);
dic[nameof(WmsEmptyInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID; dic[nameof(WmsEmptyInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
dic[nameof(WmsEmptyInstock.carry_id)] = carry.id; dic[nameof(WmsEmptyInstock.carry_id)] = carry.id;

View File

@@ -272,6 +272,8 @@ namespace Tnb.WarehouseMgr
var loc = await _db.Queryable<BasLocation>().FirstAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType..ToString()); var loc = await _db.Queryable<BasLocation>().FirstAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType..ToString());
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.instock.carry_code); var carry = await _db.Queryable<WmsCarryH>().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) if (carry.IsNull() || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1)
{ {

View File

@@ -67,8 +67,6 @@ namespace Tnb.WarehouseMgr
{ {
await _db.Ado.BeginTranAsync(); 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 inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
@@ -80,9 +78,16 @@ namespace Tnb.WarehouseMgr
} }
if (endLocations?.Count > 0) 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); ePoint = await _db.Queryable<WmsPointH>().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) if (sPoint != null && ePoint != null)
{ {
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);

View File

@@ -66,22 +66,27 @@ namespace Tnb.WarehouseMgr
{ {
await _db.Ado.BeginTranAsync(); 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 inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
WmsPointH? sPoint = null; WmsPointH sPoint = null!;
WmsPointH? ePoint = null; WmsPointH ePoint = null!;
if (input.data.ContainsKey(nameof(WmsPointH.location_id))) if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
{ {
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
} }
if (endLocations?.Count > 0) 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); ePoint = await _db.Queryable<WmsPointH>().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) if (sPoint != null && ePoint != null)
{ {
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);

View File

@@ -65,9 +65,7 @@ namespace Tnb.WarehouseMgr
{ {
await _db.Ado.BeginTranAsync(); 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 inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
WmsPointH sPoint = null!; WmsPointH sPoint = null!;
@@ -78,9 +76,16 @@ namespace Tnb.WarehouseMgr
} }
if (endLocations?.Count > 0) 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); ePoint = await _db.Queryable<WmsPointH>().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) if (sPoint != null && ePoint != null)
{ {
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);

View File

@@ -80,6 +80,10 @@ namespace Tnb.WarehouseMgr
} }
if (endLocations?.Count > 0) 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); ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
} }

View File

@@ -246,14 +246,14 @@ namespace Tnb.WarehouseMgr
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId); var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
var kods = await _db.Queryable<WmsKittingoutD>().Where(it => it.bill_id == input.requireId).ToListAsync(); var kods = await _db.Queryable<WmsKittingoutD>().Where(it => it.bill_id == input.requireId).ToListAsync();
//载具为料架时,取所有料箱的条码 //载具为料架时,取所有料箱的条码
List<string> carryMIds = new(); List<string> mCarryIds = new();
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID) if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
{ {
var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carryId).ToListAsync(); var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carryId).ToListAsync();
carryMIds = carryDs.Select(x => x.membercarry_id).ToList(); mCarryIds = carryDs.Select(x => x.membercarry_id).ToList();
} }
//当前载具对应的所有条码插入 //当前载具对应的所有条码插入
Expression<Func<WmsCarryCode, bool>> whereExp = carryMIds?.Count > 0 ? a => carryMIds.Contains(a.carry_id) : a => a.carry_id == carryId; Expression<Func<WmsCarryCode, bool>> whereExp = mCarryIds?.Count > 0 ? a => mCarryIds.Contains(a.carry_id) : a => a.carry_id == carryId;
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(whereExp).ToListAsync(); var carryCodes = await _db.Queryable<WmsCarryCode>().Where(whereExp).ToListAsync();
var kittingoutCodes = carryCodes.Adapt<List<WmsKittingoutCode>>(); var kittingoutCodes = carryCodes.Adapt<List<WmsKittingoutCode>>();
@@ -298,9 +298,9 @@ namespace Tnb.WarehouseMgr
// isOk = row > 0; // isOk = row > 0;
//} //}
//判断当前载具是否为料架,如果是料架 清空所有料架/料箱数据, //判断当前载具是否为料架,如果是料架 清空所有料架/料箱数据,
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && carryMIds?.Count > 0) if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIds?.Count > 0)
{ {
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryMIds.Contains(it.id)).ToListAsync(); var carrys = await _db.Queryable<WmsCarryH>().Where(it => mCarryIds.Contains(it.id)).ToListAsync();
carrys.Add(carry); carrys.Add(carry);
if (carrys?.Count > 0) if (carrys?.Count > 0)
{ {