测试接口

usertest
zhangxiaofeng 3 months ago
parent 2310d7db3e
commit 1ba609f2ea

@ -65,6 +65,10 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="userInfos">要转交的人员信息列表</param>
Task<DataResult> TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List<RecvUserInfo> userInfos);
Task<DataResult> TestTaskFlow(string taskType, long taskId);
/// <summary>
/// 测试用
/// </summary>
Task<DataResult> TestTaskFlow(string taskType, long taskId, int testType);
}
}

@ -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("测试成功");
}

@ -54,36 +54,4 @@ public class TaskAllocationController : ApiController
return result;
}
/// <summary>
/// (测试)任务台任务分配
/// </summary>
/// <returns></returns>
[HttpPost("Test")]
public async Task Test()
{
var saasDbService = serviceProvider.GetService<ISaasDbService>();
var user = serviceProvider.GetService<IUser>();
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
var order = await tenantDb.Queryable<SeaExport>().Select<Core.Op.Dtos.SeaExportRes>().FirstAsync(x => x.Id == 1816649497120477184);
TaskFlowDataContext dataContext = new(
(TaskFlowDataNameConst.Business, order)
);
// 分配测试
var result = await taskAllocationService.GetAllotUserBySeaExportId(new List<TaskBaseTypeEnum>() {
TaskBaseTypeEnum.INVOICE_BILL_MAIL,
TaskBaseTypeEnum.NOT_LOADED,
TaskBaseTypeEnum.NOT_SHIPMENG,
}, 1816649497120477184, dataContext);
// 工作流节点测试
//TaskFlowRuner runer = new TaskFlowRuner(tenantDb, serviceProvider);
//var result1 = await runer.GetWorkFlowNextConfig(dataContext, null); // 首位
//var result2 = await runer.GetWorkFlowNextConfig(dataContext, 20001); // 正常
//var result3 = await runer.GetWorkFlowNextConfig(dataContext, 20002); // 分支判断
//var result4 = await runer.GetWorkFlowNextConfig(dataContext, 20003); // 分支结尾判断
//var result5 = await runer.GetWorkFlowNextConfig(dataContext, 20007); // 末位
}
}

@ -212,12 +212,11 @@ public class TaskManageController : ApiController
}
/// <summary>
/// 测试执行任务编排
/// 测试
/// </summary>
/// <returns></returns>
[HttpGet("TestTaskFlow")]
public async Task<DataResult> TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId)
public async Task<DataResult> TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId, [FromQuery] int testType)
{
return await taskManageService.TestTaskFlow(taskType, taskId);
return await taskManageService.TestTaskFlow(taskType, taskId, testType);
}
}
Loading…
Cancel
Save