Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts: # ems-core/src/main/java/it/integry/ems/rules/completing/SalesRules.java
This commit is contained in:
@@ -12,6 +12,7 @@ import it.integry.WooCommerce.dto.order.WooCommerceBillingDTO;
|
|||||||
import it.integry.WooCommerce.dto.order.WooCommerceShippingDTO;
|
import it.integry.WooCommerce.dto.order.WooCommerceShippingDTO;
|
||||||
import it.integry.WooCommerce.dto.product.WooCommerceImageDTO;
|
import it.integry.WooCommerce.dto.product.WooCommerceImageDTO;
|
||||||
import it.integry.WooCommerce.dto.product.WooCommerceProductAttributeDTO;
|
import it.integry.WooCommerce.dto.product.WooCommerceProductAttributeDTO;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.db.ResultSetMapper;
|
import it.integry.ems_model.db.ResultSetMapper;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
@@ -28,9 +29,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -453,11 +451,11 @@ public class WooCommerceArticoliDataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBooleanSetup(String keySection) throws Exception {
|
public boolean getBooleanSetup(String keySection) throws Exception {
|
||||||
return setupGest.getSetupBoolean("WOOCOMMERCE", "SETUP", keySection);
|
return setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "WOOCOMMERCE", "SETUP", keySection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSetupInteger(String keySection) throws Exception {
|
public int getSetupInteger(String keySection) throws Exception {
|
||||||
return setupGest.getSetupInteger("WOOCOMMERCE", "SETUP", keySection);
|
return setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "WOOCOMMERCE", "SETUP", keySection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WooCommerceImageDTO> getImagesArticolo(String codMart) throws Exception {
|
public List<WooCommerceImageDTO> getImagesArticolo(String codMart) throws Exception {
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class DocumentBusinessLogic {
|
|||||||
|
|
||||||
if (dtbDoct.getDrlDocAttached().size() > 0) {
|
if (dtbDoct.getDrlDocAttached().size() > 0) {
|
||||||
SetupGest setupGest = new SetupGest();
|
SetupGest setupGest = new SetupGest();
|
||||||
String minDataRic = setupGest.getSetup("CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE");
|
String minDataRic = setupGest.getSetup(conn, "CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE");
|
||||||
Date dataRicMin = UtilityString.parseDate(minDataRic);
|
Date dataRicMin = UtilityString.parseDate(minDataRic);
|
||||||
|
|
||||||
String idAttach = dtbDoct.getDrlDocAttached().get(0).getIdAttach();
|
String idAttach = dtbDoct.getDrlDocAttached().get(0).getIdAttach();
|
||||||
|
|||||||
@@ -1414,7 +1414,7 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
|||||||
private static Integer addImpostaBollo(Connection connection, DtbDoct testata, HashMap<String, BigDecimal> lhm_castelletto, List<DtbDocs> speseCalc,
|
private static Integer addImpostaBollo(Connection connection, DtbDoct testata, HashMap<String, BigDecimal> lhm_castelletto, List<DtbDocs> speseCalc,
|
||||||
Integer maxRigaSpesa, String whereCondExcSpese, BigDecimal totDoc) throws Exception {
|
Integer maxRigaSpesa, String whereCondExcSpese, BigDecimal totDoc) throws Exception {
|
||||||
final String tipoCalcolo = "BOLLO";
|
final String tipoCalcolo = "BOLLO";
|
||||||
String impMinDoc = setupGest.getSetup("EXPORT_DOCUMENTI VENDITA", "FATTURE_FPR", "DATI_BOLLO_IMP_MIN");
|
String impMinDoc = setupGest.getSetup(connection, "EXPORT_DOCUMENTI VENDITA", "FATTURE_FPR", "DATI_BOLLO_IMP_MIN");
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(impMinDoc) && !impMinDoc.equalsIgnoreCase("0")) {
|
if (!UtilityString.isNullOrEmpty(impMinDoc) && !impMinDoc.equalsIgnoreCase("0")) {
|
||||||
BigDecimal impMinDocB = new BigDecimal(impMinDoc);
|
BigDecimal impMinDocB = new BigDecimal(impMinDoc);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
public class DocumentRules extends QueryRules {
|
public class DocumentRules extends QueryRules {
|
||||||
public static Date getDataRicezioneAllegati(Connection conn, List<DrlDocAttached> drlDocAttached) throws Exception {
|
public static Date getDataRicezioneAllegati(Connection conn, List<DrlDocAttached> drlDocAttached) throws Exception {
|
||||||
SetupGest setupGest = new SetupGest();
|
SetupGest setupGest = new SetupGest();
|
||||||
String minDataRic = setupGest.getSetup("CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE");
|
String minDataRic = setupGest.getSetup(conn, "CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE");
|
||||||
Date dataRicMin = UtilityString.parseDate(minDataRic);
|
Date dataRicMin = UtilityString.parseDate(minDataRic);
|
||||||
|
|
||||||
String idAttach = drlDocAttached.get(0).getIdAttach();
|
String idAttach = drlDocAttached.get(0).getIdAttach();
|
||||||
@@ -33,7 +33,7 @@ public class DocumentRules extends QueryRules {
|
|||||||
" FROM stb_files_attached " +
|
" FROM stb_files_attached " +
|
||||||
" WHERE id_attach = " + UtilityDB.valueToString(idAttach);
|
" WHERE id_attach = " + UtilityDB.valueToString(idAttach);
|
||||||
|
|
||||||
Date dataRicezione = (Date) UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sqlAttach);
|
Date dataRicezione = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sqlAttach);
|
||||||
|
|
||||||
return dataRicezione;
|
return dataRicezione;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,15 @@ package it.integry.ems.rules.completing;
|
|||||||
|
|
||||||
|
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||||
import it.integry.ems_model.entity.common.DtbOrdCommonR;
|
import it.integry.ems_model.entity.common.DtbOrdCommonR;
|
||||||
import it.integry.ems_model.types.ApplicationName;
|
import it.integry.ems_model.types.ApplicationName;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.*;
|
import it.integry.ems_model.utility.*;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -422,7 +419,7 @@ public class OrderRules extends QueryRules {
|
|||||||
|
|
||||||
public static void sospendiOrdine(Connection conn, DtbOrdt dtbOrdt) throws Exception {
|
public static void sospendiOrdine(Connection conn, DtbOrdt dtbOrdt) throws Exception {
|
||||||
if (dtbOrdt.getGestione().equalsIgnoreCase("V") && dtbOrdt.getOperation() == OperationType.INSERT) {
|
if (dtbOrdt.getGestione().equalsIgnoreCase("V") && dtbOrdt.getOperation() == OperationType.INSERT) {
|
||||||
boolean sospendiOrd = setupGest.getSetupBoolean("DTB_ORDT", "SOSPENDI_ORD", "FUORI_FIDO");
|
boolean sospendiOrd = setupGest.getSetupBoolean(conn, "DTB_ORDT", "SOSPENDI_ORD", "FUORI_FIDO");
|
||||||
if (sospendiOrd) {
|
if (sospendiOrd) {
|
||||||
BigDecimal totOrd = dtbOrdt.getTotImponib().add(dtbOrdt.getTotIva());
|
BigDecimal totOrd = dtbOrdt.getTotImponib().add(dtbOrdt.getTotIva());
|
||||||
totOrd = totOrd.subtract(dtbOrdt.getAcconto());
|
totOrd = totOrd.subtract(dtbOrdt.getAcconto());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class PackagesRules extends QueryRules {
|
|||||||
public static String completePartitaMag4DataScad(Connection conn, String codMart, Date dataScad) throws Exception {
|
public static String completePartitaMag4DataScad(Connection conn, String codMart, Date dataScad) throws Exception {
|
||||||
String partitaMag = null;
|
String partitaMag = null;
|
||||||
|
|
||||||
boolean selectPartitaMag = setupGest.getSetupBoolean("MTB_PARTITA_MAG", "SETUP", "SELECT_PARTITA_MAG");
|
boolean selectPartitaMag = setupGest.getSetupBoolean(conn, "MTB_PARTITA_MAG", "SETUP", "SELECT_PARTITA_MAG");
|
||||||
|
|
||||||
if (selectPartitaMag) {
|
if (selectPartitaMag) {
|
||||||
String sql =
|
String sql =
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package it.integry.ems.rules.completing;
|
|||||||
import com.annimon.stream.Stream;
|
import com.annimon.stream.Stream;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
import it.integry.ems.exception.CheckConstraintException;
|
import it.integry.ems.exception.CheckConstraintException;
|
||||||
import it.integry.ems.utility.UtilityDebug;
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems_model.config.EmsRestConstants;
|
import it.integry.ems_model.config.EmsRestConstants;
|
||||||
import it.integry.ems_model.db.ResultSetMapper;
|
import it.integry.ems_model.db.ResultSetMapper;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
@@ -15,14 +15,14 @@ import it.integry.ems_model.types.OperationType;
|
|||||||
import it.integry.ems_model.utility.*;
|
import it.integry.ems_model.utility.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.joda.time.DateTimeComparator;
|
import org.joda.time.DateTimeComparator;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.*;
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ public class SalesRules extends QueryRules {
|
|||||||
!x.getFlagEquiPrezzo().equalsIgnoreCase("N")).toList();
|
!x.getFlagEquiPrezzo().equalsIgnoreCase("N")).toList();
|
||||||
|
|
||||||
|
|
||||||
if (lisv.size() == 0)
|
if (lisv.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
List<String> artEquiErr = Stream.of(lisv)
|
List<String> artEquiErr = Stream.of(lisv)
|
||||||
@@ -1058,7 +1058,7 @@ public class SalesRules extends QueryRules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updArtEqui(Connection conn, VtbListData testata) throws Exception {
|
public static void updArtEqui(Connection conn, VtbListData testata) throws Exception {
|
||||||
boolean aggiornaEquivalenti = setupGest.getSetupBoolean("vtb_list", "ART_EQUIVALENTI", "AGGIORNAMENTO_AUTO");
|
boolean aggiornaEquivalenti = setupGest.getSetupBoolean(conn, "vtb_list", "ART_EQUIVALENTI", "AGGIORNAMENTO_AUTO");
|
||||||
if (!aggiornaEquivalenti) return;
|
if (!aggiornaEquivalenti) return;
|
||||||
|
|
||||||
String query =
|
String query =
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||||||
import com.fasterxml.jackson.databind.JavaType;
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import it.integry.common.var.CommonConstants;
|
import it.integry.common.var.CommonConstants;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityString;
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
@@ -13,9 +14,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.context.ContextLoader;
|
import org.springframework.web.context.ContextLoader;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -66,30 +64,22 @@ public class SetupGest {
|
|||||||
return Integer.parseInt(getSetup(conn, gestName, section, keySection, ""));
|
return Integer.parseInt(getSetup(conn, gestName, section, keySection, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSetupInteger(String gestName, String section, String keySection) throws Exception {
|
public int getSetupInteger(Connection conn, String gestName, String section, String keySection, int defaultValue) throws Exception {
|
||||||
return Integer.parseInt(getSetup(gestName, section, keySection));
|
String value = getSetup(conn, gestName, section, keySection);
|
||||||
}
|
|
||||||
|
|
||||||
public int getSetupInteger(String gestName, String section, String keySection, int defaultValue) throws Exception {
|
|
||||||
String value = getSetup(gestName, section, keySection);
|
|
||||||
return value != null ? Integer.parseInt(value) : defaultValue;
|
return value != null ? Integer.parseInt(value) : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSetupBigDecimal(String gestName, String section, String keySection) throws Exception {
|
public BigDecimal getSetupBigDecimal(Connection conn, String gestName, String section, String keySection) throws Exception {
|
||||||
return getSetupBigDecimal(gestName, section, keySection, null);
|
return getSetupBigDecimal(conn, gestName, section, keySection, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSetupBigDecimal(String gestName, String section, String keySection, BigDecimal defaultValue) throws Exception {
|
public BigDecimal getSetupBigDecimal(Connection conn, String gestName, String section, String keySection, BigDecimal defaultValue) throws Exception {
|
||||||
String value = getSetup(gestName, section, keySection);
|
String value = getSetup(conn, gestName, section, keySection);
|
||||||
return value != null ? BigDecimal.valueOf(Double.parseDouble(getSetup(gestName, section, keySection))) : defaultValue;
|
return value != null ? BigDecimal.valueOf(Double.parseDouble(getSetup(gestName, section, keySection))) : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSetupDetBigDecimal(String gestName, String section, String keySection, String colRif) throws Exception {
|
public BigDecimal getSetupDetBigDecimal(Connection conn, String gestName, String section, String keySection, String colRif, BigDecimal defaultValue) throws Exception {
|
||||||
return getSetupDetBigDecimal(gestName, section, keySection, colRif, null);
|
String value = getSetupDet(conn, gestName, section, keySection, colRif);
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getSetupDetBigDecimal(String gestName, String section, String keySection, String colRif, BigDecimal defaultValue) throws Exception {
|
|
||||||
String value = getSetupDet(gestName, section, keySection, colRif);
|
|
||||||
return value != null ? BigDecimal.valueOf(Double.parseDouble(value)) : defaultValue;
|
return value != null ? BigDecimal.valueOf(Double.parseDouble(value)) : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +111,7 @@ public class SetupGest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setSetup(String gestName, String section, String keySection, Object value) throws Exception {
|
public void setSetup(Connection conn, String gestName, String section, String keySection, Object value) throws Exception {
|
||||||
String sql = "";
|
String sql = "";
|
||||||
|
|
||||||
if (value instanceof Date) {
|
if (value instanceof Date) {
|
||||||
@@ -136,10 +126,8 @@ public class SetupGest {
|
|||||||
+ " AND section = " + UtilityDB.valueToString(section)
|
+ " AND section = " + UtilityDB.valueToString(section)
|
||||||
+ " AND key_section = " + UtilityDB.valueToString(keySection);
|
+ " AND key_section = " + UtilityDB.valueToString(keySection);
|
||||||
|
|
||||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
|
||||||
PreparedStatement ps = multiDBTransactionManager.getPrimaryConnection().prepareStatement(query);
|
UtilityDB.executeSimpleUpdate(conn, query);
|
||||||
ps.executeUpdate();
|
|
||||||
ps.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getSetup(String gestName, String section, String keySection, TypeReference<T> type) throws Exception {
|
public <T> T getSetup(String gestName, String section, String keySection, TypeReference<T> type) throws Exception {
|
||||||
|
|||||||
@@ -371,8 +371,8 @@ public class PassiveInvoiceService {
|
|||||||
if (receivedDate == null) {
|
if (receivedDate == null) {
|
||||||
receivedDate = new Date();
|
receivedDate = new Date();
|
||||||
logger.warn(String.format("Non è possibile risalire al messaggio relativo all'allegato %s: verrà utilizzata la data attuale come data ricezione...", fileName));
|
logger.warn(String.format("Non è possibile risalire al messaggio relativo all'allegato %s: verrà utilizzata la data attuale come data ricezione...", fileName));
|
||||||
} else if (UtilityString.isNullOrEmpty(setupGest.getSetup("CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE"))) {
|
} else if (UtilityString.isNullOrEmpty(setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE"))) {
|
||||||
setupGest.setSetup("CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE", new Date());
|
setupGest.setSetup(multiDBTransactionManager.getPrimaryConnection(), "CTB_MOVI", "SETUP", "SET_DATA_RICEZIONE", new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recupero allegato parent
|
// Recupero allegato parent
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ public class OrdifyService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal sconto = orderRow.getSconto5().add(orderRow.getSconto6());
|
BigDecimal sconto = orderRow.getSconto5().add(orderRow.getSconto6());
|
||||||
BigDecimal percProv = setupGest.getSetupBigDecimal("ORDIFY", "SETUP", "PERC_PROVVIGIONE");
|
BigDecimal percProv = setupGest.getSetupBigDecimal(multiDBTransactionManager.getPrimaryConnection(), "ORDIFY", "SETUP", "PERC_PROVVIGIONE");
|
||||||
BigDecimal maxSconto = setupGest.getSetupBigDecimal("ORDIFY", "SETUP", "MAX_SCONTO");
|
BigDecimal maxSconto = setupGest.getSetupBigDecimal(multiDBTransactionManager.getPrimaryConnection(), "ORDIFY", "SETUP", "MAX_SCONTO");
|
||||||
|
|
||||||
BigDecimal prov = UtilityBigDecimal.isNullOrZero(percProv) || UtilityBigDecimal.isNullOrZero(maxSconto) ? null : maxSconto.subtract(sconto).multiply(percProv);
|
BigDecimal prov = UtilityBigDecimal.isNullOrZero(percProv) || UtilityBigDecimal.isNullOrZero(maxSconto) ? null : maxSconto.subtract(sconto).multiply(percProv);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import it.integry.ems_model.exception.GestSetupNotFoundException;
|
|||||||
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.*;
|
import it.integry.ems_model.utility.*;
|
||||||
import org.apache.bcel.classfile.Utility;
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -61,8 +60,6 @@ import java.time.LocalDate;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static it.integry.ems.rules.completing.PackagesRules.completeDatiOrdine;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
public class MesProductionServiceV2 {
|
public class MesProductionServiceV2 {
|
||||||
@@ -91,6 +88,7 @@ public class MesProductionServiceV2 {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductionOrderDataHandlerService productionOrderDataHandlerService;
|
private ProductionOrderDataHandlerService productionOrderDataHandlerService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductionWarehouseService productionWarehouseService;
|
private ProductionWarehouseService productionWarehouseService;
|
||||||
|
|
||||||
@@ -104,6 +102,7 @@ public class MesProductionServiceV2 {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSLavorazioneService wmsLavorazioneService;
|
private WMSLavorazioneService wmsLavorazioneService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSGenericService wmsGenericService;
|
private WMSGenericService wmsGenericService;
|
||||||
|
|
||||||
@@ -124,9 +123,9 @@ public class MesProductionServiceV2 {
|
|||||||
String url = String.format("http://%s:%d/%s", serviceIp, servicePort, serviceName);
|
String url = String.format("http://%s:%d/%s", serviceIp, servicePort, serviceName);
|
||||||
StringBuilder srb = new StringBuilder();
|
StringBuilder srb = new StringBuilder();
|
||||||
|
|
||||||
Integer timeout = setupGest.getSetupInteger("MES","HMI","TIMEOUT_MACHINE_CONNECTION",0);
|
Integer timeout = setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "MES", "HMI", "TIMEOUT_MACHINE_CONNECTION", 0);
|
||||||
|
|
||||||
int requestStatusCode = HttpRestWrapper.callGeneric(url, null, null, jsonRequest, ContentType.APPLICATION_JSON, srb, null,timeout);
|
int requestStatusCode = HttpRestWrapper.callGeneric(url, null, null, jsonRequest, ContentType.APPLICATION_JSON, srb, null, timeout);
|
||||||
|
|
||||||
if (requestStatusCode != HttpURLConnection.HTTP_OK) {
|
if (requestStatusCode != HttpURLConnection.HTTP_OK) {
|
||||||
logger.debug("Impossibile comunicare con il servizio richiesto: " + url);
|
logger.debug("Impossibile comunicare con il servizio richiesto: " + url);
|
||||||
@@ -1286,11 +1285,11 @@ public class MesProductionServiceV2 {
|
|||||||
throw new Exception("Il barcode richiesto non ha fornito alcun risultato!");
|
throw new Exception("Il barcode richiesto non ha fornito alcun risultato!");
|
||||||
|
|
||||||
List<MtbColr> rows = collo.getMtbColr();
|
List<MtbColr> rows = collo.getMtbColr();
|
||||||
if (UtilityList.isNullOrEmpty(rows)){
|
if (UtilityList.isNullOrEmpty(rows)) {
|
||||||
MtbColr versamentoSuOrdine = getVersamentoBarcodeSuOrdine(dto.getOrdine(),dto.getBarcode());
|
MtbColr versamentoSuOrdine = getVersamentoBarcodeSuOrdine(dto.getOrdine(), dto.getBarcode());
|
||||||
if (versamentoSuOrdine != null && UtilityBigDecimal.greaterThan(versamentoSuOrdine.getQtaCol(),BigDecimal.ZERO)){
|
if (versamentoSuOrdine != null && UtilityBigDecimal.greaterThan(versamentoSuOrdine.getQtaCol(), BigDecimal.ZERO)) {
|
||||||
response.setVersamento(versamentoSuOrdine);
|
response.setVersamento(versamentoSuOrdine);
|
||||||
}else{
|
} else {
|
||||||
throw new Exception("La UL richiesta è vuota!");
|
throw new Exception("La UL richiesta è vuota!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1327,7 +1326,7 @@ public class MesProductionServiceV2 {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private MtbColr getVersamentoBarcodeSuOrdine(DtbOrdt ordine,String barcode) throws Exception {
|
private MtbColr getVersamentoBarcodeSuOrdine(DtbOrdt ordine, String barcode) throws Exception {
|
||||||
String sql = Query.format("SELECT mtb_colt.data_collo, mtb_colt.num_collo, mtb_colt.ser_collo, mtb_colt.gestione, mtb_colr.cod_mart, SUM(qta_col) AS qta_col\n" +
|
String sql = Query.format("SELECT mtb_colt.data_collo, mtb_colt.num_collo, mtb_colt.ser_collo, mtb_colt.gestione, mtb_colr.cod_mart, SUM(qta_col) AS qta_col\n" +
|
||||||
"FROM mtb_colr\n" +
|
"FROM mtb_colr\n" +
|
||||||
" INNER JOIN mtb_colt ON mtb_colr.gestione = mtb_colt.gestione AND mtb_colr.data_collo = mtb_colt.data_collo AND\n" +
|
" INNER JOIN mtb_colt ON mtb_colr.gestione = mtb_colt.gestione AND mtb_colr.data_collo = mtb_colt.data_collo AND\n" +
|
||||||
@@ -1340,9 +1339,9 @@ public class MesProductionServiceV2 {
|
|||||||
" AND mtb_colr.data_ord = {}\n" +
|
" AND mtb_colr.data_ord = {}\n" +
|
||||||
" AND mtb_colr.num_ord = {}\n" +
|
" AND mtb_colr.num_ord = {}\n" +
|
||||||
" AND rif.barcode_ul = {}\n" +
|
" AND rif.barcode_ul = {}\n" +
|
||||||
"GROUP BY mtb_colt.data_collo, mtb_colt.num_collo, mtb_colt.ser_collo, mtb_colt.gestione, mtb_colr.cod_mart",ordine.getDataOrd(),ordine.getNumOrd(),barcode);
|
"GROUP BY mtb_colt.data_collo, mtb_colt.num_collo, mtb_colt.ser_collo, mtb_colt.gestione, mtb_colr.cod_mart", ordine.getDataOrd(), ordine.getNumOrd(), barcode);
|
||||||
|
|
||||||
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),sql,MtbColr.class);
|
return UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColr.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DtbOrdt completeDatiOrdine(DtbOrdt ordine) throws Exception {
|
private DtbOrdt completeDatiOrdine(DtbOrdt ordine) throws Exception {
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ public class WMSAccettazioneService {
|
|||||||
.setOperation(OperationType.SELECT_OBJECT);
|
.setOperation(OperationType.SELECT_OBJECT);
|
||||||
entityProcessor.processEntity(posizione, multiDBTransactionManager);
|
entityProcessor.processEntity(posizione, multiDBTransactionManager);
|
||||||
|
|
||||||
BigDecimal qtaMix = setupGest.getSetupDetBigDecimal("PICKING", "SETUP", "QTA_MIX_VERSAMENTO_SILOS", UtilityEntity.primaryKeyToString(posizione), BigDecimal.ZERO);
|
BigDecimal qtaMix = setupGest.getSetupDetBigDecimal(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SETUP", "QTA_MIX_VERSAMENTO_SILOS", UtilityEntity.primaryKeyToString(posizione), BigDecimal.ZERO);
|
||||||
MtbColr articoloAccettato = colloCarico.getMtbColr().get(0);
|
MtbColr articoloAccettato = colloCarico.getMtbColr().get(0);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import it.integry.ems.service.EntityProcessor;
|
|||||||
import it.integry.ems.service.MapService;
|
import it.integry.ems.service.MapService;
|
||||||
import it.integry.ems.service.ReportProcessor;
|
import it.integry.ems.service.ReportProcessor;
|
||||||
import it.integry.ems.service.exception.EmptyReportException;
|
import it.integry.ems.service.exception.EmptyReportException;
|
||||||
|
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems.utility.UtilityFile;
|
import it.integry.ems.utility.UtilityFile;
|
||||||
import it.integry.ems.utility.dto.C2EArgDTO;
|
import it.integry.ems.utility.dto.C2EArgDTO;
|
||||||
@@ -43,9 +44,6 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
|
|
||||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -704,7 +702,7 @@ public class UtilityService {
|
|||||||
public IndirizzoDTO getPositionFromCoords(BigDecimal lat, BigDecimal lng) throws Exception {
|
public IndirizzoDTO getPositionFromCoords(BigDecimal lat, BigDecimal lng) throws Exception {
|
||||||
double formattedLat = lat.setScale(5, RoundingMode.HALF_EVEN).doubleValue();
|
double formattedLat = lat.setScale(5, RoundingMode.HALF_EVEN).doubleValue();
|
||||||
double formattedLng = lng.setScale(5, RoundingMode.HALF_EVEN).doubleValue();
|
double formattedLng = lng.setScale(5, RoundingMode.HALF_EVEN).doubleValue();
|
||||||
int distance = setupGest.getSetupInteger("MAPS", "SETUP", "GEOCODE_PRECISION", 50);
|
int distance = setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "MAPS", "SETUP", "GEOCODE_PRECISION", 50);
|
||||||
|
|
||||||
String nearbyPointQuery = "SELECT * from ( " +
|
String nearbyPointQuery = "SELECT * from ( " +
|
||||||
" SELECT *,(6371392.896 * acos(cos(radians(" + formattedLat + ")) * cos(radians(lat)) * " +
|
" SELECT *,(6371392.896 * acos(cos(radians(" + formattedLat + ")) * cos(radians(lat)) * " +
|
||||||
|
|||||||
Reference in New Issue
Block a user