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.

92 lines
3.4 KiB

8 months ago
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.Text.Json.Serialization;
  4. namespace Mirle.Component.API.ProgrammableLogicController.Models
  5. {
  6. /// <summary>
  7. /// 鐵捲門狀態回報類別
  8. /// </summary>
  9. public class FP039RollingDoorStatusReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 當下任務編號
  13. /// </summary>
  14. /// <remarks>S[YYYYMMDDHH][SEQ * 5]</remarks>
  15. [Required, StringLength(16), JsonPropertyName("current_task_id"), JsonPropertyOrder(101)]
  16. public string CurrentTaskID { get; set; }
  17. /// <summary>
  18. /// 鐵捲門編號
  19. /// </summary>
  20. [Required, StringLength(9), JsonPropertyName("rolling_door_id"), JsonPropertyOrder(102)]
  21. public string RollingDoorID { get; set; }
  22. /// <summary>
  23. /// 鐵捲門狀態
  24. /// </summary>
  25. /// <value>
  26. /// 0 = Opne <br/>
  27. /// 1 = Close <br/>
  28. /// </value>
  29. [Required, JsonPropertyName("rolling_door_status"), JsonPropertyOrder(103)]
  30. public RollingDoorStatus RollingDoorStatus { get; set; }
  31. }
  32. /// <summary>
  33. /// 鐵捲門狀態回應類別
  34. /// </summary>
  35. public class TP040RollingDoorStatusAckDto : CommonMessage
  36. {
  37. /// <summary>
  38. /// 當下任務編號
  39. /// </summary>
  40. /// <remarks>S[YYYYMMDDHH][SEQ * 5]</remarks>
  41. [Required, StringLength(16), JsonPropertyName("current_task_id"), JsonPropertyOrder(101)]
  42. public string CurrentTaskID { get; set; }
  43. /// <summary>
  44. /// 鐵捲門編號
  45. /// </summary>
  46. [Required, StringLength(9), JsonPropertyName("rolling_door_id"), JsonPropertyOrder(102)]
  47. public string RollingDoorID { get; set; }
  48. /// <summary>
  49. /// 鐵捲門狀態
  50. /// </summary>
  51. /// <remarks>
  52. /// 0 = Open <br/>
  53. /// 1 = Close <br/>
  54. /// </remarks>
  55. [Required, JsonPropertyName("rolling_door_status"), JsonPropertyOrder(103)]
  56. public RollingDoorStatus RollingDoorStatus { get; set; }
  57. /// <summary>
  58. /// 回應代碼
  59. /// </summary>
  60. /// <value>
  61. /// 0 = OK <br/>
  62. /// 1 = NG <br/>
  63. /// </value>
  64. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(104)]
  65. public ReplyCode ReplyCode { get; set; }
  66. /// <summary>
  67. /// 取得鐵捲門狀態回應
  68. /// </summary>
  69. /// <param name="transName">交易名稱</param>
  70. /// <param name="softwareID">軟體編號</param>
  71. /// <param name="currentTaskID">當前任務編號</param>
  72. /// <param name="rollingDoorID">鐵捲門編號</param>
  73. /// <param name="status">鐵捲門狀態</param>
  74. /// <param name="replyCode">回應代碼</param>
  75. /// <returns>鐵捲門狀態回應</returns>
  76. public static TP040RollingDoorStatusAckDto Get(TransactionName transName, string softwareID,
  77. string currentTaskID, string rollingDoorID, RollingDoorStatus status, ReplyCode replyCode)
  78. {
  79. return new TP040RollingDoorStatusAckDto()
  80. {
  81. Timetick = DateTime.Now,
  82. TransactionName = transName.ToTransactionName(),
  83. SoftwareID = softwareID,
  84. CurrentTaskID = currentTaskID,
  85. RollingDoorID = rollingDoorID,
  86. RollingDoorStatus = status,
  87. ReplyCode = replyCode
  88. };
  89. }
  90. }
  91. }