Merge remote-tracking branch 'origin/develop' into develop
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:
@@ -0,0 +1,32 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251201180420 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
String value = null;
|
||||
|
||||
if (isCustomerDb(IntegryCustomerDB.RossoGargano_RossoGargano)) {
|
||||
value = "01";
|
||||
}
|
||||
|
||||
createSetupQuery("COD_MDEP", "COD_MDEP", "SELECT COD_MDEP FROM MTB_DEPO ORDER BY 1");
|
||||
createSetup("PVM", "MACCHINARI_PROD", "DEPOSITO_RICAMBI", value,
|
||||
"Deposito sulla quale ci sono i ricambi, usato durante la creazione di ordini di lavoro delle manutenzioni",
|
||||
false, "COD_MDEP", false, false, false,
|
||||
false, false, null, false, "SELECT COD_MDEP FROM MTB_DEPO ORDER BY 1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,17 +2,19 @@ package it.integry.ems.machine.service;
|
||||
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.machine.dto.CreateManutenzioneRequestDTO;
|
||||
import it.integry.ems.production.service.ProductionService;
|
||||
import it.integry.ems.service.AziendaService;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.GestSetupNotFoundException;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -34,14 +36,21 @@ public class MachineService {
|
||||
|
||||
@Autowired
|
||||
private AziendaService aziendaService;
|
||||
|
||||
@Autowired
|
||||
private ProductionService productionService;
|
||||
private SetupGest setupGest;
|
||||
|
||||
public CtbAmac createManutenzione(CreateManutenzioneRequestDTO dto) throws Exception {
|
||||
if (!dto.isValid()) {
|
||||
throw new MissingDataException("Dto incompleto");
|
||||
}
|
||||
|
||||
String codMdepRicambi = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "PVM", "MACCHINARI_PROD", "DEPOSITO_RICAMBI");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(codMdepRicambi)) {
|
||||
throw new GestSetupNotFoundException("PVM", "MACCHINARI_PROD", "DEPOSITO_RICAMBI");
|
||||
}
|
||||
|
||||
try {
|
||||
CtbAmacManutenzioni ctbAmacManutenzioni = new CtbAmacManutenzioni()
|
||||
.setDescrizione(dto.getDescrizione())
|
||||
@@ -150,68 +159,5 @@ public class MachineService {
|
||||
} finally {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
}
|
||||
|
||||
//$id = array_get($data, "id");
|
||||
// $codCmac = array_get($data, "codCmac");
|
||||
//
|
||||
// $ctbAmac = new EntityItem("ctb_amac");
|
||||
// $ctbAmac
|
||||
// ->no_op()
|
||||
// ->set("codCmac", $codCmac);
|
||||
//
|
||||
// $ctbAmacManutenzioni = new EntityItem("ctb_amac_manutenzioni");
|
||||
// $ctbAmacManutenzioni
|
||||
// ->set("descrizione", $data["descrizione"])
|
||||
// ->setDate("dataManutenzione", $data["dataManutenzione"])
|
||||
// ->setDatetime("dataIniz", $data["dataIniz"])
|
||||
// ->setDatetime("dataFine", $data["dataFine"])
|
||||
// ->set("stato", $data["stato"])
|
||||
// ->set("esito", $data["esito"])
|
||||
// ->set("oreLavoro", $data["oreLavoro"])
|
||||
// ->set("esitoPositivo", array_get($data, "esito_positivo") == "1" ? 1 : 0)
|
||||
// ->set("manutenzioneOrdinaria", array_get($data, "manutenzione_ordinaria") == "1" ? 1 : 0)
|
||||
// ->set("nomeSquadra", $data["nomeSquadra"]);
|
||||
//
|
||||
// if ($id) {
|
||||
// $ctbAmacManutenzioni
|
||||
// ->update()
|
||||
// ->set("id", $id);
|
||||
// } else {
|
||||
// $ctbAmacManutenzioni
|
||||
// ->insert()
|
||||
// ->setDate("dataInserimento", Date::getToday());
|
||||
// }
|
||||
//
|
||||
// $ctbAmac->onlyPkMaster(false)->set("ctbAmacManutenzioni")->append($ctbAmacManutenzioni);
|
||||
//
|
||||
// $ret = $ctbAmac->send();
|
||||
// if ($ret->is_KO()) {
|
||||
// return $ret;
|
||||
// }
|
||||
//
|
||||
// $uploads = $_FILES;
|
||||
//
|
||||
// if (empty($uploads)) {
|
||||
// return $ret;
|
||||
// }
|
||||
//
|
||||
// $resultMac = $ret->get_entity();
|
||||
// $manutenzione = $resultMac["ctbAmacManutenzioni"][0];
|
||||
// foreach ($uploads as $file) {
|
||||
// $filePath = $file["tmp_name"];
|
||||
// if (file_exists($filePath)) {
|
||||
// $crlAmacManutenzioniFiles = new \EntityItem("crl_amac_manutenzioni_files");
|
||||
//
|
||||
// $crlAmacManutenzioniFiles
|
||||
// ->insert()
|
||||
// ->set("idManutenzione", array_get($manutenzione, "id"));
|
||||
//
|
||||
// $ret = Allegati\StbFilesAttached::upload($file, $crlAmacManutenzioniFiles);
|
||||
// if ($ret->is_KO()) {
|
||||
// return $ret;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user