This commit is contained in:
2023-06-21 10:21:17 +08:00
parent efb68b9ad7
commit 785102ddab
2 changed files with 216 additions and 5 deletions

View File

@@ -426,6 +426,7 @@ namespace Tnb.ProductionMgr
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(MoModuleId, true);
// var data = await _runService.GetListResult(templateEntity, input);
//
//
// if (data?.list?.Count > 0)
// {
// var parentIdField = nameof(PrdMo.parent_id);
@@ -529,7 +530,7 @@ namespace Tnb.ProductionMgr
.WhereIF(!string.IsNullOrEmpty(moCode),(a,b,c,d,e)=>a.mo_code.Contains(moCode))
.WhereIF(!string.IsNullOrEmpty(combineMoCode),(a,b,c,d,e)=>a.combine_mo_code.Contains(combineMoCode))
.OrderByDescending((a,b,c,d,e)=>a.create_time)
.Select((a, b, c, d, e) => new PrdMoTreeOutput
.Select((a, b, c, d, e) => new PrdMoListTreeOutput
{
org_id = a.org_id,
mo_id = a.id,
@@ -557,13 +558,50 @@ namespace Tnb.ProductionMgr
scheduled_qty = a.scheduled_qty.Value.ToString(),
parent_id = "0",
id = a.id,
hasChildren = false,
num = 0,
isLeaf = true,
hasChildren = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
num = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Count(),
isLeaf = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
children = SqlFunc.Subqueryable<PrdMo>()
.LeftJoin<BasMaterial>((h,i) => h.material_id == i.id)
.LeftJoin<DictionaryDataEntity>((h,i,j) => h.mo_type == j.Id)
.LeftJoin<DictionaryDataEntity>((h,i,j,k) => h.mo_status == k.Id)
.LeftJoin<UserEntity>((h,i,j,k,l) => h.create_id == l.Id)
.Where((h,i,j,k,l)=>a.id==h.parent_id).ToList((h,i,j,k,l)=>new PrdMoListTreeOutput()
{
org_id = h.org_id,
mo_id = h.id,
mo_code = h.mo_code,
material_code = i.code,
material_name = i.name,
material_standard = i.material_standard,
mo_type = j.FullName,
mo_status = k.FullName,
plan_qty = h.plan_qty.Value.ToString(),
input_qty = h.input_qty.Value.ToString(),
complete_qty = h.complete_qty.Value.ToString(),
scrap_qty = h.scrap_qty.Value.ToString(),
plan_start_date = h.plan_start_date.Value.ToString("yyyy-MM-dd"),
plan_end_date = h.plan_end_date.Value.ToString("yyyy-MM-dd"),
is_create_dispatch = h.is_create_dispatch==0 ? "否" : "是",
production_linecode = h.production_linecode,
is_merge = h.is_merge==0 ? "否" : "是",
combine_mo_code = h.combine_mo_code,
time_stamp = h.time_stamp,
create_id = l.RealName,
create_time = h.create_time.Value.ToString("yyyy-MM-dd : HH:mm:ss"),
material_id = i.code,
material_id_id = h.material_id,
scheduled_qty = h.scheduled_qty.Value.ToString(),
parent_id = a.id,
id = h.id,
hasChildren = false,
num = 0,
isLeaf = true,
})
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdMoTreeOutput>.SqlSugarPageResult(result);
return PageResult<PrdMoListTreeOutput>.SqlSugarPageResult(result);
}
#endregion