Importazione DIPA
This commit is contained in:
@@ -11,7 +11,7 @@ public class Migration_20240619105525 extends BaseMigration implements Migration
|
||||
return;
|
||||
|
||||
|
||||
createSetup("IMPORT_DOCUMENTI_TRASPORTO", "DIPA", "€/KG.", "KG", "Tipo calcolo euro/kg", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI_TRASPORTO", "DIPA", "€/KG.", "PESO", "Tipo calcolo euro/kg", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_DOCUMENTI_TRASPORTO", "DIPA", "€/PLT", "PEDANE", "Tipo calcolo euro/pallet", false, null, false, false, false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240619163048 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
updateSetupValue("IMPORT_DOCUMENTI_TRASPORTO", "DIPA", "ELENCO_TIPI_DOC_DA_ESCLUDERE", "D.D.T|DDTAV|DDTRC");
|
||||
updateSetupValue("IMPORT_DOCUMENTI_TRASPORTO", "MIRARCHI", "ELENCO_TIPI_DOC_DA_ESCLUDERE", "D.D.T|DDTAV|DDTRC");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,10 +26,6 @@ public class DocTraspImportDTO {
|
||||
private String rifDoc;
|
||||
/*Riferimento del numero di riga del file importato*/
|
||||
private Integer idRiga;
|
||||
|
||||
/*Se impostata vengono passati l'elenco dei documenti che dovranno essere sclusi dalla ricerca,
|
||||
l'elenco dei documenti da escludere normalmente viene configurato nella setup del formato di importazione*/
|
||||
private String elencoDocDaEscludere;
|
||||
private BigDecimal peso;
|
||||
private BigDecimal colli;
|
||||
private BigDecimal pallet;
|
||||
@@ -155,15 +151,6 @@ public class DocTraspImportDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getElencoDocDaEscludere() {
|
||||
return elencoDocDaEscludere;
|
||||
}
|
||||
|
||||
public DocTraspImportDTO setElencoDocDaEscludere(String elencoDocDaEscludere) {
|
||||
this.elencoDocDaEscludere = elencoDocDaEscludere;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getPeso() {
|
||||
return peso;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
@@ -32,6 +36,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
@@ -77,6 +82,7 @@ public class DocCostiTrasporto {
|
||||
|
||||
String codVvet = UtilityString.emptyStr2Null(setupGest.getImportSetup(connect, type, format, "COD_VVET"));
|
||||
String elencoClientiTipoCalcPallet = UtilityString.emptyStr2Null(setupGest.getImportSetup(connect, type, format, "TIPO_CALC_PALLET_EL_COD_ANAG"));
|
||||
String elencoDocDaEscludere = UtilityString.emptyStr2Null(setupGest.getImportSetup(connect, type, format, "ELENCO_TIPI_DOC_DA_ESCLUDERE"));
|
||||
if (codVvet == null){
|
||||
throw new Exception("CODICE VETTORE NON CONFIGURATO");
|
||||
}
|
||||
@@ -92,13 +98,15 @@ public class DocCostiTrasporto {
|
||||
Integer numDoc = doc.getNumDoc();
|
||||
String serDoc = UtilityString.emptyStr2Null(doc.getSerDoc());
|
||||
Integer idRiga = doc.getIdRiga();
|
||||
String elencoDocDaEscludere = doc.getElencoDocDaEscludere();
|
||||
String note = "";
|
||||
String checkgestione = doc.getCheckGestione();
|
||||
|
||||
String untMis = getUntMisFromTipoCalc(tipoCalc);
|
||||
|
||||
// Acquisizione numero e serie documento
|
||||
codDtip = null;
|
||||
codAnag = null;
|
||||
serDoc = null;
|
||||
if (numDoc == null){
|
||||
if (rifDoc == null || rifDoc.length() == 0){
|
||||
rifDoc = "[VUOTO]";
|
||||
@@ -176,7 +184,7 @@ public class DocCostiTrasporto {
|
||||
note += "@DOC_NO_EXIST=" + rifDoc + " documento inesistente";
|
||||
dataDoc = dataSped;
|
||||
} else if (rowCounter > 1) {
|
||||
note += "@DOC_MORE=" + rifDoc + " ci sono più documenti associati con la stessa serie e numero nel gestionale";
|
||||
note += "@DOC_MORE=" + rifDoc + " ci sono più documenti associati con la stessa numero nel gestionale";
|
||||
dataDoc = dataSped;
|
||||
}
|
||||
}
|
||||
@@ -518,7 +526,6 @@ public class DocCostiTrasporto {
|
||||
docTrasp.setDataSped(dataDoc);
|
||||
docTrasp.setRifDoc(rifDoc);
|
||||
docTrasp.setIdRiga(idRiga);
|
||||
docTrasp.setElencoDocDaEscludere(elencoTipiDocDaEscludere);
|
||||
docTrasp.setCheckSerDoc(checkSerieDoc);
|
||||
docTrasp.setColli(tassatoCollo);
|
||||
docTrasp.setPeso(tassatoPeso);
|
||||
@@ -608,7 +615,7 @@ public class DocCostiTrasporto {
|
||||
|
||||
String checkSerieDoc = "N",
|
||||
checkAnnoDoc = "N",
|
||||
checkVettore = "S",
|
||||
checkVettore = "N",
|
||||
checkGestione = "V";
|
||||
|
||||
File tempFile = new File(requestDataDTO.getPathFile());
|
||||
@@ -621,13 +628,16 @@ public class DocCostiTrasporto {
|
||||
while (rowIterator.hasNext()) {
|
||||
if (idRiga <= 1){
|
||||
row = rowIterator.next();
|
||||
}
|
||||
idRiga++;
|
||||
if (idRiga == 1){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
if (rifDoc.length() == 0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Ciclo su riferimento documento per clacolo del costo toale nolo
|
||||
int index = 0;
|
||||
do {
|
||||
String dataSpedizione = String.valueOf(row.getCell(0));
|
||||
@@ -635,36 +645,23 @@ public class DocCostiTrasporto {
|
||||
String ragSoc = dataFormatter.formatCellValue(row.getCell(3));
|
||||
String citta = dataFormatter.formatCellValue(row.getCell(4)).toUpperCase();
|
||||
BigDecimal tassato = new BigDecimal(String.valueOf(row.getCell(5)));
|
||||
String tipoCalc = dataFormatter.formatCellValue(row.getCell(7)).toUpperCase();
|
||||
String tipoCalcVett = dataFormatter.formatCellValue(row.getCell(7)).toUpperCase();
|
||||
BigDecimal nolo = new BigDecimal(String.valueOf(row.getCell(8)));
|
||||
Date dataDoc = new SimpleDateFormat("dd-MMM-yyyy").parse(dataSpedizione);
|
||||
Date dataDoc = new SimpleDateFormat("dd/MM/yyyy").parse(dataSpedizione);
|
||||
index++;
|
||||
|
||||
// Le informazioni relativa agli estremi del documento vengono presi dalla prima riga, mentre dalle atre righe vengono solo sommati i singoli importi di spedizione più diritti fissi e contrassegno
|
||||
if (index == 1){
|
||||
// Verifica se si tratta di un documento di acquisto o di reso, in tal caso nella destinazione c'è il nome dell'azienda e non devono essere ricercati i riferimenti del docuemento
|
||||
sql = "select count(*) " +
|
||||
"from dbo.ParseStringIntoArray((select dbo.getGestSetup(IMPORT_" + UtilityDB.valueToString(type) + ", " + UtilityDB.valueToString(format) +", 'RAG_SOC_AZIENDA')), '|')" +
|
||||
" where value_string = " + UtilityDB.valueToString(ragSoc);
|
||||
Integer isDocAnonymous = (Integer) getSingleValue(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
tipoCalc = setupGest.getImportSetup(connect, type, format, tipoCalc);
|
||||
String untMis = getUntMisFromTipoCalc(tipoCalc);
|
||||
Integer numDoc = null;
|
||||
if (isDocAnonymous == 0) {
|
||||
if (UtilityString.isNumber(rifDoc)) {
|
||||
numDoc = Integer.valueOf(rifDoc);
|
||||
}
|
||||
}
|
||||
|
||||
docTrasp = new DocTraspImportDTO();
|
||||
docTrasp.setDataDoc(dataDoc);
|
||||
docTrasp.setNumDoc(numDoc);
|
||||
docTrasp.setRagSoc(ragSoc);
|
||||
docTrasp.setNolo(nolo);
|
||||
docTrasp.setTassato(tassato);
|
||||
docTrasp.setTipoCalc(tipoCalc);
|
||||
docTrasp.setUntMis(untMis);
|
||||
docTrasp.setDataSped(dataDoc);
|
||||
docTrasp.setRifDoc(rifDoc);
|
||||
docTrasp.setIdRiga(idRiga);
|
||||
@@ -673,14 +670,32 @@ public class DocCostiTrasporto {
|
||||
docTrasp.setCheckSerDoc(checkSerieDoc);
|
||||
docTrasp.setCheckAnnoDoc(checkAnnoDoc);
|
||||
docTrasp.setCheckVettore(checkVettore);
|
||||
|
||||
String tipoCalc = setupGest.getImportSetup(connect, type, format, tipoCalcVett);
|
||||
if (tipoCalc != null){
|
||||
String untMis = getUntMisFromTipoCalc(tipoCalc);
|
||||
docTrasp.setTipoCalc(tipoCalc);
|
||||
docTrasp.setUntMis(untMis);
|
||||
docTrasp.setTassato(tassato);
|
||||
}
|
||||
|
||||
listDocTrasp.add(docTrasp);
|
||||
} else {
|
||||
String tipoCalc = setupGest.getImportSetup(connect, type, format, tipoCalcVett);
|
||||
String untMis = getUntMisFromTipoCalc(tipoCalc);
|
||||
if (tipoCalc != null){
|
||||
docTrasp.setTipoCalc(tipoCalc);
|
||||
docTrasp.setUntMis(untMis);
|
||||
docTrasp.setTassato(tassato);
|
||||
}
|
||||
|
||||
docTrasp.setNolo(docTrasp.getNolo().add(nolo));
|
||||
}
|
||||
|
||||
rifDocOld = rifDoc;
|
||||
|
||||
if (rowIterator.hasNext()){
|
||||
idRiga++;
|
||||
row = rowIterator.next();
|
||||
rifDoc = dataFormatter.formatCellValue(row.getCell(1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user