|
|
@ -474,7 +474,31 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
x.UpdateTime
|
|
|
|
x.UpdateTime
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
}).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)
|
|
|
|
if (!result.Succeeded)
|
|
|
|
return DataResult.Failed(result.Message, result.MultiCode);
|
|
|
|
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)
|
|
|
|
if (request.Steps == null || request.Steps.Count == 0)
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.SubTaskCannotNull));
|
|
|
|
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)
|
|
|
|
if (useTransaction)
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
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)
|
|
|
|
var allSteps = await TenantDb.Queryable<TaskStep>().Where(x => x.TaskId == task.Id && !x.IsCompleted).OrderBy(x => x.Priority)
|
|
|
|
.Select(x => new TaskStep
|
|
|
|
.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))
|
|
|
|
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,
|
|
|
|
ParentId = request.ParentId,
|
|
|
|
BusinessType = task.BusinessType,
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
TaskTypeName = request.TaskTypeName,
|
|
|
|
TaskTypeName = request.TaskTypeName,
|
|
|
|
TaskStatus = TaskStatusEnum.Complete
|
|
|
|
TaskStatus = TaskStatusEnum.Complete
|
|
|
|
}, false);
|
|
|
|
}, false);
|
|
|
|