|
|
|
@ -19,6 +19,7 @@ using DS.WMS.Core.TaskPlat.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using SqlSugar;
|
|
|
|
@ -2749,32 +2750,72 @@ namespace DS.WMS.Core.TaskPlat.Method
|
|
|
|
|
return DataResult<CodePortRes>.FailedData(portInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<DataResult> TestTaskFlow(string taskType, long taskId)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试用
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType);
|
|
|
|
|
|
|
|
|
|
TaskManageOrderMessageInfo p1 = new TaskManageOrderMessageInfo()
|
|
|
|
|
switch (testType)
|
|
|
|
|
{
|
|
|
|
|
Main = new TaskManageOrderMessageMainInfo()
|
|
|
|
|
{
|
|
|
|
|
BCInfo = new TaskManageOrderBCInfo()
|
|
|
|
|
// 任务编排执行测试
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
var taskTypeEnum = (TaskBaseTypeEnum)Enum.Parse(typeof(TaskBaseTypeEnum), taskType);
|
|
|
|
|
TaskManageOrderMessageInfo p1 = new TaskManageOrderMessageInfo()
|
|
|
|
|
{
|
|
|
|
|
Main = new TaskManageOrderMessageMainInfo()
|
|
|
|
|
{
|
|
|
|
|
BCInfo = new TaskManageOrderBCInfo()
|
|
|
|
|
{
|
|
|
|
|
Vessel = "TESTVESSEL"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
TaskFlowDataContext dataContext = new(
|
|
|
|
|
((TaskFlowDataNameConst.TaskManageOrderMessageInfo), p1),
|
|
|
|
|
(("Name"), "QD-ZXF"),
|
|
|
|
|
(("Age"), 19),
|
|
|
|
|
(("Height"), 160)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
TaskFlowRuner taskFlow = new TaskFlowRuner(tenantDb, serviceProvider);
|
|
|
|
|
await taskFlow.Run(taskTypeEnum, taskId, dataContext);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// 分配测试
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
Vessel = "TESTVESSEL"
|
|
|
|
|
var order = await tenantDb.Queryable<SeaExport>().Select<Core.Op.Dtos.SeaExportRes>().FirstAsync(x => x.Id == 1816649497120477184);
|
|
|
|
|
TaskFlowDataContext dataContext2 = new(
|
|
|
|
|
(TaskFlowDataNameConst.Business, order)
|
|
|
|
|
);
|
|
|
|
|
var taskAllocationService = serviceProvider.GetRequiredService<ITaskAllocationService>();
|
|
|
|
|
var result = await taskAllocationService.GetAllotUserBySeaExportId(new List<TaskBaseTypeEnum>() {
|
|
|
|
|
TaskBaseTypeEnum.INVOICE_BILL_MAIL,
|
|
|
|
|
TaskBaseTypeEnum.NOT_LOADED,
|
|
|
|
|
TaskBaseTypeEnum.NOT_SHIPMENG,
|
|
|
|
|
}, 1816649497120477184, dataContext2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
TaskFlowDataContext dataContext = new(
|
|
|
|
|
((TaskFlowDataNameConst.TaskManageOrderMessageInfo), p1),
|
|
|
|
|
(("Name"), "QD-ZXF"),
|
|
|
|
|
(("Age"), 19),
|
|
|
|
|
(("Height"), 160)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
TaskFlowRuner taskFlow = new TaskFlowRuner(tenantDb, serviceProvider);
|
|
|
|
|
await taskFlow.Run(taskTypeEnum, taskId, dataContext);
|
|
|
|
|
// 工作流获取下一节点测试
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
var order = await tenantDb.Queryable<SeaExport>().Select<Core.Op.Dtos.SeaExportRes>().FirstAsync(x => x.Id == 1816649497120477184);
|
|
|
|
|
TaskFlowDataContext dataContext = new(
|
|
|
|
|
(TaskFlowDataNameConst.Business, order)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
TaskFlowRuner runer = new TaskFlowRuner(tenantDb, serviceProvider);
|
|
|
|
|
var result1 = await runer.GetWorkFlowNextConfig(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, null); // 首位
|
|
|
|
|
var result2 = await runer.GetWorkFlowNextConfig(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20001); // 正常
|
|
|
|
|
var result3 = await runer.GetWorkFlowNextConfig(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20002); // 分支判断
|
|
|
|
|
var result4 = await runer.GetWorkFlowNextConfig(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20003); // 分支结尾判断
|
|
|
|
|
var result5 = await runer.GetWorkFlowNextConfig(TaskBaseTypeEnum.WORK_FLOW_MAIN, dataContext, 20008); // 末位
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("测试成功");
|
|
|
|
|
}
|
|
|
|
|