initialize
This commit is contained in:
31
interface/asm/dotnet/Oib5xGUI/src/main/assembly/bin.xml
Normal file
31
interface/asm/dotnet/Oib5xGUI/src/main/assembly/bin.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<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>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/src</directory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/lib</directory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/OibAdapterUnitTests</directory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/Properties</directory>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/</directory>
|
||||
<includes>
|
||||
<include>*.ico</include>
|
||||
<include>*.csproj</include>
|
||||
<include>*.sln</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1,35 @@
|
||||
<assembly>
|
||||
<id>windows</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<files>
|
||||
<file>
|
||||
<!-- aus der app.config eine oib.adapter.config machen-->
|
||||
<source>${basedir}/src/main/resources/app.config</source>
|
||||
<destName>${binary.name}.config</destName>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${basedir}/src/main/resources/Readme.txt</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${basedir}/target</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<includes>
|
||||
<include>*.exe</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${basedir}/lib</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<includes>
|
||||
<include>*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1,155 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
using com.itac.oib.client.customextensions;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
/// <summary>
|
||||
/// Receiver class for the TraceService events
|
||||
/// </summary>
|
||||
public class BoardGateKeeperReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
OIBEventHandler _eventHandler;
|
||||
readonly OibClient.OibBoardGateKeeperEvents _oibBoardGateKeeperEvents;
|
||||
|
||||
public BoardGateKeeperReceiver(OibClient.OibBoardGateKeeperEvents oibBoardGateKeeperEvents,
|
||||
OIBEventHandler eventHandler)
|
||||
{
|
||||
if (oibBoardGateKeeperEvents == null) throw new ArgumentNullException("oibBoardGateKeeperEvents");
|
||||
if (eventHandler == null) throw new ArgumentNullException("eventHandler");
|
||||
|
||||
this._oibBoardGateKeeperEvents = oibBoardGateKeeperEvents;
|
||||
this._eventHandler = eventHandler;
|
||||
_oibBoardGateKeeperEvents.Ping = Ping;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibBoardGateKeeperEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibBoardGateKeeperEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
|
||||
bool Ping()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "BoardGateKeeperReceiver.Ping");
|
||||
return _eventHandler != null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibBoardGateKeeperEvents != null) { _oibBoardGateKeeperEvents.Dispose(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void virtualInkspotData(OibClient.CustomExtensions.VirtualInkspotHandlerBoardRequest virtualInkspotHandlerBoardRequest)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "BoardGateKeeperReceiver.VirtualInkspotData");
|
||||
if (_eventHandler != null)
|
||||
{
|
||||
|
||||
com.itac.oib.client.customextensions.VirtualInkspotHandlerBoardRequest virtInkspotBoardRequest = VirtualInkspotHandlerBoardRequestMapper.get(virtualInkspotHandlerBoardRequest);
|
||||
|
||||
com.itac.oib.boardgatekeeper.contracts.data.BoardRequestResult itacResult = _eventHandler.virtualInkspotBoardRequest(virtInkspotBoardRequest);
|
||||
|
||||
// itacResult ist null: call an das DataInterface schlug fehl
|
||||
if (itacResult == null)
|
||||
{
|
||||
// setzen default Fehlertext
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.Reason = "no results from iTAC.MES.Suite";
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.RequestResult = "Rejected";
|
||||
for (int i = 0; i < virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates.Length; i++)
|
||||
{
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates[i].Place = false;
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates[i].Reason = "no results from iTAC.MES.Suite";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Werte in die Rückgabe kopieren;
|
||||
/* virtualInkspotHandlerBoardRequest.BoardRequestResult.Reason = itacResult.getBoardRequestResult().reason;
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.RequestResult = itacResult.getBoardRequestResult().requestResult;
|
||||
if (itacResult.getBoardRequestResult().getVIHResult().getSubPanelStates() != null)
|
||||
{
|
||||
if (itacResult.getBoardRequestResult().getVIHResult().getSubPanelStates().Length == virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates.Length)
|
||||
{
|
||||
// subPanelStates kopieren
|
||||
for (int i = 0; i < itacResult.getBoardRequestResult().getVIHResult().getSubPanelStates().Length; i++)
|
||||
{
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates[i].Place = itacResult.getBoardRequestResult().getVIHResult().getSubPanelStates()[i].getPlace();
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates[i].Reason = itacResult.getBoardRequestResult().getVIHResult().getSubPanelStates()[i].getReason();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/ }
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Warning, "calling BoardGateKeeperReceiver.VirtualInkspotData not performed");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// der letzte Aufruf schlug fehl!!
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "calling BoardRequestResult in eventHandler failed", e);
|
||||
for (int i = 0; i < virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates.Length; i++)
|
||||
{
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates[i].Place = false;
|
||||
virtualInkspotHandlerBoardRequest.BoardRequestResult.VIHResult.SubPanelStates[i].Reason = e.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// called by incoming xml files
|
||||
public void virtualInkspotData(com.itac.oib.client.customextensions.VirtualInkspotHandlerBoardRequest requestData)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "BoardGateKeeperReceiver.VirtualInkspotData from xml-file");
|
||||
if (_eventHandler != null)
|
||||
{
|
||||
com.itac.oib.boardgatekeeper.contracts.data.BoardRequestResult itacResult = _eventHandler.virtualInkspotBoardRequest(requestData);
|
||||
// TODO: Rückgabe noch auswerten ?
|
||||
// requestData.setBoardRequestResult(itacResult);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Warning, "calling BoardGateKeeperReceiver.VirtualInkspotData not performed");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// der letzte Aufruf schlug fehl!!
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "calling BoardRequestResult in eventHandler failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Asm.As.Oib.Client.CustomExtensions;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using com.itac.oib.client.customextensions;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
/// <summary>
|
||||
/// Receiver class for the Changeover manager events
|
||||
/// </summary>
|
||||
public class ChangeoverReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
public OIBEventHandler _eventHandler { get; set; }
|
||||
private readonly ChangeoverManager _changeoverManager;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public ChangeoverReceiver(ChangeoverManager changeoverManager)
|
||||
{
|
||||
_changeoverManager = changeoverManager;
|
||||
_changeoverManager.LineChangeover += new Asm.As.Oib.Client.CustomExtensions.LineChangeoverEvent(ChangeoverManagerLineChangeover);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_changeoverManager != null)
|
||||
_changeoverManager.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
|
||||
public class LineChangeoverThread : ThreadTemplate<Asm.As.Oib.Client.CustomExtensions.LineChangeoverEventArgs>
|
||||
{
|
||||
public LineChangeoverThread(OIBEventHandler eventHandler, Asm.As.Oib.Client.CustomExtensions.LineChangeoverEventArgs request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = LineChangeoverEventArgsMapper.get(_request);
|
||||
getEventHandler().lineChangeoverEvent(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeoverManagerLineChangeover(object sender, Asm.As.Oib.Client.CustomExtensions.LineChangeoverEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, string.Format("Changeover completed for line '{0}'", args.Line.Name));
|
||||
// interessante Infos:
|
||||
// String conveyorModeString = args.Line.StationInLines[0].StationConveyorSystem.ConveyorMode.ToString();
|
||||
// com.itac.oib.client.customextensions.LineChangeoverEventArgs lineChangeoverEvent = LineChangeoverEventArgsMapper.get(args);
|
||||
// if (lineChangeoverEvent == null)
|
||||
// {
|
||||
// LogHandler.log(Constants.LOGGER, TraceEventType.Error, "LineChangeover not converted");
|
||||
// return;
|
||||
// }
|
||||
var mmt = new LineChangeoverThread(_eventHandler, args);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, string.Format("LineChangeover could not be pushed to java receiver"), e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal com.itac.oib.client.customextensions.LineChangeoverEventArgs getCurrentLineProductionData()
|
||||
{
|
||||
com.itac.oib.client.customextensions.LineChangeoverEventArgs lineChangeoverEvent = LineChangeoverEventArgsMapper.get(_changeoverManager.GetCurrentLineProductionData());
|
||||
if (lineChangeoverEvent == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "LineChangeover not converted");
|
||||
return null;
|
||||
}
|
||||
return lineChangeoverEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Asm.As.Oib.Client;
|
||||
using Asm.As.Oib.SiplaceSetupCenter.Contracts.Data;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
|
||||
// [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
|
||||
public class DekPrinterExternalControlReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly OibDekPrinterExtenalControlEvents _oibDekPrinterExternalControlEvents;
|
||||
public OIBEventHandler _eventHandler { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region constructor, event delegate assignment
|
||||
|
||||
public DekPrinterExternalControlReceiver(OibDekPrinterExtenalControlEvents oibSetupCenterExternalControlEvents)
|
||||
{
|
||||
_oibDekPrinterExternalControlEvents = oibSetupCenterExternalControlEvents;
|
||||
|
||||
oibSetupCenterExternalControlEvents.VerifyPrinterMaterial = VerifyPrinterMaterial;
|
||||
oibSetupCenterExternalControlEvents.VerifyPrinterTool = VerifyPrinterTool;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
public void Start()
|
||||
{
|
||||
_oibDekPrinterExternalControlEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibDekPrinterExternalControlEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public OIBEventHandler getEventHandler(Object request)
|
||||
{
|
||||
if (_eventHandler == null)
|
||||
{
|
||||
if (request == null) { throw new Exception("missing event handler to transport unknown message"); }
|
||||
throw new Exception("missing event handler to transport message of type " + request.GetType().Name);
|
||||
}
|
||||
return _eventHandler;
|
||||
}
|
||||
#region IDekPrinterCenterExternalControl Members
|
||||
|
||||
private void startCall(string method)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, String.Format("DekPrinterExternalControl.{0} called", method));
|
||||
}
|
||||
|
||||
public VerifyPrinterToolResponse VerifyPrinterTool(VerifyPrinterToolRequest request)
|
||||
{
|
||||
startCall("VerifyPrinterTool");
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.VerifyPrinterToolRequestMapper.get(request);
|
||||
VerifyPrinterToolResponse oibResult = null;
|
||||
try
|
||||
{
|
||||
var mesNamespaceConformResult = getEventHandler(request).verifyPrinterTool(mesNamespaceConformRequest);
|
||||
oibResult = com.itac.oib.siplacesetupcenter.contracts.data.VerifyPrinterToolResponseMapper.get(mesNamespaceConformResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "failed to process VerifyPrinterToolRequest", e);
|
||||
}
|
||||
|
||||
return oibResult;
|
||||
}
|
||||
|
||||
|
||||
public VerifyPrinterMaterialResponse VerifyPrinterMaterial(VerifyPrinterMaterialRequest request)
|
||||
{
|
||||
startCall("VerifyPrinterMaterial");
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.VerifyPrinterMaterialRequestMapper.get(request);
|
||||
VerifyPrinterMaterialResponse oibResult = null;
|
||||
try
|
||||
{
|
||||
var mesNamespaceConformResult = getEventHandler(request).verifyPrinterMaterial(mesNamespaceConformRequest);
|
||||
oibResult = com.itac.oib.siplacesetupcenter.contracts.data.VerifyPrinterMaterialResponseMapper.get(mesNamespaceConformResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "failed to process VerifyPrinterMaterialRequest", e);
|
||||
}
|
||||
|
||||
return oibResult;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibDekPrinterExternalControlEvents != null)
|
||||
_oibDekPrinterExternalControlEvents.Dispose();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Asm.As.Oib.Client.CustomExtensions;
|
||||
using Asm.As.Oib.DisplayService.Contracts.Messages;
|
||||
using Asm.As.Oib.DisplayService.Proxy.Architecture.Objects;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using com.itac.oib.client.customextensions;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
/// <summary>
|
||||
/// Receiver class for the Changeover manager events
|
||||
/// </summary>
|
||||
public class DisplayServiceReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
public OIBEventHandler _eventHandler { get; set; }
|
||||
private readonly DisplayServiceClient _displayServiceClient;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public DisplayServiceReceiver(DisplayServiceClient displayServiceClient)
|
||||
{
|
||||
_displayServiceClient = displayServiceClient;
|
||||
_displayServiceClient.ConfirmationReceived += confirmationReceived;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_displayServiceClient != null)
|
||||
_displayServiceClient.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
private void confirmationReceived(ConfirmationReceivedRequest confirmationReceivedRequest)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/*public class LineChangeoverThread : ThreadTemplate<Asm.As.Oib.Client.CustomExtensions.LineChangeoverEventArgs>
|
||||
{
|
||||
public LineChangeoverThread(OIBEventHandler eventHandler, Asm.As.Oib.Client.CustomExtensions.LineChangeoverEventArgs request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = LineChangeoverEventArgsMapper.get(_request);
|
||||
getEventHandler().lineChangeoverEvent(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeoverManagerLineChangeover(object sender, Asm.As.Oib.Client.CustomExtensions.LineChangeoverEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, string.Format("Changeover completed for line '{0}'", args.Line.Name));
|
||||
// interessante Infos:
|
||||
// String conveyorModeString = args.Line.StationInLines[0].StationConveyorSystem.ConveyorMode.ToString();
|
||||
// com.itac.oib.client.customextensions.LineChangeoverEventArgs lineChangeoverEvent = LineChangeoverEventArgsMapper.get(args);
|
||||
// if (lineChangeoverEvent == null)
|
||||
// {
|
||||
// LogHandler.log(Constants.LOGGER, TraceEventType.Error, "LineChangeover not converted");
|
||||
// return;
|
||||
// }
|
||||
var mmt = new LineChangeoverThread(_eventHandler, args);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, string.Format("LineChangeover could not be pushed to java receiver"), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal com.itac.oib.client.customextensions.LineChangeoverEventArgs getCurrentLineProductionData()
|
||||
{
|
||||
com.itac.oib.client.customextensions.LineChangeoverEventArgs lineChangeoverEvent = LineChangeoverEventArgsMapper.get(_displayServiceClient.GetCurrentLineProductionData());
|
||||
if (lineChangeoverEvent == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "LineChangeover not converted");
|
||||
return null;
|
||||
}
|
||||
return lineChangeoverEvent;
|
||||
}*/
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
using MesNamespace = com.itac.oib.linecontrol.contracts.data;
|
||||
using AsmNamespace = www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data;
|
||||
using www.siplace.com.OIB._2015._10.LineControlServer.Contracts.Data;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
/// <summary>
|
||||
/// Receiver class for the TraceService events
|
||||
/// </summary>
|
||||
public class LineControlMesInterceptorReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
OIBEventHandler _eventHandler;
|
||||
readonly OibClient.OibLineControlMesInterceptorEvents _oibLineControlMesInterceptorEvents;
|
||||
#endregion
|
||||
|
||||
#region construtor/destructor
|
||||
public LineControlMesInterceptorReceiver(OibClient.OibLineControlMesInterceptorEvents oibLineControlMesInterceptorEvents,
|
||||
OIBEventHandler eventHandler)
|
||||
{
|
||||
if (oibLineControlMesInterceptorEvents == null) throw new ArgumentNullException("oibLineControlMesInterceptorEvents");
|
||||
if (eventHandler == null) throw new ArgumentNullException("eventHandler");
|
||||
|
||||
this._oibLineControlMesInterceptorEvents = oibLineControlMesInterceptorEvents;
|
||||
this._eventHandler = eventHandler;
|
||||
_oibLineControlMesInterceptorEvents.Ping = Ping;
|
||||
_oibLineControlMesInterceptorEvents.VerifyPcbForAutoProgramDownload = VerifyPcbForAutoProgramDownload;
|
||||
_oibLineControlMesInterceptorEvents.VerifyRecipeActivationOnDekPrinter = VerifyRecipeActivationOnDekPrinter;
|
||||
_oibLineControlMesInterceptorEvents.VerifyRecipeDownload = VerifyRecipeDownload;
|
||||
_oibLineControlMesInterceptorEvents.VerifyRecipeForAutoProgramDownload = VerifyRecipeForAutoProgramDownload;
|
||||
_oibLineControlMesInterceptorEvents.VerifyStartAutoProgramDownload = VerifyStartAutoProgramDownload;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibLineControlMesInterceptorEvents != null) { _oibLineControlMesInterceptorEvents.Dispose(); }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibLineControlMesInterceptorEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibLineControlMesInterceptorEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
bool Ping()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "LineControlMesInterceptorReceiver.Ping");
|
||||
return _eventHandler != null;
|
||||
}
|
||||
|
||||
private MesVerificationResult VerifyRecipeForAutoProgramDownload(VerifyRecipeForAutoProgramDownloadRequest request)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "LineControlMesInterceptorReceiver VerifyRecipeForAutoProgramDownload called");
|
||||
// map value from asm namespace to mes namespace
|
||||
MesNamespace.VerifyRecipeForAutoProgramDownloadRequest report = MesNamespace.VerifyRecipeForAutoProgramDownloadRequestMapper.get(request);
|
||||
|
||||
// create return value
|
||||
AsmNamespace.MesVerificationResult asmResult = null;
|
||||
try
|
||||
{
|
||||
MesNamespace.MesVerificationResult mesResult = _eventHandler.verifyRecipeForAutoProgramDownload(report);
|
||||
asmResult = MesNamespace.MesVerificationResultMapper.get(mesResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
asmResult = getFailureResult(e);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "failed to process LineControlMesInterceptorReceiver.VerifyRecipeForAutoProgramDownload", e);
|
||||
}
|
||||
|
||||
return asmResult;
|
||||
}
|
||||
|
||||
private MesVerificationResult VerifyStartAutoProgramDownload(VerifyRecipeForAutoProgramDownloadRequest request)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "LineControlMesInterceptorReceiver VerifyStartAutoProgramDownload called");
|
||||
// map value from asm namespace to mes namespace
|
||||
MesNamespace.VerifyRecipeForAutoProgramDownloadRequest report = MesNamespace.VerifyRecipeForAutoProgramDownloadRequestMapper.get(request);
|
||||
AsmNamespace.MesVerificationResult asmResult = null;
|
||||
try
|
||||
{
|
||||
MesNamespace.MesVerificationResult mesResult = _eventHandler.verifyStartAutoProgramDownload(report);
|
||||
asmResult = MesNamespace.MesVerificationResultMapper.get(mesResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
asmResult = getFailureResult(e);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "failed to process LineControlMesInterceptorReceiver.VerifyStartAutoProgramDownload", e);
|
||||
}
|
||||
|
||||
return asmResult;
|
||||
}
|
||||
|
||||
private MesVerificationResult VerifyRecipeDownload(VerifyRecipeDownloadRequest request)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "LineControlMesInterceptorReceiver VerifyRecipeDownload called");
|
||||
// map value from asm namespace to mes namespace
|
||||
MesNamespace.VerifyRecipeDownloadRequest report = MesNamespace.VerifyRecipeDownloadRequestMapper.get(request);
|
||||
AsmNamespace.MesVerificationResult asmResult = null;
|
||||
try
|
||||
{
|
||||
MesNamespace.MesVerificationResult mesResult = _eventHandler.verifyRecipeDownload(report);
|
||||
asmResult = MesNamespace.MesVerificationResultMapper.get(mesResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
asmResult = getFailureResult(e);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "failed to process LineControlMesInterceptorReceiver.VerifyRecipeDownload", e);
|
||||
}
|
||||
|
||||
return asmResult;
|
||||
}
|
||||
|
||||
private MesVerificationResult VerifyRecipeActivationOnDekPrinter(VerifyRecipeActivationOnDekPrinterRequest request)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "LineControlMesInterceptorReceiver VerifyRecipeActivationOnDekPrinterRequest called");
|
||||
// map value from asm namespace to mes namespace
|
||||
MesNamespace.VerifyRecipeActivationOnDekPrinterRequest report = MesNamespace.VerifyRecipeActivationOnDekPrinterRequestMapper.get(request);
|
||||
AsmNamespace.MesVerificationResult asmResult = null;
|
||||
try
|
||||
{
|
||||
MesNamespace.MesVerificationResult mesResult = _eventHandler.verifyRecipeActivationOnDekPrinter(report);
|
||||
asmResult = MesNamespace.MesVerificationResultMapper.get(mesResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
asmResult = getFailureResult(e);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "failed to process LineControlMesInterceptorReceiver.VerifyRecipeActivationOnDekPrinterRequest", e);
|
||||
}
|
||||
|
||||
return asmResult;
|
||||
}
|
||||
|
||||
private MesVerificationResult VerifyPcbForAutoProgramDownload(VerifyPcbForAutoProgramDownloadRequest request)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "LineControlMesInterceptorReceiver VerifyPcbForAutoProgramDownloadRequest called");
|
||||
// map value from asm namespace to mes namespace
|
||||
MesNamespace.VerifyPcbForAutoProgramDownloadRequest report = MesNamespace.VerifyPcbForAutoProgramDownloadRequestMapper.get(request);
|
||||
AsmNamespace.MesVerificationResult asmResult = null;
|
||||
try
|
||||
{
|
||||
MesNamespace.MesVerificationResult mesResult = _eventHandler.verifyPcbForAutoProgramDownload(report);
|
||||
asmResult = MesNamespace.MesVerificationResultMapper.get(mesResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
asmResult = getFailureResult(e);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "failed to process LineControlMesInterceptorReceiver.VerifyPcbForAutoProgramDownloadRequest", e);
|
||||
}
|
||||
|
||||
return asmResult;
|
||||
}
|
||||
|
||||
private AsmNamespace.MesVerificationResult getFailureResult(Exception e)
|
||||
{
|
||||
MesVerificationResult result = new MesVerificationResult();
|
||||
result.VerificationResult = 2; // 0=OK, 1=Rejected, 2=Error
|
||||
result.Reason = e.Message;
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using Constants = com.itac.mes.proxy.Constants;
|
||||
using OibMonBizObj = Asm.As.Oib.Monitoring.Proxy.Business.EventArgs;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
using System.Configuration;
|
||||
using com.itac.oib.monitoring.contracts.data;
|
||||
using Asm.As.Oib.Monitoring.Proxy.Business.Objects;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
public class MonitoringReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
public OIBEventHandler _eventHandler { get; set; }
|
||||
private readonly String _lineFullPath;
|
||||
private readonly OibClient.OibMonitoringEvents _oibMonitoringEvents;
|
||||
private TimeSpan boardProcessedMaxAge = new TimeSpan(0, 0, 0);
|
||||
private TimeSpan stationEventMaxAge = new TimeSpan(0, 0, 0);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public MonitoringReceiver(OibClient.OibMonitoringEvents oibMonitoringEvents, string lineFullPath)
|
||||
{
|
||||
_oibMonitoringEvents = oibMonitoringEvents;
|
||||
_lineFullPath = lineFullPath;
|
||||
|
||||
oibMonitoringEvents.BoardProcessed += BoardProcessedEventReceived;
|
||||
oibMonitoringEvents.StationEvent += StationEventReceived;
|
||||
|
||||
try
|
||||
{
|
||||
String sMaxAge = (String)new AppSettingsReader().GetValue("BoardProcessedDataMaxAge", typeof(String));
|
||||
boardProcessedMaxAge = TimeSpan.Parse(sMaxAge);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
// default Wert 1 Stunde
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "configured Value for 'BoardProcessedDataMaxAge' is invalid, use default value");
|
||||
boardProcessedMaxAge = new TimeSpan(24, 0, 0);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
boardProcessedMaxAge = new TimeSpan(0, 0, 0);
|
||||
}
|
||||
if (boardProcessedMaxAge.Ticks > 0)
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "maximum age for BoardProcessedMessages = " + boardProcessedMaxAge.ToString());
|
||||
else
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "no maximum age for BoardProcessedMessages");
|
||||
try
|
||||
{
|
||||
String sMaxAge = (String)new AppSettingsReader().GetValue("StationEventMaxAge", typeof(String));
|
||||
stationEventMaxAge = TimeSpan.Parse(sMaxAge);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
// default Wert 1 Stunde
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "configured Value for 'StationEventMaxAge' is invalid, use default value");
|
||||
stationEventMaxAge = new TimeSpan(24, 0, 0);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
stationEventMaxAge = new TimeSpan(0, 0, 0);
|
||||
}
|
||||
if (stationEventMaxAge.Ticks > 0)
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "maximum age for StationEventMaxAge = " + stationEventMaxAge.ToString());
|
||||
else
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "no maximum age for StationEventMaxAge");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Start/Stopp
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibMonitoringEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibMonitoringEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
|
||||
#region Board Processed
|
||||
|
||||
public void BoardProcessedEventReceived(object sender, OibMonBizObj.BoardProcessedEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "BoardProcessedEventArgs");
|
||||
if (boardProcessedMaxAge.Ticks > 0)
|
||||
{
|
||||
Boolean skip = false;
|
||||
DateTime oldestDate = new DateTime(DateTime.Now.Ticks - boardProcessedMaxAge.Ticks).ToUniversalTime();
|
||||
foreach (Asm.As.Oib.Monitoring.Proxy.Business.Objects.ProcessedBoard processedBoard in args.BoardProcessedData.ProcessedBoards)
|
||||
{
|
||||
if (processedBoard.StationTime != null && processedBoard.StationTime.ToUniversalTime().Ticks < oldestDate.Ticks)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "found old BoardProcessedEvent from " + processedBoard.StationTime.ToUniversalTime().ToString() +
|
||||
", oldest message to be processed is " + oldestDate.ToString());
|
||||
skip = true;
|
||||
}
|
||||
}
|
||||
if (skip)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ignore BoardProcessedEvent because one of its " +
|
||||
"stationEvents is older than configured time " + boardProcessedMaxAge.ToString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
var mmt = new BoardProcessedThread(_eventHandler, args.BoardProcessedData);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "BoardProcessedEventArgs failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
private class BoardProcessedThread : ThreadTemplate<Asm.As.Oib.Monitoring.Proxy.Business.Objects.BoardProcessedData>
|
||||
{
|
||||
public BoardProcessedThread(OIBEventHandler eventHandler, Asm.As.Oib.Monitoring.Proxy.Business.Objects.BoardProcessedData request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.monitoring.contracts.data.BoardProcessedDataMapper.get(_request);
|
||||
getEventHandler().boardProcessedEventReceived(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Station Event
|
||||
|
||||
public void StationEventReceived(object sender, OibMonBizObj.StationEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "StationEventReceived");
|
||||
if (stationEventMaxAge.Ticks > 0)
|
||||
{
|
||||
DateTime oldestDate = new DateTime(DateTime.Now.Ticks - stationEventMaxAge.Ticks).ToUniversalTime();
|
||||
if (args.StationEventComposite != null && args.StationEventComposite.StationTime.ToUniversalTime().Ticks < oldestDate.Ticks)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "ignore StationEvent because its time '" +
|
||||
args.StationEventComposite.StationTime.ToUniversalTime() + "' is older than configured time " + stationEventMaxAge.ToString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var mmt = new StationEventThread(_eventHandler, args.StationEventComposite);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "StationEventArgs failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
public class StationEventThread : ThreadTemplate<Asm.As.Oib.Monitoring.Proxy.Business.Objects.StationEventComposite>
|
||||
{
|
||||
public StationEventThread(OIBEventHandler eventHandler, Asm.As.Oib.Monitoring.Proxy.Business.Objects.StationEventComposite request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.monitoring.contracts.data.StationEventCompositeMapper.get(_request);
|
||||
getEventHandler().stationEventReceived(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void MonitoringSubscriptionHealthStatus(object sender, OibClient.OibServiceStatusEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!e.SubscriptionCheckResult.Succeeded)
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, string.Format("OIB Monitoring Queue for line '{0}' cound not be checked.", _lineFullPath));
|
||||
else
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, string.Format("OIB Monitoring Queue for line '{0}' is in state '{1}' containing '{2}' messages.", _lineFullPath, e.SubscriptionCheckResult.QueueStatus, e.SubscriptionCheckResult.MessagesInQueue));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, string.Format("OIB Monitoring Queue for line '{0}' checked failed: '{1}'.", _lineFullPath, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibMonitoringEvents != null)
|
||||
_oibMonitoringEvents.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using com.itac.mes.proxy.business;
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
|
||||
public class ThreadTemplate<T>
|
||||
{
|
||||
protected readonly OIBEventHandler _eventHandler;
|
||||
protected readonly T _request;
|
||||
|
||||
public ThreadTemplate(OIBEventHandler eventHandler, T request)
|
||||
{
|
||||
_eventHandler = eventHandler;
|
||||
_request = request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the event handler. By calling a funcion at the eventHandler the object is serialized and transported to java receiver.
|
||||
/// </summary>
|
||||
/// <returns>The event handler instance</returns>
|
||||
/// <exception>An exception is thrown when the handler was not set to this instance of thread template</exception>
|
||||
public OIBEventHandler getEventHandler()
|
||||
{
|
||||
if (_eventHandler == null)
|
||||
{
|
||||
if (_request == null) { throw new Exception("missing event handler to transport unknown message"); }
|
||||
throw new Exception("missing event handler to transport message of type " + _request.GetType().Name);
|
||||
}
|
||||
return _eventHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Asm.As.Oib.SiplaceSetupCenter.Contracts.Data;
|
||||
using Asm.As.Oib.SiplaceSetupCenter.Contracts.Service;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
|
||||
// [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
|
||||
public class SetupCenterExternalControlReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly OibClient.OibSetupCenterExternalControlEvents _oibSetupCenterExternalControlEvents;
|
||||
public OIBEventHandler _eventHandler { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public SetupCenterExternalControlReceiver(OibClient.OibSetupCenterExternalControlEvents oibSetupCenterExternalControlEvents)
|
||||
{
|
||||
_oibSetupCenterExternalControlEvents = oibSetupCenterExternalControlEvents;
|
||||
oibSetupCenterExternalControlEvents.Ping = Ping;
|
||||
oibSetupCenterExternalControlEvents.GetNewPackagingUnitData = GetNewPackagingUnitData;
|
||||
oibSetupCenterExternalControlEvents.GetPackagingUnitControlStatus = GetPackagingUnitControlStatus;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibSetupCenterExternalControlEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibSetupCenterExternalControlEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISiplaceSetupCenterExternalControl Members
|
||||
|
||||
/// <summary>
|
||||
/// Check for the client if this service is available.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Ping()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "SetupCenterExternalControl.Ping");
|
||||
return _eventHandler != null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ExternalControlResult[] GetPackagingUnitControlStatus(PackagingUnitLocation[] packagingUnitLocations)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "ExternalControl GetPackagingUnitControlStatus called");
|
||||
com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitLocation[] report = com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitLocationMapper.getArray(packagingUnitLocations);
|
||||
Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ExternalControlResult[] oibResult = null;
|
||||
try
|
||||
{
|
||||
com.itac.oib.siplacesetupcenter.contracts.data.ExternalControlResult[] itacResult = _eventHandler.getPackagingUnitControlStatus(report);
|
||||
oibResult = com.itac.oib.siplacesetupcenter.contracts.data.ExternalControlResultMapper.get(itacResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "failed to process GetPackagingUnitControlStatus", e);
|
||||
}
|
||||
|
||||
asmHandler(ref packagingUnitLocations, ref oibResult);
|
||||
return oibResult;
|
||||
}
|
||||
|
||||
public void UpdateEmptyFields(List<PackagingUnitLocation> packagingUnitLocations, List<ExternalControlResult> result)
|
||||
{
|
||||
if (packagingUnitLocations == null || packagingUnitLocations.Count == 0)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "SetupCenterExternalControl.updateEmptyFields: packagingUnitLocations empty or null");
|
||||
return;
|
||||
}
|
||||
if (result == null || result.Count == 0)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "SetupCenterExternalControl.updateEmptyFields: result empty or null");
|
||||
return;
|
||||
}
|
||||
if (packagingUnitLocations.Count != result.Count)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "SetupCenterExternalControl.updateEmptyFields: packagingUnitLocations and result different size");
|
||||
return;
|
||||
}
|
||||
// über alle Items iterieren
|
||||
for (int i = 0; i < packagingUnitLocations.Count; i++)
|
||||
{
|
||||
UpdateEmptyFields(packagingUnitLocations[i], result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateEmptyFields(PackagingUnitLocation packagingUnitLocation, ExternalControlResult result)
|
||||
{
|
||||
if (packagingUnitLocation == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "SetupCenterExternalControl.updateEmptyFields: packagingUnitLocation is null");
|
||||
return;
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "SetupCenterExternalControl.updateEmptyFields: result is null");
|
||||
return;
|
||||
}
|
||||
// per reflection über alle Felder iterieren, dabei per Name vorgehen
|
||||
// deepCopy(packagingUnitLocation, result);
|
||||
// Console.WriteLine("");
|
||||
if (packagingUnitLocation.PackagingUnit.BatchPackagingUnit != null && result.PackagingUnit.BatchPackagingUnit == null)
|
||||
{
|
||||
result.PackagingUnit.BatchPackagingUnit = packagingUnitLocation.PackagingUnit.BatchPackagingUnit;
|
||||
}
|
||||
}
|
||||
|
||||
// muss noch weiter getestet werden...
|
||||
public void DeepCopy(object sourceObject, object destObject)
|
||||
{
|
||||
Type sourceType = sourceObject.GetType();
|
||||
Type destType = destObject.GetType();
|
||||
MemberInfo[] sourceMbrInfoArray = sourceType.GetMembers();
|
||||
MemberInfo[] destMbrInfoArray = destType.GetMembers();
|
||||
|
||||
foreach (MemberInfo sourceMbrInfo in sourceMbrInfoArray)
|
||||
{
|
||||
if (sourceMbrInfo.MemberType == MemberTypes.Property)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "" + sourceMbrInfo + " is a " + sourceMbrInfo.MemberType);
|
||||
// alle einfachen TypeNameConverter direkt prüfen (int, String, bool)
|
||||
// komplexe Typen ???
|
||||
|
||||
PropertyInfo sourcePropInfo = sourceType.GetProperty(sourceMbrInfo.Name);
|
||||
|
||||
// gibt es das Property auch im Zielobjekt
|
||||
foreach (MemberInfo destMbrInfo in destMbrInfoArray)
|
||||
{
|
||||
// identischer Name, identischerr Typ
|
||||
if (destMbrInfo.MemberType == sourceMbrInfo.MemberType && destMbrInfo.Name == sourceMbrInfo.Name)
|
||||
{
|
||||
PropertyInfo destPropInfo = destType.GetProperty(destMbrInfo.Name);
|
||||
object sourceValue = sourcePropInfo.GetValue(sourceObject, null);
|
||||
object destValue = destPropInfo.GetValue(destObject, null);
|
||||
if (sourcePropInfo.PropertyType == typeof(String) || sourcePropInfo.PropertyType == typeof(int)
|
||||
|| sourcePropInfo.PropertyType == typeof(Int32) || sourcePropInfo.PropertyType == typeof(Int64)
|
||||
|| sourcePropInfo.PropertyType == typeof(long) || sourcePropInfo.PropertyType == typeof(bool)
|
||||
|| sourcePropInfo.PropertyType == typeof(Boolean))
|
||||
{
|
||||
if (sourceValue != destValue)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "primitive type copy value");
|
||||
destPropInfo.SetValue(destObject, sourceValue, null);
|
||||
}
|
||||
}
|
||||
else if (!sourceType.IsArray)
|
||||
{
|
||||
// komplexer Typ, kein Array
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, sourceMbrInfo.Name + " is complex type ");
|
||||
if (sourceValue != null)
|
||||
{
|
||||
DeepCopy(sourceValue, destValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, sourceMbrInfo.Name + " is complex type, sourceValue is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void asmHandler(ref Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.PackagingUnitLocation[] packagingUnitLocations,
|
||||
ref Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ExternalControlResult[] result)
|
||||
{
|
||||
//
|
||||
// special ASM Handling:
|
||||
// simply return MSD Level and MSD Open Date as received in request
|
||||
|
||||
foreach (Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.PackagingUnitLocation item in packagingUnitLocations)
|
||||
{
|
||||
// find this container in result and copy the values
|
||||
foreach (Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.ExternalControlResult resultItem in result)
|
||||
{
|
||||
if (item.PackagingUnit.UID.Equals(resultItem.PackagingUnit.UID))
|
||||
{
|
||||
resultItem.PackagingUnit.MsdLevel = item.PackagingUnit.MsdLevel;
|
||||
resultItem.PackagingUnit.MsdOpenDate = item.PackagingUnit.MsdOpenDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ExternalControlResult[] GetNewPackagingUnitData(PackagingUnitLocation[] packagingUnitLocations)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "SetupCenterExternalControl.GetPackagingUnitControlStatus");
|
||||
try
|
||||
{
|
||||
// List<ExternalControlResult> result = _eventHandler.GetPackagingUnitControlStatus(packagingUnitLocations);
|
||||
|
||||
// hier müssen eigentliche alle Felder aus den quelldaten, die nicht in den Zieldaten enthalten sind per
|
||||
// Reflection übernommen werden, damit wir nie mehr irgend welche Werte verlieren
|
||||
// UpdateEmptyFields(packagingUnitLocations, result);
|
||||
// return result;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_eventHandler = null;
|
||||
// Fehler, keine weitere info vorhanden, da die Applikation nicht läuft
|
||||
}
|
||||
return new ExternalControlResult[0];
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibSetupCenterExternalControlEvents != null)
|
||||
_oibSetupCenterExternalControlEvents.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,513 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using System.Threading;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
using Asm.As.Oib.SiplaceSetupCenter.Contracts.Data;
|
||||
using Asm.As.Oib.SiplaceSetupCenter.Proxy.Business.Objects;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
public class SetupCenterReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
public OIBEventHandler _eventHandler { get; set; }
|
||||
private readonly String _lineFullPath;
|
||||
private readonly OibClient.OibSetupCenterEvents _oibSetupCenterEvents;
|
||||
private bool _isSetupStation;
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public SetupCenterReceiver(OibClient.OibSetupCenterEvents oibSetupCenterEvents, string lineFullPath, bool isSetupStation)
|
||||
{
|
||||
_oibSetupCenterEvents = oibSetupCenterEvents;
|
||||
_lineFullPath = lineFullPath;
|
||||
_isSetupStation = isSetupStation;
|
||||
|
||||
oibSetupCenterEvents.FeederPlaced += SetupCenterFeederPlaced;
|
||||
oibSetupCenterEvents.FeederRemoved += SetupCenterFeederRemoved;
|
||||
oibSetupCenterEvents.NewSetupActive += SetupCenterNewSetupActive;
|
||||
oibSetupCenterEvents.PackagingQuantityChanged += SetupCenterPackagingQuantityChanged;
|
||||
oibSetupCenterEvents.SetupChanged += SetupCenterSetupChanged;
|
||||
oibSetupCenterEvents.PackagingUnitConsumed += SetupCenterPackagingUnitConsumed;
|
||||
oibSetupCenterEvents.MaterialMoved += SetupCenterMaterialMoved;
|
||||
oibSetupCenterEvents.PrinterToolVerified += SetupCenterPrinterToolVerified;
|
||||
oibSetupCenterEvents.PrinterToolUnverified += SetupCenterPrinterToolUnVerified;
|
||||
oibSetupCenterEvents.PrinterCapabilitiesChanged += SetupCenterPrinterCapabilitiesChanged;
|
||||
oibSetupCenterEvents.PrinterConsumablesUpdated += SetupCenterPrinterConsumablesChanged;
|
||||
oibSetupCenterEvents.PrinterCoverClosed += SetupCenterPrintercoverClosed;
|
||||
oibSetupCenterEvents.PrinterCoverOpened += SetupCenterPrinterCoverOpened;
|
||||
oibSetupCenterEvents.PrinterMaterialUnverified += SetupCenterPrinterMaterialUnverified;
|
||||
oibSetupCenterEvents.PrinterMaterialVerified += SetupCenterPrinterMaterialVerified;
|
||||
oibSetupCenterEvents.PrinterRecipeVerified += SetupCenterPrinterRecipeVerified;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibSetupCenterEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibSetupCenterEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
private void startSetupcenterEvent(Object args)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, String.Format("SetupCenterReceiver.{0}", args.GetType().Name));
|
||||
}
|
||||
private void setupcenterEventFailed(Object args, Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, String.Format("calling SetupCenterNotifyReceiver.{0} failed", args.GetType().Name), e);
|
||||
}
|
||||
|
||||
void SetupCenterPackagingQuantityChanged(object sender, OibClient.PackagingQuantityChangedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PackagingQuantityChangedThread(_eventHandler, args.PackagingQuantityChangedReport);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupCenterFeederPlaced(object sender, OibClient.FeederPlacedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new FeederPlacedThread(_eventHandler, args.FeederPlacedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupCenterFeederRemoved(object sender, OibClient.FeederRemovedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new FeederRemovedThread(_eventHandler, args.FeederRemovedReport);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupCenterNewSetupActive(object sender, OibClient.NewSetupActiveEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new NewSetupActiveThread(_eventHandler, args.NewSetupActiveReport);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupCenterSetupChanged(object sender, OibClient.SetupChangedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new SetupChangedThread(_eventHandler, args.SetupChangedReport);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
void SetupCenterPackagingUnitConsumed(object sender, OibClient.PackagingUnitConsumedEventArgs args)
|
||||
{
|
||||
if (_isSetupStation)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "ignore PackagingUnitConsumed because in SetupStation mode");
|
||||
return;
|
||||
}
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PackagingUnitConsumedThread(_eventHandler, args.PackagingUnitConsumedReport);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterMaterialMoved(object sender, OibClient.MaterialMovedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new MaterialMovedThread(_eventHandler, args.MaterialMovedReport);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
#region PrinterFunctions Receiver
|
||||
public void SetupCenterPrinterToolVerified(object sender, OibClient.PrinterToolVerifiedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterToolVerifiedThread(_eventHandler, args.PrinterToolVerifiedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterRecipeVerified(object sender, OibClient.PrinterRecipeVerifiedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterRecipeVerifiedThread(_eventHandler, args.PrinterRecipeVerifiedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterMaterialVerified(object sender, OibClient.PrinterMaterialVerifiedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterMaterialVerifiedThread(_eventHandler, args.PrinterMaterialVerifiedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterMaterialUnverified(object sender, OibClient.PrinterMaterialUnverifiedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterMaterialUnverifiedThread(_eventHandler, args.PrinterMaterialUnverifiedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterCoverOpened(object sender, OibClient.PrinterCoverOpenedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterCoverOpenedThread(_eventHandler, args.PrinterCoverOpenedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrintercoverClosed(object sender, OibClient.PrinterCoverClosedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterCoverClosedThread(_eventHandler, args.PrinterCoverClosedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterConsumablesChanged(object sender, OibClient.PrinterConsumablesUpdatedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterConsumablesChangedThread(_eventHandler, args.PrinterConsumablesUpdatedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterCapabilitiesChanged(object sender, OibClient.PrinterCapabilitiesChangedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterCapabilitiesChangedThread(_eventHandler, args.PrinterCapabilitiesChangedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupCenterPrinterToolUnVerified(object sender, OibClient.PrinterToolUnverifiedEventArgs args)
|
||||
{
|
||||
startSetupcenterEvent(args);
|
||||
try
|
||||
{
|
||||
var mmt = new PrinterToolUnVerifiedThread(_eventHandler, args.PrinterToolUnverifiedReportRequest);
|
||||
var thread = new Thread(mmt.ThreadFunction);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
setupcenterEventFailed(args, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// Calls delegieren an die eigentliche Implementierung
|
||||
|
||||
public class FeederPlacedThread : ThreadTemplate<FeederPlacedReport>
|
||||
{
|
||||
public FeederPlacedThread(OIBEventHandler eventHandler, FeederPlacedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.FeederPlacedReportMapper.get(_request);
|
||||
getEventHandler().feederPlaced(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class FeederRemovedThread : ThreadTemplate<FeederRemovedReport>
|
||||
{
|
||||
public FeederRemovedThread(OIBEventHandler eventHandler, FeederRemovedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.FeederRemovedReportMapper.get(_request);
|
||||
getEventHandler().feederRemoved(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class NewSetupActiveThread : ThreadTemplate<NewSetupActiveReport>
|
||||
{
|
||||
public NewSetupActiveThread(OIBEventHandler eventHandler, NewSetupActiveReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.NewSetupActiveReportMapper.get(_request);
|
||||
getEventHandler().newSetupActive(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PackagingQuantityChangedThread : ThreadTemplate<PackagingQuantityChangedReport>
|
||||
{
|
||||
public PackagingQuantityChangedThread(OIBEventHandler eventHandler, PackagingQuantityChangedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PackagingQuantityChangedReportMapper.get(_request);
|
||||
getEventHandler().packagingQuantityChanged(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
public class SetupChangedThread : ThreadTemplate<SetupChangedReport>
|
||||
{
|
||||
public SetupChangedThread(OIBEventHandler eventHandler, SetupChangedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.SetupChangedReportMapper.get(_request);
|
||||
getEventHandler().setupChanged(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PackagingUnitConsumedThread : ThreadTemplate<PackagingUnitConsumedReport>
|
||||
{
|
||||
public PackagingUnitConsumedThread(OIBEventHandler eventHandler, PackagingUnitConsumedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitConsumedReportMapper.get(_request);
|
||||
getEventHandler().packagingUnitConsumed(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Calls delegieren an die eigentliche Implementierung
|
||||
|
||||
|
||||
public class MaterialMovedThread : ThreadTemplate<MaterialMovedReport>
|
||||
{
|
||||
public MaterialMovedThread(OIBEventHandler eventHandler, MaterialMovedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.MaterialMovedReportMapper.get(_request);
|
||||
getEventHandler().materialMoved(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterToolVerifiedThread : ThreadTemplate<PrinterToolVerifiedReport>
|
||||
{
|
||||
public PrinterToolVerifiedThread(OIBEventHandler eventHandler, PrinterToolVerifiedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterToolVerifiedReportMapper.get(_request);
|
||||
getEventHandler().printerToolVerified(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterMaterialVerifiedThread : ThreadTemplate<PrinterMaterialVerifiedReport>
|
||||
{
|
||||
public PrinterMaterialVerifiedThread(OIBEventHandler eventHandler, PrinterMaterialVerifiedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterMaterialVerifiedReportMapper.get(_request);
|
||||
getEventHandler().printerMaterialVerified(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterMaterialUnverifiedThread : ThreadTemplate<PrinterMaterialUnverifiedReport>
|
||||
{
|
||||
public PrinterMaterialUnverifiedThread(OIBEventHandler eventHandler, PrinterMaterialUnverifiedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterMaterialUnverifiedReportMapper.get(_request);
|
||||
getEventHandler().printerMaterialUnverified(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterCoverOpenedThread : ThreadTemplate<PrinterCoverOpenedReport>
|
||||
{
|
||||
public PrinterCoverOpenedThread(OIBEventHandler eventHandler, PrinterCoverOpenedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterCoverOpenedReportMapper.get(_request);
|
||||
getEventHandler().printerCoverOpened(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterCoverClosedThread : ThreadTemplate<PrinterCoverClosedReport>
|
||||
{
|
||||
public PrinterCoverClosedThread(OIBEventHandler eventHandler, PrinterCoverClosedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterCoverClosedReportMapper.get(_request);
|
||||
getEventHandler().printerCoverClosed(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterConsumablesChangedThread : ThreadTemplate<PrinterConsumablesUpdatedReport>
|
||||
{
|
||||
public PrinterConsumablesChangedThread(OIBEventHandler eventHandler, PrinterConsumablesUpdatedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterConsumablesUpdatedReportMapper.get(_request);
|
||||
getEventHandler().printerConsumablesUpdated(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterCapabilitiesChangedThread : ThreadTemplate<PrinterCapabilitiesChangedReport>
|
||||
{
|
||||
public PrinterCapabilitiesChangedThread(OIBEventHandler eventHandler, PrinterCapabilitiesChangedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterCapabilitiesChangedReportMapper.get(_request);
|
||||
getEventHandler().printerCapabilitiesChanged(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterToolUnVerifiedThread : ThreadTemplate<PrinterToolUnverifiedReport>
|
||||
{
|
||||
public PrinterToolUnVerifiedThread(OIBEventHandler eventHandler, PrinterToolUnverifiedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterToolUnverifiedReportMapper.get(_request);
|
||||
getEventHandler().printerToolUnverified(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public class PrinterRecipeVerifiedThread : ThreadTemplate<PrinterRecipeVerifiedReport>
|
||||
{
|
||||
public PrinterRecipeVerifiedThread(OIBEventHandler eventHandler, PrinterRecipeVerifiedReport request) : base(eventHandler, request) { }
|
||||
|
||||
public void ThreadFunction()
|
||||
{
|
||||
var mesNamespaceConformRequest = com.itac.oib.siplacesetupcenter.contracts.data.PrinterRecipeVerifiedReportMapper.get(_request);
|
||||
getEventHandler().printerRecipeVerified(mesNamespaceConformRequest);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibSetupCenterEvents != null)
|
||||
_oibSetupCenterEvents.Dispose();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
88
interface/asm/dotnet/Oib5xGUI/src/main/csharp/SpiReceiver.cs
Normal file
88
interface/asm/dotnet/Oib5xGUI/src/main/csharp/SpiReceiver.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Asm.As.Oib.Client;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
public class SpiReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly OIBEventHandler _eventHandler;
|
||||
private readonly OibSpiEvents _oibSpiEvents;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public SpiReceiver(OibSpiEvents oibSpiEvents, OIBEventHandler eventHandler)
|
||||
{
|
||||
_eventHandler = eventHandler;
|
||||
_oibSpiEvents = oibSpiEvents;
|
||||
|
||||
oibSpiEvents.RecipeSecifiedForStation += OibSpiEventsRecipeSecifiedForStation;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start/Stopp
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibSpiEvents.StartDownloadEvents();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibSpiEvents.StopDownloadEvents();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
|
||||
public void OibSpiEventsRecipeSecifiedForStation(object sender, Asm.As.Oib.Client.RecipeSecifiedForStationEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
com.itac.oib.linecontrol.data.DownloadData downloadData = new com.itac.oib.linecontrol.data.DownloadData();
|
||||
downloadData.strServiceComputer = "";
|
||||
downloadData.downloadTime = args.DownloadTime;
|
||||
downloadData.lineName = args.ProductionScheduleElement.Recipe.Setup.Line.FullPath;
|
||||
downloadData.stationName = args.StationIdentity.FullPath;
|
||||
downloadData.conveyorLanes = args.IsRightLane ? "Right" : "Left";
|
||||
downloadData.jobName = args.ProductionScheduleElement.OrderID;
|
||||
downloadData.recipeName = args.ProductionScheduleElement.Recipe.FullPath;
|
||||
downloadData.productionScheduleName = args.ProductionScheduleDisplayName;
|
||||
downloadData.productionScheduleElementId = args.ProductionScheduleElement.ID;
|
||||
downloadData.placementInfo = com.itac.oib.siplacepro.service.SiplacePro.GetPlacementForRecipe(args.ProductionScheduleElement.Recipe);
|
||||
_eventHandler.downloadEvent(downloadData);
|
||||
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "download Event received");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.WriteLine("Error processing SPI property changed event: " + ex.Message);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "Error processing SPI property changed event: ", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibSpiEvents != null)
|
||||
_oibSpiEvents.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Asm.As.Oib.Client.CustomExtensions;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using com.itac.oib.traceability.contracts.data;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
/// <summary>
|
||||
/// Receiver class for the TraceService events
|
||||
/// </summary>
|
||||
public class TraceabilityReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
OIBEventHandler _eventHandler;
|
||||
readonly OibClient.OibTraceabilityEvents _oibTraceabilityEvents;
|
||||
readonly OperatorNotificationManager _operatorNotificationManager;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public TraceabilityReceiver(OibClient.OibTraceabilityEvents oibTraceEvents, OIBEventHandler eventHandler, OperatorNotificationManager operatorNotificationManager)
|
||||
{
|
||||
if (oibTraceEvents == null) throw new ArgumentNullException("oibTraceEvents");
|
||||
if (eventHandler == null) throw new ArgumentNullException("eventHandler");
|
||||
if (operatorNotificationManager == null) throw new ArgumentNullException("operatorNotificationManager");
|
||||
|
||||
_oibTraceabilityEvents = oibTraceEvents;
|
||||
_eventHandler = eventHandler;
|
||||
_operatorNotificationManager = operatorNotificationManager;
|
||||
|
||||
oibTraceEvents.TraceabilityData = TraceDataReceived;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start/Stop
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_oibTraceabilityEvents.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_oibTraceabilityEvents.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handling of events
|
||||
|
||||
|
||||
public www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.BoardProducedResponse TraceDataReceived(www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.TraceabilityData traceabilityData)
|
||||
{
|
||||
www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.BoardProducedResponse response = new www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.BoardProducedResponse ();
|
||||
try
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "ITraceabilityOibService.NewTraceabilityData");
|
||||
if (_eventHandler != null)
|
||||
{
|
||||
|
||||
TraceabilityData itacTraceData = TraceabilityDataMapper.get(traceabilityData);
|
||||
BoardProducedResponse result = _eventHandler.boardProduced(itacTraceData);
|
||||
if (result.BoardValidationResult == 2)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "received the RC_TRCDATA_REJECTED return code");
|
||||
try
|
||||
{
|
||||
_operatorNotificationManager.TraceDataRejected("Die letzte Station wurde gestoppt, da iTac die Tracedaten als fehlerhaft erkannt hat.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "calling OperatorNotificationManager failed", ex);
|
||||
}
|
||||
}
|
||||
else if (result.BoardValidationReason.StartsWith("RC_TRCDATA_REJECTED:"))
|
||||
{
|
||||
string message = result.BoardValidationReason.Replace("RC_TRCDATA_REJECTED:", "");
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "received the RC_TRCDATA_REJECTED return code with additional l message text " + message);
|
||||
try
|
||||
{
|
||||
_operatorNotificationManager.TraceDataRejected(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "calling OperatorNotificationManager failed", ex);
|
||||
}
|
||||
}
|
||||
response.BoardValidationResult = 2;
|
||||
return response;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Warning, "calling ITraceabilityOibService.NewTraceabilityData not performed");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// der letzte Aufruf schlug fehl!!
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "calling NewTraceabilityData in eventHandler failed", e);
|
||||
}
|
||||
response.BoardValidationResult = 1;
|
||||
return response;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposeable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_oibTraceabilityEvents != null)
|
||||
_oibTraceabilityEvents.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
public interface IReceiver
|
||||
{
|
||||
void Start();
|
||||
|
||||
void Stop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
using com.itac.oib;
|
||||
using com.itac.oib.boardgatekeeper.service;
|
||||
using com.itac.oib.displayservice.service;
|
||||
using com.itac.oib.linecontrol.service;
|
||||
using com.itac.oib.monitoring.service;
|
||||
using com.itac.oib.siplacesetupcenter.service;
|
||||
using com.itac.oib.traceability.service;
|
||||
|
||||
namespace com.itac.mes.domain
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Defines all events, that will sent from siplace machine
|
||||
/// </summary>
|
||||
public interface OIBEvents : ISiplaceSetupCenterNotify, ITraceability, ISetupCenterExternalControl, IMonitoringReceiver,
|
||||
IDisplayServiceCallback, ILineControlReceiver, IAdapterNotify, IChangeoverManager, IBoardGateKeeper, IDekPrinterExternalControl, ILineControlMesInterceptor
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using com.itac.oib;
|
||||
using com.itac.oib.displayservice.service;
|
||||
using com.itac.oib.linecontrol.service;
|
||||
using com.itac.oib.siplacepro.service;
|
||||
using com.itac.oib.siplacesetupcenter.service;
|
||||
|
||||
namespace com.itac.mes.domain
|
||||
{
|
||||
|
||||
public interface OIBService : ISiplaceSetupCenter, IAdapterControl, ILineControl, ISiplacePro, IDisplayService
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace com.itac.mes.proxy
|
||||
{
|
||||
public class Constants
|
||||
{
|
||||
public const String SERVICE_NAME = "iTAC OIB Proxy";
|
||||
public const String SERVICE_DESC = "iTAC OIB Proxy";
|
||||
|
||||
public const String EVENT_TYPE = "Application";
|
||||
|
||||
public const String LOGGER = "iTAC-OIB";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
|
||||
namespace com.itac.mes.proxy
|
||||
{
|
||||
public class LogHandler
|
||||
{
|
||||
private static Object lockObject = new Object();
|
||||
|
||||
protected static readonly ILog logger = LogManager.GetLogger(Constants.LOGGER);
|
||||
private static TraceSource ts = new TraceSource(Constants.SERVICE_NAME, SourceLevels.All);
|
||||
|
||||
static LogHandler()
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
}
|
||||
|
||||
public static void addListener(TraceListener listener)
|
||||
{
|
||||
ts.Listeners.Add(listener);
|
||||
}
|
||||
|
||||
public static void log(String loggerName, TraceEventType level, String message)
|
||||
{
|
||||
log(loggerName, level, message, null);
|
||||
}
|
||||
|
||||
public static void log(String loggerName, TraceEventType level, String message, Exception e)
|
||||
{
|
||||
// alles wird geloggt, aber nur Error und Fatal an die TraceSource weiter gereicht
|
||||
try
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case TraceEventType.Critical: ts.TraceEvent(level, 10, message);
|
||||
ts.Flush();
|
||||
logger.Fatal(message, e);
|
||||
break;
|
||||
case TraceEventType.Error: ts.TraceEvent(level, 10, message);
|
||||
ts.Flush();
|
||||
logger.Error(message, e);
|
||||
break;
|
||||
case TraceEventType.Information:
|
||||
logger.Info(message, e);
|
||||
break;
|
||||
case TraceEventType.Verbose:
|
||||
logger.Debug(message, e);
|
||||
break;
|
||||
case TraceEventType.Warning:
|
||||
logger.Warn(message, e);
|
||||
break;
|
||||
default: logger.Info(message, e);
|
||||
ts.TraceEvent(level, 10, message);
|
||||
ts.Flush();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ThreadInterruptedException) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,698 @@
|
||||
#region Namespace
|
||||
using Asm.As.Oib.Client;
|
||||
using Asm.As.Oib.SiplacePro.LineControl.Contracts;
|
||||
using Asm.As.Oib.SiplacePro.Proxy.Architecture.Objects;
|
||||
using com.itac.mes.domain;
|
||||
using com.itac.oib;
|
||||
using com.itac.oib.displayservice.contracts.data;
|
||||
using com.itac.oib.linecontrol.contracts.data;
|
||||
using com.itac.oib.siplacesetupcenter.contracts.data;
|
||||
using com.itac.oib.siplacepro.service;
|
||||
using com.itac.oib.siplacepro.contracts.data;
|
||||
using Itac.Oib;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using LcTypes = Asm.As.Oib.SiplacePro.LineControl.Contracts;
|
||||
using OibSpiTyp = Asm.As.Oib.SiplacePro.Proxy.Types;
|
||||
using Asm.As.Oib.Client.CustomExtensions;
|
||||
using com.itac.oib.client.customextensions;
|
||||
using com.itac.oib.traceability.contracts.data;
|
||||
using com.itac.oib.linecontrol.data;
|
||||
using System.Collections.Generic;
|
||||
using Asm.As.Oib.DisplayService.Contracts.Messages;
|
||||
#endregion
|
||||
|
||||
namespace com.itac.mes.proxy.business
|
||||
{
|
||||
public class OIBServiceImpl : OIBService, IDisposable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private IAdapterControl _adapterControl;
|
||||
private readonly MessageWriter _messageWriter;
|
||||
public ChangeoverReceiver ChangeoverReceiver { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public OIBServiceImpl(IAdapterControl adapterControl, MessageWriter messageWriter)
|
||||
{
|
||||
_adapterControl = adapterControl;
|
||||
_messageWriter = messageWriter;
|
||||
}
|
||||
|
||||
public OibSetupCenterAccess OibSetupCenterAccess { get; set; }
|
||||
public OibLineControlAccess OibLineControlAccess { get; set; }
|
||||
public SiplacePro SiplacePro { set; get; }
|
||||
public OibDisplayServiceAccess DisplayServiceAccess { get; set; }
|
||||
public string configuredLineFullPath { get; set; }
|
||||
public string firstMachineInLine { get; set; }
|
||||
public string lastMachineInLine { get; set; }
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
internal void SetAdapterControl(IAdapterControl adapterControl)
|
||||
{
|
||||
_adapterControl = adapterControl;
|
||||
}
|
||||
|
||||
#region ISiplaceSetupCenter Member
|
||||
|
||||
public void set(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitLocation[] packagingUnitLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.Set(PackagingUnitLocationMapper.get(packagingUnitLocations));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Class OIBServiceImpl, Call ISiplaceSetupCenter.Set failed: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void refill(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitLocation[] packagingUnitLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.Refill(PackagingUnitLocationMapper.get(packagingUnitLocations));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Class OIBServiceImpl, Call ISiplaceSetupCenter.Refill failed: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void tearDown(string strSetup, com.itac.oib.siplacesetupcenter.contracts.data.ComponentLocation[] componentLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.TearDown(strSetup, ComponentLocationMapper.get(componentLocations));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Class OIBServiceImpl, Call ISiplaceSetupCenter.TearDown failed: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public com.itac.oib.siplacesetupcenter.contracts.data.MachineSetup getReducedActualSetup(string machineId)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SetupCenter.GetReducedActualSetup(machineId=" + machineId + ")");
|
||||
try
|
||||
{
|
||||
Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.MachineSetup oibMachineSetup = OibSetupCenterAccess.GetReducedActualSetup(machineId);
|
||||
if (oibMachineSetup == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to SetupCenter.GetReducedActualSetup returned null");
|
||||
return null;
|
||||
}
|
||||
MachineSetup machineSetup = MachineSetupMapper.get(oibMachineSetup);
|
||||
Evaluate(machineSetup);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to SetupCenter.GetReducedActualSetup returned");
|
||||
return machineSetup;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to SetupCenter.GetReducedActualSetup failed", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public PackagingUnitResult[] update(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnit[] packagingUnits)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PackagingUnitResultMapper.getArray(OibSetupCenterAccess.Get(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitMapper.get(packagingUnits)));
|
||||
}
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
|
||||
public PackagingUnitResult[] get(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnit[] packagingUnits)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PackagingUnitResultMapper.getArray(OibSetupCenterAccess.Get(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitMapper.get(packagingUnits)));
|
||||
}
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
|
||||
public com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitResult[] create(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnit[] packagingUnits)
|
||||
{
|
||||
try { return PackagingUnitResultMapper.getArray(OibSetupCenterAccess.Get(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitMapper.get(packagingUnits))); }
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
|
||||
public PackagingUnitResult[] delete(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnit[] packagingUnits)
|
||||
{
|
||||
return PackagingUnitResultMapper.getArray(OibSetupCenterAccess.Get(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitMapper.get(packagingUnits)));
|
||||
}
|
||||
|
||||
public void activate(ComponentLocation[] componentLocations)
|
||||
{
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.Activate(ComponentLocationMapper.get(componentLocations));
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
public void deactivate(com.itac.oib.siplacesetupcenter.contracts.data.ComponentLocation[] componentLocations, string reason)
|
||||
{
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.Deactivate(ComponentLocationMapper.get(componentLocations), reason);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
public void lockUids(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnit[] puIDs, string reason)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SetupCenter.Lock(reason=" + reason + ")");
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.Lock(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitMapper.get(puIDs), reason);
|
||||
Evaluate(puIDs);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to SetupCenter.Lock returned");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to SetupCenter.Lock failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void unlockUids(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnit[] puIDs)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SetupCenter.Unlock");
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.Unlock(com.itac.oib.siplacesetupcenter.contracts.data.PackagingUnitMapper.get(puIDs));
|
||||
Evaluate(puIDs);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to SetupCenter.Unlock returned");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to SetupCenter.Unlock failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
public Configuration getConfiguration()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SetupCenter.GetConfiguration");
|
||||
try
|
||||
{
|
||||
var configuration = ConfigurationMapper.get(OibSetupCenterAccess.GetConfiguration());
|
||||
Evaluate(configuration);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to SetupCenter.GetConfiguration returned");
|
||||
|
||||
return configuration;
|
||||
}
|
||||
catch
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to SetupCenter.GetConfiguration failed");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool isConnected()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OibSetupCenterAccess.IsConnected();
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
public void setMessageLevel(int messageLevel)
|
||||
{
|
||||
try
|
||||
{
|
||||
OibSetupCenterAccess.SetMessageLevel(messageLevel);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public string getDatabaseName()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OibSetupCenterAccess.GetDatabaseName();
|
||||
}
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ILineControl Member
|
||||
|
||||
public string getDatabaseId()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.getDatabaseId");
|
||||
try
|
||||
{
|
||||
String result = OibLineControlAccess.LineControlSession.DatabaseId;
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.getDatabaseId returned " + result);
|
||||
return result;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.getDatabaseId failed, return false ", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string getAdapterTimeZone()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OibLineControlAccess.LineControlSession.GetAdapterTimeZone();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.getAdapterTimeZone failed, return empty string ", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// full path required (including folders)
|
||||
/// </summary>
|
||||
/// <param name="lineName"></param>
|
||||
/// <returns></returns>
|
||||
public bool stopLine(string lineName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.StopLine(" + lineName + ")");
|
||||
try
|
||||
{
|
||||
bool b = OibLineControlAccess.LineControlSession.StopLine(lineName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.StopLine returned " + b);
|
||||
return b;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.StopLine failed, return false ", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool stopLineConveyor(string lineName, int nLanes)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.StopLineConveyor(" + lineName + "," + nLanes + ")");
|
||||
try
|
||||
{
|
||||
var oibLanes = (LcTypes.ConveyorLanes)Enum.ToObject(typeof(LcTypes.ConveyorLanes), nLanes);
|
||||
bool b = OibLineControlAccess.LineControlSession.StopLineConveyor(lineName, oibLanes);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.StopLineConveyor returned " + b);
|
||||
return b;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.StopLineConveyor failed, return false", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool continueLine(string lineName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.ContinueLine(" + lineName + ")");
|
||||
try
|
||||
{
|
||||
bool b = OibLineControlAccess.LineControlSession.ContinueLine(lineName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.ContinueLine returned " + b);
|
||||
return b;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.ContinueLine failed, return false", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool continueLineConveyor(string lineName, int nLanes)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.ContinueLineConveyor(" + lineName + "," + nLanes + ")");
|
||||
try
|
||||
{
|
||||
var oibLanes = (LcTypes.ConveyorLanes)Enum.ToObject(typeof(LcTypes.ConveyorLanes), nLanes);
|
||||
bool b = OibLineControlAccess.LineControlSession.ContinueLineConveyor(lineName, oibLanes);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.ContinueLineConveyor returned " + b);
|
||||
return b;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.ContinueLineConveyor failed, return false", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool blockStationInputConveyor(string station, bool bLock, string strBlockingApplicationName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.BlockStationInputConveyor(" + station + "," + bLock + ", " + strBlockingApplicationName + ")");
|
||||
try
|
||||
{
|
||||
bool b = OibLineControlAccess.LineControlSession.BlockStationInputConveyor(station, bLock, strBlockingApplicationName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.BlockStationInputConveyor returned " + b);
|
||||
return b;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.BlockStationInputConveyor failed, return false", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool unBlockStationInputConveyor(string station, string strUnblockingApplicationName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.UnBlockStationInputConveyor(" + station + ", " + strUnblockingApplicationName + ")");
|
||||
try
|
||||
{
|
||||
bool b = OibLineControlAccess.LineControlSession.UnBlockStationInputConveyor(station, strUnblockingApplicationName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.UnBlockStationInputConveyor returned " + b);
|
||||
return b;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.UnBlockStationInputConveyor failed, return false", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public string getActiveProductionSchedule(string lineName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.GetActiveProductionSchedule(" + lineName + ")");
|
||||
String result = null;
|
||||
try
|
||||
{
|
||||
result = OibLineControlAccess.LineControlSession.GetActiveProductionSchedule(lineName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.GetActiveProductionSchedule(" + lineName + ") returned " + result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.GetActiveProductionSchedule failed", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public LineControlLineStatus getLineStatus(string lineName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.GetLineStatus(" + lineName + ")");
|
||||
LineControlLineStatus result = null;
|
||||
try
|
||||
{
|
||||
result = LineControlLineStatusMapper.get(OibLineControlAccess.LineControlSession.GetLineStatus(lineName));
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to LineControl.GetLineStatus(" + lineName + ") returned ");
|
||||
Evaluate(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, ".NET call to LineControl.GetLineStatus failed", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public StartJobResult startPlacementRecipe(string productionSchedule, string jobName, int conveyor)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to LineControl.startPlacementRecipe(schedule=" + productionSchedule + ", job=" + jobName + ", conveyor=" + conveyor + ")");
|
||||
|
||||
StartJobResult startJobResult = new StartJobResult();
|
||||
try
|
||||
{
|
||||
// evtl. ist productionSchedule leer, dann den aktuellen Schedule der Linie nehmen
|
||||
LcTypes.ConveyorLanes lcLane = (LcTypes.ConveyorLanes)conveyor;
|
||||
|
||||
// Get the SIPLACE Pro session for the SPI adapter on the local host
|
||||
Session session = SiplacePro.oibSpiAccess.Session;
|
||||
|
||||
// Get the line the production schedule will be for.
|
||||
Object line = session.GetObject(configuredLineFullPath, OibSpiTyp.ObjectServerType.Line);
|
||||
if (line == null)
|
||||
{
|
||||
startJobResult.errorText = string.Format("Line '{0}' does not exist in SIPLACE Pro.", configuredLineFullPath);
|
||||
startJobResult.result = false;
|
||||
return startJobResult;
|
||||
}
|
||||
|
||||
if (productionSchedule.Equals("") || productionSchedule.Equals("*"))
|
||||
{
|
||||
// automatic resolving of current production schedule
|
||||
productionSchedule = OibLineControlAccess.LineControlSession.GetActiveProductionSchedule(configuredLineFullPath);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "automatic resolved ProductionSchedule is " + productionSchedule);
|
||||
}
|
||||
|
||||
Asm.As.Oib.SiplacePro.Proxy.Business.Objects.ProductionSchedule prodSched = session.GetObject(productionSchedule, OibSpiTyp.ObjectServerType.ProductionSchedule) as Asm.As.Oib.SiplacePro.Proxy.Business.Objects.ProductionSchedule;
|
||||
if (prodSched == null)
|
||||
{
|
||||
startJobResult.errorText = string.Format("ProductionSchedule '{0}' not found in SIPLACE Pro.", productionSchedule);
|
||||
startJobResult.result = false;
|
||||
return startJobResult;
|
||||
}
|
||||
bool found = false;
|
||||
Asm.As.Oib.SiplacePro.Proxy.Business.Objects.ProductionScheduleElement productionScheduleElement = null;
|
||||
foreach (Asm.As.Oib.SiplacePro.Proxy.Business.Objects.ProductionScheduleElement prodSchedElem in prodSched.ProductionScheduleElements.Values)
|
||||
{
|
||||
if (prodSchedElem.Recipe.Name.Equals(jobName) || prodSchedElem.Recipe.FullPath.Equals(jobName))
|
||||
{
|
||||
found = true;
|
||||
productionScheduleElement = prodSchedElem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
startJobResult.errorText = string.Format("Job {0} not found in ProductionSchedule '{1}'.", jobName, productionSchedule);
|
||||
startJobResult.result = false;
|
||||
return startJobResult;
|
||||
}
|
||||
|
||||
Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.DownloadResult result = OibLineControlAccess.LineControlSession.DownloadIC(
|
||||
prodSched.FullPath, //Name of the production schedule
|
||||
prodSched.ProductionScheduleElements.IndexOf(productionScheduleElement), //Zero based index of the ProductionScheduleElement
|
||||
"", // ProductionScheduleElement ID, if this is empty, Index will be used
|
||||
lcLane,//
|
||||
LcTypes.IntegrityCheckMode.AllowHeadstepRecalcuation,
|
||||
LcTypes.IntegrityCheckModeForRepartitioning.AvoidRepartitioning,
|
||||
LcTypes.DownloadProcessingOptions.AutoWidthAdjust | LcTypes.DownloadProcessingOptions.OverwriteFeederSettings)
|
||||
as Asm.As.Oib.SiplacePro.LineControl.Contracts.Data.DownloadResult;
|
||||
startJobResult.result = result.Succeeded;
|
||||
startJobResult.errorText = result.DetailedResults.ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
startJobResult.errorText = e.Message;
|
||||
startJobResult.result = false;
|
||||
return startJobResult;
|
||||
}
|
||||
Evaluate(startJobResult);
|
||||
return startJobResult;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IAdapterControl Member
|
||||
|
||||
public void startSetupCenterNotifyReceiver()
|
||||
{
|
||||
if (_adapterControl != null) { _adapterControl.startSetupCenterNotifyReceiver(); }
|
||||
}
|
||||
|
||||
public void stopSetupCenterNotifyReceiver()
|
||||
{
|
||||
if (_adapterControl != null) { _adapterControl.stopSetupCenterNotifyReceiver(); }
|
||||
}
|
||||
|
||||
public void startMonitoringReceiver()
|
||||
{
|
||||
_adapterControl.startMonitoringReceiver();
|
||||
}
|
||||
|
||||
public void stopMonitoringReceiver()
|
||||
{
|
||||
_adapterControl.stopMonitoringReceiver();
|
||||
}
|
||||
|
||||
public bool ping()
|
||||
{
|
||||
return _adapterControl.ping();
|
||||
}
|
||||
|
||||
public bool isSetupStation()
|
||||
{
|
||||
return _adapterControl.isSetupStation();
|
||||
}
|
||||
|
||||
public void setInterfaceHost(int port, string ipAddress, string canonicalHostName, string hostName)
|
||||
{
|
||||
_adapterControl.setInterfaceHost(port, ipAddress, canonicalHostName, hostName);
|
||||
}
|
||||
|
||||
public void setChannelName(string channelName)
|
||||
{
|
||||
_adapterControl.setChannelName(channelName);
|
||||
}
|
||||
|
||||
public void startTraceReceiver()
|
||||
{
|
||||
_adapterControl.startTraceReceiver();
|
||||
}
|
||||
|
||||
public void stopTraceReceiver()
|
||||
{
|
||||
_adapterControl.stopTraceReceiver();
|
||||
}
|
||||
|
||||
public void startBoardGateKeeper()
|
||||
{
|
||||
_adapterControl.startBoardGateKeeper();
|
||||
}
|
||||
|
||||
public void stopBoardGateKeeper()
|
||||
{
|
||||
_adapterControl.stopBoardGateKeeper();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISiplacePro Member
|
||||
|
||||
public BoardCheckInRequest completeCheckinData(BoardCheckInRequest checkinData)
|
||||
{
|
||||
return SiplacePro.completeCheckinData(checkinData);
|
||||
}
|
||||
|
||||
public BoardElement[] getPlacementForBoard(String boardFullName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SiplacePro.getPlacementForBoard(" + boardFullName + ")");
|
||||
BoardElement[] placeInfo = null;
|
||||
try
|
||||
{
|
||||
placeInfo = SiplacePro.getPlacementForBoard(boardFullName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call to SiplacePro.getPlacementForBoard(" + boardFullName + ") returned ");
|
||||
Evaluate(placeInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "java call to SiplacePro.getPlacementForBoard failed", e);
|
||||
}
|
||||
return placeInfo;
|
||||
}
|
||||
|
||||
// beim starten des interface ermittelt sich das Interface darueber einmalig den Status und die Rüstng der Linie, und
|
||||
// kann damit die Rüstung neu aufbauen
|
||||
oib.client.customextensions.LineChangeoverEventArgs ISiplacePro.getCurrentLineProductionData()
|
||||
{
|
||||
if (ChangeoverReceiver == null) { return null; }
|
||||
return ChangeoverReceiver.getCurrentLineProductionData();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logging Utils
|
||||
|
||||
private void Evaluate(Object arg)
|
||||
{
|
||||
if (_messageWriter != null)
|
||||
{
|
||||
_messageWriter.output(arg);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (OibLineControlAccess != null)
|
||||
OibLineControlAccess.Dispose();
|
||||
if (OibSetupCenterAccess != null)
|
||||
OibSetupCenterAccess.Dispose();
|
||||
if (OibLineControlAccess != null)
|
||||
OibLineControlAccess.Dispose();
|
||||
if (OibLineControlAccess != null)
|
||||
OibLineControlAccess.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void sendMessageByLinePathAllStations(string linePath, string messageText, string extendedDescription, AcknowledgementType acknowledgementType,
|
||||
bool callbackRequest, SeverityLevel severityLevel)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SendMessageByLinePathAllStations");
|
||||
// wenn default-Wert (*) dann den konfigurierten Wert für die Linie benutzen
|
||||
if (linePath == null || linePath.Length == 0 || linePath.Equals("*"))
|
||||
{
|
||||
linePath = configuredLineFullPath;
|
||||
}
|
||||
try
|
||||
{
|
||||
Asm.As.Oib.DisplayService.Proxy.Architecture.Objects.DisplayServiceClient displaySession = DisplayServiceAccess.DisplayServiceSession;
|
||||
Asm.As.Oib.DisplayService.Contracts.Data.Types.AcknowledgementType ackType = AcknowledgementTypeMapper.get(acknowledgementType);
|
||||
Asm.As.Oib.DisplayService.Contracts.Data.Types.SeverityLevel severity = SeverityLevelMapper.get(severityLevel);
|
||||
Asm.As.Oib.DisplayService.Contracts.Messages.SendMessageResponse sendMessageResponse = displaySession.
|
||||
SendMessageByLinePathAllStations(linePath, messageText, extendedDescription, ackType, callbackRequest, 0, severity, null, null);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SendMessageByStationPath finished");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "java call to SendMessageByStationPath finished", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessageByLinePathFirstStation(string linePath, string messageText, string extendedDescription, AcknowledgementType acknowledgementType,
|
||||
bool callbackRequest, SeverityLevel severityLevel)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SendMessageByLinePathFirstStation");
|
||||
if (linePath.Equals("*"))
|
||||
{
|
||||
linePath = configuredLineFullPath;
|
||||
}
|
||||
try
|
||||
{
|
||||
Asm.As.Oib.DisplayService.Proxy.Architecture.Objects.DisplayServiceClient displaySession = DisplayServiceAccess.DisplayServiceSession;
|
||||
Asm.As.Oib.DisplayService.Contracts.Data.Types.AcknowledgementType ackType = AcknowledgementTypeMapper.get(acknowledgementType);
|
||||
Asm.As.Oib.DisplayService.Contracts.Data.Types.SeverityLevel severity = SeverityLevelMapper.get(severityLevel);
|
||||
Asm.As.Oib.DisplayService.Contracts.Messages.SendMessageResponse sendMessageResponse = displaySession.
|
||||
SendMessageByLinePathFirstStation(linePath, messageText, extendedDescription, ackType, callbackRequest, 0, severity, null, null);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SendMessageByLinePathFirstStation finished");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "java call to SendMessageByLinePathFirstStation finished", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessageByStationPath(string stationPath, string messageText, string extendedDescription, AcknowledgementType acknowledgementType,
|
||||
bool callbackRequest, SeverityLevel severityLevel, Answer[] answerList)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SendMessageByStationPath");
|
||||
if (stationPath.Equals("*"))
|
||||
{
|
||||
stationPath = firstMachineInLine;
|
||||
}
|
||||
else if (stationPath.Equals("#"))
|
||||
{
|
||||
stationPath = lastMachineInLine;
|
||||
}
|
||||
try
|
||||
{
|
||||
Asm.As.Oib.DisplayService.Proxy.Architecture.Objects.DisplayServiceClient displaySession = DisplayServiceAccess.DisplayServiceSession;
|
||||
|
||||
Asm.As.Oib.DisplayService.Contracts.Data.Types.AcknowledgementType ackType = AcknowledgementTypeMapper.get(acknowledgementType);
|
||||
Asm.As.Oib.DisplayService.Contracts.Data.Types.SeverityLevel severity = SeverityLevelMapper.get(severityLevel);
|
||||
|
||||
List<Asm.As.Oib.DisplayService.Contracts.Data.Answer> asmAnswerList = new List<Asm.As.Oib.DisplayService.Contracts.Data.Answer>();
|
||||
|
||||
Asm.As.Oib.DisplayService.Contracts.Messages.SendMessageResponse sendMessageResponse = displaySession.
|
||||
SendMessageByStationPath(stationPath, messageText, extendedDescription, ackType, callbackRequest, 0, severity, asmAnswerList, null);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "java call to SendMessageByStationPath finished with failure");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "java call to SendMessageByStationPath finished", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Runtime.Remoting.Proxies;
|
||||
using System.Threading;
|
||||
using com.itac.artes.ihap;
|
||||
using com.itac.mes.domain;
|
||||
|
||||
|
||||
// Handler der das callen von Methoden des DataInterface aus dem iTAC.OIB.Adapter übernimmt
|
||||
namespace com.itac.mes.proxy.sockets
|
||||
{
|
||||
|
||||
public delegate void PropertyChangeListener(object sender, string channelName, string message);
|
||||
|
||||
|
||||
public class IhapEventChannel : RealProxy
|
||||
{
|
||||
|
||||
private static int CONNECTION_CHECK_MILLIES = 500;
|
||||
|
||||
private TcpClient _client;
|
||||
private IhapOutputStream _ios;
|
||||
private IhapInputStream _iis;
|
||||
private bool _isShutdown;
|
||||
public string channelName { get; set; }
|
||||
private long lastCall = DateTime.Now.Ticks;
|
||||
private Object lockObject = new Object();
|
||||
private Thread aliveThread;
|
||||
|
||||
public event PropertyChangeListener connectionStateChangeListener;
|
||||
|
||||
public IhapEventChannel(TcpClient client, String channelName)
|
||||
: base(typeof(OIBEvents))
|
||||
{
|
||||
lock (typeof(IhapHandler))
|
||||
{
|
||||
}
|
||||
this.channelName = channelName;
|
||||
this._client = client;
|
||||
_ios = new IhapOutputStream(_client.GetStream());
|
||||
_iis = new IhapInputStream(_client.GetStream());
|
||||
|
||||
aliveThread = new Thread(new ThreadStart(aliveThreadRun));
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "closing channel" + channelName);
|
||||
_isShutdown = true;
|
||||
try
|
||||
{
|
||||
_client.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Warning, "closing channel" + channelName + " failed");
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastCall()
|
||||
{
|
||||
return lastCall;
|
||||
}
|
||||
|
||||
public bool isConnected()
|
||||
{
|
||||
return _client.Client.Connected;
|
||||
}
|
||||
|
||||
public bool isShutdownInProgress()
|
||||
{
|
||||
return _isShutdown;
|
||||
}
|
||||
|
||||
public override IMessage Invoke(IMessage message)
|
||||
{
|
||||
lastCall = new DateTime().Ticks;
|
||||
IMethodCallMessage methodMsg = (IMethodCallMessage)message;
|
||||
try
|
||||
{
|
||||
MethodInfo methodInfo = typeof(OIBEvents).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
|
||||
Type[] interfaces = typeof(OIBEvents).GetInterfaces();
|
||||
foreach (Type t in interfaces)
|
||||
{
|
||||
methodInfo = t.GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
if (methodInfo != null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, String.Format("found method {0} in interface {1}", methodInfo.Name, t.Name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
throw new Exception("IHapEventChannel: methode '" + methodMsg.MethodName + "' not found in any of the interfaces");
|
||||
}
|
||||
|
||||
object[] args = methodMsg.Args;
|
||||
if (methodMsg.MethodName.Equals("Equals"))
|
||||
{
|
||||
return new ReturnMessage(args[0].Equals(this), args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
else if (methodMsg.MethodName.Equals("GetHashCode"))
|
||||
{
|
||||
return new ReturnMessage(this.GetHashCode(), args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
else if (methodMsg.MethodName.Equals("shutdown"))
|
||||
{
|
||||
shutdown();
|
||||
stopAliveThread();
|
||||
connectionClosed();
|
||||
return new ReturnMessage(null, args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
else if (methodMsg.MethodName.Equals("startup"))
|
||||
{
|
||||
aliveThread.Start();
|
||||
return new ReturnMessage(null, args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
Object retValue = sendCall(methodInfo, args);
|
||||
return new ReturnMessage(retValue, args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
catch (TargetInvocationException ite)
|
||||
{
|
||||
return new ReturnMessage(ite.GetBaseException(), methodMsg);
|
||||
}
|
||||
catch (Exception ite)
|
||||
{
|
||||
return new ReturnMessage(ite.GetBaseException(), methodMsg);
|
||||
}
|
||||
}
|
||||
|
||||
private Object sendCall(MethodInfo method, Object[] args)
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "Send event '" + method.Name + "' to socket " + _client.Client.RemoteEndPoint + " on " + channelName);
|
||||
Object result = null;
|
||||
try
|
||||
{
|
||||
_ios.writeBoolean(false);
|
||||
_ios.call(method, args);
|
||||
_ios.Flush();
|
||||
IhapReply reply = _iis.readReply();
|
||||
if (reply is IhapSuccessReply)
|
||||
{
|
||||
result = ((IhapSuccessReply)reply).getReturnValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
IhapFaultReply fault = (IhapFaultReply)reply;
|
||||
switch (fault.getFaultCode())
|
||||
{
|
||||
case FaultCode.NoSuchMethodException:
|
||||
throw new NotImplementedException(fault.getMessage());
|
||||
case FaultCode.ProtocolException:
|
||||
throw new IhapProtocolException(fault.getMessage(), null);
|
||||
default:
|
||||
throw new IhapProtocolException(fault.getMessage(), null);
|
||||
//(Exception)fault.getException();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "Error while sending event call on " + channelName + ":" + e.Message + "\n" + e.StackTrace);
|
||||
shutdown();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void connectionClosed()
|
||||
{
|
||||
// Hier wird überprüft, ob ein Eintrag in der Aufruf-Liste vorhanden ist.
|
||||
if (this.connectionStateChangeListener != null)
|
||||
{
|
||||
// Hier wird jeder Delegat, der sich für den Event registriert hat, aufgerufen.
|
||||
this.connectionStateChangeListener(this, channelName, "connectionClosed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void stopAliveThread()
|
||||
{
|
||||
if (aliveThread.IsAlive && (aliveThread.ThreadState != System.Threading.ThreadState.Running))
|
||||
{
|
||||
aliveThread.Interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void aliveThreadRun()
|
||||
{
|
||||
while (!_isShutdown && aliveThread.ThreadState == System.Threading.ThreadState.Running)
|
||||
{
|
||||
// wenn der letzte Call länger als .. her ist...
|
||||
try
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// wenn beim schliessen der Verbindung noch was passiert ist das nicht schlimm
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "interrupted for " + channelName);
|
||||
}
|
||||
if (DateTime.Now.Ticks - lastCall > CONNECTION_CHECK_MILLIES)
|
||||
{
|
||||
try
|
||||
{
|
||||
// versuchen den Server zu pingen
|
||||
// wenn das fehlschlägt ist die Verbindung kaputt
|
||||
lock (lockObject)
|
||||
{ // das erfolgreiche Schreiben eines booleschen Wertes ist aus Kommunikationssicht zu sehen wie der
|
||||
// erfolgreiche Aufruf einer Methode
|
||||
if (!_isShutdown && (aliveThread.ThreadState == System.Threading.ThreadState.Running))
|
||||
{
|
||||
// nur wenn die Verbindung nicht bereits gestoppt wurde...
|
||||
_ios.writeBoolean(true);
|
||||
_ios.Flush();
|
||||
lastCall = DateTime.Now.Ticks;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
_isShutdown = true;
|
||||
_client.Close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// wenn beim schliessen der Verbindung noch was passiert ist das nicht schlimm
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "shutdown connection problem for " + channelName, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// die Schreibverbindung ist kaputt, also diese Connection töten...
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "detected broken connection for " + channelName
|
||||
+ " because Server closed port");
|
||||
connectionClosed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// wenn beim schliessen der Verbindung noch was passiert ist das nicht schlimm
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "channel shut down finished for " + channelName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Runtime.Remoting.Proxies;
|
||||
using System.Threading;
|
||||
using com.itac.artes.ihap;
|
||||
using com.itac.artes.ihap.serialize;
|
||||
using com.itac.mes.domain;
|
||||
using com.itac.mes.proxy.business;
|
||||
using com.itac.oib;
|
||||
using com.itac.oib.boardgatekeeper.service;
|
||||
using com.itac.oib.linecontrol.service;
|
||||
using com.itac.oib.monitoring.service;
|
||||
using com.itac.oib.siplacesetupcenter.service;
|
||||
using com.itac.oib.traceability.service;
|
||||
|
||||
namespace com.itac.mes.proxy.sockets
|
||||
{
|
||||
|
||||
public delegate void ClientDisconnectedHandler(IhapHandler handler);
|
||||
|
||||
public class IhapHandler : RealProxy
|
||||
{
|
||||
private static IDictionary<String, MethodInfo> _methodMap;
|
||||
private static int handlerCounter;
|
||||
|
||||
private Object lockObject = new Object();
|
||||
|
||||
private int handlerNr;
|
||||
private TcpClient _client;
|
||||
private IhapOutputStream _ios;
|
||||
private IhapInputStream _iis;
|
||||
private OIBServiceImpl _serviceImpl;
|
||||
private bool _isShutdown;
|
||||
private long lastCall = DateTime.Now.Ticks;
|
||||
|
||||
|
||||
public IhapHandler(TcpClient client, OIBServiceImpl oibServiceImpl)
|
||||
: base(typeof(OIBEvents))
|
||||
{
|
||||
lock (typeof(IhapHandler))
|
||||
{
|
||||
handlerCounter++;
|
||||
this.handlerNr = handlerCounter;
|
||||
}
|
||||
this._client = client;
|
||||
this._serviceImpl = oibServiceImpl;
|
||||
|
||||
// damit zum testen callbacks aufgerufen werden koennen
|
||||
initMethodMap();
|
||||
Thread thread = new Thread(new ThreadStart(Run));
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
public event ClientDisconnectedHandler ClientDisconnected;
|
||||
|
||||
private static void initMethodMap()
|
||||
{
|
||||
if (_methodMap != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_methodMap = new Dictionary<String, MethodInfo>();
|
||||
ProtocolMapping protocolMapping = new ProtocolMapping_v1();
|
||||
MethodInfo[] methods = typeof(OIBService).GetMethods();
|
||||
foreach (MethodInfo method in methods)
|
||||
{
|
||||
_methodMap.Add(protocolMapping.getOverloadMethodName(method), method);
|
||||
}
|
||||
|
||||
// Alle Methoden aller implmentierten Interface eintragen...
|
||||
Type[] array = typeof(OIBService).GetInterfaces();
|
||||
foreach (Type innerType in array)
|
||||
{
|
||||
methods = innerType.GetMethods();
|
||||
foreach (MethodInfo method in methods)
|
||||
{
|
||||
_methodMap.Add(protocolMapping.getOverloadMethodName(method), method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
_isShutdown = true;
|
||||
try
|
||||
{
|
||||
_serviceImpl.Shutdown();
|
||||
_client.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastCall()
|
||||
{
|
||||
return lastCall;
|
||||
}
|
||||
|
||||
public bool isConnected()
|
||||
{
|
||||
return _client.Client.Connected;
|
||||
}
|
||||
|
||||
public string getName()
|
||||
{
|
||||
return "IhapHandler" + handlerNr;
|
||||
}
|
||||
|
||||
public bool isShutdownInProgress()
|
||||
{
|
||||
return _isShutdown;
|
||||
}
|
||||
|
||||
public override IMessage Invoke(IMessage message)
|
||||
{
|
||||
lastCall = new DateTime().Ticks;
|
||||
IMethodCallMessage methodMsg = (IMethodCallMessage)message;
|
||||
try
|
||||
{
|
||||
MethodInfo methodInfo = typeof(OIBEvents).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
// der Reihe nach alle Interface durchgehen, die als Callback implementiert sind
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(ISiplaceSetupCenterNotify).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(ITraceability).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(ISetupCenterExternalControl).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(IMonitoringReceiver).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(ILineControlReceiver).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(IAdapterNotify).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(IBoardGateKeeper).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = typeof(IDekPrinterExternalControl).GetMethod(methodMsg.MethodName);
|
||||
methodInfo = typeof(IDekPrinterExternalControl).GetMethod(methodMsg.MethodName, (Type[])methodMsg.MethodSignature);
|
||||
}
|
||||
|
||||
|
||||
if (methodInfo == null)
|
||||
{
|
||||
throw new Exception("IHapHandler.cs: methode nicht in den Interfacen gefunden");
|
||||
}
|
||||
|
||||
object[] args = methodMsg.Args;
|
||||
if (methodMsg.MethodName.Equals("Equals"))
|
||||
{
|
||||
return new ReturnMessage(args[0].Equals(this), args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
else if (methodMsg.MethodName.Equals("GetHashCode"))
|
||||
{
|
||||
return new ReturnMessage(this.GetHashCode(), args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
Object retValue = sendCall(methodInfo, args);
|
||||
return new ReturnMessage(retValue, args, 0, methodMsg.LogicalCallContext, methodMsg);
|
||||
}
|
||||
catch (TargetInvocationException ite)
|
||||
{
|
||||
return new ReturnMessage(ite.GetBaseException(), methodMsg);
|
||||
}
|
||||
catch (Exception ite)
|
||||
{
|
||||
return new ReturnMessage(ite.GetBaseException(), methodMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
Thread.CurrentThread.Name = "IhapHandler-" + handlerNr;
|
||||
_ios = new IhapOutputStream(_client.GetStream());
|
||||
_iis = new IhapInputStream(_client.GetStream());
|
||||
try
|
||||
{
|
||||
while (!_isShutdown && isConnected())
|
||||
{
|
||||
receiveCall();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void receiveCall()
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
try
|
||||
{
|
||||
Exception fault = null;
|
||||
Object returnValue = null;
|
||||
String methodName = null;
|
||||
try
|
||||
{
|
||||
if (!_iis.readBoolean())
|
||||
{
|
||||
IhapCall lCall = _iis.readCall();
|
||||
methodName = lCall.getOverloadMethodName();
|
||||
if (_methodMap.ContainsKey(methodName))
|
||||
{
|
||||
MethodInfo lMethod = _methodMap[methodName];
|
||||
Object[] args = lCall.getArgs();
|
||||
returnValue = lMethod.Invoke(_serviceImpl, args);
|
||||
lastCall = DateTime.Now.Ticks;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//ping...
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (IhapProtocolException pe)
|
||||
{
|
||||
if (pe.Message.EndsWith("end of file"))
|
||||
{
|
||||
throw pe;
|
||||
}
|
||||
fault = new ArtesRemoteException("Unable to read client request on " + getName(), pe);
|
||||
_ios.writeFaultReply(FaultCode.ProtocolException, fault);
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
fault = new ArtesRemoteException("Unknown method '" + methodName + "'");
|
||||
_ios.writeFaultReply(FaultCode.NoSuchMethodException, fault);
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
throw ioe;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e is TargetInvocationException)
|
||||
{
|
||||
e = ((TargetInvocationException)e).InnerException;
|
||||
}
|
||||
fault = e;
|
||||
_ios.writeFaultReply(FaultCode.ServiceException, fault);
|
||||
}
|
||||
if (fault == null)
|
||||
{
|
||||
_ios.writeSuccessReply(returnValue);
|
||||
}
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
if (ioe.Message.EndsWith("end of file"))
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Socket " + _client.Client.RemoteEndPoint + " disconnected for " + getName());
|
||||
ClientDisconnected(this);
|
||||
shutdown();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "Error receiving call for " + getName() + ":" + ioe.Message);
|
||||
ClientDisconnected(this);
|
||||
}
|
||||
throw ioe;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
_ios.Flush();
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Object sendCall(MethodInfo method, Object[] args)
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "Send event '" + method.Name + "' to socket " + _client.Client.RemoteEndPoint + " for " + getName());
|
||||
Object result = null;
|
||||
try
|
||||
{
|
||||
_ios.writeBoolean(false);
|
||||
_ios.call(method, args);
|
||||
_ios.Flush();
|
||||
IhapReply reply = _iis.readReply();
|
||||
if (reply is IhapSuccessReply)
|
||||
{
|
||||
result = ((IhapSuccessReply)reply).getReturnValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
IhapFaultReply fault = (IhapFaultReply)reply;
|
||||
switch (fault.getFaultCode())
|
||||
{
|
||||
case FaultCode.NoSuchMethodException:
|
||||
throw new NotImplementedException(fault.getMessage());
|
||||
case FaultCode.ProtocolException:
|
||||
throw new IhapProtocolException(fault.getMessage(), null);
|
||||
default:
|
||||
throw new IhapProtocolException(fault.getMessage(), null); // (Exception)fault.getException();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "Error while sending event call for " + getName() + " . " + e.Message + "\n" + e.StackTrace);
|
||||
shutdown();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public void setAdapterControl(IAdapterControl adapterControl)
|
||||
{
|
||||
_serviceImpl.SetAdapterControl(adapterControl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
#region Namespace
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
|
||||
using com.itac.mes.proxy.business;
|
||||
using com.itac.oib;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace com.itac.mes.proxy.sockets
|
||||
{
|
||||
|
||||
public class SocketAdapter
|
||||
{
|
||||
|
||||
private readonly IList<IhapHandler> _channels = new List<IhapHandler>();
|
||||
private readonly TcpListener _listener;
|
||||
|
||||
private readonly IAdapterControl _adapterControl;
|
||||
private readonly OIBServiceImpl _serviceImpl;
|
||||
|
||||
private bool _isShutdown = false;
|
||||
|
||||
// Wenn ein IHapHandler ein Disconnect feststellt wird eine Verbindung entfernt...
|
||||
public void ClientDisconnected(IhapHandler iHapHandler)
|
||||
{
|
||||
// remove handler with disconnected sockets
|
||||
for (int i = _channels.Count - 1; i >= 0; i--)
|
||||
{
|
||||
IhapHandler element = _channels[i];
|
||||
if (element == iHapHandler)
|
||||
{
|
||||
_channels[i].shutdown();
|
||||
_channels.RemoveAt(i);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Remove socket connection.");
|
||||
}
|
||||
}
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "Nr of active connections: " + _channels.Count);
|
||||
}
|
||||
|
||||
public SocketAdapter(int listeningPort, IAdapterControl adapterControl, OIBServiceImpl serviceImpl)
|
||||
{
|
||||
_listener = new TcpListener(IPAddress.Any, listeningPort);
|
||||
_listener.Start();
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Listen on port " + listeningPort);
|
||||
_adapterControl = adapterControl;
|
||||
_serviceImpl = serviceImpl;
|
||||
|
||||
var thread = new Thread(Run);
|
||||
thread.Start();
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Startup " + Constants.SERVICE_NAME + " finished.");
|
||||
|
||||
//
|
||||
// neuen Thread aufmachen, der immer wieder nachguckt, wie oft die IHapHandler benutzt werden. und unbenutzte Verbindungen entfernt
|
||||
var checkAliveThread = new Thread(RunCheckAlive);
|
||||
checkAliveThread.Start();
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
Thread.CurrentThread.Name = "SocketAdapter";
|
||||
while (!_isShutdown)
|
||||
{
|
||||
TcpClient client;
|
||||
try
|
||||
{
|
||||
client = _listener.AcceptTcpClient();
|
||||
}
|
||||
catch (SocketException se)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Critical, "Accepting new socket connection failed", se);
|
||||
continue;
|
||||
}
|
||||
var handler = new IhapHandler(client, _serviceImpl);
|
||||
handler.setAdapterControl(_adapterControl);
|
||||
|
||||
handler.ClientDisconnected += ClientDisconnected;
|
||||
|
||||
_channels.Add(handler);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Incoming socket connection from " + client.Client.RemoteEndPoint);
|
||||
}
|
||||
}
|
||||
|
||||
public void RunCheckAlive()
|
||||
{
|
||||
Thread.CurrentThread.Name = "CheckAliveThread";
|
||||
while (!_isShutdown)
|
||||
{
|
||||
bool removed = false;
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "registered incoming socket connections: " + _channels.Count);
|
||||
try
|
||||
{
|
||||
for (int i = _channels.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var channel = _channels[i];
|
||||
if (!channel.isConnected())
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "remove disconnected incoming socket connection for " + channel.getName());
|
||||
_channels.Remove(channel);
|
||||
removed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "" + channel.getName() + " channel last used: " + new DateTime(channel.getLastCall()));
|
||||
if ((channel.getLastCall() + 36001000L) < DateTime.Now.Ticks) // eine Stunde...
|
||||
{
|
||||
// Verbindung schliessen, wenn Sie länger als ... nicht benutzt wurde
|
||||
// channel.shutdown();
|
||||
}
|
||||
}
|
||||
if (removed)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "remaining open incoming socket connections after cleanup: " + _channels.Count);
|
||||
}
|
||||
}
|
||||
catch (Exception )
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "service channel listing interrupted");
|
||||
}
|
||||
|
||||
// LG: Why this??
|
||||
Thread.Sleep(60000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
_isShutdown = true;
|
||||
try
|
||||
{
|
||||
_listener.Stop();
|
||||
foreach (var channel in _channels)
|
||||
{
|
||||
if (channel.isConnected())
|
||||
{
|
||||
channel.shutdown();
|
||||
}
|
||||
}
|
||||
_channels.Clear();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "Listen port closed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
#region Namespace
|
||||
using Asm.As.Oib.Client;
|
||||
using com.itac.mes.domain;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.sockets;
|
||||
using Itac.Oib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace com.itac.oib
|
||||
{
|
||||
// remote-Methoden zum steuern der einzelnen Teile der Anwendung
|
||||
public class AdapterControl : IAdapterControl, IDisposable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
// Zugriff auf die folgenden Maps muss synchronisiert erfolgen
|
||||
static readonly object _locker = new object();
|
||||
// In dieser Map sind alle offenen Verbindungen zum DataInterface enthalten
|
||||
private Dictionary<String, IhapEventChannel> openClientChannels = new Dictionary<String, IhapEventChannel>();
|
||||
// pro Verbindung wird gez?hlt wie viele Connections es schon gab...
|
||||
private Dictionary<String, Int32> channelNameCounter = new Dictionary<String, Int32>();
|
||||
|
||||
// Verbindungsparameter zum DataInterface. Diese werden nach dem Start des DataInterface an den Adapter ?bertragen
|
||||
private int _port = 0;
|
||||
private string _ipAddress = "";
|
||||
private string _hostName = "";
|
||||
private string _canonicalHostName = "";
|
||||
|
||||
// die folgenden Werte werden beim Initialisieren des iTAC.OIB.Adapter gesetzt
|
||||
private int _own_itac_oib_adapter_port = 0;
|
||||
private string _own_ip_address = "";
|
||||
private string _own_host_name = "";
|
||||
private string _own_canonical_host_name = "";
|
||||
|
||||
#endregion
|
||||
|
||||
// die eigentlichen OIB-Event-Receiver
|
||||
public SetupCenterReceiver SetupCenterReceiver { set; get; }
|
||||
public SetupCenterExternalControlReceiver SetupCenterExternalControlReceiver { set; get; }
|
||||
public MonitoringReceiver MonitoringReceiver { set; get; }
|
||||
public TraceabilityReceiver TraceReceiver { set; get; }
|
||||
public SpiReceiver SpiReceiver { get; set; }
|
||||
public ChangeoverReceiver ChangeoverReceiver { get; set; }
|
||||
public OibClient OibClient { get; set; }
|
||||
public BoardGateKeeperReceiver BoardGateKeeperReceiver { set; get; }
|
||||
|
||||
public bool _isSetupStation;
|
||||
public List<KeyValue> productVersions { get; set; }
|
||||
|
||||
public AdapterControl()
|
||||
{
|
||||
var config = new AppSettingsReader();
|
||||
try
|
||||
{
|
||||
// Der Port an dem der Adapter auf eingehende Verbindungen des iTAC DataInterface lauscht
|
||||
_own_itac_oib_adapter_port = (int)config.GetValue("ListenPort", typeof(int));
|
||||
_own_host_name = Environment.MachineName;
|
||||
var hostInfo = Dns.GetHostEntry(_own_host_name);
|
||||
_own_canonical_host_name = hostInfo.HostName;
|
||||
var addresslist = Dns.GetHostAddresses(_own_host_name);
|
||||
// die eigene IP-Adresse raussuchen
|
||||
var theaddress = addresslist[0];
|
||||
// jetzt versuchen eine gueltige V4 Adresse zu finden, diese bevorzugen
|
||||
foreach (var IPA in addresslist)
|
||||
{
|
||||
if (IPA.AddressFamily.ToString() == "InterNetwork")
|
||||
{
|
||||
theaddress = IPA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, theaddress.ToString());
|
||||
_own_ip_address = theaddress.ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// eine neue socket zum DataInterface als Client aufmachen. ?ber diese Verbindung werden alle Events zum
|
||||
// Datainterface ?bertragen
|
||||
// Returned nie einen Null-Wert
|
||||
public IhapEventChannel GetDataInterfaceConnection(string channelName)
|
||||
{
|
||||
// sind die n?tigen Parameter gesetzt (_ipAddress, _hostname), damit eine Verbindung aufgebaut werden kann?
|
||||
if (_ipAddress.Equals("") || _hostName.Equals("") || _canonicalHostName.Equals(""))
|
||||
{
|
||||
//Fehlerausgabe
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Critical, "ADAPTER: communication parameter unknown:\n" +
|
||||
"DataInterface IP Address = " + _ipAddress + "\n" +
|
||||
"DataInterface Host Name = " + _hostName + "\n" +
|
||||
"DataInterface Canonical Host Name = " + _canonicalHostName + "\n");
|
||||
// Ende
|
||||
throw new Exception("iTAC.OIB.Adapter is not configured properly");
|
||||
}
|
||||
|
||||
// F?r jeden Kanal eine neue eigene Verbindung aufmachen. Pro Verbindung eine laufende Nummer z?hlen...
|
||||
var channelNameWithNumber = "";
|
||||
|
||||
// gab es f?r diesen channelName bereits eine Connection
|
||||
var counter = 0;
|
||||
lock (_locker)
|
||||
{
|
||||
if (channelNameCounter.ContainsKey(channelName))
|
||||
{
|
||||
counter = channelNameCounter[channelName];
|
||||
counter++;
|
||||
if (counter > 100000) { counter = 1; }
|
||||
channelNameCounter.Remove(channelName);
|
||||
channelNameCounter.Add(channelName, counter);
|
||||
}
|
||||
else
|
||||
{
|
||||
channelNameCounter.Add(channelName, counter);
|
||||
}
|
||||
channelNameWithNumber = channelName + "#" + counter;
|
||||
}
|
||||
// Neue Verbindung zum DataInterface aufmachen
|
||||
var tcpClient = new TcpClient(_canonicalHostName, _port);
|
||||
// eine neue TCp-Client-Verbindung
|
||||
var iHapEventChannel = new IhapEventChannel(tcpClient, channelNameWithNumber);
|
||||
if (iHapEventChannel == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "ADAPTER: iHapEventChannel not created");
|
||||
throw new Exception("ADAPTER: iHapEventChannel not created");
|
||||
}
|
||||
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: before adding " + channelNameWithNumber);
|
||||
lock (_locker)
|
||||
{
|
||||
if (openClientChannels.ContainsKey(channelNameWithNumber))
|
||||
{
|
||||
openClientChannels.Remove(channelNameWithNumber);
|
||||
}
|
||||
openClientChannels.Add(channelNameWithNumber, iHapEventChannel);
|
||||
}
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: " + channelNameWithNumber + " added");
|
||||
|
||||
iHapEventChannel.channelName = channelNameWithNumber;
|
||||
// Listener installieren, um zu reagieren, wenn das Data-Interface die Verbindung abgebrochen hat
|
||||
iHapEventChannel.connectionStateChangeListener += new PropertyChangeListener(iHapEventChannel_connectionStateChangeListener);
|
||||
|
||||
var oibEvents = (OIBEvents)iHapEventChannel.GetTransparentProxy();
|
||||
if (oibEvents == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "ADAPTER: iHapEventChannel.transparentProxy not created");
|
||||
throw new Exception("ADAPTER: iHapEventChannel.transparentProxy not created");
|
||||
}
|
||||
oibEvents.setChannelName(channelNameWithNumber);
|
||||
oibEvents.startup();
|
||||
return iHapEventChannel;
|
||||
}
|
||||
|
||||
|
||||
#region IAdapterControl Member
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions starten
|
||||
/// </summary>
|
||||
public void startMonitoringReceiver()
|
||||
{
|
||||
genericStart("Monitoring Receiver", MonitoringReceiver);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions anhalten und austragen
|
||||
/// </summary>
|
||||
public void stopMonitoringReceiver()
|
||||
{
|
||||
genericStop("Monitoring Receiver", MonitoringReceiver);
|
||||
}
|
||||
|
||||
public void startSetupCenterNotifyReceiver()
|
||||
{
|
||||
genericStart("SetupCenterReceiver", SetupCenterReceiver);
|
||||
genericStart("SetupCenterExternalControlReceiver", SetupCenterExternalControlReceiver);
|
||||
}
|
||||
|
||||
public void stopSetupCenterNotifyReceiver()
|
||||
{
|
||||
genericStop("SetupCenterReceiver", SetupCenterReceiver);
|
||||
genericStop("SetupCenterExternalControlReceiver", SetupCenterExternalControlReceiver);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions starten
|
||||
/// </summary>
|
||||
public void startTraceReceiver()
|
||||
{
|
||||
genericStart("TraceReceiver", TraceReceiver);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions anhalten und austragen
|
||||
/// </summary>
|
||||
public void stopTraceReceiver()
|
||||
{
|
||||
genericStop("TraceReceiver", TraceReceiver);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions starten
|
||||
/// </summary>
|
||||
public void startBoardGateKeeper()
|
||||
{
|
||||
genericStart("BoardGateKeeperReceiver", BoardGateKeeperReceiver);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions anhalten und austragen
|
||||
/// </summary>
|
||||
public void stopBoardGateKeeper()
|
||||
{
|
||||
genericStop("BoardGateKeeperReceiver", BoardGateKeeperReceiver);
|
||||
}
|
||||
|
||||
public bool ping()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "ADAPTER: ping");
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool isSetupStation()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: isSetupStation()");
|
||||
return _isSetupStation;
|
||||
}
|
||||
|
||||
public void setInterfaceHost(int port, string ipAddress, string canonicalHostName, string hostName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: setInterfaceHost() called");
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: set DataInterface port: " + port);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: set DataInterface ipAddress: " + ipAddress);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: set DataInterface canonical hostname : " + canonicalHostName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: set DataInterface hostname : " + hostName);
|
||||
// setzen der Parameter ist immer moeglich, wenn die Parameter noch nicht gesetzt wurden.
|
||||
if (_port != 0 && !_hostName.Equals(""))
|
||||
{
|
||||
// eine Änderung des Hostnamen ist nicht erlaubt, so lange der AdapterProzess besteht.
|
||||
if (!_hostName.Equals(hostName) || !_ipAddress.Equals(ipAddress) || !_canonicalHostName.Equals(canonicalHostName))
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: current port: " + _port + ": new port :" + port);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: current ipAddress: " + _ipAddress + ": new ipAddress :" + ipAddress);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: current canonical hostname : " + _canonicalHostName + ": new canonical hostname : " + canonicalHostName);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: current hostname : " + _hostName + ": new hostname:" + hostName);
|
||||
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Warning, "ADAPTER: changing DataInterface communication parameter not allowed and not changed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_port = port;
|
||||
_ipAddress = ipAddress;
|
||||
_hostName = hostName;
|
||||
_canonicalHostName = canonicalHostName;
|
||||
try
|
||||
{
|
||||
IhapEventChannel interfaceControlChannel = GetDataInterfaceConnection("interfaceControlChannel");
|
||||
// die Methode "DataInterfaceShutdown" wird aufgerufen, wenn das Interface diese Clientverbindung abbricht
|
||||
// hierf?r wird ein zus?tzlicher Handler installiert
|
||||
// interfaceControlChannel.connectionStateChangeListener += new PropertyChangeListener(DataInterfaceShutdown);
|
||||
//interfaceControlChannel.connectionStateChangeListener += new PropertyChangeListener(iHapEventChannel_connectionStateChangeListener);
|
||||
|
||||
var channel = (OIBEvents)interfaceControlChannel.GetTransparentProxy();
|
||||
channel.RegisterAdapter(_own_itac_oib_adapter_port, _own_ip_address, _own_canonical_host_name, _own_host_name);
|
||||
|
||||
var versionList = new List<KeyValue>();
|
||||
channel.setVersionInfo(versionList.ToArray());
|
||||
closeHandler(channel);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: setInterfaceHost() call failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setChannelName(string channelName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: setting channel name(" + channelName + ")");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
// die Verbindung zum DataInterface aktiv abbauen
|
||||
internal void closeChannel(IhapEventChannel eventChannel)
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
openClientChannels.Remove(eventChannel.channelName);
|
||||
eventChannel.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
// die eingehende Verbindung aktiv schliessen
|
||||
internal void closeHandler(OIBEvents eventHandler)
|
||||
{
|
||||
eventHandler.shutdown();
|
||||
}
|
||||
|
||||
// Listener f?r ausgehende Verbindungen; wird aufgerufen, wenn f?r eine ausgehende Verbindung das schreiben fehlschl?gt (also durch das
|
||||
// DataInterface die Verbindung abgebrochen wurde
|
||||
internal void iHapEventChannel_connectionStateChangeListener(Object source, string channelName, string message)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: " + channelName + " " + message);
|
||||
closeChannel((IhapEventChannel)source);
|
||||
if (openClientChannels.Count > 0)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "shutdown " + openClientChannels.Count + " remaining open connections from iTAC.OIB.Adpater to DataInterface");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "no remaining open connections from iTAC.OIB.Adpater to DataInterface");
|
||||
}
|
||||
}
|
||||
|
||||
// Wenn ein IHapHandler ein Disconnect feststellt wird eine Verbindung entfernt...
|
||||
public void DataInterfaceShutdown(object sender, string channelName, string message)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, channelName + " disconnected");
|
||||
_port = 0;
|
||||
_ipAddress = "";
|
||||
_canonicalHostName = "";
|
||||
_hostName = "";
|
||||
// alle client-Verbindungen muessen abgebaut werden...
|
||||
if (openClientChannels.Count > 0)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "shutdown " + openClientChannels.Count + " remaining open connections from iTAC.OIB.Adpater to DataInterface");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "no remaining open connections from iTAC.OIB.Adpater to DataInterface");
|
||||
}
|
||||
|
||||
// ge?ffnete Eventing Queues stoppen
|
||||
stopMonitoringReceiver();
|
||||
stopSetupCenterNotifyReceiver();
|
||||
}
|
||||
|
||||
protected void genericStop(String serviceName, IReceiver service)
|
||||
{
|
||||
if (service == null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: " + serviceName + " will not be stopped because it was not initialized");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: Stop " + serviceName + "");
|
||||
service.Stop();
|
||||
}
|
||||
}
|
||||
public void genericStart(String serviceName, IReceiver service)
|
||||
{
|
||||
if (service == null)
|
||||
{
|
||||
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: " + serviceName + " will not be started because it was not initialized");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "ADAPTER: Start " + serviceName + "");
|
||||
service.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (SetupCenterReceiver != null)
|
||||
SetupCenterReceiver.Dispose();
|
||||
if (SetupCenterExternalControlReceiver != null)
|
||||
SetupCenterExternalControlReceiver.Dispose();
|
||||
if (MonitoringReceiver != null)
|
||||
MonitoringReceiver.Dispose();
|
||||
if (TraceReceiver != null)
|
||||
TraceReceiver.Dispose();
|
||||
if (SpiReceiver != null)
|
||||
SpiReceiver.Dispose();
|
||||
if (BoardGateKeeperReceiver != null)
|
||||
BoardGateKeeperReceiver.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
namespace com.itac.oib
|
||||
{
|
||||
// remote-Methoden zum testen der Anwendung...
|
||||
public interface IAdapterControl
|
||||
{
|
||||
|
||||
//bool addEventFilter(string filterExpr);
|
||||
//void clearFilter();
|
||||
|
||||
void startSetupCenterNotifyReceiver();
|
||||
void stopSetupCenterNotifyReceiver();
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions starten
|
||||
/// </summary>
|
||||
void startMonitoringReceiver();
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions anhalten und austragen
|
||||
/// </summary>
|
||||
void stopMonitoringReceiver();
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions starten
|
||||
/// </summary>
|
||||
void startTraceReceiver();
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions anhalten und austragen
|
||||
/// </summary>
|
||||
void stopTraceReceiver();
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions starten
|
||||
/// </summary>
|
||||
void startBoardGateKeeper();
|
||||
|
||||
/// <summary>
|
||||
/// subscriptions anhalten und austragen
|
||||
/// </summary>
|
||||
void stopBoardGateKeeper();
|
||||
|
||||
bool ping();
|
||||
|
||||
/// <summary>
|
||||
/// liefert true, wenn dieser Adapter für eine SetupStation (Vorrüstplatz) konfiguriert ist.
|
||||
/// In diesem Fall muss die Client Applikation beim start keine Board Daten lesen
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool isSetupStation();
|
||||
|
||||
/// <summary>
|
||||
/// dem Adapter die Interface-Konfiguration mitteilen
|
||||
/// </summary>
|
||||
/// @param ipAddress
|
||||
/// die Adresse, auf der das Interface zu erreichen ist
|
||||
/// @param hostName
|
||||
/// der host, auf dem das Interface zu erreichen ist
|
||||
void setInterfaceHost(int port, string ipAddress, string canonicalHostName, string hostName);
|
||||
|
||||
void setChannelName(string channelName);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace com.itac.oib
|
||||
{
|
||||
|
||||
//public class KeyValue
|
||||
//{
|
||||
// public string key { get; set; }
|
||||
// public string value { get; set; }
|
||||
//}
|
||||
|
||||
// Meldungen, die der Adapter an das DataInterface senden kann
|
||||
public interface IAdapterNotify
|
||||
{
|
||||
// Diese Nachricht wird immer dann vom iTAC.OIB.Adapter zum DataInterface gesendet, wenn eine MessageQueue durch den Adapter neu gestartet wurde.
|
||||
void MessageQueueRestartet(string queueEndpoint);
|
||||
void SendQueueInfo(QueueInfo queueInfo);
|
||||
|
||||
// wenn der iTAC.OIB.Adapter vom DataInterface angesprochen wird und eine neue Konfiguration erhält
|
||||
// (Endpunkt/Port, wo das Interface zu finden ist) schickt der Adapter eine Meldung an das Interface wo er selbst zu finden ist.
|
||||
void RegisterAdapter(int port, string ipAddress, string canonicalHostName, string hostName);
|
||||
|
||||
void shutdown();
|
||||
void setChannelName(string channelName);
|
||||
void startup();
|
||||
void setVersionInfo(KeyValue[] keyValueArray);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace com.itac.oib
|
||||
{
|
||||
public class ItacXmlSerializer
|
||||
{
|
||||
|
||||
private static int MAX_INDENT_LEVEL = 15;
|
||||
private static int indentationWidth = 2;
|
||||
|
||||
private int indentationLevel = 0;
|
||||
private bool formatting = true;
|
||||
private StringBuilder writer;
|
||||
private static String[] indentStrings;
|
||||
private bool logXmlFormat = true;// Eine Möglichkeit auch nicht-XML zu loggen
|
||||
|
||||
|
||||
static ItacXmlSerializer()
|
||||
{
|
||||
indentStrings = new String[MAX_INDENT_LEVEL];
|
||||
for (int level = 0; level < MAX_INDENT_LEVEL; level++)
|
||||
{
|
||||
StringBuilder indentBuffer = new StringBuilder();
|
||||
int count = level * indentationWidth;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
indentBuffer.Append(' ');
|
||||
}
|
||||
indentStrings[level] = indentBuffer.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// [MethodImpl(MethodImplOptions.Synchronized)]
|
||||
public StringBuilder serialize(Object source)
|
||||
{
|
||||
writer = new StringBuilder();
|
||||
if (source != null)
|
||||
{
|
||||
if (source.GetType().IsArray)
|
||||
{
|
||||
writeArray("", source);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeStart(source.GetType().Name, true);
|
||||
writeStructure(source);
|
||||
writeEnd(source.GetType().Name, true, true);
|
||||
}
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
|
||||
private void indent()
|
||||
{
|
||||
if (formatting)
|
||||
{
|
||||
indentationLevel += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void unindent()
|
||||
{
|
||||
if (formatting && indentationLevel > 0)
|
||||
{
|
||||
indentationLevel -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeArray(String fieldName, Object fieldvalue)
|
||||
{
|
||||
Object[] array = (Object[])fieldvalue;
|
||||
// do not print empty arrays
|
||||
if (array != null && array.Length > 0)
|
||||
{
|
||||
if (!fieldName.Equals(""))
|
||||
{
|
||||
writeStart(fieldName, true);
|
||||
}
|
||||
String simpleClassName = fieldvalue.GetType().Name.Substring(0, fieldvalue.GetType().Name.Length - 2);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
writeStart(simpleClassName, true);
|
||||
writeStructure(array[i]);
|
||||
writeEnd(simpleClassName, true, false);
|
||||
}
|
||||
|
||||
if (!fieldName.Equals(""))
|
||||
{
|
||||
writeEnd(fieldName, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void allClassProperties(List<PropertyInfo> fieldList, Type clazz)
|
||||
{
|
||||
// über alle Felder aller parent Interfaces, solange das Interface nicht Object ist.
|
||||
if (clazz == null || clazz == typeof(Object))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// fields: all public fields
|
||||
PropertyInfo[] fields = clazz.GetProperties();
|
||||
foreach (PropertyInfo field in fields)
|
||||
{
|
||||
fieldList.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
private void allClassFields(List<FieldInfo> fieldList, Type clazz)
|
||||
{
|
||||
// über alle Felder aller parent Interfaces, solange das Interface nicht Object ist.
|
||||
if (clazz == null || clazz == typeof(Object))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// fields: all public fields
|
||||
FieldInfo[] fields = clazz.GetFields();
|
||||
foreach (FieldInfo field in fields)
|
||||
{
|
||||
fieldList.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeStructure(Object source)
|
||||
{
|
||||
List<PropertyInfo> propertyList = new List<PropertyInfo>();
|
||||
allClassProperties(propertyList, source.GetType());
|
||||
|
||||
List<FieldInfo> fieldList = new List<FieldInfo>();
|
||||
allClassFields(fieldList, source.GetType());
|
||||
foreach (PropertyInfo field2 in propertyList)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object fieldvalue = field2.GetValue(source, null);
|
||||
writeObject(field2.Name, fieldvalue);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
writeObject(field2.Name, "property write failed");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (FieldInfo field2 in fieldList)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object fieldvalue = field2.GetValue(source);
|
||||
writeObject(field2.Name, fieldvalue);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
writeObject(field2.Name, "field write failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(String fieldName, object fieldvalue)
|
||||
{
|
||||
if (fieldvalue == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (fieldvalue.GetType() == typeof(String))
|
||||
{
|
||||
writeString(fieldName, (String)fieldvalue);
|
||||
}
|
||||
else if (fieldvalue.GetType() == typeof(DateTime))
|
||||
{
|
||||
writeDate(fieldName, (DateTime)fieldvalue);
|
||||
}
|
||||
else if (fieldvalue.GetType() == typeof(bool) || fieldvalue.GetType() == typeof(Boolean))
|
||||
{
|
||||
if (((bool)fieldvalue)) { writeString(fieldName, "true"); } else { writeString(fieldName, "false"); }
|
||||
}
|
||||
else if (fieldvalue.GetType() == typeof(byte) || fieldvalue.GetType() == typeof(int) || fieldvalue.GetType() == typeof(Int16) || fieldvalue.GetType() == typeof(Int32)
|
||||
|| fieldvalue.GetType() == typeof(Int64))
|
||||
{
|
||||
writeIntNumber(fieldName, (Object)fieldvalue);
|
||||
}
|
||||
else if (fieldvalue.GetType() == typeof(double) || fieldvalue.GetType() == typeof(float))
|
||||
{
|
||||
writeNumber(fieldName, (Object)fieldvalue);
|
||||
}
|
||||
else if (fieldvalue.GetType() == typeof(Double))
|
||||
{
|
||||
writeNumber(fieldName, (Object)fieldvalue);
|
||||
}
|
||||
else if (fieldvalue.GetType().IsArray)
|
||||
{
|
||||
writeArray(fieldName, fieldvalue);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Strukturierten Wert schreiben
|
||||
writeStart(fieldName, true);
|
||||
writeStructure(fieldvalue);
|
||||
writeEnd(fieldName, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeDate(String fieldName, DateTime fieldvalue)
|
||||
{
|
||||
writeStart(fieldName, false);
|
||||
writer.Append(fieldvalue.ToString("o"));
|
||||
writeEnd(fieldName, false, false);
|
||||
}
|
||||
|
||||
private void writeStart(string fieldName, bool endLineAndIndent)
|
||||
{
|
||||
startLine();
|
||||
if (logXmlFormat)
|
||||
{
|
||||
writer.Append("<");
|
||||
writer.Append(fieldName);
|
||||
writer.Append(">");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Append(fieldName);
|
||||
writer.Append(": ");
|
||||
}
|
||||
if (endLineAndIndent)
|
||||
{
|
||||
endLine();
|
||||
indent();
|
||||
}
|
||||
}
|
||||
private void writeEnd(string fieldName, bool indenting, bool newLine)
|
||||
{
|
||||
if (logXmlFormat)
|
||||
{
|
||||
if (indenting)
|
||||
{
|
||||
unindent();
|
||||
startLine();
|
||||
}
|
||||
writer.Append("</");
|
||||
writer.Append(fieldName);
|
||||
writer.Append(">");
|
||||
endLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (indenting)
|
||||
{
|
||||
unindent();
|
||||
}
|
||||
if (newLine)
|
||||
{
|
||||
endLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeNumber(String fieldName, Object fieldvalue)
|
||||
{
|
||||
writeStart(fieldName, false);
|
||||
writer.Append(fieldvalue.ToString());
|
||||
writeEnd(fieldName, false, true);
|
||||
}
|
||||
|
||||
private void writeIntNumber(String fieldName, Object fieldvalue)
|
||||
{
|
||||
writeStart(fieldName, false);
|
||||
writer.Append(fieldvalue.ToString());
|
||||
writeEnd(fieldName, false, true);
|
||||
}
|
||||
|
||||
private void writeString(String fieldName, String value)
|
||||
{
|
||||
writeStart(fieldName, false);
|
||||
writer.Append(value);
|
||||
writeEnd(fieldName, false, true);
|
||||
}
|
||||
|
||||
private void endLine()
|
||||
{
|
||||
if (formatting)
|
||||
{
|
||||
writer.Append("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
private void startLine()
|
||||
{
|
||||
if (formatting)
|
||||
{
|
||||
writer.Append(indentStrings[Math.Min(indentationLevel, MAX_INDENT_LEVEL)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
namespace com.itac.oib
|
||||
{
|
||||
public class KeyValue
|
||||
{
|
||||
public string key
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using com.itac.mes.proxy;
|
||||
|
||||
namespace com.itac.oib
|
||||
{
|
||||
public class MessageWriter
|
||||
{
|
||||
static int counter = 0;
|
||||
bool xmlExport = false;
|
||||
bool xmlLogging = false;
|
||||
HashSet<String> writeXmlForType = new HashSet<String>();
|
||||
|
||||
public void init()
|
||||
{
|
||||
|
||||
AppSettingsReader config = new AppSettingsReader();
|
||||
try
|
||||
{
|
||||
//<add key="xmlExport" value="true"/>
|
||||
xmlExport = (bool)config.GetValue("xmlExport", typeof(bool));
|
||||
xmlLogging = (bool)config.GetValue("xmlLogging", typeof(bool));
|
||||
|
||||
// pruefen, dass das Ausgabeverzeichnis ./output existiert
|
||||
bool exists = System.IO.Directory.Exists(@".\output");
|
||||
if (!exists && xmlExport)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Critical, "xmlExport set to true, but output folder (./output) does not exist!");
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "flag xmlExport modified, is set to false now!");
|
||||
xmlExport = false;
|
||||
}
|
||||
|
||||
//<!-- definieren, welche Messages ausgegeben werden sollen -->
|
||||
if (xmlExport)
|
||||
{
|
||||
if ((bool)config.GetValue("TraceabilityData", typeof(bool))) { writeXmlForType.Add("TraceabilityData"); }
|
||||
if ((bool)config.GetValue("DownloadData", typeof(bool))) { writeXmlForType.Add("DownloadData"); }
|
||||
if ((bool)config.GetValue("CheckInData", typeof(bool))) { writeXmlForType.Add("CheckInData"); }
|
||||
if ((bool)config.GetValue("StationEventComposite", typeof(bool))) { writeXmlForType.Add("StationEventComposite"); }
|
||||
if ((bool)config.GetValue("PackagingUnitLocation", typeof(bool))) { writeXmlForType.Add("PackagingUnitLocation"); }
|
||||
if ((bool)config.GetValue("ExternalControlResult", typeof(bool))) { writeXmlForType.Add("ExternalControlResult"); }
|
||||
if ((bool)config.GetValue("MaterialMovedReport", typeof(bool))) { writeXmlForType.Add("MaterialMovedReport"); }
|
||||
if ((bool)config.GetValue("SetupChangedReport", typeof(bool))) { writeXmlForType.Add("SetupChangedReport"); }
|
||||
if ((bool)config.GetValue("FeederPlacedReport", typeof(bool))) { writeXmlForType.Add("FeederPlacedReport"); }
|
||||
if ((bool)config.GetValue("TablePlacedReport", typeof(bool))) { writeXmlForType.Add("TablePlacedReport"); }
|
||||
if ((bool)config.GetValue("TableRemovedReport", typeof(bool))) { writeXmlForType.Add("TableRemovedReport"); }
|
||||
if ((bool)config.GetValue("BoardProcessedData", typeof(bool))) { writeXmlForType.Add("BoardProcessedData"); }
|
||||
if ((bool)config.GetValue("FeederRemovedReport", typeof(bool))) { writeXmlForType.Add("FeederRemovedReport"); }
|
||||
if ((bool)config.GetValue("PackagingUnitConsumedReport", typeof(bool))) { writeXmlForType.Add("PackagingUnitConsumedReport"); }
|
||||
if ((bool)config.GetValue("PackagingUnitCreatedReport", typeof(bool))) { writeXmlForType.Add("PackagingUnitCreatedReport"); }
|
||||
if ((bool)config.GetValue("LockStateChangedReport", typeof(bool))) { writeXmlForType.Add("LockStateChangedReport"); }
|
||||
if ((bool)config.GetValue("LineChangeoverEvent", typeof(bool))) { writeXmlForType.Add("LineChangeoverEventArgs"); }
|
||||
if ((bool)config.GetValue("BoardRequestData", typeof(bool))) { writeXmlForType.Add("BoardRequestData"); }
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Critical, "Initialization failed! " + e.Message, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void output(Object outputObject)
|
||||
{
|
||||
if (outputObject == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DateTime starttime = DateTime.Now;
|
||||
counter++;
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "start serializing message");
|
||||
String typeName = outputObject.GetType().Name;
|
||||
// bei Array-Typen die Klammern im Typnamen weglassen
|
||||
if (typeName.EndsWith("[]"))
|
||||
{
|
||||
typeName = typeName.Substring(0, typeName.Length - 2);
|
||||
}
|
||||
String XmlizedString = null;
|
||||
if (xmlLogging)
|
||||
{
|
||||
ItacXmlSerializer itacSerializer = new ItacXmlSerializer();
|
||||
try
|
||||
{
|
||||
XmlizedString = itacSerializer.serialize(outputObject).ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
XmlizedString = "serializing data for " + typeName + " failed!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlizedString = "<" + typeName + ">...";
|
||||
}
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, XmlizedString);
|
||||
if (xmlExport)
|
||||
{
|
||||
try
|
||||
{
|
||||
String fileName = counter + "_" + DateTime.Now.Ticks + "_" + typeName + ".xml";
|
||||
string newPath = Path.Combine(@".\output", fileName);
|
||||
bool writeFile = writeXmlForType.Contains(typeName);
|
||||
if (writeFile && counter < 65535)
|
||||
{
|
||||
Stream fileStream = new FileStream(newPath, FileMode.Create, FileAccess.Write);
|
||||
using (StreamWriter outfile = new StreamWriter(fileStream))
|
||||
{
|
||||
outfile.Write(XmlizedString);
|
||||
outfile.Flush();
|
||||
outfile.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "writing xml file failed for " + typeName);
|
||||
}
|
||||
}
|
||||
TimeSpan duration = DateTime.Now - starttime;
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Verbose, "serializing message done in " + duration.Milliseconds + " millies");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace com.itac.oib
|
||||
{
|
||||
public class QueueInfo
|
||||
{
|
||||
public int OutStandingMessages { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string QueueName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
namespace com.itac.oib.client
|
||||
{
|
||||
// property: assembly: ASM.AS.OIB.Client, Version: 3.0.0.0
|
||||
public class OibClientService {
|
||||
|
||||
// canRead:True, canWrite:False
|
||||
private string displayName;
|
||||
|
||||
public void setDisplayName(string displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
// field DisplayName without setMethod
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
using com.itac.oib.linecontrol.service;
|
||||
using System;
|
||||
|
||||
namespace com.itac.oib.client
|
||||
{
|
||||
// property: assembly: ASM.AS.OIB.Client, Version: 3.0.0.0
|
||||
public class OibLineControlAccess : OibService {
|
||||
|
||||
// property: assembly: ASM.AS.OIB.SIPLACEPro.LineControl.Proxy, Version: 5.1.0.84
|
||||
// canRead:True, canWrite:False
|
||||
private OibLineControlAccess lineControlSession;
|
||||
// property: assembly: mscorlib, Version: 4.0.0.0
|
||||
// canRead:True, canWrite:False
|
||||
private Nullable<bool> isServiceAlive;
|
||||
|
||||
public void setLineControlSession(OibLineControlAccess lineControlSession) {
|
||||
this.lineControlSession = lineControlSession;
|
||||
}
|
||||
// field LineControlSession without setMethod
|
||||
|
||||
public void setIsServiceAlive(Nullable<bool> isServiceAlive) {
|
||||
this.isServiceAlive = isServiceAlive;
|
||||
}
|
||||
// field IsServiceAlive without setMethod
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
namespace com.itac.oib.client
|
||||
{
|
||||
// property: assembly: ASM.AS.OIB.Client, Version: 3.0.0.0
|
||||
public class OibService : OibClientService {
|
||||
|
||||
// canRead:True, canWrite:False
|
||||
private string serviceName;
|
||||
|
||||
public void setServiceName(string serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
// field ServiceName without setMethod
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using com.itac.mes.proxy;
|
||||
using com.itac.mes.proxy.business;
|
||||
using Asm.As.Oib.Client;
|
||||
using com.itac.oib.client.customextensions;
|
||||
using com.itac.oib.traceability.contracts.data;
|
||||
|
||||
using OibSpiArchInt = Asm.As.Oib.SiplacePro.Proxy.Architecture.Interfaces;
|
||||
using OibSpiArchObj = Asm.As.Oib.SiplacePro.Proxy.Architecture.Objects;
|
||||
using OibSpiBizObj = Asm.As.Oib.SiplacePro.Proxy.Business.Objects;
|
||||
using OibSpiTypes = Asm.As.Oib.SiplacePro.Proxy.Types;
|
||||
using OibSpiNotify = Asm.As.Oib.SiplacePro.Proxy.Architecture.Notifications.SubscriptionService;
|
||||
|
||||
using Asm.As.Oib.SiplacePro.Contracts.Data.Business.Objects;
|
||||
using com.itac.oib.siplacepro.contracts.data;
|
||||
using com.itac.oib.monitoring.contracts.data;
|
||||
#endregion
|
||||
|
||||
namespace com.itac.oib.siplacepro.service
|
||||
{
|
||||
/// <summary>
|
||||
/// Diese Klasse enthält eine Referenz auf eine Siplace pro Session, über die auf die SiplacePro Schnittstelle zugegriffen werden kann.
|
||||
/// </summary>
|
||||
public class SiplacePro : ISiplacePro
|
||||
{
|
||||
#region Fields
|
||||
|
||||
// Eventhandler zur übergabe des Events an Java Server.
|
||||
public OIBEventHandler _eventHandler { set; get; }
|
||||
|
||||
public OibSpiAccess oibSpiAccess { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISiplacePro Member
|
||||
|
||||
public void RegisterCallback()
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "subscribe SiplacePro events");
|
||||
try
|
||||
{
|
||||
if (oibSpiAccess.Session != null)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "SiplacePro Adapter Version: " + oibSpiAccess.Session.OibSiplaceProAdapterVersion);
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "SiplacePro Proxy Version: " + oibSpiAccess.Session.OibSiplaceProProxyVersion);
|
||||
|
||||
oibSpiAccess.Session.ServiceUnreachable += SpiSessionOnServiceUnreachable;
|
||||
oibSpiAccess.Session.ServiceReconnect += SpiSessionOnServiceReconnect;
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "SiplacePro events subscribed ");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "Got exception during setting up Subcription mode: ", ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SPI Event Handling
|
||||
|
||||
private void SpiSessionOnServiceReconnect(string endpoint, string comment)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "*** SERVICE RECONNECT ***");
|
||||
if (_eventHandler != null)
|
||||
_eventHandler.onServiceReconnect();
|
||||
}
|
||||
|
||||
private void SpiSessionOnServiceUnreachable(string endpoint, string comment)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "*** SERVICE UNREACHABLE ***");
|
||||
if (_eventHandler != null)
|
||||
_eventHandler.onServiceDisconnect();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISiplacePro Member
|
||||
|
||||
public contracts.data.BoardElement[] getPlacementForBoard(String boardFullName)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET get Board");
|
||||
contracts.data.BoardElement[] placementInfo = new contracts.data.BoardElement[0];
|
||||
OibSpiBizObj.Board board = oibSpiAccess.Session.GetObject(boardFullName, OibSpiTypes.ObjectServerType.Board) as OibSpiBizObj.Board;
|
||||
// List<com.itac.oib.siplacepro.contracts.data.BoardElement> itacBoardElementList = new List<com.itac.oib.siplacepro.contracts.data.BoardElement>();
|
||||
|
||||
// com.itac.oib.siplacepro.contracts.data.BoardElement itacBoardElement = new com.itac.oib.siplacepro.contracts.data.BoardElement();
|
||||
// com.itac.oib.siplacepro.contracts.data.Board itacBoard = BoardMapper.get((Asm.As.Oib.SiplacePro.Contracts.Data.Business.Objects.Board)board);
|
||||
|
||||
// itacBoardElement.setBoard(itacBoard);// board = BoardElementHelper.DoBoard(board);
|
||||
// itacBoard.producedSide = board.BoardSideProduced.ToString();
|
||||
// itacBoardElementList.Add(itacBoardElement);
|
||||
|
||||
// placementInfo.boardElements = itacBoardElementList.ToArray();
|
||||
|
||||
return placementInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// diese Methode im Download Event ausführen und Ergebnis zurückliefern
|
||||
internal static contracts.data.BoardElement[] GetPlacementForRecipe(OibSpiBizObj.Recipe recipe)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET get Recipe");
|
||||
contracts.data.BoardElement[] placementInfo = new contracts.data.BoardElement[0];
|
||||
// var itacBoardElementList = new List<BoardElement>();
|
||||
try
|
||||
{
|
||||
foreach (var boardelement in recipe.BoardElements)
|
||||
{
|
||||
// itacBoardElementList.Add(BoardElementHelper.DoBoardElement(boardelement));
|
||||
}
|
||||
// placementInfo.boardElements = itacBoardElementList.ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// bei allen Exceptions Ausgabe machen und null liefern!!!
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Error, "converting board information failed, can't continue properly", ex);
|
||||
return null;
|
||||
}
|
||||
return placementInfo;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ISiplacePro Member
|
||||
|
||||
public BoardCheckInRequest completeCheckinData(BoardCheckInRequest checkinData)
|
||||
{
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "complete CheckInData");
|
||||
if (checkinData == null) { return null; }
|
||||
// Line und Recipe ermitteln, die fehlenden Werte in die übergebene Struktur eintragen und zurückliefern
|
||||
var result = checkinData;
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call getRecipe");
|
||||
// var recipe = oibSpiAccess.Session.GetObject(checkinData.getRecipeName(), OibSpiTypes.ObjectServerType.Recipe) as OibSpiBizObj.Recipe;
|
||||
// result.setRecipeName(monitoring.contracts.data.RecipeMapper.get(recipe));
|
||||
// LogHandler.log(Constants.LOGGER, TraceEventType.Information, ".NET call getLine");
|
||||
// var line = oibSpiAccess.Session.GetObject(checkinData.getLineName(), OibSpiTypes.ObjectServerType.Line) as OibSpiBizObj.Line;
|
||||
// result.setLineName( LineMapper.get(line));
|
||||
LogHandler.log(Constants.LOGGER, TraceEventType.Information, "complete CheckInData finished");
|
||||
return checkinData;
|
||||
}
|
||||
|
||||
private static OibSpiArchObj.Identity GetStationIdentity(OibSpiBizObj.DownloadData downloadData, OibSpiBizObj.ProductionDataManager pdm)
|
||||
{
|
||||
foreach (var dd in pdm.LineControlData.DownloadData)
|
||||
{
|
||||
if (dd.Value.OID == downloadData.OID)
|
||||
{
|
||||
return dd.Key;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
internal void Download(Asm.As.Oib.SiplacePro.Contracts.Data.Business.Objects.DownloadData downloadData)
|
||||
{
|
||||
if (_eventHandler != null)
|
||||
{
|
||||
// TODO richtiges download nehmen _eventHandler.DownloadEvent(downloadData);
|
||||
}
|
||||
}
|
||||
|
||||
public LineChangeoverEventArgs getCurrentLineProductionData()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
180388
interface/asm/dotnet/Oib5xGUI/src/main/csharp/proxySIPLACEPro.SPI.cs
Normal file
180388
interface/asm/dotnet/Oib5xGUI/src/main/csharp/proxySIPLACEPro.SPI.cs
Normal file
File diff suppressed because it is too large
Load Diff
1195
interface/asm/dotnet/Oib5xGUI/src/main/csharp/proxyServiceLocator.cs
Normal file
1195
interface/asm/dotnet/Oib5xGUI/src/main/csharp/proxyServiceLocator.cs
Normal file
File diff suppressed because it is too large
Load Diff
2531
interface/asm/dotnet/Oib5xGUI/src/main/csharp/proxyWSEventing.cs
Normal file
2531
interface/asm/dotnet/Oib5xGUI/src/main/csharp/proxyWSEventing.cs
Normal file
File diff suppressed because it is too large
Load Diff
269
interface/asm/dotnet/Oib5xGUI/src/main/resources/Readme.txt
Normal file
269
interface/asm/dotnet/Oib5xGUI/src/main/resources/Readme.txt
Normal file
@@ -0,0 +1,269 @@
|
||||
Version 1.1.0.8
|
||||
---------------
|
||||
Import and export of messages as xml file
|
||||
|
||||
|
||||
Version 1.1.0.9
|
||||
---------------
|
||||
importing invalid xml file; avoid iTAC.OIB.Adapter crash
|
||||
|
||||
|
||||
Version 1.2.0.0
|
||||
---------------
|
||||
Configuration changed
|
||||
filtering for line names implemented
|
||||
support for PreSetupStation added
|
||||
|
||||
|
||||
Version 1.2.0.1
|
||||
---------------
|
||||
Avoid crash if OIB core is down for maintainance. automatically re-establish connection
|
||||
logging improved
|
||||
|
||||
|
||||
Version 1.2.0.2
|
||||
---------------
|
||||
exception handling in setupCenterNotifyReceiver optimized.
|
||||
field test version
|
||||
|
||||
|
||||
Version 1.2.0.3
|
||||
---------------
|
||||
xml file writing for PackagingUnitLocation and ExternalControlResult, Configuration change necessary.
|
||||
<!-- the following two are for synchronous call on scanning packaging units -->
|
||||
<add key="PackagingUnitLocation" value="true"/>
|
||||
<add key="ExternalControlResult" value="true"/>
|
||||
|
||||
Version 1.3.0.0
|
||||
---------------
|
||||
new libs for OIB 2.5 and SC 4.2
|
||||
more Exception handling, general exception handler for uncaught exceptions
|
||||
new function GetNewPackagingUnit (SC requests a packaging unit from MES)
|
||||
PackagingUnitConsumedReport contains additional information about locations and remaining packaging units
|
||||
|
||||
Version 1.3.0.1
|
||||
---------------
|
||||
Adapter can read DownloadData from xml file and send it to Client
|
||||
added consumedComponents information in TraceabilityData
|
||||
|
||||
Version 1.3.0.2
|
||||
---------------
|
||||
always create new input and output streams to java connector (requires java equivalent)
|
||||
|
||||
Version 1.3.0.3
|
||||
---------------
|
||||
A few more Packaging Unit fields: brightness class, ..
|
||||
|
||||
Version 1.3.0.4
|
||||
---------------
|
||||
Missing monitoring endpoint does not kill process
|
||||
|
||||
Version 1.3.0.5
|
||||
---------------
|
||||
Assembly Version still remains 1.3.0.4 from now to prevent oib configuration change
|
||||
additionally startup information about FileVersion, which is now 1.3.0.5
|
||||
compatible with Data Interface Version 6.10.02.374
|
||||
|
||||
Version 1.3.0.6
|
||||
---------------
|
||||
New Communication structure, DataInterface tells iTAC.OIB.Adapter on startup a remote port
|
||||
Every data set opens a new connection
|
||||
line control receiver configured only with port (changed adapter-configuration)
|
||||
compatible with Data Interface Version 6.10.02.384
|
||||
|
||||
Version 1.3.0.7
|
||||
---------------
|
||||
catch Exception on logging(was not thread safe)
|
||||
printing lineControl and setupCenter endpoints on startup
|
||||
|
||||
Version 1.3.0.8
|
||||
---------------
|
||||
LineName trim()
|
||||
Events from Monitoring Queue and SetupCenter Queue sent by a thread and return immediately, preventing timeouts
|
||||
|
||||
Version 1.3.0.9
|
||||
---------------
|
||||
Exception inserting values in Hashmap fixed
|
||||
possibly NullPointer prevented on MaterialMovedEvent
|
||||
|
||||
Version 1.3.0.10
|
||||
---------------
|
||||
return own address as IPv4 instead of undefined
|
||||
config file modified timeout-times (now 2 minutes)
|
||||
|
||||
Version 1.3.0.11
|
||||
---------------
|
||||
Capability of reading PackagingUnitConsumedReport from file (internal feature)
|
||||
Capability of reading MaterialMovedReport from file (internal feature)
|
||||
management of connections to DataInterface now thread safe
|
||||
|
||||
Version 1.3.0.12
|
||||
---------------
|
||||
logging events NewSetupActive and SetupChangedReport (20120424)
|
||||
config changed; new setting for NewSetupActive logging (20120424)
|
||||
requesting DataInterface connection synchronized (20120425)
|
||||
|
||||
Version 1.3.0.13
|
||||
---------------
|
||||
changed log level for XML-Message-Logging from INFO to DEBUG (20120523)
|
||||
changed time stamp format in logging, 3 digits for fractions of seconds (20120523)
|
||||
logging configuration changed, adjustable log level for console logger (20120523)
|
||||
new Parameter for Logging Xml into Console(20120523)
|
||||
XML-Serialization performance improved (20120523)
|
||||
|
||||
Version 1.3.0.14
|
||||
----------------
|
||||
Capability of reading StationEventcomposite from file (internal feature 20120525)
|
||||
Logging StationEventComposite corrected (20123105)
|
||||
|
||||
// from here we have two version for OIB 2.5 and 3.0
|
||||
|
||||
Version 2.5.0.15 / Version 3.0.0.15
|
||||
-----------------------------------
|
||||
internal structural changes
|
||||
|
||||
Version 2.5.0.16 / Version 3.0.0.16
|
||||
-----------------------------------
|
||||
preparing data structure (ComponentLocation) corrected (missing location info).
|
||||
SiplacePro logging modified.
|
||||
|
||||
Version 2.5.0.17 / Version 3.0.0.17
|
||||
-----------------------------------
|
||||
skips all older BoardProcessedData messages, requires new Configuration value (20120815)
|
||||
<!-- maximum age for boardProcessedMessages to be processed, in 'hours:minutes:seconds' -->
|
||||
<add key="BoardProcessedDataMaxAge" value="00:30:00"/>
|
||||
|
||||
Version 3.0.1.18
|
||||
-----------------------------------
|
||||
new mechanism for line changeover eventBased Mode (20121017)
|
||||
skips all older Stationevents messages, optional new Configuration value (20121017)
|
||||
<!-- maximum age for StationEventMessages to be processed, in 'hours:minutes:seconds' -->
|
||||
<add key="StationEventMaxAge" value="00:30:00"/>
|
||||
ignored if value is not configured or invalid
|
||||
|
||||
Version 3.0.1.19
|
||||
-----------------------------------
|
||||
correction in SetupCenterReceiver (20121023)
|
||||
|
||||
Version 3.0.1.20
|
||||
-----------------------------------
|
||||
check receive time in MonitoringReceiver with UTC time (StationEvent and BoardProcessed) (20121106)
|
||||
|
||||
Version 3.0.1.21
|
||||
-----------------------------------
|
||||
use stationFullPath instead of stationTypeFullPath in downloadEvent (20121127)
|
||||
|
||||
// latest version usable with OIB 3.0.1.x
|
||||
|
||||
// from here minimum required OIB Version is 3.1.0.101
|
||||
|
||||
Version 3.1.0.22
|
||||
-----------------------------------
|
||||
Initial support of OIB 3.1; OIB Client 3.0.x is no longer supported by this Adapter. (20130307)
|
||||
|
||||
Version 3.1.0.23
|
||||
-----------------------------------
|
||||
Adapter starts even if DisplayService is not available, but in this case without Traceability function. (20130821)
|
||||
|
||||
Version 3.1.0.24
|
||||
-----------------------------------
|
||||
new ASM DLL V2.1.0.1 including BoardGateKeeper (20130919)
|
||||
TraceReceiver will not be created/started if configured port is 0
|
||||
Display Service Receiver will not be started if configured port is 0
|
||||
|
||||
Version 3.1.0.25
|
||||
-----------------------------------
|
||||
new ASM DLL V2.1.0.2 including modified BoardGateKeeper (20131011)
|
||||
Adapter starts even if DisplayService is not available/reachable (20131011)
|
||||
BoardGateKeeper will not be started if configured port is 0
|
||||
sligthly changed format of xml output (bool values lower case, different date format)
|
||||
|
||||
Version 3.1.0.26
|
||||
-----------------------------------
|
||||
new ASM DLL V2.1.0.3 including modified BoardGateKeeper (20131018)
|
||||
sligthly changed format of xml output (bool values lower case, different date format)
|
||||
read xml files for VirtualInkspotData
|
||||
|
||||
Version 3.1.0.26
|
||||
-----------------------------------
|
||||
new ASM DLL V2.1.0.11 Virtual Inkspot Handling tested (20131025)
|
||||
new configuration values "OnVIHDataRejected.ShowMessage" and "OnVIHDataRejected.StationStop" (20131025)
|
||||
|
||||
Version 3.1.0.27
|
||||
-----------------------------------
|
||||
new ASM DLL V2.1.0.14 implemented (20131120)
|
||||
provide a new placementRecipeName to the line, new function startPlacementRecipe (20131022)
|
||||
|
||||
Version 3.1.0.28
|
||||
-----------------------------------
|
||||
deny board when communication break whilst VirtualInkspotRequest is active(20131204)
|
||||
accept BoardProcessedData messages as xml files (20131206)
|
||||
|
||||
Version 3.1.0.29
|
||||
-----------------------------------
|
||||
get ASM OIB Product Versions (20131217)
|
||||
|
||||
Version 3.1.0.30
|
||||
-----------------------------------
|
||||
new ASM DLL V2.1.0.16 (20140113)
|
||||
|
||||
// from here:
|
||||
// minimum required OIB Version 3.2.0.135
|
||||
|
||||
|
||||
Version 3.2.0.31
|
||||
-----------------------------------
|
||||
new ASM DLL V2.2.0.1 (20140114)
|
||||
use ASM OIB V3.2 (20140114)
|
||||
|
||||
Version 3.2.0.32
|
||||
-----------------------------------
|
||||
use recipeFullPath in LineChangeOverEvents instead of recipeName (20140120)
|
||||
correct namespace for startJobResult (20140124)
|
||||
setupCenterQueue subscription corrected (find correct stations of line) (20140120)
|
||||
|
||||
Version 3.2.0.33
|
||||
-----------------------------------
|
||||
logging on connection breakdown (20140827)
|
||||
new ASM DLL V2.2.1.4 (20140909)
|
||||
use ASM OIB V3.2 HF3 (3.2.0.152) (20140909)
|
||||
|
||||
Version 3.2.0.34
|
||||
-----------------------------------
|
||||
new ASM DLL V2.2.1.6, DLL backward compatible with older adapter versions (20141021)
|
||||
provide additional info to displayService on rejected Tracebilitydata (20141021)
|
||||
|
||||
Version 3.2.0.35
|
||||
-----------------------------------
|
||||
ignore download events from any except the configured line (20141118)
|
||||
|
||||
Version 3.2.0.36
|
||||
-----------------------------------
|
||||
skip StationEventComposite messages without stateTransitions (20150706)
|
||||
|
||||
Version 3.2.0.37
|
||||
-----------------------------------
|
||||
accept Component to be null even if designator is set in BoardData/improved logging (20150909)
|
||||
|
||||
Version 3.2.0.38
|
||||
-----------------------------------
|
||||
new internal API Version (AsmApi.dll) / ASM Release 80 (20151209)
|
||||
|
||||
Version 3.2.0.39
|
||||
-----------------------------------
|
||||
return timestamp values as UTC (like 2016-10-07T12:33:05.0000000Z instead of 2016-10-07T12:33:05.0000000) (20162110)
|
||||
|
||||
Version 3.2.0.40
|
||||
-----------------------------------
|
||||
new asm client lib 2.3.0.1 (20170215)
|
||||
|
||||
Version 3.2.0.41
|
||||
-----------------------------------
|
||||
new asm client lib 2.3.0.2
|
||||
new optional config parameter to configure inkspot fiducial handling
|
||||
added all optional parameters to configuration file (20170706)
|
||||
use date 01.01.0001 for any date from iTAC <= 01.01.1970 in PackagingUnitControl (20180201)
|
||||
|
||||
Version 3.2.0.42
|
||||
-----------------------------------
|
||||
new asm client lib 2.3.0.3 (20180809)
|
||||
145
interface/asm/dotnet/Oib5xGUI/src/main/resources/app.config
Normal file
145
interface/asm/dotnet/Oib5xGUI/src/main/resources/app.config
Normal file
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
|
||||
</configSections>
|
||||
|
||||
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||
</startup>
|
||||
|
||||
|
||||
<appSettings>
|
||||
<!-- The name or the IP address of the OIB Core Host -->
|
||||
<add key="OIBCoreHostName" value="192.168.5.51" />
|
||||
|
||||
<!-- this iTAC.OIB.Adapter should work for this line. -->
|
||||
<!-- the line Name is appended to the endpoint urls to distinguish the endpoints in oib -->
|
||||
<!--add key="LineName" value="Line1\Line1sync"/>
|
||||
<add key="LineName" value="Line4\Line 4.2"/-->
|
||||
<add key="LineName" value="Line1\Line1sync"/>
|
||||
<add key ="isSetupStation" value="false"/>
|
||||
|
||||
<!-- set to true for iTAC failure analysis only -->
|
||||
<add key ="offlineMode" value="false"/>
|
||||
|
||||
<!-- The listen port is the port the adapter will listen for Java connections -->
|
||||
<add key="ListenPort" value="33020"/>
|
||||
|
||||
<!-- every iTAC.OIB.Adapter endpoint has a separate URL and port. together with the service name results a uniqe URL -->
|
||||
<!-- the endpoint-url may contain special characters!!! -->
|
||||
<!-- e.g. http://OibAdapterPc:33334/Itac.Oib.SetupCenterExternalControl/Line1 -->
|
||||
<add key="SiplaceProEventPort" value="9500"/>
|
||||
<add key="DisplayServiceEventPort" value="9600"/>
|
||||
<!-- default port 9600 -->
|
||||
<add key="SetupCenterNotifyPort" value="33333"/>
|
||||
<add key="SetupCenterExternalControlPort" value="33334"/>
|
||||
<add key="TraceServicePort" value="33335"/>
|
||||
<add key="MonitoringReceiverPort" value="33336"/>
|
||||
<add key="LineControlReceiverPort" value="33338"/>
|
||||
<add key="BoardGateKeeperEventPort" value="33339"/>
|
||||
<add key="DekPrinterExternalControlPort" value="33337"/>
|
||||
|
||||
<!-- define wether messages should be logged or not. -->
|
||||
<add key="xmlExport" value="true"/>
|
||||
<add key="xmlLogging" value="true"/>
|
||||
<!-- define, which messages should be logged -->
|
||||
<add key="TraceabilityData" value="true"/>
|
||||
<add key="DownloadData" value="false"/>
|
||||
<add key="StationEventComposite" value="false"/>
|
||||
<add key="MaterialMovedReport" value="true"/>
|
||||
<add key="SetupChangedReport" value="false"/>
|
||||
<add key="FeederPlacedReport" value="false"/>
|
||||
<add key="TablePlacedReport" value="false"/>
|
||||
<add key="TableRemovedReport" value="false"/>
|
||||
<add key="BoardProcessedData" value="false"/>
|
||||
<add key="CheckInData" value="true"/>
|
||||
<add key="FeederRemovedReport" value="false"/>
|
||||
<add key="PackagingUnitConsumedReport" value="true"/>
|
||||
<add key="PackagingUnitCreatedReport" value="false"/>
|
||||
<add key="LockStateChangedReport" value="false"/>
|
||||
<add key="LineChangeoverEvent" value="true"/>
|
||||
<!-- the following two are for synchronous call on scanning packaging units -->
|
||||
<add key="PackagingUnitLocation" value="true"/>
|
||||
<add key="ExternalControlResult" value="true"/>
|
||||
<add key="BoardRequestData" value="true"/>
|
||||
|
||||
<!-- maximum age for boardProcessedMessages to be processed, in 'hours:minutes:seconds' -->
|
||||
<add key="BoardProcessedDataMaxAge" value="00:30:00"/>
|
||||
<add key="StationEventMaxAge" value="00:05:00"/>
|
||||
|
||||
<!-- This setting allows to stop the line if the trace data is rejected by iTac MES Suite -->
|
||||
<!-- In this case the input conveyor of the last station is stopped -->
|
||||
<add key="Asm.As.Oib.Client.Extensions.StopLineOnTraceDataRejected" value="true"/>
|
||||
<add key="Asm.As.Oib.Client.Extensions.OnVIHDataRejected.ShowMessage" value="true"/>
|
||||
<add key="Asm.As.Oib.Client.Extensions.OnVIHDataRejected.StationStop" value="true"/>
|
||||
<!-- timing values for event based mode -->
|
||||
<add key="Asm.As.Oib.Client.Extensions.ChangeoverIncompleteWarningSeconds" value="120"/>
|
||||
<add key="Asm.As.Oib.Client.Extensions.ChangeoverIncompleteRepeatWarningSeconds" value="120"/>
|
||||
<!-- from 2.3.0.2: Virtual Inkspot handling definition
|
||||
True: VirtualInkspotHandler will only request iTAC if a BarcodeFiducial is configured for the board in SiplacePro. ("Customer-Case")
|
||||
False: VirtualInkspotHandler will request iTAC always.
|
||||
Default: true -->
|
||||
<add key="Asm.As.Oib.Client.Extensions.VirtualInkspotHandlerConsidersBarcodeFiducial" value="true"/>
|
||||
|
||||
<!--These are values a user can override if neccessary (for info see MSDN for binding parameters), if not provided the defaults are used-->
|
||||
<!-- <add key="Siemens.Siplace.OIB.SiplacePro.Proxies.ReliableChannel.MaxNumberOfRetryAttempts" value="1" />-->
|
||||
<!-- <add key="Siemens.Siplace.OIB.SiplacePro.Proxies.ReliableChannel.RetryFrequency" value="2000" />-->
|
||||
<!-- This is the interval in ms when the proxy checks the connection to the Service,-->
|
||||
<!-- it must be greater or equal to 1000ms; if this is not present, a default value of 1 minute is used -->
|
||||
<!-- <add key="Siemens.Siplace.OIB.SiplacePro.Proxies.ReliableChannel.CheckAliveFrequency" value="60000" />-->
|
||||
|
||||
</appSettings>
|
||||
|
||||
<log4net>
|
||||
<appender name="LogFileAppenderFull" type="log4net.Appender.RollingFileAppender">
|
||||
<file value=".\Log\itac.oib.proxy.full.log" />
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Size" />
|
||||
<maxSizeRollBackups value="10" />
|
||||
<maximumFileSize value="10MB" />
|
||||
<staticLogFileName value="true" />
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<header value="" />
|
||||
<footer value="" />
|
||||
<conversionPattern value="%date{dd.MM.yyyy HH:mm:ss,f} %8.10c %-5p %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
<appender name="LogFileAppenderError" type="log4net.Appender.RollingFileAppender">
|
||||
<file value=".\Log\itac.oib.proxy.error.log" />
|
||||
<appendToFile value="true" />
|
||||
<rollingStyle value="Size" />
|
||||
<maxSizeRollBackups value="3" />
|
||||
<maximumFileSize value="10MB" />
|
||||
<staticLogFileName value="true" />
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="WARN" />
|
||||
<levelMax value="FATAL" />
|
||||
</filter>
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<header value="" />
|
||||
<footer value="" />
|
||||
<conversionPattern value="%date{dd.MM.yyyy HH:mm:ss,f} %8.10c %-5p %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
|
||||
<layout type="log4net.Layout.PatternLayout">
|
||||
<header value="[Header]\r\n" />
|
||||
<footer value="[Footer]\r\n" />
|
||||
<conversionPattern value="%date{dd.MM.yyyy HH:mm:ss,f} %8.10c %-5p %m%n" />
|
||||
</layout>
|
||||
<filter type="log4net.Filter.LevelRangeFilter">
|
||||
<levelMin value="DEBUG" />
|
||||
<levelMax value="FATAL" />
|
||||
</filter>
|
||||
</appender>
|
||||
<root>
|
||||
<level value="DEBUG" />
|
||||
<appender-ref ref="LogFileAppenderFull" />
|
||||
<appender-ref ref="LogFileAppenderError" />
|
||||
<appender-ref ref="ConsoleAppender" />
|
||||
</root>
|
||||
</log4net>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user