|
|
|
@ -115,14 +115,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 +208,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;
|
|
|
|
@ -346,8 +360,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
{
|
|
|
|
|
BusinessId = request.BusinessId,
|
|
|
|
|
BusinessType = request.BusinessType,
|
|
|
|
|
TaskTypeName = task.NextType.Value.ToString(),
|
|
|
|
|
RecvUserIdList = task.RecvUserIdArray
|
|
|
|
|
TaskTypeName = task.NextType.Value.ToString()
|
|
|
|
|
};
|
|
|
|
|
result = await CreateTaskAsync(req, false);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
@ -363,7 +376,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (task.TaskStatus == TaskStatusEnum.Complete)//目前限制任务完成才触发
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, object>? dic = null;
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
if (task.NextType == TaskBaseTypeEnum.WAIT_BOOKING)
|
|
|
|
|
{
|
|
|
|
|
dic = new Dictionary<string, object>();
|
|
|
|
|
var param = await ClientParamService.GetParamAsync<string>(task.BusinessId, BookingSelector.Booking_Route,
|
|
|
|
@ -461,14 +474,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
|
|
|
|
|
{
|
|
|
|
@ -627,7 +632,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
BusinessType = callback.BusinessType.Value,
|
|
|
|
|
TaskTypeName = taskType.ToString(),
|
|
|
|
|
TaskStatus = callback.FlowStatus == FlowStatusEnum.Approve ? TaskStatusEnum.Complete : TaskStatusEnum.Pending,
|
|
|
|
|
AutoCreateNext = false //审批完成后需根据业务需要自定义任务类型,因此设置为不自动创建下一任务
|
|
|
|
|
AutoCreateNext = true
|
|
|
|
|
};
|
|
|
|
|
//根据审批结果更新任务状态
|
|
|
|
|
await SetTaskStatusAsync(req);
|
|
|
|
@ -668,34 +673,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>
|
|
|
|
|