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.

104 lines
3.8 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 FP023ArrivedLifterReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 當下任務編號
  13. /// </summary>
  14. /// <remarks>AGVC/SHTC 任務編號</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("station_id"), JsonPropertyOrder(102)]
  21. public string StationID { get; set; }
  22. /// <summary>
  23. /// 抵達樓層
  24. /// </summary>
  25. [Required, JsonPropertyName("floor"), JsonPropertyOrder(103)]
  26. public int Floor { get; set; }
  27. /// <summary>
  28. /// 電梯狀態
  29. /// </summary>
  30. /// <value>
  31. /// 0 = Arrived <br/>
  32. /// 1 = Alarm <br/>
  33. /// </value>
  34. [Required, JsonPropertyName("lifter_status"), JsonPropertyOrder(104)]
  35. public LifterStatus LifterStatus { get; set; }
  36. }
  37. /// <summary>
  38. /// 電梯抵達回應類別
  39. /// </summary>
  40. public class TP024ArrivedLifterAckDto : CommonMessage
  41. {
  42. /// <summary>
  43. /// 當下任務編號
  44. /// </summary>
  45. /// <remarks>AGVC/SHTC 任務編號</remarks>
  46. [Required, StringLength(16), JsonPropertyName("current_task_id"), JsonPropertyOrder(101)]
  47. public string CurrentTaskID { get; set; }
  48. /// <summary>
  49. /// 站點編號
  50. /// </summary>
  51. [Required, StringLength(9), JsonPropertyName("station_id"), JsonPropertyOrder(102)]
  52. public string StationID { get; set; }
  53. /// <summary>
  54. /// 抵達樓層
  55. /// </summary>
  56. [Required, JsonPropertyName("floor"), JsonPropertyOrder(103)]
  57. public int Floor { get; set; }
  58. /// <summary>
  59. /// 電梯狀態
  60. /// </summary>
  61. /// <value>
  62. /// 0 = Arrived <br/>
  63. /// 1 = Alarm <br/>
  64. /// </value>
  65. [Required, JsonPropertyName("lifter_status"), JsonPropertyOrder(104)]
  66. public LifterStatus LifterStatus { get; set; }
  67. /// <summary>
  68. /// 回應代碼
  69. /// </summary>
  70. /// <value>
  71. /// 0 = OK <br/>
  72. /// 1 = NG <br/>
  73. /// </value>
  74. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(105)]
  75. public ReplyCode ReplyCode { get; set; }
  76. /// <summary>
  77. /// 取得電梯抵達回應
  78. /// </summary>
  79. /// <param name="transName">交易名稱</param>
  80. /// <param name="softwareID">軟體編號</param>
  81. /// <param name="currentTaskID">當下任務編號</param>
  82. /// <param name="stationID">站點編號</param>
  83. /// <param name="floor">抵達樓層</param>
  84. /// <param name="lifterStatus">電梯狀態</param>
  85. /// <param name="replyCode">回應代碼</param>
  86. /// <returns>電梯抵達回應</returns>
  87. public static TP024ArrivedLifterAckDto Get(TransactionName transName, string softwareID,
  88. string currentTaskID, string stationID, int floor, LifterStatus lifterStatus, ReplyCode replyCode)
  89. {
  90. return new TP024ArrivedLifterAckDto()
  91. {
  92. Timetick = DateTime.Now,
  93. TransactionName = transName.ToTransactionName(),
  94. SoftwareID = softwareID,
  95. CurrentTaskID = currentTaskID,
  96. StationID = stationID,
  97. Floor = floor,
  98. LifterStatus = lifterStatus,
  99. ReplyCode = replyCode
  100. };
  101. }
  102. }
  103. }