From 88a9cb4b110e5a241bf12839a4ec99af7a611fae Mon Sep 17 00:00:00 2001 From: Deepak Dixit Date: Thu, 1 Aug 2024 11:38:59 +0530 Subject: [PATCH] Fixed the CONVERT_TZ issue while checking the facility order count , due to incorrect syntax is was returning null for all condition --- service/co/hotwax/order/routing/OrderRoutingServices.xml | 3 +++ sql/InventorySourceSelector.sql.ftl | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/service/co/hotwax/order/routing/OrderRoutingServices.xml b/service/co/hotwax/order/routing/OrderRoutingServices.xml index 6d2e727..7f2b18b 100644 --- a/service/co/hotwax/order/routing/OrderRoutingServices.xml +++ b/service/co/hotwax/order/routing/OrderRoutingServices.xml @@ -140,6 +140,7 @@ In this scenario, there is no direct way to identify if the service returned an error. As we want to log the hasError status at the OrderRoutingRun level, to address this we are calling service in script tag */ + try { def orderRoutingResult = ec.service.sync().name("co.hotwax.order.routing.OrderRoutingServices.run#OrderRouting") .requireNewTransaction(true) @@ -383,6 +384,7 @@ + @@ -866,6 +868,7 @@ + diff --git a/sql/InventorySourceSelector.sql.ftl b/sql/InventorySourceSelector.sql.ftl index 5effdfe..64d7382 100644 --- a/sql/InventorySourceSelector.sql.ftl +++ b/sql/InventorySourceSelector.sql.ftl @@ -112,7 +112,7 @@ x.* left join facility f on pf.facility_id=f.facility_id left join (select foc1.facility_id,foc1.entry_date,foc1.last_order_count from facility_order_count foc1 inner join (select facility_id,max(entry_date) as entry_date from facility_order_count group by facility_id) foc2 on foc2.facility_id=foc1.facility_id and foc2.entry_date=foc1.entry_date - ) foc on pf.facility_id=foc.facility_id and foc.entry_date = DATE(CONVERT_TZ(UTC_TIMESTAMP,'+00:00' , ifnull('America/New_York', '+00:00'))) + ) foc on pf.facility_id=foc.facility_id and foc.entry_date = DATE(CONVERT_TZ(UTC_TIMESTAMP,'+00:00' , '${brokeringOffset!"+00:00"}')) left join facility_contact_mech_purpose fcmp on fcmp.facility_id=f.facility_id and fcmp.contact_mech_purpose_type_id='PRIMARY_LOCATION' and (fcmp.thru_date is null or fcmp.thru_date >= now()) inner join postal_address fpa on fpa.contact_mech_id=fcmp.contact_mech_id left join (SELECT PFI.FACILITY_ID, sum(ifnull(PFI.LAST_INVENTORY_COUNT, 0)) AS inventoryForAllocation, count(PFI.PRODUCT_ID) as PRODUCT_COUNT FROM PRODUCT_FACILITY PFI WHERE ifnull(PFI.LAST_INVENTORY_COUNT, 0) > ifnull(PFI.MINIMUM_STOCK,0)