|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.Module.Core.Helpers;
|
|
|
|
|
using DS.Module.DjyRulesEngine;
|
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
@ -12,16 +13,17 @@ using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Entity.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Op.Interface;
|
|
|
|
|
using DS.WMS.Core.Op.Interface.TaskInteraction;
|
|
|
|
|
using DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector;
|
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
|
using DS.WMS.Core.TaskPlat;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Entity;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Masuit.Tools;
|
|
|
|
|
using Masuit.Tools.Systems;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using static DS.WMS.Core.Op.Method.TaskInteraction.ActionSelector.BookingSelector;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
{
|
|
|
|
@ -56,7 +58,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工作流服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected IClientFlowInstanceService FlowService { get; private set; }
|
|
|
|
|
protected Lazy<IClientFlowInstanceService> FlowService { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 动作服务
|
|
|
|
@ -73,6 +75,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected IClientParamService ClientParamService { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 规则引擎服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected Lazy<IRuleEngineService> RuleEngineService { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
|
/// </summary>
|
|
|
|
@ -82,11 +89,13 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
ManagerService = provider.GetRequiredService<ITaskManageService>();
|
|
|
|
|
LogService = provider.GetRequiredService<ITaskLogService>();
|
|
|
|
|
TaskAllocationService = provider.GetRequiredService<ITaskAllocationService>();
|
|
|
|
|
FlowService = provider.GetRequiredService<IClientFlowInstanceService>();
|
|
|
|
|
ActionService = provider.GetRequiredService<IActionManagerService>();
|
|
|
|
|
OpService = provider.GetRequiredService<ISeaExportService>();
|
|
|
|
|
ClientParamService = provider.GetRequiredService<IClientParamService>();
|
|
|
|
|
|
|
|
|
|
FlowService = new Lazy<IClientFlowInstanceService>(provider.GetRequiredService<IClientFlowInstanceService>());
|
|
|
|
|
RuleEngineService = new Lazy<IRuleEngineService>(provider.GetRequiredService<IRuleEngineService>());
|
|
|
|
|
|
|
|
|
|
TenantDb.QueryFilter.Clear<IOrgId>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -99,7 +108,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
{
|
|
|
|
|
var order = await ActionService.GetBusinessDataAsync(current.BusinessId, current.BusinessType);
|
|
|
|
|
TaskFlowRuner flowRuner = new(TenantDb, ServiceProvider);
|
|
|
|
|
var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
|
|
|
|
|
var taskType = await flowRuner.GetWorkFlowNextConfigByTaskType(TaskBaseTypeEnum.WORK_FLOW_MAIN,
|
|
|
|
|
new TaskFlowDataContext(
|
|
|
|
|
(TaskFlowDataNameConst.Business, order)
|
|
|
|
|
), current.TaskType);
|
|
|
|
@ -215,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;
|
|
|
|
@ -255,7 +286,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (template == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
|
|
|
|
|
|
|
|
|
|
var result = FlowService.CreateFlowInstance(new CreateFlowInstanceReq
|
|
|
|
|
var result = FlowService.Value.CreateFlowInstance(new CreateFlowInstanceReq
|
|
|
|
|
{
|
|
|
|
|
BusinessId = task.BusinessId,
|
|
|
|
|
BusinessType = task.BusinessType,
|
|
|
|
@ -268,7 +299,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
task.FlowId = instance.Id;
|
|
|
|
|
await TenantDb.Updateable(task).UpdateColumns(x => x.FlowId).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
result = FlowService.StartFlowInstance(instance.Id.ToString());
|
|
|
|
|
result = FlowService.Value.StartFlowInstance(instance.Id.ToString());
|
|
|
|
|
instance = result.Data as FlowInstance;
|
|
|
|
|
|
|
|
|
|
if (result.Succeeded && changeMarker)
|
|
|
|
@ -365,7 +396,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (request.TaskType == TaskBaseTypeEnum.WAIT_ORDER_AUDIT)
|
|
|
|
|
{
|
|
|
|
|
dic = new Dictionary<string, object>();
|
|
|
|
|
var param = await ClientParamService.GetParamAsync<string>(task.BusinessId, Booking_Route,
|
|
|
|
|
var param = await ClientParamService.GetParamAsync<string>(task.BusinessId, BookingSelector.Booking_Route,
|
|
|
|
|
(x, y) => x.CustomerId == y.ForwarderId);
|
|
|
|
|
dic[TaskFlowDataNameConst.ClientParam] = param;
|
|
|
|
|
}
|
|
|
|
@ -546,7 +577,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
|
|
|
|
|
if (task.FlowId == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FlowNotFound));
|
|
|
|
|
|
|
|
|
|
var result = FlowService.AuditFlowInstance(new FlowAuditInfo
|
|
|
|
|
var result = FlowService.Value.AuditFlowInstance(new FlowAuditInfo
|
|
|
|
|
{
|
|
|
|
|
AuditNote = request.Remark,
|
|
|
|
|
Status = request.Result,
|
|
|
|
|