diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs index eb231cf8..b6544561 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using Aspose.Cells.Drawing; @@ -14,6 +15,7 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; +using NPOI.SS.Formula.Functions; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.QcMgr.Entities; @@ -95,7 +97,7 @@ namespace Tnb.QcMgr Dictionary dic = new Dictionary(); dic.Add("ok", "合格"); dic.Add("no", "不合格"); - dic.Add("barelyok", "让步合格"); + dic.Add("barelyOk", "让步合格"); dic.Add("await", "待检"); dic.Add("temporarily", "暂控"); Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); @@ -106,6 +108,15 @@ namespace Tnb.QcMgr .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); var BasLocations = await db.Queryable().ToListAsync(); + Expression> expression; + if (list.Where(p => p.FullName == "待执行").First().Id == status) + { + expression = a => DateTime.Parse(a.tasktime!); + } + else + { + expression = a => DateTime.Parse(a.exectime!); + } var result = await db.Queryable() .LeftJoin((a, b) => a.materialid == b.id) .LeftJoin((a, b, c) => a.processid == c.id) @@ -129,7 +140,8 @@ namespace Tnb.QcMgr tasktime = a.tasktime == null ? "" : a.tasktime, exectime = a.exectime == null ? "" : a.exectime, execuser = e.RealName == null ? "" : e.RealName, - }).OrderByDescending(a => DateTime.Parse(a.exectime)).ToPagedListAsync(input.currentPage, input.pageSize); + }).OrderByDescending(expression).ToPagedListAsync(input.currentPage, input.pageSize); + foreach (var item in result.list) { item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : "";