using System.ComponentModel; using System.Runtime.Serialization; using CMS.Plugin.FlowManagement.Abstractions.Enums; using CMS.Plugin.FlowManagement.Abstractions.FlowBusiness.Activitys; using CMS.Plugin.MesSuite.Abstractions.Models; using CMS.Plugin.OrderManagement.Abstractions.Models; using CMS.Plugin.ProcessManagement.Abstractions.Models; using CMS.Plugin.TraceManagement.Abstractions.Models.Traces; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using SYC.Flow.Kernel; namespace CMS.Plugin.PipeLineLems.Abstractions { /// /// PipeLineLems 业务步骤 /// [Design("PipeLineLems", "PipeLineLems 业务步骤", Sort = 99), Category("定制步骤")] [Serializable] public class PipeLineLemsActivity : BusinessActivity { /// /// 配置属性1 /// [Design("配置属性1", "配置属性1", Sort = 1), Category("配置信息")] [DataMember] public string MyProperty1 { get; set; } /// /// 配置属性2 /// [Design("配置属性2", "配置属性2", Sort = 2), Category("配置信息")] [DataMember] public int MyProperty2 { get; set; } /// /// 流程上下文标识集合 /// public override List FlowItemKeys => GetFlowItemKeys(); /// /// 工艺流程处理 /// public override async Task ProcessAsync(ProcessflowEventArgs args) { // 工艺模型 var processModel = Flow.DataItems.ApplicationData as ProcessModel; // 工单模型 var orderModel = Flow.DataItems[FlowItemCollection.OrderModel] as OrderModel; // 产品模型 var productModel = Flow.DataItems[FlowItemCollection.ProductModel] as AssociationProductModel; // 追溯模型 var traceModel = Flow.DataItems[FlowItemCollection.TraceModel] as TraceModel; Flow.Logger.LogInformation($"执行流程:实例={Flow.Instance.ProcID} -> {Flow.Name} -> {Name} PipeLineLemsActivity"); // 业务处理 // 由于ServiceProvider来源于Flow组件,此处需共享CMS.Plugin.PipeLineLems.Abstractions程序集,否则无法调用,修改CMS.Plugin.PipeLineLems项目中的CMSPluginModule.cs文件,取消注释GetSharedAssemblies()方法 var pipelinelemsFlowService = Flow.ServiceProvider.GetService(); if (pipelinelemsFlowService != null) { await pipelinelemsFlowService.ProcessAsync(args); } } /// /// Gets the flow item keys. /// protected virtual List GetFlowItemKeys() { var result = new List(); return result; } } }