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.

67 lines
2.2 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 FP043OperationModeReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 操作模式
  13. /// </summary>
  14. /// <value>
  15. /// 0 = Online Reomte <br/>
  16. /// 1 = Online Local <br/>
  17. /// 2 = Offline <br/>
  18. /// </value>
  19. [Required, JsonPropertyName("operation_mode"), JsonPropertyOrder(101)]
  20. public OperationMode OperationMode { get; set; }
  21. }
  22. /// <summary>
  23. /// 操作模式回應類別
  24. /// </summary>
  25. public class TP044OperationModeAckDto : CommonMessage
  26. {
  27. /// <summary>
  28. /// 操作模式
  29. /// </summary>
  30. /// <value>
  31. /// 0 = Online Reomte <br/>
  32. /// 1 = Online Local <br/>
  33. /// 2 = Offline <br/>
  34. /// </value>
  35. [Required, JsonPropertyName("operation_mode"), JsonPropertyOrder(101)]
  36. public OperationMode OperationMode { get; set; }
  37. /// <summary>
  38. /// 結果代碼
  39. /// </summary>
  40. /// <value>
  41. /// 0 = OK <br/>
  42. /// 1 = NG <br/>
  43. /// </value>
  44. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(102)]
  45. public ReplyCode ReplyCode { get; set; }
  46. /// <summary>
  47. /// 取得操作模式回應
  48. /// </summary>
  49. /// <param name="transName">交易名稱</param>
  50. /// <param name="softwareID">軟體編號</param>
  51. /// <param name="operationMode">操作模式</param>
  52. /// <param name="replyCode">回應代碼</param>
  53. /// <returns>操作模式回應</returns>
  54. public static TP044OperationModeAckDto Get(TransactionName transName, string softwareID, OperationMode operationMode, ReplyCode replyCode)
  55. {
  56. return new TP044OperationModeAckDto()
  57. {
  58. Timetick = DateTime.Now,
  59. TransactionName = transName.ToTransactionName(),
  60. SoftwareID = softwareID,
  61. OperationMode = operationMode,
  62. ReplyCode = replyCode
  63. };
  64. }
  65. }
  66. }