protocolli
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:
@@ -995,5 +995,66 @@ public class DocumentRules extends QueryRules {
|
||||
|
||||
}
|
||||
|
||||
public static DtbDocp getDtbDocp(Connection conn, DtbDoct dtbDoct) throws Exception {
|
||||
if (dtbDoct.getDtbTipi().getFlagSetNumProt()) {
|
||||
String wherePK;
|
||||
if ((dtbDoct.getOperation() == OperationType.SUBSTITUTE || dtbDoct.getOperation() == OperationType.DELETE_THEN_INSERT) && dtbDoct.getOldPk() != null) {
|
||||
wherePK = dtbDoct.getWhereCondOldPk(DtbDocp.class);
|
||||
} else {
|
||||
wherePK = dtbDoct.getEntityHolder().getWherePK(dtbDoct);
|
||||
}
|
||||
|
||||
String sql =
|
||||
"SELECT num_prot FROM dtb_docp ";
|
||||
|
||||
sql = UtilityDB.addwhereCond(sql, wherePK, false);
|
||||
Integer numProt = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (numProt != null) {
|
||||
DtbDocp dtbDocp = new DtbDocp().setNumProt(numProt);
|
||||
return dtbDocp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static void setNumProtDoc(Connection conn, DtbDoct dtbDoct) throws Exception {
|
||||
if (dtbDoct.getDtbTipi().getFlagSetNumProt()) {
|
||||
String sql = "SELECT cast(count(*) as bit) FROM dtb_doct";
|
||||
String wherePK;
|
||||
if ((dtbDoct.getOperation() == OperationType.SUBSTITUTE || dtbDoct.getOperation() == OperationType.DELETE_THEN_INSERT) && dtbDoct.getOldPk() != null) {
|
||||
wherePK = dtbDoct.getWhereCondOldPk(DtbDocp.class);
|
||||
} else {
|
||||
wherePK = dtbDoct.getEntityHolder().getWherePK(dtbDoct);
|
||||
}
|
||||
sql = UtilityDB.addwhereCond(sql, wherePK, false);
|
||||
|
||||
Boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (!existDoc && dtbDoct.getDtbDocp() == null) {
|
||||
sql =
|
||||
Query.format(
|
||||
"SELECT cast(IsNull(max(num_prot), 0) + 1 as int) \n" +
|
||||
" FROM dtb_docp INNER JOIN dtb_doct ON dtb_doct.cod_anag = dtb_docp.cod_anag AND \n" +
|
||||
" dtb_doct.cod_dtip = dtb_docp.cod_dtip AND\n" +
|
||||
" dtb_doct.data_doc = dtb_docp.data_doc AND\n" +
|
||||
" dtb_doct.ser_doc = dtb_docp.ser_doc AND\n" +
|
||||
" dtb_doct.num_doc = dtb_docp.num_doc\n" +
|
||||
" WHERE cod_mdep = %s AND Year(dtb_doct.data_reg) = year(%s);\n",
|
||||
dtbDoct.getCodMdep(), dtbDoct.getDataReg());
|
||||
|
||||
Integer numProt = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
DtbDocp dtbDocp = new DtbDocp()
|
||||
.setCodAnag(dtbDoct.getCodAnag())
|
||||
.setCodDtip(dtbDoct.getCodDtip())
|
||||
.setDataDoc(dtbDoct.getDataDoc())
|
||||
.setSerDoc(dtbDoct.getSerDoc())
|
||||
.setNumDoc(dtbDoct.getNumDoc())
|
||||
.setNumProt(numProt);
|
||||
dtbDocp.setOperation(OperationType.INSERT);
|
||||
dtbDoct.setDtbDocp(dtbDocp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Master()
|
||||
@PropertyReactive()
|
||||
@Table(value = DtbDocp.ENTITY)
|
||||
@JsonTypeName(value = DtbDocp.ENTITY)
|
||||
|
||||
@@ -390,6 +390,9 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
||||
@EntityChild
|
||||
private List<DtbDocCarat> dtbDocCarat = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private DtbDocp dtbDocp;
|
||||
|
||||
private List<CtbScad> ctbScad;
|
||||
|
||||
@Priority(value = 101, copyPk = false)
|
||||
@@ -1457,6 +1460,15 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
||||
return this;
|
||||
}
|
||||
|
||||
public DtbDocp getDtbDocp() {
|
||||
return dtbDocp;
|
||||
}
|
||||
|
||||
public DtbDoct setDtbDocp(DtbDocp dtbDocp) {
|
||||
this.dtbDocp = dtbDocp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<DtbDocImb> getDtbDocImb() {
|
||||
return dtbDocImb;
|
||||
}
|
||||
@@ -1626,6 +1638,9 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dtbDocp != null) {
|
||||
dtbDocp.manageWithParentConnection(connection, dtbDocp.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1661,6 +1676,8 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
||||
dtbDocs.deleteAllEntities(connection, this);
|
||||
DtbDocImb dtbDocImb = new DtbDocImb();
|
||||
dtbDocImb.deleteAllEntities(connection, this);
|
||||
DtbDocp dtbDocp = new DtbDocp();
|
||||
dtbDocp.deleteAllEntities(connection, this);
|
||||
DtbDocCarat dtbDocCarat = new DtbDocCarat();
|
||||
dtbDocCarat.deleteAllEntities(connection, this);
|
||||
DrlDocAttached drlDocAttached = new DrlDocAttached();
|
||||
@@ -1674,7 +1691,6 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
||||
connection.createStatement().executeUpdate(sql);
|
||||
sql = "UPDATE mtb_colt SET cod_anag = null, cod_dtip = null, data_doc = null, ser_doc = null, num_doc = null ";
|
||||
sql = UtilityDB.addwhereCond(sql, this.getWhereCondOldPk(null), false);
|
||||
connection.createStatement().executeUpdate(sql);
|
||||
|
||||
if ("S".equalsIgnoreCase(getGeneraMovCont())) {
|
||||
if (getWhereCond() == null) {
|
||||
|
||||
@@ -557,6 +557,14 @@ then
|
||||
modify ( $dTip ) { setAggiornaList("N") }
|
||||
end
|
||||
|
||||
rule "completeFlagSetNumProtDtbTipi"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$dTip : DtbTipi((gestione != "A" || codCcau != null) && flagSetNumProt == "S")
|
||||
then
|
||||
modify ( $dTip ) { setFlagSetNumProt(false) }
|
||||
end
|
||||
|
||||
rule "completeDtbInum"
|
||||
no-loop
|
||||
when
|
||||
@@ -567,7 +575,16 @@ then
|
||||
modify ( $docT ) { setDtbInum(dtbInum) }
|
||||
end
|
||||
|
||||
|
||||
rule "completeDtbDocp"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docT : DtbDoct(operation != OperationType.DELETE && dtbDocp == null && codAnag != null && codDtip != null &&
|
||||
dataDoc != null && serDoc != null && numDoc != null)
|
||||
then
|
||||
DtbDocp dtbDocp = DocumentRules.getDtbDocp(conn, $docT);
|
||||
modify ( $docT ) { setDtbDocp(dtbDocp) }
|
||||
end
|
||||
|
||||
|
||||
//DOCUMENTI WEB
|
||||
|
||||
@@ -73,6 +73,7 @@ when
|
||||
$testata: DtbDoct(executeRecalc == true)
|
||||
then
|
||||
CommonRules.reloadRow(conn, $testata);
|
||||
DocumentRules.setNumProtDoc(conn, $testata);
|
||||
DocOrdCalTotaliRules.calcTotali(conn, $testata);
|
||||
if (UtilityString.equalsIgnoreCase($testata.getGeneraMovCont(),"S")) {
|
||||
DocumentBusinessLogic.regMovContDoc(conn, $testata);
|
||||
|
||||
Reference in New Issue
Block a user