Rimossa whereCond in getOrdiniLavorazione
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -4,7 +4,7 @@ import java.util.Date;
|
||||
|
||||
public class GroupStepDTO {
|
||||
String codJfas;
|
||||
String idLotto;
|
||||
Integer idLotto;
|
||||
Date dataLotto;
|
||||
String codJcom;
|
||||
Date dataOrdProd;
|
||||
@@ -24,11 +24,11 @@ public class GroupStepDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIdLotto() {
|
||||
public Integer getIdLotto() {
|
||||
return idLotto;
|
||||
}
|
||||
|
||||
public GroupStepDTO setIdLotto(String idLotto) {
|
||||
public GroupStepDTO setIdLotto(Integer idLotto) {
|
||||
this.idLotto = idLotto;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1338,8 +1338,8 @@ public class MesProductionServiceV2 {
|
||||
|
||||
String sql = Query.format("SELECT dtb_ordr.* from dtb_ordr\n" +
|
||||
" inner join dtb_ordt on dtb_ordr.data_ord = dtb_ordt.data_ord_rif and dtb_ordr.gestione = gestione_rif and dtb_ordr.num_ord = num_ord_rif\n" +
|
||||
" where dtb_ordt.gestione = {} and dtb_ordt.data_ord = {} and dtb_ordt.num_ord = {} and dtb_ordr.cod_mart = {}",ordine.getGestione(),ordine.getDataOrd(),ordine.getNumOrd(),ordine.getCodProd());
|
||||
DtbOrdr oldRow = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),sql,DtbOrdr.class);
|
||||
" where dtb_ordt.gestione = {} and dtb_ordt.data_ord = {} and dtb_ordt.num_ord = {} and dtb_ordr.cod_mart = {}", ordine.getGestione(), ordine.getDataOrd(), ordine.getNumOrd(), ordine.getCodProd());
|
||||
DtbOrdr oldRow = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdr.class);
|
||||
|
||||
CreaOrdineProdDTO newOrdDTO = new CreaOrdineProdDTO();
|
||||
newOrdDTO.setCodAnag(ordine.getCodAnag())
|
||||
@@ -1351,7 +1351,7 @@ public class MesProductionServiceV2 {
|
||||
.setColliPedana(oldRow.getColliPedana());
|
||||
ordine = productionService.saveOrdineProd(newOrdDTO);
|
||||
ordine.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(ordine,multiDBTransactionManager);
|
||||
entityProcessor.processEntity(ordine, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
|
||||
@@ -1410,14 +1410,14 @@ public class MesProductionServiceV2 {
|
||||
partitaSL.setCodMart(scarico.getCodMart())
|
||||
.setPartitaMag(scarico.getPartitaMag())
|
||||
.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(partitaSL,multiDBTransactionManager);
|
||||
entityProcessor.processEntity(partitaSL, multiDBTransactionManager);
|
||||
|
||||
MtbPartitaMag partitaPf = new MtbPartitaMag();
|
||||
partitaPf.setCodMart(ordine.getCodProd())
|
||||
.setPartitaMag(partitaSL.getPartitaMag())
|
||||
.setDataScad(partitaSL.getDataScad())
|
||||
.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
entityProcessor.processEntity(partitaPf,true,multiDBTransactionManager);
|
||||
entityProcessor.processEntity(partitaPf, true, multiDBTransactionManager);
|
||||
ordine.setPartitaMag(partitaSL.getPartitaMag())
|
||||
.setOperation(OperationType.UPDATE);
|
||||
|
||||
@@ -1452,33 +1452,26 @@ public class MesProductionServiceV2 {
|
||||
throw new MissingDataException("openGroupStep");
|
||||
}
|
||||
|
||||
String whereCond;
|
||||
|
||||
if (UtilityString.isNullOrEmpty(groupStepDTO.getIdLotto())) {
|
||||
whereCond = Query.format(
|
||||
"cod_jcom = %s\n" +
|
||||
" AND data_ord_prod = %s\n" +
|
||||
" AND num_ord_prod = %s\n" +
|
||||
" AND cod_prod = %s\n" +
|
||||
" AND id_lotto IS NULL",
|
||||
groupStepDTO.getCodJcom(),
|
||||
groupStepDTO.getDataOrdProd(),
|
||||
groupStepDTO.getNumOrdProd(),
|
||||
groupStepDTO.getCodProd()
|
||||
);
|
||||
} else {
|
||||
whereCond = Query.format(
|
||||
"id_lotto = %s",
|
||||
groupStepDTO.getIdLotto()
|
||||
);
|
||||
}
|
||||
|
||||
List<OrdineLavorazioneDTO> ordini = productionOrderDataHandlerService.getOrdiniLavorazione(null, Collections.singletonList(groupStepDTO.getCodJfas()), null, null, null, whereCond);
|
||||
List<OrdineLavorazioneDTO> ordini = productionOrderDataHandlerService.getOrdiniLavorazione(null, Collections.singletonList(groupStepDTO.getCodJfas()), null, null, null);
|
||||
|
||||
if (ordini == null) {
|
||||
throw new SQLException("Nessun ordine trovato");
|
||||
}
|
||||
|
||||
if (UtilityString.isNullOrEmpty(groupStepDTO.getIdLotto())) {
|
||||
ordini = ordini.stream()
|
||||
.filter(x -> Objects.equals(x.getCodJcom(), groupStepDTO.getCodJcom())
|
||||
&& Objects.equals(x.getDataOrdProd(), groupStepDTO.getDataOrdProd())
|
||||
&& Objects.equals(x.getNumOrdProd(), groupStepDTO.getNumOrdProd())
|
||||
&& Objects.equals(x.getCodProd(), groupStepDTO.getCodProd())
|
||||
&& x.getIdLotto() == null)
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
} else {
|
||||
ordini = ordini.stream()
|
||||
.filter(x -> Objects.equals(x.getIdLotto(), groupStepDTO.getIdLotto()))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
List<EntityBase> entitiesToSave = new ArrayList<>();
|
||||
|
||||
String codJflavDef = setupGest.getSetup("W_PORDI_RC", "GENERA_LOTTO_PROD", "COD_JFLAV_DEF");
|
||||
@@ -1696,9 +1689,10 @@ public class MesProductionServiceV2 {
|
||||
}
|
||||
|
||||
RegisterSupervisorDTO supervisorData = getSupervisorPanelData(groupStepDTO.getCodJfas());
|
||||
if (supervisorData != null && !UtilityString.isNullOrEmpty(supervisorData.getSupervisorServiceIp())) {
|
||||
|
||||
if (supervisorData != null && !UtilityString.isNullOrEmpty(supervisorData.getSupervisorServiceIp())) {
|
||||
String command;
|
||||
|
||||
switch (action) {
|
||||
case OPEN:
|
||||
command = "order/start";
|
||||
@@ -1712,21 +1706,17 @@ public class MesProductionServiceV2 {
|
||||
default:
|
||||
command = null;
|
||||
}
|
||||
if (command != null) {
|
||||
|
||||
if (command != null) {
|
||||
HashMap<String, Object> body = new HashMap<>();
|
||||
Integer idLotto = jtbLott != null ? jtbLott.getIdLotto() : Integer.parseInt(groupStepDTO.getIdLotto());
|
||||
body.put("idLotto", idLotto);
|
||||
|
||||
body.put("idLotto", jtbLott != null ? jtbLott.getIdLotto() : groupStepDTO.getIdLotto());
|
||||
body.put("codJfas", groupStepDTO.getCodJfas());
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
sendCommand(groupStepDTO.getCodJfas(), command, mapper.convertValue(body, JsonNode.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ProductionOrderDataHandlerService {
|
||||
boolean gestioneAbilitata = isMESEnabled(multiDBTransactionManager);
|
||||
|
||||
if (gestioneAbilitata) {
|
||||
List<OrdineLavorazioneDTO> ordiniLav = getOrdiniLavorazione(multiDBTransactionManager, onlyInevasi ? "I" : null, null, null, null, null, null);
|
||||
List<OrdineLavorazioneDTO> ordiniLav = getOrdiniLavorazione(multiDBTransactionManager, onlyInevasi ? "I" : null, null, null, null, null);
|
||||
HashMap<String, List<OrdineLavorazioneDTO>> section = getSectionByDBName(orderList, dbName);
|
||||
section.clear();
|
||||
if (ordiniLav != null)
|
||||
@@ -128,27 +128,19 @@ public class ProductionOrderDataHandlerService {
|
||||
}
|
||||
|
||||
public List<OrdineLavorazioneDTO> getOrdiniLavorazioneSync(String flagEvaso, List<String> linee, Date startDate, Date endDate, String codAnag) throws Exception {
|
||||
return this.getOrdiniLavorazioneSync(flagEvaso, linee, startDate, endDate, codAnag, null);
|
||||
}
|
||||
|
||||
public List<OrdineLavorazioneDTO> getOrdiniLavorazioneSync(String flagEvaso, List<String> linee, Date startDate, Date endDate, String codAnag, String whereCond) throws Exception {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
return getOrdiniLavorazione(multiDBTransactionManager, flagEvaso, linee, startDate, endDate, codAnag, whereCond);
|
||||
return getOrdiniLavorazione(multiDBTransactionManager, flagEvaso, linee, startDate, endDate, codAnag);
|
||||
}
|
||||
|
||||
public List<OrdineLavorazioneDTO> getOrdiniLavorazione(String flagEvaso, List<String> linee, Date startDate, Date endDate, String codAnag) throws Exception {
|
||||
return this.getOrdiniLavorazione(flagEvaso, linee, startDate, endDate, codAnag, null);
|
||||
}
|
||||
|
||||
public List<OrdineLavorazioneDTO> getOrdiniLavorazione(String flagEvaso, List<String> linee, Date startDate, Date endDate, String codAnag, String whereCond) throws Exception {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
|
||||
if (
|
||||
UtilityDebug.isIntegryServer() || UtilityDebug.isDebugExecution() ||
|
||||
UtilityString.isNullOrEmpty(flagEvaso)
|
||||
if (UtilityDebug.isIntegryServer()
|
||||
|| UtilityDebug.isDebugExecution()
|
||||
|| UtilityString.isNullOrEmpty(flagEvaso)
|
||||
|| !flagEvaso.equalsIgnoreCase("I")
|
||||
|| !isMESEnabled(multiDBTransactionManager)) {
|
||||
return getOrdiniLavorazione(multiDBTransactionManager, flagEvaso, linee, startDate, endDate, codAnag, whereCond);
|
||||
return getOrdiniLavorazione(multiDBTransactionManager, flagEvaso, linee, startDate, endDate, codAnag);
|
||||
} else {
|
||||
HashMap<String, HashMap<String, List<OrdineLavorazioneDTO>>> inputMap = inevasiOrdersCachedData;
|
||||
List<OrdineLavorazioneDTO> ordersList = new ArrayList<>();
|
||||
@@ -200,8 +192,8 @@ public class ProductionOrderDataHandlerService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<OrdineLavorazioneDTO> getOrdiniLavorazione(MultiDBTransactionManager multiDBTransactionManager, String flagEvaso, List<String> linee, Date startDate, Date endDate, String codAnag, String whereCond) throws Exception {
|
||||
String whereCondFlagEvaso = "";
|
||||
private List<OrdineLavorazioneDTO> getOrdiniLavorazione(MultiDBTransactionManager multiDBTransactionManager, String flagEvaso, List<String> linee, Date startDate, Date endDate, String codAnag) throws Exception {
|
||||
String whereCondFlagEvaso;
|
||||
String whereCondCodJfas = "";
|
||||
|
||||
if (startDate == null) {
|
||||
@@ -241,8 +233,7 @@ public class ProductionOrderDataHandlerService {
|
||||
UtilityDB.valueToString(endDate) + "," +
|
||||
UtilityDB.valueToString(flagEvaso) + "," +
|
||||
UtilityDB.valueToString(codAnag) + ")\n" +
|
||||
"WHERE " + (UtilityString.isNullOrEmpty(whereCond) ? "1 = 1" : whereCond) + "\n" +
|
||||
" ORDER BY sort";
|
||||
"ORDER BY sort";
|
||||
} else {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(flagEvaso)) {
|
||||
@@ -426,7 +417,6 @@ public class ProductionOrderDataHandlerService {
|
||||
" dtb_ord_steps.flag_step_attivo = 'S' " +
|
||||
whereCondFlagEvaso +
|
||||
whereCondCodJfas +
|
||||
" AND " + (UtilityString.isNullOrEmpty(whereCond) ? "1 = 1" : whereCond) + "\n" +
|
||||
" AND max_step_by_num_fase = max_step" +
|
||||
" GROUP BY dtb_ordr.data_ord, " +
|
||||
" dtb_ordr.num_ord, " +
|
||||
|
||||
Reference in New Issue
Block a user