cjy 4 weeks ago
commit 3367d57a0a

@ -1570,6 +1570,8 @@ public static class MultiLanguageConst
public const string TypeOrName = "TypeOrName"; public const string TypeOrName = "TypeOrName";
[Description("此任务尚有未完成的优先级别更高的子任务或前置条件")] [Description("此任务尚有未完成的优先级别更高的子任务或前置条件")]
public const string HigherUnfinishedItems = "Higher_Unfinished_Items"; public const string HigherUnfinishedItems = "Higher_Unfinished_Items";
[Description("无法获取主任务信息")]
public const string MainTaskNotFound = "Main_Task_NotFound";
#endregion #endregion
#region 任务台相关 #region 任务台相关

@ -42,7 +42,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
if (request.Steps?.Count > 0) if (request.Steps?.Count > 0)
{ {
if (request.Steps.Where(x => x.Type != StepType.NotSpecified).GroupBy(x => x.Type).Select(x => x.Key).Count() == 1) if (request.Steps.Where(x => x.Type != StepType.NotSpecified).GroupBy(x => x.Type).Select(x => x.Key).Count() > 1)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DuplicateStepType)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DuplicateStepType));
if (request.Steps.Any(x => x.Type == StepType.NotSpecified && string.IsNullOrEmpty(x.Name))) if (request.Steps.Any(x => x.Type == StepType.NotSpecified && string.IsNullOrEmpty(x.Name)))

@ -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));
if (useTransaction)
await TenantDb.Ado.BeginTranAsync();
try
{
BusinessTask task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync(); BusinessTask task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync();
if (task == null) if (task == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotExists)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskNotExists));
if (task.TaskStatus == TaskStatusEnum.Complete) if (task.TaskStatus == TaskStatusEnum.Complete)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted)); return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
if (useTransaction)
await TenantDb.Ado.BeginTranAsync();
try
{
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);

Loading…
Cancel
Save