From 1ba609f2ea3713fc1496e28642bfc67af6b1c187 Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Wed, 14 Aug 2024 09:53:41 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TaskPlat/Interface/ITaskManageService.cs | 6 +-
.../TaskPlat/Method/TaskManageService.cs | 81 ++++++++++++++-----
.../Controllers/TaskAllocationController.cs | 32 --------
.../Controllers/TaskManageController.cs | 7 +-
4 files changed, 69 insertions(+), 57 deletions(-)
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
index 8fb94dca..6d6cfe04 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageService.cs
@@ -65,6 +65,10 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// 业务类型
/// 要转交的人员信息列表
Task TransferTask(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, List userInfos);
- Task TestTaskFlow(string taskType, long taskId);
+
+ ///
+ /// 测试用
+ ///
+ Task TestTaskFlow(string taskType, long taskId, int testType);
}
}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
index 02524acc..1077c55e 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -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.FailedData(portInfo);
}
- public async Task TestTaskFlow(string taskType, long taskId)
+ ///
+ /// 测试用
+ ///
+ public async Task 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().Select().FirstAsync(x => x.Id == 1816649497120477184);
+ TaskFlowDataContext dataContext2 = new(
+ (TaskFlowDataNameConst.Business, order)
+ );
+ var taskAllocationService = serviceProvider.GetRequiredService();
+ var result = await taskAllocationService.GetAllotUserBySeaExportId(new List() {
+ 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().Select().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("测试成功");
}
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs
index 21823d0b..b507b725 100644
--- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskAllocationController.cs
@@ -54,36 +54,4 @@ public class TaskAllocationController : ApiController
return result;
}
- ///
- /// (测试)任务台任务分配
- ///
- ///
- [HttpPost("Test")]
- public async Task Test()
- {
- var saasDbService = serviceProvider.GetService();
- var user = serviceProvider.GetService();
-
- var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
- var order = await tenantDb.Queryable().Select().FirstAsync(x => x.Id == 1816649497120477184);
-
- TaskFlowDataContext dataContext = new(
- (TaskFlowDataNameConst.Business, order)
- );
-
- // 分配测试
- var result = await taskAllocationService.GetAllotUserBySeaExportId(new List() {
- 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); // 末位
- }
}
\ No newline at end of file
diff --git a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
index 91ea4422..5fda2a22 100644
--- a/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
+++ b/ds-wms-service/DS.WMS.TaskApi/Controllers/TaskManageController.cs
@@ -212,12 +212,11 @@ public class TaskManageController : ApiController
}
///
- /// 测试执行任务编排
+ /// 测试用
///
- ///
[HttpGet("TestTaskFlow")]
- public async Task TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId)
+ public async Task TestTaskFlow([FromQuery] string taskType, [FromQuery] long taskId, [FromQuery] int testType)
{
- return await taskManageService.TestTaskFlow(taskType, taskId);
+ return await taskManageService.TestTaskFlow(taskType, taskId, testType);
}
}
\ No newline at end of file