取消提报数量大于等于任务数改状态

This commit is contained in:
2023-07-24 13:52:21 +08:00
parent 1b3d30d204
commit b8180d941f

View File

@@ -1330,11 +1330,11 @@ namespace Tnb.ProductionMgr
}
bool flag = (prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty == prdMoTask.scheduled_qty;
if ((prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty)
{
throw Oops.Bah("已完成数量不能大于任务单数量");
}
// bool flag = (prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty == prdMoTask.scheduled_qty;
// if ((prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty)
// {
// throw Oops.Bah("已完成数量不能大于任务单数量");
// }
report = input.Adapt<PrdReport>();
report.id = SnowflakeIdHelper.NextId();
@@ -1369,7 +1369,7 @@ namespace Tnb.ProductionMgr
await db.Updateable<PrdMoTask>()
// .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty)
.SetColumns(x => x.reported_work_qty == input.reported_qty)
.SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
// .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
}
else
@@ -1377,7 +1377,7 @@ namespace Tnb.ProductionMgr
await db.Updateable<PrdMoTask>()
// .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty)
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty)
.SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
// .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
}
@@ -1391,13 +1391,13 @@ namespace Tnb.ProductionMgr
{
await db.Updateable<PrdMoTask>()
.SetColumns(x => x.last_process_complete_qty == input.reported_qty)
.SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
// .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
.Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync();
}else if (parentMoTask?.last_process_complete_qty != null)
{
await db.Updateable<PrdMoTask>()
.SetColumns(x => x.last_process_complete_qty == x.last_process_complete_qty + input.reported_qty)
.SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
// .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode)
.Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync();
}
}