[Smetar - Centri di lavoro]

- Aggiunto servizio per fetch allegati lotto
- Aggiunto invio eventi ordine al collector
This commit is contained in:
2024-06-13 10:05:23 +02:00
parent b8c4caaa9b
commit a14e9f85e1
4 changed files with 88 additions and 0 deletions

View File

@@ -353,6 +353,7 @@ public class EmsRestConstants {
public static final String PATH_MES_ARRESTA_LINEA_PRODUZIONE = PATH + "arrestaLineaDiProduzione";
public static final String PATH_MES_AVVIA_PRODUZIONE_ARTICOLO_SU_LINEA = PATH + "avviaProduzioneArticoloSuLinea";
public static final String PATH_MES_STATO_LINEE_PROD = PATH + "statoLineeProd";
public static final String PATH_MES_ALLEGATI_LOTTO = PATH + "getAllegatiLottoLavorazione";
public static final String PATH_MES_GET_ORDINI_LAVORAZIONE_MATERIALE_V2 = PATH + "getOrdiniLavorazioneMateriale";
public static final String PATH_MES_GET_RIGA_ORD_MATERIA_PRIMA_FROM_MACC_V2 = PATH + "getRigaOrdMateriaPrimaFromMacc";

View File

@@ -376,6 +376,17 @@ public class MesProductionControllerV2 {
return ServiceRestResponse.createPositiveResponse(productionLineService.productionLinesStatus(codMdep));
}
@RequestMapping(value = EmsRestConstants.PATH_MES_ALLEGATI_LOTTO, method = RequestMethod.GET)
public @ResponseBody
ServiceRestResponse getAllegatiLottoLavorazione(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestParam("codJfas") String codJfas,
@RequestParam("idLotto") String idLotto
) throws Exception {
return ServiceRestResponse.createPositiveResponse(mesProductionService.getAllegatiLottoLavorazione(codJfas,idLotto));
}
@RequestMapping(value = "executeGroupStep", method = RequestMethod.POST)
public @ResponseBody
ServiceRestResponse executeGroupStep(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,

View File

@@ -0,0 +1,29 @@
package it.integry.ems.production.dto;
import it.integry.ems_model.annotation.SqlField;
public class AttachmentDTO {
@SqlField("id_attach")
private String idAttach;
@SqlField("file_name")
private String fileName;
public String getIdAttach() {
return idAttach;
}
public AttachmentDTO setIdAttach(String idAttach) {
this.idAttach = idAttach;
return this;
}
public String getFileName() {
return fileName;
}
public AttachmentDTO setFileName(String fileName) {
this.fileName = fileName;
return this;
}
}

View File

@@ -1338,6 +1338,37 @@ public class MesProductionServiceV2 {
} else {
multiDBTransactionManager.commitAll();
}
RegisterSupervisorDTO supervisorData = getSupervisorPanelData(groupStepDTO.getCodJfas());
if (supervisorData != null && !UtilityString.isNullOrEmpty(supervisorData.getSupervisorServiceIp())) {
String command;
switch (action) {
case OPEN:
command = "order/start";
break;
case STOP:
command = "order/stop";
break;
case CLOSE:
command = "order/pause";
break;
default:
command = null;
}
HashMap<String, Object> body = new HashMap<>();
Integer idLotto = jtbLott != null ? jtbLott.getIdLotto() : Integer.parseInt(groupStepDTO.getIdLotto());
body.put("idLotto", idLotto);
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;
@@ -1426,4 +1457,20 @@ public class MesProductionServiceV2 {
}
return data;
}
public List<AttachmentDTO> getAllegatiLottoLavorazione(String codJfas, String idLotto) throws Exception {
String sql = "SELECT stb_files_attached.id_attach, stb_files_attached.file_name\n" +
"FROM jtb_lott\n" +
" LEFT OUTER JOIN jtb_lotr ON jtb_lott.cod_jfas = jtb_lotr.cod_jfas AND jtb_lott.id_lotto = jtb_lotr.id_lotto\n" +
" INNER JOIN dtb_ordt ON jtb_lotr.data_ord = dtb_ordt.data_ord AND jtb_lotr.gestione = dtb_ordt.gestione AND\n" +
" jtb_lotr.num_ord = dtb_ordt.num_ord\n" +
" INNER JOIN drl_ord_attached ON dtb_ordt.gestione = drl_ord_attached.gestione AND\n" +
" dtb_ordt.data_ord = drl_ord_attached.data_ord AND\n" +
" dtb_ordt.num_ord = drl_ord_attached.num_ord\n" +
" INNER JOIN stb_files_attached ON drl_ord_attached.id_attach = stb_files_attached.id_attach\n" +
"WHERE jtb_lott.cod_jfas = " + UtilityDB.valueToString(codJfas) + "\n" +
" AND jtb_lott.id_lotto = " + UtilityDB.valueToString(idLotto) + "";
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(),sql,AttachmentDTO.class);
}
}