田爽 1 рік тому
батько
коміт
16b0cadece

+ 3 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -1506,7 +1506,9 @@ public class OrderController : BaseController
             List<RepeatableEventDetail> repeatables = _mapper.Map<List<RepeatableEventDetail>>(dto.RepeatableEventDetails);
             await _repeatableEventDetailRepository.AddRangeAsync(repeatables, HttpContext.RequestAborted);
         }
-        return orderId;
+        //写入质检
+        if(!string.IsNullOrEmpty(orderId)) await _qualityRepository.AddQualityAsync(EQualitySource.Accepted, orderId, HttpContext.RequestAborted);
+		return orderId;
     }
 
     [HttpPost("add")]

+ 12 - 4
src/Hotline.Application/Handlers/FlowEngine/NextStepHandler.cs

@@ -6,6 +6,7 @@ using Hotline.FlowEngine.WorkflowModules;
 using Hotline.FlowEngine.Workflows;
 using Hotline.KnowledgeBase;
 using Hotline.Orders;
+using Hotline.Quality;
 using Hotline.Repository.SqlSugar.CallCenter;
 using Hotline.Repository.SqlSugar.Orders;
 using Hotline.Settings;
@@ -15,10 +16,12 @@ using Hotline.Share.Dtos.Order;
 using Hotline.Share.Dtos.Settings;
 using Hotline.Share.Enums.FlowEngine;
 using Hotline.Share.Enums.Order;
+using Hotline.Share.Enums.Quality;
 using Hotline.Share.Enums.Settings;
 using Hotline.Share.Mq;
 using MapsterMapper;
 using MediatR;
+using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
 using XF.Domain.Entities;
@@ -38,8 +41,9 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
     private readonly IMapper _mapper;
     private readonly ILogger<NextStepHandler> _logger;
     private readonly IRepository<OrderScreen> _orderScreenRepository;
+    private readonly IQualityRepository _qualityRepository;
 
-    public NextStepHandler(
+	public NextStepHandler(
         IOrderDomainService orderDomainService,
         IKnowledgeDomainService knowledgeDomainService,
         IOrderRepository orderRepository,
@@ -48,7 +52,8 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
         ICapPublisher capPublisher,
         IMapper mapper,
         ILogger<NextStepHandler> logger,
-        IRepository<OrderScreen> orderScreenRepository)
+        IRepository<OrderScreen> orderScreenRepository,
+        IQualityRepository qualityRepository)
     {
         _orderDomainService = orderDomainService;
         _knowledgeDomainService = knowledgeDomainService;
@@ -59,7 +64,8 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
         _mapper = mapper;
         _logger = logger;
         _orderScreenRepository = orderScreenRepository;
-    }
+        _qualityRepository = qualityRepository;
+	}
 
     /// <summary>Handles a notification</summary>
     /// <param name="notification">The notification</param>
@@ -100,7 +106,9 @@ public class NextStepHandler : INotificationHandler<NextStepNotify>
                     else if (data.FlowDirection is EFlowDirection.CenterToOrg)
                     {
                         order.CenterToOrg(expiredTime.EndTime);
-                    }
+                        //写入质检
+                        await _qualityRepository.AddQualityAsync(EQualitySource.Send, order.Id, cancellationToken);
+					}
 
                     await _workflowDomainService.UpdateExpiredTimeAsync(workflow, expiredTime.EndTime,
                         expiredTime.RuleStr, data.External.TimeLimit, data.External.TimeLimitUnit, cancellationToken);