Merge branch 'develop' into feature/Feature-RGIAC
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,6 +4,7 @@ import it.integry.ems.migration._base.BaseMigration;
|
|||||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
import it.integry.ems_model.entity.WtbJrept;
|
import it.integry.ems_model.entity.WtbJrept;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
|
import it.integry.ems_model.utility.UtilityList;
|
||||||
import net.sf.jasperreports.engine.JasperCompileManager;
|
import net.sf.jasperreports.engine.JasperCompileManager;
|
||||||
import net.sf.jasperreports.engine.JasperReport;
|
import net.sf.jasperreports.engine.JasperReport;
|
||||||
import net.sf.jasperreports.engine.util.JRSaver;
|
import net.sf.jasperreports.engine.util.JRSaver;
|
||||||
@@ -24,11 +25,16 @@ public class Migration_20241108153628 extends BaseMigration implements Migration
|
|||||||
|
|
||||||
String sql = "SELECT * FROM wtb_jrept";
|
String sql = "SELECT * FROM wtb_jrept";
|
||||||
final List<WtbJrept> wtbJrepts = executeQueryDTO(sql, WtbJrept.class);
|
final List<WtbJrept> wtbJrepts = executeQueryDTO(sql, WtbJrept.class);
|
||||||
|
if (UtilityList.isNullOrEmpty(wtbJrepts))
|
||||||
|
return;
|
||||||
|
|
||||||
for (WtbJrept w : wtbJrepts) {
|
for (WtbJrept w : wtbJrepts) {
|
||||||
byte[] jrxml = Base64.decodeBase64(w.getB64Jrxml());
|
byte[] jrxml = Base64.decodeBase64(w.getB64Jrxml());
|
||||||
|
if (jrxml == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
ByteArrayInputStream bais = new ByteArrayInputStream(jrxml);
|
ByteArrayInputStream bais = new ByteArrayInputStream(jrxml);
|
||||||
|
|
||||||
final JasperReport compiledReport = JasperCompileManager.compileReport(bais);
|
final JasperReport compiledReport = JasperCompileManager.compileReport(bais);
|
||||||
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241111125804 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
executeStatement("ALTER TABLE ctb_amac ADD note varchar(MAX)");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241112092604 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
createOrUpdateFunction("[suggestMtbArtEqui]", "CREATE FUNCTION [dbo].[suggestMtbArtEqui]\n" +
|
||||||
|
"( \n" +
|
||||||
|
" @jsonParm varchar(max)\n" +
|
||||||
|
")\n" +
|
||||||
|
"RETURNS TABLE \n" +
|
||||||
|
"AS\n" +
|
||||||
|
"RETURN \n" +
|
||||||
|
"\n" +
|
||||||
|
"(\n" +
|
||||||
|
"/*with tab_json as (\n" +
|
||||||
|
"select *\n" +
|
||||||
|
"from openJson(@jsonParm) \n" +
|
||||||
|
"WITH (\n" +
|
||||||
|
" cod_mgrp VARCHAR(5) '$.cod_mgrp',\n" +
|
||||||
|
" cod_msgr VARCHAR(5) '$.cod_msgr',\n" +
|
||||||
|
" cod_mtip VARCHAR(5) '$.cod_mtip',\n" +
|
||||||
|
" cod_mstp VARCHAR(5) '$.cod_mstp',\n" +
|
||||||
|
" cod_tcol_UI VARCHAR(100) '$.cod_tcol_UI',\n" +
|
||||||
|
" marchio VARCHAR(255) '$.marchio',\n" +
|
||||||
|
" qta_cnf FLOAT '$.qta_cnf',\n" +
|
||||||
|
" peso_kg FLOAT '$.peso_kg'\n" +
|
||||||
|
") )*/\n" +
|
||||||
|
" -- Add the SELECT statement with parameter references here\n" +
|
||||||
|
" SELECT CONVERT(varchar(25), null ) as id_art_equi, CONVERT(varchar(255), null ) as descrizione, 'N' as flag_equi_prezzo, 'N' as flag_equi_costo\n" +
|
||||||
|
" \n" +
|
||||||
|
")");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
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_20241112092826 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !isCustomer(IntegryCustomer.RossoGargano)) return;
|
||||||
|
|
||||||
|
createOrUpdateFunction("[suggestMtbArtEqui]", "CREATE FUNCTION [dbo].[suggestMtbArtEqui]\n" +
|
||||||
|
"( \n" +
|
||||||
|
" @jsonParm varchar(max)\n" +
|
||||||
|
")\n" +
|
||||||
|
"RETURNS TABLE \n" +
|
||||||
|
"AS\n" +
|
||||||
|
"RETURN \n" +
|
||||||
|
"(\n" +
|
||||||
|
" with tab_json as (\n" +
|
||||||
|
"select *\n" +
|
||||||
|
"from openJson(@jsonParm) \n" +
|
||||||
|
"WITH (\n" +
|
||||||
|
" cod_mgrp VARCHAR(5) '$.cod_mgrp',\n" +
|
||||||
|
" cod_msgr VARCHAR(5) '$.cod_msgr',\n" +
|
||||||
|
" cod_mtip VARCHAR(5) '$.cod_mtip',\n" +
|
||||||
|
" cod_mstp VARCHAR(5) '$.cod_mstp',\n" +
|
||||||
|
" cod_tcol_UI VARCHAR(100) '$.cod_tcol_UI',\n" +
|
||||||
|
" marchio VARCHAR(255) '$.marchio',\n" +
|
||||||
|
" qta_cnf FLOAT '$.qta_cnf',\n" +
|
||||||
|
" peso_kg FLOAT '$.peso_kg'\n" +
|
||||||
|
") )\n" +
|
||||||
|
",art as (\n" +
|
||||||
|
"SELECT distinct mtb_aart_equi.id_art_equi, IsNull(mtb_aart_equi.descrizione,\n" +
|
||||||
|
" CONCAT_WS(' ', mtb_tipi.descrizione, mtb_aart.cod_tcol_UI, CAST(mtb_aart.qta_cnf AS FLOAT), 'x',\n" +
|
||||||
|
" CAST(mtb_aart.peso_kg AS FLOAT), mtb_stip.descrizione, mtb_aart.marchio) ) as descrizione,\n" +
|
||||||
|
" IsNull(mtb_aart_equi.flag_equi_prezzo, 'T') as flag_equi_prezzo, IsNull(mtb_aart_equi.flag_equi_costo,'N') as flag_equi_costo \n" +
|
||||||
|
"FROM mtb_aart \n" +
|
||||||
|
"left outer join mtb_aart_equi on mtb_aart.id_art_equi = mtb_aart_equi.id_art_equi\n" +
|
||||||
|
"left outer join mtb_tipi on mtb_aart.cod_mtip = mtb_tipi.cod_mtip\n" +
|
||||||
|
"left outer join mtb_stip on mtb_aart.cod_mtip = mtb_stip.cod_mtip and mtb_aart.cod_mstp = mtb_stip.cod_mstp \n" +
|
||||||
|
"where exists (select *\n" +
|
||||||
|
"from tab_json where mtb_aart.cod_mgrp = tab_json.cod_mgrp and\n" +
|
||||||
|
"mtb_aart.cod_msgr = tab_json.cod_msgr and \n" +
|
||||||
|
"mtb_aart.qta_cnf = tab_json.qta_cnf and\n" +
|
||||||
|
"mtb_aart.peso_kg = tab_json.peso_kg and\n" +
|
||||||
|
"(IsNull(mtb_aart.marchio,'') = isNull(tab_json.marchio,'')) and\n" +
|
||||||
|
"(IsNull(mtb_aart.cod_mtip,'') = isNull(tab_json.cod_mtip,'')) and\n" +
|
||||||
|
"(IsNull(mtb_aart.cod_mstp, '') = isNull(tab_json.cod_mstp,'')) \n" +
|
||||||
|
"))\n" +
|
||||||
|
"\n" +
|
||||||
|
"select *\n" +
|
||||||
|
"from art \n" +
|
||||||
|
"union all\n" +
|
||||||
|
"select null as id_art_eqi, upper( CONCAT_WS(' ', mtb_tipi.descrizione, cod_tcol_UI, CAST(qta_cnf AS FLOAT), 'x',\n" +
|
||||||
|
" CAST(peso_kg AS FLOAT), mtb_stip.descrizione, marchio)), 'T' as flag_equi_prezzo, 'N' as flag_equi_costo \n" +
|
||||||
|
"from tab_json left outer join mtb_tipi on tab_json.cod_mtip = mtb_tipi.cod_mtip\n" +
|
||||||
|
"left outer join mtb_stip on tab_json.cod_mtip = mtb_stip.cod_mtip and tab_json.cod_mstp = mtb_stip.cod_mstp \n" +
|
||||||
|
"where exists(select * from tab_json)\n" +
|
||||||
|
")");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package it.integry.ems.rules.completing;
|
|||||||
import com.annimon.stream.ComparatorCompat;
|
import com.annimon.stream.ComparatorCompat;
|
||||||
import com.annimon.stream.Optional;
|
import com.annimon.stream.Optional;
|
||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems_model.annotation.ReloadRow;
|
import it.integry.ems_model.annotation.ReloadRow;
|
||||||
@@ -991,6 +992,38 @@ public class CommonRules extends QueryRules {
|
|||||||
return mtbAartMarchio;
|
return mtbAartMarchio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getIdArtEqui(Connection conn, MtbAart entity) throws Exception {
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put("cod_mgrp", entity.getCodMgrp());
|
||||||
|
data.put("cod_msgr", entity.getCodMsgr());
|
||||||
|
data.put("cod_mtip", entity.getCodMtip());
|
||||||
|
data.put("qta_cnf", entity.getQtaCnf());
|
||||||
|
data.put("peso_kg", entity.getPesoKg());
|
||||||
|
data.put("cod_tcol_UI",entity.getCodTcolUi());
|
||||||
|
data.put("marchio", entity.getMarchio());
|
||||||
|
|
||||||
|
// Convertire in JSON
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
String jsonParm = objectMapper.writeValueAsString(data).toLowerCase();
|
||||||
|
String sql =
|
||||||
|
String.format(
|
||||||
|
"SELECT * FROM dbo.suggestMtbArtEqui('%s') " ,
|
||||||
|
jsonParm);
|
||||||
|
MtbAartEqui mtbAartEqui = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(conn, sql, MtbAartEqui.class);
|
||||||
|
if (mtbAartEqui != null ) {
|
||||||
|
String idArtEqui =mtbAartEqui.getIdArtEqui();
|
||||||
|
if (UtilityString.isNullOrEmpty(mtbAartEqui.getIdArtEqui())) {
|
||||||
|
idArtEqui = entity.getCodMart();
|
||||||
|
mtbAartEqui.setIdArtEqui(idArtEqui)
|
||||||
|
.setFlagEquiPrezzo("T");
|
||||||
|
mtbAartEqui.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
|
}
|
||||||
|
return idArtEqui;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static MtbAartEqui insEqui(Connection conn, MtbAart entity) throws Exception {
|
public static MtbAartEqui insEqui(Connection conn, MtbAart entity) throws Exception {
|
||||||
String sql = "SELECT id_art_equi FROM mtb_aart_equi WHERE id_art_equi = " + UtilityDB.valueToString(entity.getIdArtEqui());
|
String sql = "SELECT id_art_equi FROM mtb_aart_equi WHERE id_art_equi = " + UtilityDB.valueToString(entity.getIdArtEqui());
|
||||||
HashMap<String, Object> map = execSingleQuery(conn, sql);
|
HashMap<String, Object> map = execSingleQuery(conn, sql);
|
||||||
|
|||||||
@@ -303,6 +303,8 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
|||||||
@SqlField(value = "tipo_codice_imballo", maxLength = 10)
|
@SqlField(value = "tipo_codice_imballo", maxLength = 10)
|
||||||
private String tipoCodiceImballo;
|
private String tipoCodiceImballo;
|
||||||
|
|
||||||
|
private Boolean setIdArtEqui;
|
||||||
|
|
||||||
@Priority(1)
|
@Priority(1)
|
||||||
private MtbAartMarchio mtbAartMarchio;
|
private MtbAartMarchio mtbAartMarchio;
|
||||||
|
|
||||||
@@ -1184,6 +1186,15 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getSetIdArtEqui() {
|
||||||
|
return setIdArtEqui;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbAart setSetIdArtEqui(Boolean setIdArtEqui) {
|
||||||
|
this.setIdArtEqui = setIdArtEqui;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<MtbAartAnag> getMtbAartAnag() {
|
public List<MtbAartAnag> getMtbAartAnag() {
|
||||||
return mtbAartAnag;
|
return mtbAartAnag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import it.integry.ems_model.types.OperationType
|
|||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.utility.UtilityFile
|
import it.integry.ems.utility.UtilityFile
|
||||||
import it.integry.ems.exception.CheckConstraintException
|
import it.integry.ems.exception.CheckConstraintException
|
||||||
|
import it.integry.ems_model.utility.UtilityDB
|
||||||
|
|
||||||
global Connection conn
|
global Connection conn
|
||||||
global String username
|
global String username
|
||||||
@@ -126,6 +127,18 @@ then
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rule "completeSetIdArtEquiAuto"
|
||||||
|
no-loop
|
||||||
|
when
|
||||||
|
eval(completeRulesEnabled)
|
||||||
|
$entity : MtbAart(idArtEqui == null && setIdArtEqui != null && setIdArtEqui && operation != OperationType.DELETE)
|
||||||
|
then
|
||||||
|
String idArtEqui = CommonRules.getIdArtEqui(conn, $entity);
|
||||||
|
modify($entity){
|
||||||
|
setIdArtEqui(idArtEqui)}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
rule "completeInsEqui"
|
rule "completeInsEqui"
|
||||||
no-loop
|
no-loop
|
||||||
when
|
when
|
||||||
@@ -190,6 +203,17 @@ then
|
|||||||
modify ( $entity ) { setArticoloComposto("N") }
|
modify ( $entity ) { setArticoloComposto("N") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rule "completeSetIdArtEqui"
|
||||||
|
no-loop
|
||||||
|
when
|
||||||
|
eval(completeRulesEnabled)
|
||||||
|
$entity : MtbAart(setIdArtEqui == null)
|
||||||
|
then
|
||||||
|
String sql = "select CAst( case when dbo.getGestSetup( 'MTB_AART', 'ID_ART_EQUI', 'INSERT_AUTO') = 'N' THEN 0 ELSE 1 END as BIT)";
|
||||||
|
Boolean setSetIdArtEqui = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||||
|
modify ( $entity ) { setSetIdArtEqui(setSetIdArtEqui) }
|
||||||
|
end
|
||||||
|
|
||||||
rule "completeDescrEstesaArt"
|
rule "completeDescrEstesaArt"
|
||||||
when
|
when
|
||||||
eval(completeRulesEnabled)
|
eval(completeRulesEnabled)
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ public class ExchangeFornitoriImportService {
|
|||||||
put("cod_anag", importedData.getCodAnag());
|
put("cod_anag", importedData.getCodAnag());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
exchangeImportDataManagerService.updateImportedStatus(connection, "gtb_anag_clienti", importedKey, useTempTable);
|
exchangeImportDataManagerService.updateImportedStatus(connection, "gtb_anag_fornitori", importedKey, useTempTable);
|
||||||
exchangeImportDataManagerService.updateImportedStatus(connection, "vtb_clie", importedKey, useTempTable);
|
exchangeImportDataManagerService.updateImportedStatus(connection, "atb_forn", importedKey, useTempTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user