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.

78 lines
2.7 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 FP045LockStorageDispatchReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 站點編號
  13. /// </summary>
  14. [Required, StringLength(9), JsonPropertyName("station_id"), JsonPropertyOrder(101)]
  15. public string StationID { get; set; }
  16. /// <summary>
  17. /// 庫區事件
  18. /// </summary>
  19. /// <remarks>
  20. /// 0 = Lock <br/>
  21. /// 1 = Unlock <br/>
  22. /// </remarks>
  23. [Required, JsonPropertyName("event_type"), JsonPropertyOrder(102)]
  24. public DispatchEvent EventType { get; set; }
  25. }
  26. /// <summary>
  27. /// 鎖定庫區命令派送回應類別
  28. /// </summary>
  29. public class TP046LockStorageDispatchAckDto : CommonMessage
  30. {
  31. /// <summary>
  32. /// 站點編號
  33. /// </summary>
  34. [Required, StringLength(9), JsonPropertyName("station_id"), JsonPropertyOrder(101)]
  35. public string StationID { get; set; }
  36. /// <summary>
  37. /// 庫區事件
  38. /// </summary>
  39. /// <remarks>
  40. /// 0 = Lock <br/>
  41. /// 1 = Unlock <br/>
  42. /// </remarks>
  43. [Required, JsonPropertyName("event_type"), JsonPropertyOrder(102)]
  44. public DispatchEvent EventType { get; set; }
  45. /// <summary>
  46. /// 回應代碼
  47. /// </summary>
  48. /// <value>
  49. /// 0 = OK <br/>
  50. /// 1 = NG <br/>
  51. /// </value>
  52. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(103)]
  53. public ReplyCode ReplyCode { get; set; }
  54. /// <summary>
  55. /// 取得鎖定庫區命令派送回應
  56. /// </summary>
  57. /// <param name="transName">交易名稱</param>
  58. /// <param name="softwareID">軟體編號</param>
  59. /// <param name="stationID">站點編號</param>
  60. /// <param name="eventType">事件類別</param>
  61. /// <param name="replyCode">回應代碼</param>
  62. /// <returns>鎖定庫區命令派送回應</returns>
  63. public static TP046LockStorageDispatchAckDto Get(TransactionName transName, string softwareID,
  64. string stationID, DispatchEvent eventType, ReplyCode replyCode)
  65. {
  66. return new TP046LockStorageDispatchAckDto()
  67. {
  68. Timetick = DateTime.Now,
  69. TransactionName = transName.ToTransactionName(),
  70. SoftwareID = softwareID,
  71. StationID = stationID,
  72. EventType = eventType,
  73. ReplyCode = replyCode
  74. };
  75. }
  76. }
  77. }