|
@@ -3693,10 +3693,25 @@ public class OrderController : BaseController
|
|
|
.Queryable()
|
|
|
.Includes(d => d.Workflow)
|
|
|
.FirstAsync(d => d.Id == workflow.ExternalId);
|
|
|
- if (oneSendBack || twoSendBack)
|
|
|
+ var (currentStep, prevStep, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
+ dto.WorkflowId, _sessionContext.RequiredUserId, _sessionContext.RequiredOrgId, _sessionContext.Roles, HttpContext.RequestAborted);
|
|
|
+ var audit = new OrderSendBackAudit
|
|
|
+ {
|
|
|
+ OrderId = workflow.ExternalId,
|
|
|
+ State = ESendBackAuditState.Apply,
|
|
|
+ Content = dto.Opinion,
|
|
|
+ SendBackData = dto,
|
|
|
+ ApplyOrgId = currentStep.AcceptorOrgId,
|
|
|
+ ApplyOrgName = currentStep!.AcceptorOrgName,
|
|
|
+ SendBackOrgId = prevStep.HandlerOrgId, //prevStep.AcceptorOrgId,
|
|
|
+ SendBackOrgName = prevStep.HandlerOrgName, //prevStep!.AcceptorOrgName,
|
|
|
+ WorkflowOrgId = _sessionContext.RequiredOrgId,
|
|
|
+ WorkflowUserId = _sessionContext.RequiredUserId,
|
|
|
+ WorkflowRoleIds = _sessionContext.Roles.ToList(),
|
|
|
+ TraceId = currentStep.Id
|
|
|
+ };
|
|
|
+ if (oneSendBack || twoSendBack)
|
|
|
{
|
|
|
- var (currentStep, prevStep, isOrgToCenter, isSecondToFirstOrgLevel) = await _workflowApplication.GetPreviousInformationAsync(
|
|
|
- dto.WorkflowId, _sessionContext.RequiredUserId, _sessionContext.RequiredOrgId, _sessionContext.Roles, HttpContext.RequestAborted);
|
|
|
var sendBack = await _orderSendBackAuditRepository.Queryable()
|
|
|
.Where(x => x.OrderId == workflow.ExternalId && x.State == ESendBackAuditState.Apply).AnyAsync();
|
|
|
if (sendBack)
|
|
@@ -3705,33 +3720,19 @@ public class OrderController : BaseController
|
|
|
var specialAny = await _orderSpecialRepository.Queryable().Where(x => x.OrderId == dto.OrderId && x.State == 0)
|
|
|
.AnyAsync();
|
|
|
if (specialAny) throw UserFriendlyException.SameMessage("工单已存在待审批特提信息!");
|
|
|
-
|
|
|
-
|
|
|
if (order.Workflow.IsInCountersign) throw UserFriendlyException.SameMessage("工单会签中,无法进行退回!");
|
|
|
if ((oneSendBack && isOrgToCenter) || (twoSendBack && isSecondToFirstOrgLevel))
|
|
|
{
|
|
|
- var audit = new OrderSendBackAudit
|
|
|
- {
|
|
|
- OrderId = workflow.ExternalId,
|
|
|
- State = ESendBackAuditState.Apply,
|
|
|
- Content = dto.Opinion,
|
|
|
- SendBackData = dto,
|
|
|
- ApplyOrgId = currentStep.AcceptorOrgId,
|
|
|
- ApplyOrgName = currentStep!.AcceptorOrgName,
|
|
|
- SendBackOrgId = prevStep.HandlerOrgId, //prevStep.AcceptorOrgId,
|
|
|
- SendBackOrgName = prevStep.HandlerOrgName, //prevStep!.AcceptorOrgName,
|
|
|
- WorkflowOrgId = _sessionContext.RequiredOrgId,
|
|
|
- WorkflowUserId = _sessionContext.RequiredUserId,
|
|
|
- WorkflowRoleIds = _sessionContext.Roles.ToList(),
|
|
|
- TraceId = currentStep.Id
|
|
|
- };
|
|
|
- await _orderSendBackAuditRepository.AddAsync(audit, HttpContext.RequestAborted);
|
|
|
+
|
|
|
await _orderRepository.Updateable().SetColumns(o => new Orders.Order() { Status = EOrderStatus.SendBackAudit })
|
|
|
.Where(o => o.Id == order.Id).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var flowDirection = await _workflowApplication.PreviousAsync(dto, HttpContext.RequestAborted);
|
|
|
+ audit.State = ESendBackAuditState.End;
|
|
|
+ audit.AuditUser ="默认通过";
|
|
|
+ audit.AuditTime = DateTime.Now;
|
|
|
+ var flowDirection = await _workflowApplication.PreviousAsync(dto, HttpContext.RequestAborted);
|
|
|
var processType = flowDirection == EFlowDirection.OrgToCenter || flowDirection == EFlowDirection.CenterToCenter
|
|
|
? EProcessType.Zhiban
|
|
|
: EProcessType.Jiaoban;
|
|
@@ -3742,7 +3743,10 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var flowDirection = await _workflowApplication.PreviousAsync(dto, HttpContext.RequestAborted);
|
|
|
+ audit.State = ESendBackAuditState.End;
|
|
|
+ audit.AuditUser = "默认通过";
|
|
|
+ audit.AuditTime = DateTime.Now;
|
|
|
+ var flowDirection = await _workflowApplication.PreviousAsync(dto, HttpContext.RequestAborted);
|
|
|
var processType = flowDirection == EFlowDirection.OrgToCenter || flowDirection == EFlowDirection.CenterToCenter
|
|
|
? EProcessType.Zhiban
|
|
|
: EProcessType.Jiaoban;
|
|
@@ -3750,7 +3754,8 @@ public class OrderController : BaseController
|
|
|
.Where(o => o.Id == order.Id).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
//发送短信TODO
|
|
|
}
|
|
|
- }
|
|
|
+ await _orderSendBackAuditRepository.AddAsync(audit, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 工单业务退回审批
|
|
@@ -4341,7 +4346,8 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
|
|
|
var reTransactNum = order.ReTransactNum.HasValue ? order.ReTransactNum.Value + 1 : 1;
|
|
|
- await _orderRepository.Updateable().SetColumns(o => new Orders.Order() { ProcessType = processType, ReTransactNum = reTransactNum, Status = EOrderStatus.BackToUnAccept }).Where(o => o.Id == order.Id)
|
|
|
+ var Status = model.StepType == EStepType.Start ? EOrderStatus.BackToUnAccept : EOrderStatus.SendBack;
|
|
|
+ await _orderRepository.Updateable().SetColumns(o => new Orders.Order() { ProcessType = processType, ReTransactNum = reTransactNum, Status = Status }).Where(o => o.Id == order.Id)
|
|
|
.ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
|
|
|
var visit = await _orderVisitRepository.GetAsync(x => x.OrderId == dto.OrderId && x.VisitState != EVisitState.None);
|