|
|
|
@ -24,104 +24,104 @@ namespace Rs.MotionPlat.Commom
|
|
|
|
|
SysConfigParam.Init();
|
|
|
|
|
int errNum = 0;
|
|
|
|
|
//Task.Run(() => {
|
|
|
|
|
#region 初始化固高卡
|
|
|
|
|
ErrorCode errCode = GugaoPulseCardManager.Instance.Init();
|
|
|
|
|
if (errCode > ErrorCode.Ok)
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
MessageQueue.Instance.Warn($"Gugao motion card load fail {errCode}");
|
|
|
|
|
LogHelper.Debug($"Gugao motion card load fail {errCode}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Gugao motion card load success");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 初始化固高卡
|
|
|
|
|
ErrorCode errCode = GugaoPulseCardManager.Instance.Init();
|
|
|
|
|
if (errCode > ErrorCode.Ok)
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
MessageQueue.Instance.Warn($"Gugao motion card load fail {errCode}");
|
|
|
|
|
LogHelper.Debug($"Gugao motion card load fail {errCode}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Gugao motion card load success");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 初始化ztm卡
|
|
|
|
|
errCode = ZtmCardManager.Instance.Init();
|
|
|
|
|
if (errCode > ErrorCode.Ok)
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
MessageQueue.Instance.Warn($"rs motion card load fail {errCode}"); return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("rs motion card load ok");
|
|
|
|
|
#region 初始化ztm卡
|
|
|
|
|
errCode = ZtmCardManager.Instance.Init();
|
|
|
|
|
if (errCode > ErrorCode.Ok)
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
MessageQueue.Instance.Warn($"rs motion card load fail {errCode}"); return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("rs motion card load ok");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 初始化IO
|
|
|
|
|
IoManager.Instance.Init();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 初始化IO
|
|
|
|
|
IoManager.Instance.Init();
|
|
|
|
|
#endregion
|
|
|
|
|
#region 链接相机
|
|
|
|
|
//链接相机
|
|
|
|
|
ECameraErrorCode ceCode = HikCamera.Instance.Init();
|
|
|
|
|
if (ceCode > ECameraErrorCode.Ok)
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
MessageQueue.Instance.Warn(ceCode.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Camera load ok!");
|
|
|
|
|
|
|
|
|
|
#region 链接相机
|
|
|
|
|
//链接相机
|
|
|
|
|
ECameraErrorCode ceCode = HikCamera.Instance.Init();
|
|
|
|
|
if (ceCode > ECameraErrorCode.Ok)
|
|
|
|
|
int ret = HikCamera.Instance.SetReverseX("upCamera", EDir.Y, false);
|
|
|
|
|
ret += HikCamera.Instance.SetReverseX("upCamera", EDir.X, false);
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
MessageQueue.Instance.Warn(ceCode.ToString());
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ret = 0;
|
|
|
|
|
ret = HikCamera.Instance.SetReverseX("downCamera", EDir.X, true);
|
|
|
|
|
ret += HikCamera.Instance.SetReverseX("downCamera", EDir.Y, false);
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Camera load ok!");
|
|
|
|
|
|
|
|
|
|
int ret = HikCamera.Instance.SetReverseX("upCamera", EDir.Y, false);
|
|
|
|
|
ret += HikCamera.Instance.SetReverseX("upCamera", EDir.X, false);
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
ret = 0;
|
|
|
|
|
ret = HikCamera.Instance.SetReverseX("downCamera", EDir.X, true);
|
|
|
|
|
ret += HikCamera.Instance.SetReverseX("downCamera", EDir.Y, false);
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("upCamera");
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("locationCamera");
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("scanCamera");
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//使能所有轴卡
|
|
|
|
|
AxisControl.AllEnable();
|
|
|
|
|
SafeControl.Instance.Init();
|
|
|
|
|
NozzleManager.Init();
|
|
|
|
|
TestCenter.Instance.Init();
|
|
|
|
|
TrayPointManager.LoadPoint();
|
|
|
|
|
AxisControl.AllStop();
|
|
|
|
|
if (errNum==0)
|
|
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("upCamera");
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Init finished");
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("locationCamera");
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Init fail");
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
Ops.On("上下气缸电磁阀原位");
|
|
|
|
|
Ops.Off("上下气缸电磁阀动位");
|
|
|
|
|
Ops.Off("下左相机光源触发");
|
|
|
|
|
Ops.Off("下右相机光源触发");
|
|
|
|
|
Ops.Off("上相机光源触发");
|
|
|
|
|
|
|
|
|
|
ret = HikCamera.Instance.StartGrab("scanCamera");
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Camera init error");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//使能所有轴卡
|
|
|
|
|
AxisControl.AllEnable();
|
|
|
|
|
SafeControl.Instance.Init();
|
|
|
|
|
NozzleManager.Init();
|
|
|
|
|
TestCenter.Instance.Init();
|
|
|
|
|
TrayPointManager.LoadPoint();
|
|
|
|
|
AxisControl.AllStop();
|
|
|
|
|
if (errNum == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Init finished");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Insert("Init fail");
|
|
|
|
|
}
|
|
|
|
|
Ops.On("上下气缸电磁阀原位");
|
|
|
|
|
Ops.Off("上下气缸电磁阀动位");
|
|
|
|
|
Ops.Off("下左相机光源触发");
|
|
|
|
|
Ops.Off("下右相机光源触发");
|
|
|
|
|
Ops.Off("上相机光源触发");
|
|
|
|
|
TurnoverSlotOffset.Init();
|
|
|
|
|
MonitorSystemButton.Instance.Start();
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
@ -130,17 +130,18 @@ namespace Rs.MotionPlat.Commom
|
|
|
|
|
|
|
|
|
|
public static void Start()
|
|
|
|
|
{
|
|
|
|
|
TakeTrayFlow.Instance.Start();
|
|
|
|
|
StockManager.Instance.Start();
|
|
|
|
|
Task.Run(() => {
|
|
|
|
|
MachineManage.Instance.MachineStatus = EMachineStatus.Working;
|
|
|
|
|
TakeTrayFlow.Instance.Start();
|
|
|
|
|
StockManager.Instance.Start();
|
|
|
|
|
WorkEnvironment.Instance.Ready();
|
|
|
|
|
if (WorkEnvironment.Instance.EnvReadyOkEvent.WaitOne())
|
|
|
|
|
{
|
|
|
|
|
WorkFlow.Instance.Start();
|
|
|
|
|
TurnoverFlow.Instance.Start();
|
|
|
|
|
MachineManage.Instance.RunState = ERunState.Waiting;
|
|
|
|
|
MachineManage.Instance.MachineStatus = EMachineStatus.Working;
|
|
|
|
|
MachineManage.Instance.SetCenterMachineStatus(ERunStatus.Started);
|
|
|
|
|
MachineManage.Instance.SetLoadUnloadStatus(ERunState.Waiting);
|
|
|
|
|
MachineManage.Instance.SetLocalMachineStatus(EMachineStatus.Working);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|