|
|
|
@ -25,6 +25,7 @@ using Mapster;
|
|
|
|
|
using Masuit.Tools;
|
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
@ -235,7 +236,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
{
|
|
|
|
|
result = await CheckRulesAsync(request.BusinessId, request.BusinessType.Value, RuleEngineType.COMMON_ORDER_AUDIT);
|
|
|
|
|
result = await CheckRulesAsync(request.TaskType, request.BusinessId, request.BusinessType.Value, RuleEngineType.COMMON_ORDER_AUDIT);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -754,7 +755,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
|
|
|
|
|
if (task.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
{
|
|
|
|
|
result = await CheckRulesAsync(request.BusinessId, request.BusinessType.Value, RuleEngineType.COMMON_ORDER_AUDIT);
|
|
|
|
|
result = await CheckRulesAsync(request.TaskType, request.BusinessId, request.BusinessType.Value, RuleEngineType.COMMON_ORDER_AUDIT);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -970,7 +971,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
//如果当前审批为终审,则调用规则库进行校验
|
|
|
|
|
if (request.Result == 1 && request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT && instance.GetMarkerList().Length == 1)
|
|
|
|
|
{
|
|
|
|
|
result = await CheckRulesAsync(instance.BusinessId, request.BusinessType.GetValueOrDefault(), RuleEngineType.COMMON_OCEAN_BOOKING);
|
|
|
|
|
result = await CheckRulesAsync(request.TaskType, instance.BusinessId, request.BusinessType.GetValueOrDefault(), RuleEngineType.COMMON_OCEAN_BOOKING);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -1229,7 +1230,8 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task<DataResult> CheckRulesAsync(long bsId, BusinessType businessType, RuleEngineType ruleType)
|
|
|
|
|
//调用规则库
|
|
|
|
|
async Task<DataResult> CheckRulesAsync(TaskBaseTypeEnum taskType, long bsId, BusinessType businessType, RuleEngineType ruleType)
|
|
|
|
|
{
|
|
|
|
|
var rulesReq = new RuleEngineReq();
|
|
|
|
|
var order = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == bsId).FirstAsync();
|
|
|
|
@ -1239,7 +1241,17 @@ namespace DS.WMS.Core.TaskInteraction.Method
|
|
|
|
|
var ruleResult = await RuleEngineService.Value.ExecuteSeaExportAuditRulesAsync(rulesReq);
|
|
|
|
|
if (string.Equals(ruleResult.Succ, bool.FalseString, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed(ruleResult.Msg);
|
|
|
|
|
string msg = "校验规则API返回了错误:" + ruleResult.Msg;
|
|
|
|
|
var taskLog = new BusinessTaskLog
|
|
|
|
|
{
|
|
|
|
|
BusinessId = bsId,
|
|
|
|
|
BusinessType = businessType,
|
|
|
|
|
ActionType = ActionType.Validation,
|
|
|
|
|
TaskType = taskType,
|
|
|
|
|
Remark = msg + ";请求参数:" + JsonConvert.SerializeObject(rulesReq)
|
|
|
|
|
};
|
|
|
|
|
await LogService.WriteLogAsync(taskLog);
|
|
|
|
|
return DataResult.Failed(msg);
|
|
|
|
|
}
|
|
|
|
|
else if (ruleResult.Extra.DetailList?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|