From fd9df6302c00270f6885b4315f721cb0b179e89f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Mon, 19 Aug 2024 10:55:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AE=A1=E6=A0=B8=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E5=A4=A7=E7=AE=80=E4=BA=91=E8=A7=84=E5=88=99=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.Module.Core/Utils/ApiFox.cs | 90 ++++++++----------- .../IRuleEngineService.cs | 17 ++-- .../DS.Module.DjyRulesEngine/RuleEngineReq.cs | 5 -- .../RuleEngineService.cs | 35 +++++++- .../TaskInteraction/IActionManagerService.cs | 2 - .../Booking/BookingActionExecutor.cs | 2 +- .../Booking/EDIActionExecutor.cs | 2 +- .../Booking/MailActionExecutor.cs | 3 +- .../TaskInteraction/ActionManagerService.cs | 29 +----- .../Op/Method/TaskInteraction/MailService.cs | 10 +-- .../TaskInteraction/SeaExportTaskService.cs | 14 +++ .../Op/Method/TaskInteraction/TaskService.cs | 49 ++++++++-- .../Controllers/TaskMailController.cs | 37 +------- 13 files changed, 143 insertions(+), 152 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs b/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs index a2c996b8..91e4851d 100644 --- a/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs +++ b/ds-wms-service/DS.Module.Core/Utils/ApiFox.cs @@ -84,11 +84,7 @@ namespace DS.Module.Core if (!queryString.IsNullOrEmpty()) url = url.LastOrDefault() == '?' ? url + queryString : url + "?" + queryString; - var result = await SendRequestAsync(HttpMethod.Get, url); - if (!result.Succeeded) - return DataResult.Failed(result.Message, result.MultiCode); - - var response = result.Data; + var response = await SendRequestAsync(HttpMethod.Get, url); T? data = default; if (response != null) { @@ -96,7 +92,7 @@ namespace DS.Module.Core data = JsonConvert.DeserializeObject(json); } - return new DataResult(result.Code, result.Message, data, result.MultiCode); + return DataResult.Success(data); } /// @@ -109,19 +105,15 @@ namespace DS.Module.Core /// 为null或空字符串 public async Task> PostAsync(string url, object? requestParams = null) { - var result = await SendRequestAsync(HttpMethod.Post, url, requestParams); - if (!result.Succeeded) - return DataResult.Failed(result.Message, result.MultiCode); - - var response = result.Data; + var response = await SendRequestAsync(HttpMethod.Post, url, requestParams); T? data = default; - if (response != null) + if (response != null) { string json = await response.Content.ReadAsStringAsync(); data = JsonConvert.DeserializeObject(json); } - - return new DataResult(result.Code, result.Message, data, result.MultiCode); + + return DataResult.Success(data); } /// @@ -134,7 +126,7 @@ namespace DS.Module.Core /// 为null /// 为null或空字符串 /// 不等于 GET/POST/PUT/Delete 中的任何一个请求方法 - public async Task> SendRequestAsync(HttpMethod method, string url, object? requestParams = null) + public async Task SendRequestAsync(HttpMethod method, string url, object? requestParams = null) { ArgumentNullException.ThrowIfNull(method); ArgumentException.ThrowIfNullOrEmpty(url); @@ -159,49 +151,39 @@ namespace DS.Module.Core RequestUri = reqUri }); - try + HttpResponseMessage? response = null; + if (method == HttpMethod.Get) { - HttpResponseMessage? response = null; - if (method == HttpMethod.Get) - { - response = await http.GetAsync(reqUri); - } - else if (method == HttpMethod.Post) - { - string json = JsonConvert.SerializeObject(requestParams); - var jsonRequest = new StringContent(json, Encoding.UTF8, "application/json"); - response = await http.PostAsync(reqUri, jsonRequest); - } - else if (method == HttpMethod.Put) - { - string json = JsonConvert.SerializeObject(requestParams); - var jsonRequest = new StringContent(json, Encoding.UTF8, "application/json"); - response = await http.PutAsync(reqUri, jsonRequest); - } - else if (method == HttpMethod.Delete) - { - response = await http.DeleteAsync(reqUri); - } - else - { - throw new NotSupportedException($"不支持的请求方法:{method.Method}"); - } - - OnCompleted(new CompleteEventArgs - { - RequestUri = reqUri, - Response = response - }); - - if (!response.IsSuccessStatusCode) - return DataResult.FailedData(response, string.Format(MultiLanguageConst.HttpRequestFailed, $"{response.StatusCode}")); - - return DataResult.Success(response); + response = await http.GetAsync(reqUri); + } + else if (method == HttpMethod.Post) + { + string json = JsonConvert.SerializeObject(requestParams); + var jsonRequest = new StringContent(json, Encoding.UTF8, "application/json"); + response = await http.PostAsync(reqUri, jsonRequest); + } + else if (method == HttpMethod.Put) + { + string json = JsonConvert.SerializeObject(requestParams); + var jsonRequest = new StringContent(json, Encoding.UTF8, "application/json"); + response = await http.PutAsync(reqUri, jsonRequest); } - catch (Exception ex) + else if (method == HttpMethod.Delete) { - return DataResult.Failed(ex.Message); + response = await http.DeleteAsync(reqUri); } + else + { + throw new NotSupportedException($"不支持的请求方法:{method.Method}"); + } + + OnCompleted(new CompleteEventArgs + { + RequestUri = reqUri, + Response = response + }); + + return response; } /// diff --git a/ds-wms-service/DS.Module.DjyRulesEngine/IRuleEngineService.cs b/ds-wms-service/DS.Module.DjyRulesEngine/IRuleEngineService.cs index 868d9745..7b85884f 100644 --- a/ds-wms-service/DS.Module.DjyRulesEngine/IRuleEngineService.cs +++ b/ds-wms-service/DS.Module.DjyRulesEngine/IRuleEngineService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DS.Module.DjyRulesEngine +namespace DS.Module.DjyRulesEngine { public interface IRuleEngineService { @@ -13,6 +7,13 @@ namespace DS.Module.DjyRulesEngine /// /// 修改服务状态详情 /// 返回回执 - public Task ExcuteRulesOceanBooking(RuleEngineReq req); + public Task ExcuteRulesOceanBooking(RuleEngineReq req); + + /// + /// 执行海运出口订单审核规则引擎校验 + /// + /// 服务状态详情 + /// 返回回执 + Task ExecuteSeaExportAuditRulesAsync(RuleEngineReq req); } } diff --git a/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineReq.cs b/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineReq.cs index 9821cb3a..1a4bc724 100644 --- a/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineReq.cs +++ b/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineReq.cs @@ -1,9 +1,4 @@ using DS.Module.Core.Extensions; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace DS.Module.DjyRulesEngine { diff --git a/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs b/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs index 16ec03f7..ad8bd3d1 100644 --- a/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs +++ b/ds-wms-service/DS.Module.DjyRulesEngine/RuleEngineService.cs @@ -1,16 +1,22 @@ using DS.Module.Core; using DS.Module.Core.Extensions; -using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using NLog; namespace DS.Module.DjyRulesEngine { /// - /// + /// 大简云规则引擎 /// public class RuleEngineService : IRuleEngineService { + static readonly ApiFox api; + + static RuleEngineService() + { + api = new ApiFox(60); + } + private readonly IServiceProvider _serviceProvider; private readonly string ip; private readonly int port; @@ -59,5 +65,30 @@ namespace DS.Module.DjyRulesEngine } + /// + /// 执行海运出口订单审核规则引擎校验 + /// + /// 服务状态详情 + /// 返回回执 + public async Task ExecuteSeaExportAuditRulesAsync(RuleEngineReq req) + { + if (string.IsNullOrEmpty(req.Head.SenderKey)) + req.Head.SenderKey = senderKey; + + var uriBuilder = new UriBuilder + { + Host = ip, + Port = port, + Path = sendUrl + }; + string url = uriBuilder.ToString(); + var result = await api.PostAsync(url, req); + + if (!result.Succeeded || result.Data == null) + return RuleEngineResult.Failed("请求失败,请联系管理员"); + + return result.Data; + } + } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs index 2d6b86c0..e973c9fd 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs @@ -69,7 +69,5 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction /// 附加参数 /// Task TriggerActionAsync(BusinessTask businessTask, bool includeOrder = false, IDictionary? additionalData = null); - - Task TriggerTestAsync(TaskBaseTypeEnum taskType, long? id); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs index 7b385fae..f09647ce 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs @@ -47,7 +47,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking }); } - protected async Task SetTaskComplete(ActionExecutionContext context) + protected async Task SetTaskCompleteAsync(ActionExecutionContext context) { if (!context.TaskInfo.NextType.HasValue) return; diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs index c4c096c6..2a649040 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs @@ -41,7 +41,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking return; } - await SetTaskComplete(context); + await SetTaskCompleteAsync(context); } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs index c03afb60..a18135d3 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs @@ -2,7 +2,6 @@ using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity.TaskInteraction; -using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Op.Interface.TaskInteraction; using Masuit.Tools; using Masuit.Tools.Systems; @@ -80,7 +79,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking return; } - await SetTaskComplete(context); + await SetTaskCompleteAsync(context); } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs index 03090cf4..79c9a8a9 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs @@ -112,7 +112,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction //未设置查询字段 if (fields == null || fields.Length == 0) { - biz = await TenantDb.Queryable().ClearFilter(typeof(IOrgId)).Where(a => a.Id == businessId) + biz = await TenantDb.Queryable().Where(a => a.Id == businessId) .Select().Mapper(it => { it.DischargePortCountry = TenantDb.Queryable().Where(x => x.Id == it.DischargePortId).Select(x => x.CountryName).First(); @@ -121,7 +121,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction else { var selectors = fields.Select(x => new SelectModel { FieldName = x }).ToList(); - biz = await TenantDb.Queryable().AS("op_sea_export").ClearFilter(typeof(IOrgId)) + biz = await TenantDb.Queryable().AS("op_sea_export") .Where("Id=@Id", new { Id = businessId }).Select(selectors).FirstAsync(); } break; @@ -264,30 +264,5 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction await logService.WriteLogAsync(context.TaskInfo, $"开始运行后台任务({currentExecutor.GetType().FullName})..."); await currentExecutor.ExecuteAsync(context); } - - public async Task TriggerTestAsync(TaskBaseTypeEnum taskType, long? id) - { - var task = await TenantDb.Queryable() - .Where(t => t.TaskType == taskType - //&& SqlFunc.Subqueryable().Where(s => t.BusinessId == s.Id && s.BillSubmitStatus == AuditStatusEnum.Approve).Any() - ) - //.Where(x => x.TaskStatus == TaskStatusEnum.Complete) - .WhereIF(id.HasValue, x => x.BusinessId == id) - .OrderByDescending(t => SqlFunc.GetRandom()).Take(1).FirstAsync(); - if (task != null) - { - TaskFlowDataContext dataContext = new( - (TaskFlowDataNameConst.BusinessTask, task) - ); - - TaskFlowRuner taskFlow = new(TenantDb, ServiceProvider); - await taskFlow.RunWithBsno(task.TaskType, task.BusinessId, dataContext); - return DataResult.Success; - } - - var result = DataResult.Failed("找不到指定类型的任务"); - result.Data = 404; - return result; - } } } diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailService.cs index bc0b8860..5d7c1da1 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/MailService.cs @@ -211,11 +211,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction string url = config["TaskMail:FileBaseUrl"] + @"/PrintTempFile/" + reqResult.Data.Data; var fileResult = await Api.SendRequestAsync(HttpMethod.Get, url); - if (!fileResult.Succeeded) + if (!fileResult.IsSuccessStatusCode) return DataResult.Failed($"未能获取打印API生成的文件,附件地址:{url}"); - string fileName = item.FileName.IsNullOrEmpty() ? Path.GetFileName(reqResult.Data.Data) : item.FileName; - var byteArray = await fileResult.Data.Content.ReadAsByteArrayAsync(); + string? fileName = item.FileName.IsNullOrEmpty() ? Path.GetFileName(reqResult.Data.Data) : item.FileName; + var byteArray = await fileResult.Content.ReadAsByteArrayAsync(); string base64Str = Convert.ToBase64String(byteArray); attachmentList.Add(new Tuple(fileName, base64Str)); } @@ -260,13 +260,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction }]; var mailResult = await Api.SendRequestAsync(HttpMethod.Post, config["TaskMail:MailApiUrl"], mailParams); - if (mailResult.Data.IsSuccessStatusCode) + if (mailResult.IsSuccessStatusCode) { return DataResult.Successed($"已发邮件(委托单:{order.CustomerNo}),收件人:" + string.Join(",", sendTo) + "发件人:" + senderConfig.MailAccount); } - return DataResult.Failed($"邮件发送失败,API返回状态为:{(int)mailResult.Data.StatusCode} {mailResult.Data.StatusCode}" + return DataResult.Failed($"邮件发送失败,API返回状态为:{(int)mailResult.StatusCode} {mailResult.StatusCode}" + $"(委托单:{order.CustomerNo}),收件人:" + string.Join(",", sendTo) + "发件人:" + senderConfig.MailAccount); } catch (Exception ex) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs index c64f5761..78bde8eb 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/SeaExportTaskService.cs @@ -140,6 +140,20 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction await CreateSubTaskAsync(list.FindAll(x => x.TaskType != TaskBaseTypeEnum.NOT_SPECIFIED).OrderBy(x => x.TaskType)); } + /// + /// 创建关联子任务 + /// + /// + /// + public async Task CreateSubTaskAsync(TaskFlowDataContext dataContext) + { + ArgumentNullException.ThrowIfNull(dataContext, nameof(dataContext)); + + var task = dataContext.GetOrDefault(TaskFlowDataNameConst.BusinessTask); + if (task != null) + await CreateSubTaskAsync(task); + } + ///// ///// 当任务状态发生变化时调用 ///// diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs index 997fe1fa..daa05dd1 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/TaskService.cs @@ -1,7 +1,8 @@ -using System; +using System.Text; using DS.Module.Core; using DS.Module.Core.Data; using DS.Module.Core.Helpers; +using DS.Module.DjyRulesEngine; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Entity; using DS.WMS.Core.Flow.Interface; @@ -12,16 +13,17 @@ using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Op.Interface.TaskInteraction; +using DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector; using DS.WMS.Core.Sys.Entity; using DS.WMS.Core.TaskPlat; using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Entity; using DS.WMS.Core.TaskPlat.Interface; +using Mapster; using Masuit.Tools; using Masuit.Tools.Systems; using Microsoft.Extensions.DependencyInjection; using SqlSugar; -using static DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector.BookingSelector; namespace DS.WMS.Core.Op.Method.TaskInteraction { @@ -56,7 +58,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction /// /// 工作流服务 /// - protected IClientFlowInstanceService FlowService { get; private set; } + protected Lazy FlowService { get; private set; } /// /// 动作服务 @@ -73,6 +75,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction /// protected IClientParamService ClientParamService { get; private set; } + /// + /// 规则引擎服务 + /// + protected Lazy RuleEngineService { get; private set; } + /// /// 初始化 /// @@ -82,11 +89,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction ManagerService = provider.GetRequiredService(); LogService = provider.GetRequiredService(); TaskAllocationService = provider.GetRequiredService(); - FlowService = provider.GetRequiredService(); ActionService = provider.GetRequiredService(); OpService = provider.GetRequiredService(); ClientParamService = provider.GetRequiredService(); + FlowService = new Lazy(provider.GetRequiredService()); + RuleEngineService = new Lazy(provider.GetRequiredService()); + TenantDb.QueryFilter.Clear(); } @@ -99,7 +108,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction { var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType); TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider); - var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, + var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN, new TaskFlowDataContext( (TaskFlowDataNameConst.Business, order) ), current.TaskType); @@ -215,6 +224,28 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction //审核任务需创建工作流 if (AuditTaskTypes.Contains(request.TaskType)) { + if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) + { + var rulesReq = new RuleEngineReq(); + rulesReq.Head.MessageType = "BUSI_RULE"; + rulesReq.Head.SenderId = "NewOceanBooking"; + rulesReq.Head.RequestAction = "CheckRule"; + rulesReq.Main.ProjectCode = ["COMMON_OCEAN_BOOKING"]; + + var order = await TenantDb.Queryable().Where(x => x.Id == request.BusinessId).FirstAsync(); + rulesReq.Main.BusinessInfo = info.Adapt(); + + var ruleResult = await RuleEngineService.Value.ExecuteSeaExportAuditRulesAsync(rulesReq); + if (ruleResult?.Extra.DetailList?.Count > 0) + { + StringBuilder sb = new StringBuilder(); + foreach (var item in ruleResult?.Extra.DetailList) + sb.Append(item.ResultName); + + return DataResult.Failed(sb.ToString()); + } + } + result = await CreateAndStartWorkflow(task); if (!result.Succeeded) return result; @@ -255,7 +286,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (template == null) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound)); - var result = FlowService.CreateFlowInstance(new CreateFlowInstanceReq + var result = FlowService.Value.CreateFlowInstance(new CreateFlowInstanceReq { BusinessId = task.BusinessId, BusinessType = task.BusinessType, @@ -268,7 +299,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction task.FlowId = instance.Id; await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync(); - result = FlowService.StartFlowInstance(instance.Id.ToString()); + result = FlowService.Value.StartFlowInstance(instance.Id.ToString()); instance = result.Data as FlowInstance; if (result.Succeeded && changeMarker) @@ -365,7 +396,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) { dic = new Dictionary(); - var param = await ClientParamService.GetParamAsync(task.BusinessId, Booking_Route, + var param = await ClientParamService.GetParamAsync(task.BusinessId, BookingSelector.Booking_Route, (x, y) => x.CustomerId == y.ForwarderId); dic[TaskFlowDataNameConst.ClientParam] = param; } @@ -546,7 +577,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction if (task.FlowId == null) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound)); - var result = FlowService.AuditFlowInstance(new FlowAuditInfo + var result = FlowService.Value.AuditFlowInstance(new FlowAuditInfo { AuditNote = request.Remark, Status = request.Result, diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs index 7ec60deb..63acc6ff 100644 --- a/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs +++ b/ds-wms-service/DS.WMS.OpApi/Controllers/TaskMailController.cs @@ -1,5 +1,4 @@ -using System.Net; -using DS.Module.Core; +using DS.Module.Core; using DS.WMS.Core.Op.Entity.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction; using Microsoft.AspNetCore.Mvc; @@ -22,40 +21,6 @@ namespace DS.WMS.OpApi.Controllers this.service = service; } - /// - /// 运行测试 - /// - /// - /// 任务类型 - /// 业务ID - /// - [HttpGet, Route("RunTest")] - public async Task RunTestAsync([FromServices] IActionManagerService actionManager, - [FromQuery] TaskBaseTypeEnum taskype, [FromQuery] long? id) - { - HttpStatusCode statusCode; - try - { - var result = await actionManager.TriggerTestAsync(taskype, id); - if (result.Succeeded) - { - statusCode = HttpStatusCode.NoContent; - return new StatusCodeResult((int)statusCode); - } - - return new ContentResult - { - Content = result.Message, - StatusCode = result.Data == null ? null : (int)result.Data - }; - } - catch - { - statusCode = HttpStatusCode.InternalServerError; - return new StatusCodeResult((int)statusCode); - } - } - /// /// 获取分页列表 ///