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.

100 lines
3.9 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 TW005FinishCommandReportDto : CommonMessage
  10. {
  11. /// <summary>
  12. /// 搬運命令序號
  13. /// </summary>
  14. /// <remarks>W[YYYYMMDDHH][Sequence * 5]</remarks>
  15. [Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)]
  16. public string CommandSequnceNumber { get; set; }
  17. /// <summary>
  18. /// 搬運命令完成狀態
  19. /// </summary>
  20. /// <value>
  21. /// 0 = Complete <br/>
  22. /// 1 = Force Complete <br/>
  23. /// 2 = Force Cancel <br/>
  24. /// 2 = Failed <br/>
  25. /// </value>
  26. [Required, JsonPropertyName("complete_status"), JsonPropertyOrder(102)]
  27. public CommandCompleteStatus CompleteStatus { get; set; }
  28. /// <summary>
  29. /// 搬運命令完成時間
  30. /// </summary>
  31. [Required, JsonPropertyName("finish_time"), JsonPropertyOrder(103)]
  32. public DateTime FinishTime { get; set; }
  33. /// <summary>
  34. /// 失敗原因
  35. /// </summary>
  36. [JsonPropertyName("failed_reason"), JsonPropertyOrder(104)]
  37. public string FailedReason { get; set; }
  38. /// <summary>
  39. /// 取得完成命令回報
  40. /// </summary>
  41. /// <param name="transName">交易名稱</param>
  42. /// <param name="commandSeqeunceNumber">搬運命令序號</param>
  43. /// <param name="completeStatus">搬運命令完成狀態</param>
  44. /// <param name="finishTime">搬運命令完成時間</param>
  45. /// <param name="faileReason">失敗原因</param>
  46. /// <returns>完成命令回報</returns>
  47. public static TW005FinishCommandReportDto Get(TransactionName transName, string commandSeqeunceNumber, CommandCompleteStatus completeStatus,
  48. DateTime finishTime, string faileReason = null)
  49. {
  50. return new TW005FinishCommandReportDto()
  51. {
  52. Timetick = DateTime.Now,
  53. TransactionName = transName.ToTransactionName(),
  54. CommandSequnceNumber = commandSeqeunceNumber,
  55. CompleteStatus = completeStatus,
  56. FinishTime = finishTime,
  57. FailedReason = faileReason
  58. };
  59. }
  60. }
  61. /// <summary>
  62. /// 完成命令回應類別
  63. /// </summary>
  64. public class FW006FinishCommandAckDto : CommonMessage
  65. {
  66. /// <summary>
  67. /// 搬運命令序號
  68. /// </summary>
  69. /// <remarks>W[YYYYMMDDHH][Sequence * 5]</remarks>
  70. [Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)]
  71. public string CommandSequnceNumber { get; set; }
  72. /// <summary>
  73. /// 回應代碼
  74. /// </summary>
  75. /// <value>
  76. /// 0 = OK <br/>
  77. /// 1 = NG <br/>
  78. /// </value>
  79. [Required, JsonPropertyName("reply_code"), JsonPropertyOrder(102)]
  80. public ReplyCode ReplyCode { get; set; }
  81. /// <summary>
  82. /// 取得完成命令回應
  83. /// </summary>
  84. /// <param name="transName">交易名稱</param>
  85. /// <param name="commandSequnceNumberm">搬運命令序號</param>
  86. /// <param name="replyCode">回應代碼</param>
  87. /// <returns>完成命令回應</returns>
  88. public static FW006FinishCommandAckDto Get(TransactionName transName, string commandSequnceNumberm, bool replyCode)
  89. {
  90. return new FW006FinishCommandAckDto()
  91. {
  92. Timetick = DateTime.Now,
  93. TransactionName = transName.ToTransactionName(),
  94. CommandSequnceNumber = commandSequnceNumberm,
  95. ReplyCode = replyCode ? ReplyCode.OK : ReplyCode.NG
  96. };
  97. }
  98. }
  99. }