[DEMO]
messi dati MRP e MES in cache per biolevante !!TEMPORANEAMENTE!!
This commit is contained in:
@@ -46,6 +46,17 @@ public class MrpConsumiHandlerService {
|
||||
if ( saveCache() ) {
|
||||
looperService.add(() -> this.internalCacheConsumi(consumiCachedData), (UtilityDebug.isDebugExecution()?5:1) * 60 * 1000, MrpConsumiHandlerService.class.getName());
|
||||
}
|
||||
|
||||
|
||||
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer()) {
|
||||
looperService.add(() -> {
|
||||
try {
|
||||
loadConsumi( "biolevante", "BIOLEVANTE", consumiCachedData);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}, 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean saveCache(){
|
||||
@@ -66,6 +77,17 @@ public class MrpConsumiHandlerService {
|
||||
for (String dbName : databases.keySet()) {
|
||||
String profileName = databases.get(dbName).get(0).getProfileName();
|
||||
|
||||
|
||||
loadConsumi(dbName,profileName,consumiList);
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConsumi(String dbName, String profileName, HashMap<String, HashMap<String, Map<String, List<MRPDailyConsumiDTO>>>> consumiList) throws Exception {
|
||||
Date startDate = new Date();
|
||||
MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false);
|
||||
|
||||
@@ -83,11 +105,6 @@ public class MrpConsumiHandlerService {
|
||||
multiDBTransactionManager.closeAll();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isGestioneAbilitata(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||
String sql =
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
@@ -234,7 +251,7 @@ public class MrpConsumiHandlerService {
|
||||
public Map<String, List<MRPDailyConsumiDTO>> getConsumi() throws Exception {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
|
||||
if (!saveCache()) {
|
||||
if (!saveCache() && !multiDBTransactionManager.getPrimaryDatasource().getDbName().equalsIgnoreCase("biolevante")) {
|
||||
return getConsumi(multiDBTransactionManager);
|
||||
} else {
|
||||
HashMap<String, HashMap<String, Map<String, List<MRPDailyConsumiDTO>>>> inputMap = consumiCachedData;
|
||||
|
||||
@@ -52,6 +52,16 @@ public class ProductionOrderDataHandlerService {
|
||||
if (!UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer()) {
|
||||
looperService.add(() -> this.internalCacheOrdiniLavorazione(true, inevasiOrdersCachedData), 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
||||
}
|
||||
|
||||
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer()) {
|
||||
looperService.add(() -> {
|
||||
try {
|
||||
loadOrdiniProfile(false, "biolevante", "BIOLEVANTE", inevasiOrdersCachedData);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}, 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,9 +154,7 @@ public class ProductionOrderDataHandlerService {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
|
||||
if (
|
||||
UtilityDebug.isIntegryServer()
|
||||
|| UtilityDebug.isDebugExecution()
|
||||
|| UtilityString.isNullOrEmpty(flagEvaso)
|
||||
UtilityString.isNullOrEmpty(flagEvaso)
|
||||
|| !flagEvaso.equalsIgnoreCase("I")
|
||||
|| !isMESEnabled(multiDBTransactionManager)) {
|
||||
return getOrdiniLavorazione(multiDBTransactionManager, flagEvaso, linee, startDate, endDate, codAnag, whereCond);
|
||||
|
||||
Reference in New Issue
Block a user