Merge branch 'develop' into feature/Consegna
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250224114817 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (existsTable("apuliac_agg_prz_csv") && !existColumn("apuliac_agg_prz_csv", "altro")){
|
||||||
|
executeStatement("alter table apuliac_agg_prz_csv add altro varchar(max)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
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_20250224145759 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup("PVM","MONITORAGGIO_LINEE_V2","REIMPOSTA_LOTTO_ORDINE_RIPIANIFICATO","N","Se impostato sul deposito di destinazione dell'ordine ripianificato ne azzera il lotto in testata costringendo alla reimpostazione dello stesso prima dell'avvio dell'ordine",false,"SI_NO",false,true,false,false,false,null,false);
|
||||||
|
if (isCustomer(IntegryCustomer.Gramm))
|
||||||
|
executeStatement("INSERT INTO stb_gest_setup_depo VALUES ('01',\t'PVM',\t'MONITORAGGIO_LINEE_V2',\t'REIMPOSTA_LOTTO_ORDINE_RIPIANIFICATO',\t'S',\t'N');");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20250224165212 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createOrUpdateFunction("getEffettiCliente",
|
||||||
|
"CREATE FUNCTION [dbo].[getEffettiCliente](\n" +
|
||||||
|
" @codAnag varchar(5), @viewAllDist varchar(1)\n" +
|
||||||
|
")\n" +
|
||||||
|
" RETURNS TABLE as\n" +
|
||||||
|
" return(SELECT ctb_scad.cod_anag,\n" +
|
||||||
|
" ctb_scad.data_scad,\n" +
|
||||||
|
" case\n" +
|
||||||
|
" when DateAdd(day, -2, ctb_scad.data_scad) <= Cast(getDate() as date) THEN 'R'\n" +
|
||||||
|
" ELSE 'S' END as tipo_scad_effetto,\n" +
|
||||||
|
" (ctb_scad.imp_dare * ctb_part.tipo_partita - (1 - ctb_part.tipo_partita) *\n" +
|
||||||
|
" ctb_scad.imp_avere) AS Importo,\n" +
|
||||||
|
" gtb_paga.tipo_paga,\n" +
|
||||||
|
" ctb_scad.data_doc,\n" +
|
||||||
|
" ctb_scad.ser_doc,\n" +
|
||||||
|
" ctb_scad.num_doc\n" +
|
||||||
|
" FROM ctb_scad\n" +
|
||||||
|
" inner join vtb_riba on ctb_scad.tipo_anag = vtb_riba.tipo_anag AND\n" +
|
||||||
|
" ctb_scad.cod_anag = vtb_riba.cod_anag AND\n" +
|
||||||
|
" ctb_scad.data_doc = vtb_riba.data_doc AND\n" +
|
||||||
|
" ctb_scad.ser_doc = vtb_riba.ser_doc AND\n" +
|
||||||
|
" ctb_scad.num_doc = vtb_riba.num_doc AND\n" +
|
||||||
|
" ctb_scad.id_riga = vtb_riba.num_scad\n" +
|
||||||
|
" inner join ctb_part on ctb_scad.tipo_anag = ctb_part.tipo_anag AND\n" +
|
||||||
|
" ctb_scad.cod_anag = ctb_part.cod_anag AND\n" +
|
||||||
|
" ctb_scad.data_doc = ctb_part.data_doc AND\n" +
|
||||||
|
" ctb_scad.ser_doc = ctb_part.ser_doc AND\n" +
|
||||||
|
" ctb_scad.num_doc = ctb_part.num_doc\n" +
|
||||||
|
" inner join vtb_dist on vtb_dist.rif_dist = vtb_riba.rif_dist AND\n" +
|
||||||
|
" vtb_dist.data_dist = vtb_riba.data_dist\n" +
|
||||||
|
" inner join gtb_paga on ctb_scad.cod_paga = gtb_paga.cod_paga\n" +
|
||||||
|
" WHERE ctb_scad.cod_anag = @codAnag\n" +
|
||||||
|
" AND ctb_scad.data_pag is not null\n" +
|
||||||
|
" AND DateAdd(day, 5, ctb_scad.data_scad) > Cast(getDate() as date)\n" +
|
||||||
|
" AND (@viewAllDist = 'S' or vtb_dist.num_cmov is not null))");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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_20250225115502 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||||
|
createSetup("W_CMOD_UNICO_RC", "SETUP", "ESCLUDI_FORFETTARI", "S",
|
||||||
|
null, false, "SI_NO", false, false,
|
||||||
|
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -61,100 +61,90 @@ public class CtbIreg extends EntityBase {
|
|||||||
return codIreg;
|
return codIreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodIreg(String codIreg) {
|
public CtbIreg setCodIreg(String codIreg) {
|
||||||
this.codIreg = codIreg;
|
this.codIreg = codIreg;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescrizione() {
|
public String getDescrizione() {
|
||||||
return descrizione;
|
return descrizione;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescrizione(String descrizione) {
|
public CtbIreg setDescrizione(String descrizione) {
|
||||||
this.descrizione = descrizione;
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlagScorporo() {
|
public String getFlagScorporo() {
|
||||||
return flagScorporo;
|
return flagScorporo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlagScorporo(String flagScorporo) {
|
public CtbIreg setFlagScorporo(String flagScorporo) {
|
||||||
this.flagScorporo = flagScorporo;
|
this.flagScorporo = flagScorporo;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTipoNumerazione() {
|
public String getTipoNumerazione() {
|
||||||
return tipoNumerazione;
|
return tipoNumerazione;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTipoNumerazione(String tipoNumerazione) {
|
public CtbIreg setTipoNumerazione(String tipoNumerazione) {
|
||||||
this.tipoNumerazione = tipoNumerazione;
|
this.tipoNumerazione = tipoNumerazione;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSegnoLiquid() {
|
public BigDecimal getSegnoLiquid() {
|
||||||
return segnoLiquid;
|
return segnoLiquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSegnoLiquid(BigDecimal segnoLiquid) {
|
public CtbIreg setSegnoLiquid(BigDecimal segnoLiquid) {
|
||||||
this.segnoLiquid = segnoLiquid;
|
this.segnoLiquid = segnoLiquid;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlagIva() {
|
public String getFlagIva() {
|
||||||
return flagIva;
|
return flagIva;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlagIva(String flagIva) {
|
public CtbIreg setFlagIva(String flagIva) {
|
||||||
this.flagIva = flagIva;
|
this.flagIva = flagIva;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlagIvaDaVentilare() {
|
public String getFlagIvaDaVentilare() {
|
||||||
return flagIvaDaVentilare;
|
return flagIvaDaVentilare;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlagIvaDaVentilare(String flagIvaDaVentilare) {
|
public CtbIreg setFlagIvaDaVentilare(String flagIvaDaVentilare) {
|
||||||
this.flagIvaDaVentilare = flagIvaDaVentilare;
|
this.flagIvaDaVentilare = flagIvaDaVentilare;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlagExtracee() {
|
public String getFlagExtracee() {
|
||||||
return flagExtracee;
|
return flagExtracee;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlagExtracee(String flagExtracee) {
|
public CtbIreg setFlagExtracee(String flagExtracee) {
|
||||||
this.flagExtracee = flagExtracee;
|
this.flagExtracee = flagExtracee;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CtbInum> getCtbInum() {
|
public List<CtbInum> getCtbInum() {
|
||||||
return ctbInum;
|
return ctbInum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCtbInum(List<CtbInum> ctbInum) {
|
public CtbIreg setCtbInum(List<CtbInum> ctbInum) {
|
||||||
this.ctbInum = ctbInum;
|
this.ctbInum = ctbInum;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DtbInum> getDtbInum() {
|
public List<DtbInum> getDtbInum() {
|
||||||
return dtbInum;
|
return dtbInum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDtbInum(List<DtbInum> dtbInum) {
|
public CtbIreg setDtbInum(List<DtbInum> dtbInum) {
|
||||||
this.dtbInum = dtbInum;
|
this.dtbInum = dtbInum;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void insertChilds() throws Exception {
|
|
||||||
for (CtbInum ctbInum : getCtbInum()) {
|
|
||||||
ctbInum.manageWithParentConnection(connection, ctbInum.getOperation(), dataCompleting, entityHolder);
|
|
||||||
}
|
|
||||||
for (DtbInum dtbInum : getDtbInum()) {
|
|
||||||
dtbInum.manageWithParentConnection(connection, dtbInum.getOperation(), dataCompleting, entityHolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void updateChilds() throws Exception {
|
|
||||||
for (CtbInum ctbInum : getCtbInum()) {
|
|
||||||
ctbInum.manageWithParentConnection(connection, ctbInum.getOperation(), dataCompleting, entityHolder);
|
|
||||||
}
|
|
||||||
for (DtbInum dtbInum : getDtbInum()) {
|
|
||||||
dtbInum.manageWithParentConnection(connection, dtbInum.getOperation(), dataCompleting, entityHolder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
|||||||
@SqlField(value = "sconto2", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "sconto2", nullable = false, defaultObjectValue = "0")
|
||||||
private BigDecimal sconto2;
|
private BigDecimal sconto2;
|
||||||
|
|
||||||
|
@FireRecalc
|
||||||
@SqlField(value = "sconto3", nullable = false, defaultObjectValue = "0")
|
@SqlField(value = "sconto3", nullable = false, defaultObjectValue = "0")
|
||||||
private BigDecimal sconto3;
|
private BigDecimal sconto3;
|
||||||
|
|
||||||
@@ -289,7 +290,6 @@ public class DtbDoct extends DtbBaseDocT implements EquatableEntityInterface<Dtb
|
|||||||
@SqlField(value = "targa_rim", maxLength = 20)
|
@SqlField(value = "targa_rim", maxLength = 20)
|
||||||
private String targaRim;
|
private String targaRim;
|
||||||
|
|
||||||
@ForceRecalc
|
|
||||||
@SqlField(value = "posti_pallet")
|
@SqlField(value = "posti_pallet")
|
||||||
private Integer postiPallet;
|
private Integer postiPallet;
|
||||||
|
|
||||||
|
|||||||
@@ -49,39 +49,44 @@ public class DtbInum extends EntityBase {
|
|||||||
return codIreg;
|
return codIreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCodIreg(String codIreg) {
|
public DtbInum setCodIreg(String codIreg) {
|
||||||
this.codIreg = codIreg;
|
this.codIreg = codIreg;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNumIreg() {
|
public Integer getNumIreg() {
|
||||||
return numIreg;
|
return numIreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNumIreg(Integer numIreg) {
|
public DtbInum setNumIreg(Integer numIreg) {
|
||||||
this.numIreg = numIreg;
|
this.numIreg = numIreg;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAnno() {
|
public Integer getAnno() {
|
||||||
return anno;
|
return anno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnno(Integer anno) {
|
public DtbInum setAnno(Integer anno) {
|
||||||
this.anno = anno;
|
this.anno = anno;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSerDoc() {
|
public String getSerDoc() {
|
||||||
return serDoc;
|
return serDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSerDoc(String serDoc) {
|
public DtbInum setSerDoc(String serDoc) {
|
||||||
this.serDoc = serDoc;
|
this.serDoc = serDoc;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNumDoc() {
|
public Integer getNumDoc() {
|
||||||
return numDoc;
|
return numDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNumDoc(Integer numDoc) {
|
public DtbInum setNumDoc(Integer numDoc) {
|
||||||
this.numDoc = numDoc;
|
this.numDoc = numDoc;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ end
|
|||||||
rule "completePartitaMagOrd"
|
rule "completePartitaMagOrd"
|
||||||
when
|
when
|
||||||
eval(completeRulesEnabled)
|
eval(completeRulesEnabled)
|
||||||
$ordT: DtbOrdt(partitaMag != null && gestione == "L" && !DocOrdRules.checkIfPartitaExist(conn, getCodProd(), getPartitaMag()))
|
$ordT: DtbOrdt(partitaMag != null && partitaMag != "[NULL]" && gestione == "L" && !DocOrdRules.checkIfPartitaExist(conn, getCodProd(), getPartitaMag()))
|
||||||
then
|
then
|
||||||
MtbPartitaMag partitaMag = DocOrdRules.completePartitaMag($ordT.getCodProd(), $ordT.getPartitaMag(), $ordT.getNote());
|
MtbPartitaMag partitaMag = DocOrdRules.completePartitaMag($ordT.getCodProd(), $ordT.getPartitaMag(), $ordT.getNote());
|
||||||
modify ( $ordT ) { setRifPartitaMag(partitaMag) }
|
modify ( $ordT ) { setRifPartitaMag(partitaMag) }
|
||||||
|
|||||||
@@ -283,6 +283,18 @@ public class ContabilController {
|
|||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
|
}@RequestMapping(value = "rigeneraAutofattura", method = RequestMethod.POST)
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse rigeneraAutofattura(HttpServletRequest request,
|
||||||
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
|
@RequestParam Date dataInizio,
|
||||||
|
@RequestParam String codIreg,
|
||||||
|
@RequestParam String codIregAutoFat,
|
||||||
|
@RequestParam Integer numDocFirst,
|
||||||
|
@RequestParam Integer numProtFirst) throws Exception {
|
||||||
|
|
||||||
|
return ServiceRestResponse.createPositiveResponse(autofatturaService.rigeneraAutofatture(dataInizio,codIreg, codIregAutoFat, numDocFirst, numProtFirst));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "cancellaAutofattura", method = RequestMethod.POST)
|
@RequestMapping(value = "cancellaAutofattura", method = RequestMethod.POST)
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
package it.integry.ems.contabil.dto;
|
package it.integry.ems.contabil.dto;
|
||||||
|
|
||||||
|
import it.integry.ems_model.annotation.SqlField;
|
||||||
|
|
||||||
public class AutofatturaDTO {
|
public class AutofatturaDTO {
|
||||||
|
@SqlField(value = "num_cmov")
|
||||||
private Integer numCmov;
|
private Integer numCmov;
|
||||||
private String codDtip;
|
private String codDtip;
|
||||||
|
@SqlField(value = "descrizione")
|
||||||
private String descrizione;
|
private String descrizione;
|
||||||
|
@SqlField(value = "identificativo_sdi")
|
||||||
private String identificativoSdi;
|
private String identificativoSdi;
|
||||||
|
|
||||||
|
private boolean rigeneraAutofattura;
|
||||||
|
|
||||||
public Integer getNumCmov() {
|
public Integer getNumCmov() {
|
||||||
return numCmov;
|
return numCmov;
|
||||||
}
|
}
|
||||||
@@ -41,4 +48,13 @@ public class AutofatturaDTO {
|
|||||||
this.identificativoSdi = identificativoSdi;
|
this.identificativoSdi = identificativoSdi;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRigeneraAutofattura() {
|
||||||
|
return rigeneraAutofattura;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutofatturaDTO setRigeneraAutofattura(boolean rigeneraAutofattura) {
|
||||||
|
this.rigeneraAutofattura = rigeneraAutofattura;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,17 @@ public class AutofatturaService {
|
|||||||
|
|
||||||
|
|
||||||
public List<EntityBase> cancellaAutofattura(AutofatturaDTO autofatturaDTO) throws Exception {
|
public List<EntityBase> cancellaAutofattura(AutofatturaDTO autofatturaDTO) throws Exception {
|
||||||
|
List<EntityBase> entitylist = cancellaAutofattura(autofatturaDTO.getNumCmov());
|
||||||
|
|
||||||
|
List<EntityBase> entityRet = entityProcessor.processEntityList(entitylist, true);
|
||||||
|
|
||||||
|
UtilityEntity.throwEntitiesException(entityRet);
|
||||||
|
|
||||||
|
return entityRet;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EntityBase> cancellaAutofattura(Integer numCmov) throws Exception {
|
||||||
List<EntityBase> entitylist = new ArrayList<>();
|
List<EntityBase> entitylist = new ArrayList<>();
|
||||||
|
|
||||||
String sql =
|
String sql =
|
||||||
@@ -57,7 +68,7 @@ public class AutofatturaService {
|
|||||||
"dtb_tipi.cod_ccau is not null AND " +
|
"dtb_tipi.cod_ccau is not null AND " +
|
||||||
"dtb_tipi.tipo_emissione = 'DIRETTA' AND " +
|
"dtb_tipi.tipo_emissione = 'DIRETTA' AND " +
|
||||||
"dtb_tipi.cod_dtip in (select cod_dtip FROM dvw_tipi_integrazioni) ",
|
"dtb_tipi.cod_dtip in (select cod_dtip FROM dvw_tipi_integrazioni) ",
|
||||||
autofatturaDTO.getNumCmov());
|
numCmov);
|
||||||
|
|
||||||
DtbDoct dtbDoct = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbDoct.class);
|
DtbDoct dtbDoct = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbDoct.class);
|
||||||
|
|
||||||
@@ -69,18 +80,107 @@ public class AutofatturaService {
|
|||||||
sql =
|
sql =
|
||||||
Query.format(
|
Query.format(
|
||||||
"SELECT * FROM crl_movt_rif_cmov WHERE num_cmov_rif = %s",
|
"SELECT * FROM crl_movt_rif_cmov WHERE num_cmov_rif = %s",
|
||||||
autofatturaDTO.getNumCmov());
|
numCmov);
|
||||||
|
|
||||||
CrlMovtRifCmov crlMovtRifCmov = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CrlMovtRifCmov.class);
|
CrlMovtRifCmov crlMovtRifCmov = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CrlMovtRifCmov.class);
|
||||||
crlMovtRifCmov.setOperation(OperationType.DELETE);
|
crlMovtRifCmov.setOperation(OperationType.DELETE);
|
||||||
entitylist.add(crlMovtRifCmov);
|
entitylist.add(crlMovtRifCmov);
|
||||||
entitylist.add(dtbDoct);
|
entitylist.add(dtbDoct);
|
||||||
|
return entitylist;
|
||||||
|
|
||||||
List<EntityBase> entityRet = entityProcessor.processEntityList(entitylist, true);
|
}
|
||||||
|
|
||||||
UtilityEntity.throwEntitiesException(entityRet);
|
public List<EntityBase> rigeneraAutofatture(Date dataInizio,
|
||||||
|
String codIreg,
|
||||||
|
String codIregAutoFat,
|
||||||
|
Integer numDocFirst,
|
||||||
|
Integer numProtFirst) throws Exception {
|
||||||
|
|
||||||
return entityRet;
|
|
||||||
|
String sql =
|
||||||
|
Query.format("SELECT cod_dtip, Cast(num_ireg as int) as num_ireg, dare_avere, serie FROM dtb_tipi WHERE cod_ireg = %s and flag_gestione_speciale = 1 and flag_attivo = 'S' ", codIregAutoFat);
|
||||||
|
|
||||||
|
List<HashMap<String, Object>> tipiDocumento = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
|
if ( tipiDocumento == null || tipiDocumento.isEmpty() )
|
||||||
|
throw new Exception(String.format("Nessun tipo documento trovato per il registro %s", codIreg));
|
||||||
|
|
||||||
|
Integer anno = UtilityDate.getYear(dataInizio);
|
||||||
|
|
||||||
|
CtbIreg ctbIreg = new CtbIreg()
|
||||||
|
.setCodIreg(codIregAutoFat);
|
||||||
|
|
||||||
|
for (HashMap<String, Object> documento : tipiDocumento) {
|
||||||
|
Integer numIreg = (Integer) documento.get("num_ireg");
|
||||||
|
String serie = (String) documento.get("serie");
|
||||||
|
if (ctbIreg.getCtbInum().stream().noneMatch(x->x.getNumIreg().equals(numIreg))) {
|
||||||
|
CtbInum ctbInum = new CtbInum()
|
||||||
|
.setAnno(anno)
|
||||||
|
.setNumIreg(numIreg)
|
||||||
|
.setNumProt(numProtFirst);
|
||||||
|
ctbInum.setOperation(OperationType.UPDATE);
|
||||||
|
ctbIreg.getCtbInum().add(ctbInum);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctbIreg.getDtbInum().stream().noneMatch(x->x.getNumIreg().equals(numIreg) && ((String) x.getSerDoc()).equalsIgnoreCase(serie))) {
|
||||||
|
DtbInum dtbInum = new DtbInum()
|
||||||
|
.setAnno(anno)
|
||||||
|
.setNumIreg(numIreg)
|
||||||
|
.setSerDoc(serie)
|
||||||
|
.setNumDoc(numDocFirst);
|
||||||
|
dtbInum.setOperation(OperationType.UPDATE);
|
||||||
|
ctbIreg.getDtbInum().add(dtbInum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
entityProcessor.processEntity(ctbIreg, multiDBTransactionManager);
|
||||||
|
|
||||||
|
sql =
|
||||||
|
Query.format(
|
||||||
|
"SELECT ctb_movt.num_cmov,\n" +
|
||||||
|
" dtb_docr.descrizione_estesa as descrizione,\n" +
|
||||||
|
" dtb_docr.note AS identificativo_sdi, \n" +
|
||||||
|
" CAST(ctb_caus.segno_ireg as int) as segno_ireg \n" +
|
||||||
|
"FROM ctb_movt\n" +
|
||||||
|
" INNER JOIN crl_movt_rif_cmov ON ctb_movt.num_cmov = crl_movt_rif_cmov.num_cmov\n" +
|
||||||
|
" INNER JOIN ctb_caus ON ctb_movt.cod_ccau = ctb_caus.cod_ccau\n" +
|
||||||
|
" INNER JOIN dtb_doct ON crl_movt_rif_cmov.num_cmov_rif = dtb_doct.num_cmov\n" +
|
||||||
|
" INNER JOIN dtb_docr ON dtb_doct.cod_anag = dtb_docr.cod_anag AND dtb_doct.cod_dtip = dtb_docr.cod_dtip AND\n" +
|
||||||
|
" dtb_doct.data_doc = dtb_docr.data_doc AND dtb_doct.ser_doc = dtb_docr.ser_doc AND\n" +
|
||||||
|
" dtb_doct.num_doc = dtb_docr.num_doc\n" +
|
||||||
|
"WHERE ctb_movt.data_cmov BETWEEN %s AND DateFromParts( %s, 12, 31)\n" +
|
||||||
|
" AND ctb_movt.cod_ireg = %s\n" +
|
||||||
|
"ORDER BY ctb_movt.data_cmov, ctb_movt.num_prot",
|
||||||
|
dataInizio, anno, codIreg);
|
||||||
|
|
||||||
|
List<HashMap<String, Object>> listaMov = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
|
List<EntityBase> entityBaseList = new ArrayList<>();
|
||||||
|
for (HashMap<String, Object> mov : listaMov) {
|
||||||
|
String dareAvere;
|
||||||
|
if (UtilityHashMap.<Integer>getValueIfExists(mov, "segno_ireg") < 0) {
|
||||||
|
dareAvere = "A";
|
||||||
|
} else {
|
||||||
|
dareAvere = "D";
|
||||||
|
}
|
||||||
|
String codDtip = (String) tipiDocumento.stream()
|
||||||
|
.filter(x->((String) x.get("dare_avere"))
|
||||||
|
.equalsIgnoreCase(dareAvere)).map(x->x.get("cod_dtip"))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
if ( UtilityString.isNullOrEmpty(codDtip) ) {
|
||||||
|
throw new Exception(String.format("Tipo documento non configurato per la registrazione delle ",
|
||||||
|
dareAvere.equalsIgnoreCase("D")?"fatture":"note credito"));
|
||||||
|
}
|
||||||
|
|
||||||
|
AutofatturaDTO autofatturaDTO =
|
||||||
|
new AutofatturaDTO().setCodDtip(codDtip)
|
||||||
|
.setNumCmov((Integer) mov.get("num_cmov"))
|
||||||
|
.setDescrizione((String) mov.get("descrizione"))
|
||||||
|
.setIdentificativoSdi((String) mov.get("identificativo_sdi"))
|
||||||
|
.setRigeneraAutofattura(true);
|
||||||
|
entityBaseList.add(generaAutofattura(autofatturaDTO));
|
||||||
|
}
|
||||||
|
return entityBaseList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityBase generaAutofattura(AutofatturaDTO autofatturaDTO) throws Exception {
|
public EntityBase generaAutofattura(AutofatturaDTO autofatturaDTO) throws Exception {
|
||||||
@@ -144,7 +244,6 @@ public class AutofatturaService {
|
|||||||
throw new Exception(String.format("Attenzione sul cliente %s non è stata inserita la modalità di pagamento, impossibile procedere", datiMov.get("cod_anag")));
|
throw new Exception(String.format("Attenzione sul cliente %s non è stata inserita la modalità di pagamento, impossibile procedere", datiMov.get("cod_anag")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean pagaScadenze = false;
|
boolean pagaScadenze = false;
|
||||||
String codDtip = (String) datiMov.get("cod_dtip");
|
String codDtip = (String) datiMov.get("cod_dtip");
|
||||||
OperationType operationType = OperationType.DELETE_THEN_INSERT;
|
OperationType operationType = OperationType.DELETE_THEN_INSERT;
|
||||||
@@ -169,29 +268,40 @@ public class AutofatturaService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DtbDoct dtbDoct =
|
DtbDoct dtbDoct;
|
||||||
new DtbDoct()
|
if (autofatturaDTO.isRigeneraAutofattura()) {
|
||||||
.setCodAnag((String) datiMov.get("cod_anag"))
|
entityList.addAll(cancellaAutofattura((Integer) datiMov.get("num_cmov_rif")));
|
||||||
.setCodDtip(codDtip)
|
operationType = OperationType.INSERT;
|
||||||
.setDataDoc((Date) datiMov.get("data_cmov"))
|
dtbDoct =
|
||||||
.setDataReg((Date) datiMov.get("data_cmov"))
|
new DtbDoct()
|
||||||
.setSerDoc((String) datiMov.get("ser_doc"))
|
.setCodAnag((String) datiMov.get("cod_anag"))
|
||||||
.setNumDoc((Integer) datiMov.get("num_doc"));
|
.setCodDtip(codDtip)
|
||||||
|
.setDataDoc((Date) datiMov.get("data_cmov"))
|
||||||
dtbDoct.setOperation(operationType);
|
.setDataReg((Date) datiMov.get("data_cmov"));
|
||||||
String codDtipOld = UtilityHashMap.getValueIfExists(datiMov, "cod_dtip");
|
} else {
|
||||||
if (datiMov.get("cod_anag_old") != null ||
|
dtbDoct =
|
||||||
datiMov.get("data_doc_old") != null ||
|
new DtbDoct()
|
||||||
(codDtipOld != null && !codDtipOld.equalsIgnoreCase(autofatturaDTO.getCodDtip()))) {
|
.setCodAnag((String) datiMov.get("cod_anag"))
|
||||||
HashMap<String, Object> oldPk = new HashMap<>();
|
.setCodDtip(codDtip)
|
||||||
if (datiMov.get("cod_anag_old") != null) oldPk.put("codAnag", datiMov.get("cod_anag_old"));
|
.setDataDoc((Date) datiMov.get("data_cmov"))
|
||||||
if (datiMov.get("data_doc_old") != null)
|
.setDataReg((Date) datiMov.get("data_cmov"))
|
||||||
oldPk.put("dataDoc", new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(datiMov.get("data_doc_old")));
|
.setSerDoc((String) datiMov.get("ser_doc"))
|
||||||
if (datiMov.get("cod_dtip") != null && !datiMov.get("cod_dtip").equals(codDtip))
|
.setNumDoc((Integer) datiMov.get("num_doc"));
|
||||||
oldPk.put("codDtip", datiMov.get("cod_dtip"));
|
String codDtipOld = UtilityHashMap.getValueIfExists(datiMov, "cod_dtip");
|
||||||
dtbDoct.setOldPk(oldPk);
|
if (datiMov.get("cod_anag_old") != null ||
|
||||||
|
datiMov.get("data_doc_old") != null ||
|
||||||
|
(codDtipOld != null && !codDtipOld.equalsIgnoreCase(autofatturaDTO.getCodDtip()))) {
|
||||||
|
HashMap<String, Object> oldPk = new HashMap<>();
|
||||||
|
if (datiMov.get("cod_anag_old") != null) oldPk.put("codAnag", datiMov.get("cod_anag_old"));
|
||||||
|
if (datiMov.get("data_doc_old") != null)
|
||||||
|
oldPk.put("dataDoc", new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(datiMov.get("data_doc_old")));
|
||||||
|
if (datiMov.get("cod_dtip") != null && !datiMov.get("cod_dtip").equals(codDtip))
|
||||||
|
oldPk.put("codDtip", datiMov.get("cod_dtip"));
|
||||||
|
dtbDoct.setOldPk(oldPk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dtbDoct.setNumCmovAutofattura(autofatturaDTO.getNumCmov());
|
dtbDoct.setNumCmovAutofattura(autofatturaDTO.getNumCmov());
|
||||||
|
dtbDoct.setOperation(operationType);
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(dtbDoct.getCodMdep())) {
|
if (UtilityString.isNullOrEmpty(dtbDoct.getCodMdep())) {
|
||||||
sql = "SELECT min(cod_mdep) FROM mtb_depo WHERE flag_movimentabile = 'S'";
|
sql = "SELECT min(cod_mdep) FROM mtb_depo WHERE flag_movimentabile = 'S'";
|
||||||
@@ -255,7 +365,7 @@ public class AutofatturaService {
|
|||||||
if (entityBase.getException() != null) {
|
if (entityBase.getException() != null) {
|
||||||
multiDBTransactionManager.rollbackAll();
|
multiDBTransactionManager.rollbackAll();
|
||||||
throw new Exception(entityBase.getException());
|
throw new Exception(entityBase.getException());
|
||||||
} else if (entityBase instanceof DtbDoct) {
|
} else if (entityBase instanceof DtbDoct && entityBase.getOperation() != OperationType.DELETE) {
|
||||||
docRet = (DtbDoct) entityBase;
|
docRet = (DtbDoct) entityBase;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -118,8 +117,8 @@ public class WMSGenericController {
|
|||||||
return ServiceRestResponse.createPositiveResponse();
|
return ServiceRestResponse.createPositiveResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_CHECK_LATEST_WMS_VERSION_JSON, method = RequestMethod.GET)
|
@GetMapping(value = EmsRestConstants.PATH_CHECK_LATEST_WMS_VERSION_JSON)
|
||||||
public Object checkWMSLatestVersionJSON(HttpServletResponse response) throws Exception {
|
public WMSVersionDTO checkWMSLatestVersionJSON(HttpServletResponse response) throws Exception {
|
||||||
String wmsVersionFile = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version.txt").toString();
|
String wmsVersionFile = Paths.get(UtilityDirs.getWebAppPath(), "wms", "version.txt").toString();
|
||||||
if (new File(wmsVersionFile).exists()) {
|
if (new File(wmsVersionFile).exists()) {
|
||||||
List<String> lines = UtilityString.splitStringToMultipleLine(IoUtils.readFileAsString(new File(wmsVersionFile)));
|
List<String> lines = UtilityString.splitStringToMultipleLine(IoUtils.readFileAsString(new File(wmsVersionFile)));
|
||||||
@@ -139,7 +138,7 @@ public class WMSGenericController {
|
|||||||
WMSVersionDTO wmsVersionDTO = new WMSVersionDTO()
|
WMSVersionDTO wmsVersionDTO = new WMSVersionDTO()
|
||||||
.setLatestVersion(versionString)
|
.setLatestVersion(versionString)
|
||||||
.setLatestVersionCode(versionCode)
|
.setLatestVersionCode(versionCode)
|
||||||
.setUrl("http://" + InetAddress.getLocalHost().getHostAddress() + ":8080" + emsProperties.getRootApi() + "/wms/android-release.apk");
|
.setUrl("/wms/android-release.apk");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2039,10 +2039,10 @@ public class WMSGenericService {
|
|||||||
boolean gestisciColli = WMSUtility.isGestisciColli(mtbDepo, entityProcessor, multiDBTransactionManager);
|
boolean gestisciColli = WMSUtility.isGestisciColli(mtbDepo, entityProcessor, multiDBTransactionManager);
|
||||||
MtbColt uds = null;
|
MtbColt uds = null;
|
||||||
|
|
||||||
if (!gestisciColli){
|
if (!gestisciColli) {
|
||||||
CreateUDSRequestDTO createUDSRequest = new CreateUDSRequestDTO();
|
CreateUDSRequestDTO createUDSRequest = new CreateUDSRequestDTO();
|
||||||
createUDSRequest.setCodMdep(mtbDepo.getCodMdep())
|
createUDSRequest.setCodMdep(mtbDepo.getCodMdep())
|
||||||
.setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO);
|
.setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO);
|
||||||
|
|
||||||
uds = wmsLavorazioneService.createUDS(createUDSRequest);
|
uds = wmsLavorazioneService.createUDS(createUDSRequest);
|
||||||
}
|
}
|
||||||
@@ -2050,7 +2050,7 @@ public class WMSGenericService {
|
|||||||
for (MtbColt mtbColtToMove : mtbCotlList) {
|
for (MtbColt mtbColtToMove : mtbCotlList) {
|
||||||
if (dtbDoct != null) {
|
if (dtbDoct != null) {
|
||||||
for (MtbColr mtbColr : mtbColtToMove.getMtbColr()) {
|
for (MtbColr mtbColr : mtbColtToMove.getMtbColr()) {
|
||||||
if(!gestisciColli){
|
if (!gestisciColli) {
|
||||||
InsertUDSRowRequestDTO insertUDSRowRequest = new InsertUDSRowRequestDTO();
|
InsertUDSRowRequestDTO insertUDSRowRequest = new InsertUDSRowRequestDTO();
|
||||||
insertUDSRowRequest
|
insertUDSRowRequest
|
||||||
.setSourceMtbColr(mtbColr)
|
.setSourceMtbColr(mtbColr)
|
||||||
@@ -2143,12 +2143,17 @@ public class WMSGenericService {
|
|||||||
.setNumColloRif(cloneMtbColr.getNumColloRif())
|
.setNumColloRif(cloneMtbColr.getNumColloRif())
|
||||||
.setSerColloRif(cloneMtbColr.getSerColloRif())
|
.setSerColloRif(cloneMtbColr.getSerColloRif())
|
||||||
.setDataColloRif(cloneMtbColr.getDataColloRif())
|
.setDataColloRif(cloneMtbColr.getDataColloRif())
|
||||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
|
||||||
.setUtente(requestDataDTO.getUsername())
|
.setUtente(requestDataDTO.getUsername())
|
||||||
|
|
||||||
.setQtaCol(stornoSourceMtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
.setQtaCol(stornoSourceMtbColr.getQtaCol().multiply(new BigDecimal(-1)))
|
||||||
.setNumCnf(stornoSourceMtbColr.getNumCnf().multiply(new BigDecimal(-1)));
|
.setNumCnf(stornoSourceMtbColr.getNumCnf().multiply(new BigDecimal(-1)));
|
||||||
|
|
||||||
|
if (destinationMtbColt.getGestione().equalsIgnoreCase("V") && destinationMtbColt.getSegno() == -1) {
|
||||||
|
stornoSourceMtbColr.setCausale(null);
|
||||||
|
} else {
|
||||||
|
stornoSourceMtbColr.setCausale(MtbColr.Causale.VERSAMENTO);
|
||||||
|
}
|
||||||
|
|
||||||
mtbColrSourceObservableField.add(stornoSourceMtbColr);
|
mtbColrSourceObservableField.add(stornoSourceMtbColr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2164,13 +2169,18 @@ public class WMSGenericService {
|
|||||||
cloneMtbColr.setCodJcom(null);
|
cloneMtbColr.setCodJcom(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (destinationMtbColt.getGestione().equalsIgnoreCase("V") && destinationMtbColt.getSegno() == -1) {
|
||||||
|
cloneMtbColr.setCausale(null);
|
||||||
|
} else {
|
||||||
|
cloneMtbColr.setCausale(MtbColr.Causale.VERSAMENTO);
|
||||||
|
}
|
||||||
|
|
||||||
cloneMtbColr
|
cloneMtbColr
|
||||||
.setGestione(null)
|
.setGestione(null)
|
||||||
.setSerCollo(null)
|
.setSerCollo(null)
|
||||||
.setNumCollo(null)
|
.setNumCollo(null)
|
||||||
.setDataCollo(null)
|
.setDataCollo(null)
|
||||||
.setRiga(null)
|
.setRiga(null)
|
||||||
.setCausale(MtbColr.Causale.VERSAMENTO)
|
|
||||||
.setUtente(requestDataDTO.getUsername());
|
.setUtente(requestDataDTO.getUsername());
|
||||||
|
|
||||||
mtbColrDestObservableField.add(cloneMtbColr);
|
mtbColrDestObservableField.add(cloneMtbColr);
|
||||||
|
|||||||
Reference in New Issue
Block a user