修改代码

Uat_Study
he 2022-04-07 09:55:44 +08:00
parent 59f5dc4944
commit 8b3030539e
7 changed files with 79 additions and 30 deletions

View File

@ -59,6 +59,17 @@ namespace IRaCIS.Core.Application.ViewModel
public string ByTrialConfig { get; set; } = string.Empty; public string ByTrialConfig { get; set; } = string.Empty;
/// <summary>
/// 是否向前站位
/// </summary>
public bool? IsForwardPosition { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; }
} }
@ -134,6 +145,17 @@ namespace IRaCIS.Core.Application.ViewModel
public string ByTrialConfig { get; set; } = string.Empty; public string ByTrialConfig { get; set; } = string.Empty;
/// <summary>
/// 是否向前站位
/// </summary>
public bool? IsForwardPosition { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; } = string.Empty;
} }

View File

@ -132,7 +132,9 @@ namespace IRaCIS.Core.Application.Service
ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN, ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN,
IsShowByTrialConfig =data.IsShowByTrialConfig, IsShowByTrialConfig =data.IsShowByTrialConfig,
ByTrialConfig=data.ByTrialConfig, ByTrialConfig=data.ByTrialConfig,
}; IsForwardPosition=data.IsForwardPosition,
Identification=data.Identification,
};
query = query query = query
.WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value)
@ -161,6 +163,17 @@ namespace IRaCIS.Core.Application.Service
// CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap(); // CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap();
if (await _frontAuditConfigRepository.AnyAsync(x => x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M"))
{
return ResponseOutput.NotOk("标识重复");
}
if (await _frontAuditConfigRepository.AnyAsync(x => x.Description == addOrEditFrontAuditConfig.Description && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M"))
{
return ResponseOutput.NotOk("名称重复");
}
addOrEditFrontAuditConfig.CreateTime= DateTime.Now; addOrEditFrontAuditConfig.CreateTime= DateTime.Now;
addOrEditFrontAuditConfig.UpdateTime= DateTime.Now; addOrEditFrontAuditConfig.UpdateTime= DateTime.Now;
addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id; addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id;

View File

@ -86,6 +86,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
/// </summary> /// </summary>
public string ObjectType { get; set; } = string.Empty; public string ObjectType { get; set; } = string.Empty;
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; } = string.Empty;
////需要单独处理 ////需要单独处理
//public string IP { get; set; } //public string IP { get; set; }

View File

@ -46,35 +46,29 @@ namespace IRaCIS.Core.Application.Service.Inspection
join moduleTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = moduleTyped.Id, ModuleType = data.ModuleType } equals new { ParentId = moduleTypec.ParentId.Value, ModuleType = moduleTypec.Value } into moduleTypectemp join moduleTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = moduleTyped.Id, ModuleType = data.ModuleType } equals new { ParentId = moduleTypec.ParentId.Value, ModuleType = moduleTypec.Value } into moduleTypectemp
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty() from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
join childrenTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ChildrenType") on 1 equals 1 //join childrenTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ChildrenType") on 1 equals 1
join childrenTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp //join childrenTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = childrenTyped.Id, ModuleType = data.ChildrenType } equals new { ParentId = childrenTypec.ParentId.Value, ModuleType = childrenTypec.Value } into childrenTypectemp
from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty() //from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
join ObjectTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ObjectType") on 1 equals 1 //join ObjectTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "ObjectType") on 1 equals 1
join ObjectTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp //join ObjectTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = ObjectTyped.Id, ModuleType = data.ObjectType } equals new { ParentId = ObjectTypec.ParentId.Value, ModuleType = ObjectTypec.Value } into objectTypetemp
from leftObjectType in objectTypetemp.DefaultIfEmpty() //from leftObjectType in objectTypetemp.DefaultIfEmpty()
join OptTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "OptType") on 1 equals 1 //join OptTyped in _repository.GetQueryable<Dictionary>().Where(x => x.Code == "OptType") on 1 equals 1
join OptTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp //join OptTypec in _repository.GetQueryable<Dictionary>() on new { ParentId = OptTyped.Id, ModuleType = data.OptType } equals new { ParentId = OptTypec.ParentId.Value, ModuleType = OptTypec.Value } into optTypetemp
from leftOptType in optTypetemp.DefaultIfEmpty() //from leftOptType in optTypetemp.DefaultIfEmpty()
join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp
from lefttrialSign in trialSigntemp.DefaultIfEmpty() from lefttrialSign in trialSigntemp.DefaultIfEmpty()
join frontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M") on new join frontAuditConfig in _repository.GetQueryable<FrontAuditConfig>().Where(x=>x.ConfigType=="M"&&!x.Identification.IsNullOrEmpty()) on new
{ {
ModuleTypeId = leftmoduleTypec.Id.ToString(), data.Identification
ChildrenTypeId = leftchildrenTypec.Id.ToString(),
ObjectTypeId = leftObjectType.Id.ToString(),
OptTypeId = leftOptType.Id.ToString(),
} equals new } equals new
{ {
frontAuditConfig.ModuleTypeId, frontAuditConfig.Identification,
frontAuditConfig.ChildrenTypeId,
frontAuditConfig.ObjectTypeId,
frontAuditConfig.OptTypeId,
} into frontAuditConfigtemp } into frontAuditConfigtemp
from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty() from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty()
@ -254,12 +248,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <param name="signId">签名Id</param> /// <param name="signId">签名Id</param>
/// <param name="Statusdata">初始化状态对象</param> /// <param name="Statusdata">初始化状态对象</param>
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null) public async Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId=null, object? Statusdata = null)
{ {
await SetEnum(addDto); await SetEnum(addDto);
var add = _mapper.Map<DataInspection>(addDto); var add = _mapper.Map<DataInspection>(addDto);
Guid? parentId = null; Guid? parentId = null;
parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ModuleType==add.ModuleType&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id; parentId = (await _repository.GetQueryable<DataInspection>().Where(x => x.TrialId == add.TrialId && x.SubjectVisitId == add.SubjectVisitId && x.SubjectId == add.SubjectId && x.SiteId == add.SiteId&&x.ChildrenType==add.ChildrenType && x.ObjectType==add.ObjectType).OrderByDescending(x => x.CreateTime).FirstOrDefaultAsync())?.Id;
add.ParentId = parentId; add.ParentId = parentId;
add.CreateTime = DateTime.Now; add.CreateTime = DateTime.Now;
add.CreateUserId = _userInfo.Id; add.CreateUserId = _userInfo.Id;
@ -269,8 +263,6 @@ namespace IRaCIS.Core.Application.Service.Inspection
await _repository.AddAsync(add); await _repository.AddAsync(add);
if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null) if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null)
{ {
DataInspection ststus=JsonConvert.DeserializeObject<DataInspection>(JsonConvert.SerializeObject(add))??new DataInspection(); DataInspection ststus=JsonConvert.DeserializeObject<DataInspection>(JsonConvert.SerializeObject(add))??new DataInspection();
ststus.CreateTime = add.CreateTime.AddSeconds(1); ststus.CreateTime = add.CreateTime.AddSeconds(1);
ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata); ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata);
@ -309,7 +301,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
{ {
guids.Add(Guid.Parse(x.ToString())); guids.Add(Guid.Parse(x.ToString()));
}); });
JsonData[item.Key] = string.Join(',', await _repository.GetQueryable<Dictionary>().Where(x => guids.Contains(x.Id)).Select(x => x.Value).ToListAsync()); JsonData[item.Key] = string.Join(',', await _repository.GetQueryable<Dictionary>().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
} }
else else
{ {
@ -325,7 +317,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
parent = b parent = b
}).SelectMany(a => a.parent, (m, n) => new }).SelectMany(a => a.parent, (m, n) => new
{ {
value = n.Value value = n.ValueCN
}).Select(x => x.value).ToListAsync() }).Select(x => x.value).ToListAsync()
); );
} }
@ -335,13 +327,13 @@ namespace IRaCIS.Core.Application.Service.Inspection
if (item.Type.ToLower() == "id".ToLower()) if (item.Type.ToLower() == "id".ToLower())
{ {
Guid guid = Guid.Parse(value.ToString()); Guid guid = Guid.Parse(value.ToString());
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.Value).FirstOrDefaultAsync(); JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
} }
else else
{ {
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable<Dictionary>().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable<Dictionary>().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
{ {
value=b.Value value=b.ValueCN
}).Select(x=>x.value).FirstOrDefaultAsync(); }).Select(x=>x.value).FirstOrDefaultAsync();
} }

View File

@ -21,8 +21,9 @@ namespace IRaCIS.Core.Application.Service.Inspection.Interface
Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response = null, object? Statusdata = null); Task<dynamic> Enforcement(dynamic OptCommand, DataInspectionAddDTO AuditInfo, SignDTO SignInfo, dynamic fun, IResponseOutput? response = null, object? Statusdata = null);
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null);
Task SetEnum(DataInspectionAddDTO Data); Task SetEnum(DataInspectionAddDTO Data);
Task<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId = null, object? Statusdata = null);
} }
} }

View File

@ -116,6 +116,16 @@ namespace IRaCIS.Core.Domain.Models
public string ByTrialConfig { get; set; } public string ByTrialConfig { get; set; }
/// <summary>
/// 是否向前站位
/// </summary>
public bool? IsForwardPosition { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; }
} }

View File

@ -144,6 +144,11 @@ namespace IRaCIS.Core.Domain.Models
/// </summary> /// </summary>
public string ObjectType { get; set; } public string ObjectType { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; }
} }