FPSMS-frontend
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

239 wiersze
10 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 type ReportResponseType = 'pdf' | 'excel';
  17. export interface ReportDefinition {
  18. id: string;
  19. title: string;
  20. apiEndpoint: string;
  21. /** When 'excel', report page fetches JSON and builds .xlsx for download. Default 'pdf'. */
  22. responseType?: ReportResponseType;
  23. fields: ReportField[];
  24. }
  25. export const REPORTS: ReportDefinition[] = [
  26. //{
  27. // id: "rep-001",
  28. // title: "報告 1",
  29. // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report1`,
  30. // fields: [
  31. // { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory
  32. // { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory
  33. // { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"},
  34. // { label: "Item Type", name: "itemType", type: "select", required: false,
  35. // options: [
  36. // { label: "FG", value: "FG" },
  37. // { label: "Material", value: "Mat" }
  38. // ] },
  39. // ]
  40. //},
  41. //{
  42. // id: "rep-002",
  43. // title: "報告 2",
  44. // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report2`,
  45. // fields: [
  46. // { label: "Target Date", name: "targetDate", type: "date", required: false },
  47. // { label: "Item Code", name: "itemCode", type: "text", required: false },
  48. // { label: "Shift", name: "shift", type: "select", options: [
  49. // { label: "Day", value: "D" },
  50. // { label: "Night", value: "N" }
  51. // ], required: false}
  52. // ]
  53. //},
  54. //{
  55. // id: "rep-003",
  56. // title: "報告 3",
  57. // apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-report3`,
  58. // fields: [
  59. // { label: "From Date", name: "fromDate", type: "date", required: true }, // Mandatory
  60. // { label: "To Date", name: "toDate", type: "date", required: true }, // Mandatory
  61. // { label: "Item Code", name: "itemCode", type: "text", required: false, placeholder: "e.g. FG"},
  62. // { label: "Item Type", name: "itemType", type: "select", required: false,
  63. // options: [
  64. // { label: "FG", value: "FG" },
  65. // { label: "Material", value: "Mat" }
  66. // ] },
  67. // ]
  68. //},
  69. {
  70. id: "rep-004",
  71. title: "入倉追蹤報告",
  72. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-in-traceability`,
  73. fields: [
  74. { label: "入倉日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  75. { label: "入倉日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  76. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  77. ]
  78. },
  79. {
  80. id: "rep-008",
  81. title: "成品出倉報告",
  82. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-fg-delivery-report`,
  83. fields: [
  84. { label: "出貨日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
  85. { label: "出貨日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
  86. { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
  87. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  88. ]
  89. },
  90. { id: "rep-012",
  91. title: "庫存盤點報告",
  92. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-take-variance`,
  93. fields: [
  94. { label: "盤點日期:由 Stock Take Date Start", name: "stockTakeDateStart", type: "date", required: false },
  95. { label: "盤點日期:至 Stock Take Date End", name: "stockTakeDateEnd", type: "date", required: false },
  96. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  97. ]
  98. },
  99. { id: "rep-011",
  100. title: "庫存明細報告",
  101. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-ledger`,
  102. fields: [
  103. { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  104. { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  105. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  106. ]
  107. },
  108. {
  109. id: "rep-007",
  110. title: "庫存結餘報告",
  111. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-balance`,
  112. fields: [
  113. {
  114. label: "盤點輪次 Stock Take Round",
  115. name: "stockTakeRoundId",
  116. type: "select",
  117. required: true,
  118. dynamicOptions: true,
  119. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/stock-take-rounds`,
  120. options: []
  121. },
  122. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  123. ]
  124. },
  125. {
  126. id: "rep-014",
  127. title: "PO入倉記錄報告",
  128. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/grn-report`,
  129. responseType: "excel",
  130. fields: [
  131. { label: "收貨日期:由 Receipt Date Start", name: "receiptDateStart", type: "date", required: false },
  132. { label: "收貨日期:至 Receipt Date End", name: "receiptDateEnd", type: "date", required: false },
  133. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false },
  134. ],
  135. },
  136. { id: "rep-009",
  137. title: "成品出倉追蹤報告",
  138. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-fg-stock-out-traceability`,
  139. fields: [
  140. { label: "出貨日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
  141. { label: "出貨日期:至 Last Out Date End", name: "lastOutDateEnd", 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/fg-stock-out-traceability-handlers`,
  147. options: [] },
  148. ]
  149. },
  150. { id: "rep-010",
  151. title: "庫存品質檢測報告",
  152. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-item-qc-fail`,
  153. fields: [
  154. { label: "QC 不合格日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  155. { label: "QC 不合格日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  156. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  157. ]
  158. },
  159. { id: "rep-013",
  160. title: "物料出倉追蹤報告",
  161. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-material-stock-out-traceability`,
  162. fields: [
  163. { label: "庫存日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false },
  164. { label: "庫存日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false },
  165. { label: "物料編號 Item Code", name: "itemCode", type: "text", required: false},
  166. { label: "提料人 Handler", name: "handler", type: "select", required: false,
  167. multiple: true,
  168. dynamicOptions: true,
  169. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/material-stock-out-traceability-handlers`,
  170. options: [] },
  171. ]
  172. },
  173. {
  174. id: "rep-006",
  175. title: "庫存材料消耗趨勢報告",
  176. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-stock-item-consumption-trend`,
  177. fields: [
  178. { label: "材料消耗日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false },
  179. { label: "材料消耗日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false },
  180. { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
  181. { label: "類別 Category", name: "stockCategory", type: "select", required: false,
  182. multiple: true,
  183. options: [
  184. { label: "All", value: "All" },
  185. { label: "MAT", value: "MAT" },
  186. { label: "WIP", value: "WIP" },
  187. { label: "NM", value: "NM" },
  188. { label: "FG", value: "FG" },
  189. { label: "CMB", value: "CMB" }
  190. ] },
  191. { label: "物料編號 Item Code", name: "itemCode", type: "select", required: false,
  192. multiple: true,
  193. allowInput: true,
  194. dynamicOptions: true,
  195. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/stock-item-code-prefixes`,
  196. dynamicOptionsParam: "stockCategory",
  197. options: [] },
  198. ]
  199. },
  200. {
  201. id: "rep-005",
  202. title: "成品/半成品生產分析報告",
  203. apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-semi-fg-production-analysis`,
  204. fields: [
  205. { label: "完成生產日期:由 Last Out Date Start", name: "lastOutDateStart", type: "date", required: false, placeholder: "dd/mm/yyyy" },
  206. { label: "完成生產日期:至 Last Out Date End", name: "lastOutDateEnd", type: "date", required: false, placeholder: "dd/mm/yyyy" },
  207. { label: "年份 Year", name: "year", type: "text", required: false, placeholder: "e.g. 2026" },
  208. { label: "類別 Category", name: "stockCategory", type: "select", required: false,
  209. multiple: true,
  210. options: [
  211. { label: "All", value: "All" },
  212. { label: "WIP", value: "WIP" },
  213. { label: "FG", value: "FG" },
  214. ] },
  215. { label: "物料編號 Item Code", name: "itemCode", type: "select", required: false,
  216. multiple: true,
  217. allowInput: true,
  218. dynamicOptions: true,
  219. dynamicOptionsEndpoint: `${NEXT_PUBLIC_API_URL}/report/semi-fg-item-codes`,
  220. dynamicOptionsParam: "stockCategory",
  221. options: [] },
  222. ]
  223. }
  224. ]