|
|
|
@ -103,7 +103,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 任务分配
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected ITaskAllocationService TaskAllocationService { get; private set; }
|
|
|
|
|
protected Lazy<ITaskAllocationService> TaskAllocationService { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工作流服务
|
|
|
|
@ -130,9 +130,9 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
{
|
|
|
|
|
ManagerService = provider.GetRequiredService<ITaskManageService>();
|
|
|
|
|
LogService = provider.GetRequiredService<ITaskLogService>();
|
|
|
|
|
TaskAllocationService = provider.GetRequiredService<ITaskAllocationService>();
|
|
|
|
|
ActionService = provider.GetRequiredService<IActionManagerService>();
|
|
|
|
|
|
|
|
|
|
TaskAllocationService = new Lazy<ITaskAllocationService>(provider.GetRequiredService<ITaskAllocationService>());
|
|
|
|
|
ClientParamService = new Lazy<IClientParamService>(provider.GetRequiredService<IClientParamService>());
|
|
|
|
|
FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
|
|
|
|
|
RuleEngineService = new Lazy<IRuleEngineService>(provider.GetRequiredService<IRuleEngineService>());
|
|
|
|
@ -179,7 +179,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="useTransaction">是否使用事务</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
|
|
|
|
|
public virtual async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
|
|
|
|
|
{
|
|
|
|
|
if (!await HasAuthorizedAsync())
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
|
|
|
|
@ -193,20 +193,6 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TypeOrName));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (request.BusinessType.HasValue)
|
|
|
|
|
//{
|
|
|
|
|
// bool isBizValid = false;
|
|
|
|
|
// switch (request.BusinessType.Value)
|
|
|
|
|
// {
|
|
|
|
|
// case BusinessType.OceanShippingExport:
|
|
|
|
|
// isBizValid = await TenantDb.Queryable<SeaExport>().AnyAsync(x => x.Id == request.BusinessId);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (!isBizValid)
|
|
|
|
|
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Biz_Not_Valid));
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
if (request.HasCabin.GetValueOrDefault() && request.BusinessType.HasValue)
|
|
|
|
|
{
|
|
|
|
|
//如果为现舱,获取下一任务类型进行创建
|
|
|
|
@ -263,19 +249,19 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
Head = new TaskManageOrderMessageHeadInfo
|
|
|
|
|
{
|
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
|
BSNO = request.BusinessId,
|
|
|
|
|
BSNO = request.ParentBusinessId ?? request.BusinessId,
|
|
|
|
|
MessageType = "WORK_FLOW_TASK",
|
|
|
|
|
SenderId = "WorkFlow",
|
|
|
|
|
SenderName = "工作流平台",
|
|
|
|
|
ReceiverId = "TaskManage",
|
|
|
|
|
ReceiverName = "任务管理平台",
|
|
|
|
|
Version = "1.0",
|
|
|
|
|
RequestDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
|
|
|
|
RequestAction = "Add"
|
|
|
|
|
IsChild = request.ParentBusinessId.HasValue,
|
|
|
|
|
ChildBSNO = request.ParentBusinessId.HasValue ? request.BusinessId : 0
|
|
|
|
|
},
|
|
|
|
|
Main = new TaskManageOrderMessageMainInfo
|
|
|
|
|
{
|
|
|
|
|
TaskType = request.TaskType,
|
|
|
|
|
TaskType = request.ParentTaskType ?? request.TaskType,
|
|
|
|
|
TaskSource = TaskSourceEnum.WORK_FLOW,
|
|
|
|
|
TaskTitle = request.TaskTitle,
|
|
|
|
|
TaskDesp = request.TaskDescription,
|
|
|
|
@ -283,7 +269,8 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
TaskUserName = User.UserName,
|
|
|
|
|
TaskTenatId = long.Parse(User.TenantId),
|
|
|
|
|
TaskTenatName = User.TenantName,
|
|
|
|
|
IsCheckExistsByTaskType = true
|
|
|
|
|
IsCheckExistsByTaskType = true,
|
|
|
|
|
ChildTaskType = request.TaskType
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -548,7 +535,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="useTransaction">是否使用事务</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
|
|
|
|
|
public virtual async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
|
|
|
|
|
{
|
|
|
|
|
if (!await HasAuthorizedAsync())
|
|
|
|
|
return DataResult.FailedWithDesc(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ModuleUnauthorized)));
|
|
|
|
@ -651,7 +638,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <param name="useTransaction">是否使用事务</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> SetStepsAsync(TaskRequest request, bool useTransaction = true)
|
|
|
|
|
public virtual async Task<DataResult> SetStepsAsync(TaskRequest request, bool useTransaction = true)
|
|
|
|
|
{
|
|
|
|
|
if (!await HasAuthorizedAsync())
|
|
|
|
|
return DataResult.FailedWithDesc(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ModuleUnauthorized)));
|
|
|
|
@ -679,6 +666,8 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
IsCompleted = x.IsCompleted,
|
|
|
|
|
SortOrder = x.SortOrder
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
if (allSteps.All(x => x.IsCompleted))
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
|
|
|
|
|
|
|
|
|
|
//获取未完成的优先级最高的步骤
|
|
|
|
|
var topSteps = allSteps.Where(x => !x.IsCompleted).GroupBy(x => x.SortOrder).OrderBy(x => x.Key).FirstOrDefault();
|
|
|
|
@ -811,14 +800,14 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 返回指定类型的任务是否已存在
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">业务ID</param>
|
|
|
|
|
/// <param name="bsId">业务ID</param>
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
/// <param name="type">任务类型</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<bool>> ExistsAsync(long id, BusinessType businessType, TaskBaseTypeEnum type)
|
|
|
|
|
public async Task<DataResult<bool>> ExistsAsync(long bsId, BusinessType businessType, TaskBaseTypeEnum type)
|
|
|
|
|
{
|
|
|
|
|
var value = await TenantDb.Queryable<BusinessTask>().AnyAsync(x =>
|
|
|
|
|
x.BusinessId == id && x.BusinessType == businessType && x.TaskType == type);
|
|
|
|
|
x.BusinessId == bsId && x.BusinessType == businessType && x.TaskType == type);
|
|
|
|
|
return DataResult<bool>.Success(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1338,7 +1327,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
if (businessType.HasValue)
|
|
|
|
|
biz = await ActionService.GetBusinessDataAsync(id, businessType.Value);
|
|
|
|
|
|
|
|
|
|
var result = await TaskAllocationService.GetAllotUserBySeaExportId(taskTypes, id, new TaskFlowDataContext(
|
|
|
|
|
var result = await TaskAllocationService.Value.GetAllotUserBySeaExportId(taskTypes, id, new TaskFlowDataContext(
|
|
|
|
|
(TaskFlowDataNameConst.Business, biz)
|
|
|
|
|
));
|
|
|
|
|
return result.Succeeded ? result.Data : [];
|
|
|
|
|