bug,生产bom工序添加排序和是否最后一道工序字段
This commit is contained in:
@@ -282,6 +282,7 @@ namespace Tnb.BasicData
|
||||
|
||||
if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null)
|
||||
{
|
||||
int index = 0;
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
{
|
||||
string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
@@ -296,6 +297,8 @@ namespace Tnb.BasicData
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
route_detail_id = process.route_detail_id,
|
||||
ordinal = ++index,
|
||||
is_last = index==mbomSaveDataInput.processes.Count ? 1 : 0,
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -182,4 +182,10 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
/// 生产bom工序id
|
||||
/// </summary>
|
||||
public string? mbom_process_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后一道工序完成数量
|
||||
/// </summary>
|
||||
public int? last_process_complete_qty { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,22 @@ 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))
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
var master = await db.Queryable<PrdReportRecord>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||
if (master != null)
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Tnb.ProductionMgr
|
||||
plan_end_date = a.estimated_end_date,
|
||||
plan_qty = c.plan_qty,
|
||||
// complete_qty = SqlFunc.Subqueryable<PrdReport>().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
|
||||
complete_qty = a.reported_work_qty+a.scrap_qty,
|
||||
complete_qty = a.last_process_complete_qty,
|
||||
mo_task_status = a.mo_task_status,
|
||||
|
||||
})
|
||||
@@ -116,8 +116,12 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic)
|
||||
{
|
||||
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||
var items = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||
.LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||
.LeftJoin<BasMbomProcess>((a,b,c,d)=>a.mbom_process_id==d.id)
|
||||
.Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled")
|
||||
.OrderBy((a,b,c,d)=>d.ordinal)
|
||||
.Select((a, b, c) => new PrdMoTask
|
||||
{
|
||||
id = a.id,
|
||||
@@ -129,7 +133,8 @@ namespace Tnb.ProductionMgr
|
||||
plan_start_date = a.estimated_start_date,
|
||||
plan_end_date = a.estimated_end_date,
|
||||
plan_qty = c.plan_qty,
|
||||
complete_qty = SqlFunc.Subqueryable<PrdReport>().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
|
||||
//complete_qty = SqlFunc.Subqueryable<PrdReport>().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
|
||||
complete_qty = a.reported_work_qty+a.scrap_qty,
|
||||
mo_task_status = a.mo_task_status,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user