Author: bleny Date: 2013-07-13 17:03:53 +0200 (Sat, 13 Jul 2013) New Revision: 314 Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revisions... Log: remove hacks for easy testing, limit suggested locations to 50 in reception Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieInterceptor.java Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-07-13 14:48:43 UTC (rev 313) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-07-13 15:03:53 UTC (rev 314) @@ -33,9 +33,7 @@ Location find(String code, Warehouse warehouse); - List<Location> findAllWithoutReception(Building building); + List<Location> findAllWithoutReception(Warehouse warehouse, boolean limitExtraLocationsTo50); - List<Location> findAllWithoutReception(Warehouse warehouse); - Location findByBarcode(String barcode, Building building); } Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java 2013-07-13 14:48:43 UTC (rev 313) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java 2013-07-13 15:03:53 UTC (rev 314) @@ -46,43 +46,25 @@ return findUnique(query); } - protected List<Location> findAllWithoutReception(Building building, Warehouse warehouse) { - boolean filterOnBuilding = building != null; - boolean filterOnWarehouse = warehouse != null; + @Override + public List<Location> findAllWithoutReception(Warehouse warehouse, boolean limitExtraLocationsTo50) { String hql = " from Location l where"; - if (filterOnBuilding) { - hql += " l.warehouse.building = :building and "; - } - if (filterOnWarehouse) { - hql += " l.warehouse = :warehouse and "; - } - hql += " l.code != :codeForReceptionLocations and " + hql += " l.warehouse = :warehouse and " + + " l.code != :codeForReceptionLocations and " + " l.code != :codeForWarehouseWithoutLocations and " + " l.fullLocation = false " + " order by l.warehouse.building.code, l.warehouse.code, l.code"; TypedQuery <Location> query = createQuery(hql); - if (filterOnBuilding) { - query.setParameter("building", building); - } - if (filterOnWarehouse) { - query.setParameter("warehouse", warehouse); - } + query.setParameter("warehouse", warehouse); query.setParameter("codeForReceptionLocations", Locations.codeForReceptionLocations()); query.setParameter("codeForWarehouseWithoutLocations", Locations.codeForWarehouseWithoutLocations()); + if (limitExtraLocationsTo50) { + query.setMaxResults(50); + } return findAll(query); } @Override - public List<Location> findAllWithoutReception(Building building) { - return findAllWithoutReception(building, null); - } - - @Override - public List<Location> findAllWithoutReception(Warehouse warehouse) { - return findAllWithoutReception(null, warehouse); - } - - @Override public Location findByBarcode(String barcode, Building building) { TypedQuery<Location> query = createQuery("from Location l " + "where CONCAT(l.warehouse.code, l.code) = :barcode " + Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java =================================================================== --- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-07-13 14:48:43 UTC (rev 313) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-07-13 15:03:53 UTC (rev 314) @@ -69,7 +69,7 @@ private static final Log log = LogFactory.getLog(ReceptionService.class); /** disabled, for a warehouse with 1000+ locations, can lead to a page of 1Mo+, now the locations are loaded on demand */ - protected static final boolean INCLUDE_ALL_BUILDING_LOCATIONS_IN_RECEPTION_TASK = false; + protected static final boolean LIMIT_EXTRA_LOCATIONS_TO_50 = true; protected MagalieServiceContext serviceContext; @@ -241,16 +241,9 @@ LocationDao locationDao = persistenceContext.getLocationDao(); - // TODO brendan 04/07/13 probablement l'origine du problème de performance - // add all locations in the same warehouse - locations.addAll(locationDao.findAllWithoutReception(warehouse)); + locations.addAll(locationDao.findAllWithoutReception(warehouse, LIMIT_EXTRA_LOCATIONS_TO_50)); - // add all locations in the same building, other warehouses - if (INCLUDE_ALL_BUILDING_LOCATIONS_IN_RECEPTION_TASK) { - locations.addAll(locationDao.findAllWithoutReception(warehouse.getBuilding())); - } - // fourth step, remove reception locations because it's stupid to // move an article from reception location to another reception location // also, remove full locations and locations reported in error Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieInterceptor.java =================================================================== --- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieInterceptor.java 2013-07-13 14:48:43 UTC (rev 313) +++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieInterceptor.java 2013-07-13 15:03:53 UTC (rev 314) @@ -26,8 +26,6 @@ import com.franciaflex.magalie.MagalieApplicationConfig; import com.franciaflex.magalie.services.MagalieService; import com.franciaflex.magalie.services.MagalieServiceContext; -import com.franciaflex.magalie.services.service.BuildingsService; -import com.franciaflex.magalie.services.service.MagalieUsersService; import com.franciaflex.magalie.web.action.ChooseCompanyAction; import com.franciaflex.magalie.web.action.IndexAction; import com.franciaflex.magalie.web.action.LoginAction; @@ -133,12 +131,6 @@ try { - // TODO brendan 12/07/13 remove - if (magalieSession.getMagalieUser() == null) { - magalieSession.setBuilding(serviceContext.newService(BuildingsService.class).getBuilding("building_1")); - magalieSession.setMagalieUser(serviceContext.newService(MagalieUsersService.class).getMagalieUser("magalie_user_bruno")); - } - // prevent accessing a page without a session if (magalieSession.getMagalieUser() == null) {
participants (1)
-
bleny@users.forge.codelutin.com