Merge branch 'develop' into feature/Syncronizations
This commit is contained in:
@@ -549,7 +549,6 @@
|
|||||||
<option value="$PROJECT_DIR$/ems-retail/pom.xml" />
|
<option value="$PROJECT_DIR$/ems-retail/pom.xml" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="PWA">
|
<component name="PWA">
|
||||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||||
@@ -952,6 +951,44 @@
|
|||||||
</option>
|
</option>
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration default="false" name="Tomcat 7 #1 (ServerDev)" type="Remote">
|
||||||
|
<module name="ems-engine" />
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" />
|
||||||
|
<option name="HOST" value="serverdev" />
|
||||||
|
<option name="PORT" value="8001" />
|
||||||
|
<option name="AUTO_RESTART" value="false" />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="8001" />
|
||||||
|
<option name="LOCAL" value="false" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="false" name="Tomcat 9 #2 (ServerDev)" type="Remote">
|
||||||
|
<module name="ems-engine" />
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" />
|
||||||
|
<option name="HOST" value="serverdev" />
|
||||||
|
<option name="PORT" value="8002" />
|
||||||
|
<option name="AUTO_RESTART" value="false" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="false" name="Tomcat #1 (ServerTomcat)" type="Remote">
|
||||||
|
<module name="ems-engine" />
|
||||||
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
|
<option name="SERVER_MODE" value="false" />
|
||||||
|
<option name="SHMEM_ADDRESS" />
|
||||||
|
<option name="HOST" value="servertomcat" />
|
||||||
|
<option name="PORT" value="8000" />
|
||||||
|
<option name="AUTO_RESTART" value="false" />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="8000" />
|
||||||
|
<option name="LOCAL" value="false" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
<property name="settings.editor.selected.configurable" value="configurable.group.editor" />
|
<property name="settings.editor.selected.configurable" value="configurable.group.editor" />
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import it.integry.ems.settings.Model.SettingsModel;
|
|||||||
import it.integry.ems.settings.SettingsController;
|
import it.integry.ems.settings.SettingsController;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
import it.integry.ems.sync.MultiDBTransaction.AdvancedDataSource;
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
import it.integry.ems.utility.UtilityDebug;
|
||||||
|
import it.integry.ems_model.entity.StbGestSetup;
|
||||||
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||||
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.Query;
|
import it.integry.ems_model.utility.Query;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -67,6 +69,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
|||||||
return val != null && val == 1;
|
return val != null && val == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void renameColumn(Connection connection, String tableName, String oldColumnname, String newColumnName) throws SQLException {
|
||||||
|
String sql = "exec sp_rename 'dbo." + tableName + "." + oldColumnname + "', " + newColumnName + ", 'COLUMN'";
|
||||||
|
executeStatement(connection, sql);
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean existsTable(Connection connection, String tableName) throws SQLException {
|
protected boolean existsTable(Connection connection, String tableName) throws SQLException {
|
||||||
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N%s", tableName);
|
String sql = Query.format("SELECT CAST(COUNT(*) AS BIT) AS exist FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N%s", tableName);
|
||||||
|
|
||||||
@@ -102,4 +109,34 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
|||||||
String dropSql = "DROP TABLE " + tableName;
|
String dropSql = "DROP TABLE " + tableName;
|
||||||
executeStatement(connection, dropSql);
|
executeStatement(connection, dropSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void createSetup(Connection connection, String gestName, String section, String keySection, String value, String description, String codQuery) throws Exception {
|
||||||
|
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||||
|
.setGestName(gestName)
|
||||||
|
.setSection(section)
|
||||||
|
.setKeySection(keySection)
|
||||||
|
.setValue(value)
|
||||||
|
.setDescription(description)
|
||||||
|
.setQueryDefault(codQuery);
|
||||||
|
|
||||||
|
stbGestSetup.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
|
stbGestSetup.manageWithParentConnection(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void deleteSetup(Connection connection, String gestName, String section, String keySection) throws Exception {
|
||||||
|
StbGestSetup stbGestSetup = new StbGestSetup()
|
||||||
|
.setGestName(gestName)
|
||||||
|
.setSection(section)
|
||||||
|
.setKeySection(keySection);
|
||||||
|
|
||||||
|
stbGestSetup.setOperation(OperationType.DELETE);
|
||||||
|
stbGestSetup.manageWithParentConnection(connection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_20240219094933 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String sql = "ALTER TABLE mtb_colt\n" +
|
||||||
|
" ADD barcode_ul VARCHAR(20)";
|
||||||
|
|
||||||
|
executeStatement(advancedDataSource.getConnection(), sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20240219103840 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup(advancedDataSource.getConnection(),
|
||||||
|
"PICKING", "ACCETTAZIONE", "FLAG_ALLOW_BARCODE_FORNITORE", "N",
|
||||||
|
"Abilita la possibilità di effettuare l'accettazione merci utilizzando direttamente l'SSCC del fornitore (salvato poi nella colonna barcode_pedana)",
|
||||||
|
"SI_NO");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.itextpdf.text.PageSize;
|
|||||||
import com.itextpdf.text.pdf.PdfPTable;
|
import com.itextpdf.text.pdf.PdfPTable;
|
||||||
import com.itextpdf.text.pdf.PdfWriter;
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
import com.itextpdf.tool.xml.XMLWorkerHelper;
|
import com.itextpdf.tool.xml.XMLWorkerHelper;
|
||||||
|
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.enums.DigitalSignatureType;
|
import it.integry.ems.utility.enums.DigitalSignatureType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
@@ -12,6 +13,7 @@ import it.integry.ems_model.utility.UtilityString;
|
|||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bouncycastle.cms.CMSSignedData;
|
import org.bouncycastle.cms.CMSSignedData;
|
||||||
@@ -31,6 +33,7 @@ import java.nio.file.*;
|
|||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -413,4 +416,21 @@ public class UtilityFile {
|
|||||||
}
|
}
|
||||||
return cleanName.toString();
|
return cleanName.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void moveFile(@NotNull String path, @NotNull String newPath, @NotNull String fileName, String newFileName) throws Exception {
|
||||||
|
if (!path.endsWith("\\") || !path.endsWith("/"))
|
||||||
|
path = path + File.separator;
|
||||||
|
|
||||||
|
if (!newPath.endsWith("\\") || !newPath.endsWith("/"))
|
||||||
|
newPath = newPath + File.separator;
|
||||||
|
|
||||||
|
if (newFileName == null)
|
||||||
|
newFileName = fileName;
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileUtils.moveFile(new File(path + fileName), new File(newPath + newFileName));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new Exception("Impossibile spostare il file");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import it.integry.ems_model.types.OperationType;
|
|||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -162,6 +161,9 @@ public class MtbColt extends EntityBase {
|
|||||||
@SqlField("id_lotto")
|
@SqlField("id_lotto")
|
||||||
private Integer idLotto;
|
private Integer idLotto;
|
||||||
|
|
||||||
|
@SqlField(value = "barcode_ul", nullable = true, maxLength = 20)
|
||||||
|
private String barcodeUl;
|
||||||
|
|
||||||
private String insPartitaMag;
|
private String insPartitaMag;
|
||||||
|
|
||||||
private transient String stpPrz;
|
private transient String stpPrz;
|
||||||
@@ -610,6 +612,15 @@ public class MtbColt extends EntityBase {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBarcodeUl() {
|
||||||
|
return barcodeUl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt setBarcodeUl(String barcodeUl) {
|
||||||
|
this.barcodeUl = barcodeUl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<MtbColr> getMtbColr() {
|
public List<MtbColr> getMtbColr() {
|
||||||
return mtbColr;
|
return mtbColr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ import it.integry.ems_model.base.EntityBase;
|
|||||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
import org.springframework.web.context.ContextLoader;
|
import org.springframework.web.context.ContextLoader;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -304,7 +302,7 @@ public class VtbOfft extends EntityBase {
|
|||||||
UtilityDB.valueToString(getIdOfferta()));
|
UtilityDB.valueToString(getIdOfferta()));
|
||||||
|
|
||||||
if (!articoli.isEmpty()) {
|
if (!articoli.isEmpty()) {
|
||||||
sql = UtilityDB.addwhereCond(sql, "vtb_offr.cod_mart in ('" + StringUtils.join(articoli, "','") + "'", true);
|
sql = UtilityDB.addwhereCond(sql, "vtb_offr.cod_mart in ('" + StringUtils.join(articoli, "','") + "')", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> artNew = UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
|
List<String> artNew = UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package it.integry.ems_model.entity;
|
package it.integry.ems_model.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import it.integry.ems_model.annotation.Master;
|
import it.integry.ems_model.annotation.Master;
|
||||||
import it.integry.ems_model.annotation.PK;
|
import it.integry.ems_model.annotation.PK;
|
||||||
import it.integry.ems_model.annotation.SqlField;
|
import it.integry.ems_model.annotation.SqlField;
|
||||||
import it.integry.ems_model.annotation.Table;
|
import it.integry.ems_model.annotation.Table;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
|
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -50,6 +52,9 @@ public class VtbViaggi extends EntityBase {
|
|||||||
@SqlField(value = "num_prenotazione", maxLength = 20)
|
@SqlField(value = "num_prenotazione", maxLength = 20)
|
||||||
private String numPrenotazione;
|
private String numPrenotazione;
|
||||||
|
|
||||||
|
@SqlField(value = "mezzo", maxLength = 1, defaultObjectValue = "0")
|
||||||
|
private Mezzo mezzo;
|
||||||
|
|
||||||
public VtbViaggi() {
|
public VtbViaggi() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -128,4 +133,56 @@ public class VtbViaggi extends EntityBase {
|
|||||||
this.numPrenotazione = numPrenotazione;
|
this.numPrenotazione = numPrenotazione;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mezzo getMezzo() {
|
||||||
|
return mezzo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VtbViaggi setMezzo(Mezzo mezzo) {
|
||||||
|
this.mezzo = mezzo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Mezzo implements IBaseEnum<Mezzo> {
|
||||||
|
VETTORE((short) 0),
|
||||||
|
MITTENTE((short) 1),
|
||||||
|
DESTINATARIO((short) 2);
|
||||||
|
|
||||||
|
private final short value;
|
||||||
|
|
||||||
|
Mezzo(final short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Mezzo from(Object value) {
|
||||||
|
short castValue = (short) value;
|
||||||
|
|
||||||
|
for (Mezzo b : Mezzo.values()) {
|
||||||
|
if (b.value == castValue)
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public short getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mezzo fromInternal(Object val) {
|
||||||
|
return from(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package it.integry.ems_model.utility;
|
package it.integry.ems_model.utility;
|
||||||
|
|
||||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.poi.hssf.usermodel.*;
|
import org.apache.poi.hssf.usermodel.*;
|
||||||
import org.apache.poi.hssf.util.HSSFCellUtil;
|
import org.apache.poi.hssf.util.HSSFCellUtil;
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
@@ -133,6 +134,9 @@ public class UtilityExcel {
|
|||||||
if (UtilityString.isNullOrEmpty(fileName))
|
if (UtilityString.isNullOrEmpty(fileName))
|
||||||
fileName = requestDTO.getFileName();
|
fileName = requestDTO.getFileName();
|
||||||
|
|
||||||
|
if (!FilenameUtils.getExtension(fileName).equalsIgnoreCase("xlsx"))
|
||||||
|
throw new Exception("Formato file non supportato");
|
||||||
|
|
||||||
if (!path.endsWith("\\") || !path.endsWith("/"))
|
if (!path.endsWith("\\") || !path.endsWith("/"))
|
||||||
path = path + File.separator;
|
path = path + File.separator;
|
||||||
|
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ end
|
|||||||
rule "completeInsertVtbOfft"
|
rule "completeInsertVtbOfft"
|
||||||
when
|
when
|
||||||
eval(completeRulesEnabled)
|
eval(completeRulesEnabled)
|
||||||
$vtbOfft : VtbOfft(dataIns == null && (operation == OperationType.INSERT || operation == OperationType.INSERT_OR_UPDATE))
|
$vtbOfft : VtbOfft(dataIns == null && (operation == OperationType.INSERT || operation == OperationType.INSERT_OR_UPDATE || operation == OperationType.DELETE_THEN_INSERT))
|
||||||
then
|
then
|
||||||
String fullName = CommonRules.getFullName(conn, username);
|
String fullName = CommonRules.getFullName(conn, username);
|
||||||
modify($vtbOfft) {
|
modify($vtbOfft) {
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package it.integry.core.report_javabean.model.scheda_costi;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class StampaSchedaCostiDTO {
|
||||||
|
|
||||||
|
private String codMart;
|
||||||
|
private String descrArt;
|
||||||
|
private String untMis;
|
||||||
|
private String codVlis;
|
||||||
|
private String descrLisv;
|
||||||
|
private Integer sort;
|
||||||
|
private Integer gruppo;
|
||||||
|
private String descrizioneGruppo;
|
||||||
|
private Integer idCategoria;
|
||||||
|
private String categoria;
|
||||||
|
private String descrCosto;
|
||||||
|
private BigDecimal qtaProd;
|
||||||
|
private BigDecimal costoUnit;
|
||||||
|
private BigDecimal valore;
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrArt() {
|
||||||
|
return descrArt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setDescrArt(String descrArt) {
|
||||||
|
this.descrArt = descrArt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMis() {
|
||||||
|
return untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setUntMis(String untMis) {
|
||||||
|
this.untMis = untMis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIdCategoria() {
|
||||||
|
return idCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setIdCategoria(Integer idCategoria) {
|
||||||
|
this.idCategoria = idCategoria;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaProd() {
|
||||||
|
return qtaProd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setQtaProd(BigDecimal qtaProd) {
|
||||||
|
this.qtaProd = qtaProd;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCostoUnit() {
|
||||||
|
return costoUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setCostoUnit(BigDecimal costoUnit) {
|
||||||
|
this.costoUnit = costoUnit;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValore() {
|
||||||
|
return valore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setValore(BigDecimal valore) {
|
||||||
|
this.valore = valore;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodVlis() {
|
||||||
|
return codVlis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setCodVlis(String codVlis) {
|
||||||
|
this.codVlis = codVlis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrLisv() {
|
||||||
|
return descrLisv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setDescrLisv(String descrLisv) {
|
||||||
|
this.descrLisv = descrLisv;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getGruppo() {
|
||||||
|
return gruppo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setGruppo(Integer gruppo) {
|
||||||
|
this.gruppo = gruppo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizioneGruppo() {
|
||||||
|
return descrizioneGruppo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setDescrizioneGruppo(String descrizioneGruppo) {
|
||||||
|
this.descrizioneGruppo = descrizioneGruppo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategoria() {
|
||||||
|
return categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setCategoria(String categoria) {
|
||||||
|
this.categoria = categoria;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrCosto() {
|
||||||
|
return descrCosto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StampaSchedaCostiDTO setDescrCosto(String descrCosto) {
|
||||||
|
this.descrCosto = descrCosto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package it.integry.core.report_javabean.model.scheda_costi;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import it.integry.core.report_javabean.UtilityReportJavabean;
|
||||||
|
import it.integry.core.report_javabean.model.base.BaseReportJavabean;
|
||||||
|
import it.integry.core.report_javabean.model.base.IReportJavabean;
|
||||||
|
import it.integry.core.report_javabean.model.exception.NoPageProcessedException;
|
||||||
|
import it.integry.ems.json.JSONObjectMapper;
|
||||||
|
import it.integry.ems.product.dto.CategorieCostoProdottoDTO;
|
||||||
|
import it.integry.ems.product.dto.CostoProdottoDTO;
|
||||||
|
import it.integry.ems.report.dto.JasperDTO;
|
||||||
|
import it.integry.ems_model.utility.Query;
|
||||||
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class StampaSchedaCostiJavabean extends BaseReportJavabean implements IReportJavabean {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JSONObjectMapper jsonObjectMapper;
|
||||||
|
|
||||||
|
public static void testRun(java.util.Vector collection) {
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yy");
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
StampaSchedaCostiDTO dto = new StampaSchedaCostiDTO();
|
||||||
|
// dto.setCodMart("abc")
|
||||||
|
// .setCodMdep("pc")
|
||||||
|
// .setDescrDepo("dadsa")
|
||||||
|
// .setDescrArt("aa");
|
||||||
|
collection.add(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void register() {
|
||||||
|
UtilityReportJavabean.registerJavabean("StampaSchedaCosti", StampaSchedaCostiJavabean.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] process(JasperDTO jasperDTO) throws Exception {
|
||||||
|
HashMap<String, Object> paramsMap = reportProcessor.createParamsFromList(jasperDTO.getParams());
|
||||||
|
|
||||||
|
List<Object> javaBeans = this.run(paramsMap);
|
||||||
|
|
||||||
|
if (javaBeans != null) {
|
||||||
|
jasperDTO.setJavaBeans(javaBeans);
|
||||||
|
return reportProcessor.processReport(jasperDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NoPageProcessedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Object> run(HashMap<String, Object> paramsMap) throws Exception {
|
||||||
|
|
||||||
|
List<Object> stampaSchedaCostiDTOS = new ArrayList<>();
|
||||||
|
String sql;
|
||||||
|
|
||||||
|
if (paramsMap.containsKey("cod_vlis")) {
|
||||||
|
sql = Query.format("SELECT mtb_lisv_data.cod_mart,\n" +
|
||||||
|
" ISNULL(mtb_lisv_data.descrizione_html, ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione)) AS descr_art,\n" +
|
||||||
|
" mtb_lisv_data.system_note,\n" +
|
||||||
|
" mtb_lisv_data.unt_mis_ven,\n" +
|
||||||
|
" mtb_lisv_data.cod_vlis,\n" +
|
||||||
|
" vtb_list.descrizione AS descr_lisv\n" +
|
||||||
|
"FROM mtb_lisv_data\n" +
|
||||||
|
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
" INNER JOIN vtb_list ON mtb_lisv_data.cod_vlis = vtb_list.cod_vlis\n" +
|
||||||
|
" INNER JOIN vtb_list_data ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND mtb_lisv_data.versione = vtb_list_data.versione\n" +
|
||||||
|
"WHERE system_note IS NOT NULL\n" +
|
||||||
|
" AND mtb_lisv_data.cod_mart = %s\n" +
|
||||||
|
" AND mtb_lisv_data.cod_vlis = %s\n" +
|
||||||
|
" AND vtb_list_data.data_iniz = %s",
|
||||||
|
paramsMap.get("cod_mart"),
|
||||||
|
paramsMap.get("cod_vlis"),
|
||||||
|
paramsMap.get("data_iniz")
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
sql = Query.format("SELECT vtb_offr.cod_mart,\n" +
|
||||||
|
" ISNULL(vtb_offr.descrizione_html, ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione)) AS descr_art,\n" +
|
||||||
|
" vtb_offr.json_costi AS system_note,\n" +
|
||||||
|
" vtb_offr.unt_mis_vend,\n" +
|
||||||
|
" id_offerta\n" +
|
||||||
|
"FROM vtb_offr\n" +
|
||||||
|
" INNER JOIN mtb_aart ON vtb_offr.cod_mart = mtb_aart.cod_mart\n" +
|
||||||
|
"WHERE json_costi IS NOT NULL\n" +
|
||||||
|
" AND vtb_offr.cod_mart = %s\n" +
|
||||||
|
" AND vtb_offr.id_offerta = %s",
|
||||||
|
paramsMap.get("cod_mart"),
|
||||||
|
paramsMap.get("id_offerta")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String, Object> dati = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
|
if (dati.isEmpty()) return null;
|
||||||
|
|
||||||
|
String systemNote = UtilityHashMap.getValueIfExists(dati, "system_note");
|
||||||
|
if (!UtilityString.isNullOrEmpty(systemNote)) {
|
||||||
|
List<CategorieCostoProdottoDTO> categorieCostoProdotto = new ObjectMapper().readValue(systemNote, new TypeReference<List<CategorieCostoProdottoDTO>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
int idGruppo = 0, idCategoria = 0, idSort = 0;
|
||||||
|
|
||||||
|
for (CategorieCostoProdottoDTO gruppo : categorieCostoProdotto) {
|
||||||
|
String descrizioneGruppo = gruppo.getDescrizione();
|
||||||
|
|
||||||
|
if (gruppo.getCategRows() == null && gruppo.getCategRows().isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (CategorieCostoProdottoDTO categoria : gruppo.getCategRows()) {
|
||||||
|
String descrizioneCategoria = categoria.getDescrizione();
|
||||||
|
|
||||||
|
if (categoria.getRows() == null && categoria.getRows().isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (CostoProdottoDTO row : categoria.getRows()) {
|
||||||
|
StampaSchedaCostiDTO stampaSchedaCostiDTO = new StampaSchedaCostiDTO()
|
||||||
|
.setCodMart(UtilityHashMap.getValueIfExists(dati, "cod_mart"))
|
||||||
|
.setDescrArt(UtilityHashMap.getValueIfExists(dati, "descr_art"))
|
||||||
|
.setCodVlis(UtilityHashMap.getValueIfExists(dati, "cod_vlis"))
|
||||||
|
.setDescrLisv(UtilityHashMap.getValueIfExists(dati, "descr_lisv"))
|
||||||
|
.setGruppo(idGruppo)
|
||||||
|
.setDescrizioneGruppo(descrizioneGruppo)
|
||||||
|
.setIdCategoria(idCategoria)
|
||||||
|
.setCategoria(descrizioneCategoria)
|
||||||
|
.setDescrCosto(row.getDescrizione())
|
||||||
|
.setCostoUnit(row.getCostoUnt())
|
||||||
|
.setQtaProd(row.getQtaProd())
|
||||||
|
.setValore(row.getValore())
|
||||||
|
.setUntMis(row.getUntMis())
|
||||||
|
.setSort(idSort);
|
||||||
|
|
||||||
|
stampaSchedaCostiDTOS.add(stampaSchedaCostiDTO);
|
||||||
|
|
||||||
|
idSort++;
|
||||||
|
}
|
||||||
|
|
||||||
|
idCategoria++;
|
||||||
|
}
|
||||||
|
|
||||||
|
idCategoria = idCategoria + 100;
|
||||||
|
idGruppo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stampaSchedaCostiDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -792,16 +792,7 @@ public class ActivityService {
|
|||||||
" LEFT OUTER JOIN jtb_rlavr ON stb_activity.activity_id = jtb_rlavr.activity_id\n" +
|
" LEFT OUTER JOIN jtb_rlavr ON stb_activity.activity_id = jtb_rlavr.activity_id\n" +
|
||||||
(isTable?"":" AND stb_activity.user_name = '" + username + "'") +
|
(isTable?"":" AND stb_activity.user_name = '" + username + "'") +
|
||||||
" GROUP BY stb_activity.parent_activity_id),\n" +
|
" GROUP BY stb_activity.parent_activity_id),\n" +
|
||||||
"\n";
|
" processi AS (SELECT stb_activity.cod_jcom,\n" +
|
||||||
|
|
||||||
if (daInstallare){
|
|
||||||
sql += "lastUpdt AS (SELECT cod_anag, MAX(effective_date) AS data\n" +
|
|
||||||
" FROM stb_activity\n" +
|
|
||||||
" WHERE activity_type_id = 'aggiornamenti software'\n" +
|
|
||||||
" GROUP BY cod_anag), \n";
|
|
||||||
}
|
|
||||||
|
|
||||||
sql += " processi AS (SELECT stb_activity.cod_jcom,\n" +
|
|
||||||
" stb_activity.user_name,\n" +
|
" stb_activity.user_name,\n" +
|
||||||
" stb_activity.activity_id,\n" +
|
" stb_activity.activity_id,\n" +
|
||||||
" stb_activity.parent_activity_id,\n" +
|
" stb_activity.parent_activity_id,\n" +
|
||||||
@@ -874,11 +865,10 @@ public class ActivityService {
|
|||||||
" LEFT OUTER JOIN integry_tag ON stb_activity.activity_id = integry_tag.activity_id\n";
|
" LEFT OUTER JOIN integry_tag ON stb_activity.activity_id = integry_tag.activity_id\n";
|
||||||
|
|
||||||
if (daInstallare){
|
if (daInstallare){
|
||||||
sql += " LEFT OUTER JOIN lastUpdt ON stb_activity.cod_anag = lastUpdt.cod_anag\n";
|
sql += " LEFT OUTER JOIN integry_last_upd_clie lastUpdt ON stb_activity.cod_anag = lastUpdt.cod_anag\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
sql += " WHERE stb_activity.flag_tipologia = 'P'\n" +
|
sql += " WHERE stb_activity.flag_tipologia = 'P'\n" +
|
||||||
" AND stb_activity.user_name <> 'F0000'\n" +
|
|
||||||
" AND NOT EXISTS(SELECT *\n" +
|
" AND NOT EXISTS(SELECT *\n" +
|
||||||
" FROM escludi_commesse\n" +
|
" FROM escludi_commesse\n" +
|
||||||
" WHERE stb_activity.cod_jcom = escludi_commesse.cod_jcom)\n" +
|
" WHERE stb_activity.cod_jcom = escludi_commesse.cod_jcom)\n" +
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -59,21 +60,20 @@ public class RossoGarganoSyncService {
|
|||||||
String sql =
|
String sql =
|
||||||
"SELECT CAST(FORMAT(DATEPART(YEAR, data_iniz), '0000') +\n" +
|
"SELECT CAST(FORMAT(DATEPART(YEAR, data_iniz), '0000') +\n" +
|
||||||
" FORMAT(DATEPART(MONTH, data_iniz), '00') +\n" +
|
" FORMAT(DATEPART(MONTH, data_iniz), '00') +\n" +
|
||||||
" FORMAT(DATEPART(DAY, data_iniz), '00') AS NUMERIC) as data_iniz,\n" +
|
" FORMAT(DATEPART(DAY, data_iniz), '00') AS NUMERIC) as data_iniz\n" +
|
||||||
" CAST(FORMAT(DATEPART(YEAR, data_fine), '0000') +\n" +
|
|
||||||
" FORMAT(DATEPART(MONTH, data_fine), '00') +\n" +
|
|
||||||
" FORMAT(DATEPART(DAY, data_fine), '00') AS NUMERIC) as data_fine\n" +
|
|
||||||
"FROM azienda\n" +
|
"FROM azienda\n" +
|
||||||
" CROSS APPLY dbo.getperiodoannofisc(azienda.anno_contab)";
|
" CROSS APPLY dbo.getperiodoannofisc(azienda.anno_contab)";
|
||||||
|
|
||||||
HashMap<String, Object> date = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
|
BigDecimal dataIniz = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
if (date == null)
|
sql =
|
||||||
throw new Exception("Errore nel calcolo di data inizio e data fine");
|
"SELECT CAST(FORMAT(DATEPART(YEAR, data_fine), '0000') +\n" +
|
||||||
|
" FORMAT(DATEPART(MONTH, data_fine), '00') +\n" +
|
||||||
|
" FORMAT(DATEPART(DAY, data_fine), '00') AS NUMERIC) as data_fine\n" +
|
||||||
|
"FROM azienda\n" +
|
||||||
|
" CROSS APPLY dbo.getperiodoannofisc(azienda.anno_attuale)";
|
||||||
|
|
||||||
|
BigDecimal dataFine = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
BigDecimal dataIniz = UtilityHashMap.getValueIfExists(date, "data_iniz");
|
|
||||||
BigDecimal dataFine = UtilityHashMap.getValueIfExists(date, "data_fine");
|
|
||||||
|
|
||||||
saveCtbMovt(rgExchange.getConnection(), "(PNOTA.PN_DATA_COMPETENZA = 20210701 AND PN_CAUSALE_MOVIMENTO = '998')", dataIniz, dataFine);
|
saveCtbMovt(rgExchange.getConnection(), "(PNOTA.PN_DATA_COMPETENZA = 20210701 AND PN_CAUSALE_MOVIMENTO = '998')", dataIniz, dataFine);
|
||||||
logger.info("Importazione apertura conti: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
logger.info("Importazione apertura conti: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||||
@@ -81,7 +81,7 @@ public class RossoGarganoSyncService {
|
|||||||
saveCtbMovt(rgExchange.getConnection(), "(PNOTA.PN_SEZIONALE_IVA <> '' AND PN_CAUSALE_MOVIMENTO <> '998')", dataIniz, dataFine);
|
saveCtbMovt(rgExchange.getConnection(), "(PNOTA.PN_SEZIONALE_IVA <> '' AND PN_CAUSALE_MOVIMENTO <> '998')", dataIniz, dataFine);
|
||||||
logger.info("Importazione fatture attive e passive: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
logger.info("Importazione fatture attive e passive: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||||
|
|
||||||
saveCtbMovt(rgExchange.getConnection(), "", dataIniz, dataFine);
|
// saveCtbMovt(rgExchange.getConnection(), "(PN_CAUSALE_MOVIMENTO <> '998')", dataIniz, dataFine);
|
||||||
logger.info("Importazione altri movimenti contabili: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
logger.info("Importazione altri movimenti contabili: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +308,9 @@ public class RossoGarganoSyncService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (pagaScadenze && !UtilityString.isNullOrEmpty(codAnag)) {
|
if (pagaScadenze && !UtilityString.isNullOrEmpty(codAnag)) {
|
||||||
List<CtbScad> scadenzeAperte = pagaScadenze(pnPartita, tipoAnag, codAnag, ctbMovt, pnImportoMov, pnSegnoMovimento, ctbMovr);
|
List<CtbScad> scadenzeAperte = pagaScadenze(pnPartita, tipoAnag, codAnag, ctbMovt, pnImportoMov, pnSegnoMovimento,
|
||||||
|
pnCausaleMovimento,
|
||||||
|
ctbMovr);
|
||||||
if (scadenzeAperte != null) {
|
if (scadenzeAperte != null) {
|
||||||
if (ctbMovt.getCtbScad() == null) ctbMovt.setCtbScad(new ArrayList<>());
|
if (ctbMovt.getCtbScad() == null) ctbMovt.setCtbScad(new ArrayList<>());
|
||||||
ctbMovt.getCtbScad().addAll(scadenzeAperte);
|
ctbMovt.getCtbScad().addAll(scadenzeAperte);
|
||||||
@@ -1043,14 +1045,21 @@ public class RossoGarganoSyncService {
|
|||||||
ctbMovt.setCtbPart(ctbPart);
|
ctbMovt.setCtbPart(ctbPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CtbScad> pagaScadenze(String pnPartita, String tipoAnag, String codAnag, CtbMovt ctbMovt, BigDecimal impIncasso, String pnSegnoMovimento, CtbMovr ctbMovr) throws Exception {
|
private List<CtbScad> pagaScadenze(String pnPartita, String tipoAnag, String codAnag, CtbMovt ctbMovt, BigDecimal impIncasso,
|
||||||
|
String pnSegnoMovimento,
|
||||||
|
String pnCausaleMov,
|
||||||
|
CtbMovr ctbMovr) throws Exception {
|
||||||
String anno = null;
|
String anno = null;
|
||||||
if (UtilityString.isNumber(pnPartita.substring(0, 2)))
|
if (UtilityString.isNumber(pnPartita.substring(0, 2)))
|
||||||
anno = "20" + pnPartita.substring(0, 2);
|
anno = "20" + pnPartita.substring(0, 2);
|
||||||
|
|
||||||
String numero = pnPartita.substring(2);
|
String numero = pnPartita.substring(2);
|
||||||
if (UtilityString.isNumber(numero))
|
|
||||||
|
try {
|
||||||
numero = new Integer(numero).toString();
|
numero = new Integer(numero).toString();
|
||||||
|
} catch (NumberFormatException e ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
List<CtbScad> elencoScadenze = new ArrayList<>();
|
List<CtbScad> elencoScadenze = new ArrayList<>();
|
||||||
Integer annoPart = null, numDoc = null, tipoPartita = null;
|
Integer annoPart = null, numDoc = null, tipoPartita = null;
|
||||||
@@ -1083,13 +1092,13 @@ public class RossoGarganoSyncService {
|
|||||||
numDoc = UtilityHashMap.getValueIfExists(datiPartita, "num_doc");
|
numDoc = UtilityHashMap.getValueIfExists(datiPartita, "num_doc");
|
||||||
serDoc = UtilityHashMap.getValueIfExists(datiPartita, "ser_doc");
|
serDoc = UtilityHashMap.getValueIfExists(datiPartita, "ser_doc");
|
||||||
tipoPartita = UtilityHashMap.getValueIfExists(datiPartita, "tipo_partita");
|
tipoPartita = UtilityHashMap.getValueIfExists(datiPartita, "tipo_partita");
|
||||||
} else {
|
} else if ( anno != null && Integer.valueOf(anno).intValue() <= 2021){
|
||||||
numDoc = 0;
|
numDoc = 0;
|
||||||
serDoc = "/";
|
serDoc = "/";
|
||||||
annoPart = 2021;
|
annoPart = 2021;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctbMovt.getCtbScad() != null) {
|
if (ctbMovt.getCtbScad() != null && annoPart != null) {
|
||||||
Integer finalAnnoPart = annoPart;
|
Integer finalAnnoPart = annoPart;
|
||||||
String finalSerDoc = serDoc;
|
String finalSerDoc = serDoc;
|
||||||
Integer finalNumDoc = numDoc;
|
Integer finalNumDoc = numDoc;
|
||||||
@@ -1107,12 +1116,49 @@ public class RossoGarganoSyncService {
|
|||||||
ctbMovt.getCtbScad().removeAll(elencoScadenze);
|
ctbMovt.getCtbScad().removeAll(elencoScadenze);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TipoPartita tipoPartitaEnum = null;
|
||||||
|
|
||||||
if (tipoPartita != null) {
|
if (tipoPartita != null) {
|
||||||
if ((pnSegnoMovimento.equalsIgnoreCase("A") && TipoPartita.fromValue(tipoPartita.intValue()) == TipoPartita.PASSIVA) ||
|
tipoPartitaEnum = TipoPartita.fromValue(tipoPartita.intValue());
|
||||||
(pnSegnoMovimento.equalsIgnoreCase("D") && TipoPartita.fromValue(tipoPartita.intValue()) == TipoPartita.ATTIVA)
|
if ((pnSegnoMovimento.equalsIgnoreCase("A") && tipoPartitaEnum == TipoPartita.PASSIVA) ||
|
||||||
|
(pnSegnoMovimento.equalsIgnoreCase("D") && tipoPartitaEnum == TipoPartita.ATTIVA)
|
||||||
) {
|
) {
|
||||||
impIncasso = impIncasso.multiply(new BigDecimal(-1));
|
impIncasso = impIncasso.multiply(new BigDecimal(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (impIncasso.doubleValue() < 0 && pnCausaleMov.equalsIgnoreCase("260")) {
|
||||||
|
List<CtbScad> insoluto = new ArrayList<>();
|
||||||
|
CtbScad ctbScadInsoluto = new CtbScad()
|
||||||
|
.setDataScad(ctbMovt.getDataCmov())
|
||||||
|
.setImpDare(impIncasso)
|
||||||
|
.setImpAvere(impIncasso)
|
||||||
|
.setDataPag(ctbMovt.getDataCmov());
|
||||||
|
|
||||||
|
insoluto.add(ctbScadInsoluto);
|
||||||
|
|
||||||
|
BigDecimal impDareIns = BigDecimal.ZERO;
|
||||||
|
BigDecimal impAvereIns = BigDecimal.ZERO;
|
||||||
|
switch (tipoPartitaEnum) {
|
||||||
|
case ATTIVA:
|
||||||
|
impDareIns = impIncasso.abs();
|
||||||
|
break;
|
||||||
|
case PASSIVA:
|
||||||
|
impAvereIns = impIncasso.abs();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ctbScadInsoluto = new CtbScad()
|
||||||
|
.setDataScad(ctbMovt.getDataCmov())
|
||||||
|
.setImpDare(impDareIns)
|
||||||
|
.setImpAvere(impAvereIns)
|
||||||
|
.setDataPag(ctbMovt.getDataCmov());
|
||||||
|
|
||||||
|
insoluto.add(ctbScadInsoluto);
|
||||||
|
|
||||||
|
return insoluto;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountingBusinessLogic.pagaScadenze(ctbMovt.getDataCmov(), impIncasso, elencoScadenze, ctbMovr.getIdRiga());
|
AccountingBusinessLogic.pagaScadenze(ctbMovt.getDataCmov(), impIncasso, elencoScadenze, ctbMovr.getIdRiga());
|
||||||
|
|||||||
@@ -36,12 +36,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.Connection;
|
import java.sql.*;
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -367,12 +365,14 @@ public class DocumentiAcquistoImportService {
|
|||||||
" dtb_doct.cod_dtip = %s AND " +
|
" dtb_doct.cod_dtip = %s AND " +
|
||||||
" dtb_doct.data_doc = %s AND " +
|
" dtb_doct.data_doc = %s AND " +
|
||||||
" dtb_doct.ser_doc = %s AND " +
|
" dtb_doct.ser_doc = %s AND " +
|
||||||
" dtb_doct.num_doc = %s ",
|
" dtb_doct.num_doc = %s AND " +
|
||||||
|
" dtb_doct.listino = %s ",
|
||||||
dtbDoct.getCodAnag(),
|
dtbDoct.getCodAnag(),
|
||||||
dtbDoct.getCodDtip(),
|
dtbDoct.getCodDtip(),
|
||||||
dtbDoct.getDataDoc(),
|
dtbDoct.getDataDoc(),
|
||||||
dtbDoct.getSerDoc(),
|
dtbDoct.getSerDoc(),
|
||||||
dtbDoct.getNumDoc());
|
dtbDoct.getNumDoc(),
|
||||||
|
dtbDoct.getListino());
|
||||||
|
|
||||||
Boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
Boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
sql =
|
sql =
|
||||||
@@ -979,8 +979,14 @@ public class DocumentiAcquistoImportService {
|
|||||||
m.setPrimaryDs(ds.getProfileName());
|
m.setPrimaryDs(ds.getProfileName());
|
||||||
|
|
||||||
for (EntityBase e : entityList){
|
for (EntityBase e : entityList){
|
||||||
|
DtbDoct dtbDoct = (DtbDoct) e;
|
||||||
|
|
||||||
|
UpdProgOrdini(m, dtbDoct, -1);
|
||||||
|
|
||||||
entityProcessor.processEntity(e, true, false, requestData.getUsername(), m, false);
|
entityProcessor.processEntity(e, true, false, requestData.getUsername(), m, false);
|
||||||
entityReturn.add(e);
|
entityReturn.add(e);
|
||||||
|
|
||||||
|
UpdProgOrdini(m, dtbDoct, 1);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
m.rollbackAll();
|
m.rollbackAll();
|
||||||
@@ -991,6 +997,20 @@ public class DocumentiAcquistoImportService {
|
|||||||
return entityReturn;
|
return entityReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UpdProgOrdini(MultiDBTransactionManager m, DtbDoct dtbDoct, Integer segno) throws SQLException, PrimaryDatabaseNotPresentException, IOException {
|
||||||
|
CallableStatement storedProcedure;
|
||||||
|
storedProcedure = m.getPrimaryConnection().prepareCall("{call UpdProgOrdini(?,?,?,?,?,?,?)}");
|
||||||
|
storedProcedure.setString(1, dtbDoct.getCodAnag());
|
||||||
|
storedProcedure.setString(2, dtbDoct.getCodDtip());
|
||||||
|
storedProcedure.setTimestamp(3, new Timestamp(dtbDoct.getDataDoc().getTime()));
|
||||||
|
storedProcedure.setString(4, dtbDoct.getSerDoc());
|
||||||
|
storedProcedure.setInt(5, dtbDoct.getNumDoc());
|
||||||
|
storedProcedure.setInt(6, segno);
|
||||||
|
storedProcedure.setString(7, "U");
|
||||||
|
storedProcedure.execute();
|
||||||
|
storedProcedure.close();
|
||||||
|
}
|
||||||
|
|
||||||
private List<EntityBase> processRifOrdApuliaList (List<RifOrdApuliaDTO> rifOrdApuliaList, List<AnomalieDTO> anomalie, String tipiDoc, Connection connection, String pIva) throws Exception {
|
private List<EntityBase> processRifOrdApuliaList (List<RifOrdApuliaDTO> rifOrdApuliaList, List<AnomalieDTO> anomalie, String tipiDoc, Connection connection, String pIva) throws Exception {
|
||||||
List<EntityBase> entityList = new ArrayList<>();
|
List<EntityBase> entityList = new ArrayList<>();
|
||||||
for (RifOrdApuliaDTO rifOrdApulia : rifOrdApuliaList){
|
for (RifOrdApuliaDTO rifOrdApulia : rifOrdApuliaList){
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class CambioTipoDocPlanService {
|
|||||||
return data1.compareTo(data2);
|
return data1.compareTo(data2);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
List<HashMap<String, String>> utenti = new ArrayList<>();
|
|
||||||
for (Map.Entry<Date, List<DtbDoctCambioTipoDoc>> dataCmov : listaDataCmov) {
|
for (Map.Entry<Date, List<DtbDoctCambioTipoDoc>> dataCmov : listaDataCmov) {
|
||||||
boolean error = false;
|
boolean error = false;
|
||||||
|
|
||||||
@@ -116,8 +116,6 @@ public class CambioTipoDocPlanService {
|
|||||||
boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
if (existDoc) {
|
if (existDoc) {
|
||||||
String compilatoDa = CommonRules.getFullName(multiDBTransactionManager.getPrimaryConnection(), doc.getKey().getUserName());
|
|
||||||
doc.getKey().setFullName(compilatoDa);
|
|
||||||
List<CambioTipoDocDTO.Allegati> listaAllegati =
|
List<CambioTipoDocDTO.Allegati> listaAllegati =
|
||||||
Stream.of(doc.getValue())
|
Stream.of(doc.getValue())
|
||||||
.filter(x -> x.getIdAllegato() != null)
|
.filter(x -> x.getIdAllegato() != null)
|
||||||
@@ -134,7 +132,7 @@ public class CambioTipoDocPlanService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
entityList = entityProcessor.processEntityList(cambioTipoDocService.getListaDoc(doc.getKey()), true);
|
entityList = entityProcessor.processEntityList(cambioTipoDocService.getListaDoc(doc.getKey()), doc.getKey().getUserName(), true, true, true);
|
||||||
|
|
||||||
Optional<EntityBase> first = Stream.of(entityList).filter(x -> x.getException() != null).findFirst();
|
Optional<EntityBase> first = Stream.of(entityList).filter(x -> x.getException() != null).findFirst();
|
||||||
if (first.isPresent()) {
|
if (first.isPresent()) {
|
||||||
|
|||||||
@@ -111,12 +111,6 @@ public class CambioTipoDocService {
|
|||||||
.setCodDtip(doc.getCodDtipNew())
|
.setCodDtip(doc.getCodDtipNew())
|
||||||
.setPrevistaFat(null)
|
.setPrevistaFat(null)
|
||||||
.setNumDocForn(doc.getNumDocForn());
|
.setNumDocForn(doc.getNumDocForn());
|
||||||
if (!UtilityString.isNullOrEmpty(doc.getUserName())) {
|
|
||||||
newDoc.setUserName(doc.getUserName());
|
|
||||||
newDoc.setUsername(doc.getUserName());
|
|
||||||
}
|
|
||||||
if (!UtilityString.isNullOrEmpty(doc.getFullName()))
|
|
||||||
newDoc.setCompilatoDa(doc.getFullName());
|
|
||||||
|
|
||||||
newDoc.setOperation(OperationType.INSERT);
|
newDoc.setOperation(OperationType.INSERT);
|
||||||
if (doc.getAllegati() != null && doc.getAllegati().size() > 0) {
|
if (doc.getAllegati() != null && doc.getAllegati().size() > 0) {
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ public class DistribuzioneColliService {
|
|||||||
psRemoveOrdRifsFromMtbColrs.executeUpdate();
|
psRemoveOrdRifsFromMtbColrs.executeUpdate();
|
||||||
psRemoveOrdRifsFromMtbColrs.close();
|
psRemoveOrdRifsFromMtbColrs.close();
|
||||||
|
|
||||||
EntityBase[] result = entityProcessor.processEntity(sourceMtbColt, multiDBTransactionManager);
|
List<EntityBase> result = entityProcessor.processEntity(sourceMtbColt, multiDBTransactionManager);
|
||||||
|
|
||||||
if (result == null || result.length == 0)
|
if (result == null || result.isEmpty())
|
||||||
throw new EntityNotFoundException(String.format("Il collo numero %d del %s non esiste",
|
throw new EntityNotFoundException(String.format("Il collo numero %d del %s non esiste",
|
||||||
filtroDistribuzioneColloDTO.getNumCollo(),
|
filtroDistribuzioneColloDTO.getNumCollo(),
|
||||||
UtilityDate.formatDate(filtroDistribuzioneColloDTO.getDataCollo(), CommonConstants.DATE_FORMAT_DMY)));
|
UtilityDate.formatDate(filtroDistribuzioneColloDTO.getDataCollo(), CommonConstants.DATE_FORMAT_DMY)));
|
||||||
|
|
||||||
sourceMtbColt = (MtbColt) result[0];
|
sourceMtbColt = (MtbColt) result.get(0);
|
||||||
|
|
||||||
//Lettura delle righe del collo in ingresso
|
//Lettura delle righe del collo in ingresso
|
||||||
final List<HashMap<String, Object>> mtbColtData = new ArrayList<>();
|
final List<HashMap<String, Object>> mtbColtData = new ArrayList<>();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class WoocommerceService {
|
|||||||
" CASE WHEN CONVERT(DATE, GETDATE()) BETWEEN ttb_anno_stag.data_iniz_ecomm AND ttb_anno_stag.data_fine_ecomm THEN 'NUOVA COLLEZIONE' ELSE 'OUTLET' END AS collezione , " +
|
" CASE WHEN CONVERT(DATE, GETDATE()) BETWEEN ttb_anno_stag.data_iniz_ecomm AND ttb_anno_stag.data_fine_ecomm THEN 'NUOVA COLLEZIONE' ELSE 'OUTLET' END AS collezione , " +
|
||||||
" ttb_stag.descrizione AS stagione , " +
|
" ttb_stag.descrizione AS stagione , " +
|
||||||
" ISNULL(ws.categoria_woocomm, mtb_aart.cod_msgr) AS categoria , " +
|
" ISNULL(ws.categoria_woocomm, mtb_aart.cod_msgr) AS categoria , " +
|
||||||
" CONVERT( DECIMAL(15, 2), dbo.f_CalcPrzMaxTextiles(ttb_style.cod_style, " + UtilityDB.valueToString(listino) + " , 'S' )) AS prezzo " +
|
" CONVERT( DECIMAL(15, 2), dbo.f_CalcPrzMaxTextiles(ttb_style.cod_style, " + UtilityDB.valueToString(listino) + " , 'N' )) AS prezzo " +
|
||||||
" FROM ttb_style " +
|
" FROM ttb_style " +
|
||||||
" INNER JOIN mtb_aart " +
|
" INNER JOIN mtb_aart " +
|
||||||
" ON ttb_style.cod_style = mtb_aart.cod_mart " +
|
" ON ttb_style.cod_style = mtb_aart.cod_mart " +
|
||||||
@@ -108,7 +108,7 @@ public class WoocommerceService {
|
|||||||
" ), " +
|
" ), " +
|
||||||
" disponibile AS " +
|
" disponibile AS " +
|
||||||
" ( " +
|
" ( " +
|
||||||
" SELECT " +
|
" SELECT DISTINCT " +
|
||||||
" dettaglio.cod_style , " +
|
" dettaglio.cod_style , " +
|
||||||
" dettaglio.cod_barre AS ean , " +
|
" dettaglio.cod_barre AS ean , " +
|
||||||
" dettaglio.pos , " +
|
" dettaglio.pos , " +
|
||||||
|
|||||||
@@ -7,15 +7,18 @@ import it.integry.ems.Import.dto.AnomalieDTO;
|
|||||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
|
import it.integry.ems.utility.UtilityFile;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.entity.AtbGriglie;
|
import it.integry.ems_model.entity.AtbGriglie;
|
||||||
import it.integry.ems_model.entity.AtbGriglieArt;
|
import it.integry.ems_model.entity.AtbGriglieArt;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityDate;
|
||||||
import it.integry.ems_model.utility.UtilityExcel;
|
import it.integry.ems_model.utility.UtilityExcel;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.apache.bcel.generic.Select;
|
import org.apache.bcel.generic.Select;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
@@ -27,6 +30,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -130,6 +134,23 @@ public class ImportGrigliaAcquistoService {
|
|||||||
|
|
||||||
entityList = entityProcessor.processEntityList(result, true);
|
entityList = entityProcessor.processEntityList(result, true);
|
||||||
|
|
||||||
|
//MoveFile
|
||||||
|
if (entityList != null && !entityList.isEmpty()){
|
||||||
|
String path = setup.get("PATH_FILE");
|
||||||
|
String fileName = setup.get("FILE_FILTER");
|
||||||
|
|
||||||
|
if (UtilityString.isNullOrEmpty(path))
|
||||||
|
path = requestDTO.getPathFile();
|
||||||
|
|
||||||
|
if (UtilityString.isNullOrEmpty(fileName))
|
||||||
|
fileName = requestDTO.getFileName();
|
||||||
|
|
||||||
|
String pathToMoveTo = path + "imported" + File.separator;
|
||||||
|
String newFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + "_" + fileName;
|
||||||
|
|
||||||
|
UtilityFile.moveFile(path, pathToMoveTo, fileName, newFileName);
|
||||||
|
}
|
||||||
|
|
||||||
return entityList;
|
return entityList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1029,10 +1029,10 @@ public class ProductServices {
|
|||||||
searchArtLink.setOperation(OperationType.SELECT);
|
searchArtLink.setOperation(OperationType.SELECT);
|
||||||
searchArtLink.setNativeSql("select * from mtb_aart_link where cod_mart = " + UtilityDB.valueToString(codMart) + "and path_link = " + UtilityDB.valueToString(fileName));
|
searchArtLink.setNativeSql("select * from mtb_aart_link where cod_mart = " + UtilityDB.valueToString(codMart) + "and path_link = " + UtilityDB.valueToString(fileName));
|
||||||
|
|
||||||
EntityBase[] artLinkResult = entityProcessor.processEntity(searchArtLink, multiDBTransactionManager);
|
List<EntityBase> artLinkResult = entityProcessor.processEntity(searchArtLink, multiDBTransactionManager);
|
||||||
|
|
||||||
|
|
||||||
if (artLinkResult == null || artLinkResult.length == 0) {
|
if (artLinkResult == null || artLinkResult.isEmpty()) {
|
||||||
MtbAartLink mtbAartLink = new MtbAartLink();
|
MtbAartLink mtbAartLink = new MtbAartLink();
|
||||||
mtbAartLink.setCodMart(codMart);
|
mtbAartLink.setCodMart(codMart);
|
||||||
mtbAartLink.setPathLink(fileName);
|
mtbAartLink.setPathLink(fileName);
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package it.integry.ems.retail.ReportVariazioni.service;
|
package it.integry.ems.retail.ReportVariazioni.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.annimon.stream.Stream;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
|
||||||
import it.integry.ems.offer.dto.DettCostoIn;
|
|
||||||
import it.integry.ems.retail.ReportVariazioni.dto.Variazioni.*;
|
import it.integry.ems.retail.ReportVariazioni.dto.Variazioni.*;
|
||||||
|
import it.integry.ems.retail.dto.GrigliaAcquistoDTO;
|
||||||
|
import it.integry.ems.retail.dto.ListiniOrdiniAcquistoDTO;
|
||||||
|
import it.integry.ems.retail.service.GrigliaAcquistoHandlerService;
|
||||||
|
import it.integry.ems.retail.service.ListiniAcquistoHandlerService;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityDirs;
|
import it.integry.ems.utility.UtilityDirs;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
@@ -18,19 +20,14 @@ import org.springframework.stereotype.Service;
|
|||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.Marshaller;
|
import javax.xml.bind.Marshaller;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
@@ -39,6 +36,11 @@ public class VariazioniPVService {
|
|||||||
private MultiDBTransactionManager multiDBTransactionManager;
|
private MultiDBTransactionManager multiDBTransactionManager;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SetupGest setupGest;
|
private SetupGest setupGest;
|
||||||
|
@Autowired
|
||||||
|
private GrigliaAcquistoHandlerService grigliaAcquistoHandlerService;
|
||||||
|
|
||||||
|
private HashMap<String, String> listini = new HashMap<>();
|
||||||
|
private List<GrigliaAcquistoDTO> grigliaAcquisto = new ArrayList<>();
|
||||||
|
|
||||||
public String variazionePrezzoPVXml(VariazioniPvInputDTO variazioniPvDTO) throws Exception {
|
public String variazionePrezzoPVXml(VariazioniPvInputDTO variazioniPvDTO) throws Exception {
|
||||||
|
|
||||||
@@ -74,9 +76,9 @@ public class VariazioniPVService {
|
|||||||
|
|
||||||
String sql =
|
String sql =
|
||||||
"SELECT vtb_list.cod_vlis, vtb_list.descrizione, vtb_list.flag_list_iva_inclusa, mtb_depo.cod_mdep " +
|
"SELECT vtb_list.cod_vlis, vtb_list.descrizione, vtb_list.flag_list_iva_inclusa, mtb_depo.cod_mdep " +
|
||||||
" FROM vtb_list INNER JOIN mtb_depo ON mtb_depo.cod_vlis = vtb_list.cod_vlis " +
|
" FROM vtb_list INNER JOIN mtb_depo ON mtb_depo.cod_vlis = vtb_list.cod_vlis " +
|
||||||
" WHERE vtb_list.flag_attivo = 'S' " +
|
" WHERE vtb_list.flag_attivo = 'S' " +
|
||||||
"ORDER BY vtb_list.cod_vlis ";
|
"ORDER BY vtb_list.cod_vlis ";
|
||||||
|
|
||||||
sql = UtilityDB.addwhereCond(sql, variazioniPvDTO.getWhereCondLisv(), false);
|
sql = UtilityDB.addwhereCond(sql, variazioniPvDTO.getWhereCondLisv(), false);
|
||||||
|
|
||||||
@@ -93,7 +95,7 @@ public class VariazioniPVService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReportType fileVariazioniDTO = new ReportType();
|
ReportType fileVariazioniDTO = new ReportType();
|
||||||
for(HashMap<String, Object> datiLisv:listini) {
|
for (HashMap<String, Object> datiLisv : listini) {
|
||||||
String codVlis = UtilityHashMap.getValueIfExists(datiLisv, "cod_vlis");
|
String codVlis = UtilityHashMap.getValueIfExists(datiLisv, "cod_vlis");
|
||||||
String descrLisv = UtilityString.streNull(UtilityHashMap.getValueIfExists(datiLisv, "descrizione"));
|
String descrLisv = UtilityString.streNull(UtilityHashMap.getValueIfExists(datiLisv, "descrizione"));
|
||||||
String flagListIvaInclusa = UtilityString.streNull(UtilityHashMap.getValueIfExists(datiLisv, "flag_list_iva_inclusa"));
|
String flagListIvaInclusa = UtilityString.streNull(UtilityHashMap.getValueIfExists(datiLisv, "flag_list_iva_inclusa"));
|
||||||
@@ -120,6 +122,15 @@ public class VariazioniPVService {
|
|||||||
|
|
||||||
String query = getQueryVariazioni(variazioniPvDTO, setup, codVlis, getSetupSectionDepo.get("SELEZIONA_GRIGLIE"));
|
String query = getQueryVariazioni(variazioniPvDTO, setup, codVlis, getSetupSectionDepo.get("SELEZIONA_GRIGLIE"));
|
||||||
List<HashMap<String, Object>> elencoVar = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
|
List<HashMap<String, Object>> elencoVar = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
|
|
||||||
|
if (getSetupSectionDepo.get("SELEZIONA_GRIGLIE").equalsIgnoreCase("S")) {
|
||||||
|
grigliaAcquisto = grigliaAcquistoHandlerService.getGrigliaAcquisto();
|
||||||
|
grigliaAcquisto = Stream.of(grigliaAcquisto)
|
||||||
|
.filter(x -> x.getDataValidita().equals(variazioniPvDTO.getDataValidita()) &&
|
||||||
|
x.getCodMdep().equalsIgnoreCase(codMdep))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
for (HashMap<String, Object> variazioni : elencoVar) {
|
for (HashMap<String, Object> variazioni : elencoVar) {
|
||||||
CodMartType codMart = fillArticoloData(objectFactory,
|
CodMartType codMart = fillArticoloData(objectFactory,
|
||||||
variazioni, variazioniPvDTO, invioIngredienti, getSetupSectionDepo, codMdep, colNameDescrEstesa,
|
variazioni, variazioniPvDTO, invioIngredienti, getSetupSectionDepo, codMdep, colNameDescrEstesa,
|
||||||
@@ -148,11 +159,11 @@ public class VariazioniPVService {
|
|||||||
String valLibero2) throws Exception {
|
String valLibero2) throws Exception {
|
||||||
CodMartType codMartType = objectFactory.createCodMartType();
|
CodMartType codMartType = objectFactory.createCodMartType();
|
||||||
String codMart = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_mart"));
|
String codMart = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_mart"));
|
||||||
String flagTipoPromo = UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"flag_tipo_promo"));
|
String flagTipoPromo = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "flag_tipo_promo"));
|
||||||
BigDecimal przPieno = UtilityHashMap.getValueIfExists(var,"prezzo_pieno");
|
BigDecimal przPieno = UtilityHashMap.getValueIfExists(var, "prezzo_pieno");
|
||||||
BigDecimal przPienoIva = UtilityHashMap.getValueIfExists(var,"prz_pieno_iva");
|
BigDecimal przPienoIva = UtilityHashMap.getValueIfExists(var, "prz_pieno_iva");
|
||||||
BigDecimal przVend = UtilityHashMap.getValueIfExists(var,"prz_vend");
|
BigDecimal przVend = UtilityHashMap.getValueIfExists(var, "prz_vend");
|
||||||
BigDecimal przVendIva = UtilityHashMap.getValueIfExists(var,"prz_vend_iva");
|
BigDecimal przVendIva = UtilityHashMap.getValueIfExists(var, "prz_vend_iva");
|
||||||
if ("P".equals(flagTipoPromo)) {
|
if ("P".equals(flagTipoPromo)) {
|
||||||
przPienoIva = przVendIva;
|
przPienoIva = przVendIva;
|
||||||
przPieno = przVend;
|
przPieno = przVend;
|
||||||
@@ -181,81 +192,81 @@ public class VariazioniPVService {
|
|||||||
dataAggPrzS = new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(dataAggPrz);
|
dataAggPrzS = new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(dataAggPrz);
|
||||||
}
|
}
|
||||||
|
|
||||||
String tipoVariazioneLisv = UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"tipo_variazione_lisv"));
|
String tipoVariazioneLisv = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "tipo_variazione_lisv"));
|
||||||
String flagStato = UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"flag_stato"));
|
String flagStato = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "flag_stato"));
|
||||||
if ("D".equalsIgnoreCase(tipoVariazioneLisv)) {
|
if ("D".equalsIgnoreCase(tipoVariazioneLisv)) {
|
||||||
flagStato = "I";
|
flagStato = "I";
|
||||||
}
|
}
|
||||||
codMartType.getContent().add(codMart);
|
codMartType.getContent().add(codMart);
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"descr_art"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "descr_art"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis2(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"unt_mis2"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis2(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "unt_mis2"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"unt_mis"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "unt_mis"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeRapConv2(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"rap_conv2"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypeRapConv2(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "rap_conv2"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis3(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"unt_mis3"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis3(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "unt_mis3"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeRapConv3(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"rap_conv3"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypeRapConv3(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "rap_conv3"), "###0.00").replace(",", ".")));
|
||||||
CodMgrpType codMgrpType = objectFactory.createCodMgrpType();
|
CodMgrpType codMgrpType = objectFactory.createCodMgrpType();
|
||||||
codMgrpType.setValue(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_mgrp")));
|
codMgrpType.setValue(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_mgrp")));
|
||||||
codMgrpType.setDescrGrup(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"descr_grup")));
|
codMgrpType.setDescrGrup(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "descr_grup")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodMgrp(codMgrpType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodMgrp(codMgrpType));
|
||||||
CodMsgrType codMsgrType = objectFactory.createCodMsgrType();
|
CodMsgrType codMsgrType = objectFactory.createCodMsgrType();
|
||||||
codMsgrType.setValue(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_msgr")));
|
codMsgrType.setValue(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_msgr")));
|
||||||
codMsgrType.setDescrSgrp(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"descr_sgrp")));
|
codMsgrType.setDescrSgrp(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "descr_sgrp")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodMsgr(codMsgrType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodMsgr(codMsgrType));
|
||||||
CodMsfaType codMsfaType = objectFactory.createCodMsfaType();
|
CodMsfaType codMsfaType = objectFactory.createCodMsfaType();
|
||||||
codMsfaType.setValue(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_msfa")));
|
codMsfaType.setValue(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_msfa")));
|
||||||
codMsfaType.setDescrSfam(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"descr_msfa")));
|
codMsfaType.setDescrSfam(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "descr_msfa")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodMsfa(codMsfaType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodMsfa(codMsfaType));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeRepartoCassa(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"reparto_cassa"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeRepartoCassa(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "reparto_cassa"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeTipoVariazione( UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"tipo_variazione"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeTipoVariazione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "tipo_variazione"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeTipoVariazioneLisv(tipoVariazioneLisv));
|
codMartType.getContent().add(objectFactory.createCodMartTypeTipoVariazioneLisv(tipoVariazioneLisv));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePrzBase(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"prz_base"), "###0.00###").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePrzBase(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "prz_base"), "###0.00###").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePrzVend(UtilityString.bigDecimalToString(przVend, "###0.00###").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePrzVend(UtilityString.bigDecimalToString(przVend, "###0.00###").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePrzVendIva(UtilityString.bigDecimalToString(przVendIva, "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePrzVendIva(UtilityString.bigDecimalToString(przVendIva, "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePosizione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"posizione"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypePosizione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "posizione"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeUntMisVen( UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"unt_mis_ven"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeUntMisVen(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "unt_mis_ven"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeRapConvVen(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"rap_conv"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypeRapConvVen(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "rap_conv"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePesoKg(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"peso_kg"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePesoKg(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "peso_kg"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagEsponiPrz(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"flag_esponi_prz"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagEsponiPrz(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "flag_esponi_prz"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePercSfrido(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"perc_sfrido"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePercSfrido(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "perc_sfrido"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodBarreImb(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_barre_imb"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodBarreImb(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_barre_imb"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagCalcPrz( UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"flag_calc_prz"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagCalcPrz(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "flag_calc_prz"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeEsposizioneCompAcq(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"esposizione_comp_acq"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeEsposizioneCompAcq(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "esposizione_comp_acq"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeEsposizioneComp( UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"esposizione_comp"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeEsposizioneComp(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "esposizione_comp"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagCalcPrzAcq(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"flag_calc_prz_acq"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagCalcPrzAcq(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "flag_calc_prz_acq"))));
|
||||||
BigDecimal colliPedane = UtilityHashMap.getValueIfExists(var,"colli_pedana");
|
BigDecimal colliPedane = UtilityHashMap.getValueIfExists(var, "colli_pedana");
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeColliPedane(UtilityString.bigDecimalToString(colliPedane == null ? BigDecimal.ZERO : colliPedane, "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypeColliPedane(UtilityString.bigDecimalToString(colliPedane == null ? BigDecimal.ZERO : colliPedane, "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePercSco1(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"perc_sco1"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePercSco1(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "perc_sco1"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePercSco2(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"perc_sco2"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePercSco2(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "perc_sco2"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePercSco3(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"perc_sco3"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePercSco3(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "perc_sco3"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePercSco4(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"perc_sco4"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePercSco4(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "perc_sco4"), "###0.00").replace(",", ".")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDataUltVar(dataUltVarS));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDataUltVar(dataUltVarS));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDataAggPrz(dataAggPrzS));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDataAggPrz(dataAggPrzS));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodBarre(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_barre"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodBarre(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_barre"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePlu(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"plu"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypePlu(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "plu"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagStato(flagStato));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagStato(flagStato));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeQtaCnf(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"qta_cnf"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypeQtaCnf(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "qta_cnf"), "###0.00").replace(",", ".")));
|
||||||
BigDecimal tara = UtilityHashMap.getValueIfExists(var,"tara_kg");
|
BigDecimal tara = UtilityHashMap.getValueIfExists(var, "tara_kg");
|
||||||
if (tara.compareTo(BigDecimal.ZERO) != 0) {
|
if (tara.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
tara = (tara.multiply(new BigDecimal("1000"))).setScale(0, RoundingMode.HALF_UP);
|
tara = (tara.multiply(new BigDecimal("1000"))).setScale(0, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeTara(UtilityString.bigDecimalToString(tara, "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypeTara(UtilityString.bigDecimalToString(tara, "###0.00").replace(",", ".")));
|
||||||
String descrizioneEstesa = UtilityHashMap.getValueIfExists(var,colNameDescrEstesa);
|
String descrizioneEstesa = UtilityHashMap.getValueIfExists(var, colNameDescrEstesa);
|
||||||
if ( UtilityString.isNullOrEmpty(descrizioneEstesa))
|
if (UtilityString.isNullOrEmpty(descrizioneEstesa))
|
||||||
descrizioneEstesa = UtilityHashMap.getValueIfExists(var,"descrizione_estesa");
|
descrizioneEstesa = UtilityHashMap.getValueIfExists(var, "descrizione_estesa");
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizioneEstesa(UtilityString.streNull(descrizioneEstesa)));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizioneEstesa(UtilityString.streNull(descrizioneEstesa)));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeAnnotazioniArt(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"annotazioni_art"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeAnnotazioniArt(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "annotazioni_art"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodAliq(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_aliq"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodAliq(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_aliq"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeArticoloComposto(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"articolo_composto"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeArticoloComposto(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "articolo_composto"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeTipoEan(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"tipo_codice"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeTipoEan(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "tipo_codice"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagTracciabilita(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"flag_tracciabilita"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagTracciabilita(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "flag_tracciabilita"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeGgScadPartita(String.valueOf(UtilityHashMap.<Integer>getValueIfExists(var, "gg_scad_partita"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeGgScadPartita(String.valueOf(UtilityHashMap.<Integer>getValueIfExists(var, "gg_scad_partita"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePercAliq(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var,"perc_aliq"), "###0.00").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePercAliq(UtilityString.bigDecimalToString(UtilityHashMap.getValueIfExists(var, "perc_aliq"), "###0.00").replace(",", ".")));
|
||||||
|
|
||||||
String idArtEqui = UtilityHashMap.getValueIfExists(var,"id_art_equi");
|
String idArtEqui = UtilityHashMap.getValueIfExists(var, "id_art_equi");
|
||||||
if (!UtilityString.isNullOrEmpty(idArtEqui)) {
|
if (!UtilityString.isNullOrEmpty(idArtEqui)) {
|
||||||
IdArtEquiType idArtEquiType = objectFactory.createIdArtEquiType();
|
IdArtEquiType idArtEquiType = objectFactory.createIdArtEquiType();
|
||||||
idArtEquiType.setValue(idArtEqui);
|
idArtEquiType.setValue(idArtEqui);
|
||||||
idArtEquiType.setDescrizione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"descr_art_equi")));
|
idArtEquiType.setDescrizione(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "descr_art_equi")));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeIdArtEqui(idArtEquiType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeIdArtEqui(idArtEquiType));
|
||||||
}
|
}
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypePrezzoPieno(UtilityString.bigDecimalToString(przPieno, "###0.00###").replace(",", ".")));
|
codMartType.getContent().add(objectFactory.createCodMartTypePrezzoPieno(UtilityString.bigDecimalToString(przPieno, "###0.00###").replace(",", ".")));
|
||||||
@@ -269,8 +280,8 @@ public class VariazioniPVService {
|
|||||||
HashMap<String, Object> datiPromo = new HashMap<>();
|
HashMap<String, Object> datiPromo = new HashMap<>();
|
||||||
FlagMxnType flagMxnType = getScontoMerce(objectFactory, codMart, variazioniPvDTO.getDataValidita(), datiPromo);
|
FlagMxnType flagMxnType = getScontoMerce(objectFactory, codMart, variazioniPvDTO.getDataValidita(), datiPromo);
|
||||||
|
|
||||||
String finePromo = UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"fine_promo"));
|
String finePromo = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "fine_promo"));
|
||||||
String codPromo = UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"cod_promo"));
|
String codPromo = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "cod_promo"));
|
||||||
if (flagMxnType.getValue().equalsIgnoreCase("S") && finePromo.equalsIgnoreCase("S")) {
|
if (flagMxnType.getValue().equalsIgnoreCase("S") && finePromo.equalsIgnoreCase("S")) {
|
||||||
codPromo = (String) datiPromo.get("cod_promo");
|
codPromo = (String) datiPromo.get("cod_promo");
|
||||||
dataInizPromoS = new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(datiPromo.get("data_iniz"));
|
dataInizPromoS = new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(datiPromo.get("data_iniz"));
|
||||||
@@ -278,12 +289,12 @@ public class VariazioniPVService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeCodPromo(codPromo));
|
codMartType.getContent().add(objectFactory.createCodMartTypeCodPromo(codPromo));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizionePromo(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"descr_promo"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizionePromo(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "descr_promo"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagTipoPromo(flagTipoPromo));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagTipoPromo(flagTipoPromo));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDataInizPromo(dataInizPromoS));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDataInizPromo(dataInizPromoS));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeDataFinePromo(dataFinePromoS));
|
codMartType.getContent().add(objectFactory.createCodMartTypeDataFinePromo(dataFinePromoS));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFinePromo(finePromo));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFinePromo(finePromo));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeIdPromo(UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"id_promo"))));
|
codMartType.getContent().add(objectFactory.createCodMartTypeIdPromo(UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "id_promo"))));
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeFlagMxn(flagMxnType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeFlagMxn(flagMxnType));
|
||||||
|
|
||||||
//INGREDIENTI
|
//INGREDIENTI
|
||||||
@@ -294,7 +305,7 @@ public class VariazioniPVService {
|
|||||||
//GLI INGREDIENTI VENGONO COMUNQUE INVIATI
|
//GLI INGREDIENTI VENGONO COMUNQUE INVIATI
|
||||||
inviaIngrOpz = invioIngredientiSetup;
|
inviaIngrOpz = invioIngredientiSetup;
|
||||||
}
|
}
|
||||||
String ingredienti = UtilityString.streNull(UtilityHashMap.getValueIfExists(var,"ingredienti"));
|
String ingredienti = UtilityString.streNull(UtilityHashMap.getValueIfExists(var, "ingredienti"));
|
||||||
IngredientiType ingredientiType = getIngredienti(objectFactory, codMart, variazioniPvDTO.getDataValidita(), variazioniPvDTO.getTipoReportEnum(), tipoVariazioneLisv, inviaIngrOpz, ingredienti);
|
IngredientiType ingredientiType = getIngredienti(objectFactory, codMart, variazioniPvDTO.getDataValidita(), variazioniPvDTO.getTipoReportEnum(), tipoVariazioneLisv, inviaIngrOpz, ingredienti);
|
||||||
codMartType.getContent().add(objectFactory.createCodMartTypeIngredienti(ingredientiType));
|
codMartType.getContent().add(objectFactory.createCodMartTypeIngredienti(ingredientiType));
|
||||||
|
|
||||||
@@ -330,12 +341,12 @@ public class VariazioniPVService {
|
|||||||
if (tipoValore.equalsIgnoreCase("M")) {
|
if (tipoValore.equalsIgnoreCase("M")) {
|
||||||
String sql =
|
String sql =
|
||||||
Query.format("SELECT mtb_part.vend_mese_prec/4 as media_sett\n" +
|
Query.format("SELECT mtb_part.vend_mese_prec/4 as media_sett\n" +
|
||||||
"FROM mtb_part\n" +
|
"FROM mtb_part\n" +
|
||||||
"WHERE cod_mdep = %s\n" +
|
"WHERE cod_mdep = %s\n" +
|
||||||
" AND cod_mart = %s", codMdep, codMart);
|
" AND cod_mart = %s", codMdep, codMart);
|
||||||
BigDecimal valMedio = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
BigDecimal valMedio = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
if (UtilityBigDecimal.isNullOrZero(valMedio) && UtilityDB.existDatabaseObject(multiDBTransactionManager.getPrimaryConnection(), "mvw_media_vend", TypeDbObject.VIEW)){
|
if (UtilityBigDecimal.isNullOrZero(valMedio) && UtilityDB.existDatabaseObject(multiDBTransactionManager.getPrimaryConnection(), "mvw_media_vend", TypeDbObject.VIEW)) {
|
||||||
sql =
|
sql =
|
||||||
Query.format("SELECT media_sett\n" +
|
Query.format("SELECT media_sett\n" +
|
||||||
"FROM mvw_media_vend\n" +
|
"FROM mvw_media_vend\n" +
|
||||||
@@ -343,7 +354,7 @@ public class VariazioniPVService {
|
|||||||
" AND cod_mart = %s", codMdep, codMart);
|
" AND cod_mart = %s", codMdep, codMart);
|
||||||
valMedio = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
valMedio = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
}
|
}
|
||||||
return (valMedio==null?"":new DecimalFormat("#,##0.00").format(valMedio));
|
return (valMedio == null ? "" : new DecimalFormat("#,##0.00").format(valMedio));
|
||||||
} else if (tipoValore.equalsIgnoreCase("P")) {
|
} else if (tipoValore.equalsIgnoreCase("P")) {
|
||||||
return UtilityHashMap.getValueIfExists(var, "posizione_art");
|
return UtilityHashMap.getValueIfExists(var, "posizione_art");
|
||||||
}
|
}
|
||||||
@@ -353,7 +364,7 @@ public class VariazioniPVService {
|
|||||||
private String getQueryVariazioni(VariazioniPvInputDTO variazioniPvDTO,
|
private String getQueryVariazioni(VariazioniPvInputDTO variazioniPvDTO,
|
||||||
HashMap<String, String> setup,
|
HashMap<String, String> setup,
|
||||||
String codVlis,
|
String codVlis,
|
||||||
String selezionaGriglie) throws Exception{
|
String selezionaGriglie) throws Exception {
|
||||||
|
|
||||||
String queryAssortimento = getQueryAssortimento(variazioniPvDTO, setup, codVlis, selezionaGriglie);
|
String queryAssortimento = getQueryAssortimento(variazioniPvDTO, setup, codVlis, selezionaGriglie);
|
||||||
String query =
|
String query =
|
||||||
@@ -473,26 +484,26 @@ public class VariazioniPVService {
|
|||||||
" ON listino.cod_vlis = promozione.cod_vlis AND listino.cod_mart = promozione.cod_mart\n" +
|
" ON listino.cod_vlis = promozione.cod_vlis AND listino.cod_mart = promozione.cod_mart\n" +
|
||||||
" LEFT OUTER JOIN vtb_promo ON promozione.cod_promo = vtb_promo.cod_promo\n" +
|
" LEFT OUTER JOIN vtb_promo ON promozione.cod_promo = vtb_promo.cod_promo\n" +
|
||||||
"WHERE vtb_promo.cod_promo_intercode IS NULL\n" +
|
"WHERE vtb_promo.cod_promo_intercode IS NULL\n" +
|
||||||
((variazioniPvDTO.getTipoReportEnum()==VariazioniPvInputDTO.Type.LISTINO)?
|
((variazioniPvDTO.getTipoReportEnum() == VariazioniPvInputDTO.Type.LISTINO) ?
|
||||||
" AND ( (IsNull('[INVIA_DISATTIVAZIONI]', 'N') = 'S') " +
|
" AND ( (IsNull('[INVIA_DISATTIVAZIONI]', 'N') = 'S') " +
|
||||||
" OR (IsNull('[INVIA_DISATTIVAZIONI]', 'N') = 'N' AND listino.tipo_variazione <> 'D')) ":"" ) +
|
" OR (IsNull('[INVIA_DISATTIVAZIONI]', 'N') = 'N' AND listino.tipo_variazione <> 'D')) " : "") +
|
||||||
"ORDER BY listino.cod_mart ";
|
"ORDER BY listino.cod_mart ";
|
||||||
|
|
||||||
query = query
|
query = query
|
||||||
.replace("'[DATA_VARIAZIONE]'", UtilityDB.valueDateToString(variazioniPvDTO.getDataValidita(), CommonConstants.DATE_FORMAT_YMD))
|
.replace("'[DATA_VARIAZIONE]'", UtilityDB.valueDateToString(variazioniPvDTO.getDataValidita(), CommonConstants.DATE_FORMAT_YMD))
|
||||||
.replace("'[COD_VLIS]'", UtilityDB.valueToString(codVlis) )
|
.replace("'[COD_VLIS]'", UtilityDB.valueToString(codVlis))
|
||||||
.replace("'[CLASSIFICAZIONE_MERCEOLOGICA]'", UtilityDB.valueToString(setup.get("CLASSIFICAZIONE_MERCEOLOGICA")))
|
.replace("'[CLASSIFICAZIONE_MERCEOLOGICA]'", UtilityDB.valueToString(setup.get("CLASSIFICAZIONE_MERCEOLOGICA")))
|
||||||
.replace("'[INVIA_DESC_CASSA]'", UtilityDB.valueToString(setup.get("INVIA_DESC_CASSA")))
|
.replace("'[INVIA_DESC_CASSA]'", UtilityDB.valueToString(setup.get("INVIA_DESC_CASSA")))
|
||||||
.replace("'[INVIA_DISATTIVAZIONI]'", UtilityDB.valueToString( UtilityString.isNull(variazioniPvDTO.getInviaDisattivazioni(), "N")));
|
.replace("'[INVIA_DISATTIVAZIONI]'", UtilityDB.valueToString(UtilityString.isNull(variazioniPvDTO.getInviaDisattivazioni(), "N")));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String getElencoCasse(String codMdep) throws Exception {
|
private String getElencoCasse(String codMdep) throws Exception {
|
||||||
String sql =
|
String sql =
|
||||||
"SELECT mtb_depo_casse.cod_cassa\n" +
|
"SELECT mtb_depo_casse.cod_cassa\n" +
|
||||||
" FROM mtb_depo_casse\n" +
|
" FROM mtb_depo_casse\n" +
|
||||||
" WHERE mtb_depo_casse.cod_mdep = " + UtilityDB.valueToString(codMdep);
|
" WHERE mtb_depo_casse.cod_mdep = " + UtilityDB.valueToString(codMdep);
|
||||||
|
|
||||||
List<Object> casse = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
List<Object> casse = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
|
||||||
@@ -513,14 +524,14 @@ public class VariazioniPVService {
|
|||||||
case LISTINO:
|
case LISTINO:
|
||||||
queryAssortimento =
|
queryAssortimento =
|
||||||
Query.format(
|
Query.format(
|
||||||
"SELECT DISTINCT lisv.cod_vlis, " +
|
"SELECT DISTINCT lisv.cod_vlis, " +
|
||||||
" lisv.cod_mart, " +
|
" lisv.cod_mart, " +
|
||||||
" 'A' as tipo_variazione, " +
|
" 'A' as tipo_variazione, " +
|
||||||
" Convert(varchar(15), null ) as 'cod_mart_view', " +
|
" Convert(varchar(15), null ) as 'cod_mart_view', " +
|
||||||
" 'N' as 'fine_promo' " +
|
" 'N' as 'fine_promo' " +
|
||||||
" FROM mtb_lisv lisv " +
|
" FROM mtb_lisv lisv " +
|
||||||
" WHERE lisv.cod_vlis = %s ",
|
" WHERE lisv.cod_vlis = %s ",
|
||||||
codVlis);
|
codVlis);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case VARIAZIONI:
|
case VARIAZIONI:
|
||||||
@@ -595,14 +606,14 @@ public class VariazioniPVService {
|
|||||||
" INNER JOIN mtb_lisv\n" +
|
" INNER JOIN mtb_lisv\n" +
|
||||||
" ON ISNULL(vtb_list.cod_vlis_rif, vtb_list.cod_vlis) = mtb_lisv.cod_vlis) lisv\n" +
|
" ON ISNULL(vtb_list.cod_vlis_rif, vtb_list.cod_vlis) = mtb_lisv.cod_vlis) lisv\n" +
|
||||||
" ON art.cod_mart = lisv.cod_mart\n" +
|
" ON art.cod_mart = lisv.cod_mart\n" +
|
||||||
"WHERE lisv.cod_vlis = '[COD_VLIS]'" ;
|
"WHERE lisv.cod_vlis = '[COD_VLIS]'";
|
||||||
queryAssortimento =
|
queryAssortimento =
|
||||||
queryAssortimento
|
queryAssortimento
|
||||||
.replace("'[COD_VLIS]'", UtilityDB.valueToString(codVlis))
|
.replace("'[COD_VLIS]'", UtilityDB.valueToString(codVlis))
|
||||||
.replace("'[DATA_VALIDITA]'", UtilityDB.valueDateToString(variazioniPvDTO.getDataValidita(), CommonConstants.DATE_FORMAT_YMD));
|
.replace("'[DATA_VALIDITA]'", UtilityDB.valueDateToString(variazioniPvDTO.getDataValidita(), CommonConstants.DATE_FORMAT_YMD));
|
||||||
break;
|
break;
|
||||||
case PROMOZIONI:
|
case PROMOZIONI:
|
||||||
String filtroPromoOrto = setup.get("FILTRO_ART_ORTOFRUTTA");
|
String filtroPromoOrto = setup.get("FILTRO_ART_ORTOFRUTTA");
|
||||||
queryAssortimento =
|
queryAssortimento =
|
||||||
"SELECT vtb_list_data.cod_vlis, " +
|
"SELECT vtb_list_data.cod_vlis, " +
|
||||||
" mtb_lisv_data.cod_mart, " +
|
" mtb_lisv_data.cod_mart, " +
|
||||||
@@ -638,20 +649,20 @@ public class VariazioniPVService {
|
|||||||
filtroMenu = "mtb_aart.cod_mart not in (" + filtroMenu + ")";
|
filtroMenu = "mtb_aart.cod_mart not in (" + filtroMenu + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
String whereCond =variazioniPvDTO.getWhereCondArt();
|
String whereCond = variazioniPvDTO.getWhereCondArt();
|
||||||
String query =
|
String query =
|
||||||
"SELECT Convert(varchar(5), assortimento.cod_vlis) as cod_vlis,\n " +
|
"SELECT Convert(varchar(5), assortimento.cod_vlis) as cod_vlis,\n " +
|
||||||
"Convert(varchar(15), assortimento.cod_mart) as cod_mart,\n " +
|
"Convert(varchar(15), assortimento.cod_mart) as cod_mart,\n " +
|
||||||
"Convert(varchar(1), max(assortimento.tipo_variazione)) as tipo_variazione,\n " +
|
"Convert(varchar(1), max(assortimento.tipo_variazione)) as tipo_variazione,\n " +
|
||||||
"Convert(varchar(15), assortimento.cod_mart_view) as cod_mart_view,\n " +
|
"Convert(varchar(15), assortimento.cod_mart_view) as cod_mart_view,\n " +
|
||||||
"Convert(varchar(1), assortimento.fine_promo) as fine_promo\n " +
|
"Convert(varchar(1), assortimento.fine_promo) as fine_promo\n " +
|
||||||
" FROM (\n" + queryAssortimento + "\n) assortimento inner join mtb_aart on assortimento.cod_mart = mtb_aart.cod_mart\n " +
|
" FROM (\n" + queryAssortimento + "\n) assortimento inner join mtb_aart on assortimento.cod_mart = mtb_aart.cod_mart\n " +
|
||||||
" WHERE mtb_aart.flag_incl_listino = 'S' AND\n " +
|
" WHERE mtb_aart.flag_incl_listino = 'S' AND\n " +
|
||||||
"mtb_aart.flag_stato = 'A' AND\n " +
|
"mtb_aart.flag_stato = 'A' AND\n " +
|
||||||
" EXISTS ( SELECT cod_barre from mvw_barcode WHERE mvw_barcode.cod_mart = mtb_aart.cod_mart )\n " +
|
" EXISTS ( SELECT cod_barre from mvw_barcode WHERE mvw_barcode.cod_mart = mtb_aart.cod_mart )\n " +
|
||||||
(UtilityString.isNullOrEmpty(whereCond)?"":" AND " + whereCond)+
|
(UtilityString.isNullOrEmpty(whereCond) ? "" : " AND " + whereCond) +
|
||||||
(UtilityString.isNullOrEmpty(filtroMenu)?"":" AND " + filtroMenu)+
|
(UtilityString.isNullOrEmpty(filtroMenu) ? "" : " AND " + filtroMenu) +
|
||||||
" GROUP BY assortimento.cod_vlis, assortimento.cod_mart, assortimento.cod_mart_view, assortimento.fine_promo";
|
" GROUP BY assortimento.cod_vlis, assortimento.cod_mart, assortimento.cod_mart_view, assortimento.fine_promo";
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,7 +677,7 @@ public class VariazioniPVService {
|
|||||||
" vtb_promo_articoli.cod_mart = '" + codMart + "' AND " +
|
" vtb_promo_articoli.cod_mart = '" + codMart + "' AND " +
|
||||||
" vtb_promo.flag_tipo_promo = 'F'";
|
" vtb_promo.flag_tipo_promo = 'F'";
|
||||||
BigDecimal punti = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
BigDecimal punti = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
if ( punti == null ) punti = BigDecimal.ZERO;
|
if (punti == null) punti = BigDecimal.ZERO;
|
||||||
return punti;
|
return punti;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,7 +742,7 @@ public class VariazioniPVService {
|
|||||||
|
|
||||||
List<String> ingredienti = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
List<String> ingredienti = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
int contatore = 1;
|
int contatore = 1;
|
||||||
for(String i: ingredienti) {
|
for (String i : ingredienti) {
|
||||||
IngredientiArticoloType ingredientiArticoloType = objectFactory.createIngredientiArticoloType();
|
IngredientiArticoloType ingredientiArticoloType = objectFactory.createIngredientiArticoloType();
|
||||||
String descrIngr = UtilityString.streNull(i);
|
String descrIngr = UtilityString.streNull(i);
|
||||||
ingredientiArticoloType.setIdRiga(String.valueOf(contatore));
|
ingredientiArticoloType.setIdRiga(String.valueOf(contatore));
|
||||||
@@ -845,35 +856,72 @@ public class VariazioniPVService {
|
|||||||
private void getDatiGriglia(ObjectFactory objectFactory, String codMart, String codMdep, Date dataValidita, CodMartType codMartType) throws Exception {
|
private void getDatiGriglia(ObjectFactory objectFactory, String codMart, String codMdep, Date dataValidita, CodMartType codMartType) throws Exception {
|
||||||
CodAlisType codAlisType = objectFactory.createCodAlisType();
|
CodAlisType codAlisType = objectFactory.createCodAlisType();
|
||||||
|
|
||||||
String query =
|
List<GrigliaAcquistoDTO> grigliaArticolo = Stream.of(grigliaAcquisto)
|
||||||
/*"with arts as (\n" +
|
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart) &&
|
||||||
"select cod_mart, cod_mart as cod_mart_griglia from mtb_aart\n" +
|
x.getCodMdep().equalsIgnoreCase(codMdep) &&
|
||||||
"union all\n" +
|
x.getDataValidita().equals(dataValidita))
|
||||||
"select cod_mart, cod_comp as cod_mart_griglia from mtb_comp \n"+
|
.toList();
|
||||||
"union all\n" +
|
|
||||||
"select cod_comp, cod_mart as cod_mart_griglia from mtb_comp )\n"+ */
|
if (grigliaArticolo.isEmpty()) {
|
||||||
"SELECT TOP 1 griglia.data_validita, " +
|
|
||||||
" griglia.cod_mdep, " +
|
|
||||||
" griglia.cod_mart, " +
|
String query = "select cod_mart from mtb_comp where cod_comp = " + UtilityDB.valueToString(codMart) + " \n" +
|
||||||
" griglia.tipo_variazione, " +
|
"union all\n" +
|
||||||
" ISNULL(griglia.tipo_assortimento, '') AS tipo_assortimento, " +
|
"select cod_comp from mtb_comp where cod_mart = " + UtilityDB.valueToString(codMart);
|
||||||
" griglia.cod_alis, " +
|
|
||||||
" atb_list.descrizione AS descr_list " +
|
List<String> kits = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
" FROM atb_list\n" +
|
|
||||||
"INNER JOIN dbo.getGrigliaAcquisto(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + ", NULL, " +
|
for (String kit : kits) {
|
||||||
UtilityDB.valueToString(codMdep) + ", NULL, NULL) griglia ON atb_list.cod_alis = griglia.cod_alis\n" +
|
grigliaArticolo = Stream.of(grigliaAcquisto)
|
||||||
//"INNER JOIN arts on griglia.cod_mart = arts.cod_mart_griglia \n" +
|
.filter(x -> x.getCodMart().equalsIgnoreCase(kit) &&
|
||||||
" WHERE griglia.tipo_variazione <> 'D' AND " +
|
x.getCodMdep().equalsIgnoreCase(codMdep) &&
|
||||||
" griglia.cod_mart = " + UtilityDB.valueToString(codMart) + "\n " +
|
x.getDataValidita().equals(dataValidita))
|
||||||
" ORDER BY griglia.data_validita DESC ";
|
.toList();
|
||||||
HashMap<String, Object> datiGriglia = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
|
||||||
|
if (!grigliaArticolo.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grigliaArticolo.isEmpty()) {
|
||||||
|
kits.add(codMart);
|
||||||
|
|
||||||
|
query =
|
||||||
|
"SELECT TOP 1 griglia.data_validita, " +
|
||||||
|
" griglia.cod_mdep, " +
|
||||||
|
" griglia.cod_mart, " +
|
||||||
|
" griglia.tipo_variazione, " +
|
||||||
|
" ISNULL(griglia.tipo_assortimento, '') AS tipo_assortimento, " +
|
||||||
|
" griglia.cod_alis, " +
|
||||||
|
" atb_list.descrizione AS descr_list " +
|
||||||
|
" FROM atb_list\n" +
|
||||||
|
"INNER JOIN dbo.getGrigliaAcquisto(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + ", NULL, " +
|
||||||
|
UtilityDB.valueToString(codMdep) + ", NULL, NULL) griglia ON atb_list.cod_alis = griglia.cod_alis\n" +
|
||||||
|
" WHERE griglia.tipo_variazione <> 'D' AND " +
|
||||||
|
" griglia.cod_mart IN (" + UtilityDB.listValueToString(kits) + ")\n " +
|
||||||
|
" ORDER BY griglia.data_validita DESC ";
|
||||||
|
|
||||||
|
grigliaArticolo = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), query, GrigliaAcquistoDTO.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String tipoAssortimento, tipoVariazioneGriglia, codAlis, descrList = null;
|
||||||
|
|
||||||
|
if (grigliaArticolo != null && !grigliaArticolo.isEmpty()) {
|
||||||
|
codAlis = grigliaArticolo.get(0).getCodAlis();
|
||||||
|
tipoAssortimento = UtilityString.streNull(grigliaArticolo.get(0).getTipoAssortimento());
|
||||||
|
tipoVariazioneGriglia = grigliaArticolo.get(0).getTipoVariazione();
|
||||||
|
|
||||||
|
descrList = listini.get(codAlis);
|
||||||
|
if (descrList == null) {
|
||||||
|
String sql = "SELECT descrizione\n" +
|
||||||
|
"FROM atb_list\n" +
|
||||||
|
"WHERE cod_alis = " + UtilityDB.valueToString(codAlis);
|
||||||
|
|
||||||
|
descrList = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
listini.put(codAlis, descrList);
|
||||||
|
}
|
||||||
|
|
||||||
String tipoAssortimento = null, tipoVariazioneGriglia = null, codAlis, descrList;
|
|
||||||
if (datiGriglia != null && datiGriglia.size() > 0) {
|
|
||||||
codAlis = UtilityHashMap.getValueIfExists(datiGriglia, "cod_alis");
|
|
||||||
descrList = UtilityHashMap.getValueIfExists(datiGriglia, "descr_list");
|
|
||||||
tipoAssortimento = UtilityHashMap.getValueIfExists(datiGriglia, "tipo_assortimento");
|
|
||||||
tipoVariazioneGriglia = UtilityHashMap.getValueIfExists(datiGriglia, "tipo_variazione");
|
|
||||||
} else {
|
} else {
|
||||||
codAlis = "NO GRIGLIA";
|
codAlis = "NO GRIGLIA";
|
||||||
descrList = codAlis;
|
descrList = codAlis;
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package it.integry.ems.retail.dto;
|
||||||
|
|
||||||
|
import it.integry.ems_model.annotation.SqlField;
|
||||||
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityInteger;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class GrigliaAcquistoDTO {
|
||||||
|
|
||||||
|
@SqlField("cod_alis")
|
||||||
|
private String codAlis;
|
||||||
|
@SqlField("cod_mdep")
|
||||||
|
private String codMdep;
|
||||||
|
@SqlField("data_validita")
|
||||||
|
private Date dataValidita;
|
||||||
|
@SqlField("note")
|
||||||
|
private String Note;
|
||||||
|
@SqlField("cod_art_forn")
|
||||||
|
private String codArtForn;
|
||||||
|
@SqlField("cod_mart")
|
||||||
|
private String codMart;
|
||||||
|
@SqlField("tipo_assortimento")
|
||||||
|
private String tipoAssortimento;
|
||||||
|
@SqlField("tipo_variazione")
|
||||||
|
private String tipoVariazione;
|
||||||
|
@SqlField("last_griglia")
|
||||||
|
private Long lastGriglia;
|
||||||
|
|
||||||
|
public String getCodAlis() {
|
||||||
|
return codAlis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setCodAlis(String codAlis) {
|
||||||
|
this.codAlis = codAlis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMdep() {
|
||||||
|
return codMdep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setCodMdep(String codMdep) {
|
||||||
|
this.codMdep = codMdep;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDataValidita() {
|
||||||
|
return dataValidita;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setDataValidita(Date dataValidita) {
|
||||||
|
this.dataValidita = dataValidita;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return Note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setNote(String note) {
|
||||||
|
Note = note;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodArtForn() {
|
||||||
|
return codArtForn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setCodArtForn(String codArtForn) {
|
||||||
|
this.codArtForn = codArtForn;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoAssortimento() {
|
||||||
|
return tipoAssortimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setTipoAssortimento(String tipoAssortimento) {
|
||||||
|
this.tipoAssortimento = tipoAssortimento;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoVariazione() {
|
||||||
|
return tipoVariazione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setTipoVariazione(String tipoVariazione) {
|
||||||
|
this.tipoVariazione = tipoVariazione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getLastGriglia() {
|
||||||
|
return lastGriglia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrigliaAcquistoDTO setLastGriglia(Long lastGriglia) {
|
||||||
|
this.lastGriglia = lastGriglia;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package it.integry.ems.retail.wms.ordini_acquisto.dto;
|
package it.integry.ems.retail.dto;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.javabeans.RequestDataDTO;
|
import it.integry.ems.javabeans.RequestDataDTO;
|
||||||
import it.integry.ems.product.dto.TipoCosto;
|
import it.integry.ems.product.dto.TipoCosto;
|
||||||
import it.integry.ems.report.dto.ReportTypeDTO;
|
|
||||||
import it.integry.ems.response.EsitoType;
|
import it.integry.ems.response.EsitoType;
|
||||||
import it.integry.ems.response.FileItem;
|
import it.integry.ems.response.FileItem;
|
||||||
import it.integry.ems.response.ServiceRestResponse;
|
import it.integry.ems.response.ServiceRestResponse;
|
||||||
@@ -20,7 +19,6 @@ import it.integry.ems.user.UserSession;
|
|||||||
import it.integry.ems.utility.UtilityEntity;
|
import it.integry.ems.utility.UtilityEntity;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.entity.DtbOrdt;
|
|
||||||
import it.integry.ems_model.entity.MtbColt;
|
import it.integry.ems_model.entity.MtbColt;
|
||||||
import it.integry.ems_model.entity.NtbRapr;
|
import it.integry.ems_model.entity.NtbRapr;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
@@ -493,9 +491,9 @@ public class PvmController {
|
|||||||
@RequestParam(value = "codProd", required = false) String codProd,
|
@RequestParam(value = "codProd", required = false) String codProd,
|
||||||
@RequestParam(value = "dataValidita", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date dataValidita,
|
@RequestParam(value = "dataValidita", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date dataValidita,
|
||||||
@RequestParam(value = "codVlis", required = false) String codVlis) throws Exception {
|
@RequestParam(value = "codVlis", required = false) String codVlis) throws Exception {
|
||||||
if (dataValidita == null) {
|
|
||||||
|
if (dataValidita == null)
|
||||||
dataValidita = new Date();
|
dataValidita = new Date();
|
||||||
}
|
|
||||||
|
|
||||||
return ServiceRestResponse.createPositiveResponse(pvmService.getCostoProdottoDatiCommerciali(codProd, dataValidita.toInstant(), codVlis));
|
return ServiceRestResponse.createPositiveResponse(pvmService.getCostoProdottoDatiCommerciali(codProd, dataValidita.toInstant(), codVlis));
|
||||||
}
|
}
|
||||||
@@ -507,19 +505,11 @@ public class PvmController {
|
|||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam String codBarreCollo,
|
@RequestParam String codBarreCollo,
|
||||||
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) {
|
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) throws Exception {
|
||||||
ServiceRestResponse response;
|
|
||||||
try {
|
|
||||||
MtbColt collo = pvmService.getColloByBarcode(codBarreCollo, onlyResiduo);
|
|
||||||
|
|
||||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
MtbColt collo = pvmService.getColloByBarcode(codBarreCollo, onlyResiduo);
|
||||||
|
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
return ServiceRestResponse.createPositiveResponse(collo);
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(request.getRequestURI(), e);
|
|
||||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLO_IN_GIAC, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLO_IN_GIAC, method = RequestMethod.POST)
|
||||||
@@ -529,20 +519,12 @@ public class PvmController {
|
|||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull,
|
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull,
|
||||||
@RequestBody MtbColt mtbColt) {
|
@RequestBody MtbColt mtbColt) throws Exception {
|
||||||
|
|
||||||
ServiceRestResponse response;
|
MtbColt collo = pvmService.getColloInGiac(mtbColt, onlyResiduo);
|
||||||
try {
|
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||||
MtbColt collo = pvmService.getColloInGiac(mtbColt, onlyResiduo);
|
|
||||||
|
|
||||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
return ServiceRestResponse.createPositiveResponse(collo);
|
||||||
|
|
||||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(request.getRequestURI(), e);
|
|
||||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLI_IN_BASKET, method = RequestMethod.GET)
|
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLI_IN_BASKET, method = RequestMethod.GET)
|
||||||
@@ -550,15 +532,9 @@ public class PvmController {
|
|||||||
ServiceRestResponse getColliInBasket(
|
ServiceRestResponse getColliInBasket(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam(required = false) String codMdep) {
|
@RequestParam(required = false) String codMdep) throws Exception {
|
||||||
ServiceRestResponse response;
|
|
||||||
try {
|
return ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
||||||
response = ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(request.getRequestURI(), e);
|
|
||||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = EmsRestConstants.PATH_CREA_RAPPORTINO_FG_PVM, method = RequestMethod.POST)
|
@RequestMapping(value = EmsRestConstants.PATH_CREA_RAPPORTINO_FG_PVM, method = RequestMethod.POST)
|
||||||
@@ -566,12 +542,11 @@ public class PvmController {
|
|||||||
List<ServiceRestResponse> creaRapportinoFgPvm(HttpServletRequest request,
|
List<ServiceRestResponse> creaRapportinoFgPvm(HttpServletRequest request,
|
||||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||||
@RequestParam("dataRapp") Date dataRapp,
|
@RequestParam("dataRapp") Date dataRapp,
|
||||||
@RequestParam("codMdep") String codMdep
|
@RequestParam("codMdep") String codMdep) {
|
||||||
) {
|
|
||||||
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
||||||
try {
|
try {
|
||||||
List<EntityBase> entityList = pvmRapportiniFgService.creaRappParziali(dataRapp, codMdep);
|
List<EntityBase> entityList = pvmRapportiniFgService.creaRappParziali(dataRapp, codMdep);
|
||||||
if (entityList != null && entityList.size() > 0) {
|
if (entityList != null && !entityList.isEmpty()) {
|
||||||
listResponse = UtilityEntity.toServiceRestResponse(entityList);
|
listResponse = UtilityEntity.toServiceRestResponse(entityList);
|
||||||
} else {
|
} else {
|
||||||
listResponse.add(new ServiceRestResponse(EsitoType.OK));
|
listResponse.add(new ServiceRestResponse(EsitoType.OK));
|
||||||
@@ -776,7 +751,7 @@ public class PvmController {
|
|||||||
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
@RequestMapping(value = "popolaGiancezaDaInventario", method = RequestMethod.POST)
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ServiceRestResponse popolaGiancezaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
ServiceRestResponse popolaGiancezaDaInventario(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||||
@RequestParam (required = false) String codMdep) throws Exception {
|
@RequestParam(required = false) String codMdep) throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
giacenzaService.popolaGiancezaDaInventario(codMdep);
|
giacenzaService.popolaGiancezaDaInventario(codMdep);
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ public class GiacenzaService {
|
|||||||
|
|
||||||
String codDtipRett = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "GIACENZA_DA_INV", "TIPO_DOC_RETT");
|
String codDtipRett = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "GIACENZA_DA_INV", "TIPO_DOC_RETT");
|
||||||
|
|
||||||
|
cancellazioneKit(codMdep);
|
||||||
|
logger.debug(String.format(GiacenzaService.class.getSimpleName() + " - Deposito %s - Cancellazione kit: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs", codMdep));
|
||||||
|
|
||||||
|
|
||||||
String sql;
|
String sql;
|
||||||
sql =
|
sql =
|
||||||
Query.format(
|
Query.format(
|
||||||
@@ -120,6 +124,22 @@ public class GiacenzaService {
|
|||||||
UtilityEntity.throwEntitiesException(entityRet);
|
UtilityEntity.throwEntitiesException(entityRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void cancellazioneKit(String codMdep ) throws Exception {
|
||||||
|
String sql = Query.format(
|
||||||
|
"SELECT g.cod_mdep, g.cod_mart\n" +
|
||||||
|
"FROM carelli_giacenza_prog g INNER JOIN mtb_aart ON g.cod_mart =mtb_aart.cod_mart \n" +
|
||||||
|
"WHERE articolo_composto = 'S' AND g.cod_mdep = %s\n",
|
||||||
|
codMdep);
|
||||||
|
|
||||||
|
List<CarelliGiacenzaProg> carelliGiacenzaProgs = new ResultSetMapper().mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, CarelliGiacenzaProg.class, OperationType.DELETE);
|
||||||
|
|
||||||
|
List<EntityBase> entityRet = entityProcessor.processEntityList(carelliGiacenzaProgs, false, false, false);
|
||||||
|
|
||||||
|
UtilityEntity.throwEntitiesException(entityRet);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void popolaQtaMovimenti(String codMdep, String queryArt, List<String> articoliSalvati) throws Exception {
|
private void popolaQtaMovimenti(String codMdep, String queryArt, List<String> articoliSalvati) throws Exception {
|
||||||
String sql;
|
String sql;
|
||||||
sql =
|
sql =
|
||||||
|
|||||||
@@ -2247,91 +2247,95 @@ public class PvmService {
|
|||||||
|
|
||||||
|
|
||||||
public MtbColt getColloByBarcode(String codBarreCollo, boolean onlyResiduo) throws Exception {
|
public MtbColt getColloByBarcode(String codBarreCollo, boolean onlyResiduo) throws Exception {
|
||||||
HashMap<String, Object> datiCollo = new HashMap<>();
|
|
||||||
|
|
||||||
if (codBarreCollo.startsWith("U")) {
|
MtbColt mtbColt = getColloByExternalBarcode(codBarreCollo);
|
||||||
datiCollo.put("gestione", null);
|
|
||||||
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(1, 3)));
|
|
||||||
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(3, 10)));
|
|
||||||
|
|
||||||
if (codBarreCollo.length() > 10) {
|
if(mtbColt == null) {
|
||||||
datiCollo.put("serie", codBarreCollo.substring(10));
|
|
||||||
} else {
|
|
||||||
datiCollo.put("serie", "UL");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
HashMap<String, Object> datiCollo = new HashMap<>();
|
||||||
|
if (codBarreCollo.startsWith("U")) {
|
||||||
|
datiCollo.put("gestione", null);
|
||||||
|
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(1, 3)));
|
||||||
|
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(3, 10)));
|
||||||
|
|
||||||
} else {
|
if (codBarreCollo.length() > 10) {
|
||||||
datiCollo = new HashMap<>();
|
datiCollo.put("serie", codBarreCollo.substring(10));
|
||||||
|
} else {
|
||||||
codBarreCollo = codBarreCollo.substring(0, codBarreCollo.length() - 1); //Rimuovo il check digit finale
|
datiCollo.put("serie", "UL");
|
||||||
|
|
||||||
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 5, codBarreCollo.length())));
|
|
||||||
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 7, codBarreCollo.length() - 5)));
|
|
||||||
int gestioneInt = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 8));
|
|
||||||
|
|
||||||
int numMultiplier = 0;
|
|
||||||
if (codBarreCollo.length() >= 9) {
|
|
||||||
numMultiplier = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 9)) * 100000;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
datiCollo.put("num", ((Integer) datiCollo.get("num")) + numMultiplier);
|
|
||||||
|
|
||||||
String gestione;
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch (gestioneInt) {
|
|
||||||
case 1:
|
|
||||||
gestione = "A";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
gestione = "L";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
gestione = "V";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Exception("Il collo letto ha un errore nella gestione");
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new Exception("Il collo letto ha un errore nella gestione");
|
|
||||||
|
} else {
|
||||||
|
datiCollo = new HashMap<>();
|
||||||
|
|
||||||
|
codBarreCollo = codBarreCollo.substring(0, codBarreCollo.length() - 1); //Rimuovo il check digit finale
|
||||||
|
|
||||||
|
datiCollo.put("num", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 5, codBarreCollo.length())));
|
||||||
|
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(codBarreCollo.length() - 7, codBarreCollo.length() - 5)));
|
||||||
|
int gestioneInt = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 8));
|
||||||
|
|
||||||
|
int numMultiplier = 0;
|
||||||
|
if (codBarreCollo.length() >= 9) {
|
||||||
|
numMultiplier = Integer.parseInt("" + codBarreCollo.charAt(codBarreCollo.length() - 9)) * 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
datiCollo.put("num", ((Integer) datiCollo.get("num")) + numMultiplier);
|
||||||
|
|
||||||
|
String gestione;
|
||||||
|
|
||||||
|
try {
|
||||||
|
switch (gestioneInt) {
|
||||||
|
case 1:
|
||||||
|
gestione = "A";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
gestione = "L";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
gestione = "V";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Il collo letto ha un errore nella gestione");
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new Exception("Il collo letto ha un errore nella gestione");
|
||||||
|
}
|
||||||
|
|
||||||
|
datiCollo.put("gestione", gestione);
|
||||||
|
datiCollo.put("serie", "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
datiCollo.put("gestione", gestione);
|
String query;
|
||||||
datiCollo.put("serie", "/");
|
|
||||||
|
String whereCondGestione = "";
|
||||||
|
|
||||||
|
if (datiCollo.containsKey("gestione") && datiCollo.get("gestione") != null) {
|
||||||
|
whereCondGestione = " gestione = " + UtilityDB.valueToString(datiCollo.get("gestione")) + " AND ";
|
||||||
|
}
|
||||||
|
|
||||||
|
query = "SELECT * "
|
||||||
|
+ "FROM mtb_colt "
|
||||||
|
+ "WHERE "
|
||||||
|
+ whereCondGestione
|
||||||
|
+ " num_collo = " + UtilityDB.valueToString(datiCollo.get("num")) + " AND "
|
||||||
|
+ " RIGHT(YEAR(data_collo), 2) = " + UtilityDB.valueToString(datiCollo.get("anno")) + " AND "
|
||||||
|
+ " ser_collo = " + UtilityDB.valueToString(datiCollo.get("serie"));
|
||||||
|
|
||||||
|
|
||||||
|
mtbColt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), query, MtbColt.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
MtbColt mtbColt;
|
if (mtbColt == null) return null;
|
||||||
String query;
|
|
||||||
|
|
||||||
String whereCondGestione = "";
|
|
||||||
|
|
||||||
if (datiCollo.containsKey("gestione") && datiCollo.get("gestione") != null) {
|
|
||||||
whereCondGestione = " gestione = " + UtilityDB.valueToString(datiCollo.get("gestione")) + " AND ";
|
|
||||||
}
|
|
||||||
|
|
||||||
query = "SELECT * "
|
|
||||||
+ "FROM mtb_colt "
|
|
||||||
+ "WHERE "
|
|
||||||
+ whereCondGestione
|
|
||||||
+ " num_collo = " + UtilityDB.valueToString(datiCollo.get("num")) + " AND "
|
|
||||||
+ " RIGHT(YEAR(data_collo), 2) = " + UtilityDB.valueToString(datiCollo.get("anno")) + " AND "
|
|
||||||
+ " ser_collo = " + UtilityDB.valueToString(datiCollo.get("serie"));
|
|
||||||
|
|
||||||
PreparedStatement ps = multiDBTransactionManager.getPrimaryDatasource().getConnection().prepareStatement(query);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
ResultSetMapper rsMapper = new ResultSetMapper();
|
|
||||||
mtbColt = rsMapper.mapResultSetToObject(rs, MtbColt.class);
|
|
||||||
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
|
|
||||||
if (mtbColt == null) return mtbColt;
|
|
||||||
else return getColloInGiac(mtbColt, onlyResiduo);
|
else return getColloInGiac(mtbColt, onlyResiduo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MtbColt getColloByExternalBarcode(String barcode) throws Exception {
|
||||||
|
String sql = Query.format("SELECT * FROM " + MtbColt.ENTITY +
|
||||||
|
" WHERE barcode_ul = %s", barcode);
|
||||||
|
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||||
|
}
|
||||||
|
|
||||||
public MtbColt getColloInGiac(MtbColt mtbColt, boolean onlyResiduo) throws Exception {
|
public MtbColt getColloInGiac(MtbColt mtbColt, boolean onlyResiduo) throws Exception {
|
||||||
|
|
||||||
@@ -3574,7 +3578,7 @@ public class PvmService {
|
|||||||
" TempCount.*\n" +
|
" TempCount.*\n" +
|
||||||
"FROM TempResult,\n" +
|
"FROM TempResult,\n" +
|
||||||
" TempCount\n" +
|
" TempCount\n" +
|
||||||
"ORDER BY 1\n" +
|
"ORDER BY 2 DESC, 1 DESC\n" +
|
||||||
"OFFSET (" + UtilityDB.valueToString(pageNum) + " - 1) * " + UtilityDB.valueToString(pageSize) + " ROWS FETCH NEXT " + UtilityDB.valueToString(pageSize) + " ROWS ONLY";
|
"OFFSET (" + UtilityDB.valueToString(pageNum) + " - 1) * " + UtilityDB.valueToString(pageSize) + " ROWS FETCH NEXT " + UtilityDB.valueToString(pageSize) + " ROWS ONLY";
|
||||||
|
|
||||||
List<RowInventarioDTO> inventari = new ArrayList<>();
|
List<RowInventarioDTO> inventari = new ArrayList<>();
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class SmartEnterpriseService {
|
|||||||
" ISNULL(', ' + vtb_dest.citta, '') AS destinazione,\n" +
|
" ISNULL(', ' + vtb_dest.citta, '') AS destinazione,\n" +
|
||||||
" gtb_anag.cod_anag,\n" +
|
" gtb_anag.cod_anag,\n" +
|
||||||
" vtb_dest.cod_vdes,\n" +
|
" vtb_dest.cod_vdes,\n" +
|
||||||
" case when gvw_part_iva_infragroup.part_iva is not null THEN 'L' ELSE gestione_anag END as gestione_anag\n" +
|
" case when gvw_part_iva_infragroup.part_iva is not null and gestione_anag = 'A' THEN 'L' ELSE gestione_anag END as gestione_anag\n" +
|
||||||
" FROM gtb_anag\n" +
|
" FROM gtb_anag\n" +
|
||||||
" INNER JOIN vtb_dest ON gtb_anag.cod_anag = vtb_dest.cod_anag\n" +
|
" INNER JOIN vtb_dest ON gtb_anag.cod_anag = vtb_dest.cod_anag\n" +
|
||||||
" INNER JOIN (SELECT cod_anag, flag_stato, 'A' as gestione_anag\n" +
|
" INNER JOIN (SELECT cod_anag, flag_stato, 'A' as gestione_anag\n" +
|
||||||
|
|||||||
@@ -0,0 +1,178 @@
|
|||||||
|
package it.integry.ems.retail.service;
|
||||||
|
|
||||||
|
import it.integry.annotations.PostWebServerConstruct;
|
||||||
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.looper.service.LooperService;
|
||||||
|
import it.integry.ems.retail.dto.GrigliaAcquistoDTO;
|
||||||
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
|
import it.integry.ems.settings.SettingsController;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
|
import it.integry.ems.utility.UtilityDebug;
|
||||||
|
import it.integry.ems_model.service.SetupGest;
|
||||||
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityDate;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.docx4j.wml.U;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.ContextLoader;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class GrigliaAcquistoHandlerService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LooperService looperService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SettingsModel settingsModel;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SettingsController settingsController;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SetupGest setupGest;
|
||||||
|
|
||||||
|
private static final int SIX_HOURS_DELAY = 21600000;
|
||||||
|
private static final int DAYS = 3;
|
||||||
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
private final HashMap<String, List<GrigliaAcquistoDTO>> grigliaAcquistoCachedData = new HashMap<>();
|
||||||
|
|
||||||
|
@PostWebServerConstruct
|
||||||
|
public void init() {
|
||||||
|
if (saveCache()) {
|
||||||
|
looperService.add(() -> this.internalCache(grigliaAcquistoCachedData), SIX_HOURS_DELAY, GrigliaAcquistoHandlerService.class.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean saveCache() {
|
||||||
|
return !UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer() && settingsModel.isPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isGestioneAbilitata(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||||
|
String sql =
|
||||||
|
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||||
|
"FROM stb_abil\n" +
|
||||||
|
"WHERE cod_opz IN ('AG018', 'AG019') \n" +
|
||||||
|
" AND flag_abil <> 'N'";
|
||||||
|
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Object> checkDbDistributore(MultiDBTransactionManager multiDBTransactionManager) throws Exception{
|
||||||
|
HashMap<String, Object> returnHashMap = new HashMap<>();
|
||||||
|
String dbName = multiDBTransactionManager.getPrimaryDatasource().getDbName();
|
||||||
|
|
||||||
|
String sql = "SELECT db_distributore FROM azienda";
|
||||||
|
String dbDistributore = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
returnHashMap.put("dbDistributore", dbDistributore);
|
||||||
|
|
||||||
|
if (dbDistributore == null){
|
||||||
|
returnHashMap.put("existSync", false);
|
||||||
|
return returnHashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
sql = "SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||||
|
"FROM " + dbDistributore + ".dbo.stb_subscription\n" +
|
||||||
|
"WHERE table_name = 'atb_griglie'\n" +
|
||||||
|
" AND flag_attivo = 'S'\n" +
|
||||||
|
" AND user_name = " + UtilityDB.valueToString(dbName);
|
||||||
|
boolean existSync = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
|
returnHashMap.put("existSync", existSync);
|
||||||
|
|
||||||
|
return returnHashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void internalCache(HashMap<String, List<GrigliaAcquistoDTO>> grigliaAcquistoCachedData) {
|
||||||
|
try {
|
||||||
|
String historyProfileDb = settingsController.getHistoryProfileDb();
|
||||||
|
|
||||||
|
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections()
|
||||||
|
.stream()
|
||||||
|
.filter(AvailableConnectionsModel::getInternalDb)
|
||||||
|
.filter(x -> !historyProfileDb.equalsIgnoreCase(x.getProfileName()))
|
||||||
|
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||||
|
|
||||||
|
for (String dbName : databases.keySet()) {
|
||||||
|
String profileName = databases.get(dbName).get(0).getProfileName();
|
||||||
|
MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false);
|
||||||
|
|
||||||
|
if (isGestioneAbilitata(multiDBTransactionManager)){
|
||||||
|
HashMap<String, Object> checkDbDistributore = checkDbDistributore(multiDBTransactionManager);
|
||||||
|
boolean existSync = (boolean) checkDbDistributore.get("existSync");
|
||||||
|
|
||||||
|
if (!existSync){
|
||||||
|
Date startDate = new Date();
|
||||||
|
|
||||||
|
List<GrigliaAcquistoDTO> grigliaAcquistoDTO = getGrigliaAcquisto(multiDBTransactionManager);
|
||||||
|
|
||||||
|
if(!grigliaAcquistoDTO.isEmpty())
|
||||||
|
grigliaAcquistoCachedData.put(dbName.toUpperCase(), grigliaAcquistoDTO);
|
||||||
|
|
||||||
|
logger.trace(profileName + " - Griglia acquisto: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
multiDBTransactionManager.closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<GrigliaAcquistoDTO> getGrigliaAcquisto(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
|
||||||
|
List<GrigliaAcquistoDTO> grigliaAcquisto = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < DAYS; i++) {
|
||||||
|
Date dataValidita = UtilityDate.getTodayWithoutTime();
|
||||||
|
dataValidita = UtilityDate.dateAdd(dataValidita, i);
|
||||||
|
|
||||||
|
String sql = "SELECT cod_alis,\n" +
|
||||||
|
" cod_mdep,\n" +
|
||||||
|
" " + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + " AS data_validita,\n" +
|
||||||
|
" note,\n" +
|
||||||
|
" cod_art_for,\n" +
|
||||||
|
" cod_mart,\n" +
|
||||||
|
" tipo_assortimento,\n" +
|
||||||
|
" tipo_variazione,\n" +
|
||||||
|
" last_griglia\n" +
|
||||||
|
"FROM dbo.getGrigliaAcquisto(" + UtilityDB.valueDateToString(dataValidita, CommonConstants.DATE_FORMAT_YMD) + ", NULL, NULL, NULL, NULL)\n" +
|
||||||
|
"WHERE tipo_variazione <> 'D'";
|
||||||
|
|
||||||
|
List<GrigliaAcquistoDTO> tempGrigliaAcquisto = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, GrigliaAcquistoDTO.class);
|
||||||
|
if (tempGrigliaAcquisto != null && !tempGrigliaAcquisto.isEmpty())
|
||||||
|
grigliaAcquisto.addAll(tempGrigliaAcquisto);
|
||||||
|
}
|
||||||
|
|
||||||
|
return grigliaAcquisto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GrigliaAcquistoDTO> getGrigliaAcquisto() throws Exception {
|
||||||
|
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||||
|
|
||||||
|
if (!saveCache()) {
|
||||||
|
return getGrigliaAcquisto(multiDBTransactionManager);
|
||||||
|
} else {
|
||||||
|
List<GrigliaAcquistoDTO> setupList;
|
||||||
|
HashMap<String, Object> checkDbDistributore = checkDbDistributore(multiDBTransactionManager);
|
||||||
|
String dbName = multiDBTransactionManager.getPrimaryDatasource().getDbName();
|
||||||
|
boolean existSync = (boolean) checkDbDistributore.get("existSync");
|
||||||
|
String dbDistributore = (String) checkDbDistributore.get("dbDistributore");
|
||||||
|
|
||||||
|
if (existSync){
|
||||||
|
setupList = grigliaAcquistoCachedData.get(dbDistributore.toUpperCase());
|
||||||
|
}else{
|
||||||
|
setupList = grigliaAcquistoCachedData.get(dbName.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setupList == null)
|
||||||
|
return getGrigliaAcquisto(multiDBTransactionManager);
|
||||||
|
return setupList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package it.integry.ems.retail.wms.ordini_acquisto.service;
|
package it.integry.ems.retail.service;
|
||||||
|
|
||||||
import it.integry.annotations.PostWebServerConstruct;
|
import it.integry.annotations.PostWebServerConstruct;
|
||||||
import it.integry.ems.looper.service.LooperService;
|
import it.integry.ems.looper.service.LooperService;
|
||||||
import it.integry.ems.retail.wms.ordini_acquisto.dto.ListiniOrdiniAcquistoDTO;
|
import it.integry.ems.retail.dto.ListiniOrdiniAcquistoDTO;
|
||||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||||
import it.integry.ems.settings.Model.SettingsModel;
|
import it.integry.ems.settings.Model.SettingsModel;
|
||||||
import it.integry.ems.settings.SettingsController;
|
import it.integry.ems.settings.SettingsController;
|
||||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class WMSListiniOrdiniAcquistoHandlerService {
|
public class ListiniAcquistoHandlerService {
|
||||||
|
|
||||||
private final Logger logger = LogManager.getLogger();
|
private final Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class WMSListiniOrdiniAcquistoHandlerService {
|
|||||||
@PostWebServerConstruct
|
@PostWebServerConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
if ( saveCache() ) {
|
if ( saveCache() ) {
|
||||||
looperService.add(() -> this.internalCache(ListiniCachedData), SIX_HOURS_DELAY, WMSListiniOrdiniAcquistoHandlerService.class.getName());
|
looperService.add(() -> this.internalCache(ListiniCachedData), SIX_HOURS_DELAY, ListiniAcquistoHandlerService.class.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class WMSListiniOrdiniAcquistoHandlerService {
|
|||||||
List<ListiniOrdiniAcquistoDTO> Listini = getListini(multiDBTransactionManager);
|
List<ListiniOrdiniAcquistoDTO> Listini = getListini(multiDBTransactionManager);
|
||||||
listiniCachedData.put(dbName, Listini);
|
listiniCachedData.put(dbName, Listini);
|
||||||
}
|
}
|
||||||
logger.trace(WMSListiniOrdiniAcquistoHandlerService.class.getSimpleName() + " - Listini: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
logger.trace(ListiniAcquistoHandlerService.class.getSimpleName() + " - Listini: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||||
|
|
||||||
multiDBTransactionManager.closeAll();
|
multiDBTransactionManager.closeAll();
|
||||||
}
|
}
|
||||||
@@ -94,6 +94,7 @@ public class WMSAccettazioneService {
|
|||||||
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
|
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
|
||||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||||
|
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||||
.setSegno(1);
|
.setSegno(1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class CreateUDCRequestDTO {
|
|||||||
|
|
||||||
private String annotazioni;
|
private String annotazioni;
|
||||||
|
|
||||||
|
private String barcodeUl;
|
||||||
|
|
||||||
private List<CreateUDCRequestOrderDTO> orders;
|
private List<CreateUDCRequestOrderDTO> orders;
|
||||||
|
|
||||||
|
|
||||||
@@ -71,6 +73,15 @@ public class CreateUDCRequestDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBarcodeUl() {
|
||||||
|
return barcodeUl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateUDCRequestDTO setBarcodeUl(String barcodeUl) {
|
||||||
|
this.barcodeUl = barcodeUl;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<CreateUDCRequestOrderDTO> getOrders() {
|
public List<CreateUDCRequestOrderDTO> getOrders() {
|
||||||
return orders;
|
return orders;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ public class WMSLavorazioneService {
|
|||||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||||
|
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||||
.setSegno(1);
|
.setSegno(1);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import com.annimon.stream.Stream;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.save.ArtDTO;
|
import it.integry.ems.retail.pvmRetail.dto.save.ArtDTO;
|
||||||
import it.integry.ems.retail.pvmRetail.dto.save.SaveDTO;
|
import it.integry.ems.retail.pvmRetail.dto.save.SaveDTO;
|
||||||
|
import it.integry.ems.retail.service.ListiniAcquistoHandlerService;
|
||||||
import it.integry.ems.retail.wms.ordini_acquisto.dto.BarcodeOrdiniAcquistoDTO;
|
import it.integry.ems.retail.wms.ordini_acquisto.dto.BarcodeOrdiniAcquistoDTO;
|
||||||
import it.integry.ems.retail.wms.ordini_acquisto.dto.ListiniOrdiniAcquistoDTO;
|
import it.integry.ems.retail.dto.ListiniOrdiniAcquistoDTO;
|
||||||
import it.integry.ems.retail.wms.ordini_acquisto.dto.MerceOrdiniAcquistoDTO;
|
import it.integry.ems.retail.wms.ordini_acquisto.dto.MerceOrdiniAcquistoDTO;
|
||||||
import it.integry.ems.retail.wms.ordini_acquisto.dto.OrdiniAcquistoGrigliaDTO;
|
import it.integry.ems.retail.wms.ordini_acquisto.dto.OrdiniAcquistoGrigliaDTO;
|
||||||
import it.integry.ems.service.EntityProcessor;
|
import it.integry.ems.service.EntityProcessor;
|
||||||
@@ -52,7 +53,7 @@ public class WMSOrdiniAcquistoService {
|
|||||||
private SetupGest setupGest;
|
private SetupGest setupGest;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSListiniOrdiniAcquistoHandlerService listiniOrdiniAcquistoHandlerService;
|
private ListiniAcquistoHandlerService listiniOrdiniAcquistoHandlerService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSBarcodeOrdiniAcquistoHandlerService barcodeOrdiniAcquistoHandlerService;
|
private WMSBarcodeOrdiniAcquistoHandlerService barcodeOrdiniAcquistoHandlerService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -266,7 +266,10 @@ public class SystemController {
|
|||||||
.setTipoAnag("C")
|
.setTipoAnag("C")
|
||||||
.setFlagTipologia("A")
|
.setFlagTipologia("A")
|
||||||
.setEstimatedTime(startDate)
|
.setEstimatedTime(startDate)
|
||||||
.setEstimatedEndtime(endDate);
|
.setEstimatedEndtime(endDate)
|
||||||
|
.setEffectiveTime(startDate)
|
||||||
|
.setEffectiveEndtime(endDate)
|
||||||
|
.setOreRapportino(new BigDecimal(0.25));
|
||||||
|
|
||||||
activityInstallazione.setOperation(OperationType.INSERT);
|
activityInstallazione.setOperation(OperationType.INSERT);
|
||||||
stbActivitiesToUpdate.add(activityInstallazione);
|
stbActivitiesToUpdate.add(activityInstallazione);
|
||||||
|
|||||||
Reference in New Issue
Block a user