Revert "审核任务需要校验订单规则"

This reverts commit 75fbdd4f4c.
usertest
嵇文龙 3 months ago
parent 501c30d06d
commit 5be1acfeba

@ -81,7 +81,8 @@ namespace DS.Module.DjyRulesEngine
Port = port,
Path = sendUrl
};
var result = await api.PostAsync<RuleEngineResult>(uriBuilder.ToString(), req);
string url = uriBuilder.ToString();
var result = await api.PostAsync<RuleEngineResult>(url, req);
if (!result.Succeeded || result.Data == null)
return RuleEngineResult.Failed("请求失败,请联系管理员");

@ -99,6 +99,22 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
TenantDb.QueryFilter.Clear<IOrgId>();
}
/// <summary>
/// 获取给定任务的下一任务类型
/// </summary>
/// <param name="current">当前任务对象</param>
/// <returns></returns>
protected async Task<TaskBaseTypeEnum?> GetNextTypeAsync(BusinessTask current)
{
var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType);
TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
new TaskFlowDataContext(
(TaskFlowDataNameConst.Business, order)
), current.TaskType);
return taskType;
}
/// <summary>
/// 创建关联任务
@ -115,14 +131,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task != null && task.TaskStatus != TaskStatusEnum.Cancel)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists));
//审核任务需要校验订单规则
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
{
var result = await CheckOrderRulesAsync(request.BusinessId);
if (!result.Succeeded)
return result;
}
long tenatId = long.Parse(User.TenantId);
string tenatName = Db.Queryable<SysTenant>().Where(x => x.Id == tenatId).Select(x => x.Name).First();
var info = new TaskManageOrderMessageInfo
@ -216,6 +224,28 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
//审核任务需创建工作流
if (AuditTaskTypes.Contains(request.TaskType))
{
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
{
var rulesReq = new RuleEngineReq();
rulesReq.Head.MessageType = "BUSI_RULE";
rulesReq.Head.SenderId = "NewOceanBooking";
rulesReq.Head.RequestAction = "CheckRule";
rulesReq.Main.ProjectCode = ["COMMON_OCEAN_BOOKING"];
var order = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == request.BusinessId).FirstAsync();
rulesReq.Main.BusinessInfo = info.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
var ruleResult = await RuleEngineService.Value.ExecuteSeaExportAuditRulesAsync(rulesReq);
if (ruleResult?.Extra.DetailList?.Count > 0)
{
StringBuilder sb = new StringBuilder();
foreach (var item in ruleResult?.Extra.DetailList)
sb.Append(item.ResultName);
return DataResult.Failed(sb.ToString());
}
}
result = await CreateAndStartWorkflow(task);
if (!result.Succeeded)
return result;
@ -461,14 +491,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (task.TaskStatus == TaskStatusEnum.Pending || task.TaskStatus == TaskStatusEnum.Create)
{
//审核任务需要校验订单规则
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
{
var result = await CheckOrderRulesAsync(request.BusinessId);
if (!result.Succeeded)
return result;
}
await TenantDb.Ado.BeginTranAsync();
try
{
@ -668,51 +690,6 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
});
}
async Task<DataResult> CheckOrderRulesAsync(long businessId)
{
var rulesReq = new RuleEngineReq();
rulesReq.Head.MessageType = "BUSI_RULE";
rulesReq.Head.SenderId = "NewOceanBooking";
rulesReq.Head.RequestAction = "CheckRule";
rulesReq.Main.ProjectCode = ["COMMON_OCEAN_BOOKING"];
var order = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == businessId).FirstAsync();
if (order == null)
return DataResult.FailedWithDesc(MultiLanguageConst.EmptyData);
rulesReq.Main.BusinessInfo = order.Adapt<RulesEngineOrderBookingMainBusinessInfo>();
var ruleResult = await RuleEngineService.Value.ExecuteSeaExportAuditRulesAsync(rulesReq);
if (ruleResult?.Extra.DetailList?.Count > 0)
{
StringBuilder sb = new StringBuilder();
foreach (var item in ruleResult?.Extra.DetailList)
sb.Append(" " + item.ResultName);
sb.Remove(0, 1);
return DataResult.Failed(sb.ToString());
}
return DataResult.Success;
}
/// <summary>
/// 获取给定任务的下一任务类型
/// </summary>
/// <param name="current">当前任务对象</param>
/// <returns></returns>
protected async Task<TaskBaseTypeEnum?> GetNextTypeAsync(BusinessTask current)
{
var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType);
TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
new TaskFlowDataContext(
(TaskFlowDataNameConst.Business, order)
), current.TaskType);
return taskType;
}
/// <summary>
/// 获取指定类型的业务关联任务
/// </summary>

Loading…
Cancel
Save