生成预任务时,新增任务属性逻辑判断

This commit is contained in:
alex
2023-06-21 10:21:15 +08:00
parent c2badd9a44
commit 798abfe5b0
4 changed files with 33 additions and 26 deletions

View File

@@ -240,19 +240,18 @@ namespace Tnb.WarehouseMgr
{
x.is_chain = 0;
x.chain_type = "0";
});
}
else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
{
items.ForEach(x => x.is_chain = 1);
items[0].chain_type = "1";
for (int i = 0; i < items.Count; i++)
{
if (i == 0 || i == items.Count - 1) continue;
items[i].chain_type = "2";
}
items[^1].chain_type = "3";
//items[0].chain_type = "1";
//for (int i = 0; i < items.Count; i++)
//{
// if (i == 0 || i == items.Count - 1) continue;
// items[i].chain_type = "2";
//}
//items[^1].chain_type = "3";
}
});
@@ -288,7 +287,7 @@ namespace Tnb.WarehouseMgr
items.ForEach(x =>
{
x.is_chain = 0;
x.chain_type = "0";
x.chain_type = "3";
});
}
else if (moveNum > 1)
@@ -461,18 +460,10 @@ namespace Tnb.WarehouseMgr
var disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
upInput.loginType = !_userManager.LoginType.IsNullOrEmpty() ? "app" : "web";
if (dt.is_sign == 1) //区分出入库操作
if (dt.is_sign == 1 && dt.chain_type == "3")
{
if (dt.is_chain == 0)
{
await DoUpdate(upInput);
}
else if (dt.is_chain == 1 && dt.chain_type == "3")
{
await DoUpdate(upInput);
}
await DoUpdate(upInput);
}
}
}
@@ -495,6 +486,19 @@ namespace Tnb.WarehouseMgr
/// <returns></returns>
public async Task<bool> GenPreTask(List<WmsPretaskH> preTasks, List<WmsPretaskCode> preTaskCodes)
{
var grpList = preTasks.OrderBy(o => o.bill_code).GroupBy(g => g.carry_id).ToList();
if (grpList?.Count > 0)
{
foreach (var grp in grpList)
{
var arr = grp.ToArray();
if (arr.Length > 1)
{
var subArr = arr[..^1];
Array.ForEach(subArr, a => a.chain_type = "1");
}
}
}
var row = await _db.Insertable(preTasks).ExecuteCommandAsync();
if (preTaskCodes?.Count > 0)
{