This commit is contained in:
2024-08-22 14:08:16 +08:00
parent 4ce0a58715
commit 27e67dadf3
29 changed files with 758 additions and 184 deletions

View File

@@ -105,11 +105,11 @@ namespace Tnb.ProductionMgr
.LeftJoin<PrdMo>((a, b, c, d, e, f) => a.mo_id == f.id)
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g) => g.id == a.eqp_id)
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f, g,h)=>a.workstation_id==h.Id)
.LeftJoin<UserEntity>((a, b, c, d, e, f, g,h,i)=>a.worker_id==i.Id)
//.LeftJoin<UserEntity>((a, b, c, d, e, f, g,h,i)=>a.worker_id==i.Id)
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
.WhereIF(!string.IsNullOrEmpty(moTaskStatus), (a, b, c, d) => a.mo_task_status == moTaskStatus)
.Where((a, b, c, d, e, f) => a.schedule_type == 1)
.Select((a, b, c, d, e, f, g,h,i) => new PrdMoTaskIssueListOutput
.Select((a, b, c, d, e, f, g,h) => new PrdMoTaskIssueListOutput
{
id = a.id,
mo_task_code = a.mo_task_code,
@@ -118,11 +118,28 @@ namespace Tnb.ProductionMgr
eqp_id = g.code + "/" + g.name,
mo_task_status = d.FullName,
workstation_id = h.FullName,
worker_id = i.RealName,
// worker_id = i.RealName,
plan_qty = f.plan_qty,
scheduled_qty = a.scheduled_qty,
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
dayshift_worker_id = a.dayshift_worker_id,
dayshiftafter_worker_id = a.dayshiftafter_worker_id,
nightshift_worker_id = a.nightshift_worker_id,
nightshiftafter_worker_id = a.nightshiftafter_worker_id,
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
List<string> userIdList = result.list.Select(x => x.dayshift_worker_id).Distinct().ToList();
userIdList.AddRange(result.list.Select(x => x.dayshiftafter_worker_id).Distinct().ToList());
userIdList.AddRange(result.list.Select(x => x.nightshift_worker_id).Distinct().ToList());
userIdList.AddRange(result.list.Select(x => x.nightshiftafter_worker_id).Distinct().ToList());
List<UserEntity> userEntities = await db.Queryable<UserEntity>().Where(x=>userIdList.Contains(x.Id)).ToListAsync();
foreach (var item in result.list)
{
item.dayshift_worker_id = userEntities.Find(x=>x.Id==item.dayshift_worker_id)?.RealName ?? item.dayshift_worker_id;
item.dayshiftafter_worker_id = userEntities.Find(x=>x.Id==item.dayshiftafter_worker_id)?.RealName ?? item.dayshiftafter_worker_id;
item.nightshift_worker_id = userEntities.Find(x=>x.Id==item.nightshift_worker_id)?.RealName ?? item.nightshift_worker_id;
item.nightshiftafter_worker_id = userEntities.Find(x=>x.Id==item.nightshiftafter_worker_id)?.RealName ?? item.nightshiftafter_worker_id;
}
return PageResult<PrdMoTaskIssueListOutput>.SqlSugarPageResult(result);
}
}