sportata regola

This commit is contained in:
2024-11-21 15:18:13 +01:00
parent 8feec59927
commit 2f8a9ed786
4 changed files with 11 additions and 52 deletions

View File

@@ -221,8 +221,7 @@ public class CommonRules extends QueryRules {
return finalList; return finalList;
} }
public static void updateDescrDistintaBase(Connection conn, EntityBase entityBase) throws Exception { public static void updateDescrDistintaBase(Connection conn, MtbAart mtbAart) throws Exception {
MtbAart mtbAart = (MtbAart) entityBase;
String sql = String sql =
"SELECT descrizione, descrizione_estesa " + "SELECT descrizione, descrizione_estesa " +
" FROM mtb_aart " + " FROM mtb_aart " +
@@ -995,7 +994,11 @@ public class CommonRules extends QueryRules {
return mtbAartMarchio; return mtbAartMarchio;
} }
public static String getIdArtEqui(Connection conn, MtbAart entity) throws Exception { public static void setIdArtEqui(Connection conn, MtbAart entity) throws Exception {
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);
if ( !setSetIdArtEqui ) return;
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("cod_mgrp", entity.getCodMgrp()); data.put("cod_mgrp", entity.getCodMgrp());
data.put("cod_msgr", entity.getCodMsgr()); data.put("cod_msgr", entity.getCodMsgr());
@@ -1008,7 +1011,7 @@ public class CommonRules extends QueryRules {
// Convertire in JSON // Convertire in JSON
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
String jsonParm = objectMapper.writeValueAsString(data); String jsonParm = objectMapper.writeValueAsString(data);
String sql = sql =
String.format( String.format(
"SELECT * FROM dbo.suggestMtbArtEqui('%s') " , "SELECT * FROM dbo.suggestMtbArtEqui('%s') " ,
jsonParm); jsonParm);
@@ -1021,10 +1024,8 @@ public class CommonRules extends QueryRules {
.setFlagEquiPrezzo("T"); .setFlagEquiPrezzo("T");
mtbAartEqui.setOperation(OperationType.INSERT_OR_UPDATE); mtbAartEqui.setOperation(OperationType.INSERT_OR_UPDATE);
} }
return idArtEqui; entity.setIdArtEqui(idArtEqui);
} }
return null;
} }
public static MtbAartEqui insEqui(Connection conn, MtbAart entity) throws Exception { public static MtbAartEqui insEqui(Connection conn, MtbAart entity) throws Exception {

View File

@@ -303,8 +303,6 @@ 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;
@@ -1170,13 +1168,6 @@ public class MtbAart extends EntityBase implements EquatableEntityInterface<MtbA
this.classificazioneAbc = classificazioneAbc; this.classificazioneAbc = classificazioneAbc;
} }
/*public List<MtbPart> getMtbPart() {
return mtbPart;
}
public void setMtbPart(List<MtbPart> mtbPart) {
this.mtbPart = mtbPart;
}*/
public String getTipoCodiceImballo() { public String getTipoCodiceImballo() {
return tipoCodiceImballo; return tipoCodiceImballo;
} }
@@ -1186,15 +1177,6 @@ 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;
} }

View File

@@ -127,18 +127,6 @@ 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
@@ -203,17 +191,6 @@ 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)

View File

@@ -105,10 +105,9 @@ no-loop
when when
eval(postRulesEnabled) eval(postRulesEnabled)
$mtbAart: MtbAart() $mtbAart: MtbAart()
$entity : EntityBase() from $mtbAart then
then CommonRules.setIdArtEqui(conn, $mtbAart);
CommonRules.updateDescrDistintaBase(conn, $mtbAart);
CommonRules.updateDescrDistintaBase(conn, $entity);
end end
rule "completeIdRigaCtbScad" rule "completeIdRigaCtbScad"