|
|
@ -1,6 +1,9 @@
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
using DS.WMS.Core.Fee.Method;
|
|
|
|
using DS.WMS.Core.Fee.Method;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
using DS.WMS.Core.Op.Dtos.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Op.Dtos.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
@ -19,6 +22,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
public class SeaExportTaskService : FeeServiceBase
|
|
|
|
public class SeaExportTaskService : FeeServiceBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ITaskManageService taskService;
|
|
|
|
ITaskManageService taskService;
|
|
|
|
|
|
|
|
Lazy<IClientFlowInstanceService> flowService;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 初始化
|
|
|
|
/// 初始化
|
|
|
@ -27,6 +31,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
public SeaExportTaskService(IServiceProvider provider) : base(provider)
|
|
|
|
public SeaExportTaskService(IServiceProvider provider) : base(provider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
taskService = provider.GetRequiredService<ITaskManageService>();
|
|
|
|
taskService = provider.GetRequiredService<ITaskManageService>();
|
|
|
|
|
|
|
|
flowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -93,7 +98,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
if (!result.Succeeded)
|
|
|
|
if (!result.Succeeded)
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
var businessTask = new BusinessTask
|
|
|
|
task = new BusinessTask
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
@ -102,20 +107,32 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
CreateBy = long.Parse(User.UserId),
|
|
|
|
CreateBy = long.Parse(User.UserId),
|
|
|
|
CreateTime = DateTime.Now
|
|
|
|
CreateTime = DateTime.Now
|
|
|
|
};
|
|
|
|
};
|
|
|
|
businessTask.NextType = GetNextType(businessTask);
|
|
|
|
task.NextType = GetNextType(task);
|
|
|
|
await TenantDb.Insertable(businessTask).ExecuteCommandAsync();
|
|
|
|
await TenantDb.Insertable(task).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//待审核,需创建工作流
|
|
|
|
//待审核,需创建工作流
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.SeaExport);
|
|
|
|
|
|
|
|
if (template == null)
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
result = flowService.Value.CreateFlowInstance(new CreateFlowInstanceReq
|
|
|
|
else if (request.TaskType == TaskBaseTypeEnum.WAIT_BILL_CONFIRM)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
//根据业务所选服务,生成子任务
|
|
|
|
BusinessType = BusinessType.OceanShippingExport,
|
|
|
|
|
|
|
|
TemplateId = template.Id
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.Succeeded)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var instance = result.Data as FlowInstance;
|
|
|
|
|
|
|
|
task.FlowId = instance.Id;
|
|
|
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
return DataResult.Success;
|
|
|
|
return DataResult.Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
@ -160,6 +177,12 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
await CreateTaskAsync(req);
|
|
|
|
await CreateTaskAsync(req);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//放舱结束,根据业务所选服务,生成子任务
|
|
|
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_SPACE_RELEASE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
return DataResult.Success;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
@ -184,12 +207,20 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
.OrderByDescending(x => x.CreateTime).Take(1).FirstAsync();
|
|
|
|
.OrderByDescending(x => x.CreateTime).Take(1).FirstAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取给定任务的下一任务类型
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="current">任务信息</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
internal static TaskBaseTypeEnum? GetNextType(BusinessTask current)
|
|
|
|
internal static TaskBaseTypeEnum? GetNextType(BusinessTask current)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (current.TaskType == TaskBaseTypeEnum.WAIT_VGM)
|
|
|
|
if (current.TaskType == TaskBaseTypeEnum.WAIT_CHECKOUT_BILL)
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
int currentTypeVal = (int)current.TaskType;
|
|
|
|
int currentTypeVal = (int)current.TaskType;
|
|
|
|
|
|
|
|
if (currentTypeVal >= 300) //300开始的枚举值为可选服务项目,不存在前后关联性
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
return (TaskBaseTypeEnum)currentTypeVal++;
|
|
|
|
return (TaskBaseTypeEnum)currentTypeVal++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|