|
@@ -147,7 +147,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign, startStep, firstSteps.First());
|
|
|
|
|
|
//发起会签时记录顶层会签节点(必须在update currentStep之后)
|
|
|
- if (dto.IsStartCountersign && !workflow.IsInCountersign())
|
|
|
+ if (dto.IsStartCountersign && !workflow.IsInCountersign)
|
|
|
workflow.StartCountersign(startStep.Id, counterSignType);
|
|
|
|
|
|
//更新实际办理节点信息
|
|
@@ -337,28 +337,50 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
}
|
|
|
|
|
|
//操作为回到会签汇总时,更新开始会签节点的会签办理状态
|
|
|
- if (currentStep.IsInCountersign() && dto.BackToCountersignEnd)
|
|
|
+ //if (currentStep.IsInCountersign() && dto.BackToCountersignEnd)
|
|
|
+ //{
|
|
|
+ // var targetStep = currentStep;
|
|
|
+ // if (currentStep.IsCountersignEndStep)
|
|
|
+ // {
|
|
|
+ // var csStartStep = workflow.Steps.FirstOrDefault(d => d.Id == currentStep.CountersignStartStepId);
|
|
|
+ // if (csStartStep is null)
|
|
|
+ // throw new UserFriendlyException("未查询到会签开始节点");
|
|
|
+ // targetStep = csStartStep;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // PrevStepCsHandled(workflow, targetStep, ref updateSteps);
|
|
|
+ //}
|
|
|
+
|
|
|
+ if (currentStep.IsInCountersign())
|
|
|
{
|
|
|
- var targetStep = currentStep;
|
|
|
if (currentStep.IsCountersignEndStep)
|
|
|
{
|
|
|
var csStartStep = workflow.Steps.FirstOrDefault(d => d.Id == currentStep.CountersignStartStepId);
|
|
|
if (csStartStep is null)
|
|
|
throw new UserFriendlyException("未查询到会签开始节点");
|
|
|
- targetStep = csStartStep;
|
|
|
- }
|
|
|
-
|
|
|
- var countersignStartStep = workflow.Steps.FirstOrDefault(d => d.Id == targetStep.PrevStepId);
|
|
|
- if (countersignStartStep is null)
|
|
|
- throw new UserFriendlyException("未查询到目标节点的前一节点");
|
|
|
|
|
|
- var csStep = countersignStartStep.CountersignSteps.FirstOrDefault(d => d.StepId == targetStep.Id);
|
|
|
- if (csStep is null)
|
|
|
- throw new UserFriendlyException("未查询到当前待办节点");
|
|
|
- csStep.Completed = true;
|
|
|
- updateSteps.Add(countersignStartStep);
|
|
|
+ if (currentStep.IsTopCountersignEndStep(workflow.TopCountersignStepId))
|
|
|
+ {
|
|
|
+ var csStep = csStartStep.CountersignSteps.FirstOrDefault(d => d.StepId == currentStep.Id);
|
|
|
+ if (csStep is null)
|
|
|
+ throw new UserFriendlyException("未查询到当前待办节点");
|
|
|
+ csStep.Completed = true;
|
|
|
+ updateSteps.Add(csStartStep);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //汇总节点(非顶级)
|
|
|
+ PrevStepCsHandled(workflow, csStartStep, ref updateSteps);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (dto.BackToCountersignEnd)
|
|
|
+ {
|
|
|
+ //普通节点里面流向汇总节点的
|
|
|
+ PrevStepCsHandled(workflow, currentStep, ref updateSteps);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
await _workflowStepRepository.UpdateRangeAsync(updateSteps, cancellationToken);
|
|
|
|
|
|
await NextTraceAsync(workflow, dto, currentStep, cancellationToken);
|
|
@@ -369,7 +391,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
//检查会签是否结束,并更新当前会签节点字段
|
|
|
var isCountersignOver = false;
|
|
|
- if (workflow.IsInCountersign() && currentStep.IsCountersignEndStep)
|
|
|
+ if (workflow.IsInCountersign && currentStep.IsCountersignEndStep)
|
|
|
{
|
|
|
isCountersignOver = workflow.CheckIfCountersignOver();
|
|
|
if (isCountersignOver)
|
|
@@ -415,7 +437,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
workflow.UpdateWorkflowCurrentStepInfo(dto.IsStartCountersign, currentStep, nextSteps?.FirstOrDefault());
|
|
|
|
|
|
//发起会签时记录顶层会签节点
|
|
|
- if (dto.IsStartCountersign && !workflow.IsInCountersign())
|
|
|
+ if (dto.IsStartCountersign && !workflow.IsInCountersign)
|
|
|
workflow.StartCountersign(currentStep.Id, counterSignType);
|
|
|
|
|
|
//更新指派信息
|
|
@@ -437,6 +459,20 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //更新目标节点前一节点的会签办理完成状态
|
|
|
+ private void PrevStepCsHandled(Workflow workflow, WorkflowStep targetStep, ref List<WorkflowStep> updateSteps)
|
|
|
+ {
|
|
|
+ var prevStep = workflow.Steps.FirstOrDefault(d => d.Id == targetStep.PrevStepId);
|
|
|
+ if (prevStep is null)
|
|
|
+ throw new UserFriendlyException("未查询到目标节点的前一节点");
|
|
|
+
|
|
|
+ var csStep = prevStep.CountersignSteps.FirstOrDefault(d => d.StepId == targetStep.Id);
|
|
|
+ if (csStep is null)
|
|
|
+ throw new UserFriendlyException("未查询到当前待办节点");
|
|
|
+ csStep.Completed = true;
|
|
|
+ updateSteps.Add(prevStep);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 创建下1/N个节点
|
|
|
/// </summary>
|
|
@@ -586,7 +622,7 @@ namespace Hotline.FlowEngine.Workflows
|
|
|
{
|
|
|
ValidatePermission(workflow);
|
|
|
CheckWhetherRunnable(workflow.Status);
|
|
|
- if (workflow.IsInCountersign())
|
|
|
+ if (workflow.IsInCountersign)
|
|
|
throw UserFriendlyException.SameMessage("会签流程不支持退回");
|
|
|
|
|
|
var currentStep = GetUnHandleStep(workflow.Steps, _sessionContext.RequiredOrgId, _sessionContext.RequiredUserId);
|