修改一版
parent
9c48f46ca4
commit
a68360a07c
|
@ -4336,6 +4336,13 @@
|
||||||
<param name="inDto"></param>
|
<param name="inDto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.UpdateTrialCriterion(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
更改项目标准
|
||||||
|
</summary>
|
||||||
|
<param name="systemCriterionId"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.AddSystemQuestionCriterion">
|
<member name="M:IRaCIS.Application.Services.ReadingQuestionService.AddSystemQuestionCriterion">
|
||||||
<summary>
|
<summary>
|
||||||
添加系统qc问题标准
|
添加系统qc问题标准
|
||||||
|
|
|
@ -155,10 +155,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||||
{
|
{
|
||||||
query = query.Where(x => x.InPlan == false);
|
query = query.Where(x => x.InPlan == false);
|
||||||
}
|
}
|
||||||
|
return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField.IsNullOrEmpty()?nameof(GetDataInspectionOutDto.CreateTime): dto.SortField, dto.Asc);
|
||||||
|
|
||||||
dto.Asc = false;
|
|
||||||
return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize,"CreateTime", dto.Asc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -108,21 +108,52 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task<IResponseOutput> SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto)
|
public async Task<IResponseOutput> SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!inDto.IsCompleteConfig && await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id))
|
//if (!inDto.IsCompleteConfig && await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id))
|
||||||
{
|
//{
|
||||||
ResponseOutput.NotOk("当前标准已经运用到项目,操作失败");
|
// ResponseOutput.NotOk("当前标准已经运用到项目,操作失败");
|
||||||
}
|
//}
|
||||||
|
|
||||||
await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem()
|
await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem()
|
||||||
{
|
{
|
||||||
IsCompleteConfig = inDto.IsCompleteConfig
|
IsCompleteConfig = inDto.IsCompleteConfig
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (inDto.IsCompleteConfig)
|
||||||
|
{
|
||||||
|
await UpdateTrialCriterion(inDto.Id);
|
||||||
|
}
|
||||||
var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync();
|
var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok(result);
|
return ResponseOutput.Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更改项目标准
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="systemCriterionId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task UpdateTrialCriterion(Guid systemCriterionId)
|
||||||
|
{
|
||||||
|
await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == systemCriterionId, x => new ReadingQuestionCriterionTrial()
|
||||||
|
{
|
||||||
|
IsCompleteConfig = true,
|
||||||
|
});
|
||||||
|
var systemCriterionQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == systemCriterionId).ToListAsync();
|
||||||
|
var trialCriterionList = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == systemCriterionId).Select(x => new {
|
||||||
|
x.Id,
|
||||||
|
x.TrialId,
|
||||||
|
}).ToListAsync();
|
||||||
|
var trialCriterionIdList = trialCriterionList.Select(x => x.Id).ToList();
|
||||||
|
List<ReadingQuestionTrial> needAddQuestionList = new List<ReadingQuestionTrial>();
|
||||||
|
foreach (var item in trialCriterionList)
|
||||||
|
{
|
||||||
|
await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => trialCriterionIdList.Contains(x.ReadingQuestionCriterionTrialId));
|
||||||
|
List<ReadingQuestionTrial> trialQuestionList = new List<ReadingQuestionTrial>();
|
||||||
|
SetChildParentQuestion(item.Id, item.TrialId, systemCriterionQuestionList, trialQuestionList);
|
||||||
|
needAddQuestionList.AddRange(trialQuestionList);
|
||||||
|
}
|
||||||
|
await _readingQuestionTrialRepository.AddRangeAsync(needAddQuestionList);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加系统qc问题标准
|
/// 添加系统qc问题标准
|
||||||
|
|
Loading…
Reference in New Issue