diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreationRequest.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreationRequest.cs
index 1e755eda..b133c8c6 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreationRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskCreationRequest.cs
@@ -31,5 +31,10 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
/// 下一任务类型
///
public TaskBaseTypeEnum? NextType { get; set; }
+
+ ///
+ /// 是否现舱(默认null值)
+ ///
+ public bool? HasCabin { get; set; }
}
}
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 b0e2abc0..3d934e26 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
@@ -110,6 +110,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (!await EnsureModuleAuthorized())
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
+ if (request.HasCabin.GetValueOrDefault())
+ {
+ //如果为现舱,获取下一任务类型进行创建
+ var nextType = await GetNextTypeAsync(request.BusinessId, request.BusinessType, request.TaskType);
+ if (nextType.HasValue)
+ request.TaskTypeName = nextType.Value.ToString();
+ }
+
var task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
if (task != null && task.TaskStatus != TaskStatusEnum.Cancel)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
@@ -742,14 +750,24 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
///
protected async Task GetNextTypeAsync(BusinessTask current)
{
- var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType);
- TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
- var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
- new TaskFlowDataContext(
- (TaskFlowDataNameConst.Business, order)
- ), current.TaskType);
+ return await GetNextTypeAsync(current.BusinessId, current.BusinessType, current.TaskType);
+ }
- return taskType;
+ ///
+ /// 获取给定任务的下一任务类型
+ ///
+ /// 业务ID
+ /// 业务类型
+ /// 当前任务类型
+ ///
+ protected async Task GetNextTypeAsync(long bsId, BusinessType businessType, TaskBaseTypeEnum currentType)
+ {
+ var order = await ActionService.GetBusinessDataAsync(bsId, businessType);
+ TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
+ return await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
+ new TaskFlowDataContext(
+ (TaskFlowDataNameConst.Business, order)
+ ), currentType);
}
///
diff --git a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportTaskController.cs b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportTaskController.cs
index a4996bc5..073be7ea 100644
--- a/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportTaskController.cs
+++ b/ds-wms-service/DS.WMS.OpApi/Controllers/SeaExportTaskController.cs
@@ -1,6 +1,5 @@
using System.Net;
using DS.Module.Core;
-using DS.WMS.Core;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
@@ -66,7 +65,8 @@ namespace DS.WMS.OpApi.Controllers
/// 业务ID
/// 业务类型(可空,默认=海运出口)
///
- public async Task AutomaticBooking([FromServices] IActionManagerService actionService,
+ [HttpPost, Route("AutomaticBooking")]
+ public async Task AutomaticBookingAsync([FromServices] IActionManagerService actionService,
[FromQuery] long businessId, [FromQuery] BusinessType businessType = BusinessType.OceanShippingExport)
{
return await actionService.AutomaticBooking(businessId, businessType);