From c951e532a29ba0a048f326480a4bce4d76f0647e Mon Sep 17 00:00:00 2001 From: "cyril.tsui" Date: Thu, 29 May 2025 12:27:32 +0800 Subject: [PATCH] update --- .../m18/model/M18PurchaseQuotationResponse.kt | 3 +++ .../service/M18PurchaseQuotationService.kt | 1 + .../entity/PurchaseQuotationLine.kt | 5 +++++ .../service/PurchaseQuotationLineService.kt | 1 + .../model/SavePurchaseQuotationLineRequest.kt | 2 ++ .../20250528_01_cyril/01_update_inventory.sql | 5 +++++ .../02_create_trigger_debug_log.sql | 19 +++++++++++++++++++ .../03_update_purchase_quotation_line.sql | 6 ++++++ .../20250528_01_cyril/04_update_inventory.sql | 12 ++++++++++++ 9 files changed, 54 insertions(+) create mode 100644 src/main/resources/db/changelog/changes/20250528_01_cyril/01_update_inventory.sql create mode 100644 src/main/resources/db/changelog/changes/20250528_01_cyril/02_create_trigger_debug_log.sql create mode 100644 src/main/resources/db/changelog/changes/20250528_01_cyril/03_update_purchase_quotation_line.sql create mode 100644 src/main/resources/db/changelog/changes/20250528_01_cyril/04_update_inventory.sql diff --git a/src/main/java/com/ffii/fpsms/m18/model/M18PurchaseQuotationResponse.kt b/src/main/java/com/ffii/fpsms/m18/model/M18PurchaseQuotationResponse.kt index 21f32e6..e498f33 100644 --- a/src/main/java/com/ffii/fpsms/m18/model/M18PurchaseQuotationResponse.kt +++ b/src/main/java/com/ffii/fpsms/m18/model/M18PurchaseQuotationResponse.kt @@ -1,5 +1,7 @@ package com.ffii.fpsms.m18.model +import java.math.BigDecimal + // Purchase Quotation data class M18PurchaseQuotationResponse( val data: M18PurchaseQuotationData?, @@ -35,6 +37,7 @@ data class M18PurchaseQuotationVqut( val refCode: String, val unitId: Long, val proId: Long, + val up: BigDecimal, ) // Purchase Quotation List diff --git a/src/main/java/com/ffii/fpsms/m18/service/M18PurchaseQuotationService.kt b/src/main/java/com/ffii/fpsms/m18/service/M18PurchaseQuotationService.kt index fb65470..ac24dc1 100644 --- a/src/main/java/com/ffii/fpsms/m18/service/M18PurchaseQuotationService.kt +++ b/src/main/java/com/ffii/fpsms/m18/service/M18PurchaseQuotationService.kt @@ -143,6 +143,7 @@ open class M18PurchaseQuotationService( m18ItemId = line.proId, code = line.refCode, description = line.bDesc, + price = line.up, m18Id = line.id, m18LastModifyDate = commonUtils.timestampToLocalDateTime(mainvqu.lastModifyDate) ) diff --git a/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/entity/PurchaseQuotationLine.kt b/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/entity/PurchaseQuotationLine.kt index 3258f96..95b6e7b 100644 --- a/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/entity/PurchaseQuotationLine.kt +++ b/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/entity/PurchaseQuotationLine.kt @@ -1,10 +1,12 @@ package com.ffii.fpsms.modules.purchaseQuotation.entity import com.ffii.core.entity.BaseEntity +import com.ffii.fpsms.modules.master.entity.Currency import com.ffii.fpsms.modules.master.entity.Items import com.ffii.fpsms.modules.master.entity.UomConversion import jakarta.persistence.* import jakarta.validation.constraints.Size +import java.math.BigDecimal import java.time.Instant import java.time.LocalDateTime @@ -27,6 +29,9 @@ open class PurchaseQuotationLine : BaseEntity() { @Column(name = "description", length = 300) open var description: String? = null + @Column(name = "price") + open var price: BigDecimal? = null + @ManyToOne @JoinColumn(name = "uomId") open var uom: UomConversion? = null diff --git a/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/service/PurchaseQuotationLineService.kt b/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/service/PurchaseQuotationLineService.kt index 294ad4a..03a7662 100644 --- a/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/service/PurchaseQuotationLineService.kt +++ b/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/service/PurchaseQuotationLineService.kt @@ -36,6 +36,7 @@ open class PurchaseQuotationLineService ( this.item = item code = request.code description = request.description + price = request.price this.uom = uom m18Id = request.m18Id ?: this.m18Id m18LastModifyDate = request.m18LastModifyDate ?: this.m18LastModifyDate diff --git a/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/web/model/SavePurchaseQuotationLineRequest.kt b/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/web/model/SavePurchaseQuotationLineRequest.kt index 3b65376..0020743 100644 --- a/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/web/model/SavePurchaseQuotationLineRequest.kt +++ b/src/main/java/com/ffii/fpsms/modules/purchaseQuotation/web/model/SavePurchaseQuotationLineRequest.kt @@ -1,5 +1,6 @@ package com.ffii.fpsms.modules.purchaseQuotation.web.model +import java.math.BigDecimal import java.time.LocalDateTime data class SavePurchaseQuotationLineRequest( @@ -9,6 +10,7 @@ data class SavePurchaseQuotationLineRequest( val m18ItemId: Long? = null, val code: String? = null, val description: String? = null, + val price: BigDecimal? = null, val uomId: Long? = null, val m18UomId: Long? = null, val m18Id: Long? = null, diff --git a/src/main/resources/db/changelog/changes/20250528_01_cyril/01_update_inventory.sql b/src/main/resources/db/changelog/changes/20250528_01_cyril/01_update_inventory.sql new file mode 100644 index 0000000..19d4c80 --- /dev/null +++ b/src/main/resources/db/changelog/changes/20250528_01_cyril/01_update_inventory.sql @@ -0,0 +1,5 @@ +-- liquibase formatted sql +-- changeset cyril:inventory +ALTER TABLE `inventory` + ADD COLUMN `itemId` INT NULL AFTER `deleted`, + ADD CONSTRAINT `FK_INVENTORY_ON_ITEMID` FOREIGN KEY (`itemId`) REFERENCES `items` (`id`); diff --git a/src/main/resources/db/changelog/changes/20250528_01_cyril/02_create_trigger_debug_log.sql b/src/main/resources/db/changelog/changes/20250528_01_cyril/02_create_trigger_debug_log.sql new file mode 100644 index 0000000..269c707 --- /dev/null +++ b/src/main/resources/db/changelog/changes/20250528_01_cyril/02_create_trigger_debug_log.sql @@ -0,0 +1,19 @@ +-- liquibase formatted sql +-- changeset cyril:trigger debug log + +CREATE TABLE `trigger_debug_log` +( + `id` INT NOT NULL AUTO_INCREMENT, + `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `createdBy` VARCHAR(30) NULL DEFAULT NULL, + `version` INT NOT NULL DEFAULT '0', + `modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `modifiedBy` VARCHAR(30) NULL DEFAULT NULL, + `deleted` TINYINT(1) NOT NULL DEFAULT '0', + `tableName` VARCHAR(255) NULL, + `triggerName` VARCHAR(255) NULL, + `description` VARCHAR(255) NULL, + `errorMessages` TEXT NULL, + `status` VARCHAR(255) NULL default 'success', + CONSTRAINT pk_trigger_debug_log PRIMARY KEY (id) +); \ No newline at end of file diff --git a/src/main/resources/db/changelog/changes/20250528_01_cyril/03_update_purchase_quotation_line.sql b/src/main/resources/db/changelog/changes/20250528_01_cyril/03_update_purchase_quotation_line.sql new file mode 100644 index 0000000..2fed591 --- /dev/null +++ b/src/main/resources/db/changelog/changes/20250528_01_cyril/03_update_purchase_quotation_line.sql @@ -0,0 +1,6 @@ +-- liquibase formatted sql + +-- changeset cyril:update purchase quotation line + +ALTER TABLE `purchase_quotation_line` + ADD COLUMN `price` DECIMAL(14, 2) NULL AFTER `description`; \ No newline at end of file diff --git a/src/main/resources/db/changelog/changes/20250528_01_cyril/04_update_inventory.sql b/src/main/resources/db/changelog/changes/20250528_01_cyril/04_update_inventory.sql new file mode 100644 index 0000000..53338d1 --- /dev/null +++ b/src/main/resources/db/changelog/changes/20250528_01_cyril/04_update_inventory.sql @@ -0,0 +1,12 @@ +-- liquibase formatted sql + +-- changeset cyril:update inventory + +ALTER TABLE `inventory` + DROP FOREIGN KEY `FK_INVENTORY_TO_CURRENCY_ON_CURRENCY_ID`; +ALTER TABLE `inventory` + CHANGE COLUMN `currencyId` `currencyId` INT NULL ; +ALTER TABLE `inventory` + ADD CONSTRAINT `FK_INVENTORY_TO_CURRENCY_ON_CURRENCY_ID` + FOREIGN KEY (`currencyId`) + REFERENCES `currency` (`id`);