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.

86 lines
3.1 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 FP057FinishLifterCommandReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 當下任務編號
  13. /// </summary>
  14. /// <remarks>A[YYYYMMDDHH][Sequnce * 5]/S[YYYYMMDDHH][Sequnce * 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("station_id"), JsonPropertyOrder(102)]
  21. public string StationID { get; set; }
  22. /// <summary>
  23. /// 抵達樓層
  24. /// </summary>
  25. [Required, JsonPropertyName("floor"), JsonPropertyOrder(102)]
  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(103)]
  35. public LifterStatus LifterStatus { get; set; }
  36. }
  37. /// <summary>
  38. /// 完成電梯命令回應類別
  39. /// </summary>
  40. public class TP058FinishLifterCommandAckDto : CommonMessage
  41. {
  42. /// <summary>
  43. /// 當下任務編號
  44. /// </summary>
  45. /// <remarks>A[YYYYMMDDHH][Sequnce * 5]/S[YYYYMMDDHH][Sequnce * 5]</remarks>
  46. [Required, StringLength(16), JsonPropertyName("current_task_id"), JsonPropertyOrder(101)]
  47. public string CurrentTaskID { get; set; }
  48. /// <summary>
  49. /// 抵達樓層
  50. /// </summary>
  51. [Required, JsonPropertyName("floor"), JsonPropertyOrder(102)]
  52. public int Floor { get; set; }
  53. /// <summary>
  54. /// 結果代碼
  55. /// </summary>
  56. /// <value>
  57. /// 0 = OK <br/>
  58. /// 1 = NG <br/>
  59. /// </value>
  60. [Required, JsonPropertyName("result_code"), JsonPropertyOrder(103)]
  61. public ReplyCode ReplyCode { get; set; }
  62. /// <summary>
  63. /// 取得完成電梯命令回應
  64. /// </summary>
  65. /// <param name="transName">交易名稱</param>
  66. /// <param name="softwareID">軟體編號</param>
  67. /// <param name="currentTaskID">當下任務編號</param>
  68. /// <param name="floor">抵達樓層</param>
  69. /// <param name="replyCode">回應代碼</param>
  70. /// <returns>完成電梯命令回應</returns>
  71. public static TP058FinishLifterCommandAckDto Get(TransactionName transName, string softwareID,
  72. string currentTaskID, int floor, ReplyCode replyCode)
  73. {
  74. return new TP058FinishLifterCommandAckDto()
  75. {
  76. Timetick = DateTime.Now,
  77. TransactionName = transName.ToTransactionName(),
  78. SoftwareID = softwareID,
  79. CurrentTaskID = currentTaskID,
  80. Floor = floor,
  81. ReplyCode = replyCode
  82. };
  83. }
  84. }
  85. }