From a9961027d184edd98910d7042b38e5a10c84d31a Mon Sep 17 00:00:00 2001 From: gowthaman Date: Fri, 31 May 2024 16:47:45 +0530 Subject: [PATCH] add vendor po fix and edits --- .../kotlin/com/restapi/controllers/Filters.kt | 15 +++++++-------- src/main/kotlin/com/restapi/domain/Vendors.kt | 11 ++++++++++- src/main/resources/dbmigration/1.33.sql | 5 +++++ .../resources/dbmigration/model/1.33.model.xml | 11 +++++++++++ src/main/resources/logback.xml | 2 +- 5 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 src/main/resources/dbmigration/1.33.sql create mode 100644 src/main/resources/dbmigration/model/1.33.model.xml diff --git a/src/main/kotlin/com/restapi/controllers/Filters.kt b/src/main/kotlin/com/restapi/controllers/Filters.kt index 97d8b4d..a063955 100644 --- a/src/main/kotlin/com/restapi/controllers/Filters.kt +++ b/src/main/kotlin/com/restapi/controllers/Filters.kt @@ -27,7 +27,7 @@ data class CommonFilters( interface CustomFilters {} data class POFilters( - val poNumLike: String = IGNORE, + val poNumLike: String = "", val totalAmountExceeds: Long = Long.MIN_VALUE, val totalAmountLessThan: Long = Long.MAX_VALUE, val validAfter: LocalDate = baseDate, @@ -134,7 +134,7 @@ fun applySortHelper(q: io.ebean.ExpressionList, sortBy: String, asc: Bool fun applyFromToHelper(q: io.ebean.ExpressionList, fromDate: LocalDate, toDate: LocalDate, colName: String) { q.ge(colName, fromDate) - .le(colName, toDate) + .lt(colName, toDate.plusDays(1)) } fun applyCommonFilters(q: io.ebean.ExpressionList, commonFilters: CommonFilters) { @@ -161,12 +161,8 @@ fun searchQuotes(commonFilters: CommonFilters, quoteFilters: QuoteFilters): List fun searchVendors(commonFilters: CommonFilters, vendorFilters: VendorFilters): List { val q = database.find(Vendor::class.java) .where() - .ge("rating", vendorFilters.ratingExceeds) - .le("rating", vendorFilters.ratingLessThan) .ilike("name", "%" + vendorFilters.nameLike + "%") - .ilike("msme", "%" + vendorFilters.msmeLike + "%") .ilike("gstNumber", "%" + vendorFilters.gstNumLike + "%") - .ilike("address", "%" + vendorFilters.addressLike + "%") applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc) return q.findList() } @@ -208,8 +204,11 @@ fun searchPos(commonFilters: CommonFilters, poFilters0: POFilters?): List = mutableListOf() - @ManyToOne var vendor: Vendor? = null var referenceQuotation: String? = "" @@ -79,6 +82,12 @@ open class PurchaseOrder : BaseTenantModel() { var poDate: LocalDate? = null var validTill: LocalDate? = null + var allLoadingSite: Boolean = true + var allUnloadingSite: Boolean = true + + var unloadingPlantId: String? = null + var loadingSiteId: UUID? = null + @DbArray var tnc: List? = arrayListOf() diff --git a/src/main/resources/dbmigration/1.33.sql b/src/main/resources/dbmigration/1.33.sql new file mode 100644 index 0000000..ee1e61b --- /dev/null +++ b/src/main/resources/dbmigration/1.33.sql @@ -0,0 +1,5 @@ +-- apply alter tables +alter table purchase_order add column if not exists all_loading_site boolean default true not null; +alter table purchase_order add column if not exists all_unloading_site boolean default true not null; +alter table purchase_order add column if not exists unloading_plant_id varchar(255); +alter table purchase_order add column if not exists loading_site_id uuid; diff --git a/src/main/resources/dbmigration/model/1.33.model.xml b/src/main/resources/dbmigration/model/1.33.model.xml new file mode 100644 index 0000000..a077fd6 --- /dev/null +++ b/src/main/resources/dbmigration/model/1.33.model.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index a7138dc..c338f0b 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -21,7 +21,7 @@ - +