Merge branch 'develop' into feature/Syncronizations
This commit is contained in:
@@ -549,7 +549,6 @@
|
||||
<option value="$PROJECT_DIR$/ems-retail/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="PWA">
|
||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||
@@ -952,6 +951,44 @@
|
||||
</option>
|
||||
</method>
|
||||
</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 name="PropertiesComponent">
|
||||
<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.sync.MultiDBTransaction.AdvancedDataSource;
|
||||
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.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -67,6 +69,11 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
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 {
|
||||
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;
|
||||
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.PdfWriter;
|
||||
import com.itextpdf.tool.xml.XMLWorkerHelper;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.enums.DigitalSignatureType;
|
||||
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.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bouncycastle.cms.CMSSignedData;
|
||||
@@ -31,6 +33,7 @@ import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.security.Security;
|
||||
import java.sql.Connection;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -413,4 +416,21 @@ public class UtilityFile {
|
||||
}
|
||||
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.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -162,6 +161,9 @@ public class MtbColt extends EntityBase {
|
||||
@SqlField("id_lotto")
|
||||
private Integer idLotto;
|
||||
|
||||
@SqlField(value = "barcode_ul", nullable = true, maxLength = 20)
|
||||
private String barcodeUl;
|
||||
|
||||
private String insPartitaMag;
|
||||
|
||||
private transient String stpPrz;
|
||||
@@ -610,6 +612,15 @@ public class MtbColt extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public MtbColt setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MtbColr> getMtbColr() {
|
||||
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.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -304,7 +302,7 @@ public class VtbOfft extends EntityBase {
|
||||
UtilityDB.valueToString(getIdOfferta()));
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
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.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -50,6 +52,9 @@ public class VtbViaggi extends EntityBase {
|
||||
@SqlField(value = "num_prenotazione", maxLength = 20)
|
||||
private String numPrenotazione;
|
||||
|
||||
@SqlField(value = "mezzo", maxLength = 1, defaultObjectValue = "0")
|
||||
private Mezzo mezzo;
|
||||
|
||||
public VtbViaggi() {
|
||||
super();
|
||||
}
|
||||
@@ -128,4 +133,56 @@ public class VtbViaggi extends EntityBase {
|
||||
this.numPrenotazione = numPrenotazione;
|
||||
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;
|
||||
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFCellUtil;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
@@ -133,6 +134,9 @@ public class UtilityExcel {
|
||||
if (UtilityString.isNullOrEmpty(fileName))
|
||||
fileName = requestDTO.getFileName();
|
||||
|
||||
if (!FilenameUtils.getExtension(fileName).equalsIgnoreCase("xlsx"))
|
||||
throw new Exception("Formato file non supportato");
|
||||
|
||||
if (!path.endsWith("\\") || !path.endsWith("/"))
|
||||
path = path + File.separator;
|
||||
|
||||
|
||||
@@ -562,7 +562,7 @@ end
|
||||
rule "completeInsertVtbOfft"
|
||||
when
|
||||
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
|
||||
String fullName = CommonRules.getFullName(conn, username);
|
||||
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" +
|
||||
(isTable?"":" AND stb_activity.user_name = '" + username + "'") +
|
||||
" GROUP BY stb_activity.parent_activity_id),\n" +
|
||||
"\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" +
|
||||
" processi AS (SELECT stb_activity.cod_jcom,\n" +
|
||||
" stb_activity.user_name,\n" +
|
||||
" stb_activity.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";
|
||||
|
||||
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" +
|
||||
" AND stb_activity.user_name <> 'F0000'\n" +
|
||||
" AND NOT EXISTS(SELECT *\n" +
|
||||
" FROM escludi_commesse\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.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -59,21 +60,20 @@ public class RossoGarganoSyncService {
|
||||
String sql =
|
||||
"SELECT CAST(FORMAT(DATEPART(YEAR, data_iniz), '0000') +\n" +
|
||||
" FORMAT(DATEPART(MONTH, data_iniz), '00') +\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" +
|
||||
" FORMAT(DATEPART(DAY, data_iniz), '00') AS NUMERIC) as data_iniz\n" +
|
||||
"FROM azienda\n" +
|
||||
" 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)
|
||||
throw new Exception("Errore nel calcolo di data inizio e data fine");
|
||||
sql =
|
||||
"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 dataIniz = UtilityHashMap.getValueIfExists(date, "data_iniz");
|
||||
BigDecimal dataFine = UtilityHashMap.getValueIfExists(date, "data_fine");
|
||||
BigDecimal dataFine = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
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");
|
||||
@@ -81,7 +81,7 @@ public class RossoGarganoSyncService {
|
||||
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");
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -308,7 +308,9 @@ public class RossoGarganoSyncService {
|
||||
|
||||
}
|
||||
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 (ctbMovt.getCtbScad() == null) ctbMovt.setCtbScad(new ArrayList<>());
|
||||
ctbMovt.getCtbScad().addAll(scadenzeAperte);
|
||||
@@ -1043,14 +1045,21 @@ public class RossoGarganoSyncService {
|
||||
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;
|
||||
if (UtilityString.isNumber(pnPartita.substring(0, 2)))
|
||||
anno = "20" + pnPartita.substring(0, 2);
|
||||
|
||||
String numero = pnPartita.substring(2);
|
||||
if (UtilityString.isNumber(numero))
|
||||
|
||||
try {
|
||||
numero = new Integer(numero).toString();
|
||||
} catch (NumberFormatException e ) {
|
||||
|
||||
}
|
||||
|
||||
List<CtbScad> elencoScadenze = new ArrayList<>();
|
||||
Integer annoPart = null, numDoc = null, tipoPartita = null;
|
||||
@@ -1083,13 +1092,13 @@ public class RossoGarganoSyncService {
|
||||
numDoc = UtilityHashMap.getValueIfExists(datiPartita, "num_doc");
|
||||
serDoc = UtilityHashMap.getValueIfExists(datiPartita, "ser_doc");
|
||||
tipoPartita = UtilityHashMap.getValueIfExists(datiPartita, "tipo_partita");
|
||||
} else {
|
||||
} else if ( anno != null && Integer.valueOf(anno).intValue() <= 2021){
|
||||
numDoc = 0;
|
||||
serDoc = "/";
|
||||
annoPart = 2021;
|
||||
}
|
||||
|
||||
if (ctbMovt.getCtbScad() != null) {
|
||||
if (ctbMovt.getCtbScad() != null && annoPart != null) {
|
||||
Integer finalAnnoPart = annoPart;
|
||||
String finalSerDoc = serDoc;
|
||||
Integer finalNumDoc = numDoc;
|
||||
@@ -1107,12 +1116,49 @@ public class RossoGarganoSyncService {
|
||||
ctbMovt.getCtbScad().removeAll(elencoScadenze);
|
||||
}
|
||||
|
||||
TipoPartita tipoPartitaEnum = null;
|
||||
|
||||
if (tipoPartita != null) {
|
||||
if ((pnSegnoMovimento.equalsIgnoreCase("A") && TipoPartita.fromValue(tipoPartita.intValue()) == TipoPartita.PASSIVA) ||
|
||||
(pnSegnoMovimento.equalsIgnoreCase("D") && TipoPartita.fromValue(tipoPartita.intValue()) == TipoPartita.ATTIVA)
|
||||
tipoPartitaEnum = TipoPartita.fromValue(tipoPartita.intValue());
|
||||
if ((pnSegnoMovimento.equalsIgnoreCase("A") && tipoPartitaEnum == TipoPartita.PASSIVA) ||
|
||||
(pnSegnoMovimento.equalsIgnoreCase("D") && tipoPartitaEnum == TipoPartita.ATTIVA)
|
||||
) {
|
||||
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());
|
||||
|
||||
@@ -36,12 +36,10 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Service
|
||||
@@ -367,12 +365,14 @@ public class DocumentiAcquistoImportService {
|
||||
" dtb_doct.cod_dtip = %s AND " +
|
||||
" dtb_doct.data_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.getCodDtip(),
|
||||
dtbDoct.getDataDoc(),
|
||||
dtbDoct.getSerDoc(),
|
||||
dtbDoct.getNumDoc());
|
||||
dtbDoct.getNumDoc(),
|
||||
dtbDoct.getListino());
|
||||
|
||||
Boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
sql =
|
||||
@@ -979,8 +979,14 @@ public class DocumentiAcquistoImportService {
|
||||
m.setPrimaryDs(ds.getProfileName());
|
||||
|
||||
for (EntityBase e : entityList){
|
||||
DtbDoct dtbDoct = (DtbDoct) e;
|
||||
|
||||
UpdProgOrdini(m, dtbDoct, -1);
|
||||
|
||||
entityProcessor.processEntity(e, true, false, requestData.getUsername(), m, false);
|
||||
entityReturn.add(e);
|
||||
|
||||
UpdProgOrdini(m, dtbDoct, 1);
|
||||
}
|
||||
}catch (Exception e){
|
||||
m.rollbackAll();
|
||||
@@ -991,6 +997,20 @@ public class DocumentiAcquistoImportService {
|
||||
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 {
|
||||
List<EntityBase> entityList = new ArrayList<>();
|
||||
for (RifOrdApuliaDTO rifOrdApulia : rifOrdApuliaList){
|
||||
|
||||
@@ -83,7 +83,7 @@ public class CambioTipoDocPlanService {
|
||||
return data1.compareTo(data2);
|
||||
}).toList();
|
||||
|
||||
List<HashMap<String, String>> utenti = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<Date, List<DtbDoctCambioTipoDoc>> dataCmov : listaDataCmov) {
|
||||
boolean error = false;
|
||||
|
||||
@@ -116,8 +116,6 @@ public class CambioTipoDocPlanService {
|
||||
boolean existDoc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (existDoc) {
|
||||
String compilatoDa = CommonRules.getFullName(multiDBTransactionManager.getPrimaryConnection(), doc.getKey().getUserName());
|
||||
doc.getKey().setFullName(compilatoDa);
|
||||
List<CambioTipoDocDTO.Allegati> listaAllegati =
|
||||
Stream.of(doc.getValue())
|
||||
.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();
|
||||
if (first.isPresent()) {
|
||||
|
||||
@@ -111,12 +111,6 @@ public class CambioTipoDocService {
|
||||
.setCodDtip(doc.getCodDtipNew())
|
||||
.setPrevistaFat(null)
|
||||
.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);
|
||||
if (doc.getAllegati() != null && doc.getAllegati().size() > 0) {
|
||||
|
||||
@@ -81,14 +81,14 @@ public class DistribuzioneColliService {
|
||||
psRemoveOrdRifsFromMtbColrs.executeUpdate();
|
||||
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",
|
||||
filtroDistribuzioneColloDTO.getNumCollo(),
|
||||
UtilityDate.formatDate(filtroDistribuzioneColloDTO.getDataCollo(), CommonConstants.DATE_FORMAT_DMY)));
|
||||
|
||||
sourceMtbColt = (MtbColt) result[0];
|
||||
sourceMtbColt = (MtbColt) result.get(0);
|
||||
|
||||
//Lettura delle righe del collo in ingresso
|
||||
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 , " +
|
||||
" ttb_stag.descrizione AS stagione , " +
|
||||
" 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 " +
|
||||
" INNER JOIN mtb_aart " +
|
||||
" ON ttb_style.cod_style = mtb_aart.cod_mart " +
|
||||
@@ -108,7 +108,7 @@ public class WoocommerceService {
|
||||
" ), " +
|
||||
" disponibile AS " +
|
||||
" ( " +
|
||||
" SELECT " +
|
||||
" SELECT DISTINCT " +
|
||||
" dettaglio.cod_style , " +
|
||||
" dettaglio.cod_barre AS ean , " +
|
||||
" dettaglio.pos , " +
|
||||
|
||||
@@ -7,15 +7,18 @@ import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityFile;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity.AtbGriglie;
|
||||
import it.integry.ems_model.entity.AtbGriglieArt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityExcel;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.bcel.generic.Select;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
@@ -27,6 +30,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@@ -130,6 +134,23 @@ public class ImportGrigliaAcquistoService {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1029,10 +1029,10 @@ public class ProductServices {
|
||||
searchArtLink.setOperation(OperationType.SELECT);
|
||||
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.setCodMart(codMart);
|
||||
mtbAartLink.setPathLink(fileName);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
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.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.offer.dto.DettCostoIn;
|
||||
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.utility.UtilityDirs;
|
||||
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.Marshaller;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -39,6 +36,11 @@ public class VariazioniPVService {
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
@Autowired
|
||||
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 {
|
||||
|
||||
@@ -120,6 +122,15 @@ public class VariazioniPVService {
|
||||
|
||||
String query = getQueryVariazioni(variazioniPvDTO, setup, codVlis, getSetupSectionDepo.get("SELEZIONA_GRIGLIE"));
|
||||
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) {
|
||||
CodMartType codMart = fillArticoloData(objectFactory,
|
||||
variazioni, variazioniPvDTO, invioIngredienti, getSetupSectionDepo, codMdep, colNameDescrEstesa,
|
||||
@@ -845,13 +856,37 @@ public class VariazioniPVService {
|
||||
private void getDatiGriglia(ObjectFactory objectFactory, String codMart, String codMdep, Date dataValidita, CodMartType codMartType) throws Exception {
|
||||
CodAlisType codAlisType = objectFactory.createCodAlisType();
|
||||
|
||||
String query =
|
||||
/*"with arts as (\n" +
|
||||
"select cod_mart, cod_mart as cod_mart_griglia from mtb_aart\n" +
|
||||
List<GrigliaAcquistoDTO> grigliaArticolo = Stream.of(grigliaAcquisto)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart) &&
|
||||
x.getCodMdep().equalsIgnoreCase(codMdep) &&
|
||||
x.getDataValidita().equals(dataValidita))
|
||||
.toList();
|
||||
|
||||
if (grigliaArticolo.isEmpty()) {
|
||||
|
||||
|
||||
String query = "select cod_mart from mtb_comp where cod_comp = " + UtilityDB.valueToString(codMart) + " \n" +
|
||||
"union all\n" +
|
||||
"select cod_mart, cod_comp as cod_mart_griglia from mtb_comp \n"+
|
||||
"union all\n" +
|
||||
"select cod_comp, cod_mart as cod_mart_griglia from mtb_comp )\n"+ */
|
||||
"select cod_comp from mtb_comp where cod_mart = " + UtilityDB.valueToString(codMart);
|
||||
|
||||
List<String> kits = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
|
||||
for (String kit : kits) {
|
||||
grigliaArticolo = Stream.of(grigliaAcquisto)
|
||||
.filter(x -> x.getCodMart().equalsIgnoreCase(kit) &&
|
||||
x.getCodMdep().equalsIgnoreCase(codMdep) &&
|
||||
x.getDataValidita().equals(dataValidita))
|
||||
.toList();
|
||||
|
||||
if (!grigliaArticolo.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (grigliaArticolo.isEmpty()) {
|
||||
kits.add(codMart);
|
||||
|
||||
query =
|
||||
"SELECT TOP 1 griglia.data_validita, " +
|
||||
" griglia.cod_mdep, " +
|
||||
" griglia.cod_mart, " +
|
||||
@@ -862,18 +897,31 @@ public class VariazioniPVService {
|
||||
" 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" +
|
||||
//"INNER JOIN arts on griglia.cod_mart = arts.cod_mart_griglia \n" +
|
||||
" WHERE griglia.tipo_variazione <> 'D' AND " +
|
||||
" griglia.cod_mart = " + UtilityDB.valueToString(codMart) + "\n " +
|
||||
" griglia.cod_mart IN (" + UtilityDB.listValueToString(kits) + ")\n " +
|
||||
" ORDER BY griglia.data_validita DESC ";
|
||||
HashMap<String, Object> datiGriglia = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
} else {
|
||||
codAlis = "NO GRIGLIA";
|
||||
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;
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
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.FileItem;
|
||||
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_model.base.EntityBase;
|
||||
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.NtbRapr;
|
||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||
@@ -493,9 +491,9 @@ public class PvmController {
|
||||
@RequestParam(value = "codProd", required = false) String codProd,
|
||||
@RequestParam(value = "dataValidita", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date dataValidita,
|
||||
@RequestParam(value = "codVlis", required = false) String codVlis) throws Exception {
|
||||
if (dataValidita == null) {
|
||||
|
||||
if (dataValidita == null)
|
||||
dataValidita = new Date();
|
||||
}
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(pvmService.getCostoProdottoDatiCommerciali(codProd, dataValidita.toInstant(), codVlis));
|
||||
}
|
||||
@@ -507,19 +505,11 @@ public class PvmController {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam String codBarreCollo,
|
||||
@RequestParam(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) {
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull) throws Exception {
|
||||
|
||||
MtbColt collo = pvmService.getColloByBarcode(codBarreCollo, onlyResiduo);
|
||||
|
||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||
|
||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
return ServiceRestResponse.createPositiveResponse(collo);
|
||||
}
|
||||
|
||||
@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(required = false, defaultValue = "false") boolean onlyResiduo,
|
||||
@RequestParam(required = false, defaultValue = "true") boolean throwExcIfNull,
|
||||
@RequestBody MtbColt mtbColt) {
|
||||
@RequestBody MtbColt mtbColt) throws Exception {
|
||||
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
MtbColt collo = pvmService.getColloInGiac(mtbColt, onlyResiduo);
|
||||
|
||||
if (collo == null && throwExcIfNull) throw new Exception("Nessun bancale trovato");
|
||||
|
||||
response = ServiceRestResponse.createPositiveResponse((Object) collo);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
return ServiceRestResponse.createPositiveResponse(collo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_GET_COLLI_IN_BASKET, method = RequestMethod.GET)
|
||||
@@ -550,15 +532,9 @@ public class PvmController {
|
||||
ServiceRestResponse getColliInBasket(
|
||||
HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam(required = false) String codMdep) {
|
||||
ServiceRestResponse response;
|
||||
try {
|
||||
response = ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
response = new ServiceRestResponse(EsitoType.KO, configuration, e);
|
||||
}
|
||||
return response;
|
||||
@RequestParam(required = false) String codMdep) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(pvmService.getColliInBasket(codMdep));
|
||||
}
|
||||
|
||||
@RequestMapping(value = EmsRestConstants.PATH_CREA_RAPPORTINO_FG_PVM, method = RequestMethod.POST)
|
||||
@@ -566,12 +542,11 @@ public class PvmController {
|
||||
List<ServiceRestResponse> creaRapportinoFgPvm(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String configuration,
|
||||
@RequestParam("dataRapp") Date dataRapp,
|
||||
@RequestParam("codMdep") String codMdep
|
||||
) {
|
||||
@RequestParam("codMdep") String codMdep) {
|
||||
List<ServiceRestResponse> listResponse = new ArrayList<ServiceRestResponse>();
|
||||
try {
|
||||
List<EntityBase> entityList = pvmRapportiniFgService.creaRappParziali(dataRapp, codMdep);
|
||||
if (entityList != null && entityList.size() > 0) {
|
||||
if (entityList != null && !entityList.isEmpty()) {
|
||||
listResponse = UtilityEntity.toServiceRestResponse(entityList);
|
||||
} else {
|
||||
listResponse.add(new ServiceRestResponse(EsitoType.OK));
|
||||
|
||||
@@ -81,6 +81,10 @@ public class GiacenzaService {
|
||||
|
||||
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;
|
||||
sql =
|
||||
Query.format(
|
||||
@@ -120,6 +124,22 @@ public class GiacenzaService {
|
||||
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 {
|
||||
String sql;
|
||||
sql =
|
||||
|
||||
@@ -2247,8 +2247,12 @@ public class PvmService {
|
||||
|
||||
|
||||
public MtbColt getColloByBarcode(String codBarreCollo, boolean onlyResiduo) throws Exception {
|
||||
HashMap<String, Object> datiCollo = new HashMap<>();
|
||||
|
||||
MtbColt mtbColt = getColloByExternalBarcode(codBarreCollo);
|
||||
|
||||
if(mtbColt == null) {
|
||||
|
||||
HashMap<String, Object> datiCollo = new HashMap<>();
|
||||
if (codBarreCollo.startsWith("U")) {
|
||||
datiCollo.put("gestione", null);
|
||||
datiCollo.put("anno", Integer.parseInt(codBarreCollo.substring(1, 3)));
|
||||
@@ -2302,7 +2306,6 @@ public class PvmService {
|
||||
datiCollo.put("serie", "/");
|
||||
}
|
||||
|
||||
MtbColt mtbColt;
|
||||
String query;
|
||||
|
||||
String whereCondGestione = "";
|
||||
@@ -2319,19 +2322,20 @@ public class PvmService {
|
||||
+ " 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);
|
||||
mtbColt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), query, MtbColt.class);
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ps.close();
|
||||
|
||||
if (mtbColt == null) return mtbColt;
|
||||
if (mtbColt == null) return null;
|
||||
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 {
|
||||
|
||||
@@ -3574,7 +3578,7 @@ public class PvmService {
|
||||
" TempCount.*\n" +
|
||||
"FROM TempResult,\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";
|
||||
|
||||
List<RowInventarioDTO> inventari = new ArrayList<>();
|
||||
|
||||
@@ -135,7 +135,7 @@ public class SmartEnterpriseService {
|
||||
" ISNULL(', ' + vtb_dest.citta, '') AS destinazione,\n" +
|
||||
" gtb_anag.cod_anag,\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" +
|
||||
" 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" +
|
||||
|
||||
@@ -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.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.SettingsModel;
|
||||
import it.integry.ems.settings.SettingsController;
|
||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class WMSListiniOrdiniAcquistoHandlerService {
|
||||
public class ListiniAcquistoHandlerService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -46,7 +46,7 @@ public class WMSListiniOrdiniAcquistoHandlerService {
|
||||
@PostWebServerConstruct
|
||||
public void init() {
|
||||
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);
|
||||
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();
|
||||
}
|
||||
@@ -94,6 +94,7 @@ public class WMSAccettazioneService {
|
||||
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
|
||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||
.setSegno(1);
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ public class CreateUDCRequestDTO {
|
||||
|
||||
private String annotazioni;
|
||||
|
||||
private String barcodeUl;
|
||||
|
||||
private List<CreateUDCRequestOrderDTO> orders;
|
||||
|
||||
|
||||
@@ -71,6 +73,15 @@ public class CreateUDCRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBarcodeUl() {
|
||||
return barcodeUl;
|
||||
}
|
||||
|
||||
public CreateUDCRequestDTO setBarcodeUl(String barcodeUl) {
|
||||
this.barcodeUl = barcodeUl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CreateUDCRequestOrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
@@ -469,6 +469,7 @@ public class WMSLavorazioneService {
|
||||
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
|
||||
.setCodTcol(createUDCRequestDTO.getCodTcol())
|
||||
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
|
||||
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
|
||||
.setSegno(1);
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@ import com.annimon.stream.Stream;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.ems.retail.pvmRetail.dto.save.ArtDTO;
|
||||
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.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.OrdiniAcquistoGrigliaDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
@@ -52,7 +53,7 @@ public class WMSOrdiniAcquistoService {
|
||||
private SetupGest setupGest;
|
||||
|
||||
@Autowired
|
||||
private WMSListiniOrdiniAcquistoHandlerService listiniOrdiniAcquistoHandlerService;
|
||||
private ListiniAcquistoHandlerService listiniOrdiniAcquistoHandlerService;
|
||||
@Autowired
|
||||
private WMSBarcodeOrdiniAcquistoHandlerService barcodeOrdiniAcquistoHandlerService;
|
||||
@Autowired
|
||||
|
||||
@@ -266,7 +266,10 @@ public class SystemController {
|
||||
.setTipoAnag("C")
|
||||
.setFlagTipologia("A")
|
||||
.setEstimatedTime(startDate)
|
||||
.setEstimatedEndtime(endDate);
|
||||
.setEstimatedEndtime(endDate)
|
||||
.setEffectiveTime(startDate)
|
||||
.setEffectiveEndtime(endDate)
|
||||
.setOreRapportino(new BigDecimal(0.25));
|
||||
|
||||
activityInstallazione.setOperation(OperationType.INSERT);
|
||||
stbActivitiesToUpdate.add(activityInstallazione);
|
||||
|
||||
Reference in New Issue
Block a user