Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2023-11-09 16:00:12 +08:00
5 changed files with 32 additions and 18 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

@@ -252,9 +252,10 @@ namespace Tnb.WarehouseMgr
//获取所有未下发的预任务申请
List<WmsPretaskH> preTasks = await db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
.InnerJoin<WmsAreaH>((a, b, c) => a.area_id == c.id)
.InnerJoin<BasLocation>((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0")
.Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id))
.OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code })
.Select((a, b, c) => new WmsPretaskH
.Select((a, b, c, d) => new WmsPretaskH
{
move_num = c.move_num,
third_eqp_type = c.third_eqp_type,
@@ -267,7 +268,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 +293,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;
@@ -921,6 +925,10 @@ namespace Tnb.WarehouseMgr
Expression<Func<WmsCarryH, bool>> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId;
_ = await _db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync();
}
if (input.CarryStartLocationId.IsNullOrWhiteSpace() == false)
{
_ = await _db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
}
//根据所有库位更新库位的锁定状态为“锁定”
if (setLocaionColumbExp != null && input.LocationIds?.Count > 0)
{
@@ -948,7 +956,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 +965,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

@@ -466,7 +466,7 @@ namespace Tnb.WarehouseMgr
_ = await _db.Insertable(carryCodes).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.).ToString() });
it => new BasLocation { is_lock = 1 });
if (instockCOdes?.Count > 0)
{
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();

View File

@@ -264,7 +264,7 @@ namespace Tnb.WarehouseMgr
// 更新临时条码表 状态is_end
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = ((int)EnumCarryStatus.).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, source_id = input.data[nameof(WmsOutstockH.source_id)].ToString(), source_code = input.data[nameof(WmsOutstockH.source_code)].ToString() },
it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.).ToString() });
it => new BasLocation { is_lock = 1 });
if (instockCOdes?.Count > 0)
{
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();

View File

@@ -308,7 +308,7 @@ namespace Tnb.WarehouseMgr
//回更状态
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.).ToString() });
it => new BasLocation { is_lock = 1 });
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync();
_ = await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
@@ -322,6 +322,10 @@ namespace Tnb.WarehouseMgr
await _db.Ado.RollbackTranAsync();
throw;
}
finally
{
_ = InvokeGenPretaskExcute();
}
return Task.FromResult(true);
}
}