From 7d3f0c20ba0bf5ec33da5b31df9e40f823bcc710 Mon Sep 17 00:00:00 2001 From: kelvinsuen Date: Thu, 21 Aug 2025 13:58:09 +0800 Subject: [PATCH] update qc result --- .../ffii/fpsms/modules/qc/entity/QcResult.kt | 4 ++++ .../qc/entity/projection/QcResultInfo.kt | 18 +++++++++++------- .../modules/qc/service/QcResultService.kt | 1 + .../qc/web/model/SaveQcResultRequest.kt | 1 + .../stock/service/StockInLineService.kt | 1 + .../20250820_01_kelvin/01_update_qc_result.sql | 4 ++++ 6 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 src/main/resources/db/changelog/changes/20250820_01_kelvin/01_update_qc_result.sql diff --git a/src/main/java/com/ffii/fpsms/modules/qc/entity/QcResult.kt b/src/main/java/com/ffii/fpsms/modules/qc/entity/QcResult.kt index fcc4a13..bd5391a 100644 --- a/src/main/java/com/ffii/fpsms/modules/qc/entity/QcResult.kt +++ b/src/main/java/com/ffii/fpsms/modules/qc/entity/QcResult.kt @@ -37,4 +37,8 @@ open class QcResult: BaseEntity() { @Column(name = "remarks") open var remarks: String? = null + + @NotNull + @Column(name = "qcPassed") + open var qcPassed: Boolean = true } \ No newline at end of file diff --git a/src/main/java/com/ffii/fpsms/modules/qc/entity/projection/QcResultInfo.kt b/src/main/java/com/ffii/fpsms/modules/qc/entity/projection/QcResultInfo.kt index c89f1f5..0d6350c 100644 --- a/src/main/java/com/ffii/fpsms/modules/qc/entity/projection/QcResultInfo.kt +++ b/src/main/java/com/ffii/fpsms/modules/qc/entity/projection/QcResultInfo.kt @@ -4,15 +4,19 @@ import org.springframework.beans.factory.annotation.Value interface QcResultInfo { val id: Long - @get:Value("#{target.qcItem.id}") - val qcItemId: Long - @get:Value("#{target.qcItem.name}") - val name: String - @get:Value("#{target.qcItem.code}") - val code: String + @get:Value("#{target.qcItem?.id}") + val qcItemId: Long? + @get:Value("#{target.qcItem?.code}") + val code: String? + @get:Value("#{target.qcItem?.name}") + val name: String? + @get:Value("#{target.qcItem?.description}") + val description: String? + val remarks: String? @get:Value("#{target.stockInLine?.id}") val stockInLineId: Long? @get:Value("#{target.stockOutLine?.id}") val stockOutLineId: Long? - val failQty: Double + val failQty: Double? + val qcPassed: Boolean } \ No newline at end of file diff --git a/src/main/java/com/ffii/fpsms/modules/qc/service/QcResultService.kt b/src/main/java/com/ffii/fpsms/modules/qc/service/QcResultService.kt index ed86038..76c38ed 100644 --- a/src/main/java/com/ffii/fpsms/modules/qc/service/QcResultService.kt +++ b/src/main/java/com/ffii/fpsms/modules/qc/service/QcResultService.kt @@ -42,6 +42,7 @@ open class QcResultService( this.failQty = request.failQty this.type = request.type this.remarks = request.remarks + this.qcPassed = request.qcPassed } val savedQcResult = saveAndFlush(qcResult) return MessageResponse( diff --git a/src/main/java/com/ffii/fpsms/modules/qc/web/model/SaveQcResultRequest.kt b/src/main/java/com/ffii/fpsms/modules/qc/web/model/SaveQcResultRequest.kt index bda1695..344f3ba 100644 --- a/src/main/java/com/ffii/fpsms/modules/qc/web/model/SaveQcResultRequest.kt +++ b/src/main/java/com/ffii/fpsms/modules/qc/web/model/SaveQcResultRequest.kt @@ -7,6 +7,7 @@ data class SaveQcResultRequest( val stockInLineId: Long?, val stockOutLineId: Long?, val failQty: Double, + val qcPassed: Boolean, val type: String?, val remarks: String?, ) diff --git a/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt b/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt index 9450014..f1705d9 100644 --- a/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt +++ b/src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt @@ -171,6 +171,7 @@ open class StockInLineService( this.item = item this.stockInLine = stockInLine this.failQty = it.failQty + this.qcPassed = it.qcPassed this.type = "qc" // default as qc for now this.remarks = it.remarks } diff --git a/src/main/resources/db/changelog/changes/20250820_01_kelvin/01_update_qc_result.sql b/src/main/resources/db/changelog/changes/20250820_01_kelvin/01_update_qc_result.sql new file mode 100644 index 0000000..c8535fa --- /dev/null +++ b/src/main/resources/db/changelog/changes/20250820_01_kelvin/01_update_qc_result.sql @@ -0,0 +1,4 @@ +-- liquibase formatted sql +-- changeset kelvin:update qc result table +ALTER TABLE `qc_result` +ADD COLUMN `qcPassed` TINYINT(1) NOT NULL DEFAULT 1 AFTER `remarks`;