| @@ -216,6 +216,7 @@ open class BomService( | |||
| } | |||
| /** | |||
| * FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 | |||
| * Edit BOM (basic fields + BOM materials + BOM process lines). | |||
| * | |||
| * Key rules: | |||
| @@ -1682,6 +1683,7 @@ open class BomService( | |||
| val path = dir.resolve("bom_format_issue_$issueLogFileId.xlsx") | |||
| return if (Files.exists(path)) path else null | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| open fun checkBomExcelFormat(batchId: String): BomFormatCheckResponse { | |||
| val batchDir = getBatchDir(batchId) | |||
| if (!Files.isDirectory(batchDir)) return BomFormatCheckResponse(correctFileNames = emptyList(), failList = emptyList()) | |||
| @@ -1764,6 +1766,7 @@ open class BomService( | |||
| ) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| open fun previewImportBom(batchId: String, fileNames: List<String>?): BomImportPreviewResponse { | |||
| val batchDir = getBatchDir(batchId) | |||
| if (!Files.isDirectory(batchDir)) { | |||
| @@ -1823,6 +1826,7 @@ open class BomService( | |||
| return BomImportPreviewResponse(items = lines) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| open fun revalidateImportBomItem( | |||
| batchId: String, | |||
| fileName: String, | |||
| @@ -1872,6 +1876,7 @@ open class BomService( | |||
| ) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| open fun exportCorrectedImportBomExcel( | |||
| batchId: String, | |||
| fileName: String, | |||
| @@ -3642,6 +3647,7 @@ for (r in 0..20) { | |||
| } | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 */ | |||
| @Transactional(readOnly = true) | |||
| open fun listBomVersions(code: String, bomKind: String): List<BomVersionSummary> { | |||
| val normalizedCode = code.trim() | |||
| @@ -3663,6 +3669,7 @@ for (r in 0..20) { | |||
| } | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 */ | |||
| @Transactional | |||
| open fun saveBomAsNewVersion(sourceBomId: Long, request: SaveBomAsNewVersionRequest): BomDetailResponse { | |||
| val source = bomRepository.findByIdAndDeletedIsFalse(sourceBomId) | |||
| @@ -3915,6 +3922,7 @@ for (r in 0..20) { | |||
| } | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 */ | |||
| @Transactional | |||
| open fun activateBomVersion(id: Long): BomDetailResponse { | |||
| val bom = bomRepository.findByIdAndDeletedIsFalse(id) | |||
| @@ -109,21 +109,25 @@ fun downloadBomFormatIssueLog( | |||
| .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"bom_format_issue.xlsx\"") | |||
| .body(resource) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| @PostMapping("/import-bom/format-check") | |||
| fun checkBomFormat(@RequestBody request: BomFormatCheckRequest): BomFormatCheckResponse { | |||
| return bomService.checkBomExcelFormat(request.batchId) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| @PostMapping("/import-bom/preview") | |||
| fun previewImportBom(@RequestBody request: BomImportPreviewRequest): BomImportPreviewResponse { | |||
| return bomService.previewImportBom(request.batchId, request.fileNames) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| @PostMapping("/import-bom/revalidate") | |||
| fun revalidateImportBomItem(@RequestBody request: BomImportRevalidateRequest): BomImportRevalidateResponse { | |||
| return bomService.revalidateImportBomItem(request.batchId, request.fileName, request.overrides) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 15 | v1.0.0 | 2026-07-16 */ | |||
| @PostMapping("/import-bom/export-corrected") | |||
| fun exportCorrectedImportBomExcel(@RequestBody request: BomImportExportCorrectedRequest): ResponseEntity<Resource> { | |||
| // Do not put Chinese filename in Content-Disposition (Tomcat rejects non-Latin-1 headers). | |||
| @@ -219,12 +223,14 @@ fun downloadBomFormatIssueLog( | |||
| return bomService.findBomSummaryByItemCode(code.trim()) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 */ | |||
| @GetMapping("/versions") | |||
| fun listBomVersions( | |||
| @RequestParam code: String, | |||
| @RequestParam bomKind: String, | |||
| ): List<BomVersionSummary> = bomService.listBomVersions(code, bomKind) | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 */ | |||
| @PostMapping("/{id}/save-as-new-version") | |||
| fun saveBomAsNewVersion( | |||
| @PathVariable id: Long, | |||
| @@ -236,12 +242,14 @@ fun getBomDetail(@PathVariable id: Long): BomDetailResponse { | |||
| return bomService.getBomDetail(id) | |||
| } | |||
| /** FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 */ | |||
| @PostMapping("/{id}/activate-version") | |||
| fun activateBomVersion(@PathVariable id: Long): BomDetailResponse { | |||
| return bomService.activateBomVersion(id) | |||
| } | |||
| /** | |||
| * FP-MTMS Version Checklist | Functions Ref. No. 17 | v1.0.0 | 2026-07-16 | |||
| * Edit BOM (basic fields + materials + process lines). | |||
| * baseScore is recalculated on server. | |||
| */ | |||