调整预任务生成代码逻辑

This commit is contained in:
yang.lee
2023-11-09 15:20:27 +08:00
parent d757785f0b
commit 00c11a4515
3 changed files with 23 additions and 14 deletions

View File

@@ -184,7 +184,7 @@ public class ModuleConsts
public const string MODULE_WMSPOINT_ID = "26099196480805";
/// <summary>
/// 模块标识-PDA寄存出
/// 模块标识-PDA扫码入
/// </summary>
public const string MODULE_WMSSCANCODEINSTOCKPDA_ID = "28576495374869";
/// <summary>

View File

@@ -267,7 +267,8 @@ namespace Tnb.WarehouseMgr
preTasks = preTasks.Where(it => !agvElevatorTasks.Select(x => x.endlocation_code).Contains(it.endlocation_code)).ToList();
IEnumerable<WmsPretaskH?> firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault());
agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code));
//agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code)).DistinctBy(x=>x.endlocation_code).ToList();
agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty<WmsPretaskH?>().ToList();
preTasks = preTasks.Concat(agvElevatorTasks).ToList();
@@ -291,24 +292,26 @@ namespace Tnb.WarehouseMgr
int itemsCount = items.Count;
int mod = itemsCount % moveNum > 0 ? (itemsCount / moveNum) + 1 : itemsCount / moveNum;
WmsDistaskH[] arrary = items.ToArray();
for (int i = 1; i <= mod; i++)
//for (int i = 1; i <= mod; i++)
{
string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
if (moveNum >= 1)
{
List<WmsPretaskH> areaPreTasks = itGroup.ToList();
if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1) || areaPreTasks.Any(x => x.third_eqp_type.ToEnum<EnumTaskChainType>() != EnumTaskChainType.CTU))
if ( areaPreTasks.Any(x => x.third_eqp_type.ToEnum<EnumTaskChainType>() != EnumTaskChainType.CTU))
{
items.ForEach(x =>
foreach (var x in items)
{
string groupCode = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).Result;
x.is_chain = 0;
});
items[0].groups = groupCode;
items[0].bill_code = $"{groupCode}-1";
x.groups = groupCode;
x.bill_code = $"{groupCode}-1";
}
}
else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
{
string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
items.ForEach(x => x.is_chain = 1);
int start = 0;
@@ -948,7 +951,7 @@ namespace Tnb.WarehouseMgr
List<WmsPointH> points = await LocPathCalcAlgorithms(pStartId, pEndId, roads);
try
{
if (points.FindAll(x => x.location_code != null && x.location_code.Contains("ELE"))?.Count > 0)
if (points.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0)
{
//查询当前电梯点
List<WmsElevatorD> curEleDs = await _db.Queryable<WmsElevatorD>().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync();
@@ -957,14 +960,16 @@ namespace Tnb.WarehouseMgr
{
//当前电梯
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1);
if (curEle == null)
//同电梯组电梯
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
if (curEle == null && sGpEle?.Count > 0)
{
throw new AppFriendlyException("电梯被禁用或未配置", 500);
}
//同电梯组电梯
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
//判断电梯组中各电梯任务数
if (sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
if (curEle == null || sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
{
List<WmsElevatorD> sGpDs = await _db.Queryable<WmsElevatorD>().Where(it => it.bill_id == sGpEle.First().id).ToListAsync();
if (sGpDs?.Count > 0)

View File

@@ -322,6 +322,10 @@ namespace Tnb.WarehouseMgr
await _db.Ado.RollbackTranAsync();
throw;
}
finally
{
_ = InvokeGenPretaskExcute();
}
return Task.FromResult(true);
}
}