This commit is contained in:
2023-07-11 15:36:23 +08:00
parent 95599c8fbf
commit 252ae13496
2 changed files with 296 additions and 291 deletions

View File

@@ -1278,20 +1278,24 @@ namespace Tnb.ProductionMgr
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
}
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id))
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
{
var parentMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
if (parentMoTask?.last_process_complete_qty == null)
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id))
{
await db.Updateable<PrdMoTask>()
.SetColumns(x => x.last_process_complete_qty == input.reported_qty)
.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)
.Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync();
var parentMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
if (parentMoTask?.last_process_complete_qty == null)
{
await db.Updateable<PrdMoTask>()
.SetColumns(x => x.last_process_complete_qty == input.reported_qty)
.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)
.Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync();
}
}
}