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.

96 lines
3.4 KiB

8 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Text.Json.Serialization;
  5. namespace Mirle.Component.API.ProgrammableLogicController.Models
  6. {
  7. /// <summary>
  8. /// 建立命令請求類別
  9. /// </summary>
  10. public class TP001CreateCommandRequestDto : CommonMessage
  11. {
  12. /// <summary>
  13. /// 建構式
  14. /// </summary>
  15. public TP001CreateCommandRequestDto()
  16. {
  17. MaterialID = new List<string>();
  18. }
  19. /// <summary>
  20. /// 任務模式
  21. /// </summary>
  22. /// <value>
  23. /// 0 = Store In <br/>
  24. /// 1 = Store Out <br/>
  25. /// </value>
  26. [Required, JsonPropertyName("task_mode"), JsonPropertyOrder(101)]
  27. public TaskActionMode TaskMode { get; set; }
  28. /// <summary>
  29. /// 起始位置
  30. /// </summary>
  31. [Required, StringLength(9), JsonPropertyName("from"), JsonPropertyOrder(102)]
  32. public string From { get; set; }
  33. /// <summary>
  34. /// 目的位置
  35. /// </summary>
  36. [Required, StringLength(9), JsonPropertyName("to"), JsonPropertyOrder(103)]
  37. public string To { get; set; }
  38. /// <summary>
  39. /// 載具編號清單
  40. /// </summary>
  41. /// <remarks>棧板編號/物流箱編號</remarks>
  42. [JsonPropertyName("carrier_id"), JsonPropertyOrder(104)]
  43. public string CarrierID { get; set; }
  44. /// <summary>
  45. /// 物料編號清單
  46. /// </summary>
  47. [JsonPropertyName("material_id"), JsonPropertyOrder(105)]
  48. public List<string> MaterialID { get; set; }
  49. /// <summary>
  50. /// 取得建立命令請求
  51. /// </summary>
  52. /// <param name="transName">交易名稱</param>
  53. /// <param name="softwareID">軟體編號</param>
  54. /// <param name="taskID">任務編號</param>
  55. /// <param name="taskMode">任務模式</param>
  56. /// <param name="from">起始位置</param>
  57. /// <param name="to">目的位置</param>
  58. /// <param name="carrierID">載具編號</param>
  59. /// <param name="materialID">物料編號清單</param>
  60. /// <returns>建立命令請求</returns>
  61. public static TP001CreateCommandRequestDto Get(TransactionName transName, string softwareID, string taskID, TaskActionMode taskMode,
  62. string from, string to, string carrierID, List<string> materialID = null)
  63. {
  64. return new TP001CreateCommandRequestDto()
  65. {
  66. Timetick = DateTime.Now,
  67. TransactionName = transName.ToTransactionName(),
  68. SoftwareID = softwareID,
  69. TaskID = taskID,
  70. TaskMode = taskMode,
  71. From = from,
  72. To = to,
  73. CarrierID = carrierID,
  74. MaterialID = materialID
  75. };
  76. }
  77. }
  78. /// <summary>
  79. /// 建立命令回應類別
  80. /// </summary>
  81. public class FP002CreateCommandResponseDto : CommonMessage
  82. {
  83. /// <summary>
  84. /// 結果代碼
  85. /// </summary>
  86. /// <value>
  87. /// 0 = Success <br/>
  88. /// 1 = Reject <br/>
  89. /// 2 = Source Not Exist <br/>
  90. /// 3 = Destination Not Exist <br/>
  91. /// </value>
  92. [Required, JsonPropertyName("result_code"), JsonPropertyOrder(101)]
  93. public CreateCommandResultCode ResultCode { get; set; }
  94. }
  95. }