修改代码

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;
/// <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;
/// <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,
IsShowByTrialConfig =data.IsShowByTrialConfig,
ByTrialConfig=data.ByTrialConfig,
};
IsForwardPosition=data.IsForwardPosition,
Identification=data.Identification,
};
query = query
.WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value)
@ -160,7 +162,18 @@ namespace IRaCIS.Core.Application.Service
//CreateMap<FrontAuditConfig, FrontAuditConfigView>();
// 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.UpdateTime= DateTime.Now;
addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id;

View File

@ -86,6 +86,12 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
/// </summary>
public string ObjectType { get; set; } = string.Empty;
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; } = string.Empty;
////需要单独处理
//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
from leftmoduleTypec in moduleTypectemp.DefaultIfEmpty()
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
from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
//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
//from leftchildrenTypec in childrenTypectemp.DefaultIfEmpty()
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
from leftObjectType in objectTypetemp.DefaultIfEmpty()
//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
//from leftObjectType in objectTypetemp.DefaultIfEmpty()
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
from leftOptType in optTypetemp.DefaultIfEmpty()
//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
//from leftOptType in optTypetemp.DefaultIfEmpty()
join trialSign in _repository.GetQueryable<TrialSign>() on data.SignId equals trialSign.Id into trialSigntemp
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(),
ChildrenTypeId = leftchildrenTypec.Id.ToString(),
ObjectTypeId = leftObjectType.Id.ToString(),
OptTypeId = leftOptType.Id.ToString(),
data.Identification
} equals new
{
frontAuditConfig.ModuleTypeId,
frontAuditConfig.ChildrenTypeId,
frontAuditConfig.ObjectTypeId,
frontAuditConfig.OptTypeId,
frontAuditConfig.Identification,
} into frontAuditConfigtemp
from leftfrontAuditConfig in frontAuditConfigtemp.DefaultIfEmpty()
@ -254,12 +248,12 @@ namespace IRaCIS.Core.Application.Service.Inspection
/// <param name="signId">签名Id</param>
/// <param name="Statusdata">初始化状态对象</param>
/// <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);
var add = _mapper.Map<DataInspection>(addDto);
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.CreateTime = DateTime.Now;
add.CreateUserId = _userInfo.Id;
@ -269,8 +263,6 @@ namespace IRaCIS.Core.Application.Service.Inspection
await _repository.AddAsync(add);
if (addDto.OptType.ToLower() == "Add".ToLower()&& Statusdata!=null)
{
DataInspection ststus=JsonConvert.DeserializeObject<DataInspection>(JsonConvert.SerializeObject(add))??new DataInspection();
ststus.CreateTime = add.CreateTime.AddSeconds(1);
ststus.JsonDetail = JsonConvert.SerializeObject(Statusdata);
@ -309,7 +301,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
{
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
{
@ -325,7 +317,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
parent = b
}).SelectMany(a => a.parent, (m, n) => new
{
value = n.Value
value = n.ValueCN
}).Select(x => x.value).ToListAsync()
);
}
@ -335,13 +327,13 @@ namespace IRaCIS.Core.Application.Service.Inspection
if (item.Type.ToLower() == "id".ToLower())
{
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
{
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();
}

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<IResponseOutput> AddInspectionRecordAsync(DataInspectionAddDTO addDto, Guid? signId, object? Statusdata = null);
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; }
/// <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>
public string ObjectType { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identification { get; set; }
}