From db15a3fb7b0f108e74bab345f99cc3dc984b1876 Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Thu, 19 May 2022 17:24:30 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/QC/QCOperationService.cs | 2 +-
.../Common/AuditingData.cs | 38 ++++++++-----------
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
index c9a9c2421..a1fbb9465 100644
--- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
+++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs
@@ -1841,7 +1841,7 @@ namespace IRaCIS.Core.Application.Image.QA
if (command.SubjectFirstGiveMedicineTime != null)
{
- await _subjectRepository.UpdatePartialFromQueryAsync(command.SubjectId, u => new Subject() { FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime, });
+ await _subjectRepository.UpdatePartialFromQueryAsync(command.SubjectId, u => new Subject() { FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime, },true);
}
await _subjectVisitRepository.SaveChangesAsync();
diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
index 7f810d3be..d84a5fee1 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
@@ -849,6 +849,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
entityTypeName = "New/" + entityTypeName;
}
inspection.Identification = $"{_userInfo.RequestUrl}/{ entityTypeName}/{type}";
+
+ #region 注释
//if (data != null)
//{
// var originaldata = data.OriginalValues.ToObject();
@@ -857,8 +859,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
// inspection.LastJsonDetail = originaldata.ToJcJson();
// }
//}
-
-
+ #endregion
+
await AddInspectionRecordAsync(inspection, entityobj, otherItem);
}
@@ -911,40 +913,30 @@ namespace IRaCIS.Core.Infra.EFCore.Common
/// 数据
///
///
- public async Task AddInspectionRecordAsync(DataInspection add, dynamic data,object otherItem=null)
+ public async Task AddInspectionRecordAsync(DataInspection add, dynamic data, object otherItem = null)
{
MapData(data, add);
InspectionGeneralData generalData = new InspectionGeneralData();
MapData(add, generalData);
await SetInspectionNameValue(generalData);
#region 处理标识
- try
- {
- var from = await _dbContext.FrontAuditConfig.FirstOrDefaultAsync(x => x.Identification == add.Identification);
- add.ObjectType = from?.ObjectTypeId;
- add.OptType = from?.OptTypeId;
- add.ChildrenType = from?.ChildrenTypeId;
- add.ModuleType = from?.ModuleTypeId;
- }
- catch (Exception)
- {
- throw new BusinessValidationFailedException("操作标识异常");
- }
+ var from = await _dbContext.FrontAuditConfig.FirstOrDefaultAsync(x => x.Identification == add.Identification);
+ add.ObjectType = from?.ObjectTypeId;
+ add.OptType = from?.OptTypeId;
+ add.ChildrenType = from?.ChildrenTypeId;
+ add.ModuleType = from?.ModuleTypeId;
+
#endregion
if (add.ParentId == null)
{
add.ParentId = (await _dbContext.DataInspection.AsQueryable().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId && x.VisitStageId == add.VisitStageId && x.GeneralId == add.GeneralId).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
-
}
add.CreateUserId = _userInfo.Id;
add.IP = _userInfo.IP;
- if (add.CreateTime == default(DateTime))
- {
- add.CreateTime = DateTime.Now;
- }
+ add.CreateTime = add.CreateTime == default(DateTime) ? DateTime.Now : add.CreateTime;
- if (_userInfo.SignId!=null)
+ if (_userInfo.SignId != null)
{
add.SignId = _userInfo.SignId;
add.IsSign = true;
@@ -952,11 +944,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
var inspectionData = new InspectionData()
{
- Data = AddJsonItem(data,otherItem),
+ Data = AddJsonItem(data, otherItem),
Inspection = generalData
};
add.JsonDetail = inspectionData.ToJcJson();
-
+
await _dbContext.DataInspection.AddAsync(add);
}