From 138697015a3b9fc31a5f72f58bd12e652026dfc7 Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Mon, 30 Oct 2023 09:31:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs | 56 ++++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs index ee0fd197..958e8a26 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs @@ -25,13 +25,13 @@ namespace Tnb.QcMgr [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleId)] - public class QcCheckTaskResultServic:IDynamicApiController, ITransient, IOverideVisualDevService + public class QcCheckTaskResultService : IDynamicApiController, ITransient, IOverideVisualDevService { private const string ModuleId = "26873741070613"; private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - public QcCheckTaskResultServic(ISqlSugarRepository repository, IUserManager userManager) + public QcCheckTaskResultService(ISqlSugarRepository repository, IUserManager userManager) { _repository = repository; _userManager = userManager; @@ -87,5 +87,57 @@ namespace Tnb.QcMgr } return PageResult.SqlSugarPageResult(result); } + + [HttpGet] + public async Task GetCheckTask(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + Dictionary dic = new Dictionary(); + dic.Add("ok", "合格"); + dic.Add("no", "不合格"); + dic.Add("barelyok", "让步合格"); + dic.Add("await", "待检"); + dic.Add("temporarily", "暂控"); + Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; + string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; + string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; + var list = await db.Queryable() + .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) + .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); + var BasLocations = await db.Queryable().ToListAsync(); + var result = await db.Queryable() + .LeftJoin((a, b) => a.materialid == b.id) + .LeftJoin((a, b, c) => a.processid == c.id) + .LeftJoin((a, b, c, d) => a.workid == d.Id) + .LeftJoin((a, b, c, d, e) => a.execuser == e.Id) + .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid) + .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype) + .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status) + // .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id) + .Select((a, b, c, d, e) => new QcCheckExecHOut + { + id = a.id, + materialid = b.name, + checktype = a.checktype, + workid = d.FullName, + processid = c.process_name, + wareid = a.wareid, + checknum = a.checknum, + status = a.status, + result = a.result, + 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); + 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 : ""; + item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; + item.result = dic.Where(p => p.Key == item.result).Any() ? dic.Where(p => p.Key == item.result).First().Value : ""; + item.wareid = BasLocations.Where(p => p.id == item.wareid).Any() ? BasLocations.Where(p => p.id == item.wareid).First().location_code : ""; + } + return PageResult.SqlSugarPageResult(result); + } } }