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