屏蔽新开发功能

usertest
嵇文龙 3 months ago
parent 47d99da6dc
commit cc96089e92

@ -1,5 +1,4 @@
using DS.Module.Core;
using DS.Module.Core.Condition;
using DS.Module.Core.Data;
using DS.Module.Core.Helpers;
using DS.WMS.Core.Flow.Dtos;
@ -18,7 +17,6 @@ using DS.WMS.Core.TaskPlat.Interface;
using Masuit.Tools;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using SqlSugar;
namespace DS.WMS.Core.Op.Method.TaskInteraction
@ -74,6 +72,23 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
ActionService = new Lazy<IActionManagerService>(provider.GetRequiredService<IActionManagerService>());
}
/// <summary>
/// 获取给定任务的下一默认任务类型
/// </summary>
/// <param name="current">任务信息</param>
/// <returns></returns>
internal static async Task<TaskBaseTypeEnum?> GetDefaultNextTypeAsync(BusinessTask current)
{
if (current.TaskType == TaskBaseTypeEnum.NOT_SPECIFIED || current.TaskType == TaskBaseTypeEnum.WAIT_CHECKOUT_BILL) //流程的最后一步
return null;
int currentTypeVal = (int)current.TaskType;
if (currentTypeVal >= 300) //300开始的枚举值为可选服务项目不存在前后关联性
return null;
return (TaskBaseTypeEnum)(currentTypeVal + 1);
}
/// <summary>
/// 获取给定任务的下一任务类型
/// </summary>
@ -258,8 +273,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task != null && task.TaskStatus != TaskStatusEnum.Cancel)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
if (await ShouldSkipAsync(request))
return DataResult.Success;
//if (await ShouldSkipAsync(request))
// return DataResult.Success;
long tenatId = long.Parse(User.TenantId);
string tenatName = Db.Queryable<SysTenant>().Where(x => x.Id == tenatId).Select(x => x.Name).First();
@ -347,7 +362,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
CreateBy = long.Parse(User.UserId),
CreateTime = DateTime.Now
};
task.NextType = await GetNextTypeAsync(task);
task.NextType = await GetDefaultNextTypeAsync(task);
await TenantDb.Insertable(task).ExecuteCommandAsync();
//审核任务需创建工作流
@ -380,21 +395,21 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
}
internal async Task<bool> ShouldSkipAsync(TaskRequest request)
{
var configList = await TenantDb.Queryable<BusinessTaskConfig>().Where(x => x.TaskType == request.TaskType && x.IsSkip)
.Select(x => new { x.Id, x.SourceName, x.MatchCondition }).ToListAsync();
if (configList.Count > 0)
{
var conditionList = configList.Select(x => new { x.Id, x.SourceName, MatchCondition = JsonConvert.DeserializeObject<ConditionContent>(x.MatchCondition) }).ToList();
foreach (var item in conditionList)
item.MatchCondition.SourceName = item.SourceName;
//internal async Task<bool> ShouldSkipAsync(TaskRequest request)
//{
// var configList = await TenantDb.Queryable<BusinessTaskConfig>().Where(x => x.TaskType == request.TaskType && x.IsSkip)
// .Select(x => new { x.Id, x.SourceName, x.MatchCondition }).ToListAsync();
// if (configList.Count > 0)
// {
// var conditionList = configList.Select(x => new { x.Id, x.SourceName, MatchCondition = JsonConvert.DeserializeObject<ConditionContent>(x.MatchCondition) }).ToList();
// foreach (var item in conditionList)
// item.MatchCondition.SourceName = item.SourceName;
return await ActionService.Value.IsMatchAsync(request, conditionList.Select(x => x.MatchCondition));
}
// return await ActionService.Value.IsMatchAsync(request, conditionList.Select(x => x.MatchCondition));
// }
return false;
}
// return false;
//}
/// <summary>
/// 创建并启动审批工作流
@ -516,8 +531,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (useTransaction)
await TenantDb.Ado.CommitTranAsync();
ActionService.Value.TriggerAction(task);
return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? await GetNextTypeAsync(task) : null);
//ActionService.Value.TriggerAction(task);
return DataResult<TaskBaseTypeEnum?>.Success(task.TaskStatus == TaskStatusEnum.Complete ? await GetDefaultNextTypeAsync(task) : null);
}
catch (Exception ex)
{
@ -676,7 +691,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <returns></returns>
protected internal async Task<Dictionary<TaskBaseTypeEnum, List<RecvUserInfo>>> GetRecvUsersAsync(long id, BusinessType businessType, List<TaskBaseTypeEnum> taskTypes)
{
var biz = ActionService.Value.GetBusinessDataAsync(id, businessType);
var biz = await ActionService.Value.GetBusinessDataAsync(id, businessType);
var result = await TaskAllocationService.Value.GetAllotUserBySeaExportId(taskTypes, id, new TaskFlowDataContext(
(TaskFlowDataNameConst.Business, biz)
));

Loading…
Cancel
Save