|
@@ -53,6 +53,7 @@ using Hotline.Share.Enums.FlowEngine;
|
|
|
using Hotline.Share.Enums.Order;
|
|
|
using Hotline.Share.Enums.Push;
|
|
|
using Hotline.Share.Enums.Settings;
|
|
|
+using Hotline.Share.Enums.Snapshot;
|
|
|
using Hotline.Share.Mq;
|
|
|
using Hotline.Share.Requests;
|
|
|
using Hotline.Share.Tools;
|
|
@@ -165,6 +166,7 @@ public class OrderController : BaseController
|
|
|
private readonly ICircularRecordDomainService _circularRecordDomainService;
|
|
|
private readonly IRepository<Hotline.Special.SpecialNumber> _specialNumberRepository;
|
|
|
private readonly IRepository<OrderVisitDetailCopy> _orderVisitDetailCopyRepository;
|
|
|
+ private readonly IRedPackAuditRepository _redPackAuditRepository;
|
|
|
|
|
|
public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
@@ -241,6 +243,7 @@ public class OrderController : BaseController
|
|
|
IRepository<SystemOrganize> systemOrganizeRepository,
|
|
|
IRepository<OrderComplement> orderComplementRepository,
|
|
|
ICircularRecordDomainService circularRecordDomainService,
|
|
|
+ IRedPackAuditRepository redPackAuditRepository,
|
|
|
IRepository<Hotline.Special.SpecialNumber> specialNumberRepository,
|
|
|
IRepository<OrderVisitDetailCopy> orderVisitDetailCopyRepository)
|
|
|
{
|
|
@@ -318,6 +321,7 @@ public class OrderController : BaseController
|
|
|
_systemOrganizeRepository = systemOrganizeRepository;
|
|
|
_orderComplementRepository = orderComplementRepository;
|
|
|
_circularRecordDomainService = circularRecordDomainService;
|
|
|
+ _redPackAuditRepository = redPackAuditRepository;
|
|
|
_specialNumberRepository = specialNumberRepository;
|
|
|
_orderVisitDetailCopyRepository = orderVisitDetailCopyRepository;
|
|
|
}
|
|
@@ -5137,69 +5141,91 @@ public class OrderController : BaseController
|
|
|
public async Task<string> OrderSignBathAsync([FromBody] OrderSignBathInDto dto)
|
|
|
{
|
|
|
var stringBuilder = new StringBuilder();
|
|
|
- foreach (var orderId in dto.OrderIds)
|
|
|
+ if (dto.Status == 1)
|
|
|
{
|
|
|
- var order = await _orderRepository.GetAsync(orderId, HttpContext.RequestAborted);
|
|
|
- if (order is null)
|
|
|
+ foreach (var orderId in dto.OrderIds)
|
|
|
{
|
|
|
- continue;
|
|
|
- }
|
|
|
+ var order = await _orderRepository.GetAsync(orderId, HttpContext.RequestAborted);
|
|
|
+ if (order is null)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- var snapshot = await _orderSnapshotApplication.UpdateSafetyAsync(orderId, dto.IsSafetyDepartment, dto.Remark);
|
|
|
- if (snapshot is null)
|
|
|
- {
|
|
|
- stringBuilder.Append($"随手拍: {order.No} 不存在");
|
|
|
- continue;
|
|
|
- }
|
|
|
+ var snapshot = await _orderSnapshotApplication.UpdateSafetyAsync(orderId, dto.IsSafetyDepartment, dto.Remark);
|
|
|
+ if (snapshot is null)
|
|
|
+ {
|
|
|
+ stringBuilder.Append($"随手拍: {order.No} 不存在");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- var workflow = await _workflowDomainService.GetWorkflowAsync(order.WorkflowId, withDefine: true, withSteps: true, withTraces: true,
|
|
|
- cancellationToken: HttpContext.RequestAborted);
|
|
|
+ var workflow = await _workflowDomainService.GetWorkflowAsync(order.WorkflowId, withDefine: true, withSteps: true, withTraces: true,
|
|
|
+ cancellationToken: HttpContext.RequestAborted);
|
|
|
|
|
|
- NextStepsWithOpinionDto<NextStepOption> nextSteps;
|
|
|
- try
|
|
|
- {
|
|
|
- nextSteps = await _workflowApplication.GetNextStepsAsync(order.WorkflowId, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
- catch (UserFriendlyException e)
|
|
|
- {
|
|
|
- if (e.Message.Contains("未找到对应节点"))
|
|
|
+ NextStepsWithOpinionDto<NextStepOption> nextSteps;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ nextSteps = await _workflowApplication.GetNextStepsAsync(order.WorkflowId, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ catch (UserFriendlyException e)
|
|
|
{
|
|
|
- stringBuilder.AppendLine($"{order.No} 修改成功");
|
|
|
+ if (e.Message.Contains("未找到对应节点"))
|
|
|
+ {
|
|
|
+ stringBuilder.AppendLine($"{order.No} 修改成功");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+
|
|
|
+ var stepInfo = nextSteps.Steps.FirstOrDefault(m => m.BusinessType == EBusinessType.Send);
|
|
|
+ if (stepInfo == null)
|
|
|
+ {
|
|
|
+ stringBuilder.Append($"下一步节点: [派单组] 未找到");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- throw;
|
|
|
+ var data = new OrderHandleFlowDto
|
|
|
+ {
|
|
|
+ OrderId = orderId,
|
|
|
+ IsSafetyDepartment = dto.IsSafetyDepartment
|
|
|
+ };
|
|
|
+ var workflowDto = new NextWorkflowDto
|
|
|
+ {
|
|
|
+ WorkflowId = order.WorkflowId,
|
|
|
+ StepId = nextSteps.StepId,
|
|
|
+ NextStepCode = stepInfo.Key,
|
|
|
+ NextStepName = stepInfo.Value,
|
|
|
+ Opinion = dto.Remark,
|
|
|
+ BackToCountersignEnd = false,
|
|
|
+ IsSms = false,
|
|
|
+ IsForwarded = false,
|
|
|
+ HandlerType = EHandlerType.OrgLevel,
|
|
|
+ BusinessType = EBusinessType.Send,
|
|
|
+ FlowDirection = EFlowDirection.CenterToCenter,
|
|
|
+ };
|
|
|
+ var startStep = workflow.Steps.First(d => d.Id == nextSteps.StepId);
|
|
|
+ await HandleOrderAsync(order, workflow, startStep, data, workflowDto, HttpContext.RequestAborted);
|
|
|
+ stringBuilder.AppendLine($"{orderId} 标注完成;");
|
|
|
}
|
|
|
-
|
|
|
- var stepInfo = nextSteps.Steps.FirstOrDefault(m => m.BusinessType == EBusinessType.Send);
|
|
|
- if (stepInfo == null)
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var orderNo = await _redPackAuditRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((m , order) => m.OrderId == order.Id)
|
|
|
+ .Where(m => dto.OrderIds.Contains(m.OrderId) && m.Status != ERedPackAuditStatus.Pending)
|
|
|
+ .Select((m, order) => order.No)
|
|
|
+ .ToListAsync();
|
|
|
+ if (orderNo.NotNullOrEmpty())
|
|
|
+ stringBuilder.AppendLine(string.Join(',', orderNo) + " 该工单已红包审批,无法修改标记状态!");
|
|
|
+ else
|
|
|
{
|
|
|
- stringBuilder.Append($"下一步节点: [派单组] 未找到");
|
|
|
- continue;
|
|
|
+ await _orderSnapshotRepository.Updateable()
|
|
|
+ .SetColumns(m => m.IsSafetyDepartment, dto.IsSafetyDepartment)
|
|
|
+ .SetColumns(m => m.SignRemark, dto.Remark)
|
|
|
+ .Where(m => dto.OrderIds.Contains(m.Id))
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ stringBuilder.AppendLine("标注完成;");
|
|
|
}
|
|
|
-
|
|
|
- var data = new OrderHandleFlowDto
|
|
|
- {
|
|
|
- OrderId = orderId,
|
|
|
- IsSafetyDepartment = dto.IsSafetyDepartment
|
|
|
- };
|
|
|
- var workflowDto = new NextWorkflowDto
|
|
|
- {
|
|
|
- WorkflowId = order.WorkflowId,
|
|
|
- StepId = nextSteps.StepId,
|
|
|
- NextStepCode = stepInfo.Key,
|
|
|
- NextStepName = stepInfo.Value,
|
|
|
- Opinion = dto.Remark,
|
|
|
- BackToCountersignEnd = false,
|
|
|
- IsSms = false,
|
|
|
- IsForwarded = false,
|
|
|
- HandlerType = EHandlerType.OrgLevel,
|
|
|
- BusinessType = EBusinessType.Send,
|
|
|
- FlowDirection = EFlowDirection.CenterToCenter,
|
|
|
- };
|
|
|
- var startStep = workflow.Steps.First(d => d.Id == nextSteps.StepId);
|
|
|
- await HandleOrderAsync(order, workflow, startStep, data, workflowDto, HttpContext.RequestAborted);
|
|
|
- stringBuilder.AppendLine($"{orderId} 标注完成;");
|
|
|
}
|
|
|
|
|
|
return stringBuilder.ToString();
|