Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240522152800 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "ATTIVO", "N", "Inserire S/N per attivare/disattivare il tipo di importazione", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "COD_ANAG", null, "Codice fornitore", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "COD_MDEP", null, "Codice deposito", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "EMAIL_FOR_LOG", null, "Inserire il file l'indirizzo email per inviare il log dell'importazione", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "FILE_FILTER", null, "Inserire il criterio di filtro dei file o il nome del file specifio (seguire la sintassi di java)", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "GG_CANC_FILE", null, "Giorni per la cancellazione dei file dalla cartella di appoggio", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "IMPORT_REST", "S", "Inserire S/N per attivare/disattivare il salvataggio con i servizi REST", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "LISTENING", "N", "Se LISTENIG = 'N' la procedura di importazione non si potrà mai mettere in ascolto sulla directory perchè nella procedura vengono prese in considerazione più file.", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "PATH_FILE", null, "Directory contente i file da importare.", false, null, false, false, false, false, false, null, false, null);
|
||||
createSetup("IMPORT_COLLI", "EVIOSYS", "PATH_FILE_IMPORTED", null, "Directory dove vengono spostati i file dopo l'importazione.", false, null, false, false, false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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_20240522173844 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'", false);
|
||||
createSetup("ORDIKIDS", "SETUP", "NOME_NEGOZIO_REQUIRED", null, null, false, "SI_NO", false, false, false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
|
||||
if (isCustomer(IntegryCustomer.FolliesGroup)) {
|
||||
updateSetupValue("ORDIKIDS", "SETUP", "NOME_NEGOZIO_REQUIRED", "S");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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_20240523120224 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table jtb_flav add iban varchar(40)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -148,6 +148,9 @@ public class JtbFlav extends EntityBase {
|
||||
@SqlField(value = "cod_intercode", maxLength = 40, nullable = true)
|
||||
private String codIntercode;
|
||||
|
||||
@SqlField(value = "iban", maxLength = 40, nullable = true)
|
||||
private String iban;
|
||||
|
||||
private String precode;
|
||||
|
||||
@EntityChild
|
||||
@@ -501,6 +504,14 @@ public class JtbFlav extends EntityBase {
|
||||
this.codIntercode = codIntercode;
|
||||
}
|
||||
|
||||
public String getIban() {
|
||||
return iban;
|
||||
}
|
||||
|
||||
public void setIban(String iban) {
|
||||
this.iban = iban;
|
||||
}
|
||||
|
||||
public String getPrecode() {
|
||||
return precode;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.integry.ems_model.utility;
|
||||
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFCellUtil;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
@@ -9,13 +9,8 @@ import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.beans.factory.annotation.Required;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.io.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
@@ -124,29 +119,11 @@ public class UtilityExcel {
|
||||
|
||||
}
|
||||
|
||||
public static Iterator<Row> readXlsxFile(Map<String, String> setup, ImportRequestDTO requestDTO) throws Exception {
|
||||
public static Iterator<Row> readXlsxFile(ImportRequestDTO requestDTO) throws Exception {
|
||||
OPCPackage pkg;
|
||||
String path = setup.get("PATH_FILE");
|
||||
String fileName = setup.get("FILE_FILTER");
|
||||
InputStream stream = new ByteArrayInputStream(Base64.decodeBase64(requestDTO.getRawContentB64()));
|
||||
|
||||
if (UtilityString.isNullOrEmpty(path))
|
||||
path = requestDTO.getPathFile();
|
||||
|
||||
if (UtilityString.isNullOrEmpty(fileName))
|
||||
fileName = requestDTO.getFileName();
|
||||
|
||||
if (!FilenameUtils.getExtension(fileName).equalsIgnoreCase("xlsx"))
|
||||
throw new Exception("Formato file non supportato");
|
||||
|
||||
if (!path.endsWith("\\") || !path.endsWith("/"))
|
||||
path = path + File.separator;
|
||||
|
||||
File file = new File(path + fileName);
|
||||
if (!file.exists()) {
|
||||
throw new Exception(String.format("Impossibile aprire il file %s.", path + fileName));
|
||||
}
|
||||
|
||||
pkg = OPCPackage.open(file);
|
||||
pkg = OPCPackage.open(stream);
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(pkg);
|
||||
XSSFSheet sheet = workbook.getSheetAt(0);
|
||||
pkg.close();
|
||||
|
||||
@@ -418,7 +418,7 @@ public class ContabilImportService {
|
||||
List<EntityBase> listEntityBase = new ArrayList<>();
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(setup, requestDTO);
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(requestDTO);
|
||||
//Ignoro le prime tre righe di intestazione
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (rowIterator.hasNext()) {
|
||||
|
||||
@@ -886,7 +886,7 @@ public class DocumentiAcquistoImportService {
|
||||
throw new Exception("File con data antecedente alla data prevista per l'importazione");
|
||||
}
|
||||
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(setup, requestDTO);
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(requestDTO);
|
||||
List<RifOrdApuliaDTO> rifOrdApuliaList = new ArrayList<>();
|
||||
|
||||
while (rowIterator.hasNext()) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import it.integry.ems.Import.base.BaseEntityImporter;
|
||||
import it.integry.ems.Import.base.IEntityImporter;
|
||||
import it.integry.ems.logistic.Import.service.*;
|
||||
import it.integry.ems.logistic.service.ColliBaioneImportService;
|
||||
import it.integry.ems.logistic.service.ColliEviosysImportService;
|
||||
import it.integry.ems.logistic.service.ColliImportService;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
@@ -54,7 +55,9 @@ public class ColliImporter extends BaseEntityImporter implements IEntityImporter
|
||||
break;
|
||||
case BAIONE:
|
||||
entities = context.getBean(ColliBaioneImportService.class).importColli(type, format, requestDto, anomalie);
|
||||
|
||||
break;
|
||||
case EVIOSYS:
|
||||
entities = context.getBean(ColliEviosysImportService.class).importColli(type, format, requestDto, anomalie);
|
||||
break;
|
||||
default:
|
||||
throw new Exception(String.format("Tipo %s non supportato", format));
|
||||
@@ -75,7 +78,8 @@ public class ColliImporter extends BaseEntityImporter implements IEntityImporter
|
||||
ICON_ACCETTAZIONE("ICON_ACCETTAZIONE"),
|
||||
STEUP("STEUP"),
|
||||
METALSISTEM("METALSISTEM"),
|
||||
BAIONE("BAIONE");
|
||||
BAIONE("BAIONE"),
|
||||
EVIOSYS("EVIOSYS");
|
||||
|
||||
private String text;
|
||||
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package it.integry.ems.logistic.service;
|
||||
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.MtbColr;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityExcel;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.StreamSupport.stream;
|
||||
|
||||
@Service
|
||||
@Scope(value = "request")
|
||||
public class ColliEviosysImportService {
|
||||
|
||||
@Autowired
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
@Autowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
public List<EntityBase> importColli(String type, String format, ImportRequestDTO requestDTO, List<AnomalieDTO> anomalie) throws Exception {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(conn, type, format);
|
||||
|
||||
String codAnag = setup.get("COD_ANAG");
|
||||
String codMdep = setup.get("COD_MDEP");
|
||||
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(requestDTO);
|
||||
|
||||
String codMart = null;
|
||||
boolean hasHeaderPassed = false;
|
||||
|
||||
List<MtbColt> mtbColtList = new ArrayList<>();
|
||||
|
||||
while (rowIterator.hasNext()) {
|
||||
Row row = rowIterator.next();
|
||||
|
||||
if (!hasHeaderPassed) {
|
||||
if (codMart == null) {
|
||||
codMart = findCodMart(row);
|
||||
} else {
|
||||
hasHeaderPassed = UtilityExcel.getCellAsString(row, 0, false).equalsIgnoreCase("origine");
|
||||
}
|
||||
} else {
|
||||
List<Object> rowData =
|
||||
stream(((Iterable<Cell>) row::cellIterator).spliterator(), false)
|
||||
.map(x -> {
|
||||
Object s = cellToString(x);
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
return null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (rowData.size() >= 7) {
|
||||
String barcodeUl = (String) rowData.get(2);
|
||||
String qta = (String) rowData.get(6);
|
||||
|
||||
if (barcodeUl.length() > 18) {
|
||||
barcodeUl = barcodeUl.substring(2);
|
||||
}
|
||||
|
||||
MtbColr mtbColr = new MtbColr()
|
||||
.setCodMart(codMart)
|
||||
.setQtaCol(UtilityString.stringToBigDecimal(qta));
|
||||
|
||||
MtbColt mtbColt = new MtbColt()
|
||||
.setDataCollo(LocalDate.now())
|
||||
.setSegno(1)
|
||||
.setGestione("A")
|
||||
.setBarcodeUl(barcodeUl)
|
||||
.setCodMdep(codMdep)
|
||||
.setCodAnag(codAnag);
|
||||
|
||||
mtbColt.setMtbColr(new ArrayList<>())
|
||||
.getMtbColr()
|
||||
.add(mtbColr);
|
||||
|
||||
mtbColt.setOperation(OperationType.INSERT);
|
||||
mtbColtList.add(mtbColt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entityProcessor.processEntityList(mtbColtList, multiDBTransactionManager, true);
|
||||
}
|
||||
|
||||
private Object cellToString(Cell cell) {
|
||||
if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
|
||||
for (int i = 0; i < cell.getStringCellValue().length(); i++) {
|
||||
if (cell.getStringCellValue().charAt(i) != ' ') {
|
||||
return cell.getStringCellValue().trim();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
} else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
|
||||
double numericCellValue = cell.getNumericCellValue();
|
||||
if (numericCellValue == Math.floor(numericCellValue)) {
|
||||
return String.valueOf((int) numericCellValue);
|
||||
}
|
||||
if (DateUtil.isCellDateFormatted(cell)) {
|
||||
return cell.getDateCellValue();
|
||||
} else {
|
||||
return String.valueOf(numericCellValue);
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String findCodMart(Row row) throws Exception {
|
||||
Iterator<Cell> cellIterator = row.cellIterator();
|
||||
|
||||
String codArtFor = stream(((Iterable<Cell>) () -> cellIterator).spliterator(), false)
|
||||
.map(cell -> {
|
||||
try {
|
||||
return UtilityExcel.getCellAsString(row, cell.getColumnIndex(), true);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(new String[]{null, null}, (state, cell) -> {
|
||||
if (state[0] == null && cell.equalsIgnoreCase("viaggio:")) {
|
||||
state[0] = "viaggio";
|
||||
} else if (state[0] != null && state[1] == null && cell.equalsIgnoreCase("articolo:")) {
|
||||
state[1] = "articolo";
|
||||
} else if ("articolo".equals(state[1]) && UtilityString.isNumber(cell)) {
|
||||
state[1] = cell;
|
||||
}
|
||||
return state;
|
||||
}, (s1, s2) -> s1)[1];
|
||||
|
||||
if (codArtFor != null) {
|
||||
String sql = Query.format("SELECT cod_mart FROM mtb_lisa WHERE cod_art_for = %s", codArtFor);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ public class ArticoliDTO implements Serializable {
|
||||
private BigDecimal prezzo_base;
|
||||
@SqlField
|
||||
private BigDecimal val_scatto;
|
||||
@SqlField
|
||||
private short num_min_art_col;
|
||||
|
||||
private List<ColoriDTO> colori = new ArrayList<ColoriDTO>();
|
||||
|
||||
@@ -141,4 +143,13 @@ public class ArticoliDTO implements Serializable {
|
||||
public void setVal_scatto(BigDecimal val_scatto) {
|
||||
this.val_scatto = val_scatto;
|
||||
}
|
||||
|
||||
public short getNum_min_art_col() {
|
||||
return num_min_art_col;
|
||||
}
|
||||
|
||||
public ArticoliDTO setNum_min_art_col(short num_min_art_col) {
|
||||
this.num_min_art_col = num_min_art_col;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,8 @@ public class UtenteDTO implements Serializable {
|
||||
private String nomeAzienda;
|
||||
@SqlField
|
||||
private String recTelObbligatorio;
|
||||
@SqlField
|
||||
private String nomeNegozioRequired;
|
||||
|
||||
public UtenteDTO(String user_name, String full_name, String user_code,
|
||||
String cod_vlis_newclie, String cod_anag_newclie, BigDecimal sc1, BigDecimal sc2, String cod_paga) {
|
||||
@@ -186,4 +188,12 @@ public class UtenteDTO implements Serializable {
|
||||
this.recTelObbligatorio = recTelObbligatorio;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public String getNomeNegozioRequired() {
|
||||
return nomeNegozioRequired;
|
||||
}
|
||||
|
||||
public void setNomeNegozioRequired(String nomeNegozioRequired) {
|
||||
this.nomeNegozioRequired = nomeNegozioRequired;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import it.integry.ems_model.entity.WtbFavoriteArt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -46,6 +47,7 @@ import java.sql.ResultSet;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -69,7 +71,7 @@ public class OrdikidsService {
|
||||
private EntityProcessor entityProcessor;
|
||||
|
||||
public LoginDTO login(String md5Agente) throws Exception {
|
||||
String sql, flag_bloccoPagaClie, flag_bloccoPagaNewClie, flag_bloccoListino, flag_bloccoMenuListini, elencoListini, condListini, flag_moltip, flag_vendAsso;
|
||||
String sql, flag_bloccoPagaClie, flag_bloccoPagaNewClie, flag_nomeNegozioRequired, flag_bloccoListino, flag_bloccoMenuListini, elencoListini, condListini, flag_moltip, flag_vendAsso;
|
||||
PreparedStatement ps;
|
||||
|
||||
Map<String, String> DatiAgente = getCond_vvwClientiAgenti(md5Agente);
|
||||
@@ -110,28 +112,14 @@ public class OrdikidsService {
|
||||
}
|
||||
rs.close();
|
||||
|
||||
flag_bloccoPagaClie = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "BLOCCO_PAGA_CLIE");
|
||||
if (flag_bloccoPagaClie.compareTo("") == 0) {
|
||||
flag_bloccoPagaClie = "N";
|
||||
}
|
||||
utente.setBloccoPagaClie(flag_bloccoPagaClie);
|
||||
HashMap<String, String> setupSection = setupGest.getSetupSection(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP");
|
||||
|
||||
flag_bloccoPagaNewClie = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "BLOCCO_PAGA_NEWCLIE");
|
||||
if (flag_bloccoPagaNewClie.compareTo("") == 0) {
|
||||
flag_bloccoPagaNewClie = "N";
|
||||
}
|
||||
utente.setBloccoPagaNewClie(flag_bloccoPagaNewClie);
|
||||
|
||||
flag_moltip = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "MOLTIP_BARCODEMODE");
|
||||
if (flag_moltip.compareTo("") == 0) {
|
||||
flag_moltip = "S";
|
||||
}
|
||||
utente.setMoltipl_barcodemode(flag_moltip);
|
||||
|
||||
flag_vendAsso = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "VEND_ASSO_OBBLIGATORIO");
|
||||
utente.setVend_asso_obbligatorio(flag_vendAsso);
|
||||
|
||||
utente.setRecTelObbligatorio(setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "REC_TEL_OBBLIGATORIO"));
|
||||
utente.setBloccoPagaClie(UtilityHashMap.getValueIfExists(setupSection, "BLOCCO_PAGA_CLIE", "N"));
|
||||
utente.setBloccoPagaNewClie(UtilityHashMap.getValueIfExists(setupSection, "BLOCCO_PAGA_NEWCLIE", "N"));
|
||||
utente.setNomeNegozioRequired(UtilityHashMap.getValueIfExists(setupSection, "NOME_NEGOZIO_REQUIRED", "N"));
|
||||
utente.setMoltipl_barcodemode(UtilityHashMap.getValueIfExists(setupSection, "MOLTIP_BARCODEMODE", "S"));
|
||||
utente.setVend_asso_obbligatorio(UtilityHashMap.getValueIfExists(setupSection, "VEND_ASSO_OBBLIGATORIO"));
|
||||
utente.setRecTelObbligatorio(UtilityHashMap.getValueIfExists(setupSection, "REC_TEL_OBBLIGATORIO"));
|
||||
|
||||
sql = "SELECT gtb_paga.cod_paga,\n" +
|
||||
" gtb_paga.descrizione,\n" +
|
||||
@@ -150,38 +138,43 @@ public class OrdikidsService {
|
||||
List<ElencoListiniDTO> ElencoListiniMenu = new ArrayList<>();
|
||||
flag_bloccoMenuListini = "S"; //Inizializzazione con il blocco del menu
|
||||
|
||||
flag_bloccoListino = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "BLOCCO_LISTINO");
|
||||
if (flag_bloccoListino.compareTo("") == 0 || flag_bloccoListino.compareTo("S") == 0) {
|
||||
flag_bloccoListino = setupSection.get("BLOCCO_LISTINO");
|
||||
if (flag_bloccoListino.equalsIgnoreCase("") || flag_bloccoListino.equalsIgnoreCase("S")) {
|
||||
//S acquisisce il listino Esclusivamente dalle categorie di sconto, il menu è bloccato
|
||||
flag_bloccoMenuListini = "S";
|
||||
ElencoListiniMenu.add(0, new ElencoListiniDTO("", "IN FUNZIONE DELLA LINEA"));
|
||||
} else {
|
||||
if (flag_bloccoListino.compareTo("N") == 0) {
|
||||
if (flag_bloccoListino.equalsIgnoreCase("N")) {
|
||||
//N consente di scegliere o il calcolo in base alle categorie di sconto o
|
||||
// un listino diverso se presenti in ELENCO_LISTINI
|
||||
// il menu è attivo
|
||||
flag_bloccoMenuListini = flag_bloccoListino;
|
||||
ElencoListiniMenu.add(0, new ElencoListiniDTO("", "IN FUNZIONE DELLA LINEA"));
|
||||
} else if (flag_bloccoListino.compareTo("L") == 0) {
|
||||
} else if (flag_bloccoListino.equalsIgnoreCase("L")) {
|
||||
//se L consente di scegliere solo uno dei listini presenti in ELENCO_LISTINI
|
||||
// il menu è attivo
|
||||
flag_bloccoMenuListini = "N";
|
||||
}
|
||||
|
||||
List<ElencoListiniDTO> ElencoListini;
|
||||
elencoListini = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "ELENCO_LISTINI");
|
||||
if (elencoListini.compareTo("") != 0) {
|
||||
condListini = "'" + elencoListini.replaceAll(",", "', '") + "' ";
|
||||
elencoListini = setupSection.get("ELENCO_LISTINI");
|
||||
|
||||
if (!elencoListini.equalsIgnoreCase("")) {
|
||||
condListini = "'" + elencoListini.replaceAll(",", "', '") + "' ";
|
||||
sql = "SELECT cod_vlis, descrizione FROM vtb_list WHERE cod_vlis IN ( " + condListini + " ) ";
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
ElencoListini = new ResultSetMapper()
|
||||
.mapResultSetToList(ps.executeQuery(), ElencoListiniDTO.class);
|
||||
if (ElencoListini == null) ElencoListini = new ArrayList<ElencoListiniDTO>();
|
||||
|
||||
if (ElencoListini == null) {
|
||||
ElencoListini = new ArrayList<ElencoListiniDTO>();
|
||||
}
|
||||
|
||||
ps.close();
|
||||
ElencoListiniMenu.addAll(ElencoListini);
|
||||
}
|
||||
}
|
||||
|
||||
utente.setBloccoListino(flag_bloccoMenuListini);
|
||||
|
||||
sql = "SELECT top 1 Convert(varchar(10), dateupd , 121) as dateupd "
|
||||
@@ -220,7 +213,7 @@ public class OrdikidsService {
|
||||
ps.close();
|
||||
|
||||
List<CategorieClienteDTO> categorie;
|
||||
String flag_invioCategorie = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "INVIO_CATEGORIE_SCONTO");
|
||||
String flag_invioCategorie = setupSection.get("INVIO_CATEGORIE_SCONTO");
|
||||
// if("S".equals(flag_invioCategorie)){
|
||||
|
||||
sql = "SELECT DISTINCT vvw_clienti_agenti.cod_sco_cli, vtb_sccl.descrizione, "
|
||||
@@ -247,7 +240,7 @@ public class OrdikidsService {
|
||||
}
|
||||
|
||||
List<ModuloPvmDTO> moduliPvm = new ArrayList<>();
|
||||
String jsonModuliPvm = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "MODULI_PVM");
|
||||
String jsonModuliPvm = setupSection.get("MODULI_PVM");
|
||||
if (jsonModuliPvm != null && jsonModuliPvm.length() > 0) {
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -394,9 +387,6 @@ public class OrdikidsService {
|
||||
private List<ArticoliDTO> getListArticoli(String codVage, String tableName) throws Exception {
|
||||
boolean overProduction = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "ORDIKIDS", "SETUP", "VEND_OVER_PRODUCTION");
|
||||
|
||||
List<ArticoliDTO> articoli = null;
|
||||
PreparedStatement ps, psArt;
|
||||
|
||||
String sql =
|
||||
"SELECT ttb_style.cod_style, " +
|
||||
" mtb_aart.descrizione, " +
|
||||
@@ -406,9 +396,11 @@ public class OrdikidsService {
|
||||
" 'N' AS chiedi_disp, " +
|
||||
" mtb_aart.cod_sco_art, " +
|
||||
" ttb_style.prezzo_base, " +
|
||||
" ttb_style.val_scatto " +
|
||||
" ttb_style.val_scatto, " +
|
||||
" ttb_line.num_min_art_col " +
|
||||
"FROM tvvw_agen_line INNER JOIN ttb_style ON tvvw_agen_line.cod_line = ttb_style.cod_line and ttb_style.anno_stag = tvvw_agen_line.anno_stag " +
|
||||
" INNER JOIN mtb_aart ON ttb_style.cod_style = mtb_aart.cod_mart " +
|
||||
" INNER JOIN ttb_line ON ttb_style.cod_line = ttb_line.cod_line " +
|
||||
"WHERE tvvw_agen_line.cod_vage =" + UtilityDB.valueToString(codVage) + " AND " +
|
||||
" CONVERT(VARCHAR, GETDATE(), 111) BETWEEN tvvw_agen_line.data_iniz_ord AND tvvw_agen_line.data_fine_ord AND " +
|
||||
" tvvw_agen_line.data_iniz_ord >= tvvw_agen_line.first_data_iniz_ord AND " +
|
||||
@@ -435,39 +427,37 @@ public class OrdikidsService {
|
||||
" CASE WHEN qta_ord_prod > 0 THEN 'S' ELSE 'N'END AS chiedi_disp, " +
|
||||
" art.cod_sco_art, " +
|
||||
" art.prezzo_base, " +
|
||||
" art.val_scatto " +
|
||||
" art.val_scatto, " +
|
||||
" art.num_min_art_col " +
|
||||
" FROM art left outer join ordP on art.cod_style = ordP.cod_mart ";
|
||||
}
|
||||
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
|
||||
articoli = new ResultSetMapper()
|
||||
.mapResultSetToList(ps.executeQuery(), ArticoliDTO.class);
|
||||
List<ArticoliDTO> articoli = new ResultSetMapper()
|
||||
.mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, ArticoliDTO.class);
|
||||
if (articoli == null) articoli = new ArrayList<>();
|
||||
ps.close();
|
||||
|
||||
sql = "SELECT ttb_style.cod_style, mtb_aart.descrizione, ttb_style.des_estera, " +
|
||||
" ttb_style.flag_asso, 'S' chiedi_disp, " +
|
||||
" mtb_aart.cod_sco_art, ttb_style.prezzo_base, ttb_style.val_scatto " +
|
||||
" mtb_aart.cod_sco_art, ttb_style.prezzo_base, ttb_style.val_scatto, " +
|
||||
" ttb_line.num_min_art_col " +
|
||||
"FROM tvvw_agen_line INNER JOIN ttb_style ON tvvw_agen_line.cod_line = ttb_style.cod_line and tvvw_agen_line.anno_stag = ttb_style.anno_stag " +
|
||||
" INNER JOIN mtb_aart ON ttb_style.cod_style = mtb_aart.cod_mart " +
|
||||
" INNER JOIN ttb_line ON ttb_style.cod_line = ttb_line.cod_line " +
|
||||
" INNER JOIN (Select cod_style " +
|
||||
" from dbo.ftx_getDisponibilitaArticoli( CONVERT(varchar, GETDATE(), 111), null, null, null, null, null, null)tab " +
|
||||
" from dbo.ftx_getDisponibilitaArticoli( CAST(GETDATE() as DATE), null, null, null, null, null, null)tab " +
|
||||
" Where tab.qta_disp > 0 " +
|
||||
" Group by cod_style ) disponib ON ttb_style.cod_style = disponib.cod_style " +
|
||||
" WHERE tvvw_agen_line.cod_vage =" + UtilityDB.valueToString(codVage) + " AND " +
|
||||
" CONVERT(VARCHAR, GETDATE(), 111) BETWEEN tvvw_agen_line.data_iniz_riord AND tvvw_agen_line.data_fine_riord AND " +
|
||||
" CAST(GETDATE() as DATE) BETWEEN tvvw_agen_line.data_iniz_riord AND tvvw_agen_line.data_fine_riord AND " +
|
||||
" tvvw_agen_line.data_iniz_riord >= tvvw_agen_line.first_data_iniz_riord AND " +
|
||||
" ttb_style.flag_listino = 'S' ";
|
||||
|
||||
psArt = multiDBTransactionManager.prepareStatement(sql);
|
||||
|
||||
List<ArticoliDTO> articoliPronto = new ResultSetMapper()
|
||||
.mapResultSetToList(psArt.executeQuery(), ArticoliDTO.class);
|
||||
.mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, ArticoliDTO.class);
|
||||
|
||||
if (articoliPronto == null) articoliPronto = new ArrayList<>();
|
||||
articoli.addAll(articoliPronto);
|
||||
psArt.close();
|
||||
|
||||
//CREAZIONE TABELLA TEMPORANEA CHE DOVRA' CONTENERE TUTTE LE ISTANZE DELLA CLASSE ArticoliDTO
|
||||
if (!UtilityString.isNullOrEmpty(tableName)) {
|
||||
@@ -479,7 +469,8 @@ public class OrdikidsService {
|
||||
+ " chiedi_disp varchar(1),"
|
||||
+ " cod_sco_art varchar(5),"
|
||||
+ " prezzo_base decimal(20, 5), "
|
||||
+ " val_scatto decimal(20, 5)) ";
|
||||
+ " val_scatto decimal(20, 5), "
|
||||
+ " num_min_art_col tinyint) ";
|
||||
|
||||
PreparedStatement info = multiDBTransactionManager.prepareStatement(sql);
|
||||
info.executeUpdate();
|
||||
@@ -505,52 +496,37 @@ public class OrdikidsService {
|
||||
List<CodBarreDTO> codBarre = null;
|
||||
List<ArticoliDTO> articoli = null;
|
||||
|
||||
Map<String, String> DatiAgente = new HashMap<String, String>();
|
||||
DatiAgente = getCond_vvwClientiAgenti(md5User);
|
||||
Map<String, String> DatiAgente = getCond_vvwClientiAgenti(md5User);
|
||||
|
||||
if (DatiAgente.size() > 0) {
|
||||
PreparedStatement ps;
|
||||
String sql;
|
||||
|
||||
String codVage = DatiAgente.get("cod_vage");
|
||||
|
||||
//ACQUISIZIONE ELENCO ARTICOLI
|
||||
String tableName = UtilityDB.defTmpTabName("t1_");
|
||||
articoli = this.getListArticoli(codVage, tableName);
|
||||
articoli = this.getListArticoli(codVage);
|
||||
|
||||
List<String> articoliCodStyles = new ArrayList<String>();
|
||||
|
||||
for (ArticoliDTO articoliDTO : articoli) {
|
||||
articoliCodStyles.add(articoliDTO.getCod_style());
|
||||
}
|
||||
List<String> articoliCodStyles = articoli.stream().map(x -> x.getCod_style()).collect(Collectors.toList());
|
||||
|
||||
String articoliInVector = "'" + Joiner.on("','").skipNulls().join(articoliCodStyles) + "'";
|
||||
|
||||
sql = "SELECT ttb_style_colori.cod_col, ttb_style_colori.descrizione, ttb_style_colori.cod_style, "
|
||||
String sql = "SELECT ttb_style_colori.cod_col, ttb_style_colori.descrizione, ttb_style_colori.cod_style, "
|
||||
+ "CASE WHEN ttb_style_colori.cod_col = ttb_style.cod_col_camp THEN 'S' ELSE 'N' end as flag_campione "
|
||||
+ "FROM ttb_style_colori "
|
||||
+ "left outer join ttb_style ON ttb_style.cod_style = ttb_style_colori.cod_style "
|
||||
+ "WHERE ttb_style_colori.flag_attivo = 'S' AND ttb_style_colori.cod_style IN(" + articoliInVector + ")";
|
||||
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
|
||||
List<ColoriDTO> coloriFull = new ResultSetMapper()
|
||||
.mapResultSetToList(ps.executeQuery(), ColoriDTO.class);
|
||||
if (coloriFull == null) coloriFull = new ArrayList<ColoriDTO>();
|
||||
ps.close();
|
||||
.mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, ColoriDTO.class);
|
||||
if (coloriFull == null) coloriFull = new ArrayList<>();
|
||||
|
||||
sql = "SELECT cod_tagl, num_scatto, costo, cod_style, pos FROM ttb_style_taglie WHERE flag_attivo = 'S' AND cod_style IN(" + articoliInVector + ") ORDER BY cod_style, pos";
|
||||
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
List<TaglieDTO> taglieFull = new ResultSetMapper()
|
||||
.mapResultSetToList(ps.executeQuery(), TaglieDTO.class);
|
||||
if (taglieFull == null) taglieFull = new ArrayList<TaglieDTO>();
|
||||
ps.close();
|
||||
.mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, TaglieDTO.class);
|
||||
if (taglieFull == null) taglieFull = new ArrayList<>();
|
||||
|
||||
for (ArticoliDTO articoloDTO : articoli) {
|
||||
List<ColoriDTO> coloriOLDStyle = new ArrayList<ColoriDTO>();
|
||||
for (ColoriDTO colore : coloriFull) {
|
||||
if (colore.getCodStyle().equalsIgnoreCase(articoloDTO.getCod_style())) coloriOLDStyle.add(colore);
|
||||
}
|
||||
List<ColoriDTO> coloriOLDStyle =
|
||||
coloriFull.stream().filter(x -> x.getCodStyle().equalsIgnoreCase(articoloDTO.getCod_style())).collect(Collectors.toList());
|
||||
|
||||
articoloDTO.setColori(coloriOLDStyle);
|
||||
|
||||
@@ -573,22 +549,7 @@ public class OrdikidsService {
|
||||
+ " mtb_lisv.cod_mart = ttb_lisv_taglie.cod_style AND "
|
||||
+ " ttb_lisv_taglie.cod_style + ttb_lisv_taglie.cod_tagl IN(" + codStyleTaglInVector + ")";
|
||||
|
||||
List<ListiniTaglieDTO> listiniFull = new ArrayList<ListiniTaglieDTO>();
|
||||
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
ListiniTaglieDTO dto = new ListiniTaglieDTO();
|
||||
dto.setCod_vlis(rs.getString("cod_vlis"));
|
||||
dto.setPrz_vend(rs.getBigDecimal("prz_vend"));
|
||||
dto.setRicarica(rs.getBigDecimal("ricarica"));
|
||||
dto.setCodStyleTagl(rs.getString("style_tagl"));
|
||||
listiniFull.add(dto);
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
List<ListiniTaglieDTO> listiniFull = new ResultSetMapper().mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, ListiniTaglieDTO.class);
|
||||
|
||||
for (TaglieDTO tagliaDTO : articoloDTO.getTaglie()) {
|
||||
List<ListiniTaglieDTO> listiniOLDStyle = new ArrayList<ListiniTaglieDTO>();
|
||||
@@ -608,23 +569,22 @@ public class OrdikidsService {
|
||||
sql = "SELECT isNull(mtb_aart.cod_mart_stat, mtb_aart.cod_mart) as cod_style, "
|
||||
+ " null as cod_asso,"
|
||||
+ " cod_barre "
|
||||
+ " FROM " + tableName + " as TabArt, ttb_bar_code, mtb_aart "
|
||||
+ " WHERE isNull(mtb_aart.cod_mart_stat, mtb_aart.cod_mart) = TabArt.cod_style AND "
|
||||
+ " FROM ttb_bar_code, mtb_aart "
|
||||
+ " WHERE isNull(mtb_aart.cod_mart_stat, mtb_aart.cod_mart)IN (" + articoliInVector + ") AND "
|
||||
+ " mtb_aart.cod_mart = ttb_bar_code.cod_style"
|
||||
+ " UNION "
|
||||
+ " SELECT isNull(mtb_aart.cod_mart_stat, mtb_aart.cod_mart) as cod_style, "
|
||||
+ " ttb_style_ass.cod_asso, "
|
||||
+ " ttb_style_ass.cod_barre "
|
||||
+ " FROM " + tableName + " as TabArt, ttb_style_ass, mtb_aart "
|
||||
+ " WHERE isNull(mtb_aart.cod_mart_stat, mtb_aart.cod_mart) = TabArt.cod_style AND "
|
||||
+ " FROM ttb_style_ass, mtb_aart "
|
||||
+ " WHERE isNull(mtb_aart.cod_mart_stat, mtb_aart.cod_mart) IN (" + articoliInVector + ") AND "
|
||||
+ " mtb_aart.cod_mart = ttb_style_ass.cod_style "
|
||||
+ "ORDER BY 1, 2";
|
||||
|
||||
ps = multiDBTransactionManager.prepareStatement(sql);
|
||||
|
||||
codBarre = new ResultSetMapper().mapResultSetToList(ps.executeQuery(), CodBarreDTO.class);
|
||||
if (codBarre == null) codBarre = new ArrayList<CodBarreDTO>();
|
||||
ps.close();
|
||||
codBarre = new ResultSetMapper().mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, CodBarreDTO.class);
|
||||
if (codBarre == null) codBarre = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
if (articoli == null) {
|
||||
@@ -632,7 +592,7 @@ public class OrdikidsService {
|
||||
}
|
||||
|
||||
if (codBarre == null) {
|
||||
codBarre = new ArrayList<CodBarreDTO>();
|
||||
codBarre = new ArrayList<>();
|
||||
}
|
||||
|
||||
return new ArticoliCodbarreDTO(articoli, codBarre);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ImportGrigliaAcquistoService {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryConnection();
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(conn, type, format);
|
||||
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(setup, requestDTO);
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(requestDTO);
|
||||
|
||||
List<AtbGriglieArt> atbGriglieArtList = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -694,36 +694,17 @@ public class ImportListiniVenditaService {
|
||||
public List<EntityBase> importListinoCarelli(String type, String format, ImportRequestDTO requestDTO, List<AnomalieDTO> anomalie, boolean headless) throws Exception {
|
||||
List<EntityBase> entityList = null;
|
||||
Date dataInizio = null, dataFine = null, localDate = new Date(), currentDataInizio = null, currentDataFine;
|
||||
boolean areDatesEqual = true;
|
||||
boolean areDatesEqual = true, isVolantino = format.equalsIgnoreCase(ListiniVenditaImporter.Format.VOLANTINI.toString());
|
||||
List<MtbLisvData> listMtbLisvData = new ArrayList<>();
|
||||
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
boolean isVolantino = format.equalsIgnoreCase(ListiniVenditaImporter.Format.VOLANTINI.toString());
|
||||
String path = setup.get("PATH_FILE");
|
||||
|
||||
String fileName = requestDTO.getFileName();
|
||||
if (UtilityString.isNullOrEmpty(fileName))
|
||||
fileName = setup.get("FILE_FILTER");
|
||||
|
||||
if (!path.endsWith("\\") || !path.endsWith("/")) {
|
||||
path = path + File.separator;
|
||||
}
|
||||
|
||||
List<MtbLisvData> listMtbLisvData = new ArrayList<>();
|
||||
|
||||
FileInputStream file = new FileInputStream(path + fileName);
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(file);
|
||||
XSSFSheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
// Ignora la prima riga (header)
|
||||
Iterator<Row> rowIterator = sheet.iterator();
|
||||
if (rowIterator.hasNext()) {
|
||||
rowIterator.next();
|
||||
}
|
||||
|
||||
// Verifica se il foglio di lavoro è vuoto
|
||||
if (!rowIterator.hasNext()) {
|
||||
throw new Exception("Il file è vuoto.");
|
||||
}
|
||||
Iterator<Row> rowIterator = UtilityExcel.readXlsxFile(requestDTO);
|
||||
|
||||
while (rowIterator.hasNext()) {
|
||||
Row row = rowIterator.next();
|
||||
@@ -737,7 +718,7 @@ public class ImportListiniVenditaService {
|
||||
String articolo = fillString(UtilityExcel.getCellAsString(row, 1), 9);
|
||||
|
||||
if (articolo.isEmpty())
|
||||
throw new Exception("Il codice articolo è vuoto.");
|
||||
throw new Exception(String.format("Il codice articolo è vuoto. (Riga: %s)", row.getRowNum() + 1));
|
||||
|
||||
|
||||
String dataInizioString = dataInizioFine(true, row);
|
||||
@@ -750,7 +731,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
// Verifica che dataInizio sia maggiore di localDate
|
||||
if (currentDataInizio.compareTo(localDate) <= 0) {
|
||||
throw new Exception("La data di inizio è precedente o uguale alla data corrente.");
|
||||
throw new Exception(String.format("La data di inizio è precedente o uguale alla data corrente. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
// Controlla se la data di inizio è diversa dalla prima data
|
||||
@@ -762,7 +743,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
dataInizio = currentDataInizio;
|
||||
}else{
|
||||
throw new Exception("La data inizio è vuota");
|
||||
throw new Exception(String.format("La data inizio è vuota. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
if (!dataFineString.isEmpty()){
|
||||
@@ -770,7 +751,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
// Verifica che dataFine sia maggiore di dataInizio
|
||||
if (currentDataFine.compareTo(currentDataInizio) < 0) {
|
||||
throw new Exception("La data fine è precedente alla data di inizio.");
|
||||
throw new Exception(String.format("La data fine è precedente alla data di inizio. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
// Controlla se la data di inizio è diversa dalla prima data
|
||||
@@ -782,7 +763,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
dataFine = currentDataFine;
|
||||
}else{
|
||||
throw new Exception("La data fine è vuota");
|
||||
throw new Exception(String.format("La data fine è vuota. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
int maxGiorni = Integer.parseInt(setupGest.getSetup(
|
||||
@@ -794,14 +775,14 @@ public class ImportListiniVenditaService {
|
||||
if(maxGiorni != 0){
|
||||
int count = UtilityDate.DaysAfter(dataInizio, dataFine);
|
||||
if(count > maxGiorni){
|
||||
throw new Exception("Differenza tra data inizio e data fine maggiore di: " + maxGiorni);
|
||||
throw new Exception(String.format("Differenza tra data inizio e data fine maggiore di: %s (Riga: %s)", maxGiorni, row.getRowNum() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
BigDecimal prezzo = getPrezzoAsBigDecimal(row.getCell(4));
|
||||
|
||||
if (prezzo.compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new Exception("Il prezzo è uguale a zero.");
|
||||
throw new Exception(String.format("Il prezzo è uguale a zero. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
MtbLisvData riga = new MtbLisvData();
|
||||
@@ -831,8 +812,6 @@ public class ImportListiniVenditaService {
|
||||
listMtbLisvData.add(riga);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
// Verifica che tutte le date siano uguali
|
||||
if(isVolantino && !areDatesEqual) {
|
||||
throw new Exception("Le date non sono tutte uguali.");
|
||||
@@ -892,7 +871,6 @@ public class ImportListiniVenditaService {
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
return entityList;
|
||||
}
|
||||
|
||||
|
||||
@@ -401,7 +401,7 @@ public class ListiniVenditaServices {
|
||||
.setDataIniz(x.getDataIniz())
|
||||
.setDataFine(x.getDataFine())
|
||||
.setDescrPromo(x.getDescrPromo())
|
||||
.setNote(x.getNote());
|
||||
.setNote(x.getNoteLisv());
|
||||
return vtbListData;
|
||||
}
|
||||
).toList();
|
||||
|
||||
Reference in New Issue
Block a user