varie modifiche per rossogarngano

This commit is contained in:
2025-02-07 17:26:15 +01:00
parent 02098b703d
commit 2c586a45f8
5 changed files with 81 additions and 3 deletions

View File

@@ -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_20250206135418 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateFunction("[chk_ArtCalcTotali]", "CREATE FUNCTION [dbo].[chk_ArtCalcTotali] (@codMart varchar(15) )\n" +
"RETURNS bit\n" +
"AS\n" +
"BEGIN \n" +
"\n" +
"/** Funzione di controllo per includere o meno gli articoli nel calcolo del netto merce, e nel conteggio di colli , confezioni o pedane del documento **/\n" +
"\n" +
" DECLARE @retVal bit\n" +
" SET @retVal = 1 ;\n" +
" \n" +
" SELECT @retVal = \n" +
" \n" +
" CASE when mtb_tcol.cod_tcol IS not null THEN 0 \n" +
" WHEN mtb_grup.tipo_mgrp IS NULL THEN \n" +
" CASE ctb_grup.sezione WHEN 1 THEN 0 ELSE 1 END /* sezione = 1 CONTO PATRIMONIALE */\n" +
" ELSE\n" +
" CASE WHEN mtb_grup.tipo_mgrp in ('SRV', 'ACS', 'FTT', 'ACC') THEN 0 ELSE 1 END \n" +
" END \n" +
" FROM mtb_aart LEFT OUTER JOIN ctb_cont ON mtb_aart.cod_ccon_ricavi = ctb_cont.cod_ccon\n" +
" LEFT OUTER JOIN ctb_grup ON ctb_cont.cod_cgrp = ctb_grup.cod_cgrp\n" +
" LEFT OUTER JOIN mtb_grup on mtb_aart.cod_mgrp = mtb_grup.cod_mgrp \n" +
" LEFT OUTER JOIN mtb_tcol On mtb_aart.cod_mart = mtb_tcol.cod_mart and mtb_tcol.flag_UI_UL = 'UL'\n" +
" WHERE mtb_aart.cod_mart = @codMart \n" +
"\n" +
" RETURN @retVal \n" +
"END");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -165,6 +165,15 @@ public class CommonRules extends QueryRules {
return username;
}
public static String getUserNameFromFullName(Connection connection, String fullName) throws Exception {
if ( !UtilityString.isNullOrEmpty(fullName)) {
String sql = Query.format("SELECT user_name FROM stb_user WHERE full_name = %s",
fullName);
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
}
return null;
}
public static List<WdtbOrdr> calcPercAliq(Connection conn, List<WdtbOrdr> list) throws Exception {
for (WdtbOrdr row : list) {
if (row.getPercAliq() == null && row.getCodAliq() != null)

View File

@@ -114,6 +114,15 @@ then
}
end
rule "completeCompilatoDaOffA"
when
eval(completeRulesEnabled)
$offt : AtbOfft (compilatoDa == null && (operation == OperationType.INSERT || operation == OperationType.INSERT_OR_UPDATE))
then
String fullName = CommonRules.getFullName(conn, username);
modify ( $offt ) { setCompilatoDa(fullName) }
end
rule "completeCodDiviOffForn"
no-loop
when

View File

@@ -243,8 +243,18 @@ when
then
String fullName = CommonRules.getFullName(conn, username);
modify ( $docT ) {
setCompilatoDa(fullName),
setUserName(username)
setCompilatoDa(fullName)
}
end
rule "completeUserNameDoc"
when
eval(completeRulesEnabled)
$docT : DtbDoct (userName == null && operation != OperationType.DELETE )
then
String userName = CommonRules.getUserNameFromFullName(conn, $docT.getCompilatoDa());
modify ( $docT ) {
setUserName((userName==null?username:userName))
}
end

View File

@@ -1302,7 +1302,10 @@ public class DocumentiAcquistoImportService {
.setCodVdes(codVdes);
for (FilconadrDTO filconadr : filconad.getFilconadr()) {
if (UtilityString.equalsIgnoreCase(filconadr.getCodArt(), "*")) continue;
if (UtilityString.equalsIgnoreCase(filconadr.getCodArt(), "*")) {
//Leggere il numero d'ordine dalla descrizione che ci inviano
continue;
}
sql = Query.format(
"SELECT CAST(COUNT(*) AS BIT)\n" +
"FROM mtb_lisa\n" +