Skip to content

Commit

Permalink
Merge pull request #40 from hotwax/27-order-routing-application-excee…
Browse files Browse the repository at this point in the history
…ds-maximum-order-capacity-for-facilities

Fixed the CONVERT_TZ issue while checking the facility order count , …
  • Loading branch information
dixitdeepak authored Aug 1, 2024
2 parents 899073e + 88a9cb4 commit c2f5a72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions service/co/hotwax/order/routing/OrderRoutingServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -383,6 +384,7 @@
<order-map-list list="sortFields">
<order-by field-name="sequenceNum"/>
</order-map-list>
<set field="brokeringOffset" from="ZonedDateTime.now().getOffset()"/>
<set field="productStore" from="ec.entity.getEntityDefinition('org.apache.ofbiz.product.store.ProductStore')"/>
<set field="inventorySortByList" from="sortFields != null ? sortFields.fieldName:[]" type="List"/>
<set field="templateLoc" value="component://order-routing/sql/InventorySourceSelector.sql.ftl"/>
Expand Down Expand Up @@ -866,6 +868,7 @@
<order-map-list list="sortFields">
<order-by field-name="sequenceNum"/>
</order-map-list>
<set field="brokeringOffset" from="ZonedDateTime.now().getOffset()"/>
<set field="inventorySortByList" from="sortFields != null ? sortFields.fieldName:[]" type="List"/>
<set field="templateLoc" value="component://order-routing/sql/InventorySourceSelector.sql.ftl"/>
<set field="suggestedFulfillmentLocations" from="[]"/>
Expand Down
2 changes: 1 addition & 1 deletion sql/InventorySourceSelector.sql.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c2f5a72

Please sign in to comment.