Merge branch 'develop' into feature/RefactoringGestioneColli
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,28 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250620165009 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("INSERT INTO dtb_mod_stampa (mod_stampa, descrizione, flag_attivo)" +
|
||||
"VALUES ('ORDP', 'Ordine di Produzione', 'S'), ('ORDCT', 'Ordine Conto Terzista', 'S')");
|
||||
|
||||
if(isCustomer(IntegryCustomer.Fiume)) {
|
||||
executeStatement("UPDATE dtb_mod_stampa SET report_id = 9 WHERE mod_stampa = 'ORDCT'");
|
||||
}
|
||||
if(isCustomer(IntegryCustomer.Gramm)) {
|
||||
executeStatement("UPDATE dtb_mod_stampa SET report_id = 100 WHERE mod_stampa = 'ORDCT'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250620180720 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI", "CARICO_SCARICO_DA_FABB", "GENERA_CARICO_PROD_PADRE", "S",
|
||||
"Se impostato a SE la procedura non genera il documento di carico del prodotto finito/lotto ma solo il giroconto del prodotto/matricola", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,8 +23,8 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
public static String completeCodBene(Connection conn, CtbBeni ctbBeni) throws SQLException {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT dbo.f_suggestCodeCodBene(%s)", ctbBeni.getCodCatbene());
|
||||
Query.format(
|
||||
"SELECT dbo.f_suggestCodeCodBene(%s)", ctbBeni.getCodCatbene());
|
||||
|
||||
String codBene = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
@@ -34,8 +34,8 @@ public class AccountingRules extends QueryRules {
|
||||
sql =
|
||||
Query.format(
|
||||
"SELECT ISNULL( max(cast(right(cod_bene, [LUNGHEZZA] ) as int)) ,0)\n" +
|
||||
" FROM ctb_beni\n" +
|
||||
" WHERE cod_bene like %S AND ISNUMERIC(right(cod_bene, [LUNGHEZZA])) = 1", partialCode);
|
||||
" FROM ctb_beni\n" +
|
||||
" WHERE cod_bene like %S AND ISNUMERIC(right(cod_bene, [LUNGHEZZA])) = 1", partialCode);
|
||||
sql = sql.replace("[LUNGHEZZA]", UtilityDB.valueToString(len));
|
||||
Integer maxCode = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
codBene = ctbBeni.getCodCatbene() + String.format("%0" + len + "d", maxCode + 1);
|
||||
@@ -523,8 +523,8 @@ public class AccountingRules extends QueryRules {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT * " +
|
||||
" FROM ctb_parr " +
|
||||
" WHERE num_cmov = %S AND " +
|
||||
" FROM ctb_parr " +
|
||||
" WHERE num_cmov = %S AND " +
|
||||
"anno_part = %S AND " +
|
||||
"ser_doc = %S AND " +
|
||||
"num_doc = %S AND " +
|
||||
@@ -664,15 +664,15 @@ public class AccountingRules extends QueryRules {
|
||||
} else {
|
||||
sql =
|
||||
Query.format(
|
||||
"SELECT cast(case when count(*) > 1 THEN 1 ELSE 0 eND as bit) " +
|
||||
" FROM ctb_parr " +
|
||||
" WHERE cod_anag = %s AND " +
|
||||
"tipo_anag = %s AND " +
|
||||
"anno_part = %s AND " +
|
||||
"ser_doc = %s AND " +
|
||||
"num_doc = %s AND " +
|
||||
"id_riga = %s ",
|
||||
ctbMovr.getCodAnag(), ctbMovr.getTipoAnag(), ctbMovr.getAnnoPart(), ctbMovr.getSerDoc(), ctbMovr.getNumDoc(), ctbMovr.getIdRiga());
|
||||
"SELECT cast(case when count(*) > 1 THEN 1 ELSE 0 eND as bit) " +
|
||||
" FROM ctb_parr " +
|
||||
" WHERE cod_anag = %s AND " +
|
||||
"tipo_anag = %s AND " +
|
||||
"anno_part = %s AND " +
|
||||
"ser_doc = %s AND " +
|
||||
"num_doc = %s AND " +
|
||||
"id_riga = %s ",
|
||||
ctbMovr.getCodAnag(), ctbMovr.getTipoAnag(), ctbMovr.getAnnoPart(), ctbMovr.getSerDoc(), ctbMovr.getNumDoc(), ctbMovr.getIdRiga());
|
||||
|
||||
boolean existRow = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
@@ -855,6 +855,17 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
}
|
||||
|
||||
public static void completeCtbScadCtbPart(Connection conn, CtbPart ctbPart) throws Exception {
|
||||
String sql = Query.format("SELECT descrizione FROM gtb_paga WHERE cod_paga = %s",
|
||||
ctbPart.getCodPaga());
|
||||
String descizione = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
ctbPart.getCtbScad()
|
||||
.stream()
|
||||
.filter(x -> x.getCodPaga() == null)
|
||||
.forEach(x ->
|
||||
x.setCodPaga(ctbPart.getCodPaga()).setDescrizPag(descizione));
|
||||
}
|
||||
|
||||
public static Date completeDataRicezione(Connection connection, CtbMovt ctbMovt) throws Exception {
|
||||
Date dataRicezione = null;
|
||||
String idAttach = ctbMovt.getCrlMovAttached().get(0).getIdAttach();
|
||||
@@ -1038,19 +1049,19 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
public static Boolean completeVentilazione(Connection connection, CtbMovi ctbMovi) throws SQLException {
|
||||
boolean ventilazione;
|
||||
if ( ctbMovi.getParent() instanceof CtbMovt) {
|
||||
if (ctbMovi.getParent() instanceof CtbMovt) {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT CAST(IIF((registro.segno_liquid = -1 AND flag_iva_acq_merci = 'S') OR ( registro.segno_liquid = 1 AND flag_iva_da_ventilare = 'S'), 1, 0) AS BIT)\n" +
|
||||
"FROM gtb_aliq,\n" +
|
||||
" (SELECT segno_liquid FROM ctb_ireg WHERE cod_ireg = %s) registro \n" +
|
||||
"WHERE cod_aliq = %s",
|
||||
"SELECT CAST(IIF((registro.segno_liquid = -1 AND flag_iva_acq_merci = 'S') OR ( registro.segno_liquid = 1 AND flag_iva_da_ventilare = 'S'), 1, 0) AS BIT)\n" +
|
||||
"FROM gtb_aliq,\n" +
|
||||
" (SELECT segno_liquid FROM ctb_ireg WHERE cod_ireg = %s) registro \n" +
|
||||
"WHERE cod_aliq = %s",
|
||||
((CtbMovt) ctbMovi.getParent()).getCodIreg(),
|
||||
ctbMovi.getCodAliq());
|
||||
|
||||
ventilazione = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
} else {
|
||||
ventilazione = ctbMovi.getVentilazione()==null?false:ctbMovi.getVentilazione();
|
||||
ventilazione = ctbMovi.getVentilazione() == null ? false : ctbMovi.getVentilazione();
|
||||
}
|
||||
return ventilazione;
|
||||
}
|
||||
|
||||
@@ -131,6 +131,15 @@ then
|
||||
AccountingRules.completeIdRigaScad(conn, $ctbScad);
|
||||
end
|
||||
|
||||
rule "completeCtbPart"
|
||||
no-loop
|
||||
when
|
||||
eval(postRulesEnabled)
|
||||
$ctbPart: CtbPart( codPaga != null && ctbScad.size() > 0)
|
||||
then
|
||||
AccountingRules.completeCtbScadCtbPart(conn, $ctbPart);
|
||||
end
|
||||
|
||||
|
||||
rule "completeRigaMtbColr"
|
||||
no-loop
|
||||
|
||||
@@ -80,12 +80,6 @@ public class ScadenzeImportService {
|
||||
String diacod = line.substring(92, 108).trim();
|
||||
Integer numDoc = UtilityString.isIntNumber(line.substring(185, 197).trim()) ? UtilityInteger.stringToInteger(line.substring(185, 197).trim()) : null;
|
||||
String intercode = line.substring(197, 223);
|
||||
sql = Query.format(
|
||||
"SELECT CAST(COUNT(*) AS BIT) AS exist FROM gtb_paga WHERE cod_paga = %s",
|
||||
codPaga
|
||||
);
|
||||
codPaga = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql) ? codPaga : null;
|
||||
|
||||
sql = Query.format(
|
||||
"SELECT cod_anag FROM gtb_anag WHERE diacod = %s",
|
||||
diacod
|
||||
@@ -218,7 +212,6 @@ public class ScadenzeImportService {
|
||||
ctbScad.setDataScad(dataScad)
|
||||
.setImpAvere(impAvere)
|
||||
.setImpDare(impDare)
|
||||
.setCodPaga(codPaga)
|
||||
.setIntercode(intercode)
|
||||
.setOperation(OperationType.INSERT);
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ public class DocumentiProdDaFabb {
|
||||
String codiceManodopera = setupGest.getImportSetup(connect, type, format, "CODICE_MANODOPERA'");
|
||||
String codDtipCarGiroc = setupGest.getImportSetup(connect, type, format, "COD_DTIP_CAR_GIROC");
|
||||
String codDtipScarGiroc = setupGest.getImportSetup(connect, type, format, "COD_DTIP_SCAR_GIROC");
|
||||
String generaCaricProdPadre = setupGest.getImportSetup(connect, type, format, "GENERA_CARICO_PROD_PADRE");
|
||||
|
||||
if (!ordini.isEmpty()) {
|
||||
chiudiCommessa = ordini.get(0).getChiudiCommessa();
|
||||
@@ -379,30 +380,32 @@ public class DocumentiProdDaFabb {
|
||||
|
||||
if (index == 1) {
|
||||
// Creazione testata documento di carico
|
||||
docCar = new DtbDoct();
|
||||
docCar.setOperation(OperationType.INSERT);
|
||||
docCar.setCodDtip(codDtipCar);
|
||||
docCar.setCodAnag(codAnag);
|
||||
docCar.setDataDoc(dataDoc);
|
||||
docCar.setCodMdep(codMdep);
|
||||
docCar.setCodJcom(codJcom);
|
||||
docCar.setDataOrd(riga.getDataOrd());
|
||||
docCar.setNumOrd(riga.getNumOrd());
|
||||
entityList.add(docCar);
|
||||
if (generaCaricProdPadre.equals("S")){
|
||||
docCar = new DtbDoct();
|
||||
docCar.setOperation(OperationType.INSERT);
|
||||
docCar.setCodDtip(codDtipCar);
|
||||
docCar.setCodAnag(codAnag);
|
||||
docCar.setDataDoc(dataDoc);
|
||||
docCar.setCodMdep(codMdep);
|
||||
docCar.setCodJcom(codJcom);
|
||||
docCar.setDataOrd(riga.getDataOrd());
|
||||
docCar.setNumOrd(riga.getNumOrd());
|
||||
entityList.add(docCar);
|
||||
|
||||
// Creazione riga documento carico
|
||||
DtbDocr docRCar = new DtbDocr();
|
||||
docRCar.setCodMart(codProd);
|
||||
docRCar.setPartitaMag(partitaMagProd);
|
||||
docRCar.setUntDoc(untMisProd);
|
||||
docRCar.setQtaDoc(qtaProd);
|
||||
docRCar.setRapConv(rapConvProd);
|
||||
docRCar.setCodJcom(codJcom);
|
||||
docRCar.setDataOrd(riga.getDataOrd());
|
||||
docRCar.setNumOrd(riga.getNumOrd());
|
||||
docRCar.setRigaOrd(0);
|
||||
docRCar.setMatricola(riga.getMatricola());
|
||||
docCar.getDtbDocr().add(docRCar);
|
||||
// Creazione riga documento carico
|
||||
DtbDocr docRCar = new DtbDocr();
|
||||
docRCar.setCodMart(codProd);
|
||||
docRCar.setPartitaMag(partitaMagProd);
|
||||
docRCar.setUntDoc(untMisProd);
|
||||
docRCar.setQtaDoc(qtaProd);
|
||||
docRCar.setRapConv(rapConvProd);
|
||||
docRCar.setCodJcom(codJcom);
|
||||
docRCar.setDataOrd(riga.getDataOrd());
|
||||
docRCar.setNumOrd(riga.getNumOrd());
|
||||
docRCar.setRigaOrd(0);
|
||||
docRCar.setMatricola(riga.getMatricola());
|
||||
docCar.getDtbDocr().add(docRCar);
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Gestione giroconto
|
||||
|
||||
Reference in New Issue
Block a user