生产相关列表倒叙,生产工单列表重写

This commit is contained in:
2023-07-28 16:26:27 +08:00
parent 703eda463e
commit c18b937dc1
10 changed files with 163 additions and 59 deletions

View File

@@ -303,6 +303,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<ToolMolds>((a, b, c, d) => a.mold_id == d.id)
.LeftJoin<EqpEquipment>((a, b, c, d, e) => a.eqp_id == e.id)
.Where((a, b, c, d, e) => a.mo_id == moId)
.OrderByDescending((a,b,c,d,e)=>a.create_time)
.Select((a, b, c, d, e) => new PrdMoTaskOutput
{
mo_task_code = a.mo_task_code,
@@ -321,6 +322,7 @@ namespace Tnb.ProductionMgr
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
process_code = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_code),
process_name = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_name),
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
})
.Mapper(it =>
{
@@ -335,6 +337,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workline_id == d.Id)
.LeftJoin<BasProcess>((a,b,c,d,e)=>a.process_id==e.id)
.Where((a, b, c, d) => (b.id == moId || b.parent_id == moId) && SqlFunc.IsNullOrEmpty(a.parent_id))
.OrderByDescending((a,b,c,d,e)=>a.create_time)
.Select((a, b, c, d,e) => new PrdMoTaskOutput
{
mo_task_code = a.mo_task_code,
@@ -350,6 +353,7 @@ namespace Tnb.ProductionMgr
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
plan_qty = a.scheduled_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
})
.Mapper(it =>
{
@@ -375,6 +379,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<BasMbom>((a, b, c, d) => a.bom_id == d.id)
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(input.mo_task_code))
.Where((a, b, c, d) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id))
.OrderByDescending(a=>a.create_time)
.Select((a, b, c, d) => new PackSechelToBeIssueListOutput
{
mo_task_id = a.id,
@@ -1800,19 +1805,21 @@ namespace Tnb.ProductionMgr
worklineIds = await db.Queryable<OrganizeEntity>().Where(x => x.ParentId == eqpId && x.Category==DictConst.RegionCategoryWorklineCode && x.DeleteMark==null).Select(x=>x.Id).ToListAsync();
equipIds = await db.Queryable<EqpEquipment>().Where(x => x.equip_type_id == eqpId).Select(x => x.id).ToListAsync();
}
var result = await db.Queryable<PrdMoTask>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == DictConst.TaskStatus)
.LeftJoin<DictionaryDataEntity>((a, b, c, d) => c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode)
.LeftJoin<ToolMolds>((a,b,c,d,e)=>a.mold_id==e.id)
.LeftJoin<PrdMo>((a,b,c,d,e,f)=>a.mo_id==f.id)
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f,g)=>a.workline_id==g.Id)
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g,h)=>a.eqp_id==h.id)
.LeftJoin<DictionaryDataEntity>((a, b, c, d) =>
c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode)
.LeftJoin<ToolMolds>((a, b, c, d, e) => a.mold_id == e.id)
.LeftJoin<PrdMo>((a, b, c, d, e, f) => a.mo_id == f.id)
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f, g) => a.workline_id == g.Id)
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g, h) => a.eqp_id == h.id)
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
.WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count<=0 && worklineIds.Count<=0, (a, b, c, d) => a.workline_id==eqpId || a.eqp_id==eqpId)
.WhereIF(worklineIds.Count>0,(a, b, c, d)=>worklineIds.Contains(a.workline_id))
.WhereIF(equipIds.Count>0,(a, b, c, d)=>equipIds.Contains(a.eqp_id))
.WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count <= 0 && worklineIds.Count <= 0,
(a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
.WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
.WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
{
id = a.id,
@@ -1827,7 +1834,8 @@ namespace Tnb.ProductionMgr
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
}).ToPagedListAsync(input.currentPage, input.pageSize);
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
}