代码修改
parent
11e5448acf
commit
db1a0195fe
|
@ -318,9 +318,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
continue;
|
||||
}
|
||||
str = await GetInspectionEnumValue(listIdentification, str);
|
||||
str = await SetEnum(dto.TrialId, listIdentification, str);
|
||||
str = await SetDataInspectionDateType(listIdentification, 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);
|
||||
|
||||
|
@ -330,9 +330,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
continue;
|
||||
}
|
||||
str2 = await GetInspectionEnumValue(listIdentification, str2);
|
||||
str2 = await SetEnum(dto.TrialId, listIdentification, str2);
|
||||
str2 = await SetDataInspectionDateType(listIdentification, 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
|
||||
|
@ -455,20 +455,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()
|
||||
{
|
||||
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);
|
||||
|
@ -518,13 +521,14 @@ 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,
|
||||
Identification = u.Identification,
|
||||
ForeignKeyValue = p.ForeignKeyValue,
|
||||
ForeignKeyText = p.ForeignKeyText,
|
||||
ForeignKeyTable = p.ForeignKeyTableName
|
||||
|
@ -532,9 +536,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
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();
|
||||
|
||||
|
@ -586,7 +591,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")
|
||||
{
|
||||
|
@ -599,16 +604,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
|
||||
select new
|
||||
{
|
||||
Key = p.Code,
|
||||
Identification = u.Identification,
|
||||
//前端展示类型
|
||||
DataType = p.DataType,
|
||||
|
||||
TableConfigJsonStr = p.TableConfigJsonStr,
|
||||
Key = p.Code,
|
||||
|
||||
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),
|
||||
|
||||
|
||||
}).ToList();
|
||||
|
||||
// 添加单双审
|
||||
var trialtype = await _trialRepository.AsQueryable().Where(x => x.Id == trialId).Select(x => x.QCProcessEnum).FirstOrDefaultAsync();
|
||||
|
@ -617,9 +635,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
list.Add(new
|
||||
{
|
||||
Key = "AuditState",
|
||||
Identification = string.Empty,
|
||||
DataType = string.Empty,
|
||||
TableConfigJsonStr = string.Empty,
|
||||
Key = "AuditState",
|
||||
Code = trialtype == TrialQCProcess.SingleAudit ? "AuditStatePE" : "AuditStateRC",
|
||||
Type = "Code",
|
||||
});
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
|||
public string Code { get; set; }
|
||||
|
||||
public string DateType { get; set; }
|
||||
|
||||
public string Identification { get; set; }
|
||||
}
|
||||
|
||||
public class TypeNameDto
|
||||
|
|
Loading…
Reference in New Issue