优化任务单调整列表

This commit is contained in:
2023-07-19 13:37:36 +08:00
parent cb803e7894
commit e6d2dda71c

View File

@@ -1642,6 +1642,14 @@ namespace Tnb.ProductionMgr
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
string moTaskCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
string eqpId = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : "";
List<string> worklineIds = new List<string>();
List<string> equipIds = new List<string>();
if (!string.IsNullOrEmpty(eqpId))
{
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)
@@ -1651,7 +1659,9 @@ namespace Tnb.ProductionMgr
.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), (a, b, c, d) => a.workline_id==eqpId || a.eqp_id==eqpId)
.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,