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.

56 lines
1.7 KiB

8 months ago
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.Text.Json.Serialization;
  4. namespace Mirle.Component.API.WarehouseExecutionSystem.Models
  5. {
  6. /// <summary>
  7. /// 心跳包回報類別
  8. /// </summary>
  9. public class TW013HeartbeatReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 取得心跳包回報
  13. /// </summary>
  14. /// <param name="transName">交易名稱</param>
  15. /// <returns>心跳包回報</returns>
  16. public static TW013HeartbeatReportDto Get(TransactionName transName)
  17. {
  18. return new TW013HeartbeatReportDto()
  19. {
  20. Timetick = DateTime.Now,
  21. TransactionName = transName.ToTransactionName()
  22. };
  23. }
  24. }
  25. /// <summary>
  26. /// 心跳包回應類別
  27. /// </summary>
  28. public class FW014HeartbeatAckDto : CommonMessage
  29. {
  30. /// <summary>
  31. /// 回應代碼
  32. /// </summary>
  33. /// <value>
  34. /// 0 = OK <br/>
  35. /// 1 = NG <br/>
  36. /// </value>
  37. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(101)]
  38. public ReplyCode ReplyCode { get; set; }
  39. /// <summary>
  40. /// 取得心跳包回應
  41. /// </summary>
  42. /// <param name="transName">交易名稱</param>
  43. /// <param name="replyCode">回應代碼</param>
  44. /// <returns>心跳包回應</returns>
  45. public static FW014HeartbeatAckDto Get(TransactionName transName, bool replyCode)
  46. {
  47. return new FW014HeartbeatAckDto()
  48. {
  49. Timetick = DateTime.Now,
  50. TransactionName = transName.ToTransactionName(),
  51. ReplyCode = replyCode ? ReplyCode.OK : ReplyCode.NG
  52. };
  53. }
  54. }
  55. }