You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 rivejä
4.8 KiB

  1. // ********************************************************************************
  2. // 文件名字: S1F4Handler
  3. // 文件描述: S1F4Handler
  4. // 开发人员: Michael
  5. // 创建时间: 2019/11/8 0:08
  6. //
  7. // 更新历史:
  8. // + 创建 S1F4Handler.cs 文件. by Michael @2019/11/8 0:08
  9. // ********************************************************************************
  10. using ARI.EAP.HOST;
  11. using ARI.EAP.HOST.MQ;
  12. using ARI.EAP.HOST.MQ.body;
  13. using ARI.EAP.HOST.SRD;
  14. using Glorysoft.SECS.EQP.Common;
  15. using Glorysoft.SECS.EQP.Message;
  16. using Glorysoft.SECS.EQP.Utilities;
  17. using Glorysoft.SECSwell;
  18. using System;
  19. using System.Collections.Generic;
  20. using System.Threading;
  21. using System.Threading.Tasks;
  22. namespace Glorysoft.SECS.EQP.Handlers
  23. {
  24. public class S1F4Handler : ISECSMessageHandler
  25. {
  26. public void Execute(SECSContext context, SECSTransaction trans, SECSErrors err, string errmsg)
  27. {
  28. MQMessage mQMessage = new MQMessage();
  29. mQMessage.header.messageName = "SvList";
  30. SVListBody sVListBody = new SVListBody();
  31. var content = Configurations.conf.commandContentCollection.findContent("S1F3").content;
  32. for(int i = 0; i < content.Count; i++)
  33. {
  34. if (trans.Secondary.Root.Item(i + 1).Value != null)
  35. {
  36. switch (content[i])
  37. {
  38. case "Clock":
  39. sVListBody.eventTimestamp = trans.Secondary.Root.Item(i + 1).Value.ToString();
  40. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.eventTimestamp);
  41. break;
  42. case "CommunicationState":
  43. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.CommunicationState);
  44. sVListBody.CommunicationState = trans.Secondary.Root.Item(i + 1).Value.ToString();
  45. break;
  46. case "CurrentControlState":
  47. sVListBody.ControlState = trans.Secondary.Root.Item(i + 1).Value.ToString();
  48. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.ControlState);
  49. break;
  50. case "PreviousControlState":
  51. sVListBody.PreviousControlState = trans.Secondary.Root.Item(i + 1).Value.ToString();
  52. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.PreviousControlState);
  53. break;
  54. case "CurrentEquipmentState":
  55. sVListBody.CurrentEquipmentState = trans.Secondary.Root.Item(i + 1).Value.ToString();
  56. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.CurrentEquipmentState);
  57. break;
  58. case "PreviousEquipmentState":
  59. sVListBody.PreviousEquipmentState = trans.Secondary.Root.Item(i + 1).Value.ToString();
  60. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.PreviousEquipmentState);
  61. break;
  62. case "PPExecName":
  63. sVListBody.PPExecName = trans.Secondary.Root.Item(i + 1).Value.ToString();
  64. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.PPExecName);
  65. break;
  66. case "SpoolingState":
  67. sVListBody.SpoolingState = trans.Secondary.Root.Item(i + 1).Value.ToString();
  68. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.SpoolingState);
  69. break;
  70. case "SpoolCountActual":
  71. sVListBody.SpoolCountActual = trans.Secondary.Root.Item(i + 1).Value.ToString();
  72. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.SpoolCountActual);
  73. break;
  74. case "SpoolCountTotal":
  75. sVListBody.SpoolCountTotal = trans.Secondary.Root.Item(i + 1).Value.ToString();
  76. trans.Secondary.Root.Item(i + 1).Name = nameof(sVListBody.SpoolCountTotal);
  77. break;
  78. }
  79. }
  80. }
  81. Global.MF.addlog(trans, LoggerService.Receive, "Selected Equipment Status Request", 1);
  82. LoggerService.SECSLogger.Info(trans.Secondary);
  83. mQMessage.body = sVListBody;
  84. Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
  85. if (trans.Tag != null)
  86. {
  87. var scenario = trans.Tag as Scenario;
  88. Thread.Sleep(500);
  89. scenario.ExecuteNextStep();
  90. }
  91. }
  92. }
  93. }