Test.EIImageViewer
parent
d1d35ee89c
commit
7777a2c791
|
@ -86,7 +86,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
await InsertInspection<Subject>(item, type, x => new DataInspection()
|
||||
{
|
||||
SubjectId = x.Id
|
||||
SubjectId = x.Id,
|
||||
SubjectCode=x.Code,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -95,7 +96,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
{
|
||||
await InsertInspection<SubjectVisit>(item, type, x => new DataInspection()
|
||||
{
|
||||
SubjectVisitId = x.Id
|
||||
SubjectVisitId = x.Id,
|
||||
SubjectVisitName=x.VisitName,
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
@ -234,7 +236,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
Inspection = generalData
|
||||
};
|
||||
add.JsonDetail = inspectionData.ToJcJson();
|
||||
await SetDataInspectionDateType(add);
|
||||
|
||||
await _dbContext.DataInspection.AddAsync(add);
|
||||
}
|
||||
|
||||
|
@ -323,53 +325,5 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 格式化日期和时间
|
||||
/// </summary>
|
||||
/// <param name="Data">稽查数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<DataInspection> SetDataInspectionDateType(DataInspection Data)
|
||||
{
|
||||
var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == Data.Identification)
|
||||
join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date") on parent.Id equals child.ParentId
|
||||
select new DateDto()
|
||||
{
|
||||
Code = child.Code,
|
||||
DateType = child.DateType,
|
||||
}).ToListAsync();
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(Data.JsonDetail);
|
||||
|
||||
foreach (var item in JsonData.Keys)
|
||||
{
|
||||
var datefirst = list.FirstOrDefault(x => x.Code.ToLower() == item.ToLower());
|
||||
if (datefirst != null && !IsNullOrEmpty(JsonData[item]))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (datefirst.DateType == "Date")
|
||||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
if (datefirst.DateType == "DateTime")
|
||||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Data.JsonDetail = JsonConvert.SerializeObject(JsonData);
|
||||
|
||||
return Data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -574,12 +574,63 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
{
|
||||
item.Json = await GetInspectionEnumValue(item.Identification, item.Json);
|
||||
item.Json = await SetEnum(dto.TrialId, item.Identification, item.Json);
|
||||
item.Json = await SetDataInspectionDateType(item.Identification, item.Json);
|
||||
}
|
||||
|
||||
return dto.Items.Select(x => x.Json).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 格式化日期和时间
|
||||
/// </summary>
|
||||
/// <param name="Data">稽查数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> SetDataInspectionDateType(string identification, string json)
|
||||
{
|
||||
var list = await (from parent in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.Identification == identification)
|
||||
join child in _dbContext.FrontAuditConfig.AsQueryable().Where(x => x.EnumType == "Date") on parent.Id equals child.ParentId
|
||||
select new DateDto()
|
||||
{
|
||||
Code = child.Code,
|
||||
DateType = child.DateType,
|
||||
}).ToListAsync();
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
|
||||
foreach (var item in JsonData.Keys)
|
||||
{
|
||||
var datefirst = list.FirstOrDefault(x => x.Code.ToLower() == item.ToLower());
|
||||
if (datefirst != null && !IsNullOrEmpty(JsonData[item]))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (datefirst.DateType == "Date")
|
||||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
if (datefirst.DateType == "DateTime")
|
||||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(JsonData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取外键表数据
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue