创建任务增加是否现舱参数值

usertest
嵇文龙 2 months ago
parent 37bc0e01a9
commit 7f3a68b011

@ -31,5 +31,10 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
/// 下一任务类型
/// </summary>
public TaskBaseTypeEnum? NextType { get; set; }
/// <summary>
/// 是否现舱(默认null值)
/// </summary>
public bool? HasCabin { get; set; }
}
}

@ -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
/// <returns></returns>
protected async Task<TaskBaseTypeEnum?> 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;
/// <summary>
/// 获取给定任务的下一任务类型
/// </summary>
/// <param name="bsId">业务ID</param>
/// <param name="businessType">业务类型</param>
/// <param name="currentType">当前任务类型</param>
/// <returns></returns>
protected async Task<TaskBaseTypeEnum?> 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);
}
/// <summary>

@ -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
/// <param name="businessId">业务ID</param>
/// <param name="businessType">业务类型(可空,默认=海运出口)</param>
/// <returns></returns>
public async Task<DataResult> AutomaticBooking([FromServices] IActionManagerService actionService,
[HttpPost, Route("AutomaticBooking")]
public async Task<DataResult> AutomaticBookingAsync([FromServices] IActionManagerService actionService,
[FromQuery] long businessId, [FromQuery] BusinessType businessType = BusinessType.OceanShippingExport)
{
return await actionService.AutomaticBooking(businessId, businessType);

Loading…
Cancel
Save