提交审核调用大简云规则库

usertest
嵇文龙 3 months ago
parent d7a6ca900b
commit fd9df6302c

@ -84,11 +84,7 @@ namespace DS.Module.Core
if (!queryString.IsNullOrEmpty()) if (!queryString.IsNullOrEmpty())
url = url.LastOrDefault() == '?' ? url + queryString : url + "?" + queryString; url = url.LastOrDefault() == '?' ? url + queryString : url + "?" + queryString;
var result = await SendRequestAsync(HttpMethod.Get, url); var response = await SendRequestAsync(HttpMethod.Get, url);
if (!result.Succeeded)
return DataResult<T>.Failed(result.Message, result.MultiCode);
var response = result.Data;
T? data = default; T? data = default;
if (response != null) if (response != null)
{ {
@ -96,7 +92,7 @@ namespace DS.Module.Core
data = JsonConvert.DeserializeObject<T>(json); data = JsonConvert.DeserializeObject<T>(json);
} }
return new DataResult<T>(result.Code, result.Message, data, result.MultiCode); return DataResult<T>.Success(data);
} }
/// <summary> /// <summary>
@ -109,11 +105,7 @@ namespace DS.Module.Core
/// <exception cref="ArgumentException"><paramref name="url"/>为null或空字符串</exception> /// <exception cref="ArgumentException"><paramref name="url"/>为null或空字符串</exception>
public async Task<DataResult<T>> PostAsync<T>(string url, object? requestParams = null) public async Task<DataResult<T>> PostAsync<T>(string url, object? requestParams = null)
{ {
var result = await SendRequestAsync(HttpMethod.Post, url, requestParams); var response = await SendRequestAsync(HttpMethod.Post, url, requestParams);
if (!result.Succeeded)
return DataResult<T>.Failed(result.Message, result.MultiCode);
var response = result.Data;
T? data = default; T? data = default;
if (response != null) if (response != null)
{ {
@ -121,7 +113,7 @@ namespace DS.Module.Core
data = JsonConvert.DeserializeObject<T>(json); data = JsonConvert.DeserializeObject<T>(json);
} }
return new DataResult<T>(result.Code, result.Message, data, result.MultiCode); return DataResult<T>.Success(data);
} }
/// <summary> /// <summary>
@ -134,7 +126,7 @@ namespace DS.Module.Core
/// <exception cref="ArgumentNullException"><paramref name="method"/>为null</exception> /// <exception cref="ArgumentNullException"><paramref name="method"/>为null</exception>
/// <exception cref="ArgumentException"><paramref name="url"/>为null或空字符串</exception> /// <exception cref="ArgumentException"><paramref name="url"/>为null或空字符串</exception>
/// <exception cref="NotSupportedException"><paramref name="method"/>不等于 GET/POST/PUT/Delete 中的任何一个请求方法</exception> /// <exception cref="NotSupportedException"><paramref name="method"/>不等于 GET/POST/PUT/Delete 中的任何一个请求方法</exception>
public async Task<DataResult<HttpResponseMessage>> SendRequestAsync(HttpMethod method, string url, object? requestParams = null) public async Task<HttpResponseMessage> SendRequestAsync(HttpMethod method, string url, object? requestParams = null)
{ {
ArgumentNullException.ThrowIfNull(method); ArgumentNullException.ThrowIfNull(method);
ArgumentException.ThrowIfNullOrEmpty(url); ArgumentException.ThrowIfNullOrEmpty(url);
@ -159,8 +151,6 @@ namespace DS.Module.Core
RequestUri = reqUri RequestUri = reqUri
}); });
try
{
HttpResponseMessage? response = null; HttpResponseMessage? response = null;
if (method == HttpMethod.Get) if (method == HttpMethod.Get)
{ {
@ -193,15 +183,7 @@ namespace DS.Module.Core
Response = response Response = response
}); });
if (!response.IsSuccessStatusCode) return response;
return DataResult<HttpResponseMessage>.FailedData(response, string.Format(MultiLanguageConst.HttpRequestFailed, $"{response.StatusCode}"));
return DataResult<HttpResponseMessage>.Success(response);
}
catch (Exception ex)
{
return DataResult<HttpResponseMessage>.Failed(ex.Message);
}
} }
/// <summary> /// <summary>

@ -1,10 +1,4 @@
using System; namespace DS.Module.DjyRulesEngine
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.Module.DjyRulesEngine
{ {
public interface IRuleEngineService public interface IRuleEngineService
{ {
@ -14,5 +8,12 @@ namespace DS.Module.DjyRulesEngine
/// <param name="req">修改服务状态详情</param> /// <param name="req">修改服务状态详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
public Task<RuleEngineResult> ExcuteRulesOceanBooking(RuleEngineReq req); public Task<RuleEngineResult> ExcuteRulesOceanBooking(RuleEngineReq req);
/// <summary>
/// 执行海运出口订单审核规则引擎校验
/// </summary>
/// <param name="req">服务状态详情</param>
/// <returns>返回回执</returns>
Task<RuleEngineResult?> ExecuteSeaExportAuditRulesAsync(RuleEngineReq req);
} }
} }

@ -1,9 +1,4 @@
using DS.Module.Core.Extensions; 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 namespace DS.Module.DjyRulesEngine
{ {

@ -1,16 +1,22 @@
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
namespace DS.Module.DjyRulesEngine namespace DS.Module.DjyRulesEngine
{ {
/// <summary> /// <summary>
/// /// 大简云规则引擎
/// </summary> /// </summary>
public class RuleEngineService : IRuleEngineService public class RuleEngineService : IRuleEngineService
{ {
static readonly ApiFox api;
static RuleEngineService()
{
api = new ApiFox(60);
}
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private readonly string ip; private readonly string ip;
private readonly int port; private readonly int port;
@ -59,5 +65,30 @@ namespace DS.Module.DjyRulesEngine
} }
/// <summary>
/// 执行海运出口订单审核规则引擎校验
/// </summary>
/// <param name="req">服务状态详情</param>
/// <returns>返回回执</returns>
public async Task<RuleEngineResult?> 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<RuleEngineResult>(url, req);
if (!result.Succeeded || result.Data == null)
return RuleEngineResult.Failed("请求失败,请联系管理员");
return result.Data;
}
} }
} }

@ -69,7 +69,5 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// <param name="additionalData">附加参数</param> /// <param name="additionalData">附加参数</param>
/// <returns></returns> /// <returns></returns>
Task TriggerActionAsync(BusinessTask businessTask, bool includeOrder = false, IDictionary<string, object>? additionalData = null); Task TriggerActionAsync(BusinessTask businessTask, bool includeOrder = false, IDictionary<string, object>? additionalData = null);
Task<DataResult> TriggerTestAsync(TaskBaseTypeEnum taskType, long? id);
} }
} }

@ -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) if (!context.TaskInfo.NextType.HasValue)
return; return;

@ -41,7 +41,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking
return; return;
} }
await SetTaskComplete(context); await SetTaskCompleteAsync(context);
} }
} }
} }

@ -2,7 +2,6 @@
using DS.WMS.Core.Op.Dtos.TaskInteraction; using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Entity.TaskInteraction; 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.Interface.TaskInteraction;
using Masuit.Tools; using Masuit.Tools;
using Masuit.Tools.Systems; using Masuit.Tools.Systems;
@ -80,7 +79,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking
return; return;
} }
await SetTaskComplete(context); await SetTaskCompleteAsync(context);
} }
} }

@ -112,7 +112,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
//未设置查询字段 //未设置查询字段
if (fields == null || fields.Length == 0) if (fields == null || fields.Length == 0)
{ {
biz = await TenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(a => a.Id == businessId) biz = await TenantDb.Queryable<SeaExport>().Where(a => a.Id == businessId)
.Select<SeaExportRes>().Mapper(it => .Select<SeaExportRes>().Mapper(it =>
{ {
it.DischargePortCountry = TenantDb.Queryable<CodePort>().Where(x => x.Id == it.DischargePortId).Select(x => x.CountryName).First(); it.DischargePortCountry = TenantDb.Queryable<CodePort>().Where(x => x.Id == it.DischargePortId).Select(x => x.CountryName).First();
@ -121,7 +121,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
else else
{ {
var selectors = fields.Select(x => new SelectModel { FieldName = x }).ToList(); var selectors = fields.Select(x => new SelectModel { FieldName = x }).ToList();
biz = await TenantDb.Queryable<object>().AS("op_sea_export").ClearFilter(typeof(IOrgId)) biz = await TenantDb.Queryable<object>().AS("op_sea_export")
.Where("Id=@Id", new { Id = businessId }).Select(selectors).FirstAsync(); .Where("Id=@Id", new { Id = businessId }).Select(selectors).FirstAsync();
} }
break; break;
@ -264,30 +264,5 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
await logService.WriteLogAsync(context.TaskInfo, $"开始运行后台任务({currentExecutor.GetType().FullName}..."); await logService.WriteLogAsync(context.TaskInfo, $"开始运行后台任务({currentExecutor.GetType().FullName}...");
await currentExecutor.ExecuteAsync(context); await currentExecutor.ExecuteAsync(context);
} }
public async Task<DataResult> TriggerTestAsync(TaskBaseTypeEnum taskType, long? id)
{
var task = await TenantDb.Queryable<BusinessTask>()
.Where(t => t.TaskType == taskType
//&& SqlFunc.Subqueryable<SeaExport>().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;
}
} }
} }

@ -211,11 +211,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
string url = config["TaskMail:FileBaseUrl"] + @"/PrintTempFile/" + reqResult.Data.Data; string url = config["TaskMail:FileBaseUrl"] + @"/PrintTempFile/" + reqResult.Data.Data;
var fileResult = await Api.SendRequestAsync(HttpMethod.Get, url); var fileResult = await Api.SendRequestAsync(HttpMethod.Get, url);
if (!fileResult.Succeeded) if (!fileResult.IsSuccessStatusCode)
return DataResult.Failed($"未能获取打印API生成的文件附件地址{url}"); return DataResult.Failed($"未能获取打印API生成的文件附件地址{url}");
string fileName = item.FileName.IsNullOrEmpty() ? Path.GetFileName(reqResult.Data.Data) : item.FileName; string? fileName = item.FileName.IsNullOrEmpty() ? Path.GetFileName(reqResult.Data.Data) : item.FileName;
var byteArray = await fileResult.Data.Content.ReadAsByteArrayAsync(); var byteArray = await fileResult.Content.ReadAsByteArrayAsync();
string base64Str = Convert.ToBase64String(byteArray); string base64Str = Convert.ToBase64String(byteArray);
attachmentList.Add(new Tuple<string, string>(fileName, base64Str)); attachmentList.Add(new Tuple<string, string>(fileName, base64Str));
} }
@ -260,13 +260,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}]; }];
var mailResult = await Api.SendRequestAsync(HttpMethod.Post, config["TaskMail:MailApiUrl"], mailParams); var mailResult = await Api.SendRequestAsync(HttpMethod.Post, config["TaskMail:MailApiUrl"], mailParams);
if (mailResult.Data.IsSuccessStatusCode) if (mailResult.IsSuccessStatusCode)
{ {
return DataResult.Successed($"已发邮件(委托单:{order.CustomerNo}),收件人:" return DataResult.Successed($"已发邮件(委托单:{order.CustomerNo}),收件人:"
+ string.Join(",", sendTo) + "发件人:" + senderConfig.MailAccount); + 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); + $"(委托单:{order.CustomerNo}),收件人:" + string.Join(",", sendTo) + "发件人:" + senderConfig.MailAccount);
} }
catch (Exception ex) catch (Exception ex)

@ -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)); await CreateSubTaskAsync(list.FindAll(x => x.TaskType != TaskBaseTypeEnum.NOT_SPECIFIED).OrderBy(x => x.TaskType));
} }
/// <summary>
/// 创建关联子任务
/// </summary>
/// <param name="dataContext"></param>
/// <returns></returns>
public async Task CreateSubTaskAsync(TaskFlowDataContext dataContext)
{
ArgumentNullException.ThrowIfNull(dataContext, nameof(dataContext));
var task = dataContext.GetOrDefault<BusinessTask>(TaskFlowDataNameConst.BusinessTask);
if (task != null)
await CreateSubTaskAsync(task);
}
///// <summary> ///// <summary>
///// 当任务状态发生变化时调用 ///// 当任务状态发生变化时调用
///// </summary> ///// </summary>

@ -1,7 +1,8 @@
using System; using System.Text;
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Helpers; using DS.Module.Core.Helpers;
using DS.Module.DjyRulesEngine;
using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity; using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.Flow.Interface; 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.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface; using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Op.Interface.TaskInteraction; 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.Sys.Entity;
using DS.WMS.Core.TaskPlat; using DS.WMS.Core.TaskPlat;
using DS.WMS.Core.TaskPlat.Dtos; using DS.WMS.Core.TaskPlat.Dtos;
using DS.WMS.Core.TaskPlat.Entity; using DS.WMS.Core.TaskPlat.Entity;
using DS.WMS.Core.TaskPlat.Interface; using DS.WMS.Core.TaskPlat.Interface;
using Mapster;
using Masuit.Tools; using Masuit.Tools;
using Masuit.Tools.Systems; using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using SqlSugar; using SqlSugar;
using static DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector.BookingSelector;
namespace DS.WMS.Core.Op.Method.TaskInteraction namespace DS.WMS.Core.Op.Method.TaskInteraction
{ {
@ -56,7 +58,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <summary> /// <summary>
/// 工作流服务 /// 工作流服务
/// </summary> /// </summary>
protected IClientFlowInstanceService FlowService { get; private set; } protected Lazy<IClientFlowInstanceService> FlowService { get; private set; }
/// <summary> /// <summary>
/// 动作服务 /// 动作服务
@ -73,6 +75,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// </summary> /// </summary>
protected IClientParamService ClientParamService { get; private set; } protected IClientParamService ClientParamService { get; private set; }
/// <summary>
/// 规则引擎服务
/// </summary>
protected Lazy<IRuleEngineService> RuleEngineService { get; private set; }
/// <summary> /// <summary>
/// 初始化 /// 初始化
/// </summary> /// </summary>
@ -82,11 +89,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
ManagerService = provider.GetRequiredService<ITaskManageService>(); ManagerService = provider.GetRequiredService<ITaskManageService>();
LogService = provider.GetRequiredService<ITaskLogService>(); LogService = provider.GetRequiredService<ITaskLogService>();
TaskAllocationService = provider.GetRequiredService<ITaskAllocationService>(); TaskAllocationService = provider.GetRequiredService<ITaskAllocationService>();
FlowService = provider.GetRequiredService<IClientFlowInstanceService>();
ActionService = provider.GetRequiredService<IActionManagerService>(); ActionService = provider.GetRequiredService<IActionManagerService>();
OpService = provider.GetRequiredService<ISeaExportService>(); OpService = provider.GetRequiredService<ISeaExportService>();
ClientParamService = provider.GetRequiredService<IClientParamService>(); ClientParamService = provider.GetRequiredService<IClientParamService>();
FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
RuleEngineService = new Lazy<IRuleEngineService>(provider.GetRequiredService<IRuleEngineService>());
TenantDb.QueryFilter.Clear<IOrgId>(); TenantDb.QueryFilter.Clear<IOrgId>();
} }
@ -215,6 +224,28 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
//审核任务需创建工作流 //审核任务需创建工作流
if (AuditTaskTypes.Contains(request.TaskType)) 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<SeaExport>().Where(x => x.Id == request.BusinessId).FirstAsync();
rulesReq.Main.BusinessInfo = info.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
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); result = await CreateAndStartWorkflow(task);
if (!result.Succeeded) if (!result.Succeeded)
return result; return result;
@ -255,7 +286,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (template == null) if (template == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
var result = FlowService.CreateFlowInstance(new CreateFlowInstanceReq var result = FlowService.Value.CreateFlowInstance(new CreateFlowInstanceReq
{ {
BusinessId = task.BusinessId, BusinessId = task.BusinessId,
BusinessType = task.BusinessType, BusinessType = task.BusinessType,
@ -268,7 +299,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
task.FlowId = instance.Id; task.FlowId = instance.Id;
await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync(); 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; instance = result.Data as FlowInstance;
if (result.Succeeded && changeMarker) if (result.Succeeded && changeMarker)
@ -365,7 +396,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT) if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
{ {
dic = new Dictionary<string, object>(); dic = new Dictionary<string, object>();
var param = await ClientParamService.GetParamAsync<string>(task.BusinessId, Booking_Route, var param = await ClientParamService.GetParamAsync<string>(task.BusinessId, BookingSelector.Booking_Route,
(x, y) => x.CustomerId == y.ForwarderId); (x, y) => x.CustomerId == y.ForwarderId);
dic[TaskFlowDataNameConst.ClientParam] = param; dic[TaskFlowDataNameConst.ClientParam] = param;
} }
@ -546,7 +577,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task.FlowId == null) if (task.FlowId == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound));
var result = FlowService.AuditFlowInstance(new FlowAuditInfo var result = FlowService.Value.AuditFlowInstance(new FlowAuditInfo
{ {
AuditNote = request.Remark, AuditNote = request.Remark,
Status = request.Result, Status = request.Result,

@ -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.Entity.TaskInteraction;
using DS.WMS.Core.Op.Interface.TaskInteraction; using DS.WMS.Core.Op.Interface.TaskInteraction;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -22,40 +21,6 @@ namespace DS.WMS.OpApi.Controllers
this.service = service; this.service = service;
} }
/// <summary>
/// 运行测试
/// </summary>
/// <param name="actionManager"></param>
/// <param name="taskype">任务类型</param>
/// <param name="id">业务ID</param>
/// <returns></returns>
[HttpGet, Route("RunTest")]
public async Task<IActionResult> 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);
}
}
/// <summary> /// <summary>
/// 获取分页列表 /// 获取分页列表
/// </summary> /// </summary>

Loading…
Cancel
Save