|
|
@ -99,7 +99,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
TenantDb.QueryFilter.Clear<IOrgId>();
|
|
|
|
TenantDb.QueryFilter.Clear<IOrgId>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 创建关联任务
|
|
|
|
/// 创建关联任务
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -111,6 +110,14 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
if (!await EnsureModuleAuthorized())
|
|
|
|
if (!await EnsureModuleAuthorized())
|
|
|
|
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
|
|
|
|
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();
|
|
|
|
var task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
|
|
|
|
if (task != null && task.TaskStatus != TaskStatusEnum.Cancel)
|
|
|
|
if (task != null && task.TaskStatus != TaskStatusEnum.Cancel)
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
|
|
|
@ -661,8 +668,10 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
public virtual async Task UpdateBusinessAsync(FlowCallback callback)
|
|
|
|
public virtual async Task UpdateBusinessAsync(FlowCallback callback)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ArgumentNullException.ThrowIfNull(callback, nameof(callback));
|
|
|
|
ArgumentNullException.ThrowIfNull(callback, nameof(callback));
|
|
|
|
|
|
|
|
if (callback.Type == null || callback.BusinessType == null)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
var taskType = TypeMappings.Where(x => x.Value == callback.Type.GetValueOrDefault()).Select(x => x.Key).FirstOrDefault();
|
|
|
|
var taskType = TypeMappings.Where(x => x.Value == callback.Type.Value).Select(x => x.Key).FirstOrDefault();
|
|
|
|
var req = new TaskUpdateRequest
|
|
|
|
var req = new TaskUpdateRequest
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BusinessId = callback.BusinessId,
|
|
|
|
BusinessId = callback.BusinessId,
|
|
|
@ -741,14 +750,24 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
protected async Task<TaskBaseTypeEnum?> GetNextTypeAsync(BusinessTask current)
|
|
|
|
protected async Task<TaskBaseTypeEnum?> GetNextTypeAsync(BusinessTask current)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType);
|
|
|
|
return await GetNextTypeAsync(current.BusinessId, current.BusinessType, current.TaskType);
|
|
|
|
TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
|
|
|
|
}
|
|
|
|
var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
|
|
|
|
|
|
|
|
new TaskFlowDataContext(
|
|
|
|
|
|
|
|
(TaskFlowDataNameConst.Business, order)
|
|
|
|
|
|
|
|
), 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>
|
|
|
|
/// <summary>
|
|
|
|