modifiche a inventari, listini e contabilità
This commit is contained in:
@@ -34,8 +34,8 @@ public class Migration_20251113122313 extends BaseMigration implements Migration
|
||||
"\telse ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then 1\n" +
|
||||
"\telse ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113170159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE wdtb_doct ADD merce_ricevuta BIT DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -964,18 +964,16 @@ public class AccountingRules extends QueryRules {
|
||||
public static CtbMovt completeScadRitAcc(Connection conn, CtbRitAcc ctbRitAcc) throws Exception {
|
||||
String sql =
|
||||
"SELECT count(*) as count_partita " +
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat()) + " AND " +
|
||||
" ( ctb_part.dare_part = 0 or ctb_part.avere_part = 0 ) ";
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat());
|
||||
|
||||
Integer countPart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (countPart > 0) {
|
||||
|
||||
if (countPart <= 1) {
|
||||
CtbMovt ctbMovt = new CtbMovt();
|
||||
ctbMovt.setNumCmov(ctbRitAcc.getNumCmovFat());
|
||||
ctbMovt.setGeneraScad(ctbRitAcc.getGeneraScadenze());
|
||||
|
||||
@@ -10,6 +10,7 @@ import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.ListinoEnum;
|
||||
import it.integry.ems_model.entity.common.DtbBaseDocR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||
@@ -674,7 +675,11 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
if ("A".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocA(conn, ((DtbDocr) row));
|
||||
} else if ("L".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
if (testata.getListino().equalsIgnoreCase(ListinoEnum.COSTO_ULTIMO.getValue()) && !UtilityBigDecimal.isNullOrZero(row.getValUnt())) {
|
||||
costo = row.getValUnt();
|
||||
} else {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
}
|
||||
}
|
||||
((DtbDocr) row).setCostoUnt(costo);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.ems_model.entity._enum;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum ListinoEnum implements IBaseEnum<ListinoEnum> {
|
||||
COSTO_MEDIO("CMED")
|
||||
, DISTINTA("DIST"), COSTO_ULTIMO("ULTC");
|
||||
|
||||
private final String value;
|
||||
|
||||
ListinoEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ListinoEnum from(Object value) {
|
||||
String castValue = null;
|
||||
|
||||
if (value instanceof String)
|
||||
castValue = (String) value;
|
||||
|
||||
|
||||
for (ListinoEnum b : ListinoEnum.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListinoEnum fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ end
|
||||
rule "completeValUntDISTDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt = CommonRules.completeValUntDIST(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
@@ -46,7 +46,7 @@ end
|
||||
rule "completeValUntCMEDDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino ) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt= CommonRules.completeValUntCMED(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
|
||||
@@ -15,6 +15,7 @@ import it.integry.ems_model.entity.DtbDocr;
|
||||
import it.integry.ems_model.entity.DtbDoct;
|
||||
import it.integry.ems_model.entity.MtbInvenr;
|
||||
import it.integry.ems_model.entity.MtbInvent;
|
||||
import it.integry.ems_model.entity._enum.ListinoEnum;
|
||||
import it.integry.ems_model.resolver.SqlFieldHolder;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
@@ -956,7 +957,8 @@ public class InventarioService {
|
||||
" mtb_invent.data_ver, " +
|
||||
" DateAdd(dd, (case when flag_operazione = 0 then -1 else 0 end), mtb_invent.data_inventario) as data_reg, " +
|
||||
" mtb_depo.cod_anag, " +
|
||||
" mtb_depo.cod_vdes " +
|
||||
" mtb_depo.cod_vdes, " +
|
||||
" regola_calcolo_costo " +
|
||||
" FROM mtb_invent inner join mtb_depo on mtb_invent.cod_mdep = mtb_depo.cod_mdep ";
|
||||
query = UtilityDB.addwhereCond(query, whereCondInv, false);
|
||||
|
||||
@@ -968,6 +970,7 @@ public class InventarioService {
|
||||
Date dataRegMax = UtilityHashMap.getValueIfExists(datiInv, "data_reg");
|
||||
String codAnagDepo = UtilityHashMap.getValueIfExists(datiInv, "cod_anag");
|
||||
String codVdesDepo = UtilityHashMap.getValueIfExists(datiInv, "cod_vdes");
|
||||
String regolaCalcoloCosto = UtilityHashMap.getValueIfExists(datiInv, "regola_calcolo_costo");
|
||||
|
||||
Date dataDoc = UtilityDate.isNull(datiDoc.getDataDoc(), dataRegMax);
|
||||
|
||||
@@ -1002,6 +1005,19 @@ public class InventarioService {
|
||||
throw new Exception("Attenzione sono stati inseriti/modificati dei documenti dopo la verifica dell'inventario. Prima di registrare questo inventario rifare la verifica.");
|
||||
}
|
||||
|
||||
String listino = null;
|
||||
switch (regolaCalcoloCosto) {
|
||||
case "M":
|
||||
listino = ListinoEnum.COSTO_MEDIO.getValue();
|
||||
break;
|
||||
case "D":
|
||||
listino = ListinoEnum.DISTINTA.getValue();
|
||||
break;
|
||||
default:
|
||||
listino = ListinoEnum.COSTO_ULTIMO.getValue();
|
||||
break;
|
||||
}
|
||||
|
||||
DtbDoct dtbDoct = new DtbDoct()
|
||||
.setGestione(gestione)
|
||||
.setCodMdep(codMdep)
|
||||
@@ -1010,7 +1026,8 @@ public class InventarioService {
|
||||
.setCodVdes(codVdes)
|
||||
.setDataDoc(dataDoc)
|
||||
.setSerDoc(datiDoc.getSerDoc())
|
||||
.setDataReg(dataDoc);
|
||||
.setDataReg(dataDoc)
|
||||
.setListino(listino);
|
||||
dtbDoct.setOperation(OperationType.INSERT);
|
||||
dtbDoct.setDtbDocr(new ArrayList<>());
|
||||
|
||||
@@ -1074,7 +1091,7 @@ public class InventarioService {
|
||||
dtbDocr.setNumCnf(numConf);
|
||||
dtbDocr.setQtaCnf(qtaCnf);
|
||||
} else {
|
||||
dtbDocr.setLoadedFromDb(true);
|
||||
dtbDocr.setLoadedFromDb(true);
|
||||
}
|
||||
|
||||
if ("V".equals(gestione)) {
|
||||
|
||||
@@ -959,7 +959,13 @@ public class ListiniVenditaServices {
|
||||
if (UtilityDebug.isDebugExecution())
|
||||
email = "m.ruggiero@integry.it";
|
||||
|
||||
mailService.sendMail(email, null, subject, message, true);
|
||||
if (UtilityString.isNullOrEmpty(email)) {
|
||||
message = String.format("Nessuna email associata all'utente %s.",
|
||||
inseritoDa);
|
||||
anomalie.add(AnomalieDTO.warning(message));
|
||||
}
|
||||
else
|
||||
mailService.sendMail(email, null, subject, message, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package it.integry.ems.retail.dto;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
public class AnomalieResiDTO {
|
||||
private String codMart;
|
||||
private Date dataScad;
|
||||
private LocalDate dataScad;
|
||||
private String errorMessage;
|
||||
|
||||
public String getCodMart() {
|
||||
@@ -16,11 +17,11 @@ public class AnomalieResiDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
public LocalDate getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public AnomalieResiDTO setDataScad(Date dataScad) {
|
||||
public AnomalieResiDTO setDataScad(LocalDate dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user