|
|
|
@ -474,7 +474,31 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
x.UpdateTime
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
DataResult result = await ManagerService.SetTaskStatusWithBsno(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now, false, request.TaskDesc);
|
|
|
|
|
DataResult result;
|
|
|
|
|
if (request.ParentId.HasValue || request.ParentBusinessId.HasValue) //设置子任务状态
|
|
|
|
|
{
|
|
|
|
|
var parentTask = await TenantDb.Queryable<BusinessTask>().Where(x => x.BusinessType == request.BusinessType)
|
|
|
|
|
.WhereIF(request.ParentId.HasValue, x => x.Id == request.ParentId)
|
|
|
|
|
.WhereIF(request.ParentBusinessId.HasValue, x => x.BusinessId == request.ParentBusinessId && x.TaskType == request.ParentTaskType)
|
|
|
|
|
.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.BusinessId,
|
|
|
|
|
x.TaskType
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
if (parentTask == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.MainTaskNotFound));
|
|
|
|
|
|
|
|
|
|
result = await ManagerService.SetTaskStatusWithBsno(
|
|
|
|
|
parentTask.BusinessId, parentTask.TaskType,
|
|
|
|
|
request.TaskStatus, DateTime.Now, false, request.TaskDesc,
|
|
|
|
|
childBsno: request.BusinessId,
|
|
|
|
|
childTaskBaseTypeEnum: request.TaskType);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = await ManagerService.SetTaskStatusWithBsno(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now, false, request.TaskDesc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return DataResult.Failed(result.Message, result.MultiCode);
|
|
|
|
|
|
|
|
|
@ -538,17 +562,16 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
if (request.Steps == null || request.Steps.Count == 0)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.SubTaskCannotNull));
|
|
|
|
|
|
|
|
|
|
BusinessTask task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
|
|
|
|
|
if (task == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotExists));
|
|
|
|
|
if (task.TaskStatus == TaskStatusEnum.Complete)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
|
|
|
|
|
|
|
|
|
|
if (useTransaction)
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
BusinessTask task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
|
|
|
|
|
if (task == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotExists));
|
|
|
|
|
if (task.TaskStatus == TaskStatusEnum.Complete)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
|
|
|
|
|
|
|
|
|
|
var allSteps = await TenantDb.Queryable<TaskStep>().Where(x => x.TaskId == task.Id && !x.IsCompleted).OrderBy(x => x.Priority)
|
|
|
|
|
.Select(x => new TaskStep
|
|
|
|
|
{
|
|
|
|
@ -598,10 +621,11 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
|
|
|
|
|
if (request.AutoSync && allSteps.Count > 0 && allSteps.Count == allSteps.Count(x => x.IsCompleted))
|
|
|
|
|
{
|
|
|
|
|
var result = await SetTaskStatusAsync(new TaskUpdateRequest
|
|
|
|
|
DataResult result = await SetTaskStatusAsync(new TaskUpdateRequest
|
|
|
|
|
{
|
|
|
|
|
BusinessId = task.BusinessId,
|
|
|
|
|
BusinessType = task.BusinessType,
|
|
|
|
|
ParentId = request.ParentId,
|
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
|
TaskTypeName = request.TaskTypeName,
|
|
|
|
|
TaskStatus = TaskStatusEnum.Complete
|
|
|
|
|
}, false);
|
|
|
|
|