终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

119 rader
3.4 KiB

  1. using System.ComponentModel;
  2. using System.Reflection;
  3. using System.Reflection.Emit;
  4. namespace BPASmartClient.MessageName
  5. {
  6. /// <summary>
  7. /// 消息名称管理中心---不在使用
  8. /// 特性:Category,消息分组
  9. /// Description,消息备注
  10. /// Browsable,是否使用
  11. /// 消息发送案例:
  12. /// Class_InnerMessageBus.GetInstance().PostMessage(this, MessageName.xxx, "12321");
  13. /// 接收数据案例:
  14. /// Class_InnerMessageBus.GetInstance().ListenMessage(this, MessageName.xxx, "xxnameHandler");
  15. /// public void xxnameHandler(object sender, InnerMessageEventArgs e) { }
  16. /// </summary>
  17. //public class MessageName
  18. //{
  19. // #region XX消息
  20. // /// <summary>
  21. // /// xxx消息
  22. // /// </summary>
  23. // [Category("消息分组"),Description("消息备注"),Browsable(true)]
  24. // public static string xxx = "xxx";
  25. // #endregion
  26. // #region 滚动线消息事件管理中心
  27. // /// <summary>
  28. // /// 滚动线控制滚动消息
  29. // /// </summary>
  30. // [Category("滚动线"), Description("滚动线控制滚动"), Browsable(true)]
  31. // public static string ConveyorBeltIsRun = "ConveyorBeltIsRun";
  32. // /// <summary>
  33. // /// 滚动线控制左转
  34. // /// </summary>
  35. // [Category("滚动线"), Description("滚动线控制左转"), Browsable(true)]
  36. // public static string ConveyorBeltLeft = "ConveyorBeltLeft";
  37. // /// <summary>
  38. // /// 滚动线控制右转
  39. // /// </summary>
  40. // [Category("滚动线"), Description("滚动线控制右转"), Browsable(true)]
  41. // public static string ConveyorBeltRight = "ConveyorBeltRight";
  42. // /// <summary>
  43. // /// 滚动线控制停止
  44. // /// </summary>
  45. // [Category("滚动线"), Description("滚动线控制停止"), Browsable(true)]
  46. // public static string ConveyorBeltStop = "ConveyorBeltStop";
  47. // #endregion
  48. //}
  49. /// <summary>
  50. /// 消息名称管理中心-枚举
  51. /// </summary>
  52. public enum MessageNameEnum
  53. {
  54. /// <summary>
  55. /// 无
  56. /// </summary>
  57. Null,
  58. /// <summary>
  59. /// 物料仓运行状态
  60. /// </summary>
  61. SilosRunStatus,
  62. /// <summary>
  63. /// 物料仓数据设置
  64. /// </summary>
  65. SilosSetData,
  66. /// <summary>
  67. /// 滚动线运行状态
  68. /// </summary>
  69. ConveyorBeltRunStatus,
  70. /// <summary>
  71. /// 发送消息
  72. /// </summary>
  73. SendMessageName,
  74. /// <summary>
  75. /// 接收消息
  76. /// </summary>
  77. ReceiveMessageName,
  78. }
  79. /// <summary>
  80. /// 消息基类
  81. /// </summary>
  82. public class MessageBase
  83. {
  84. /// <summary>
  85. /// 消息号
  86. /// </summary>
  87. public string MeaageID { get; set; }
  88. // <summary>
  89. /// 消息名称:枚举
  90. /// </summary>
  91. public MessageNameEnum MeaageName { get; set; }
  92. public MessageBase()
  93. {
  94. MeaageID = GetMessageID.GetID();
  95. }
  96. }
  97. /// <summary>
  98. /// 四位消息号
  99. /// </summary>
  100. public static class GetMessageID
  101. {
  102. public static int i = 0;
  103. public static string GetID()
  104. {
  105. i++;
  106. return ((Convert.ToInt32(i) + 1).ToString().PadLeft(8, '0'));
  107. }
  108. }
  109. }