diff --git a/ds-wms-service/DS.Module.Core/Condition/ConditionContent.cs b/ds-wms-service/DS.Module.Core/Condition/ConditionContent.cs
index 650caa1c..036e4e94 100644
--- a/ds-wms-service/DS.Module.Core/Condition/ConditionContent.cs
+++ b/ds-wms-service/DS.Module.Core/Condition/ConditionContent.cs
@@ -1,11 +1,11 @@
namespace DS.Module.Core.Condition
{
- public class ContitionContent
+ public class ConditionContent
{
///
/// 逻辑操作符
///
- public string LogicalOperator { get; set; }
+ public string LogicalOperator { get; set; } = "and";
///
/// 条件组
@@ -15,7 +15,7 @@
///
/// 条件组
///
- public List Groups { get; set; }
+ public List? Groups { get; set; }
///
/// 数据源名称
diff --git a/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs b/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs
index 1ee02e7b..b88e9b40 100644
--- a/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs
+++ b/ds-wms-service/DS.Module.Core/Condition/ConditionHelper.cs
@@ -1,5 +1,4 @@
using DS.Module.Core.Data;
-using Fasterflect;
namespace DS.Module.Core.Condition
{
@@ -8,7 +7,7 @@ namespace DS.Module.Core.Condition
///
/// 根据ContitionContent条件,从数据上下文TaskFlowDataContext中取出指定数据,然后判断条件是否符合
///
- public static bool IsPass(ContitionContent conditionContent, TaskFlowDataContext dataContext)
+ public static bool IsPass(ConditionContent conditionContent, TaskFlowDataContext dataContext)
{
bool? thisScopeResult = null;
@@ -18,7 +17,7 @@ namespace DS.Module.Core.Condition
}
IDictionary? dataDic = null;
- if (dataContext.ContainsKey(conditionContent.SourceName))
+ if (!string.IsNullOrEmpty(conditionContent.SourceName) && dataContext.ContainsKey(conditionContent.SourceName))
{
dataDic = dataContext[conditionContent.SourceName] as IDictionary;
}
@@ -28,10 +27,9 @@ namespace DS.Module.Core.Condition
var itemResult = false;
string? valStr = null;
- if (dataDic != null)
+ if (dataDic != null && dataDic.TryGetValue(item.Field, out object? objVal))
{
- var obj = dataDic[item.Field];
- valStr = obj?.ToString();
+ valStr = objVal?.ToString();
}
else if (dataContext.ContainsKey(item.Field))
{
diff --git a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
index 9f83d9b4..cd30b13f 100644
--- a/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
+++ b/ds-wms-service/DS.Module.Core/Enums/TaskPlat/TaskBaseTypeEnum.cs
@@ -226,9 +226,9 @@ namespace DS.Module.Core
[Description("处理Draft")]
WAIT_DRAFT = 207,
///
- /// 放单
+ /// 截单
///
- [Description("放单")]
+ [Description("截单")]
WAIT_CHECKOUT_BILL = 208,
///
/// 退舱
@@ -286,7 +286,7 @@ namespace DS.Module.Core
///
/// 报商检
///
- [Description("报商检")]
+ [Description("商检")]
WAIT_SHANGJIAN = 308,
///
/// 报COA
@@ -304,10 +304,10 @@ namespace DS.Module.Core
[Description("拖车")]
WAIT_TUOCHE = 311,
///
- /// 办保险
+ /// 保险
///
- [Description("办保险")]
- WAIT_Insurance = 312,
+ [Description("保险")]
+ WAIT_INSURANCE = 312,
///
/// 出号
///
@@ -319,9 +319,9 @@ namespace DS.Module.Core
[Description("内点入货")]
WAIT_NDRH = 314,
///
- /// 发快递
+ /// 快递
///
- [Description("发快递")]
+ [Description("快递")]
WAIT_DELIVERY = 315,
///
/// 箱使
diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs
index 5bc2e993..33497664 100644
--- a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs
+++ b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs
@@ -437,12 +437,12 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
#endregion 或签
int nextNodeType = runtime.GetNextNodeType();
- var serializerSettings = new JsonSerializerSettings
- {
- // 设置为驼峰命名
- ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
- };
- instance.Content = JsonConvert.SerializeObject(runtime.ToFlowRoot(), Formatting.None, serializerSettings);
+ //var serializerSettings = new JsonSerializerSettings
+ //{
+ // // 设置为驼峰命名
+ // ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
+ //};
+ //instance.Content = JsonConvert.SerializeObject(runtime.ToFlowRoot(), Formatting.None, serializerSettings);
instance.Note = auditNote;
Db.Updateable(instance).ExecuteCommand();
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskAuditRequest.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskAuditRequest.cs
index 2380701d..3013eb08 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskAuditRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskAuditRequest.cs
@@ -1,4 +1,5 @@
-using System.Runtime.Serialization;
+using System.ComponentModel.DataAnnotations;
+using System.Runtime.Serialization;
using DS.Module.Core;
using DS.WMS.Core.Fee.Dtos;
@@ -7,7 +8,7 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
///
/// 任务审核请求
///
- public class TaskAuditRequest : AuditRequest
+ public class TaskAuditRequest : AuditRequest, IValidatableObject
{
///
/// 任务类型名称
@@ -19,5 +20,22 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
///
[IgnoreDataMember]
public TaskBaseTypeEnum TaskType => string.IsNullOrEmpty(TaskTypeName) ? TaskBaseTypeEnum.NOT_SPECIFIED : Enum.Parse(TaskTypeName);
+
+ ///
+ /// 确定当前对象是否有效
+ ///
+ /// 验证上下文
+ ///
+ public virtual IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (string.IsNullOrEmpty(TaskTypeName))
+ {
+ yield return new ValidationResult($"参数 {nameof(TaskTypeName)} 不能为空");
+ }
+ else if (!Enum.TryParse(TaskTypeName, out TaskBaseTypeEnum taskType))
+ {
+ yield return new ValidationResult($"参数 {nameof(TaskTypeName)} 值不在有效枚举范围之内");
+ }
+ }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskRequest.cs b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskRequest.cs
index 227c4891..c44564d0 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Dtos/TaskInteraction/TaskRequest.cs
@@ -49,7 +49,7 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
}
else if (!Enum.TryParse(TaskTypeName, out TaskBaseTypeEnum taskType))
{
- yield return new ValidationResult($"参数 {nameof(TaskTypeName)} 值无效");
+ yield return new ValidationResult($"参数 {nameof(TaskTypeName)} 值不在有效枚举范围之内");
}
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTask.cs b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTask.cs
index 416f9b42..a90ada24 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTask.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Entity/TaskInteraction/BusinessTask.cs
@@ -1,5 +1,4 @@
using DS.Module.Core;
-using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using SqlSugar;
@@ -83,5 +82,11 @@ namespace DS.WMS.Core.Op.Entity.TaskInteraction
///
[SugarColumn(ColumnDescription = "审批驳回理由", Length = 200, IsNullable = true)]
public string? RejectReason { get; set; }
+
+ ///
+ /// 下一任务配置ID
+ ///
+ [SugarColumn(ColumnDescription = "下一任务配置ID", IsNullable = true)]
+ public long? NextId { get; set; }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs
index 7a932736..3b08145d 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Interface/TaskInteraction/IActionManagerService.cs
@@ -1,5 +1,7 @@
using DS.Module.Core;
+using DS.Module.Core.Condition;
using DS.Module.Core.Data;
+using DS.WMS.Core.Op.Dtos.TaskInteraction;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Entity.TaskInteraction;
@@ -10,6 +12,23 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
///
public interface IActionManagerService
{
+ ///
+ /// 根据指定条件返回是否匹配的结果
+ ///
+ /// 任务请求
+ /// 匹配条件
+ ///
+ Task IsMatchAsync(TaskRequest request, IEnumerable conditions);
+
+ ///
+ /// 获取所需业务数据
+ ///
+ /// 业务ID
+ /// 业务类型
+ /// 条件字段
+ ///
+ Task GetBusinessDataAsync(long businessId, BusinessType businessType, IEnumerable conditions);
+
///
/// 获取所需业务数据
///
@@ -17,7 +36,7 @@ namespace DS.WMS.Core.Op.Interface.TaskInteraction
/// 业务类型
/// 返回字段列表
///
- dynamic? GetBusinessData(long businessId, BusinessType businessType, params string[] fields);
+ Task GetBusinessDataAsync(long businessId, BusinessType businessType, params string[] fields);
///
/// 执行特定动作
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/BookingActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs
similarity index 93%
rename from ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/BookingActionExecutor.cs
rename to ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs
index 823cf605..b2a339ba 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/BookingActionExecutor.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/BookingActionExecutor.cs
@@ -4,8 +4,11 @@ using DS.WMS.Core.Op.Interface.TaskInteraction;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
-namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
+namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking
{
+ ///
+ /// 订舱动作
+ ///
public class BookingActionExecutor : DefaultActionExecutor
{
internal const TaskBaseTypeEnum Booking_TaskType = TaskBaseTypeEnum.WAIT_BOOKING;
@@ -27,7 +30,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
return Task.CompletedTask;
}
- protected async Task CreateTask(ActionExecutionContext context)
+ protected async Task CreateTask(ActionExecutionContext context)
{
var result = await TaskService.Exists(context.TaskInfo.BusinessId, context.TaskInfo.BusinessType, Booking_TaskType);
//任务已存在,跳过创建步骤
@@ -42,7 +45,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
});
}
- protected async Task SetTaskComplete(ActionExecutionContext context)
+ protected async Task SetTaskComplete(ActionExecutionContext context)
{
var result = await TaskService.SetTaskStatusAsync(new TaskUpdateRequest
{
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/EDIActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs
similarity index 95%
rename from ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/EDIActionExecutor.cs
rename to ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs
index 1040a6a5..42472b6f 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/EDIActionExecutor.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/EDIActionExecutor.cs
@@ -4,7 +4,7 @@ using DS.WMS.Core.Op.Interface;
using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
-namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
+namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking
{
///
/// 用于发送EDI的执行器
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/MailActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs
similarity index 92%
rename from ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/MailActionExecutor.cs
rename to ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs
index 3c6506a6..164ae1d8 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/MailActionExecutor.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/Booking/MailActionExecutor.cs
@@ -6,7 +6,7 @@ using Masuit.Tools.Systems;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
-namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
+namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.Booking
{
///
/// 用于邮件发送的执行器
@@ -31,7 +31,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
var taskMailService = context.ServiceProvider.GetRequiredService();
MailService mailService = new(context.ServiceProvider);
BusinessTaskMail? mailConfig = null;
- if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail.Id), out var id))
+ if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail) + "." + nameof(BusinessTaskMail.Id), out var id))
{
if (id == null)
{
@@ -41,7 +41,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
var idVal = (long)Convert.ChangeType(id, typeof(long));
mailConfig = (await taskMailService.GetAsync(idVal)).Data;
}
- else if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail.Name), out var name))
+ else if (context.AdditionalData.TryGetValue(nameof(BusinessTaskMail) + "." + nameof(BusinessTaskMail.Name), out var name))
{
var mailName = name as string;
if (mailName.IsNullOrEmpty())
@@ -59,7 +59,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
}
result = await mailService.SendAsync(mailConfig, context.TaskInfo.BusinessId, context.TaskInfo.BusinessType);
- if (!result.Succeeded)
+ if (!result.Succeeded)
{
await LogService.WriteLogAsync(context.TaskInfo, result.Message);
return;
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs
index 5de5a9af..565aa1b2 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/DefaultActionExecutor.cs
@@ -4,6 +4,9 @@ using DS.WMS.Core.Op.Interface.TaskInteraction;
namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
{
+ ///
+ /// 默认动作执行器
+ ///
public class DefaultActionExecutor : IActionExecutor
{
internal static readonly ApiFox Api;
@@ -13,6 +16,11 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor
Api = new ApiFox();
}
+ ///
+ /// 执行空的动作
+ ///
+ ///
+ ///
public virtual Task ExecuteAsync(ActionExecutionContext context)
{
return Task.CompletedTask;
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs
new file mode 100644
index 00000000..f6b69bc3
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionExecutor/SpaceRelease/SpaceReleaseActionExecutor.cs
@@ -0,0 +1,91 @@
+using System.ComponentModel;
+using DS.WMS.Core.Op.Dtos.TaskInteraction;
+using DS.WMS.Core.Op.Entity.TaskInteraction;
+using DS.WMS.Core.Op.Interface;
+using DS.WMS.Core.Op.Interface.TaskInteraction;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace DS.WMS.Core.Op.Method.TaskInteraction.ActionExecutor.SpaceRelease
+{
+ ///
+ /// 放舱动作
+ ///
+ public class SpaceReleaseActionExecutor : DefaultActionExecutor
+ {
+ public override async Task ExecuteAsync(ActionExecutionContext context)
+ {
+ if (!context.AdditionalData.TryGetValue("ActionType", out object? val))
+ return;
+
+ SpaceReleaseActionType actionType = (SpaceReleaseActionType)Convert.ChangeType(val, typeof(int));
+ if (actionType == SpaceReleaseActionType.None)
+ return;
+
+ var opService = context.ServiceProvider.GetRequiredService();
+ var logService = context.ServiceProvider.GetRequiredService();
+
+ if (actionType.HasFlag(SpaceReleaseActionType.ShippingOrder))
+ await SendShippingOrderAsync(opService, logService, context.TaskInfo);
+
+
+ }
+
+ //下货纸
+ internal async Task SendShippingOrderAsync(ISeaExportService opService, ITaskLogService logService, BusinessTask task)
+ {
+ var result = await opService.SendXHZ(task.BusinessId.ToString());
+ if (!result.Succeeded)
+ {
+ await logService.WriteLogAsync(task, "发送下货纸失败:" + result.Message);
+ }
+ }
+
+ //入货通知
+ internal async Task SendIncomingNotification(IOpBusinessYardService opService, ITaskLogService logService, BusinessTask task)
+ {
+ var result = opService.GetBusinessYardByKeyId(task.BusinessId.ToString());
+ if (!result.Succeeded)
+ {
+ await logService.WriteLogAsync(task, "获取入货通知数据源失败:" + result.Message);
+ return;
+ }
+
+
+ }
+
+ ////转发BC
+ //internal async Task RelayBC(ISeaExportService opService, ITaskLogService logService, BusinessTask task)
+ //{
+ //}
+ }
+
+ ///
+ /// 放舱动作类型
+ ///
+ [Flags]
+ public enum SpaceReleaseActionType
+ {
+ ///
+ /// 未设置
+ ///
+ None = 0,
+
+ ///
+ /// 下货纸
+ ///
+ [Description("下货纸")]
+ ShippingOrder = 1 << 0,
+
+ ///
+ /// 入货通知
+ ///
+ [Description("入货通知")]
+ IncomingNotification = 1 << 1,
+
+ ///
+ /// 转发BC
+ ///
+ [Description("船东BC")]
+ RelayBC = 1 << 2
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs
index 85f9fc5c..243ece04 100644
--- a/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs
+++ b/ds-wms-service/DS.WMS.Core/Op/Method/TaskInteraction/ActionManagerService.cs
@@ -1,15 +1,16 @@
using DS.Module.Core;
+using DS.Module.Core.Condition;
using DS.Module.Core.Data;
using DS.WMS.Core.Op.Dtos.TaskInteraction;
+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.TaskPlat;
-using Masuit.Tools;
-using SqlSugar;
using Fasterflect;
+using Masuit.Tools;
using Microsoft.Extensions.DependencyInjection;
-using DS.WMS.Core.Op.Entity;
-using DS.WMS.Core.Op.Interface;
+using SqlSugar;
namespace DS.WMS.Core.Op.Method.TaskInteraction
{
@@ -18,11 +19,79 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
///
public class ActionManagerService : ServiceBase, IActionManagerService
{
+ ITaskLogService LogService;
+
///
/// 初始化
///
public ActionManagerService(IServiceProvider serviceProvider) : base(serviceProvider)
{
+ LogService = serviceProvider.GetRequiredService();
+ }
+
+ ///
+ /// 根据指定条件返回是否匹配的结果
+ ///
+ /// 任务请求
+ /// 匹配条件
+ ///
+ public async Task IsMatchAsync(TaskRequest request, IEnumerable conditions)
+ {
+ ArgumentNullException.ThrowIfNull(request, nameof(request));
+ ArgumentNullException.ThrowIfNull(conditions, nameof(conditions));
+
+ var biz = await GetBusinessDataAsync(request.BusinessId, request.BusinessType, conditions);
+ if (biz != null)
+ {
+ TaskFlowDataContext dataContext = new(
+ (TaskFlowDataNameConst.Business, biz)
+ );
+ //循环匹配
+ foreach (var item in conditions)
+ {
+ if (ConditionHelper.IsPass(item, dataContext))
+ {
+ var logEntity = new BusinessTaskLog
+ {
+ ActionType = ActionType.Create,
+ BusinessId = request.BusinessId,
+ BusinessType = request.BusinessType,
+ TaskType = request.TaskType,
+ CreateBy = long.Parse(User.UserId),
+ CreateTime = DateTime.Now,
+ Remark = $"符合设定条件,已跳过任务的创建"
+ };
+ await LogService.WriteLogAsync(logEntity);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ ///
+ /// 获取所需业务数据
+ ///
+ /// 业务ID
+ /// 业务类型
+ /// 条件字段
+ ///
+ public async Task GetBusinessDataAsync(long businessId, BusinessType businessType, IEnumerable conditions)
+ {
+ ArgumentNullException.ThrowIfNull(conditions, nameof(conditions));
+
+ HashSet fields = [];
+ foreach (var item in conditions)
+ {
+ if (item.Conditions != null)
+ fields.AddRange(item.Conditions.Select(x => x.Field));
+
+ if (item.Groups != null)
+ fields.AddRange(item.Groups.SelectMany(x => x.Conditions.Select(x => x.Field)));
+ }
+
+ return await GetBusinessDataAsync(businessId, businessType, fields.ToArray());
}
///
@@ -32,7 +101,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// 业务类型
/// 返回字段列表
///
- public dynamic? GetBusinessData(long businessId, BusinessType businessType, params string[] fields)
+ public async Task GetBusinessDataAsync(long businessId, BusinessType businessType, params string[] fields)
{
object? biz = null;
switch (businessType)
@@ -46,7 +115,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
else
{
var selectors = fields.Select(x => new SelectModel { FieldName = x }).ToList();
- biz = TenantDb.Queryable
[Fact]
public void MasterInitTableTest()
- {
+ {
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持
db.CodeFirst.InitTables(typeof(SysPrintTemplate));
//tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail));
@@ -251,4 +253,18 @@ public class SaasTest
//tenantDb.CodeFirst.InitTables(typeof(TaskFlowLogDetail));
Assert.True(true);
}
+
+ [Fact]
+ public async Task ZxfTest()
+ {
+ var tenantDb = saasService.GetBizDbScopeById("1819549542425694208");
+
+ var order = await tenantDb.Queryable().FirstAsync(x => x.Id == 1816649497120477184);
+
+ TaskFlowDataContext dataContext = new(
+ (TaskFlowDataNameConst.Business, order)
+ );
+ TaskFlowRuner runer = new TaskFlowRuner(tenantDb, _serviceProvider);
+ var result =await runer.GetWorkFlowNextConfig(dataContext, null);
+ }
}
\ No newline at end of file