This commit is contained in:
qianjiawei
2023-09-20 23:08:04 +08:00
parent f636b12517
commit 0f57d7d396
9 changed files with 310 additions and 72 deletions

View File

@@ -40,6 +40,12 @@ namespace Tnb.QcMgr
private async Task<dynamic> GetListAsync(VisualDevModelListQueryInput input)
{
var db = _repository.AsSugarClient();
Dictionary<string,string> dic= new Dictionary<string,string>();
dic.Add("ok", "合格");
dic.Add("no", "不合格");
dic.Add("barelyok", "让步合格");
dic.Add("await", "待检");
dic.Add("temporarily", "暂控");
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : "";
string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : "";
@@ -47,6 +53,7 @@ namespace Tnb.QcMgr
var list = await db.Queryable<DictionaryDataEntity>()
.LeftJoin<DictionaryTypeEntity>((a, b) => a.DictionaryTypeId == b.Id)
.Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync();
var BasLocations= await db.Queryable<BasLocation>().ToListAsync();
var result = await db.Queryable<QcCheckExecH>()
.LeftJoin<BasMaterial>((a, b) => a.materialid == b.id)
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
@@ -70,11 +77,13 @@ namespace Tnb.QcMgr
tasktime = a.tasktime == null ? "" : a.tasktime,
exectime = a.exectime == null ? "" : a.exectime,
execuser = e.RealName == null ? "" : e.RealName,
}).OrderByDescending(a => a.tasktime).ToPagedListAsync(input.currentPage, input.pageSize);
}).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<QcCheckExecHOut>.SqlSugarPageResult(result);
}