Commit 2fff9226 LN

增加DeviceType

1 个父辈 459a7efc
此文件类型无法预览
...@@ -17,7 +17,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -17,7 +17,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public DischargeLine_Config Config; public DischargeLine_Config Config;
public DischargeLine(string cid, DischargeLine_Config config) public DischargeLine(string cid, DischargeLine_Config config)
{ {
baseConfig = config; baseConfig = config;
...@@ -25,11 +25,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -25,11 +25,11 @@ namespace OnlineStore.DeviceLibrary
this.Config = config; this.Config = config;
IsDebug = config.IsDebug.Equals(1); IsDebug = config.IsDebug.Equals(1);
baseConfig = config; baseConfig = config;
Name = (" " + "_出料皮带线_" + DeviceID % 100 + " ").ToUpper(); Name = (" " + "_出料皮带线_" + DeviceID % 100 + " ").ToUpper();
Init(); Init();
UseAxis = false; UseAxis = false;
MoveInfo = new LineMoveInfo(DeviceID, "出料皮带线-" + DeviceID + "-MoveInfo"); MoveInfo = new LineMoveInfo(DeviceID, "出料皮带线-" + DeviceID + "-MoveInfo");
SecondMoveInfo = new LineMoveInfo(DeviceID, "出料皮带线-" + DeviceID + "-SecondMoveInfo"); SecondMoveInfo = new LineMoveInfo(DeviceID, "出料皮带线-" + DeviceID + "-SecondMoveInfo");
} }
/// <summary> /// <summary>
...@@ -46,75 +46,81 @@ namespace OnlineStore.DeviceLibrary ...@@ -46,75 +46,81 @@ namespace OnlineStore.DeviceLibrary
//TODO 调试时暂时注释 //TODO 调试时暂时注释
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
bool result = ReturnHome(); bool result = ReturnHome();
if (result&&isDebug) if (result && isDebug)
{ {
mainTimer.Enabled = true; mainTimer.Enabled = true;
} }
return result; return result;
} }
/// <summary> /// <summary>
/// 停止运行 /// 停止运行
/// </summary> /// </summary>
public override void StopRun() public override void StopRun()
{ {
// preTrayNum = 0;
// currMoveTrayNum = 0;
if (mainTimer != null) if (mainTimer != null)
{ {
mainTimer.Enabled = false; mainTimer.Enabled = false;
} }
StopMove(); StopMove();
//停止运行时,把所有IO 置零 //停止运行时,把所有IO 置零
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.DLine_RunStatus, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.DLine_RunAlarm, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW); IOMove(IO_Type.DLine_Run1, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW); IOMove(IO_Type.DLine_Run2, IO_VALUE.LOW);
IOMove(IO_Type.BeforeAfterCylinder_Before, IO_VALUE.LOW); IOMove(IO_Type.DLine_Run3, IO_VALUE.LOW);
IOMove(IO_Type.BeforeAfterCylinder_After, IO_VALUE.LOW); IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.LOW);
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW); IOMove(IO_Type.SeparateDevice_Up, IO_VALUE.LOW);
IOMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW); IOMove(IO_Type.SeparateDevice_Down, IO_VALUE.LOW);
IOMove(IO_Type.ClampCylinder_Slack, IO_VALUE.LOW);
IOMove(IO_Type.ClampCylinder_Tighten, IO_VALUE.LOW);
runStatus = LineRunStatus.Wait; runStatus = LineRunStatus.Wait;
} }
public override void TimerProcess() public override void TimerProcess()
{ {
if (isInPro) if (IOValue(IO_Type.DLine_SuddenStop).Equals(IO_VALUE.LOW))
{ {
WarnMsg = Name + "收到急停信号";
LogUtil.error(WarnMsg);
Alarm(LineAlarmType.SuddenStop);
return; return;
} }
isInPro = true;
try
{
if (IsDebug)
{
isInPro = false;
return;
}
BusyMoveProcess(); if (IOValue(IO_Type.DLine_Reset).Equals(IO_VALUE.HIGH))
//判断流水线打开了才可以运行 {
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None)) if (alarmType.Equals(LineAlarmType.None))
{ {
LineBean lineBean = LineManager.Line; if (MoveInfo.MoveType.Equals(LineMoveType.None))
if (lineBean.isCanProcessLine() && IOManager.IOValue(IO_Type.DriveMotor_Run, 0).Equals(IO_VALUE.HIGH) && lineBean.runStatus >= LineRunStatus.Runing && lineBean.IsSleep.Equals(false)) {
LogUtil.error(Name + "收到复位信号,当前无报警,不需要复位");
}
else
{ {
StartCheckFixture(); LogUtil.error(Name + "收到复位信号,当前无报警,正在" + MoveInfo.MoveType + "处理中,不需要复位");
} }
} }
IOTimeOutProcess(); else
{
LogUtil.info(Name + "收到复位信号,开始复位");
Reset();
}
return;
} }
catch (Exception ex)
BusyMoveProcess();
//判断流水线打开了才可以运行
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{ {
LogUtil.error(Name + "TimerProcess出错:" + ex.ToString()); //LineBean lineBean = LineManager.Line;
//if (lineBean.isCanProcessLine() && IOManager.IOValue(IO_Type.DriveMotor_Run, 0).Equals(IO_VALUE.HIGH) && lineBean.runStatus >= LineRunStatus.Runing && lineBean.IsSleep.Equals(false))
//{
// StartCheckFixture();
//}
} }
IOTimeOutProcess();
isInPro = false;
} }
/// <summary> /// <summary>
...@@ -123,24 +129,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,24 +129,13 @@ namespace OnlineStore.DeviceLibrary
public bool ReturnHome() public bool ReturnHome()
{ {
mainTimer.Stop(); mainTimer.Stop();
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
LogInfo("开始原点返回: (上下气缸回原点,阻挡气缸输入=0 )开始"); LogInfo("开始原点返回: (重置灯状态,定位气缸下降 )开始");
MoveInfo.NewMove(LineMoveType.ReturnHome); MoveInfo.NewMove(LineMoveType.ReturnHome);
//移载装置原点状态:顶升气缸下降端,前后气缸后退端,上下气缸上升端,夹料气缸放松端,阻挡气缸输入=0 StartReset();
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if (IsDebug)
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
}
return true; return true;
} }
/// <summary> /// <summary>
...@@ -148,90 +143,34 @@ namespace OnlineStore.DeviceLibrary ...@@ -148,90 +143,34 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public override bool Reset() public override bool Reset()
{ {
WarnMsg = ""; WarnMsg = "";
MoveInfo.EndMove();
//如果正在出库中,需要减去托盘号 SecondMoveInfo.EndMove();
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore)) alarmType = LineAlarmType.None;
{ LogInfo("开始重置: (重置灯状态,定位气缸下降 )开始;");
//LogInfo("重置之前发现在出库执行中,减去托盘数;");
//减去需要的盘数
//TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove();
}
alarmType = LineAlarmType.None;
//重置时清理盘号,从头开始判断
// preTrayNum = 0;
// currMoveTrayNum = 0;
LogInfo("开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;");
runStatus = LineRunStatus.Reset; runStatus = LineRunStatus.Reset;
SecondMoveInfo.EndMove();
MoveInfo.NewMove(LineMoveType.Reset); MoveInfo.NewMove(LineMoveType.Reset);
StartReset();
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up); return true;
}
private void StartReset()
{
MoveInfo.NextMoveStep(LineMoveStep.DL_R_CylinderDown);
CylinderMove(MoveInfo, IO_Type.SeparateDevice_Up, IO_Type.SeparateDevice_Down);
IOMove(IO_Type.DLine_RunStatus, IO_VALUE.HIGH);
IOMove(IO_Type.DLine_RunAlarm, IO_VALUE.LOW);
if (IsDebug) if (IsDebug)
{ {
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); mainTimer.Start();
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
} }
isInPro = false; isInPro = false;
return true;
} }
/// <summary> /// <summary>
/// 重置处理 /// 重置处理
/// </summary> /// </summary>
protected override void ResetProcess() protected override void ResetProcess()
{ {
if (MoveInfo.IsInWait) ReturnHomeProcess();
{
CheckWait(MoveInfo);
}
else if (SecondMoveInfo.IsInWait)
{
CheckWait(SecondMoveInfo);
}
if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait)
{
//流水线各装置复原位,夹料气缸状态不变
//阻挡气缸全部=0
//上下气缸上升,、
//上升到位,顶升气缸下降,前后气缸回退
//复位时夹紧气缸需要发送,不然后面出入库会有问题
switch (MoveInfo.MoveStep)
{
case LineMoveStep.MH_UpDownHomeMove:
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
LogInfo("重置: (上下轴原点返回完成,上下轴走到待机点 )开始");
// UpdownUpMove();
break;
case LineMoveStep.MH_UpDownCylinder_Up:
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
LogInfo("重置: (上升到位,顶升气缸下降,前后气缸回退 )开始");
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
break;
case LineMoveStep.MH_OtherCylinder_Back:
LogInfo("重置完成!");
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
break;
//TODO 需要继续之前的的出入库处理
//ContinueInOutStore();
default: break;
}
}
} }
/// <summary> /// <summary>
/// 原点返回处理 /// 原点返回处理
...@@ -242,7 +181,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -242,7 +181,7 @@ namespace OnlineStore.DeviceLibrary
{ {
CheckWait(MoveInfo); CheckWait(MoveInfo);
} }
if (SecondMoveInfo.IsInWait) else if (SecondMoveInfo.IsInWait)
{ {
CheckWait(SecondMoveInfo); CheckWait(SecondMoveInfo);
} }
...@@ -250,102 +189,47 @@ namespace OnlineStore.DeviceLibrary ...@@ -250,102 +189,47 @@ namespace OnlineStore.DeviceLibrary
{ {
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case LineMoveStep.MH_UpDownHomeMove: case LineMoveStep.DL_R_CylinderDown:
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up); LogInfo(MoveInfo.MoveType + "完成,开始转动皮带!");
LogInfo("原点返回: (上下轴原点返回完成,上下轴走到待机点 )开始"); MoveInfo.NextMoveStep(LineMoveStep.DL_R_StartRun);
// UpdownUpMove(); IOMove(IO_Type.DLine_Run1, IO_VALUE.HIGH);
IOMove(IO_Type.DLine_Run2, IO_VALUE.HIGH);
IOMove(IO_Type.DLine_Run3, IO_VALUE.HIGH);
IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
break; break;
case LineMoveStep.MH_UpDownCylinder_Up: case LineMoveStep.DL_R_StartRun:
LogInfo(MoveInfo.MoveType + "完成!");
LogInfo("原点返回:(上升到位,顶升气缸下降,前后气缸回退 )开始"); runStatus = LineRunStatus.Runing;
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
break;
case LineMoveStep.MH_OtherCylinder_Back:
MoveInfo.EndMove(); MoveInfo.EndMove();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
LogInfo("原点返回完成!");
runStatus = LineRunStatus.Runing;
//如果是调试模式,出料装置两个阻挡气缸落下,并且不再移动
if (IsDebug)
{
lineStatus = LineStatus.Debugging;
}
else
{
lineStatus = LineStatus.StoreOnline;
}
break; break;
default: break; default: break;
} }
} }
} }
protected override void StopMoveProcess() protected override void StopMoveProcess()
{ {
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (SecondMoveInfo.IsInWait)
{
CheckWait(SecondMoveInfo);
}
if (!MoveInfo.IsInWait && !SecondMoveInfo.IsInWait)
{
switch (MoveInfo.MoveStep)
{
//流水线各装置复原位,夹料气缸状态不变 //阻挡气缸全部=0 //上下气缸上升,、 //上升到位,顶升气缸下降,前后气缸回退
case LineMoveStep.MH_UpDownCylinder_Up:
{
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
LogInfo("停止运动: (上升到位,顶升气缸下降,前后气缸回退 )开始");
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
break;
}
case LineMoveStep.MH_OtherCylinder_Back:
{
LogInfo("停止运行完成!");
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
break;
}
default: break;
}
}
} }
/// <summary> /// <summary>
/// 停止运动 /// 停止运动
/// </summary> /// </summary>
public override void StopMove() public override void StopMove()
{ {
//如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
LogInfo("停止运动时出库执行中,减去托盘数;");
//减去需要的盘数
// TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove();
}
runStatus = LineRunStatus.Busy; runStatus = LineRunStatus.Busy;
MoveInfo.EndMove();
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
LogInfo("停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 "); LogInfo("停止运动:(定位气缸下降,皮带线停转 )开始 ");
CylinderMove(null, IO_Type.SeparateDevice_Up, IO_Type.SeparateDevice_Down);
MoveInfo.NewMove(LineMoveType.StopMove);
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
// UpdownUpMove();
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
IOMove(IO_Type.DLine_Run1, IO_VALUE.LOW);
IOMove(IO_Type.DLine_Run2, IO_VALUE.LOW);
IOMove(IO_Type.DLine_Run3, IO_VALUE.LOW);
IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.LOW);
} }
......
...@@ -13,39 +13,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,39 +13,10 @@ namespace OnlineStore.DeviceLibrary
#region 托盘检测 #region 托盘检测
private void StartCheckFixture() private void StartCheckFixture()
{ {
int num = TrayManager.GetNum(DeviceID);
if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
{
//托盘在两个阻挡内
if (num > 0)
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
// SecondMoveInfo.EndStepWait();
}
else
{
LogUtil.error(Name + "检测到check4亮,但是为获取到托盘号,StartCheckFixture失败~");
}
}
else if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.HIGH))
{
//托盘在第一个阻挡处
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
CheckLog(" 托盘检测:料盘检测 SecondStoreMove(MIO_01_StopCylinder1Down阻挡气缸1-1下降 ,最多等待1秒)");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Fixture_Check_4, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
} }
private bool CheckIsNeedOutStore() private bool CheckIsNeedOutStore()
{ {
//TODO 判断是否是需要移栽出料的料盘
return false; return false;
} }
protected override void CheckFixtureProcess() protected override void CheckFixtureProcess()
...@@ -62,180 +33,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -62,180 +33,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
#region 托盘检测
if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_01_StopCylinder1Down))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_02_FixtureCheck 阻挡气缸1-1上升,等待 阻挡2托盘检测=1)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_02_FixtureCheck))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_StopCylinder2Down);
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down1, IO_VALUE.LOW));
// SecondMoveInfo.EndStepWait();
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_03_StopCylinder2Down))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_04_Wait ,等待编码信号稳定)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_04_Wait);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_04_Wait))
{
try
{
//判断是否需要顶升
bool isNeed = false;
//此处先对托盘号进行验证
currMoveTrayNum = TrayManager.GetNum(DeviceID);
bool isFull = TrayManager.IsFixTureFull(currMoveTrayNum);
if (TrayManager.RightTrayCode(currMoveTrayNum, preTrayNum, false))
{
//出料中,需要拦盘
if (CheckIsNeedOutStore())
{
//preTrayNum = currMoveTrayNum;
SecondMoveInfo.MoveParam = new InOutParam(currMoveTrayNum);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_05_CodeRember);
SecondMoveInfo.EndStepWait();
return;
}
}
else
{
string msg = Name + " 托盘顺序错乱,上个托盘号【" + preTrayNum + "】当前托盘号 【" + currMoveTrayNum + "】最大盘号【" + TrayManager.MaxTrayNum + "】";
TrayManager.UpdateTrayNumError(DeviceID, msg);
LogUtil.error(msg);
return;
}
if (isNeed)
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_05_WaitTime 等待一秒钟)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_05_WaitTime);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else
{
LogInfo(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前" + (isFull ? "有料托盘" : "空托盘") + "【" + currMoveTrayNum + "】没有出出料任务,放盘通过~");
// preTrayNum = currMoveTrayNum;
if (TrayManager.ErrorStoreId.Equals(DeviceID))
{
TrayManager.UpdateTrayNumError(-1, "");
}
CheckLog("托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_07_WaitCanGo);
//if (DeviceID.Equals(2))
//{
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay());
// SecondMoveInfo.OneWaitCanEndStep = true;
//}
}
}
catch (Exception ex)
{
LogUtil.error("判断托盘是否需要顶升出错:" + ex.ToString());
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_05_WaitTime))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_06_TopCylinderUp 顶升气缸上 升 )");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopCylinderUp);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP);
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_06_TopCylinderUp))
{
CheckLog("托盘检测(流水线阻挡)SecondStoreMove:(MIO_07_TopCylinderUpWait ,顶升气缸上升时等待1秒钟,再下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_07_TopCylinderUpWait);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_07_TopCylinderUpWait))
{
CheckLog("托盘检测(流水线阻挡)*************** 托盘号【" + currMoveTrayNum + "】");
//托盘号正确
//preTrayNum = num;
bool isNeedMove = false;
//判断盘是空盘,空盘并且编号正确才需要放料盘过去
if (CheckIsNeedOutStore())
{
SecondMoveInfo.MoveParam = new InOutParam(currMoveTrayNum);
isNeedMove = true;
LogInfo(SecondMoveInfo.MoveNum + "*************** 托盘号【" + currMoveTrayNum + "】可以放出料托盘,正在出料中,移栽料盘");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_05_CodeRember);
SecondMoveInfo.EndStepWait();
}
else
{
//preTrayNum = num;
if (TrayManager.ErrorStoreId.Equals(DeviceID))
{
TrayManager.UpdateTrayNumError(-1, "");
}
CheckLog("托盘检测 SecondStoreMove:(MO_09_TopCylinder_Down ,托盘号【" + currMoveTrayNum + "】,直接放盘通过,顶升气缸下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_06_TopCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_08_WaitInStore) && MoveInfo.MoveType.Equals(LineMoveType.None))
{
CheckLog("托盘放行 SecondStoreMove:(MIO_09_WaitLetFixtureGo ,等待移栽完成后放开阻挡)");
StartOutStoreMove(SecondMoveInfo.MoveParam);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_09_WaitLetFixtureGo);
}
#endregion
#region 不需要出出料,直接放行
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_06_TopCylinder_Down))
{
CheckLog("托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_07_WaitCanGo);
if (DeviceID.Equals(2))
{
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay());
SecondMoveInfo.OneWaitCanEndStep = true;
}
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_07_WaitCanGo))
{
CheckLog("托盘放行 SecondStoreMove:(MO_10_StopCylinder2_Down ,阻挡气缸1-2下降)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_10_StopCylinder2_Down);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
// SecondMoveInfo.EndStepWait();
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_10_StopCylinder2_Down))
{
CheckLog("托盘放行 SecondStoreMove:(MO_11_Tray_Check , 阻挡2托盘检测=0), 延时2秒)");
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_11_Tray_Check);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.LOW));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_11_Tray_Check))
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_StopCylinder_Back);
CheckLog("托盘放行 SecondStoreMove:(MO_12_StopCylinder_Back , 阻挡气缸1-2上升 )");
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
}
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_12_StopCylinder_Back))
{
preTrayNum = currMoveTrayNum;
CheckLog("托盘放行 SecondStoreMove:(托盘放行结束) ");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.EndMove();
}
#endregion
} }
#endregion #endregion
...@@ -284,71 +82,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -284,71 +82,12 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : ""; string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosId : "";
if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_01_UpDownCylinderDown)) if (MoveInfo.MoveStep.Equals(LineMoveStep.DL_R_LineCheck))
{
InStoreLog("出料:(PO_02_UpDownCylinderDownWait, 编码与仓位一致,上下气缸1下降后等待0.3秒再夹紧,防止没有下降到位就夹紧");
MoveInfo.NextMoveStep(LineMoveStep.PO_02_UpDownCylinderDownWait);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
}
//只有当BOX可以进行出出料时,移栽物品,防止卡住
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_02_UpDownCylinderDownWait))
{ {
InStoreLog("出料:(PO_02_UpDownCylinderDownWait,夹料气缸夹紧)");
MoveInfo.NextMoveStep(LineMoveStep.PO_03_ClampCylinderSlack);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Tighten, IO_Type.ClampCylinder_Slack);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_03_ClampCylinderSlack))
{
InStoreLog("出料:(PO_04_UpDownCylinderUp,上下气缸上升)");
MoveInfo.NextMoveStep(LineMoveStep.PO_04_UpDownCylinderUp);
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_04_UpDownCylinderUp))
{
int num = MoveInfo.MoveParam.TrayNumber;
MoveInfo.NextMoveStep(LineMoveStep.PO_05_WaitBox);
LogInfo("出料PO_05_WaitBox【" + posId + "】处理(等待可以移栽) 更新盘号【" + num + "】为空盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitBoxCanReviceTray());
TrayManager.UpdateFixtureValue(num, false, 0);
//阻挡气缸移动
InStoreLog("放托盘(放开阻挡):SecondStoreMove=MO_09_TopCylinder_Down 物品已移走,顶升气缸1下降)");
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_06_TopCylinder_Down);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_WaitBox))
{
InStoreLog("出料:(PO_06_BeforeAfterCylinderBefore,前后气缸前进)");
MoveInfo.NextMoveStep(LineMoveStep.PO_06_BeforeAfterCylinderBefore);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_After, IO_Type.BeforeAfterCylinder_Before);
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_BeforeAfterCylinderBefore))
{ else if (MoveInfo.MoveStep.Equals(LineMoveStep.DL_R_LineCheck))
InStoreLog("出料:(PO_07_UpDownCylinderDown ,上下气缸下降)");
MoveInfo.NextMoveStep(LineMoveStep.PO_07_UpDownCylinderDown);
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_07_UpDownCylinderDown))
{
InStoreLog("出料: (PO_08_ClampCylinderTighten,夹料气缸放松)");
MoveInfo.NextMoveStep(LineMoveStep.PO_08_ClampCylinderTighten);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_08_ClampCylinderTighten))
{
InStoreLog("出料:(PO_09_UpdownCylinderUp,上下气缸上升)");
MoveInfo.NextMoveStep(LineMoveStep.PO_09_UpdownCylinderUp);
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_09_UpdownCylinderUp))
{
InStoreLog("出料:(PO_10_BeforeAfterCylinderAfter,前后气缸后退,等待4000 )");
MoveInfo.NextMoveStep(LineMoveStep.PO_10_BeforeAfterCylinderAfter);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(4000));
}
else if( MoveInfo.MoveStep.Equals(LineMoveStep.PO_10_BeforeAfterCylinderAfter))
{ {
LogInfo("出料【" + posId + "】处理完成!"); LogInfo("出料【" + posId + "】处理完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
......
...@@ -42,13 +42,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -42,13 +42,18 @@ namespace OnlineStore.DeviceLibrary
BaseTimerProcess(); BaseTimerProcess();
} }
public override void Alarm(LineAlarmType alarmType, string alarmDetial, string alarmMsg, LineMoveType storeMoveType) public override void Alarm(LineAlarmType alarmType )
{ {
if (this.alarmType.Equals(alarmType)) if (this.alarmType.Equals(alarmType))
{ {
return; return;
} }
this.alarmType = alarmType; this.alarmType = alarmType;
if (alarmType.Equals(LineAlarmType.SuddenStop) || alarmType.Equals(LineAlarmType.NoAirCheck))
{
StopMove();
}
} }
/// <summary> /// <summary>
/// 运动处理 /// 运动处理
...@@ -106,13 +111,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -106,13 +111,10 @@ namespace OnlineStore.DeviceLibrary
private void BaseTimerProcess() private void BaseTimerProcess()
{ {
if (isInPro) TimeSpan span = DateTime.Now - lastProTimer;
if (isInPro && span.TotalSeconds < 20)
{ {
TimeSpan span = DateTime.Now - lastAirCloseTime; return;
if (span.TotalSeconds < 20)
{
return;
}
} }
isInPro = true; isInPro = true;
lastProTimer = DateTime.Now; lastProTimer = DateTime.Now;
...@@ -123,10 +125,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -123,10 +125,7 @@ namespace OnlineStore.DeviceLibrary
isInPro = false; isInPro = false;
return; return;
} }
BusyMoveProcess();
TimerProcess(); TimerProcess();
IOTimeOutProcess();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -168,22 +167,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -168,22 +167,25 @@ namespace OnlineStore.DeviceLibrary
} }
public void ChangeDebug(bool isDebug) public void ChangeDebug(bool isDebug)
{ {
if (isDebug) if (baseConfig.DType.Equals(DeviceType.MoveEquip) || baseConfig.DType.Equals(DeviceType.ProvidingEquip))
{ {
IsDebug = true; if (isDebug)
//两个阻挡气缸下降 {
lineStatus = LineStatus.Debugging; IsDebug = true;
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); //两个阻挡气缸下降
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH); lineStatus = LineStatus.Debugging;
LogInfo("从正常状态切换到调试状态!"); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
} IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
else if (lineStatus.Equals(LineStatus.Debugging)) LogInfo("从正常状态切换到调试状态!");
{ }
IsDebug = false; else if (lineStatus.Equals(LineStatus.Debugging))
lineStatus = LineStatus.StoreOnline; {
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); IsDebug = false;
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); lineStatus = LineStatus.StoreOnline;
LogInfo("从调试状态切换到正常状态!"); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
LogInfo("从调试状态切换到正常状态!");
}
} }
} }
...@@ -194,30 +196,36 @@ namespace OnlineStore.DeviceLibrary ...@@ -194,30 +196,36 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
internal void OpenStopCylinder() internal void OpenStopCylinder()
{ {
LogInfo("下降阻挡气缸,上下气缸上升,顶升气缸下降"); if (baseConfig.DType.Equals(DeviceType.MoveEquip) || baseConfig.DType.Equals(DeviceType.ProvidingEquip))
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
//上下气缸上升
if (UseAxis.Equals(false))
{ {
IOMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW); LogInfo("下降阻挡气缸,上下气缸上升,顶升气缸下降");
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.HIGH); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
//上下气缸上升
if (UseAxis.Equals(false))
{
IOMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW);
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.HIGH);
}
//顶升气缸下降
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.HIGH);
} }
//顶升气缸下降
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.HIGH);
} }
internal void CloseCylinderStop() internal void CloseCylinderStop()
{ {
LogInfo("上升阻挡气缸,关闭上下气缸,顶升气缸IO"); if (baseConfig.DType.Equals(DeviceType.MoveEquip) || baseConfig.DType.Equals(DeviceType.ProvidingEquip))
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); {
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); LogInfo("上升阻挡气缸,关闭上下气缸,顶升气缸IO");
//上下气缸上升 IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW); //上下气缸上升
//顶升气缸下降 IOMove(IO_Type.UpDownCylinder_Down, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW); IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW); //顶升气缸下降
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW);
}
} }
#region 伺服运动 #region 伺服运动
...@@ -292,7 +300,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,7 +300,7 @@ namespace OnlineStore.DeviceLibrary
ACServerManager.ServoOff(portName, slvAddr); ACServerManager.ServoOff(portName, slvAddr);
WarnMsg = Name + "打开轴" + axis.Explain + "失败 "; WarnMsg = Name + "打开轴" + axis.Explain + "失败 ";
LogUtil.info(Name + WarnMsg); LogUtil.info(Name + WarnMsg);
Alarm(LineAlarmType.AxisAlarm, 5.ToString(), WarnMsg, MoveInfo.MoveType); Alarm(LineAlarmType.AxisAlarm );
return false; return false;
} }
} }
...@@ -444,7 +452,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -444,7 +452,7 @@ namespace OnlineStore.DeviceLibrary
{ {
isOk = false; isOk = false;
WarnMsg = msg; WarnMsg = msg;
Alarm(LineAlarmType.AxisMoveError, 5.ToString(), WarnMsg, moveInfo.MoveType); Alarm(LineAlarmType.AxisMoveError );
break; break;
} }
} }
...@@ -474,7 +482,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -474,7 +482,7 @@ namespace OnlineStore.DeviceLibrary
{ {
ConfigIO io = baseConfig.getWaitIO(wait.IoType); ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "等待" + NotOkMsg + " 超时"; WarnMsg = Name + "等待" + NotOkMsg + " 超时";
Alarm(LineAlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType); Alarm(LineAlarmType.IoSingleTimeOut );
LogUtil.error(MoveInfo.Name + WarnMsg, 13); LogUtil.error(MoveInfo.Name + WarnMsg, 13);
} }
else if (rwSpan.TotalSeconds > 3 && span.TotalSeconds > 3) else if (rwSpan.TotalSeconds > 3 && span.TotalSeconds > 3)
...@@ -540,7 +548,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -540,7 +548,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待[" + NotOkMsg WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待[" + NotOkMsg
+ "]超时[" + Math.Round(span.TotalSeconds, 1) + "]秒"; + "]超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 18); LogUtil.error(WarnMsg, 18);
Alarm(LineAlarmType.IoSingleTimeOut, "", WarnMsg, moveInfo.MoveType); Alarm(LineAlarmType.IoSingleTimeOut );
} }
} }
......
...@@ -78,6 +78,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -78,6 +78,7 @@ namespace OnlineStore.DeviceLibrary
public override void TimerProcess() public override void TimerProcess()
{ {
BusyMoveProcess();
//判断流水线打开了才可以运行 //判断流水线打开了才可以运行
if (MoveInfo.MoveType.Equals(LineMoveType.None)) if (MoveInfo.MoveType.Equals(LineMoveType.None))
{ {
...@@ -88,6 +89,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -88,6 +89,7 @@ namespace OnlineStore.DeviceLibrary
// StartCheckFixture(); // StartCheckFixture();
} }
} }
IOTimeOutProcess();
} }
......
...@@ -84,7 +84,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -84,7 +84,8 @@ namespace OnlineStore.DeviceLibrary
public override void TimerProcess() public override void TimerProcess()
{ {
BusyMoveProcess();
//判断流水线打开了才可以运行 //判断流水线打开了才可以运行
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None)) if (SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{ {
......
...@@ -73,7 +73,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -73,7 +73,8 @@ namespace OnlineStore.DeviceLibrary
} }
public override void TimerProcess() public override void TimerProcess()
{ {
BusyMoveProcess();
//判断流水线打开了才可以运行 //判断流水线打开了才可以运行
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None)) if (SecondMoveInfo.MoveType.Equals(LineMoveType.None))
{ {
......
...@@ -52,24 +52,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -52,24 +52,35 @@ namespace OnlineStore.DeviceLibrary
conTimer.Start(); conTimer.Start();
} }
} }
private bool isProcess = false;
private DateTime lastTime = DateTime.Now;
private void ConTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void ConTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
TimeSpan span = DateTime.Now - lastTime;
if(span.TotalMinutes< IoIPLIst .Count&& isProcess)
{
return;
}
isProcess = true;
lastTime = DateTime.Now;
try try
{ {
List<string> list = new List<string>(IoIPLIst); List<string> list = new List<string>(IoIPLIst);
if (list.Count > 0) if (list.Count > 0)
{ {
LogUtil.info("开始重连IO模块 ------------" );
foreach (string ip in list) foreach (string ip in list)
{ {
LogUtil.info("重连AOI :" + ip);
ConnectionIP(ip); ConnectionIP(ip);
} }
LogUtil.info("结束重连IO模块 ------------");
} }
GC.Collect();
}catch(Exception ex) }catch(Exception ex)
{ {
LogUtil.error("AOI ConTimer_Elapsed 出错: " + ex.ToString()); LogUtil.error("AOI ConTimer_Elapsed 出错: " + ex.ToString());
} }
isProcess = false;
} }
public void ConnectionIP(string ioIp) public void ConnectionIP(string ioIp)
...@@ -127,7 +138,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -127,7 +138,7 @@ namespace OnlineStore.DeviceLibrary
//aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event; //aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event;
AIOMap.Add(ioIp, aioBox); AIOMap.Add(ioIp, aioBox);
LogUtil.debug("开始连接" + logName + ",尝试重连5次"); LogUtil.debug("开始连接" + logName + ",尝试重连3次");
for (int i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
{ {
bool result = aioBox.Connect(); bool result = aioBox.Connect();
...@@ -147,7 +158,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -147,7 +158,8 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error("第【" + i + "】次连接 " + logName + " 失败:" + aioBox.ErrInfo + ""); LogUtil.error("第【" + i + "】次连接 " + logName + " 失败:" + aioBox.ErrInfo + "");
} }
Thread.Sleep(2); Thread.Sleep(5);
GC.Collect();
} }
} }
......
...@@ -24,9 +24,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -24,9 +24,9 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 初始化摄像机名称和二维码类型 /// 初始化摄像机名称和二维码类型
/// </summary> /// </summary>
public static void LoadConfig( ) public static void LoadConfig()
{ {
// string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName); // string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName);
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType); string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
// cameraNameList = new List<string>(); // cameraNameList = new List<string>();
codeTypeList = new List<string>(); codeTypeList = new List<string>();
...@@ -36,43 +36,73 @@ namespace OnlineStore.DeviceLibrary ...@@ -36,43 +36,73 @@ namespace OnlineStore.DeviceLibrary
//string[] nameArray = nameStr.Split(spiltChar); //string[] nameArray = nameStr.Split(spiltChar);
//foreach (string str in nameArray) //foreach (string str in nameArray)
//{ //{
// LogUtil.info("加载到配置摄像机名称:" + str.Trim()); // if (str.Trim().Equals(""))
// {
// continue;
// }
// //LogUtil.info("加载到配置摄像机名称:" + str.Trim());
// cameraNameList.Add(str.Trim()); // cameraNameList.Add(str.Trim());
//} //}
string[] codeArray = codeStr.Split(spiltChar); string[] codeArray = codeStr.Split(spiltChar);
foreach (string str in codeArray) foreach (string str in codeArray)
{ {
if (str.Trim().Equals(""))
{
continue;
}
LogUtil.info("加载到配置二维码类型:" + str.Trim()); LogUtil.info("加载到配置二维码类型:" + str.Trim());
codeTypeList.Add(str.Trim()); codeTypeList.Add(str.Trim());
} }
LoadCamera(false); LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr); CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("解析摄像机配置出错:" + ex.ToString()); LogUtil.error("解析摄像机配置出错:" + ex.StackTrace);
} }
} }
private static void LoadCamera(bool isReLoad) private static void LoadCamera(bool isReLoad)
{ {
if (isReLoad) if (isReLoad)
{ {
CodeLibrary.HIKCamera.Instance.Load(); try
CodeLibrary.BaslerCamera.Instance.Load(); {
CodeLibrary.HIKCamera.Instance.Load();
}
catch (Exception ex)
{
LogUtil.error("加载HIK相机出错:" + ex.ToString());
}
try
{
CodeLibrary.BaslerCamera.Instance.Load();
}
catch (Exception ex)
{
LogUtil.error("加载Basler相机出错:" + ex.ToString());
}
} }
string[] names = CodeLibrary.HIKCamera.Instance.CameraName; string[] names = CodeLibrary.HIKCamera.Instance.CameraName;
hikNameList.AddRange(names);
names = CodeLibrary.BaslerCamera.Instance.CameraName;
balserNameList.AddRange(names); if (names != null)
foreach (string name in hikNameList)
{ {
LogUtil.info("加载到HIK相机:" + name); hikNameList.AddRange(names);
foreach (string name in hikNameList)
{
LogUtil.info("加载到HIK相机:" + name);
}
} }
foreach (string name in balserNameList) names = CodeLibrary.BaslerCamera.Instance.CameraName;
if (names != null)
{ {
LogUtil.info("加载到Balser相机:" + name); balserNameList.AddRange(names);
foreach (string name in balserNameList)
{
LogUtil.info("加载到Balser相机:" + name);
}
} }
} }
public static void CloseCamera() public static void CloseCamera()
......
...@@ -188,7 +188,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -188,7 +188,7 @@ namespace OnlineStore.DeviceLibrary
/// 报警 /// 报警
/// </summary> /// </summary>
/// <param name="alarmType"></param> /// <param name="alarmType"></param>
public abstract void Alarm(LineAlarmType alarmType, string alarmDetial, string alarmMsg, LineMoveType storeMoveType); public abstract void Alarm(LineAlarmType alarmType );
/// <summary> /// <summary>
/// 重置(夹料装置状态不变) /// 重置(夹料装置状态不变)
/// </summary> /// </summary>
......
...@@ -472,6 +472,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -472,6 +472,23 @@ namespace OnlineStore.DeviceLibrary
PO_10_BeforeAfterCylinderAfter = 20010, PO_10_BeforeAfterCylinderAfter = 20010,
#endregion #endregion
#region 出料流水线处理,30000开始
/// <summary>
/// 出料流水线复位,定位气缸下降
/// </summary>
DL_R_CylinderDown=30001,
/// <summary>
/// 转动皮带开始运行
/// </summary>
DL_R_StartRun=30002,
/// <summary>
/// 皮带线检测处理
/// </summary>
DL_R_LineCheck=30100,
#endregion
} }
public enum LineAlarmType public enum LineAlarmType
......
...@@ -16,8 +16,9 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,8 +16,9 @@ namespace OnlineStore.LoadCSVLibrary
{ {
} }
public DischargeLine_Config(int id, string cid, string type, string filepath) public DischargeLine_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath) : base(id, cid, LoadCSVLibrary.DeviceType.DischargeLine, filepath)
{ {
} }
......
...@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
} }
public FeedingEquip_Config(int id, string cid, string type, string filepath) public FeedingEquip_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath) : base(id, cid, LoadCSVLibrary.DeviceType.FeedingEquip, filepath)
{ {
} }
......
...@@ -331,6 +331,16 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -331,6 +331,16 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// DI 出料皮带线体1急停 DLine_SuddenStop X021
/// </summary>
public static string DLine_SuddenStop = "DLine_SuddenStop";
/// <summary>
/// DI 出料皮带线体1复位 DLine_Reset X022
/// </summary>
public static string DLine_Reset = "DLine_Reset";
/// <summary>
/// DI 皮带线1定位检测,Location_Check1, ,X021 /// DI 皮带线1定位检测,Location_Check1, ,X021
/// </summary> /// </summary>
public static string Location_Check1 = "Location_Check1"; public static string Location_Check1 = "Location_Check1";
...@@ -381,21 +391,31 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -381,21 +391,31 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// DI 分盘装置1料盘检测,SeparateDevice_Check, ,X033 /// DI 分盘装置1料盘检测,SeparateDevice_Check, ,X033
/// </summary> /// </summary>
public static string SeparateDevice_Check = "SeparateDevice_Check"; public static string SeparateDevice_Check = "SeparateDevice_Check";
/// <summary>
/// DI 出料皮带线体1运行状态 DLine_RunStatus Y021
/// </summary>
public static string DLine_RunStatus = "DLine_RunStatus";
/// <summary>
/// DI 出料皮带线体1故障状态 DLine_RunAlarm Y022
/// </summary>
public static string DLine_RunAlarm = "DLine_RunAlarm";
/// <summary> /// <summary>
/// DO 0 出料皮带线1运转 LineRun_1,Y021 /// DO 0 出料皮带线1运转 DLine_Run1,Y021
/// </summary> /// </summary>
public static string LineRun_1 = "LineRun_1"; public static string DLine_Run1 = "DLine_Run1";
/// <summary> /// <summary>
/// DO 0 出料皮带线2运转 LineRun_2,Y022 /// DO 0 出料皮带线2运转 DLine_Run2,Y022
/// </summary> /// </summary>
public static string LineRun_2 = "LineRun_2"; public static string DLine_Run2 = "DLine_Run2";
/// <summary> /// <summary>
/// DO 0 出料皮带线3运转 LineRun_3,Y023 /// DO 0 出料皮带线3运转 DLine_Run3,Y023
/// </summary> /// </summary>
public static string LineRun_3 = "LineRun_3"; public static string DLine_Run3 = "DLine_Run3";
/// <summary> /// <summary>
/// DO 0 分盘装置电机驱动 SeparateDevice_Run,Y024 /// DO 0 分盘装置电机驱动 SeparateDevice_Run,Y024
/// </summary> /// </summary>
......
...@@ -25,7 +25,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -25,7 +25,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <param name="type">类型</param> /// <param name="type">类型</param>
/// <param name="filepath">配置文件</param> /// <param name="filepath">配置文件</param>
public Line_Config(int id, string cid, string type, string filepath) public Line_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath) : base(id, cid, LoadCSVLibrary.DeviceType.Line, filepath)
{ {
} }
......
...@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
} }
public MoveEquip_Config(int id, string cid, string type, string filepath) public MoveEquip_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath) : base(id, cid, LoadCSVLibrary.DeviceType.MoveEquip, filepath)
{ {
} }
......
...@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,7 +16,7 @@ namespace OnlineStore.LoadCSVLibrary
{ {
} }
public ProvidingEquip_Config(int id, string cid, string type, string filepath) public ProvidingEquip_Config(int id, string cid, string type, string filepath)
: base(id, cid, type, filepath) : base(id, cid, LoadCSVLibrary.DeviceType.ProvidingEquip, filepath)
{ {
} }
......
...@@ -21,9 +21,9 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -21,9 +21,9 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
public string CID { get; set; } public string CID { get; set; }
/// <summary> /// <summary>
/// 料层类型 /// 设备类型
/// </summary> /// </summary>
public string StoreType { get; set; } public string DType { get; set; }
/// <summary> /// <summary>
/// 配置文件路径 /// 配置文件路径
/// </summary> /// </summary>
...@@ -75,7 +75,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -75,7 +75,7 @@ namespace OnlineStore.LoadCSVLibrary
MustHaveDOList = new List<string>(); MustHaveDOList = new List<string>();
this.Id = id; this.Id = id;
this.CID = cid; this.CID = cid;
this.StoreType = type; this.DType = type;
this.ConfigFilePath = filepath; this.ConfigFilePath = filepath;
} }
...@@ -300,4 +300,28 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -300,4 +300,28 @@ namespace OnlineStore.LoadCSVLibrary
return io.DisplayStr; return io.DisplayStr;
} }
} }
public class DeviceType
{
/// <summary>
/// 流水线线体
/// </summary>
public static string Line = "Line";
/// <summary>
/// 出入库移栽
/// </summary>
public static string MoveEquip = "MoveEquip";
/// <summary>
/// 入料模块
/// </summary>
public static string FeedingEquip = "FeedingEquip";
/// <summary>
/// 出料模块
/// </summary>
public static string ProvidingEquip = "ProvidingEquip";
/// <summary>
/// 出料流水线
/// </summary>
public static string DischargeLine = "DischargeLine";
}
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!