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.

69 lines
2.3 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 FP005FinishCommandReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 任務狀態
  13. /// </summary>
  14. /// <value>
  15. /// 0 = Complete <br/>
  16. /// 1 = Force Complete <br/>
  17. /// 2 = Failed <br/>
  18. /// 3 = Cancel <br/>
  19. /// 4 = Force Cancel <br/>
  20. /// </value>
  21. [Required, JsonPropertyName("task_status"), JsonPropertyOrder(101)]
  22. public TaskCompleteStatus TaskStatus { get; set; }
  23. /// <summary>
  24. /// 任務完成時間
  25. /// </summary>
  26. [Required, JsonPropertyName("finish_time"), JsonPropertyOrder(102)]
  27. public DateTime FinishTime { get; set; }
  28. /// <summary>
  29. /// 任務失敗原因
  30. /// </summary>
  31. [StringLength(255), JsonPropertyName("failed_reason"), JsonPropertyOrder(103)]
  32. public string FailedReason { get; set; }
  33. }
  34. /// <summary>
  35. /// 完成命令回應類別
  36. /// </summary>
  37. public class TP006FinishCommandAckDto : CommonMessage
  38. {
  39. /// <summary>
  40. /// 回應代碼
  41. /// </summary>
  42. /// <value>
  43. /// 0 = OK <br/>
  44. /// 1 = NG <br/>
  45. /// </value>
  46. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(101)]
  47. public ReplyCode ReplyCode { get; set; }
  48. /// <summary>
  49. /// 取得完成命令回應
  50. /// </summary>
  51. /// <param name="transName">交易名稱</param>
  52. /// <param name="softwareID">軟體編號</param>
  53. /// <param name="taskID">任務編號</param>
  54. /// <param name="replyCode">回應代碼</param>
  55. /// <returns>完成命令回應</returns>
  56. public static TP006FinishCommandAckDto Get(TransactionName transName, string softwareID, string taskID, ReplyCode replyCode)
  57. {
  58. return new TP006FinishCommandAckDto()
  59. {
  60. Timetick = DateTime.Now,
  61. TransactionName = transName.ToTransactionName(),
  62. SoftwareID = softwareID,
  63. TaskID = taskID,
  64. ReplyCode = replyCode
  65. };
  66. }
  67. }
  68. }