[MaxiData] Completata implementazione API per creazione pedana, avvio, pausa e stop di ordine di lavoro

This commit is contained in:
2025-09-23 15:52:22 +02:00
parent b9b756a811
commit 66a514468f
35 changed files with 1158 additions and 274 deletions

View File

@@ -0,0 +1,14 @@
package it.integry.annotations;
import it.integry.ems.migration._base.IntegryCustomer;
import org.springframework.stereotype.Indexed;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Indexed
public @interface CustomerComponent {
IntegryCustomer value();
}

View File

@@ -0,0 +1,17 @@
package it.integry.annotations;
import it.integry.ems.migration._base.IntegryCustomer;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@CustomerComponent(IntegryCustomer.Integry) // Valore di default, verrà sovrascritto
public @interface CustomerService {
@AliasFor(
annotation = CustomerComponent.class
)
IntegryCustomer value();
}

View File

@@ -0,0 +1,170 @@
package it.integry.ems.configuration;
import it.integry.annotations.CustomerComponent;
import it.integry.annotations.CustomerService;
import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.settings.Model.SettingsModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.type.filter.AnnotationTypeFilter;
/**
* Configurazione per registrare gli scope personalizzati per customer specifici
*/
@Configuration
public class CustomerServicesConfig implements ApplicationListener<ContextRefreshedEvent> {
private final Logger logger = LogManager.getLogger();
@Autowired
private SettingsModel settingsModel;
@Autowired
private ApplicationContext applicationContext;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// Assicuriamoci che sia il context principale e non un sub-context
if (event.getApplicationContext() == applicationContext) {
registerCustomerBeans();
}
}
private void registerCustomerBeans() {
ClassPathScanningCandidateComponentProvider scanner =
new ClassPathScanningCandidateComponentProvider(false);
// Aggiungo filtri per le annotazioni custom
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomerService.class));
scanner.addIncludeFilter(new AnnotationTypeFilter(CustomerComponent.class));
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) applicationContext.getAutowireCapableBeanFactory();
// Scansiono tutti i package del progetto
for (BeanDefinition bd : scanner.findCandidateComponents("it.integry")) {
try {
Class<?> clazz = Class.forName(bd.getBeanClassName());
String beanName = generateBeanName(clazz);
IntegryCustomer customer = extractCustomer(clazz);
// Ora SettingsModel è completamente inizializzato con @PostConstruct chiamato
if (!settingsModel.getDefaultProfile().equalsIgnoreCase(customer.toString())) {
continue;
}
// Evito duplicati controllando se il bean esiste già
if (!registry.containsBeanDefinition(beanName)) {
logger.trace("Registering custom bean for customer: " + customer + " - Class: " + clazz.getSimpleName());
// Creo la definizione del bean
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.genericBeanDefinition(clazz);
// Registro il bean nel registry di Spring
registry.registerBeanDefinition(beanName, builder.getBeanDefinition());
// Determino lo scope del bean per decidere se istanziarlo immediatamente
String beanScope = determineBeanScope(clazz);
if (shouldInstantiateImmediately(beanScope)) {
// Forzo l'istanziazione immediata solo per bean con scope appropriati
try {
Object beanInstance = applicationContext.getBean(beanName);
logger.info("Bean customer {} istanziato con successo: {} (scope: {})",
customer, beanInstance.getClass().getSimpleName(), beanScope);
} catch (Exception e) {
logger.error("Errore durante l'istanziazione del bean {} (scope: {}): {}",
beanName, beanScope, e.getMessage());
}
} else {
logger.info("Bean customer {} registrato ma non istanziato (scope: {}). " +
"Verrà istanziato quando richiesto", customer, beanScope);
}
}
} catch (ClassNotFoundException e) {
logger.error("Impossibile caricare la classe: " + bd.getBeanClassName(), e);
}
}
}
/**
* Genera il nome del bean basato sul nome della classe
*/
private String generateBeanName(Class<?> clazz) {
String simpleName = clazz.getSimpleName();
return Character.toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
}
private IntegryCustomer extractCustomer(Class<?> clazz) {
if (clazz.isAnnotationPresent(CustomerService.class)) {
CustomerService cs = clazz.getAnnotation(CustomerService.class);
return cs.value();
} else if (clazz.isAnnotationPresent(CustomerComponent.class)) {
CustomerComponent cc = clazz.getAnnotation(CustomerComponent.class);
return cc.value();
}
return IntegryCustomer.Integry; // Valore di default
}
/**
* Determina lo scope del bean analizzando le annotazioni della classe
*/
private String determineBeanScope(Class<?> clazz) {
// Controllo per @Scope
if (clazz.isAnnotationPresent(org.springframework.context.annotation.Scope.class)) {
org.springframework.context.annotation.Scope scopeAnnotation =
clazz.getAnnotation(org.springframework.context.annotation.Scope.class);
return scopeAnnotation.value();
}
// Controllo per @RequestScope
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.RequestScope.class)) {
return "request";
}
// Controllo per @SessionScope
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.SessionScope.class)) {
return "session";
}
// Controllo per @ApplicationScope
if (clazz.isAnnotationPresent(org.springframework.web.context.annotation.ApplicationScope.class)) {
return "application";
}
// Default è singleton
return "singleton";
}
/**
* Determina se il bean può essere istanziato immediatamente in base al suo scope
*/
private boolean shouldInstantiateImmediately(String scope) {
switch (scope.toLowerCase()) {
case "request":
case "session":
// I bean con scope request/session non possono essere istanziati
// al di fuori del contesto web
return false;
case "prototype":
// I bean prototype non vengono istanziati automaticamente
return false;
case "singleton":
case "application":
default:
// Singleton e application possono essere istanziati immediatamente
return true;
}
}
}

View File

@@ -0,0 +1,21 @@
package it.integry.ems.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@Configuration
@EnableScheduling // Equivale a <task:annotation-driven/>
public class SchedulerConfig {
@Bean
public ThreadPoolTaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(5); // Equivale a pool-size="5"
scheduler.setThreadNamePrefix("taskScheduler-");
scheduler.initialize();
return scheduler;
}
}

View File

@@ -1171,18 +1171,6 @@ public class EmsController {
// }
@RequestMapping(value = EmsRestConstants.PATH_CLEAN_DIRECTORIES, method = RequestMethod.POST)
public @ResponseBody
ServiceRestResponse cleanDirectories(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {
try {
emsServices.cleanDirectories();
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ServiceRestResponse(EsitoType.KO, multiDBTransactionManager.getPrimaryConnection().getProfileName(), e);
}
}
@RequestMapping(value = EmsRestConstants.PATH_EXPORT_SERVER_INFO_ISCC, method = RequestMethod.POST)
public @ResponseBody
ServiceRestResponse exportServerInfoISCC(@RequestParam(CommonConstants.PROFILE_DB) String config) throws Exception {

View File

@@ -8,7 +8,6 @@ import it.integry.ems.utility.UtilityFile;
import it.integry.ems_model.entity.StbFilesAttached;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.io.File;
@@ -16,7 +15,6 @@ import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@Service
public class DownloadFileHandlerService {
@@ -26,12 +24,6 @@ public class DownloadFileHandlerService {
private final HashMap<String, CachedFileDto> mFileMap = new HashMap<>();
@Scheduled(fixedDelay = 1, timeUnit = TimeUnit.HOURS, zone = "Europe/Rome")
public void clean() {
UtilityFile.cleanDirectory(getTempPath(), 1, "");
}
public DownloadFileDto generateDownloadItem(File file) throws IOException {
return generateDownloadItem(file.getName(), FileUtils.readFileToByteArray(file), false);
}

View File

@@ -31,8 +31,7 @@ public class CleanDirectoryComponent {
private SetupGest setupGest;
@Scheduled(fixedDelay = 12, timeUnit = TimeUnit.HOURS, zone = "Europe/Rome")
private void cleanDirectory() {
try {
private void cleanDirectory() throws Exception {
if (!UtilityDebug.isDebugExecution()) {
List<AvailableConnectionsModel> databases = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true);
@@ -87,15 +86,12 @@ public class CleanDirectoryComponent {
UtilityFile.cleanDirectory(UtilityDirs.getTempQueriesDirectoryPath(), 7, "");
UtilityFile.cleanDirectory(UtilityDirs.getEmsApiTempDirectoryPath(), 15, "");
UtilityFile.cleanDirectory(UtilityDirs.getTempDirectoryPath(), 1, "");
// UtilityFile.cleanDirectory(UtilityDirs.getTempDirectoryPath(), 1, "");
//Cancello i log di Tomcat
String logsPath = String.format("%s%slogs", UtilityDirs.getCatalinaHome(), File.separator);
UtilityFile.cleanDirectory(logsPath, settingsModel.getLoggerConfiguration().getDeleteDays(), "");
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
}

View File

@@ -41,7 +41,6 @@ import it.integry.ems.sync.MultiDBTransaction.BasicConnectionPool;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems.utility.UtilityDebug;
import it.integry.ems.utility.UtilityDirs;
import it.integry.ems.utility.UtilityEntity;
import it.integry.ems.utility.UtilityFile;
import it.integry.ems_model.annotation.Master;
@@ -810,58 +809,6 @@ public class EmsServices {
return downloadUrl;
}
public void cleanDirectories() throws Exception {
//Mi leggo tutte le configurazioni che hanno i GG_CANC_FILE abilitati
String query = "SELECT gest_name, section " +
"FROM stb_gest_setup " +
"WHERE key_section = 'GG_CANC_FILE' AND value IS NOT NULL";
List<HashMap<String, Object>> enabledConfigList = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), query);
if (!enabledConfigList.isEmpty()) {
for (HashMap<String, Object> enabledConfig : enabledConfigList) {
String gestName = UtilityHashMap.getValueIfExists(enabledConfig, "gest_name");
String section = UtilityHashMap.getValueIfExists(enabledConfig, "section");
HashMap<String, String> currentConfigs = setupGest.getSetupSection(multiDBTransactionManager.getPrimaryConnection(), gestName, section);
String ggCancFileStr = UtilityHashMap.getValueIfExists(currentConfigs, "GG_CANC_FILE");
Integer ggCancFile = ggCancFileStr != null ? Integer.parseInt(ggCancFileStr) : null;
String path = null;
if (gestName.startsWith("IMPORT")) {
path = UtilityHashMap.getValueIfExists(currentConfigs, "PATH_FILE_IMPORTED");
} else {
path = UtilityHashMap.getValueIfExists(currentConfigs, "PATH_FILE");
}
if (path == null) {
//COMMENTATO DA MINA, LA DIRECTORY NON è OBBLIGATORIA, SE LO LASCIAMO RIEMPIAMO IL LOG DI INFO INUTILI
//logger.error("Impossibile cancellare i file per la procedura " + gestName + ". Non è presente la PATH nella configurazione");
continue;
}
if (ggCancFile == null || ggCancFile == 0)
ggCancFile = 30;
UtilityFile.cleanDirectory(path, ggCancFile, "");
}
}
UtilityFile.cleanDirectory(UtilityDirs.getTempQueriesDirectoryPath(), 7, "");
UtilityFile.cleanDirectory(UtilityDirs.getEmsApiTempDirectoryPath(), 15, "");
//commentato perché va a leggere i file dalle sottodirectory
//UtilityFile.cleanDirectory(UtilityDirs.getTempDirectoryPath(), 1, "");
//Cancello i log di Tomcat
String logsPath = String.format("%s%slogs", UtilityDirs.getCatalinaHome(), File.separator);
UtilityFile.cleanDirectory(logsPath, settingsModel.getLoggerConfiguration().getDeleteDays(), "");
}
public void checkServerVariables() throws Exception {
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())

View File

@@ -5,6 +5,7 @@ import it.integry.ems._context.ApplicationContextProvider;
import it.integry.ems.exception.DistributoreDatabaseNotPresentException;
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.properties.EmsProperties;
import it.integry.ems.settings.Model.AvailableConnectionsModel;
import it.integry.ems.settings.Model.SettingsModel;
@@ -61,12 +62,26 @@ public class MultiDBTransactionManager implements AutoCloseable {
emsDBConst = ApplicationContextProvider.getApplicationContext().getBean(EmsDBConst.class);
}
public MultiDBTransactionManager(IntegryCustomerDB customerDB) throws Exception {
this(customerDB, true);
}
public MultiDBTransactionManager(IntegryCustomerDB customerDB, boolean enableLog) throws Exception {
this();
this.enableLog = enableLog;
String profileDb = settingsModel.getProfileDbFromDbName(customerDB.getValue());
this.setPrimaryDB(profileDb);
}
public MultiDBTransactionManager(AvailableConnectionsModel connectionsModel) throws Exception {
this(connectionsModel.getProfileName(), true);
this(connectionsModel, true);
}
public MultiDBTransactionManager(AvailableConnectionsModel connectionsModel, boolean enableLog) throws Exception {
this(connectionsModel.getProfileName(), enableLog);
this();
this.enableLog = enableLog;
this.setPrimaryDB(connectionsModel);
}
public MultiDBTransactionManager(String profileDb) throws Exception {

View File

@@ -31,19 +31,18 @@ public class UtilityDirs {
public static String getEmsApiTempDirectoryPath() {
EmsProperties emsProperties = ApplicationContextProvider.getApplicationContext().getBean(EmsProperties.class);
return TMP_DIR + File.separator + emsProperties.getRootApi();
return Paths.get(TMP_DIR, emsProperties.getRootApi()).toString();
}
public static String getTempDirectoryPath() {
return TMP_DIR;
}
public static String getTempQueriesDirectoryPath() {
return getEmsApiTempDirectoryPath() + File.separator + "queries" + File.separator;
return Paths.get(getEmsApiTempDirectoryPath(), "queries").toString();
}
public static File getDirectory(DIRECTORY dir) {
File fileToReturn = new File(getEmsApiTempDirectoryPath() + File.separator + relativePathBindingTable.get(dir));
File fileToReturn = Paths.get(getEmsApiTempDirectoryPath(), relativePathBindingTable.get(dir)).toFile();
if (!fileToReturn.exists()) {
fileToReturn.mkdirs();
@@ -54,9 +53,7 @@ public class UtilityDirs {
}
public static File getDirectoryExport(String nomeDB, String type, String format) {
String dir = "EXPORT" + File.separator + nomeDB + File.separator + type + File.separator + format;
File fileToReturn = new File(getEmsApiTempDirectoryPath() + File.separator + dir);
File fileToReturn = Paths.get(getEmsApiTempDirectoryPath(), "EXPORT", nomeDB, type, format).toFile();
if (!fileToReturn.exists()) {
fileToReturn.mkdirs();

View File

@@ -5,7 +5,10 @@ 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._context.ApplicationContextProvider;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems.task.TaskExecutorService;
import it.integry.ems.utility.enums.DigitalSignatureType;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityString;
@@ -31,10 +34,9 @@ import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.security.Security;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
@@ -91,7 +93,7 @@ public class UtilityFile {
}
public static void cleanDirectory(@NotNull final String pathFile, int days, String regex) {
public static void cleanDirectory(@NotNull final String pathFile, int days, String regex) throws ExecutionException, InterruptedException, TimeoutException {
GregorianCalendar calendar = new GregorianCalendar();
calendar.add(Calendar.DAY_OF_YEAR, -1 * days);
@@ -99,24 +101,21 @@ public class UtilityFile {
}
public static void cleanDirectory(@NotNull final String pathFile, @NotNull final Date fromDate, final String regex) {
new Thread(() -> {
public static void cleanDirectory(@NotNull final String pathFile, @NotNull final Date fromDate, final String regex) throws ExecutionException, InterruptedException, TimeoutException {
final TaskExecutorService taskExecutorService = ApplicationContextProvider.getApplicationContext().getBean(TaskExecutorService.class);
taskExecutorService.executeTask(() -> {
File directory = new File(pathFile);
if (!directory.exists()) return;
final long purgeTime = fromDate.getTime();
//final long purgeTime = new Date().getTime();
final Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
try {
Files.walkFileTree(Paths.get(pathFile), new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
return FileVisitResult.CONTINUE;
}
// Prima passata: elimina i file secondo il criterio
Files.walkFileTree(Paths.get(pathFile), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
File f = file.toFile();
@@ -128,14 +127,19 @@ public class UtilityFile {
return FileVisitResult.CONTINUE;
}
});
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) {
return FileVisitResult.CONTINUE;
}
// Seconda passata: elimina tutte le directory vuote partendo dal basso
Files.walkFileTree(Paths.get(pathFile), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
try {
if (!Files.list(dir).findAny().isPresent()) {
Files.delete(dir);
}
} catch (IOException e) {
logger.error("Errore durante la cancellazione della directory vuota: " + dir, e);
}
return FileVisitResult.CONTINUE;
}
});
@@ -144,8 +148,8 @@ public class UtilityFile {
logger.error(e.getMessage());
}
}, true);
}).start();
}
public static boolean directoryExists(String directory) {
@@ -381,7 +385,8 @@ public class UtilityFile {
* @throws Exception
*/
public static ByteArrayOutputStream htmlToPdf(ByteArrayOutputStream htmlOutputStream, PdfPTable pdfTable) throws Exception {
public static ByteArrayOutputStream htmlToPdf(ByteArrayOutputStream htmlOutputStream, PdfPTable pdfTable) throws
Exception {
ByteArrayOutputStream pdfOutputStream = new ByteArrayOutputStream();
Document document = new Document(PageSize.A4);
@@ -419,7 +424,8 @@ public class UtilityFile {
return cleanName.toString();
}
public static void moveFile(@NotNull String path, @NotNull String newPath, @NotNull String fileName, String newFileName) throws Exception {
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;
@@ -436,7 +442,8 @@ public class UtilityFile {
}
}
public static File createZipFromMultipartFile(String pathFile, String fileName, MultipartFile... files) throws IOException {
public static File createZipFromMultipartFile(String pathFile, String fileName, MultipartFile... files) throws
IOException {
// Nome del file ZIP da creare
if (!UtilityFile.directoryExists(pathFile))
UtilityFile.directoryCreate(pathFile);

View File

@@ -0,0 +1,18 @@
package it.integry.event;
import it.integry.ems.migration._base.IntegryCustomerDB;
import org.springframework.context.ApplicationEvent;
public abstract class BaseCustomerDBEvent extends ApplicationEvent {
protected final IntegryCustomerDB customerDB;
public BaseCustomerDBEvent(Object source, IntegryCustomerDB customerDB) {
super(source);
this.customerDB = customerDB;
}
public IntegryCustomerDB getCustomerDB() {
return customerDB;
}
}

View File

@@ -1,18 +1,20 @@
package it.integry.maxidata.service;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.integry.ems.utility.UtilityDebug;
import it.integry.ems.utility.UtilityDirs;
import it.integry.ems.utility.UtilityFile;
import it.integry.ems_model.utility.UtilityString;
import it.integry.maxidata.client.api.AutenticazioneApi;
import it.integry.maxidata.client.api.MesGestioneApi;
import it.integry.maxidata.client.invoker.ApiClient;
import it.integry.maxidata.client.model.MaxidataCFGBILoginV4BLLLoginType;
import it.integry.maxidata.client.model.MaxidataCFGBILoginV4BLLPayLoadType;
import it.integry.maxidata.client.model.MaxidataUveBII40V2BLLUVE2kSchedeProd;
import it.integry.maxidata.client.model.*;
import it.integry.maxidata.model.MaxiDataConfigDataDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.client.HttpClientErrorException;
import java.nio.file.Paths;
import java.util.List;
public class MaxiDataApiService {
@@ -89,7 +91,7 @@ public class MaxiDataApiService {
return true;
}
public List<MaxidataUveBII40V2BLLUVE2kSchedeProd> retrieveSchedeProduzione(MultiDBTransactionManager multiDBTransactionManager) {
public List<MaxidataUveBII40V2BLLUVE2kSchedeProd> retrieveSchedeProduzione() {
this.authenticate();
MesGestioneApi mesApi = new MesGestioneApi(this.apiClient);
@@ -98,6 +100,79 @@ public class MaxiDataApiService {
return ordersList;
}
public void startProductionOrder(String idSchedaProd) {
try {
this.authenticate();
final MaxidataUveBII40V2BLLMESProduzioni startProduzioneRequest = new MaxidataUveBII40V2BLLMESProduzioni();
startProduzioneRequest.setIdSchedaProd(idSchedaProd);
MesGestioneApi mesApi = new MesGestioneApi(this.apiClient);
final MaxidataUveBII40V2BLLUVE2kSchedeProd startedOrder = mesApi.start(startProduzioneRequest);
} catch (HttpClientErrorException e) {
final MaxidataLibrerie2WebServicesRestAPIErrorException errorData = handleAPIError(e);
throw new RuntimeException(errorData.getErrorMessage());
} catch (Exception e) {
throw new RuntimeException("Errore durante la generazione di un nuovo pallet in MaxiData", e);
}
}
public void pauseProductionOrder(String idSchedaProd) {
try {
this.authenticate();
MesGestioneApi mesApi = new MesGestioneApi(this.apiClient);
mesApi.pause(idSchedaProd);
} catch (HttpClientErrorException e) {
final MaxidataLibrerie2WebServicesRestAPIErrorException errorData = handleAPIError(e);
throw new RuntimeException(errorData.getErrorMessage());
} catch (Exception e) {
throw new RuntimeException("Errore durante la generazione di un nuovo pallet in MaxiData", e);
}
}
public void closeProductionOrder(String idSchedaProd) {
try {
this.authenticate();
MesGestioneApi mesApi = new MesGestioneApi(this.apiClient);
mesApi.stop(idSchedaProd);
} catch (HttpClientErrorException e) {
final MaxidataLibrerie2WebServicesRestAPIErrorException errorData = handleAPIError(e);
throw new RuntimeException(errorData.getErrorMessage());
} catch (Exception e) {
throw new RuntimeException("Errore durante la generazione di un nuovo pallet in MaxiData", e);
}
}
public void createNewProductionUnit(String idSchedaProd, int progressivo, int qtaPezzi, int qtaImballi) {
try {
this.authenticate();
final MaxidataUveBII40V2BLLMESPallet newPalletRequest = new MaxidataUveBII40V2BLLMESPallet();
newPalletRequest.setIdSchedaProd(idSchedaProd);
// newPalletRequest.setDataPallet(LocalDateTime.now());
newPalletRequest.setCopie(0);
newPalletRequest.setProgressivo(progressivo);
newPalletRequest.setQtaPezzi(qtaPezzi);
newPalletRequest.setQtaImballi(qtaImballi);
MesGestioneApi mesApi = new MesGestioneApi(this.apiClient);
final MaxidataUveBII40V2BLLUVE2kPallet generatedPallet = mesApi.pallet(newPalletRequest);
UtilityFile.saveFile(Paths.get(UtilityDirs.getEmsApiTempDirectoryPath(), "maxidata", "etichette").toString(), "etichetta_pallet_" + generatedPallet.getIDSSCC() + ".pdf", generatedPallet.getFilePDF());
} catch (HttpClientErrorException e) {
final MaxidataLibrerie2WebServicesRestAPIErrorException errorData = handleAPIError(e);
throw new RuntimeException(errorData.getErrorMessage());
} catch (Exception e) {
throw new RuntimeException("Errore durante la generazione di un nuovo pallet in MaxiData", e);
}
}
public MaxiDataApiService setUsername(String username) {
this.username = username;
return this;
@@ -113,6 +188,22 @@ public class MaxiDataApiService {
return this;
}
private MaxidataLibrerie2WebServicesRestAPIErrorException handleAPIError(HttpClientErrorException e) {
if (e == null)
return null;
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(
e.getResponseBodyAsString(),
MaxidataLibrerie2WebServicesRestAPIErrorException.class
);
} catch (Exception ex) {
logger.error("Errore durante la deserializzazione dell'errore API", ex);
return null;
}
}
public interface Listener {
void onJwtAccessTokenChanged(String newJwtAccessToken);
}

View File

@@ -34,22 +34,19 @@ public class GrammProductionController {
public @ResponseBody
ServiceRestResponse chiusuraLavorazioneSemole(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody ChiusuraLavorazioneSemoleRequestDTO chiusuraLavorazioneSemoleRequestDTO) {
ServiceRestResponse response;
@RequestBody ChiusuraLavorazioneSemoleRequestDTO chiusuraLavorazioneSemoleRequestDTO) throws Exception {
try {
grammMesProductionService.chiusuraLavorazioneSemole(chiusuraLavorazioneSemoleRequestDTO);
response = ServiceRestResponse.createPositiveResponse();
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
try {
multiDBTransactionManager.rollbackAll();
} catch (Exception ex) {
logger.error(request.getRequestURI(), e);
}
logger.error(request.getRequestURI(), e);
response = new ServiceRestResponse(EsitoType.KO, profileDB, e);
throw e;
}
return response;
}
@RequestMapping(value = EmsCustomRestConstants.PATH_GRAMM_CHIUSURA_LAVORAZIONE_FORNO, method = RequestMethod.POST)

View File

@@ -0,0 +1,163 @@
package it.integry.ems.customizations.production.service;
import it.integry.annotations.CustomerService;
import it.integry.ems._context.ApplicationContextProvider;
import it.integry.ems.migration._base.IntegryCustomer;
import it.integry.ems.production.event.ProductionOrderClosedEvent;
import it.integry.ems.production.event.ProductionOrderPausedEvent;
import it.integry.ems.production.event.ProductionOrderStartedEvent;
import it.integry.ems.production.event.ProductionUlCreatedEvent;
import it.integry.ems.sync.MultiDBTransaction.Connection;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.maxidata.service.MaxiDataApiService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import java.sql.SQLException;
import java.time.LocalDate;
@CustomerService(IntegryCustomer.Lamonarca)
public class LamonarcaProductionService implements ApplicationListener {
private final Logger logger = LogManager.getLogger();
private MaxiDataApiService retrieveMaxiDataService(String dbName) {
String serviceId = String.format("maxidata-uve2k-service--%s", dbName);
try {
return ApplicationContextProvider.getApplicationContext().getBean(serviceId, MaxiDataApiService.class);
} catch (Exception e) {
logger.error("Error while trying to retrieve MaxiDataApiService", e);
return null;
}
}
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ProductionOrderStartedEvent) {
handleProductionOrderStarted((ProductionOrderStartedEvent) event);
} else if (event instanceof ProductionOrderPausedEvent) {
handleProductionOrderPaused((ProductionOrderPausedEvent) event);
} else if (event instanceof ProductionOrderClosedEvent) {
handleProductionOrderClosed((ProductionOrderClosedEvent) event);
} else if (event instanceof ProductionUlCreatedEvent) {
handleProductionUlCreated((ProductionUlCreatedEvent) event);
}
}
private void handleProductionOrderStarted(ProductionOrderStartedEvent event) {
logger.info("Handling ProductionOrderStartedEvent: {}", event);
MaxiDataApiService maxiDataApiService = retrieveMaxiDataService(event.getCustomerDB().getValue());
if (maxiDataApiService == null)
return;
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
String idSchedaProd = retrieveIdSchedaProdByOrderNotes(mdb.getPrimaryConnection(), event.getGestione(), event.getDataOrd(), event.getNumOrd());
if (idSchedaProd == null) {
logger.warn("Nessun idSchedaProd trovato nelle note dell'ordine: {} - {} - {}", event.getGestione(), event.getDataOrd(), event.getNumOrd());
return;
}
maxiDataApiService.startProductionOrder(idSchedaProd);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void handleProductionOrderPaused(ProductionOrderPausedEvent event) {
logger.info("Handling ProductionOrderPausedEvent: {}", event);
MaxiDataApiService maxiDataApiService = retrieveMaxiDataService(event.getCustomerDB().getValue());
if (maxiDataApiService == null)
return;
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
String idSchedaProd = retrieveIdSchedaProdByOrderNotes(mdb.getPrimaryConnection(), event.getGestione(), event.getDataOrd(), event.getNumOrd());
if (idSchedaProd == null) {
logger.warn("Nessun idSchedaProd trovato nelle note dell'ordine: {} - {} - {}", event.getGestione(), event.getDataOrd(), event.getNumOrd());
return;
}
maxiDataApiService.pauseProductionOrder(idSchedaProd);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void handleProductionOrderClosed(ProductionOrderClosedEvent event) {
logger.info("Handling ProductionOrderClosedEvent: {}", event);
MaxiDataApiService maxiDataApiService = retrieveMaxiDataService(event.getCustomerDB().getValue());
if (maxiDataApiService == null)
return;
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
String idSchedaProd = retrieveIdSchedaProdByOrderNotes(mdb.getPrimaryConnection(), event.getGestione(), event.getDataOrd(), event.getNumOrd());
if (idSchedaProd == null) {
logger.warn("Nessun idSchedaProd trovato nelle note dell'ordine: {} - {} - {}", event.getGestione(), event.getDataOrd(), event.getNumOrd());
return;
}
maxiDataApiService.closeProductionOrder(idSchedaProd);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public void handleProductionUlCreated(ProductionUlCreatedEvent event) {
logger.info("Handling ProductionUlCreatedEvent: {}", event);
MaxiDataApiService maxiDataApiService = retrieveMaxiDataService(event.getCustomerDB().getValue());
if (maxiDataApiService == null)
return;
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
String idSchedaProd = retrieveIdSchedaProdByOrderNotes(mdb.getPrimaryConnection(), event.getGestione(), event.getDataOrd(), event.getNumOrd());
if (idSchedaProd == null) {
logger.warn("Nessun idSchedaProd trovato nelle note dell'ordine: {} - {} - {}", event.getGestione(), event.getDataOrd(), event.getNumOrd());
return;
}
maxiDataApiService.createNewProductionUnit(idSchedaProd, event.getProgressivo(), event.getQtaCol().intValue(), event.getNumCnf().intValue());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private String retrieveIdSchedaProdByOrderNotes(Connection connection, String gestioneOrd, LocalDate dataOrd, int numeroOrd) throws SQLException {
String sql = "SELECT dtb_ordr_prod.system_note\n" +
"FROM dtb_ordt dtb_ordt_lav\n" +
" INNER JOIN dtb_ordr dtb_ordr_prod ON dtb_ordt_lav.data_ord_rif = dtb_ordr_prod.data_ord\n" +
" AND dtb_ordt_lav.num_ord_rif = dtb_ordr_prod.num_ord\n" +
" AND dtb_ordt_lav.gestione_rif = dtb_ordr_prod.gestione\n" +
"WHERE dtb_ordt_lav.gestione = {}\n" +
" AND dtb_ordt_lav.data_ord = {}\n" +
" AND dtb_ordt_lav.num_ord = {}";
String idSchedaProd = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, Query.format(sql, gestioneOrd, dataOrd, numeroOrd));
return idSchedaProd;
}
}

View File

@@ -7,6 +7,8 @@ import it.integry.ems.document.Import.dto.MaterialiDaDistintaDTO;
import it.integry.ems.document.Import.service.DocumentiLavDaDist;
import it.integry.ems.document.dto.*;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.production.event.ProductionOrderClosedEvent;
import it.integry.ems.retail.wms.lavorazione.service.WMSLavorazioneService;
import it.integry.ems.rules.businessLogic.LoadColliService;
import it.integry.ems.rules.businessLogic.dto.LoadColliDTO;
@@ -32,6 +34,7 @@ import org.apache.logging.log4j.Logger;
import org.josql.Query;
import org.josql.QueryResults;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Scope;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@@ -72,6 +75,8 @@ public class DocumentProdService {
private final String tipoMateriaPrima = "MATERIA PRIMA";
private final String tipoImballaggi = "IMBALLAGGI";
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
public List<EntityBase> riapriGiornataProd(String codMdep, Date dataProd) throws Exception {
List<EntityBase> arrayEntity = new ArrayList<>();
@@ -649,6 +654,12 @@ public class DocumentProdService {
Statement storedProcedure = multiDBTransactionManager.getPrimaryConnection().createStatement();
storedProcedure.execute(syncChiusuraOrdineLavorazione);
applicationEventPublisher.publishEvent(new ProductionOrderClosedEvent(this,
IntegryCustomerDB.parse(multiDBTransactionManager.getPrimaryConnection().getDbName()),
carico.getGestione(),
UtilityLocalDate.localDateFromDate(carico.getDataOrd()),
carico.getNumOrd()));
}
private void generateCaricoProdottoFinito(CaricoProdFinLavDTO carico, List<EntityBase> arrayEntity) throws Exception {

View File

@@ -51,10 +51,10 @@ public class OrdiniImporter extends BaseEntityImporter<List<EntityBase>> impleme
result = getContextBean(ProductionSincroService.class).scaricoVsOrd(requestDto.getWhereCond());
break;
case MAXIDATA:
result = getContextBean(ProduzioniLamonarcaMaxidataService.class).importProduzioniLamonarca();
// final OrdiniMaxiDataImportService ordiniMaxiDataImportService = getContextBean(OrdiniMaxiDataImportService.class);
// ordiniMaxiDataImportService.importArticoli();
// result = ordiniMaxiDataImportService.importProduzioni();
// result = getContextBean(ProduzioniLamonarcaMaxidataService.class).importProduzioniLamonarca();
final OrdiniMaxiDataImportService ordiniMaxiDataImportService = getContextBean(OrdiniMaxiDataImportService.class);
ordiniMaxiDataImportService.importArticoli();
result = ordiniMaxiDataImportService.importProduzioni();
break;
case ORDINIDAAPPROV:
result = getContextBean(OrdiniDaApprov.class).importOrdiniDaApprov(requestDto.getWhereCond());

View File

@@ -55,7 +55,7 @@ public class OrdiniMaxiDataImportService {
public List<EntityBase> importArticoli() throws Exception {
Connection conn = multiDBTransactionManager.getPrimaryConnection();
List<MaxidataUveBII40V2BLLUVE2kSchedeProd> schedeProduzione = maxiDataApiService.retrieveSchedeProduzione(multiDBTransactionManager);
List<MaxidataUveBII40V2BLLUVE2kSchedeProd> schedeProduzione = maxiDataApiService.retrieveSchedeProduzione();
if (schedeProduzione == null || schedeProduzione.isEmpty())
return new ArrayList<>();
@@ -126,7 +126,7 @@ public class OrdiniMaxiDataImportService {
throw new Exception(String.format("Nessun codice fornitore configurato per il deposito %s", codMdepDefault));
List<MaxidataUveBII40V2BLLUVE2kSchedeProd> schedeProduzione = maxiDataApiService.retrieveSchedeProduzione(multiDBTransactionManager);
List<MaxidataUveBII40V2BLLUVE2kSchedeProd> schedeProduzione = maxiDataApiService.retrieveSchedeProduzione();
schedeProduzione = removeAlreadyImportedOrders(conn, schedeProduzione);
if (schedeProduzione == null || schedeProduzione.isEmpty())
@@ -162,6 +162,7 @@ public class OrdiniMaxiDataImportService {
productionOrder.addDtbOrdr(new DtbOrdr()
.setNote(String.format("%s N°%d", UtilityLocalDate.formatDate(schedaProd.getDataPrevista().toLocalDate(), CommonConstants.DATE_FORMAT_DMY), schedaProd.getNumeroSchedaProd()))
.setSystemNote(schedaProd.getIdSchedaProd())
.setCodJfas(schedaProd.getLineaProd())
.setCodMart(schedaProd.getIdProdotto())
.setPartitaMag(schedaProd.getLottoProd())
@@ -214,12 +215,12 @@ public class OrdiniMaxiDataImportService {
return orders;
List<String> rifOrdsToCheck = orders.stream()
.map(x -> String.format("%s N°%d", UtilityLocalDate.formatDate(x.getDataPrevista().toLocalDate(), CommonConstants.DATE_FORMAT_DMY), x.getNumeroSchedaProd()))
.map(MaxidataUveBII40V2BLLUVE2kSchedeProd::getIdSchedaProd)
.collect(Collectors.toList());
String sql = "SELECT note " +
String sql = "SELECT system_note " +
" FROM " + DtbOrdr.ENTITY +
" WHERE note IN (" + UtilityQuery.concatStringFieldsWithSeparator(rifOrdsToCheck, ",") + ")";
" WHERE system_note IN (" + UtilityQuery.concatStringFieldsWithSeparator(rifOrdsToCheck, ",") + ")";
List<String> existingRifOrds = UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
@@ -227,7 +228,7 @@ public class OrdiniMaxiDataImportService {
return orders;
return orders.stream()
.filter(x -> !existingRifOrds.contains(String.format("%s N°%d", UtilityLocalDate.formatDate(x.getDataPrevista().toLocalDate(), CommonConstants.DATE_FORMAT_DMY), x.getNumeroSchedaProd())))
.filter(x -> !existingRifOrds.contains(x.getIdSchedaProd()))
.collect(Collectors.toList());
}

View File

@@ -16,7 +16,6 @@ import it.integry.ems.service.dto.production.OrdineLavorazioneDTO;
import it.integry.ems.service.production.ProductionOrderDataHandlerService;
import it.integry.ems.status.ServiceChecker;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.business_logic.GeneraOrdLav;
import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.entity.MtbColt;
import it.integry.ems_model.types.OperationType;
@@ -185,8 +184,13 @@ public class MesProductionControllerV2 {
@RequestParam String gestioneOrd,
@RequestParam(required = false, defaultValue = "0") int hrNum,
@RequestParam(required = false) String descrizioneAttivita) throws Exception {
try {
mesProductionService.openStep(dataOrd, numOrd, gestioneOrd, UtilityString.emptyStr2Null(codJfas), hrNum, null, descrizioneAttivita);
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
}
@RequestMapping(value = EmsRestConstants.PATH_MES_CLOSE_ORDER_STEPS_V2, method = RequestMethod.GET)
@@ -200,8 +204,13 @@ public class MesProductionControllerV2 {
@RequestParam(required = false) Integer idStep,
@RequestParam(required = false) Integer idRiga) throws Exception {
try {
mesProductionService.closeStep(dataOrd, numOrd, gestioneOrd, UtilityString.emptyStr2Null(codJfas), idStep, idRiga);
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
}
@RequestMapping(value = EmsRestConstants.PATH_MES_UPDATE_QTA_IMMESSA_ORDER_STEPS_V2, method = RequestMethod.POST)
@@ -339,8 +348,12 @@ public class MesProductionControllerV2 {
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody CaricoProdottoFinitoDTO caricoProdottoFinitoDTO) throws Exception {
try {
return ServiceRestResponse.createPositiveResponse(mesProductionService.createColloCaricoProdottoFinito(caricoProdottoFinitoDTO));
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
}
@@ -464,11 +477,11 @@ public class MesProductionControllerV2 {
try {
productionOrdersLifecycleService.stopOrdineLav(dto);
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
return ServiceRestResponse.createPositiveResponse();
}
@PostMapping(value = "ordine/reopen")
@@ -478,6 +491,7 @@ public class MesProductionControllerV2 {
return ServiceRestResponse.createPositiveResponse();
}
@PostMapping(value = "ordine/ripianifica")
public @ResponseBody
ServiceRestResponse ripianifica(@RequestBody RipianificaOrdineLavRequestDTO dto) throws Exception {

View File

@@ -3,13 +3,12 @@ package it.integry.ems.production.dto;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
public class CaricoProdottoFinitoDTO {
private String codMart;
private BigDecimal qtaCollo;
private LocalDate dataOrd;
private Date dataCollo;
private LocalDate dataCollo;
private String gestione;
private int numOrd;
private int rigaOrd;
@@ -202,11 +201,11 @@ public class CaricoProdottoFinitoDTO {
return this;
}
public Date getDataCollo() {
public LocalDate getDataCollo() {
return dataCollo;
}
public CaricoProdottoFinitoDTO setDataCollo(Date dataCollo) {
public CaricoProdottoFinitoDTO setDataCollo(LocalDate dataCollo) {
this.dataCollo = dataCollo;
return this;
}

View File

@@ -2,9 +2,13 @@ package it.integry.ems.production.dto;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
public class CreateUDCProduzioneRequestDTO {
private LocalDate customDataCollo;
private LocalDateTime customDataVersamento;
private String codMdep;
private String codJfas;
private String codAnag;
@@ -12,16 +16,42 @@ public class CreateUDCProduzioneRequestDTO {
private LocalDate dataOrd;
private Integer numOrd;
private String rifOrd;
private Integer rigaOrd;
private String codTcol;
private String codJcom;
private String codMart;
private String codVdes;
private BigDecimal qta;
private BigDecimal qtaCnf;
private BigDecimal numCnf;
private String partitaMag;
private String annotazioni;
private String codDtipProvv;
private int numEtich = 0;
public LocalDate getCustomDataCollo() {
return customDataCollo;
}
public CreateUDCProduzioneRequestDTO setCustomDataCollo(LocalDate customDataCollo) {
this.customDataCollo = customDataCollo;
return this;
}
public LocalDateTime getCustomDataVersamento() {
return customDataVersamento;
}
public CreateUDCProduzioneRequestDTO setCustomDataVersamento(LocalDateTime customDataVersamento) {
this.customDataVersamento = customDataVersamento;
return this;
}
public String getCodMdep() {
return codMdep;
}
@@ -76,6 +106,33 @@ public class CreateUDCProduzioneRequestDTO {
return this;
}
public String getRifOrd() {
return rifOrd;
}
public CreateUDCProduzioneRequestDTO setRifOrd(String rifOrd) {
this.rifOrd = rifOrd;
return this;
}
public Integer getRigaOrd() {
return rigaOrd;
}
public CreateUDCProduzioneRequestDTO setRigaOrd(Integer rigaOrd) {
this.rigaOrd = rigaOrd;
return this;
}
public String getCodTcol() {
return codTcol;
}
public CreateUDCProduzioneRequestDTO setCodTcol(String codTcol) {
this.codTcol = codTcol;
return this;
}
public String getCodJcom() {
return codJcom;
}
@@ -94,6 +151,15 @@ public class CreateUDCProduzioneRequestDTO {
return this;
}
public String getCodVdes() {
return codVdes;
}
public CreateUDCProduzioneRequestDTO setCodVdes(String codVdes) {
this.codVdes = codVdes;
return this;
}
public BigDecimal getQta() {
return qta;
}
@@ -138,4 +204,22 @@ public class CreateUDCProduzioneRequestDTO {
this.numEtich = numEtich;
return this;
}
public String getAnnotazioni() {
return annotazioni;
}
public CreateUDCProduzioneRequestDTO setAnnotazioni(String annotazioni) {
this.annotazioni = annotazioni;
return this;
}
public String getCodDtipProvv() {
return codDtipProvv;
}
public CreateUDCProduzioneRequestDTO setCodDtipProvv(String codDtipProvv) {
this.codDtipProvv = codDtipProvv;
return this;
}
}

View File

@@ -0,0 +1,32 @@
package it.integry.ems.production.event;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.time.LocalDate;
public class ProductionOrderClosedEvent extends BaseCustomerDBEvent {
private final String gestione;
private final LocalDate dataOrd;
private final Integer numOrd;
public ProductionOrderClosedEvent(Object source, IntegryCustomerDB customerDB, String gestione, LocalDate dataOrd, Integer numOrd) {
super(source, customerDB);
this.gestione = gestione;
this.dataOrd = dataOrd;
this.numOrd = numOrd;
}
public String getGestione() {
return gestione;
}
public LocalDate getDataOrd() {
return dataOrd;
}
public Integer getNumOrd() {
return numOrd;
}
}

View File

@@ -0,0 +1,32 @@
package it.integry.ems.production.event;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.time.LocalDate;
public class ProductionOrderPausedEvent extends BaseCustomerDBEvent {
private final String gestione;
private final LocalDate dataOrd;
private final Integer numOrd;
public ProductionOrderPausedEvent(Object source, IntegryCustomerDB customerDB, String gestione, LocalDate dataOrd, Integer numOrd) {
super(source, customerDB);
this.gestione = gestione;
this.dataOrd = dataOrd;
this.numOrd = numOrd;
}
public String getGestione() {
return gestione;
}
public LocalDate getDataOrd() {
return dataOrd;
}
public Integer getNumOrd() {
return numOrd;
}
}

View File

@@ -0,0 +1,32 @@
package it.integry.ems.production.event;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.time.LocalDate;
public class ProductionOrderStartedEvent extends BaseCustomerDBEvent {
private final String gestione;
private final LocalDate dataOrd;
private final Integer numOrd;
public ProductionOrderStartedEvent(Object source, IntegryCustomerDB customerDB, String gestione, LocalDate dataOrd, Integer numOrd) {
super(source, customerDB);
this.gestione = gestione;
this.dataOrd = dataOrd;
this.numOrd = numOrd;
}
public String getGestione() {
return gestione;
}
public LocalDate getDataOrd() {
return dataOrd;
}
public Integer getNumOrd() {
return numOrd;
}
}

View File

@@ -0,0 +1,122 @@
package it.integry.ems.production.event;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.event.BaseCustomerDBEvent;
import java.math.BigDecimal;
import java.time.LocalDate;
public class ProductionUlCreatedEvent extends BaseCustomerDBEvent {
private final int numCollo;
private final LocalDate dataCollo;
private final String gestione;
private final short segno;
private final String serCollo;
private final int progressivo;
private final String codMart;
private final String partitaMag;
private final BigDecimal qtaCol;
private final BigDecimal numCnf;
private final BigDecimal qtaCnf;
private final String codJfas;
private final String codJcom;
private final String codMdep;
private final LocalDate dataOrd;
private final Integer numOrd;
private final Integer rigaOrd;
public ProductionUlCreatedEvent(Object source, IntegryCustomerDB customerDB, int numCollo, LocalDate dataCollo, String gestione, short segno, String serCollo,
int progressivo, String codMart, String partitaMag, BigDecimal qtaCol, BigDecimal numCnf, BigDecimal qtaCnf,
String codJfas, String codJcom, String codMdep,
LocalDate dataOrd, Integer numOrd, Integer rigaOrd) {
super(source, customerDB);
this.numCollo = numCollo;
this.dataCollo = dataCollo;
this.gestione = gestione;
this.segno = segno;
this.serCollo = serCollo;
this.progressivo = progressivo;
this.codMart = codMart;
this.partitaMag = partitaMag;
this.qtaCol = qtaCol;
this.numCnf = numCnf;
this.qtaCnf = qtaCnf;
this.codJfas = codJfas;
this.codJcom = codJcom;
this.codMdep = codMdep;
this.dataOrd = dataOrd;
this.numOrd = numOrd;
this.rigaOrd = rigaOrd;
}
public int getNumCollo() {
return numCollo;
}
public LocalDate getDataCollo() {
return dataCollo;
}
public String getGestione() {
return gestione;
}
public short getSegno() {
return segno;
}
public String getSerCollo() {
return serCollo;
}
public int getProgressivo() {
return progressivo;
}
public String getCodMart() {
return codMart;
}
public String getPartitaMag() {
return partitaMag;
}
public BigDecimal getQtaCol() {
return qtaCol;
}
public BigDecimal getNumCnf() {
return numCnf;
}
public BigDecimal getQtaCnf() {
return qtaCnf;
}
public String getCodJfas() {
return codJfas;
}
public String getCodJcom() {
return codJcom;
}
public String getCodMdep() {
return codMdep;
}
public LocalDate getDataOrd() {
return dataOrd;
}
public Integer getNumOrd() {
return numOrd;
}
public Integer getRigaOrd() {
return rigaOrd;
}
}

View File

@@ -14,10 +14,15 @@ import it.integry.ems.document.dto.ScaricoLavorazioneDTO;
import it.integry.ems.document.service.DocumentProdService;
import it.integry.ems.exception.MissingDataException;
import it.integry.ems.exception.PrimaryDatabaseNotPresentException;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.production.dto.*;
import it.integry.ems.production.event.ProductionOrderPausedEvent;
import it.integry.ems.production.event.ProductionOrderStartedEvent;
import it.integry.ems.production.event.ProductionUlCreatedEvent;
import it.integry.ems.report.dto.JasperDTO;
import it.integry.ems.report.dto.PairsDTO;
import it.integry.ems.retail.pvmRetail.service.PvmService;
import it.integry.ems.retail.wms.Utility.WMSUtility;
import it.integry.ems.retail.wms.accettazione.service.WMSAccettazioneService;
import it.integry.ems.retail.wms.dto.*;
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
@@ -53,11 +58,11 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.pdfbox.printing.Orientation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection;
@@ -120,6 +125,9 @@ public class MesProductionServiceV2 {
@Autowired
private WMSGiacenzaULService wmsGiacenzaULService;
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
public BasePanelAnswerDTO callSupervisorServiceGET(String serviceIp, int servicePort, String serviceName, HashMap<String, String> queryParams) throws Exception {
Integer timeout = setupGest.getSetupInteger(multiDBTransactionManager.getPrimaryConnection(), "MES", "HMI", "TIMEOUT_MACHINE_CONNECTION", 5);
@@ -500,6 +508,13 @@ public class MesProductionServiceV2 {
Statement storedProcedure = multiDBTransactionManager.getPrimaryConnection().createStatement();
storedProcedure.execute(syncOpenOrder);
applicationEventPublisher.publishEvent(new ProductionOrderStartedEvent(
this,
IntegryCustomerDB.parse(multiDBTransactionManager.getPrimaryConnection().getDbName()),
gestioneOrd,
dataOrd,
numOrd));
}
@@ -558,6 +573,13 @@ public class MesProductionServiceV2 {
entityProcessor.processEntityList(dtbOrdtList, skipCommit);
UtilityEntity.throwEntitiesException(UtilityEntity.toEntityBaseList(dtbOrdtList));
applicationEventPublisher.publishEvent(new ProductionOrderPausedEvent(
this,
IntegryCustomerDB.parse(multiDBTransactionManager.getPrimaryConnection().getDbName()),
gestioneOrd,
dataOrd,
numOrd));
}
public void cambioFase(LocalDate dataOrd, Integer numOrd, String gestioneOrd, String codJfas, Integer idStep, Integer idRiga, String newCodJfas) throws Exception {
@@ -756,10 +778,16 @@ public class MesProductionServiceV2 {
}};
MtbColt createdUdc = wmsLavorazioneService.createUDC(new CreateUDCRequestDTO()
.setDataCollo(request.getCustomDataCollo())
.setCodMdep(request.getCodMdep())
.setCodJfas(request.getCodJfas())
.setCodAnag(request.getCodAnag())
.setCodVdes(request.getCodVdes())
.setPosizione(request.getPosizione())
.setCodTcol(request.getCodTcol())
.setRifOrd(request.getRifOrd())
.setDataVersamento(request.getCustomDataVersamento())
.setCodDtipProvv(request.getCodDtipProvv())
.setOrders(orders));
final InsertUDCRowResponseDTO insertUDCRowResponse = wmsAccettazioneService.insertUDCRow(new InsertUDCRowRequestDTO()
@@ -768,19 +796,15 @@ public class MesProductionServiceV2 {
.setPartitaMag(request.getPartitaMag())
.setDataOrd(request.getDataOrd())
.setNumOrd(request.getNumOrd())
.setRigaOrd(0)
.setRigaOrd(request.getRigaOrd())
.setCodJcom(request.getCodJcom())
.setQtaTot(request.getQta())
.setQtaCnf(request.getQtaCnf())
.setNumCnf(request.getNumCnf()));
.setNumCnf(request.getNumCnf())
.setDatetimeRow(request.getCustomDataVersamento())
.setAnnotazioni(request.getAnnotazioni())
.setNumEtich(Math.max(request.getNumEtich(), 0)));
if (request.getNumEtich() > 0 && insertUDCRowResponse.getSavedMtbColr() != null) {
MtbColr savedMtbColr = insertUDCRowResponse.getSavedMtbColr()
.setNumEtich(request.getNumEtich());
savedMtbColr.setOperation(OperationType.UPDATE);
entityProcessor.processEntity(savedMtbColr, multiDBTransactionManager);
}
CloseUDCLavorazioneRequestDTO closeRequest = new CloseUDCLavorazioneRequestDTO();
closeRequest.setMtbColt(createdUdc);
@@ -798,6 +822,27 @@ public class MesProductionServiceV2 {
Statement storedProcedure = multiDBTransactionManager.getPrimaryConnection().createStatement();
storedProcedure.execute(syncNewULLavorazione);
applicationEventPublisher.publishEvent(new ProductionUlCreatedEvent(
this,
IntegryCustomerDB.parse(multiDBTransactionManager.getPrimaryConnection().getDbName()),
createdUdc.getNumCollo(),
createdUdc.getDataCollo(),
createdUdc.getGestione(),
(short) createdUdc.getSegno().intValue(),
createdUdc.getSerCollo(),
createdUdc.getProgressivoUl(),
insertUDCRowResponse.getSavedMtbColr().getCodMart(),
insertUDCRowResponse.getSavedMtbColr().getPartitaMag(),
insertUDCRowResponse.getSavedMtbColr().getQtaCol(),
insertUDCRowResponse.getSavedMtbColr().getNumCnf(),
insertUDCRowResponse.getSavedMtbColr().getQtaCnf(),
createdUdc.getCodJfas(),
insertUDCRowResponse.getSavedMtbColr().getCodJcom(),
createdUdc.getCodMdep(),
insertUDCRowResponse.getSavedMtbColr().getDataOrd(),
insertUDCRowResponse.getSavedMtbColr().getNumOrd(),
insertUDCRowResponse.getSavedMtbColr().getRigaOrd()));
return createdUdc;
}
@@ -964,7 +1009,8 @@ public class MesProductionServiceV2 {
.setPartitaMag(dtbOrdt.getPartitaMag())
.setNumEtich(1)
.setQta(BigDecimal.ZERO)
.setNumCnf(BigDecimal.ZERO));
.setNumCnf(BigDecimal.ZERO)
.setRigaOrd(0));
}
private RegisterSupervisorDTO getSupervisorPanelData(String codJfas) throws Exception {
@@ -1065,10 +1111,9 @@ public class MesProductionServiceV2 {
ordineLav.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(ordineLav, multiDBTransactionManager);
MtbAart mtbAart = new MtbAart().setCodMart(ordineLav.getCodProd());
mtbAart.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(mtbAart, multiDBTransactionManager);
MtbAart mtbAart =
WMSUtility.getArticoloByCodMart(ordineLav.getCodProd(), multiDBTransactionManager.getPrimaryConnection());
if (UtilityBigDecimal.isNullOrZero(dto.getQtaCollo())) {
if (UtilityBigDecimal.isNullOrZero(dto.getColliPedana())) {
@@ -1094,7 +1139,8 @@ public class MesProductionServiceV2 {
}
MtbColt mtbColtToInsert = null;
MtbColt productionUdc = null;
MtbColr savedMtbColr = null;
if (dto.isAccodaAdEsistenti()) {
String queryMtbColt = "SELECT mtb_colr.datetime_row, mtb_colr.* " +
@@ -1114,50 +1160,11 @@ public class MesProductionServiceV2 {
List<MtbColt> alreadyPresentMtbColts = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), queryMtbColt, MtbColt.class);
if (alreadyPresentMtbColts != null && !alreadyPresentMtbColts.isEmpty()) {
mtbColtToInsert = alreadyPresentMtbColts.get(0);
mtbColtToInsert.setOperation(OperationType.NO_OP);
}
productionUdc = alreadyPresentMtbColts.get(0);
productionUdc.setOperation(OperationType.NO_OP);
}
if (mtbColtToInsert == null) {
mtbColtToInsert = new MtbColt()
.setMtbColr(new ArrayList<>())
.setGestione("L")
.setSegno(1)
.setCodMdep(UtilityString.isNull(dto.getCodMdep(), ordineLav.getCodMdep()))
.setCodJfas(UtilityString.isNull(dto.getCodJfas(), ordineLav.getCodJfas()))
.setCodVdes(UtilityString.isNull(dto.getCodVdes(), ordineLav.getCodVdes()))
.setCodAnag(ordineLav.getCodAnag())
.setPosizione(dto.getCodJfas())
.setDataOrd(dto.getDataOrd())
.setCodTcol(ordineLav.getCodTcolUl())
.setRifOrd(ordineLav.getRifOrd())
.setCodVdes(ordineLav.getCodVdes())
.setPreparatoDa(dto.getPreparatoDa())
.setNumOrd(dto.getNumOrd());
if (dto.getDataCollo() != null) {
mtbColtToInsert.setDataCollo(UtilityLocalDate.localDateFromDate(dto.getDataCollo()));
}
if (dto.getDataVers() != null) {
mtbColtToInsert.setDataVers(dto.getDataVers());
}
if (dto.isSegnaQuarantena()) {
String codDtipProvv = setupGest.getSetup("MES", "SETUP", "COD_DTIP_PROVV");
if (UtilityString.isNullOrEmpty(codDtipProvv)) {
throw new GestSetupNotFoundException("MES", "SETUP", "COD_DTIP_PROVV");
}
mtbColtToInsert.setCodDtipProvv(codDtipProvv);
}
mtbColtToInsert.setOperation(OperationType.INSERT_OR_UPDATE);
}
MtbColr mtbColrToInsert = new MtbColr()
savedMtbColr = new MtbColr()
.setCodJcom(ordineLav.getCodJcom())
.setDataOrd(dto.getDataOrd())
.setNumOrd(dto.getNumOrd())
@@ -1168,13 +1175,54 @@ public class MesProductionServiceV2 {
.setNote(dto.getNote())
.setQtaCol(dto.getQtaCollo());
if (dto.getDataVers() != null) {
mtbColrToInsert.setDatetimeRow(dto.getDataVers());
savedMtbColr.setDatetimeRow(dto.getDataVers());
}
mtbColrToInsert.setOperation(OperationType.INSERT);
mtbColtToInsert.getMtbColr().add(mtbColrToInsert);
savedMtbColr.setOperation(OperationType.INSERT);
productionUdc.getMtbColr().add(savedMtbColr);
entityProcessor.processEntity(productionUdc, true, multiDBTransactionManager);
} else {
final CreateUDCProduzioneRequestDTO createUdcRequest = new CreateUDCProduzioneRequestDTO()
.setDataOrd(dto.getDataOrd())
.setNumOrd(dto.getNumOrd())
.setCodMdep(UtilityString.isNull(dto.getCodMdep(), ordineLav.getCodMdep()))
.setCodJfas(UtilityString.isNull(dto.getCodJfas(), ordineLav.getCodJfas()))
.setCodVdes(UtilityString.isNull(dto.getCodVdes(), ordineLav.getCodVdes()))
.setCodAnag(ordineLav.getCodAnag())
.setPosizione(dto.getCodJfas())
.setCodTcol(ordineLav.getCodTcolUl())
.setRifOrd(ordineLav.getRifOrd());
if (dto.getDataCollo() != null) {
createUdcRequest.setCustomDataCollo(dto.getDataCollo());
}
if (dto.getDataVers() != null) {
createUdcRequest.setCustomDataVersamento(dto.getDataVers());
}
if (dto.isSegnaQuarantena()) {
String codDtipProvv = setupGest.getSetup("MES", "SETUP", "COD_DTIP_PROVV");
if (UtilityString.isNullOrEmpty(codDtipProvv))
throw new GestSetupNotFoundException("MES", "SETUP", "COD_DTIP_PROVV");
createUdcRequest.setCodDtipProvv(codDtipProvv);
}
createUdcRequest.setCodJcom(ordineLav.getCodJcom())
.setCodMart(ordineLav.getCodProd())
.setPartitaMag(ordineLav.getPartitaMag())
.setNumEtich(dto.getNumEtich())
.setQta(dto.getQtaCollo())
.setRigaOrd(UtilityInteger.isNull(dto.getRigaOrd(), 0))
.setAnnotazioni(dto.getNote());
productionUdc = createULLavorazione(createUdcRequest);
savedMtbColr = productionUdc.getMtbColr().get(0);
}
entityProcessor.processEntity(mtbColtToInsert, true, multiDBTransactionManager);
if (dto.isSegnaQuarantena()) {
String indirizziQuarantena = setupGest.getSetup("MES", "MAIL", "INDIRIZZI_QUARANTENA");
@@ -1187,14 +1235,14 @@ public class MesProductionServiceV2 {
}
testoMailQuarantena = testoMailQuarantena
.replace("[codMdep]", mtbColtToInsert.getCodMdep())
.replace("[dataCollo]", UtilityLocalDate.formatDate(mtbColtToInsert.getDataCollo(), CommonConstants.DATE_FORMAT_DMY))
.replace("[numCollo]", String.valueOf(mtbColtToInsert.getNumCollo()))
.replace("[codMdep]", productionUdc.getCodMdep())
.replace("[dataCollo]", UtilityLocalDate.formatDate(productionUdc.getDataCollo(), CommonConstants.DATE_FORMAT_DMY))
.replace("[numCollo]", String.valueOf(productionUdc.getNumCollo()))
.replace("[articolo]", String.format("%s - %s", mtbAart.getCodMart(), mtbAart.getDescrizione()))
.replace("[partitaMag]", mtbColrToInsert.getPartitaMag())
.replace("[qtaCol]", UtilityString.bigDecimalToString(mtbColrToInsert.getQtaCol(), "#,###"))
.replace("[numCnf]", UtilityString.bigDecimalToString(mtbColrToInsert.getNumCnf(), "#,###"))
.replace("[posizione]", mtbColtToInsert.getPosizione());
.replace("[partitaMag]", savedMtbColr.getPartitaMag())
.replace("[qtaCol]", UtilityString.bigDecimalToString(savedMtbColr.getQtaCol(), "#,###"))
.replace("[numCnf]", UtilityString.bigDecimalToString(savedMtbColr.getNumCnf(), "#,###"))
.replace("[posizione]", productionUdc.getPosizione());
String subject = "Pedane in Quarantena";
@@ -1211,10 +1259,10 @@ public class MesProductionServiceV2 {
}
}
return mtbColtToInsert;
return productionUdc;
}
private int getMaxFaseOrdine(DtbOrdt ordineLav) throws SQLException, IOException, PrimaryDatabaseNotPresentException {
private int getMaxFaseOrdine(DtbOrdt ordineLav) throws SQLException, PrimaryDatabaseNotPresentException {
String sql = "select top 1 num_fase \n" +
"from dtb_ord_steps \n" +
"where data_ord = " + UtilityDB.valueToString(ordineLav.getDataOrd()) +

View File

@@ -147,7 +147,7 @@ public class OrtoFruttaProductionService {
.setCodMdep(dto.getCodMdepProd())
.setCodJfas(dto.getCodJfas())
.setDataOrd(dto.getDataOrd())
.setDataCollo(UtilityLocalDate.localDateToDate(dto.getDataCollo()))
.setDataCollo(dto.getDataCollo())
.setNumOrd(dto.getNumOrd())
.setGestione(dto.getGestione())
.setQtaCollo(dto.getQtaCol());

View File

@@ -9,9 +9,11 @@ import it.integry.ems.document.dto.RientroLavorazioneDTO;
import it.integry.ems.document.dto.ScaricoLavorazioneDTO;
import it.integry.ems.exception.MissingDataException;
import it.integry.ems.javabeans.RequestDataDTO;
import it.integry.ems.migration._base.IntegryCustomerDB;
import it.integry.ems.product.importaz.service.RipianificaOrdineLavRequestDTO;
import it.integry.ems.production.dto.AnnullaOrdLavRequestDTO;
import it.integry.ems.production.dto.ReopenOrdineLavRequestDTO;
import it.integry.ems.production.event.ProductionOrderClosedEvent;
import it.integry.ems.service.AziendaService;
import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
@@ -26,10 +28,14 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@Service
@@ -58,6 +64,9 @@ public class ProductionOrdersLifecycleService {
@Autowired
private MesProductionServiceV2 mesProductionServiceV2;
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
public void stopOrdineLav(ChiusuraLavorazioneDTO dto) throws Exception {
DtbOrdt dtbOrdt = dto.getOrdine();
if (dtbOrdt == null) {
@@ -178,6 +187,7 @@ public class ProductionOrdersLifecycleService {
productionService.chiudiOrdineLavorazione(dto);
//</editor-fold>
//TODO: Spostare le logiche del supervisor in una component che ascolta l'evento pubblicato
if (mesProductionServiceV2.hasSupervisorPanel(dto.getCodJfas())) {
HashMap<String, Object> body = new HashMap<>();
@@ -190,13 +200,18 @@ public class ProductionOrdersLifecycleService {
try {
mesProductionServiceV2.sendCommand(dto.getCodJfas(), "order/stop", mapper.convertValue(body, JsonNode.class));
} catch (Exception e) {
logger.error(e);
if ((!UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer())) {
throw e;
}
}
}
applicationEventPublisher.publishEvent(new ProductionOrderClosedEvent(this,
IntegryCustomerDB.parse(multiDBTransactionManager.getPrimaryConnection().getDbName()),
dtbOrdt.getGestione(),
UtilityLocalDate.localDateFromDate(dtbOrdt.getDataOrd()),
dtbOrdt.getNumOrd()));
}
public void reopenOrdineLav(ReopenOrdineLavRequestDTO reopenOrdineLavRequestDTO) throws Exception {

View File

@@ -299,7 +299,7 @@ public class WMSUtility {
.setCodDtipDoc(insertUDCRowRequestDTO.getCodDtip())
.setSerDoc(insertUDCRowRequestDTO.getSerDoc())
.setDatetimeRow(UtilityLocalDate.getNowTime());
.setDatetimeRow(UtilityLocalDate.isNull(insertUDCRowRequestDTO.getDatetimeRow(), UtilityLocalDate.getNowTime()));
if (insertUDCRowRequestDTO.getCodMart() != null) {

View File

@@ -312,7 +312,8 @@ public class WMSAccettazioneService {
.setCodDtipDoc(insertUDCRowRequestDTO.getCodDtip())
.setSerDoc(insertUDCRowRequestDTO.getSerDoc())
.setDatetimeRow(UtilityLocalDate.getNowTime());
.setDatetimeRow(UtilityLocalDate.getNowTime())
.setNumEtich(insertUDCRowRequestDTO.getNumEtich());
if (insertUDCRowRequestDTO.getCodMart() != null) {

View File

@@ -1,6 +1,7 @@
package it.integry.ems.retail.wms.dto;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
public class CreateUDCRequestDTO {
@@ -17,8 +18,11 @@ public class CreateUDCRequestDTO {
private String posizione;
private String annotazioni;
private String rifOrd;
private LocalDateTime dataVersamento;
private String barcodeUl;
private String codDtipProvv;
private List<CreateUDCRequestOrderDTO> orders;
@@ -86,6 +90,24 @@ public class CreateUDCRequestDTO {
return this;
}
public String getRifOrd() {
return rifOrd;
}
public CreateUDCRequestDTO setRifOrd(String rifOrd) {
this.rifOrd = rifOrd;
return this;
}
public LocalDateTime getDataVersamento() {
return dataVersamento;
}
public CreateUDCRequestDTO setDataVersamento(LocalDateTime dataVersamento) {
this.dataVersamento = dataVersamento;
return this;
}
public String getBarcodeUl() {
return barcodeUl;
}
@@ -95,6 +117,15 @@ public class CreateUDCRequestDTO {
return this;
}
public String getCodDtipProvv() {
return codDtipProvv;
}
public CreateUDCRequestDTO setCodDtipProvv(String codDtipProvv) {
this.codDtipProvv = codDtipProvv;
return this;
}
public List<CreateUDCRequestOrderDTO> getOrders() {
return orders;
}

View File

@@ -4,6 +4,7 @@ import it.integry.ems_model.entity.MtbColt;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
public class InsertUDCRowRequestDTO {
@@ -19,6 +20,7 @@ public class InsertUDCRowRequestDTO {
private LocalDate dataScad;
private String codJcom;
private String gestioneRif;
private LocalDateTime datetimeRow;
private LocalDate dataOrd;
private Integer numOrd;
@@ -30,6 +32,8 @@ public class InsertUDCRowRequestDTO {
private String codDtip;
private String fullName;
private String annotazioni;
private Integer numEtich;
public MtbColt getTargetMtbColt() {
return targetMtbColt;
@@ -130,6 +134,15 @@ public class InsertUDCRowRequestDTO {
return this;
}
public LocalDateTime getDatetimeRow() {
return datetimeRow;
}
public InsertUDCRowRequestDTO setDatetimeRow(LocalDateTime datetimeRow) {
this.datetimeRow = datetimeRow;
return this;
}
public LocalDate getDataOrd() {
return dataOrd;
}
@@ -201,4 +214,22 @@ public class InsertUDCRowRequestDTO {
this.fullName = fullName;
return this;
}
public String getAnnotazioni() {
return annotazioni;
}
public InsertUDCRowRequestDTO setAnnotazioni(String annotazioni) {
this.annotazioni = annotazioni;
return this;
}
public Integer getNumEtich() {
return numEtich;
}
public InsertUDCRowRequestDTO setNumEtich(Integer numEtich) {
this.numEtich = numEtich;
return this;
}
}

View File

@@ -599,9 +599,11 @@ public class WMSLavorazioneService {
MtbColt udcMtbColt = new MtbColt()
.setGestione(GestioneEnum.LAVORAZIONE.getText())
.setDataCollo(createUDCRequestDTO.getDataCollo())
.setNumCollo(createUDCRequestDTO.getNumCollo())
.setSerCollo(createUDCRequestDTO.getSerCollo())
.setCodMdep(createUDCRequestDTO.getCodMdep())
.setCodVdes(createUDCRequestDTO.getCodVdes())
.setOraInizPrep(new Date())
.setPreparatoDa(requestDataDTO.getUsername())
.setPosizione(UtilityString.isNull(createUDCRequestDTO.getPosizione(), defaultPosizioneColliAccettazione))
@@ -609,6 +611,9 @@ public class WMSLavorazioneService {
.setCodJfas(createUDCRequestDTO.getCodJfas())
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
.setBarcodeUl(createUDCRequestDTO.getBarcodeUl())
.setRifOrd(createUDCRequestDTO.getRifOrd())
.setDataVers(createUDCRequestDTO.getDataVersamento())
.setCodDtipProvv(createUDCRequestDTO.getCodDtipProvv())
.setSegno(1);

View File

@@ -2,16 +2,13 @@
<beans xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:task="http://www.springframework.org/schema/task"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd">
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
<context:component-scan base-package="it.integry"/>
<bean id="ppConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
@@ -24,11 +21,6 @@
</property>
</bean>
<task:scheduler id="taskScheduler" pool-size="5"/>
<!-- Enables support to @Scheduled -->
<task:annotation-driven/>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="it"/>