158 lines
7.2 KiB
C#
158 lines
7.2 KiB
C#
#region << 版 本 注 释 >>
|
||
/*----------------------------------------------------------------
|
||
* 创建者:Hupe
|
||
* 创建时间:2021/10/14 20:04:50
|
||
* 版本:V1.0.0
|
||
* 描述:
|
||
*
|
||
* ----------------------------------------------------------------
|
||
* 修改人:
|
||
* 时间:
|
||
* 修改说明:
|
||
*
|
||
* 版本:V1.0.1
|
||
*----------------------------------------------------------------*/
|
||
#endregion << 版 本 注 释 >>
|
||
|
||
using ARI.EAP.HOST.Common;
|
||
using ARI.EAP.HOST.MQ;
|
||
using ARI.EAP.HOST.MQ.body;
|
||
using ARI.EAP.HOST.SRD;
|
||
using Glorysoft.SECS.EQP;
|
||
using Glorysoft.SECS.EQP.Common;
|
||
using Glorysoft.SECS.EQP.Utilities;
|
||
using Glorysoft.SECSwell;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
|
||
namespace ARI.EAP.HOST.Handlers.EventHandlers
|
||
{
|
||
|
||
public class SlotlistHandler : IEventHandler
|
||
{
|
||
public void Execute(SECSTransaction trans, EVENT even)
|
||
{
|
||
try
|
||
{
|
||
MQMessage mQMessage = new MQMessage();
|
||
mQMessage.header.messageName = "SlotList";
|
||
SlotListBody slotListBody = new SlotListBody();
|
||
slotListBody.spoolingFlag = EquipmentStatus.SpoolingFlag.ToString();
|
||
SlotList slot_CV1 = new SlotList();
|
||
SlotList slot_SBS = new SlotList();
|
||
SlotList slot_EDS1 = new SlotList();
|
||
SlotList slot_EDS2 = new SlotList();
|
||
SlotList slot_CV2 = new SlotList();
|
||
slotListBody.slotList.Add(slot_CV1);
|
||
slotListBody.slotList.Add(slot_SBS);
|
||
slotListBody.slotList.Add(slot_EDS1);
|
||
slotListBody.slotList.Add(slot_EDS2);
|
||
slotListBody.slotList.Add(slot_CV2);
|
||
int index = 1;
|
||
foreach (var key in even.validVariables)
|
||
{
|
||
string name = Configurations.conf.sRDConfiguration.tryGetSVOrDV(key);
|
||
switch (name)
|
||
{
|
||
case ("Clock"):
|
||
{
|
||
slotListBody.eventTimestamp = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index).Value.ToString();
|
||
}
|
||
break;
|
||
default:
|
||
{
|
||
if (name.Equals("SubstrateID_CV1"))
|
||
{
|
||
for(int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].substrateId = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index+i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("LocationId_CV1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].locationId = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Target_A_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].target_A = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Target_B_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].target_B = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Target_C_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].target_C = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Target_D_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].target_D = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Reroute_A_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].reroute_A = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Reroute_B_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].reroute_B = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Reroute_C_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].reroute_C = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
else if (name.Equals("Reroute_D_1"))
|
||
{
|
||
for (int i = 0; i < 5; i++)
|
||
{
|
||
slotListBody.slotList[i].reroute_D = trans.Primary.Root.Item(3).Item(1).Item(2).Item(index + i).Value.ToString();
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
trans.Primary.Root.Item(3).Item(1).Item(2).Item(index).Name = name;
|
||
index++;
|
||
}
|
||
Global.MF.addlog(trans, LoggerService.Receive, even.name, 0);
|
||
LoggerService.SECSLogger.Info(trans.Primary);
|
||
Global.MF.addlog(trans, LoggerService.Send, even.name, 1);
|
||
LoggerService.SECSLogger.Info(trans.Secondary);
|
||
|
||
mQMessage.body = slotListBody;
|
||
Task.Run(() => MainForm.mq.EAPRequest(mQMessage));
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
LoggerService.SECSLogger.Error(e);
|
||
}
|
||
}
|
||
}
|
||
} |