Openbravo Issue Tracking System - Retail Modules
View Issue Details
0033788Retail ModulesWeb POSpublic2016-08-24 10:502018-03-16 14:45
shuehner 
Sandrahuguet 
normalminorhave not tried
closedfixed 
5
 
RR18Q2 
marvintm
No
0033788: OrderLoader.createShipmentLines query to m_locator could be optimized away
Split out part mentioned as note already in issue 33157

createShipmentLines has following code near the end of the function:

        if (pendingQty.compareTo(BigDecimal.ZERO) != 0) {
          // still qty to ship or return: let's use the bin with highest prio
          hqlWhereClause = " l where l.warehouse = :warehouse order by l.relativePriority, l.id";
          OBQuery<Locator> queryLoc = OBDal.getInstance()
              .createQuery(Locator.class, hqlWhereClause);
          queryLoc.setNamedParameter("warehouse", warehouse);
          queryLoc.setMaxResult(1);

That query very similar to one done earlier (see issue 33139).
That earlier query does search with any specified order just to check if it can find 'any' m_locator entries in current warehouse.

This query searched for 1 with highest relativePriority.

By adding orderBy that first query its result could be reused to also serve in this code here and the extra query removed.

Note: That would add some small overhead to that first query by forcing 'order by relativePriority,id limit 2'

-
Performance
related to defect 0033158 closed shuehner Duplicate query done by accident in OrderLoader.createShipmentLines 
Issue History
2016-08-24 10:50shuehnerNew Issue
2016-08-24 10:50shuehnerAssigned To => Retail
2016-08-24 10:50shuehnerTriggers an Emergency Pack => No
2016-08-24 10:51shuehnerTag Attached: Performance
2016-08-24 10:51shuehnerRelationship addedrelated to 0033158
2018-03-14 13:14SandrahuguetAssigned ToRetail => Sandrahuguet
2018-03-14 15:20SandrahuguetReview Assigned To => marvintm
2018-03-16 08:19hgbotCheckin
2018-03-16 08:19hgbotNote Added: 0103298
2018-03-16 08:19hgbotStatusnew => resolved
2018-03-16 08:19hgbotResolutionopen => fixed
2018-03-16 08:19hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c28f8c44a0eeb99c22252cea20dfb76baf1f1242 [^]
2018-03-16 14:45marvintmStatusresolved => closed
2018-03-16 14:45marvintmFixed in Version => RR18Q2

Notes
(0103298)
hgbot   
2018-03-16 08:19   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: c28f8c44a0eeb99c22252cea20dfb76baf1f1242
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Thu Mar 15 08:46:54 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c28f8c44a0eeb99c22252cea20dfb76baf1f1242 [^]

Fixed issue 33788 optimize OrderLoader.createShipmentLines query

---
M src/org/openbravo/retail/posterminal/OrderLoader.java
---