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
|
{
|
/// <summary>
|
/// PipeLineLems 业务步骤
|
/// </summary>
|
[Design("PipeLineLems", "PipeLineLems 业务步骤", Sort = 99), Category("定制步骤")]
|
[Serializable]
|
public class PipeLineLemsActivity : BusinessActivity
|
{
|
/// <summary>
|
/// 配置属性1
|
/// </summary>
|
[Design("配置属性1", "配置属性1", Sort = 1), Category("配置信息")]
|
[DataMember]
|
public string MyProperty1 { get; set; }
|
|
/// <summary>
|
/// 配置属性2
|
/// </summary>
|
[Design("配置属性2", "配置属性2", Sort = 2), Category("配置信息")]
|
[DataMember]
|
public int MyProperty2 { get; set; }
|
|
/// <summary>
|
/// 流程上下文标识集合
|
/// </summary>
|
public override List<FlowItemKey> FlowItemKeys => GetFlowItemKeys();
|
|
/// <summary>
|
/// 工艺流程处理
|
/// </summary>
|
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<IPipeLineLemsFlowService>();
|
if (pipelinelemsFlowService != null)
|
{
|
await pipelinelemsFlowService.ProcessAsync(args);
|
}
|
}
|
|
/// <summary>
|
/// Gets the flow item keys.
|
/// </summary>
|
protected virtual List<FlowItemKey> GetFlowItemKeys()
|
{
|
var result = new List<FlowItemKey>();
|
return result;
|
}
|
}
|
}
|