initialize
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
#region Namespace
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using com.itac.mes.tools;
|
||||
using com.itac.mes.proxy.business;
|
||||
using Constants = com.itac.mes.tools.Constants;
|
||||
using OibMonBizObj = Asm.As.Oib.Monitoring.Proxy.Business.EventArgs;
|
||||
using OibClient = Asm.As.Oib.Client;
|
||||
using com.itac.oib.linecontrol.data;
|
||||
#endregion
|
||||
|
||||
namespace Itac.Oib
|
||||
{
|
||||
public class SpiReceiver : IDisposable, IReceiver
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly OIBEventHandler _eventHandler;
|
||||
private readonly OibClient.OibSpiEvents _oibSpiEvents;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public SpiReceiver(OibClient.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, OibClient.RecipeSecifiedForStationEventArgs args)
|
||||
{
|
||||
try
|
||||
{
|
||||
var downloadData = new 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
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user