FPSMS-frontend
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.
 
 

213 lines
9.1 KiB

  1. export type FieldType = 'date' | 'text' | 'select' | 'number';
  2. import { NEXT_PUBLIC_API_URL } from "@/config/api";
  3. export interface ReportField {
  4. label: string;
  5. name: string;
  6. type: FieldType;
  7. placeholder?: string;
  8. required: boolean;
  9. options?: { label: string; value: string }[]; // For select types
  10. multiple?: boolean; // For select types - allow multiple selection
  11. dynamicOptions?: boolean; // For select types - load options dynamically
  12. dynamicOptionsEndpoint?: string; // API endpoint to fetch dynamic options
  13. dynamicOptionsParam?: string; // Parameter name to pass when fetching options
  14. allowInput?: boolean; // Allow user to input custom values (for select types)
  15. }
  16. export interface ReportDefinition {
  17. id: string;
  18. title: string;
  19. apiEndpoint: string;
  20. fields: ReportField[];
  21. }
  22. export const REPORTS: ReportDefinition[] = [
  23. //{
  24. // id: "rep-001",
  25. // title: "報告 1",
  26. // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report1`,
  27. // fields: [
  28. // { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory
  29. // { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory
  30. // { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"},
  31. // { label: "Item Type", name: "itemType", type: "select", required: false,
  32. // options: [
  33. // { label: "FG", value: "FG" },
  34. // { label: "Material", value: "Mat" }
  35. // ] },
  36. // ]
  37. //},
  38. //{
  39. // id: "rep-002",
  40. // title: "報告 2",
  41. // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report2`,
  42. // fields: [
  43. // { label: "Target Date", name: "targetDate", type: "date", required: false },
  44. // { label: "Item Code", name: "itemCode", type: "text", required: false },
  45. // { label: "Shift", name: "shift", type: "select", options: [
  46. // { label: "Day", value: "D" },
  47. // { label: "Night", value: "N" }
  48. // ], required: false}
  49. // ]
  50. //},
  51. //{
  52. // id: "rep-003",
  53. // title: "報告 3",
  54. // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report3`,
  55. // fields: [
  56. // { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory
  57. // { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory
  58. // { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"},
  59. // { label: "Item Type", name: "itemType", type: "select", required: false,
  60. // options: [
  61. // { label: "FG", value: "FG" },
  62. // { label: "Material", value: "Mat" }
  63. // ] },
  64. // ]
  65. //},
  66. {
  67. id: "rep-004",
  68. title: "入倉追蹤報告",
  69. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-in-traceability`,
  70. fields: [
  71. { label: "入倉日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  72. { label: "入倉日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  73. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  74. ]
  75. },
  76. {
  77. id: "rep-008",
  78. title: "成品出倉報告",
  79. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-fg-delivery-report`,
  80. fields: [
  81. { label: "出貨日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
  82. { label: "出貨日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
  83. { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
  84. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  85. ]
  86. },
  87. { id: "rep-012",
  88. title: "庫存盤點報告",
  89. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-take-variance`,
  90. fields: [
  91. { label: "盤點日期:由 Stock Take Date Start", name: "lastInDateStart", type: "date", required: false },
  92. { label: "盤點日期:至 Stock Take Date End", name: "lastInDateEnd", type: "date", required: false },
  93. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  94. ]
  95. },
  96. { id: "rep-011",
  97. title: "庫存明細報告",
  98. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-ledger`,
  99. fields: [
  100. { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  101. { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  102. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  103. ]
  104. },
  105. {
  106. id: "rep-007",
  107. title: "庫存結餘報告",
  108. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-balance`,
  109. fields: [
  110. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  111. ]
  112. },
  113. { id: "rep-009",
  114. title: "成品出倉追蹤報告",
  115. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-fg-stock-out-traceability`,
  116. fields: [
  117. { label: "出貨日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
  118. { label: "出貨日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
  119. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  120. { label: "提料人 Handler", name: "handler", type: "select", required: false,
  121. multiple: true,
  122. dynamicOptions: true,
  123. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/fg-stock-out-traceability-handlers`,
  124. options: [] },
  125. ]
  126. },
  127. { id: "rep-010",
  128. title: "庫存品質檢測報告",
  129. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-item-qc-fail`,
  130. fields: [
  131. { label: "QC 不合格日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  132. { label: "QC 不合格日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  133. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  134. ]
  135. },
  136. { id: "rep-013",
  137. title: "物料出倉追蹤報告",
  138. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-material-stock-out-traceability`,
  139. fields: [
  140. { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  141. { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  142. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  143. { label: "提料人 Handler", name: "handler", type: "select", required: false,
  144. multiple: true,
  145. dynamicOptions: true,
  146. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/material-stock-out-traceability-handlers`,
  147. options: [] },
  148. ]
  149. },
  150. {
  151. id: "rep-006",
  152. title: "庫存材料消耗趨勢報告",
  153. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-item-consumption-trend`,
  154. fields: [
  155. { label: "材料消耗日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
  156. { label: "材料消耗日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
  157. { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
  158. { label: "類別 Category", name: "stockCategory", type: "select", required: false,
  159. multiple: true,
  160. options: [
  161. { label: "All", value: "All" },
  162. { label: "MAT", value: "MAT" },
  163. { label: "WIP", value: "WIP" },
  164. { label: "NM", value: "NM" },
  165. { label: "FG", value: "FG" },
  166. { label: "CMB", value: "CMB" }
  167. ] },
  168. { label: "物料編號 Item Code", name: "itemCode", type: "select", required: false,
  169. multiple: true,
  170. allowInput: true,
  171. dynamicOptions: true,
  172. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/stock-item-code-prefixes`,
  173. dynamicOptionsParam: "stockCategory",
  174. options: [] },
  175. ]
  176. },
  177. {
  178. id: "rep-005",
  179. title: "成品/半成品生產分析報告",
  180. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-semi-fg-production-analysis`,
  181. fields: [
  182. { label: "完成生產日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false, placeholder: "dd/mm/yyyy" },
  183. { label: "完成生產日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false, placeholder: "dd/mm/yyyy" },
  184. { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
  185. { label: "類別 Category", name: "stockCategory", type: "select", required: false,
  186. multiple: true,
  187. options: [
  188. { label: "All", value: "All" },
  189. { label: "WIP", value: "WIP" },
  190. { label: "FG", value: "FG" },
  191. ] },
  192. { label: "物料編號 Item Code", name: "itemCode", type: "select", required: false,
  193. multiple: true,
  194. allowInput: true,
  195. dynamicOptions: true,
  196. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/semi-fg-item-codes`,
  197. dynamicOptionsParam: "stockCategory",
  198. options: [] },
  199. ]
  200. }
  201. ]