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.

84 lines
2.9 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 FP027HappenAlarmReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 異常代碼
  13. /// </summary>
  14. [Required, StringLength(10), JsonPropertyName("alarm_code"), JsonPropertyOrder(101)]
  15. public string AlarmCode { get; set; }
  16. /// <summary>
  17. /// 異常等級
  18. /// </summary>
  19. /// <value>
  20. /// 0 = Warning <br/>
  21. /// 1 = Alarm <br/>
  22. /// </value>
  23. [Required, JsonPropertyName("alarm_level"), JsonPropertyOrder(102)]
  24. public AlarmLevel AlarmLevel { get; set; }
  25. /// <summary>
  26. /// 異常敘述
  27. /// </summary>
  28. [JsonPropertyName("alarm_desc"), JsonPropertyOrder(7)]
  29. public string AlarmDescription { get; set; }
  30. /// <summary>
  31. /// 設備編號
  32. /// </summary>
  33. [Required, StringLength(10), JsonPropertyName("vehicle_id"), JsonPropertyOrder(103)]
  34. public string VehicleID { get; set; }
  35. /// <summary>
  36. /// 異常起始時間
  37. /// </summary>
  38. [Required, JsonPropertyName("start_time"), JsonPropertyOrder(104)]
  39. public DateTime StartTime { get; set; }
  40. }
  41. /// <summary>
  42. /// 發生異常回應類別
  43. /// </summary>
  44. public class TP028HappenAlarmAckDto : CommonMessage
  45. {
  46. /// <summary>
  47. /// 異常代碼
  48. /// </summary>
  49. [Required, StringLength(10), JsonPropertyName("alarm_code"), JsonPropertyOrder(101)]
  50. public string AlarmCode { get; set; }
  51. /// <summary>
  52. /// 回應代碼
  53. /// </summary>
  54. /// <value>
  55. /// 0 = OK <br/>
  56. /// 1 = NG <br/>
  57. /// </value>
  58. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(102)]
  59. public ReplyCode ReplyCode { get; set; }
  60. /// <summary>
  61. /// 取得發生異常回應
  62. /// </summary>
  63. /// <param name="transName">交易名稱</param>
  64. /// <param name="softwareID">軟體編號</param>
  65. /// <param name="taskID">任務編號</param>
  66. /// <param name="alarmCode">異常代碼</param>
  67. /// <param name="replyCode">回應代碼</param>
  68. /// <returns>發生異常回應</returns>
  69. public static TP028HappenAlarmAckDto Get(TransactionName transName, string softwareID, string taskID,
  70. string alarmCode, ReplyCode replyCode)
  71. {
  72. return new TP028HappenAlarmAckDto()
  73. {
  74. Timetick = DateTime.Now,
  75. TransactionName = transName.ToTransactionName(),
  76. SoftwareID = softwareID,
  77. TaskID = taskID,
  78. AlarmCode = alarmCode,
  79. ReplyCode = replyCode
  80. };
  81. }
  82. }
  83. }