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.

79 lines
3.0 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 TW003ExecuteCommandReportDto : 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. [Required, JsonPropertyName("start_time"), JsonPropertyOrder(102)]
  21. public DateTime StartTime { get; set; }
  22. /// <summary>
  23. /// 取得執行命令回報
  24. /// </summary>
  25. /// <param name="transName">交易名稱</param>
  26. /// <param name="commandSequnceNumber">搬運命令序號</param>
  27. /// <param name="startTime">搬運命令開始時間</param>
  28. /// <returns>執行命令回報</returns>
  29. public static TW003ExecuteCommandReportDto Get(TransactionName transName, string commandSequnceNumber, DateTime startTime)
  30. {
  31. return new TW003ExecuteCommandReportDto()
  32. {
  33. Timetick = DateTime.Now,
  34. TransactionName = transName.ToTransactionName(),
  35. CommandSequnceNumber = commandSequnceNumber,
  36. StartTime = startTime
  37. };
  38. }
  39. }
  40. /// <summary>
  41. /// 執行命令回應類別
  42. /// </summary>
  43. public class FW004ExecuteCommandAckDto : CommonMessage
  44. {
  45. /// <summary>
  46. /// 搬運命令序號
  47. /// </summary>
  48. /// <remarks>W[YYYYMMDDHH][Sequence * 5]</remarks>
  49. [Required, StringLength(16), JsonPropertyName("cmd_sno"), JsonPropertyOrder(101)]
  50. public string CommandSequnceNumber { 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="commandSequnceNumber">搬運命令序號</param>
  65. /// <param name="replyCode">回應代碼</param>
  66. /// <returns>執行命令回應</returns>
  67. public static FW004ExecuteCommandAckDto Get(TransactionName transName, string commandSequnceNumber, bool replyCode)
  68. {
  69. return new FW004ExecuteCommandAckDto()
  70. {
  71. Timetick = DateTime.Now,
  72. TransactionName = transName.ToTransactionName(),
  73. CommandSequnceNumber = commandSequnceNumber,
  74. ReplyCode = replyCode ? ReplyCode.OK : ReplyCode.NG
  75. };
  76. }
  77. }
  78. }