initialize

This commit is contained in:
Pruefer
2025-06-06 09:15:13 +02:00
commit fa7c2730f1
5817 changed files with 1339670 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>data-interface-line-dashboard-plugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="data-interface-line-dashboard-plugin">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
</wb-module>
</project-modules>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.8"/>
<installed facet="jst.utility" version="1.0"/>
</faceted-project>

View File

@@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-line-dashboard-plugin</artifactId>
<packaging>jar</packaging>
<name>data-interface-line-dashboard-plugin</name>
<version>${mes.interface.version}</version>
<parent>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-line-dashboard</artifactId>
<version>${mes.interface.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.itac.product</groupId>
<artifactId>artes-common</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.linedashboard</groupId>
<artifactId>linedashboard-api</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-core-definition</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>create-project-bundle</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>zippackaging</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<classifier>zip</classifier>
<descriptors>
<descriptor>src/main/assembly/descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,21 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory/>
<includes>
<include>*dependencies*.jar</include>
</includes>
<excludes>
<exclude>*.zip</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View File

@@ -0,0 +1,14 @@
package com.itac.mes.linedashboard;
public interface IMesServicesChannel extends IMesServices {
public boolean isShutdown();
public void startup();
public void shutdown();
public String getChannelName();
public void setChannelName(String channelName);
}

View File

@@ -0,0 +1,19 @@
package com.itac.mes.linedashboard;
public class LineDashboardException extends Exception {
/**
*
*/
private static final long serialVersionUID = -9180600020616111590L;
private ResponseDetail responseDetail;
public LineDashboardException(ResponseDetail responseDetail) {
this.responseDetail = responseDetail;
}
public ResponseDetail getResponseDetail() {
return responseDetail;
}
}

View File

@@ -0,0 +1,28 @@
package com.itac.mes.linedashboard;
public interface LineDashboardFields {
public static final String EVENT_DATE = "eventDate";
public static final String STATUS = "status";
public static final String MESSAGE_DETAIL = "messageDetail";
public static final String MESSAGE_STOP = "messageStop";
public static final String MESSAGE_START = "messageStart";
public static final String MESSAGE_CODE = "messageCode";
public static final String END_PRODUCTION = "endProduction";
public static final String START_PRODUCTION = "startProduction";
public static final String STATE = "state";
public static final String OPERATION = "operation";
public static final String LANE = "lane";
public static final String LINE_NAME = "lineName";
public static final String MACHINE_NAME = "machineName";
public static final String MACHINE = "machine";
public static final String MODULE_NAME = "moduleName";
public static final String WORKORDER = "workOrder";
public static final String PROCESS_LAYER = "processLayer";
public static final String PROCESS_TYPE = "processType";
public static final String STATION_RESULTS = "stationResults";
}

View File

@@ -0,0 +1,426 @@
/*
* Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.linedashboard;
import static com.itac.mes.linedashboard.ResponseDetail.OK;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Date;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.namespace.QName;
import com.itac.mes.linedashboard.data.ErrorDetail;
import com.itac.mes.linedashboard.data.MachineStatusRequest;
import com.itac.mes.linedashboard.data.MesConfigurationResponse;
import com.itac.mes.linedashboard.data.MesRequest;
import com.itac.mes.linedashboard.data.MesResponse;
import com.itac.mes.linedashboard.data.MesStartRequest;
import com.itac.mes.linedashboard.data.ProductionTimeRequest;
import com.itac.mes.linedashboard.data.QuantityAndFailureUploadRequest;
import com.itac.mes.linedashboard.data.StationResultRequest;
import com.itac.mes.linedashboard.sockets.IhapHandler;
/**
* @author frankp created 2013
*/
public class MesServices implements IMesServices {
private static String LOG_PREFIX = "ImsInterfaces LineDashboard-Plugin > ";
private static final int MIN_REQUEST_ID = 0;
private static final int MAX_REQUEST_ID = 1000000;
private static final int MIN_PORT = 1023;
private static final int MAX_PORT = 49150;
private boolean isConfigured;
private boolean isActive;
private boolean isConnected;
private String sHost;
private int iPort;
private int requestId;
private boolean logDetails = false; // default keine details loggen
private PropertyChangeListener interfaceConnectionListener;
private IMesServices interfaceConnection;
private Marshaller marshaller;
public MesServices() {
isConfigured = false;
isConnected = false;
requestId = 0;
}
/**
* Vorbedingungen sind dass der Request gesetzt ist, sowie die Konfiguration und die aktivierung des Plugin
*
* @param mesResponse
* @param mesRequest
* @throws LineDashboardException
*/
private void checkPreconditions(MesResponse mesResponse, MesRequest mesRequest) throws LineDashboardException {
if (mesRequest == null) {
throw new LineDashboardException(ResponseDetail.REQUEST_IS_NULL);
}
if (mesRequest.getRequestId() <= 0) {
mesRequest.setRequestId(getRequestId());
}
if (mesRequest.getEventDate() == null) {
mesRequest.setEventDate(new Date());
}
// Request ausgeben
logRequest(mesRequest);
// requestId aus Request in den Response uebernehmen
mesResponse.setRequestId(mesRequest.getRequestId());
// Konfigurationsprobleme checken
if (!isConfigured) {
throw new LineDashboardException(ResponseDetail.PLUGIN_NOT_CONFIGURED);
}
if (!isActive) {
throw new LineDashboardException(ResponseDetail.PLUGIN_NOT_ACTIVE);
}
if (!isConnected) {
throw new LineDashboardException(ResponseDetail.PLUGIN_NOT_CONNECTED);
}
setResponseValues(mesResponse, OK);
}
/**
* finalizing means closing communication channel and loggin response Object
*
* @param connection
* the used connection
* @param responseObject
* the responseObject
*/
private void finalizeRequest(IMesServicesChannel connection, MesResponse responseObject) {
if (connection != null) {
connection.shutdown();
}
logResponse(responseObject);
}
/**
* gets a new communication cahnnel with specified name
*
* @param channelName
* the name for the channel
* @param connectionListener
* @return
* @throws IOException
*/
private IMesServicesChannel getConnection(String channelName, PropertyChangeListener connectionListener) throws IOException {
IMesServicesChannel serviceChannel = IhapHandler.connect(sHost, iPort, channelName, connectionListener,
IMesServicesChannel.class.getClassLoader(), null);
// Kanal Ueberwachung starten
serviceChannel.startup();
isConnected = true;
return serviceChannel;
}
// convenient method
private ErrorDetail getErrorDetail(String detail, int code) {
ErrorDetail errorDetail = new ErrorDetail();
errorDetail.setCode(code);
errorDetail.setDetail(detail);
return errorDetail;
}
// creates an almost unique id
private int getRequestId() {
requestId += 1;
if (requestId >= MAX_REQUEST_ID) {
requestId = MIN_REQUEST_ID;
}
return requestId;
}
private void handleThrowable(MesResponse response, Throwable throwable) {
response.setTotalResult(IMesServices.MES_RESULT_NOT_OK);
if (throwable instanceof LineDashboardException) {
setResponseValues(response, ((LineDashboardException) throwable).getResponseDetail());
} else if (throwable instanceof IOException) {
response.getErrorDetails().add(getErrorDetail(throwable.getMessage(), ResponseDetail.COMMUNICATION_FAILURE.getCode()));
} else {
response.getErrorDetails().add(getErrorDetail(throwable.getMessage(), ResponseDetail.PROCESSED_WITH_EXCEPTION.getCode()));
throwable.printStackTrace();
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void logResponse(MesResponse mesResponse) {
if (mesResponse == null) {
System.out.println(LOG_PREFIX + "finish empty request");
return;
}
System.out.println(LOG_PREFIX + "finish request " + mesResponse.getRequestId() + " with code " + mesResponse.getTotalResult());
if (logDetails) {
try {
System.out.print(LOG_PREFIX);
JAXBElement<?> jexbelement = new JAXBElement(new QName(mesResponse.getClass().getSimpleName()), mesResponse.getClass(),
mesResponse);
marshaller.marshal(jexbelement, System.out);
} catch (Throwable e) {
System.out.print("-> Error logging mesResponse details");
} finally {
System.out.println();
}
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void logRequest(MesRequest mesRequest) {
System.out
.print(LOG_PREFIX + "start request " + mesRequest.getRequestId() + " (" + mesRequest.getClass().getSimpleName() + ")");
if (logDetails) {
try {
JAXBElement<?> jexbelement = new JAXBElement(new QName(mesRequest.getClass().getSimpleName()), mesRequest.getClass(),
mesRequest);
marshaller.marshal(jexbelement, System.out);
} catch (Throwable e) {
System.out.print("-> Error logging mesRequest details");
}
}
System.out.println();
}
private void setResponseValues(MesResponse response, ResponseDetail responseDetail) {
if (responseDetail == ResponseDetail.OK) {
response.setTotalResult(IMesServices.MES_RESULT_OK);
return;
}
response.setTotalResult(IMesServices.MES_RESULT_NOT_OK);
response.getErrorDetails().add(getErrorDetail(responseDetail.getText(), responseDetail.getCode()));
}
@Override
public MesResponse mesMachineState(MachineStatusRequest machineStatus) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, machineStatus);
connection = getConnection("machineStatus", null);
responseObject = connection.mesMachineState(machineStatus);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesStart(MesRequest mesRequest) {
MesStartRequest mesStart = new MesStartRequest();
mesStart.setRequestId(mesRequest.getRequestId());
mesStart.setEventDate(mesRequest.getEventDate());
return mesStart(mesStart);
}
@Override
public MesResponse mesStart(MesStartRequest mesRequest) {
MesResponse responseObject = new MesResponse();
try {
// zuerst die properties pruefen und Werte uebernehmen
if (System.getProperties().containsKey(MES_LOG_PREFIX)) {
LOG_PREFIX = System.getProperty(MES_LOG_PREFIX);
}
if (System.getProperties().containsKey(MES_LOG_DETAILS)) {
String sLogDetails = System.getProperty(MES_LOG_DETAILS);
logDetails = sLogDetails.equalsIgnoreCase(Boolean.TRUE.toString()) || sLogDetails.equals("1");
}
if (logDetails && marshaller == null) {
// alle Klassen aus diesem Package...
Class<?>[] classes = new Class[] { MachineStatusRequest.class, ProductionTimeRequest.class, StationResultRequest.class,
QuantityAndFailureUploadRequest.class, MesConfigurationResponse.class, MesRequest.class, MesResponse.class };
JAXBContext jc;
try {
jc = JAXBContext.newInstance(classes);
marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
} catch (JAXBException e) {
System.err.println(LOG_PREFIX + "no jaxb context or marshaller created");
responseObject.getErrorDetails().add(getErrorDetail("no jaxb context or marshaller created", -1));
}
} else {
// wenn das detailled loggin ausgeschlaten wurde auch den marshaller killen; bei erneutem mesStart call wird ein
// neuer marshaller erzeugt
marshaller = null;
}
// ab jetzt fachlich checken
if (mesRequest == null) {
throw new LineDashboardException(ResponseDetail.REQUEST_IS_NULL);
}
if (isActive) {
setResponseValues(responseObject, ResponseDetail.OK);
return responseObject;
}
if (!isConfigured) {
boolean ok = true;
try {
sHost = System.getProperty(MesServices.MES_HOST).toString();
} catch (Exception exception) {
String err = MessageFormat.format("{0}setting value for property {1} failed", LOG_PREFIX, MES_HOST);
System.err.println(err);
responseObject.getErrorDetails().add(getErrorDetail(err, -1));
ok = false;
}
try {
String sPort = System.getProperty(MesServices.MES_PORT).toString();
iPort = Integer.parseInt(sPort);
if ((iPort < MIN_PORT) || (iPort > MAX_PORT)) {
String err = MessageFormat.format("{0}setting value for property {1} failed, value {2} is out of range {3}..{4}",
LOG_PREFIX, MES_PORT, sPort, MIN_PORT, MAX_PORT);
System.err.println(err);
responseObject.getErrorDetails().add(getErrorDetail(err, -1));
ok = false;
}
} catch (Exception exception) {
String err = MessageFormat.format("{0}setting value for property {1} failed:{2}", LOG_PREFIX, MES_PORT,
exception.getClass().getSimpleName());
System.err.println(err);
responseObject.getErrorDetails().add(getErrorDetail(err, -1));
ok = false;
}
if (!ok) {
throw new LineDashboardException(ResponseDetail.WRONG_COMMUNICATION_PROPERTIES);
}
isConfigured = true;
}
if (!isActive) {
interfaceConnectionListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
IhapHandler ihapHandler = (IhapHandler) evt.getSource();
System.out.println(LOG_PREFIX + ihapHandler.getChannelName() + " was closed by iTAC.MES.Suite DataInterface");
}
};
try {
if (interfaceConnection != null) {
if (((IMesServicesChannel) interfaceConnection).isShutdown()) {
interfaceConnection = null;
isConnected = false;
}
}
interfaceConnection = getConnection("interfaceConnection", interfaceConnectionListener);
long start = System.nanoTime();
responseObject = interfaceConnection.mesStart(mesRequest);
long finished = System.nanoTime();
System.out.println(LOG_PREFIX + "roundtrip = " + ((finished - start) / 1000L) + " microseconds");
isActive = true;
} catch (IOException e) {
throw new LineDashboardException(ResponseDetail.COMMUNICATION_FAILURE);
}
}
} catch (LineDashboardException cse) {
handleThrowable(responseObject, cse);
} finally {
logResponse(responseObject);
}
return responseObject;
}
@Override
public MesResponse mesGetStatus(MesRequest mesRequest) {
MesResponse responseObject = new MesResponse();
try {
checkPreconditions(responseObject, mesRequest);
responseObject = interfaceConnection.mesGetStatus(mesRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
logResponse(responseObject);
}
return responseObject;
}
@Override
public MesResponse mesStop(MesRequest mesRequest) {
MesResponse responseObject = new MesResponse();
try {
checkPreconditions(responseObject, mesRequest);
responseObject = interfaceConnection.mesStop(mesRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
logResponse(responseObject);
}
isActive = false;
isConfigured = false;
isConnected = false;
if (interfaceConnection != null) {
((IMesServicesChannel) interfaceConnection).shutdown();
}
return responseObject;
}
@Override
public MesResponse mesSetProductionData(ProductionTimeRequest productionDataRequest) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, productionDataRequest);
connection = getConnection("productionData", null);
responseObject = connection.mesSetProductionData(productionDataRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesSetStationResult(StationResultRequest stationResultRequest) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, stationResultRequest);
connection = getConnection("stationResult", null);
responseObject = connection.mesSetStationResult(stationResultRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesSetQuantityAndFailureData(QuantityAndFailureUploadRequest quantityAndFailureUploadRequest) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, quantityAndFailureUploadRequest);
connection = getConnection("quantityAndFailureData", null);
responseObject = connection.mesSetQuantityAndFailureData(quantityAndFailureUploadRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
}

View File

@@ -0,0 +1,46 @@
package com.itac.mes.linedashboard;
public enum ResponseDetail {
// WARNINGS, HINTS: positive values
//
OK("", 0),
// Plugin-ERRORS: negative values
REQUEST_IS_NULL("request is null", -10001), //
/** any call to MES before mesConfigure was called properly */
PLUGIN_NOT_CONFIGURED("plugin not configured", -10002), //
PLUGIN_NOT_ACTIVE("plugin not active", -10003), //
PLUGIN_NOT_CONNECTED("plugin not connected " + ResponseDetail.MES_DATA_INTERFACE, -10004), //
COMMUNICATION_FAILURE("communication failure", -10005), //
WRONG_COMMUNICATION_PROPERTIES("communication properties wrong", -10006), //
// Errors from Data Interface negative values
MES_NOT_CONNECTED(ResponseDetail.MES_DATA_INTERFACE + "is not connected", -20000), //
MES_NOT_CONFIGURED_PROPERLY(ResponseDetail.MES_DATA_INTERFACE + "is not properly configured", -20001), //
MES_NOT_INITIALIZED(ResponseDetail.MES_DATA_INTERFACE + "is not initialized", -20002), //
PARSED_WITH_EXCEPTION(ResponseDetail.MES_DATA_INTERFACE + "caught an exception on parsing request", -20003), //
PROCESSED_WITH_EXCEPTION(ResponseDetail.MES_DATA_INTERFACE + "caught an exception on processing request", -20004), //
SERIALNUMBER_NOT_ALLOWED(ResponseDetail.MES_DATA_INTERFACE + "Serialnumber not allowed", -20005), //
PARSE_PROBLEM(ResponseDetail.MES_DATA_INTERFACE + "has a problem parsing the request", -20006), //
NOT_SENT(ResponseDetail.MES_DATA_INTERFACE + "did not sent data", -20007), //
MES_SERVICE_NOT_REACHABLE("iTAC.MES.Suite service is not reachable", -20008), //
;
private static final String MES_DATA_INTERFACE = "iTAC.MES.Suite DataInterface ";
private int code;
private String text;
private ResponseDetail(String text, int code) {
this.text = text;
this.code = code;
}
public int getCode() {
return code;
}
public String getText() {
return text;
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2008 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.linedashboard.sockets;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.lang.reflect.Proxy;
import com.itac.mes.datainterface.data.IMesServicesLog;
import com.itac.mes.datainterface.socket.BaseIhapHandler;
import com.itac.mes.linedashboard.IMesServicesChannel;
/**
* This handler delegates IMesService calls to a socket server for Linedashboard Interface
*
* @author frankp
*
*/
public class IhapHandler extends BaseIhapHandler {
/**
* This handler is responsible for calling all IMesServices functions at a socket server for this type.<br>
*
* @param host
* the host where the server listens
* @param port
* the port the server listens
* @param channelName
* the name of the channel. As every channel has a unique name it is possible to debug server/client side
* @param connectionStateCloseListener
* detect wether a
* @param classLoader
* a classloader to override default class loader
* @param log
* the mesLog. if null prints direct to System.out/System.err
* @return the reference to a base Handler
* @throws IOException
* thrown if no connection was established (server not available)
*/
public static IMesServicesChannel connect(String host, int port, String channelName,
PropertyChangeListener connectionStateCloseListener, ClassLoader classLoader, IMesServicesLog log) throws IOException {
// create a default connection, not bound to any type
BaseIhapHandler handler = createHandler(host, port, channelName, connectionStateCloseListener, classLoader, log);
// create a proxy for a specific type (Interface)
IMesServicesChannel mesServiceChannel = (IMesServicesChannel) Proxy.newProxyInstance(classLoader,
new Class[] { IMesServicesChannel.class }, handler);
// set the channel name and transport it top server
mesServiceChannel.setChannelName(channelName);
return mesServiceChannel;
}
}

View File

@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema id="message" targetNamespace="linedashboard.mes.itac.com" xmlns="com.linedashboard.mes" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:Q1="linedashboard.mes.itac.com" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0">
<xs:annotation>
<xs:appinfo>
<jxb:globalBindings>
<jxb:javaType name="java.util.Date" xmlType="xs:dateTime" parseMethod="com.itac.mes.linedashboard.DateAdapter.parseDate" printMethod="com.itac.mes.linedashboard.DateAdapter.printDate" />
</jxb:globalBindings>
</xs:appinfo>
</xs:annotation>
<xs:complexType name="Machine">
<xs:annotation>
<xs:documentation>Complete information for a machine. Used in iTAC.MES.Suite to find a corresponding stationNumber.</xs:documentation>
</xs:annotation>
<xs:attribute name="lineName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The line name this machine belongs to</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="machineName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The machine name as used in linedashboard.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="moduleName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The name (or number) of a module. May remain empty if module is not available.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lane" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>If not applicable (single lane ) use a fix identifier (e.g. "1").
Otherwise send an identifier for the lane.
For operations which does not belong to a specific lane send the static value "UNDEFINED"
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="MesResponse">
<xs:annotation>
<xs:documentation>
Every request is answered by a response, at least containing a totalresult for complete Operation and the
request id from its corresponding request.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="errorDetails" type="Q1:ErrorDetail" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="requestId" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>
An value identifying the call. Every response has the same requestId as it's corresponding request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="totalResult" use="required">
<xs:annotation>
<xs:documentation>0 = OK 1 = NOT_OK</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>0 = OK 1 = NOT_OK</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:int">
<xs:enumeration value="0"></xs:enumeration>
<xs:enumeration value="1"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="MesRequest">
<xs:annotation>
<xs:documentation>Every request from linedashboard to MES extends this message.</xs:documentation>
</xs:annotation>
<xs:attribute name="requestId" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>This is the request Id, to be found on both sides
and both on request and response. This information
could help on
error analysis.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="eventDate" type="xs:dateTime" use="required">
<xs:annotation>
<xs:documentation>The date and time a request is created.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="MachineStatusRequest">
<xs:annotation>
<xs:documentation>Used whenever a machine changes its state.</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>The machine descriptor.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="status" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The new status for the machine. This status is valid from the (inherited field) eventDate.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MesConfigurationResponse">
<xs:complexContent>
<xs:extension base="Q1:MesResponse">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ErrorDetail">
<xs:attribute name="detail" type="xs:string"></xs:attribute>
<xs:attribute name="code" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
<xs:complexType name="StationResultRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="stationResults" type="Q1:StationResult" maxOccurs="unbounded" minOccurs="0"></xs:element>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1"></xs:element>
</xs:sequence>
<xs:attribute name="partNumber" type="xs:string">
<xs:annotation>
<xs:documentation>Partnumber must be set, if empty a -1 is used in API call</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="workorder" type="xs:string"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ProductionTimeRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine"></xs:element>
</xs:sequence>
<xs:attribute name="workorder" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="processLayer" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="productionTime" type="xs:double" use="required"></xs:attribute>
<xs:attribute name="setupTime" type="xs:double" use="required"></xs:attribute>
<xs:attribute name="processType" default="M">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="1"></xs:length>
<xs:enumeration value="M">
<xs:annotation>
<xs:documentation>Machine workstep</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="P">
<xs:annotation>
<xs:documentation>Person workstep</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="multiBoard" type="xs:int" use="required"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="StationResult">
<xs:attribute name="lowerLimit" type="xs:string"></xs:attribute>
<xs:attribute name="upperLimit" type="xs:string"></xs:attribute>
<xs:attribute name="measureName" type="xs:string"></xs:attribute>
<xs:attribute name="measureFailCode" type="xs:string"></xs:attribute>
<xs:attribute name="measureValue" type="xs:string"></xs:attribute>
<xs:attribute name="nominal" type="xs:string"></xs:attribute>
<xs:attribute name="tolerance" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="unit" type="xs:string"></xs:attribute>
</xs:complexType>
<xs:complexType name="QuantityAndFailureUploadRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine"></xs:element>
<xs:element name="failureData" type="Q1:FailureData" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="workorder" type="xs:string"></xs:attribute>
<xs:attribute name="processLayer" type="xs:string"></xs:attribute>
<xs:attribute name="pass" type="xs:int" use="required"></xs:attribute>
<xs:attribute name="fail" type="xs:int" use="required"></xs:attribute>
<xs:attribute name="scrap" type="xs:int" use="required"></xs:attribute>
<xs:attribute name="firstPass" type="xs:int" use="required"></xs:attribute>
<xs:attribute name="firstFail" type="xs:int" use="required"></xs:attribute>
<xs:attribute name="firstScrap" type="xs:int" use="required"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="FailureData">
<xs:attribute name="failureCauseCode" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="failureImageCode" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="failureTypeCode" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="quantityFailure" type="xs:int" use="required"></xs:attribute>
<xs:attribute name="quantityRepair" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,5 @@
Manifest-Version: 1.0
Built-By: frankp
Build-Jdk: 1.8.0_111
Created-By: Maven Integration for Eclipse

View File

@@ -0,0 +1,7 @@
#Generated by Maven Integration for Eclipse
#Tue Oct 13 14:05:18 CEST 2020
version=9.10.00beta-DEVELOPER
groupId=com.itac.interface.interfaces
m2e.projectName=data-interface-line-dashboard-plugin
m2e.projectLocation=C\:\\projects_jee\\imsinterface\\mainline\\interface\\linedashboard\\plugin
artifactId=data-interface-line-dashboard-plugin

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-line-dashboard-plugin</artifactId>
<packaging>jar</packaging>
<name>data-interface-line-dashboard-plugin</name>
<version>${mes.interface.version}</version>
<parent>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-line-dashboard</artifactId>
<version>${mes.interface.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.itac.product</groupId>
<artifactId>artes-common</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.linedashboard</groupId>
<artifactId>linedashboard-api</artifactId>
</dependency>
<dependency>
<groupId>com.itac.interface.interfaces</groupId>
<artifactId>data-interface-core-definition</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>create-project-bundle</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>zippackaging</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<classifier>zip</classifier>
<descriptors>
<descriptor>src/main/assembly/descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,5 @@
#Generated by Maven
#Tue Jun 12 15:10:56 CEST 2018
version=9.00.01alpha-DEVELOPER
groupId=com.itac.interface.interfaces
artifactId=data-interface-line-dashboard-plugin