|
|
|
@ -48,6 +48,7 @@ using NPOI.SS.Formula.Functions;
|
|
|
|
|
using NPOI.SS.UserModel;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
using NPOI.XSSF.Model;
|
|
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
|
|
using Org.BouncyCastle.Asn1.Tsp;
|
|
|
|
|
using Org.BouncyCastle.Asn1.X500;
|
|
|
|
|
using Org.BouncyCastle.Asn1.X9;
|
|
|
|
@ -63,6 +64,7 @@ using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Reflection.Metadata.Ecma335;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Security.Policy;
|
|
|
|
@ -133,6 +135,9 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<TaskPOLContainerNotPickUpInfo> _taskPOLContainerNotPickUpInfoRepository;
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<TaskFlowTenant> _taskFlowTenant;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
|
|
|
|
|
private readonly ISysCacheService _cache;
|
|
|
|
@ -162,6 +167,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
//LARA纸计算常量
|
|
|
|
|
const int LARA_PARER_DRAFT_VAR = 3;
|
|
|
|
|
private readonly BookingOrderAutoService _bookingOrderAuto;
|
|
|
|
|
|
|
|
|
|
public TaskManageService(SqlSugarRepository<TaskBaseInfo> taskBaseInfoRepository,
|
|
|
|
|
SqlSugarRepository<TaskSISubmitted> taskSISubmittedRepository,
|
|
|
|
@ -220,7 +226,8 @@ namespace Myshipping.Application
|
|
|
|
|
INamedServiceProvider<ITaskPOLContainerNotPickUpService> namedTaskPOLContainerNotPickUpServiceProvider,
|
|
|
|
|
INamedServiceProvider<ITaskManageCutDateChangeService> namedTaskManageCutDateChangeServiceProvider,
|
|
|
|
|
INamedServiceProvider<IRouteChangeAdvisoryService> namedRouteChangeAdvisoryServiceServiceProvider,
|
|
|
|
|
ILogger<BookingOrderService> logger)
|
|
|
|
|
ILogger<BookingOrderService> logger, BookingOrderAutoService bookingOrderAuto,
|
|
|
|
|
SqlSugarRepository<TaskFlowTenant> taskFlowTenant)
|
|
|
|
|
{
|
|
|
|
|
_taskBaseInfoRepository = taskBaseInfoRepository;
|
|
|
|
|
_taskSISubmittedRepository = taskSISubmittedRepository;
|
|
|
|
@ -289,6 +296,8 @@ namespace Myshipping.Application
|
|
|
|
|
_namedTaskPOLContainerNotPickUpServiceProvider = namedTaskPOLContainerNotPickUpServiceProvider;
|
|
|
|
|
_namedTaskManageCutDateChangeServiceProvider = namedTaskManageCutDateChangeServiceProvider;
|
|
|
|
|
_namedRouteChangeAdvisoryServiceServiceProvider = namedRouteChangeAdvisoryServiceServiceProvider;
|
|
|
|
|
_bookingOrderAuto = bookingOrderAuto;
|
|
|
|
|
_taskFlowTenant = taskFlowTenant;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 创建任务
|
|
|
|
@ -1049,6 +1058,30 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
await name.SyncBookingSlotChange(bcInfo.TASK_ID, bcInfo.TenantId.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 自动化处理
|
|
|
|
|
if (taskInfo.CARRIER_ID =="CMA")
|
|
|
|
|
{
|
|
|
|
|
var flow = _taskFlowTenant.AsQueryable().Filter(null, true).Where(t => t.FlowCode == "CMABC" && t.IsMain == true &&t.TenantId== taskInfo.TenantId.Value).First();
|
|
|
|
|
if (flow!=null)
|
|
|
|
|
{
|
|
|
|
|
//方法请求参数
|
|
|
|
|
RecursiveMethodModel mt = new RecursiveMethodModel();
|
|
|
|
|
//TODO待完善请求参数
|
|
|
|
|
mt.parse_attachment = info.Main.parse_attachment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RecursiveMethod(flow, 0, mt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -1911,7 +1944,71 @@ namespace Myshipping.Application
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 执行方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flow">当前流程配置</param>
|
|
|
|
|
/// <param name="depth">循环深度</param>
|
|
|
|
|
public void RecursiveMethod(TaskFlowTenant flow,int depth, RecursiveMethodModel model)
|
|
|
|
|
{
|
|
|
|
|
depth = depth++;
|
|
|
|
|
|
|
|
|
|
//防止配置错误引发死循环,此处设置最多深度20层
|
|
|
|
|
if (depth>=20)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 获取方法信息
|
|
|
|
|
MethodInfo methodInfo = typeof(BookingOrderAutoService).GetMethod(flow.MethodName);
|
|
|
|
|
|
|
|
|
|
// 确保方法存在
|
|
|
|
|
if (methodInfo != null)
|
|
|
|
|
{
|
|
|
|
|
// 调用方法
|
|
|
|
|
object result = methodInfo.Invoke(_bookingOrderAuto, new object[] { model });
|
|
|
|
|
//如果返回类型为bool
|
|
|
|
|
if (flow.IsBoolReturn)
|
|
|
|
|
{
|
|
|
|
|
if ((bool)result)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty( flow.TrueMethod))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var newflow = _taskFlowTenant.AsQueryable().Filter(null, true).Where(t => t.MethodName == flow.TrueMethod).First();
|
|
|
|
|
RecursiveMethod(newflow, depth,model);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((bool)result)
|
|
|
|
|
{
|
|
|
|
|
if (flow.TrueMethod==null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var newflow = _taskFlowTenant.AsQueryable().Filter(null, true).Where(t => t.MethodName == flow.FalseMethod).First();
|
|
|
|
|
RecursiveMethod(newflow, depth, model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var newflow = _taskFlowTenant.AsQueryable().Filter(null, true).Where(t => t.PId == flow.PK_ID).First();
|
|
|
|
|
if (newflow==null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
RecursiveMethod(newflow, depth,model);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
($"方法{flow.MethodName}不存在").LogInformation();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 查询订舱表查询用户和租户信息
|
|
|
|
|
/// <summary>
|
|
|
|
|