稽查翻译修改
continuous-integration/drone/push Build is passing Details

Uat_Study^2
he 2024-05-24 14:55:24 +08:00
parent f802897b14
commit 07dcb6fe47
2 changed files with 48 additions and 28 deletions

View File

@ -238,7 +238,7 @@ namespace IRaCIS.Core.Application.Service
//var listIdentification = auditDatas.Select(x => x.Identification).Distinct().ToList(); var listIdentification = auditDatas.Select(x => x.Identification).Distinct().ToList();
foreach (var item in auditDatas) foreach (var item in auditDatas)
{ {
Dictionary<string, object> jsonDict = (JsonConvert.DeserializeObject<Dictionary<string, object>>(item.JsonStr)).IfNullThrowException(); Dictionary<string, object> jsonDict = (JsonConvert.DeserializeObject<Dictionary<string, object>>(item.JsonStr)).IfNullThrowException();
@ -319,9 +319,9 @@ namespace IRaCIS.Core.Application.Service
{ {
continue; continue;
} }
str = await GetInspectionEnumValue(new List<string>() { item.Identification }, str); str = await GetInspectionEnumValue(listIdentification, item.Identification, str);
str = await SetEnum(dto.TrialId, new List<string>() { item.Identification }, str); str = await SetEnum(dto.TrialId, listIdentification, item.Identification, str);
str = await SetDataInspectionDateType(new List<string>() { item.Identification }, str); str = await SetDataInspectionDateType(listIdentification, item.Identification, str);
jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject<object>(str); jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject<object>(str);
@ -331,9 +331,9 @@ namespace IRaCIS.Core.Application.Service
{ {
continue; continue;
} }
str2 = await GetInspectionEnumValue(new List<string>() { item.Identification }, str2); str2 = await GetInspectionEnumValue(listIdentification, item.Identification, str2);
str2 = await SetEnum(dto.TrialId, new List<string>() { item.Identification }, str2); str2 = await SetEnum(dto.TrialId, listIdentification, item.Identification, str2);
str2 = await SetDataInspectionDateType(new List<string>() { item.Identification }, str2); str2 = await SetDataInspectionDateType(listIdentification, item.Identification, str2);
jsonDict[nameof(InspectionJsonDetail.CommonData)] = JsonConvert.DeserializeObject<object>(str2); jsonDict[nameof(InspectionJsonDetail.CommonData)] = JsonConvert.DeserializeObject<object>(str2);
#endregion #endregion
@ -456,20 +456,23 @@ namespace IRaCIS.Core.Application.Service
/// <param name="identificationList"></param> /// <param name="identificationList"></param>
/// <param name="jsonStr"></param> /// <param name="jsonStr"></param>
/// <returns></returns> /// <returns></returns>
private async Task<string> SetDataInspectionDateType(List<string> identificationList, string jsonStr) private async Task<string> SetDataInspectionDateType(List<string> identificationList,string identification, string jsonStr)
{ {
var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identificationList.Contains(x.Identification)) var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identificationList.Contains(x.Identification))
join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable) on parent.Id equals child.ParentId join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable) on parent.Id equals child.ParentId
select new DateDto() select new DateDto()
{ {
Identification= parent.Identification,
Code = child.Code, Code = child.Code,
DateType = child.DateType, DateType = child.DateType,
}).ToListAsync(); }).ToListAsync();
list = list.GroupBy(x => new { x.Code }, (key, lst) => new DateDto() list = list.GroupBy(x => new { x.Code }, (key, lst) => new DateDto()
{ {
Code = key.Code, Code = key.Code,
DateType = lst.Max(x => x.DateType), DateType = lst.FirstOrDefault(y => y.Identification == identification)?.DateType ?? lst.Max(x => x.DateType),
}).ToList(); }).ToList();
var jsonDataDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr); var jsonDataDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr);
@ -519,13 +522,14 @@ namespace IRaCIS.Core.Application.Service
///// <param name="ForeignKeyValue">外键value</param> ///// <param name="ForeignKeyValue">外键value</param>
///// <param name="ForeignKeyText">要查询的外键值</param> ///// <param name="ForeignKeyText">要查询的外键值</param>
///// <param name="value">传入的纸</param> ///// <param name="value">传入的纸</param>
private async Task<string> GetInspectionEnumValue(List<string> identificationList, string jsonStr) private async Task<string> GetInspectionEnumValue(List<string> identificationList,string identification, string jsonStr)
{ {
var list = await (from u in _frontAuditConfigRepository.Where(x => identificationList.Contains(x.Identification)) var list = await (from u in _frontAuditConfigRepository.Where(x => identificationList.Contains(x.Identification))
join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId
select new select new
{ {
Key = p.Code, Key = p.Code,
Identification=u.Identification,
ForeignKeyValue = p.ForeignKeyValue, ForeignKeyValue = p.ForeignKeyValue,
ForeignKeyText = p.ForeignKeyText, ForeignKeyText = p.ForeignKeyText,
ForeignKeyTable = p.ForeignKeyTableName ForeignKeyTable = p.ForeignKeyTableName
@ -533,9 +537,10 @@ namespace IRaCIS.Core.Application.Service
list = list.GroupBy(x => new { x.Key }, (key, lst) => new list = list.GroupBy(x => new { x.Key }, (key, lst) => new
{ {
Key = key.Key, Key = key.Key,
ForeignKeyValue = lst.Max(x => x.ForeignKeyValue), Identification=string.Empty,
ForeignKeyText = lst.Max(x => x.ForeignKeyText), ForeignKeyValue= lst.FirstOrDefault(y => y.Identification == identification)?.ForeignKeyValue ?? lst.Max(x => x.ForeignKeyValue),
ForeignKeyTable = lst.Max(x => x.ForeignKeyTable), ForeignKeyText = lst.FirstOrDefault(y => y.Identification == identification)?.ForeignKeyText ?? lst.Max(x => x.ForeignKeyText),
ForeignKeyTable = lst.FirstOrDefault(y => y.Identification == identification)?.ForeignKeyTable ?? lst.Max(x => x.ForeignKeyTable),
}).ToList(); }).ToList();
@ -585,7 +590,7 @@ namespace IRaCIS.Core.Application.Service
/// <param name="identificationList">标识</param> /// <param name="identificationList">标识</param>
/// <param name="jsonStr">Json对象</param> /// <param name="jsonStr">Json对象</param>
/// <returns></returns> /// <returns></returns>
private async Task<string> SetEnum(Guid trialId, List<string> identificationList, string jsonStr) private async Task<string> SetEnum(Guid trialId, List<string> identificationList, string identification, string jsonStr)
{ {
if (jsonStr == null || jsonStr == "null") if (jsonStr == null || jsonStr == "null")
{ {
@ -598,16 +603,29 @@ namespace IRaCIS.Core.Application.Service
join p in _frontAuditConfigRepository.Where(x => (x.DictionaryCode != string.Empty && x.EnumType == "Dictionary") || (x.DataType == "Table") && x.IsEnable) on u.Id equals p.ParentId join p in _frontAuditConfigRepository.Where(x => (x.DictionaryCode != string.Empty && x.EnumType == "Dictionary") || (x.DataType == "Table") && x.IsEnable) on u.Id equals p.ParentId
select new select new
{ {
Key = p.Code,
Identification = u.Identification,
//前端展示类型 //前端展示类型
DataType = p.DataType, DataType = p.DataType,
TableConfigJsonStr = p.TableConfigJsonStr, TableConfigJsonStr = p.TableConfigJsonStr,
Key = p.Code,
Code = p.DictionaryCode, Code = p.DictionaryCode,
Type = p.DictionaryType Type = p.DictionaryType
}).ToListAsync(); }).ToListAsync();
//两条不同的标识 但是里面配置有相同的翻译字典 //两条不同的标识 但是里面配置有相同的翻译字典
list = list.Distinct().ToList(); list = list.GroupBy(x => new { x.Key }, (key, lst) => new
{
Key = key.Key,
Identification = string.Empty,
DataType = lst.FirstOrDefault(y => y.Identification == identification)?.DataType ?? lst.Max(x => x.DataType),
TableConfigJsonStr = lst.FirstOrDefault(y => y.Identification == identification)?.TableConfigJsonStr ?? lst.Max(x => x.TableConfigJsonStr),
Code = lst.FirstOrDefault(y => y.Identification == identification)?.Code ?? lst.Max(x => x.Code),
Type = lst.FirstOrDefault(y => y.Identification == identification)?.Type ?? lst.Max(x => x.Type),
}).ToList();
// 添加单双审 // 添加单双审
var trialtype = await _trialRepository.AsQueryable().Where(x => x.Id == trialId).Select(x => x.QCProcessEnum).FirstOrDefaultAsync(); var trialtype = await _trialRepository.AsQueryable().Where(x => x.Id == trialId).Select(x => x.QCProcessEnum).FirstOrDefaultAsync();
@ -616,9 +634,10 @@ namespace IRaCIS.Core.Application.Service
{ {
list.Add(new list.Add(new
{ {
Key = "AuditState",
Identification = string.Empty,
DataType = string.Empty, DataType = string.Empty,
TableConfigJsonStr = string.Empty, TableConfigJsonStr = string.Empty,
Key = "AuditState",
Code = trialtype == TrialQCProcess.SingleAudit ? "AuditStatePE" : "AuditStateRC", Code = trialtype == TrialQCProcess.SingleAudit ? "AuditStatePE" : "AuditStateRC",
Type = "Code", Type = "Code",
}); });

View File

@ -10,6 +10,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
{ {
public string Code { get; set; } public string Code { get; set; }
public string Identification { get; set; }
public string DateType { get; set; } public string DateType { get; set; }
} }