稽查翻译修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f802897b14
commit
07dcb6fe47
|
@ -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)
|
||||
{
|
||||
Dictionary<string, object> jsonDict = (JsonConvert.DeserializeObject<Dictionary<string, object>>(item.JsonStr)).IfNullThrowException();
|
||||
|
@ -319,9 +319,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
continue;
|
||||
}
|
||||
str = await GetInspectionEnumValue(new List<string>() { item.Identification }, str);
|
||||
str = await SetEnum(dto.TrialId, new List<string>() { item.Identification }, str);
|
||||
str = await SetDataInspectionDateType(new List<string>() { item.Identification }, str);
|
||||
str = await GetInspectionEnumValue(listIdentification, item.Identification, str);
|
||||
str = await SetEnum(dto.TrialId, listIdentification, item.Identification, str);
|
||||
str = await SetDataInspectionDateType(listIdentification, item.Identification, str);
|
||||
|
||||
jsonDict[nameof(InspectionJsonDetail.Data)] = JsonConvert.DeserializeObject<object>(str);
|
||||
|
||||
|
@ -331,9 +331,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
continue;
|
||||
}
|
||||
str2 = await GetInspectionEnumValue(new List<string>() { item.Identification }, str2);
|
||||
str2 = await SetEnum(dto.TrialId, new List<string>() { item.Identification }, str2);
|
||||
str2 = await SetDataInspectionDateType(new List<string>() { item.Identification }, str2);
|
||||
str2 = await GetInspectionEnumValue(listIdentification, item.Identification, str2);
|
||||
str2 = await SetEnum(dto.TrialId, listIdentification, item.Identification, str2);
|
||||
str2 = await SetDataInspectionDateType(listIdentification, item.Identification, str2);
|
||||
|
||||
jsonDict[nameof(InspectionJsonDetail.CommonData)] = JsonConvert.DeserializeObject<object>(str2);
|
||||
#endregion
|
||||
|
@ -456,20 +456,23 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="identificationList"></param>
|
||||
/// <param name="jsonStr"></param>
|
||||
/// <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))
|
||||
join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable) on parent.Id equals child.ParentId
|
||||
select new DateDto()
|
||||
{
|
||||
Code = child.Code,
|
||||
Identification= parent.Identification,
|
||||
|
||||
Code = child.Code,
|
||||
DateType = child.DateType,
|
||||
}).ToListAsync();
|
||||
|
||||
list = list.GroupBy(x => new { x.Code }, (key, lst) => new DateDto()
|
||||
{
|
||||
|
||||
Code = key.Code,
|
||||
DateType = lst.Max(x => x.DateType),
|
||||
DateType = lst.FirstOrDefault(y => y.Identification == identification)?.DateType ?? lst.Max(x => x.DateType),
|
||||
}).ToList();
|
||||
|
||||
var jsonDataDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr);
|
||||
|
@ -519,23 +522,25 @@ namespace IRaCIS.Core.Application.Service
|
|||
///// <param name="ForeignKeyValue">外键value</param>
|
||||
///// <param name="ForeignKeyText">要查询的外键值</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))
|
||||
join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId
|
||||
select new
|
||||
{
|
||||
Key = p.Code,
|
||||
ForeignKeyValue = p.ForeignKeyValue,
|
||||
Identification=u.Identification,
|
||||
ForeignKeyValue = p.ForeignKeyValue,
|
||||
ForeignKeyText = p.ForeignKeyText,
|
||||
ForeignKeyTable = p.ForeignKeyTableName
|
||||
}).ToListAsync();
|
||||
list = list.GroupBy(x => new { x.Key }, (key, lst) => new
|
||||
{
|
||||
Key = key.Key,
|
||||
ForeignKeyValue = lst.Max(x => x.ForeignKeyValue),
|
||||
ForeignKeyText = lst.Max(x => x.ForeignKeyText),
|
||||
ForeignKeyTable = lst.Max(x => x.ForeignKeyTable),
|
||||
Identification=string.Empty,
|
||||
ForeignKeyValue= lst.FirstOrDefault(y => y.Identification == identification)?.ForeignKeyValue ?? lst.Max(x => x.ForeignKeyValue),
|
||||
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();
|
||||
|
||||
|
@ -585,7 +590,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="identificationList">标识</param>
|
||||
/// <param name="jsonStr">Json对象</param>
|
||||
/// <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")
|
||||
{
|
||||
|
@ -598,27 +603,41 @@ 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
|
||||
select new
|
||||
{
|
||||
//前端展示类型
|
||||
DataType = p.DataType,
|
||||
TableConfigJsonStr = p.TableConfigJsonStr,
|
||||
Key = p.Code,
|
||||
Key = p.Code,
|
||||
Identification = u.Identification,
|
||||
//前端展示类型
|
||||
DataType = p.DataType,
|
||||
|
||||
TableConfigJsonStr = p.TableConfigJsonStr,
|
||||
|
||||
Code = p.DictionaryCode,
|
||||
Type = p.DictionaryType
|
||||
}).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),
|
||||
|
||||
|
||||
// 添加单双审
|
||||
var trialtype = await _trialRepository.AsQueryable().Where(x => x.Id == trialId).Select(x => x.QCProcessEnum).FirstOrDefaultAsync();
|
||||
}).ToList();
|
||||
|
||||
// 添加单双审
|
||||
var trialtype = await _trialRepository.AsQueryable().Where(x => x.Id == trialId).Select(x => x.QCProcessEnum).FirstOrDefaultAsync();
|
||||
|
||||
if (!list.Any(x => x.Key == "AuditState"))
|
||||
{
|
||||
list.Add(new
|
||||
{
|
||||
DataType = string.Empty,
|
||||
TableConfigJsonStr = string.Empty,
|
||||
Key = "AuditState",
|
||||
{
|
||||
Key = "AuditState",
|
||||
Identification = string.Empty,
|
||||
DataType = string.Empty,
|
||||
TableConfigJsonStr = string.Empty,
|
||||
Code = trialtype == TrialQCProcess.SingleAudit ? "AuditStatePE" : "AuditStateRC",
|
||||
Type = "Code",
|
||||
});
|
||||
|
|
|
@ -10,7 +10,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
|||
{
|
||||
public string Code { get; set; }
|
||||
|
||||
public string DateType { get; set; }
|
||||
public string Identification { get; set; }
|
||||
public string DateType { get; set; }
|
||||
}
|
||||
|
||||
public class TypeNameDto
|
||||
|
|
Loading…
Reference in New Issue