自检提报也计算预计结束时间

This commit is contained in:
2023-10-18 18:17:31 +08:00
parent 8166acf483
commit 596f483d63

View File

@@ -1510,7 +1510,7 @@ namespace Tnb.ProductionMgr
if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null &&
processStandardsH?.moulding_cycle > 0)
{
decimal? addTime = ((prdMoTask.scheduled_qty-input.reported_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1;
decimal? addTime = ((prdMoTask.scheduled_qty-input.reported_qty-(prdMoTask.scrap_qty??0)) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1;
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
{
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
@@ -1572,7 +1572,7 @@ namespace Tnb.ProductionMgr
.Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync();
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
decimal? addTime = (prdMoTask.scheduled_qty-input.reported_qty) * max;
decimal? addTime = (prdMoTask.scheduled_qty-input.reported_qty-(prdMoTask.scrap_qty??0)) * max;
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
{
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
@@ -1792,6 +1792,44 @@ namespace Tnb.ProductionMgr
await db.Updateable(reportMaster).ExecuteCommandAsync();
}
if (prdMoTask.schedule_type == 1)
{
PerProcessStandardsH processStandardsH = await db.Queryable<PerProcessStandardsH>()
.Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id &&
x.output_material_id == prdMoTask.material_id && x.enabled == 1)
.OrderByDescending(x => x.create_time).FirstAsync();
ToolMolds toolMolds = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null &&
processStandardsH?.moulding_cycle > 0)
{
decimal? addTime = ((prdMoTask.scheduled_qty-prdMoTask.reported_work_qty-input.scrap_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1;
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
{
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
await db.Updateable<PrdMoTask>()
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
}
}
}
else
{
var list = await db.Queryable<BasMbomProcess>()
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id && b.enabled==1)
.Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync();
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
decimal? addTime = (prdMoTask.scheduled_qty-prdMoTask.reported_work_qty-input.scrap_qty) * max;
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
{
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
await db.Updateable<PrdMoTask>()
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
}
}
});
return result.IsSuccess;
}