FlowContent.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using SHJX.Service.Dao;
  3. using System.Reflection;
  4. using WorkflowCore.Interface;
  5. using SHJX.Service.Model.Dao;
  6. using System.Collections.Generic;
  7. using SHJX.Service.Common.ReadXML;
  8. using SHJX.Service.Control.Interface;
  9. using SHJX.Service.Common.Logging;
  10. using Microsoft.Extensions.Logging;
  11. namespace SHJX.Service.Control
  12. {
  13. public class FlowContent
  14. {
  15. private static readonly ILogger logger = LogFactory.BuildLogger(typeof(FlowContent));
  16. protected ServiceDataManager DataManager;
  17. private readonly Dictionary<string, TaskFlowImp> _res;
  18. private readonly IWorkflowHost host;
  19. public FlowContent( ReadConfigUtil config)
  20. {
  21. try
  22. {
  23. _res = new Dictionary<string, TaskFlowImp>();
  24. var proxys = config.GetResponsibility;
  25. foreach (var item in proxys)
  26. {
  27. if (Assembly.GetExecutingAssembly().CreateInstance(item.Flow) is not TaskFlowImp operate) continue;
  28. operate.ProxyName = item.Name;
  29. _res.Add(item.Name, operate);
  30. }
  31. _res["CC"].SetNextFlow(_res["Ca"]).SetNextFlow(_res["DAL"])
  32. .SetNextFlow(_res["DAW"]).SetNextFlow(_res["DM"]).SetNextFlow(_res["DC"])
  33. .SetNextFlow(_res["LH"]).SetNextFlow(_res["LS"]).SetNextFlow(_res["Mani"])
  34. .SetNextFlow(_res["MTM"]).SetNextFlow(_res["MXM"]).SetNextFlow(_res["MYM"])
  35. .SetNextFlow(_res["MZM"]).SetNextFlow(_res["SAL1"]).SetNextFlow(_res["SAL2"])
  36. .SetNextFlow(_res["TAL1"]).SetNextFlow(_res["TAL2"]).SetNextFlow(_res["SC"]);
  37. }
  38. catch (Exception ex)
  39. {
  40. logger.LogError(ex.ToString());
  41. }
  42. }
  43. public void OperateControllerContent(EquipmentTask task)
  44. {
  45. try
  46. {
  47. var data = task.GetDataArgs();
  48. _res["CC"].OperateHandle(data);
  49. }
  50. catch (Exception ex)
  51. {
  52. logger.LogError(ex.ToString());
  53. }
  54. }
  55. }
  56. }