库位导入功能代码调整

This commit is contained in:
yang.lee
2023-12-11 15:06:43 +08:00
parent d61989417f
commit 5fde13ece9
3 changed files with 12 additions and 3 deletions

View File

@@ -125,5 +125,5 @@ public partial class BasLocation : BaseEntity<string>
/// <summary>
/// 是否超配(1不超配 2超配)
/// </summary>
public string is_overmatch { get; set; } = 1;
public string is_overmatch { get; set; } = "1";
}

View File

@@ -127,6 +127,7 @@ namespace Tnb.WarehouseMgr
l.modify_time = null;
l.is_mix = 1;
l.is_use = "0";
l.is_overmatch = "1";
}
if (locs.Count > 1000)

View File

@@ -259,7 +259,7 @@ 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))
.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, d) => new WmsPretaskH
{
@@ -268,19 +268,27 @@ namespace Tnb.WarehouseMgr
}, true)
.ToListAsync();
List<WmsPretaskH> executedPreTasks = await db.Queryable<WmsPretaskH>().Where(it => it.status != WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && it.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID).ToListAsync();
List<WmsPretaskH> agvElevatorTasks = preTasks
.Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
!it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
.ToList();
//it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)
var elePreTasks = preTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList();
var normalPreTasks = preTasks.Where(it => !agvElevatorTasks.Concat(elePreTasks).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)).DistinctBy(x=>x.endlocation_code).ToList();
agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty<WmsPretaskH>().ToList()!;
var diffEndLocPreTasks = executedPreTasks.Where(it => firstEleGrp.Select(x => x.endlocation_id).Contains(it.endlocation_id)).ToList();
if(diffEndLocPreTasks?.Count> 0)
{
agvElevatorTasks = agvElevatorTasks.Where(it => !diffEndLocPreTasks.Select(x => x.endlocation_id).Contains(it.endlocation_id)).ToList();
}
//如果电梯任务预Agv任务存在相同目标库位删除Agv任务保证电梯任务先行
var equalEndLocPreTasks = elePreTasks.Select(x => x.endlocation_code).Intersect(agvElevatorTasks.Select(x => x.endlocation_code));
if (equalEndLocPreTasks.Any())