Finish Hotfix-1
This commit is contained in:
@@ -17,6 +17,7 @@ import java.math.BigDecimal;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@Master
|
||||
@@ -110,7 +111,7 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
private Date dataDocProvv;
|
||||
|
||||
@SqlField(value = "data_vers", nullable = true, defaultObjectValue = CommonConstants.TIMESTAMP, isReturned = true)
|
||||
private Date dataVers;
|
||||
private LocalDateTime dataVers;
|
||||
|
||||
@SqlField(value = "segno", nullable = false)
|
||||
private Integer segno;
|
||||
@@ -416,11 +417,11 @@ public class MtbColt extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataVers() {
|
||||
public LocalDateTime getDataVers() {
|
||||
return dataVers;
|
||||
}
|
||||
|
||||
public MtbColt setDataVers(Date dataVers) {
|
||||
public MtbColt setDataVers(LocalDateTime dataVers) {
|
||||
this.dataVers = dataVers;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ public class UtilityThread {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
public static void executeParallel(@NotNull List<RunnableThrowable> runnables) throws InterruptedException, ExecutionException {
|
||||
executeParallel(runnables.stream().map(x -> (RunnableArgsThrowable<Object>) () -> {
|
||||
public static ArrayList<Result<Object>> executeParallel(@NotNull List<RunnableThrowable> runnables) throws InterruptedException, ExecutionException {
|
||||
return executeParallel(runnables.stream().map(x -> (RunnableArgsThrowable<Object>) () -> {
|
||||
x.run();
|
||||
return null;
|
||||
}).collect(Collectors.toList()), Runtime.getRuntime().availableProcessors() * 2);
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -178,7 +179,7 @@ public class WPMService {
|
||||
String serCollo = carico.getSerDoc();
|
||||
String codMdep = carico.getCodMdep();
|
||||
Date dataOrd = carico.getDataOrd();
|
||||
Date dataVersamento = carico.getDataVersamento();
|
||||
LocalDateTime dataVersamento = UtilityLocalDate.localDateTimeFromDate(carico.getDataVersamento());
|
||||
Integer numOrd = carico.getNumOrd();
|
||||
BigDecimal qtaCol = carico.getProdotti().getRow().get(0).getQtaProdAna(); // La quantità è in UM di magazzino
|
||||
BigDecimal tara = carico.getProdotti().getRow().get(0).getTara();
|
||||
|
||||
@@ -239,7 +239,7 @@ public class EuroSilosImportService {
|
||||
mtbColt.setGestione("L");
|
||||
mtbColt.setSegno(1);
|
||||
mtbColt.setSerCollo(setupSection.get(SERIE));
|
||||
mtbColt.setDataVers(row.getLocalColDateHour());
|
||||
mtbColt.setDataVers(UtilityLocalDate.localDateTimeFromDate(row.getLocalColDateHour()));
|
||||
mtbColt.setDataCollo(UtilityLocalDate.localDateFromDate(row.getLocalColOnlyDate()));
|
||||
mtbColt.setRifOrd(fileName);
|
||||
mtbColt.setAnnotazioni(row.getSilo());
|
||||
|
||||
@@ -833,7 +833,7 @@ public class LogisticService {
|
||||
collo.setCodMdep(codMdep);
|
||||
|
||||
collo.setAnnotazioni(annotazioni);
|
||||
collo.setDataVers(UtilityString.parseDate(dataVers));
|
||||
collo.setDataVers(UtilityString.parseLocalDateTime(dataVers));
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(dataOrd))
|
||||
collo.setDataOrd(UtilityString.parseDate(dataOrd));
|
||||
@@ -972,7 +972,7 @@ public class LogisticService {
|
||||
collo.setSegno(Integer.parseInt(segno));
|
||||
collo.setCodAnag(codAnag);
|
||||
collo.setCodMdep(codMdep);
|
||||
collo.setDataVers(new Date());
|
||||
collo.setDataVers(UtilityLocalDate.getNowTime());
|
||||
collo.setAnnotazioni(annotazioni);
|
||||
|
||||
NodeList nodeList = (NodeList) xPath.compile("/ROOT/ROW").evaluate(doc, XPathConstants.NODESET);
|
||||
@@ -1216,7 +1216,7 @@ public class LogisticService {
|
||||
collo.setCodMdep(codMdep);
|
||||
|
||||
collo.setAnnotazioni(annotazioni);
|
||||
collo.setDataVers(UtilityString.parseDate(dataVers));
|
||||
collo.setDataVers(UtilityString.parseLocalDateTime(dataVers));
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(dataOrd))
|
||||
collo.setDataOrd(UtilityString.parseDate(dataOrd));
|
||||
|
||||
@@ -224,7 +224,7 @@ public class PackagesImportService {
|
||||
pack.setCodMdep(codMdep);
|
||||
pack.setGestione("A");
|
||||
pack.setDataCollo(localDate);
|
||||
pack.setDataVers(UtilityLocalDate.localDateToDate(localDate));
|
||||
pack.setDataVers(UtilityLocalDate.localDateTimeFromLocalDate(localDate));
|
||||
pack.setCodAnag(codAnag);
|
||||
pack.setSegno(1);
|
||||
pack.setOperation(OperationType.INSERT);
|
||||
@@ -238,7 +238,7 @@ public class PackagesImportService {
|
||||
pack.setCodMdep(codMdep);
|
||||
pack.setGestione("A");
|
||||
pack.setDataCollo(localDate);
|
||||
pack.setDataVers(UtilityLocalDate.localDateToDate(localDate));
|
||||
pack.setDataVers(UtilityLocalDate.localDateTimeFromLocalDate(localDate));
|
||||
pack.setCodAnag(codAnag);
|
||||
pack.setSegno(1);
|
||||
pack.setOperation(OperationType.INSERT);
|
||||
@@ -413,7 +413,7 @@ public class PackagesImportService {
|
||||
.setNumOrd(importColliProd.getNumOrd())
|
||||
.setGestione(importColliProd.getGestione())
|
||||
.setSegno(1)
|
||||
.setDataVers(dataVers)
|
||||
.setDataVers(UtilityLocalDate.localDateTimeFromDate(dataVers))
|
||||
.setCodJfas(importColliProd.getCodJfas())
|
||||
.setAnnotazioni(importColliProd.getAnnotazioni());
|
||||
|
||||
@@ -456,7 +456,7 @@ public class PackagesImportService {
|
||||
.setCodTcol(importColliProd.getCodTcol())
|
||||
.setPreparatoDa(requestDataDTO.getUsername())
|
||||
.setAnnotazioni(importColliProd.getFornitore())
|
||||
.setDataVers(dataVers)
|
||||
.setDataVers(UtilityLocalDate.localDateTimeFromDate(dataVers))
|
||||
.setMtbColr(new ArrayList<>());
|
||||
mtbColtV.setOperation(OperationType.INSERT);
|
||||
entityBases.add(mtbColtV);
|
||||
|
||||
@@ -668,7 +668,7 @@ public class SmartLogisticService {
|
||||
.setPreparatoDa(operatore)
|
||||
.setOraInizPrep(listCreate)
|
||||
.setAnnotazioni(annotazioni)
|
||||
.setDataVers(new Date())
|
||||
.setDataVers(UtilityLocalDate.getNowTime())
|
||||
.setCodTcol(codTipoCollo)
|
||||
.setPesoKg(pesoKG)
|
||||
.setAltezzaCm(altezza);
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package it.integry.ems.production.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.production.dto.CaricoProdottoFinitoDTO;
|
||||
import it.integry.ems.production.dto.ortofrutta.AccettazioneOrtoFruttaDTO;
|
||||
import it.integry.ems.response.StatusResponse;
|
||||
import it.integry.ems.retail.wms.dto.CreateUDCRequestDTO;
|
||||
import it.integry.ems.retail.wms.generic.dto.SpostaArtsTraULRequestDTO;
|
||||
import it.integry.ems.retail.wms.generic.service.WMSGenericService;
|
||||
import it.integry.ems.retail.wms.lavorazione.service.WMSLavorazioneService;
|
||||
import it.integry.ems.rules.businessLogic.LoadColliService;
|
||||
@@ -21,26 +18,19 @@ import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.bcel.classfile.Utility;
|
||||
import org.apache.xpath.operations.Mult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Scope("request")
|
||||
@@ -269,7 +259,7 @@ public class OrtoFruttaProductionService {
|
||||
collo.setBarcodeUl(dateFormat.format(UtilityLocalDate.localDateToDate(collo.getDataCollo())) + String.format("%06d", docLav.getNumDoc()));
|
||||
}
|
||||
|
||||
collo.setDataVers(UtilityLocalDate.localDateTimeToDate(dto.getDataVers(), null));
|
||||
collo.setDataVers(dto.getDataVers());
|
||||
|
||||
MtbColr row = collo.getMtbColr().stream().filter(x -> x.getCodMart().equalsIgnoreCase(dto.getCodMart())).findFirst().orElse(new MtbColr());
|
||||
if (row.getNumOrd() == null) {
|
||||
|
||||
@@ -138,7 +138,7 @@ public class ReceiptsFrontSt implements IReceiptsParser {
|
||||
ps.close();
|
||||
|
||||
|
||||
collo.setDataVers(new Date());
|
||||
collo.setDataVers(UtilityLocalDate.getNowTime());
|
||||
collo.setDataCollo(UtilityLocalDate.localDateFromDate(date));
|
||||
collo.setPreparatoDa("EMS");
|
||||
//collo.setAnnotazioni(head[3] + "_" + head[5]);
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -552,7 +553,7 @@ public class WMSAccettazioneService {
|
||||
}
|
||||
articoloAccettato.setQtaCol(articoloAccettato.getQtaCol().subtract(qtaScarAccettazione));
|
||||
|
||||
Date dataVers = DateUtils.addSeconds(new Date(), 10);
|
||||
LocalDateTime dataVers = UtilityLocalDate.getNowTime().plusSeconds(10);
|
||||
MtbColt uds = wmsLavorazioneService.createUDS(new CreateUDSRequestDTO().setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO).setCodMdep(posizione.getCodMdep()));
|
||||
MtbColt udc = wmsLavorazioneService.createUDC(new CreateUDCRequestDTO().setCodMdep(posizione.getCodMdep()));
|
||||
udc.setDataVers(dataVers);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package it.integry.ems.system.exchange.service;
|
||||
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.dto.Result;
|
||||
import it.integry.ems.expansion.RunnableThrowable;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
@@ -11,10 +13,7 @@ import it.integry.ems_model.entity.MtbColr;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.service.SetupGest;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
import it.integry.ems_model.utility.UtilityLocalDate;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -22,10 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -78,8 +74,8 @@ public class ExchangeColliImportService {
|
||||
try {
|
||||
exchangeImportSchemaManagerService.syncSchema(exchangeMultiDb.getPrimaryConnection(), colliSchemaType, useTempTable);
|
||||
|
||||
String testataTableName = null;
|
||||
String righeTableName = null;
|
||||
String testataTableName;
|
||||
String righeTableName;
|
||||
|
||||
if (colliSchemaType == ExchangeImportSchemaManagerService.SchemaType.ColliLavorazione) {
|
||||
testataTableName = "mtb_colt_lav";
|
||||
@@ -88,6 +84,9 @@ public class ExchangeColliImportService {
|
||||
} else if (colliSchemaType == ExchangeImportSchemaManagerService.SchemaType.VersamentoGrezzo) {
|
||||
testataTableName = "mtb_colt_versamento_grezzo";
|
||||
righeTableName = "mtb_colr_versamento_grezzo";
|
||||
} else {
|
||||
righeTableName = null;
|
||||
testataTableName = null;
|
||||
}
|
||||
|
||||
final List<MtbColt> exchangeImportedMtbColts = importColliLavorazione(
|
||||
@@ -120,29 +119,42 @@ public class ExchangeColliImportService {
|
||||
|
||||
AtomicInteger importedCounter = new AtomicInteger();
|
||||
|
||||
List<RunnableThrowable> calls = new ArrayList<>();
|
||||
for (EquatableEntityInterface dataToSave : allMtbColts) {
|
||||
|
||||
calls.add(() -> {
|
||||
|
||||
logger.debug("Importati {} colli di {}", importedCounter.incrementAndGet(), allMtbColts.size());
|
||||
try {
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDb, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbColt) dataToSave, testataTableName, useTempTable);
|
||||
singleUpdateImported(exchangeMultiDb.getPrimaryConnection(), (MtbColt) dataToSave, righeTableName, useTempTable);
|
||||
try (MultiDBTransactionManager exchangeMultiDbThread = new MultiDBTransactionManager(exchangeMultiDb.getPrimaryDatasource().getProfile(), false);
|
||||
MultiDBTransactionManager internalMultiDbThread = new MultiDBTransactionManager(internalMultiDb.getPrimaryDatasource().getProfile(), false)) {
|
||||
|
||||
internalMultiDb.commitAll();
|
||||
exchangeMultiDb.commitAll();
|
||||
entityProcessor.processEntity(dataToSave, true, true, ROSSOGARGANO_EXCHANGE_USER, internalMultiDbThread, requestDataDTO);
|
||||
singleUpdateImported(exchangeMultiDbThread.getPrimaryConnection(), (MtbColt) dataToSave, testataTableName, useTempTable);
|
||||
singleUpdateImported(exchangeMultiDbThread.getPrimaryConnection(), (MtbColt) dataToSave, righeTableName, useTempTable);
|
||||
|
||||
internalMultiDbThread.commitAll();
|
||||
exchangeMultiDbThread.commitAll();
|
||||
} catch (Exception ex) {
|
||||
if (firstExceptionToThrow[0] == null) firstExceptionToThrow[0] = ex;
|
||||
|
||||
MtbColt collo = (MtbColt) dataToSave;
|
||||
logger.error("Errore durante l'importazione del collo [num: " + collo.getNumCollo() + ", " +
|
||||
"data: " + UtilityLocalDate.formatDate(collo.getDataCollo(), CommonConstants.DATE_FORMAT_DMY) + ", " +
|
||||
"serie: " + collo.getSerCollo() + ", " +
|
||||
"gestione: " + collo.getGestione() + "]", ex);
|
||||
"gestione: " + collo.getGestione() + "]",
|
||||
ex);
|
||||
|
||||
throw ex;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
final ArrayList<Result<Object>> results = UtilityThread.executeParallel(calls);
|
||||
|
||||
if (firstExceptionToThrow[0] != null) throw firstExceptionToThrow[0];
|
||||
final Result<Object> firstErrorObjectIfPresent = results.stream()
|
||||
.filter(x -> x instanceof Result.Error)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (firstErrorObjectIfPresent != null) throw ((Result.Error)firstErrorObjectIfPresent).getError();
|
||||
} finally {
|
||||
if (useTempTable)
|
||||
exchangeImportSchemaManagerService.deleteTempTables(exchangeMultiDb.getPrimaryConnection(), colliSchemaType);
|
||||
@@ -179,7 +191,6 @@ public class ExchangeColliImportService {
|
||||
.collect(groupingBy(x -> Objects.hash(x.getGestione(), x.getNumCollo(), x.getDataCollo(), x.getSerCollo())));
|
||||
|
||||
|
||||
|
||||
mtbColtLav
|
||||
.parallelStream()
|
||||
.forEach(x -> {
|
||||
|
||||
Reference in New Issue
Block a user