Commit e9a16f1e LN

hy动作优化

1 个父辈 43e6854f
...@@ -219,8 +219,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -219,8 +219,8 @@ namespace OnlineStore.DeviceLibrary
private void CheckFixture() private void CheckFixture()
{ {
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut)) //if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{ //{
try try
{ {
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false)) if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
...@@ -234,28 +234,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -234,28 +234,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CheckStopWatch(trayCheckWait, TrayWaitTime, true)) if (CheckStopWatch(trayCheckWait, TrayWaitTime, true))
{ {
//托盘在工位阻挡处 TrayStart_HY03_FrontStopUp();
MoveInfo.NewMove(LineMoveType.Fixture);
runStatus = LineRunStatus.Busy;
MoveInfo.NextMoveStep(LineMoveStep.HY03_FrontStopUp);
if (DeviceID.Equals(219) || DeviceID.Equals(203))
{
LogInfo("托盘检测," + MoveInfo.SLog + " 检测到托盘 ,阻挡上升");
}
else
{
CheckLog("托盘检测," + MoveInfo.SLog + " 检测到托盘 ,阻挡上升");
}
if (Config.DOList.ContainsKey(IO_Type.HY_FrontStopDown))
{
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_FrontStopDown, IO_VALUE.LOW));
}
IOMove(IO_Type.HY_StopDown, IO_VALUE.LOW);
IOMove(IO_Type.HY_OL_StopDown, IO_VALUE.LOW);
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_TrayCheck, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(20000));
} }
} }
else else
...@@ -273,6 +252,43 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,6 +252,43 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CheckStopWatch(frontTrayCheckWait, TrayWaitTime, false) && check2IsOk) if (CheckStopWatch(frontTrayCheckWait, TrayWaitTime, false) && check2IsOk)
{ {
TrayStart_HY02_FrontStopDown();
}
}
else if (Config.IsOutLineOut && IOValue(IO_Type.HY_OL_Tray_Check).Equals(IO_VALUE.HIGH))
{
HY71_OL_Wait();
}
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString());
}
// finally
// {
// Monitor.Exit(lockObj);
// }
//}
//else
//{
// LogUtil.error(Name + " CheckFixture " + "失败,未得到锁");
//}
}
private void TrayStart_HY02_FrontStopDown()
{
string mName = " TrayStart_HY02_FrontStopDown ";
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{
try
{
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + mName + " 不在空闲中,直接返回 ");
return;
}
StopDownCount = 0; StopDownCount = 0;
preTrayIsC1Line = true; preTrayIsC1Line = true;
//托盘在前阻挡处 //托盘在前阻挡处
...@@ -298,30 +314,84 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,30 +314,84 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
IOMove(IO_Type.HY_OL_StopDown, IO_VALUE.LOW); IOMove(IO_Type.HY_OL_StopDown, IO_VALUE.LOW);
} }
catch (Exception ex)
{
LogUtil.error(Name + mName + " 出错:" + ex.ToString());
} }
else if (Config.IsOutLineOut && IOValue(IO_Type.HY_OL_Tray_Check).Equals(IO_VALUE.HIGH)) finally
{ {
HY71_OL_Wait(); Monitor.Exit(lockObj);
} }
} }
else
{
LogUtil.error(Name + mName + "失败,未得到锁");
} }
} }
private void TrayStart_HY03_FrontStopUp()
{
string logName = " TrayStart_HY03_FrontStopUp ";
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{
try
{
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + logName + " 不在空闲中,直接返回 ");
return;
}
//托盘在工位阻挡处
MoveInfo.NewMove(LineMoveType.Fixture);
runStatus = LineRunStatus.Busy;
MoveInfo.NextMoveStep(LineMoveStep.HY03_FrontStopUp);
if (DeviceID.Equals(219) || DeviceID.Equals(203))
{
LogInfo("托盘检测," + MoveInfo.SLog + " 检测到托盘 ,阻挡上升");
}
else
{
CheckLog("托盘检测," + MoveInfo.SLog + " 检测到托盘 ,阻挡上升");
}
if (Config.DOList.ContainsKey(IO_Type.HY_FrontStopDown))
{
IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_FrontStopDown, IO_VALUE.LOW));
}
IOMove(IO_Type.HY_StopDown, IO_VALUE.LOW);
IOMove(IO_Type.HY_OL_StopDown, IO_VALUE.LOW);
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_TrayCheck, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(20000));
}
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(Name + " CheckFixture " + " 出错:" + ex.ToString()); LogUtil.error(Name + logName + " 出错:" + ex.ToString());
} }
finally finally
{ {
Monitor.Exit(lockObj); Monitor.Exit(lockObj);
} }
} }
else else
{ {
LogUtil.error(Name + " CheckFixture " + "失败,未得到锁"); LogUtil.error(Name + logName + "失败,未得到锁");
} }
} }
private void HY71_OL_Wait() private void HY71_OL_Wait()
{ {
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{
try
{
if (MoveInfo.MoveType.Equals(LineMoveType.None).Equals(false))
{
LogUtil.error(Name + " HY71_OL_Wait " + " 不在空闲中,直接返回 ");
return;
}
bool check2IsOk = CheckStopWatch(trayCheckLowWait, TrayWaitTime, false) || String.IsNullOrEmpty(RFIDIP); bool check2IsOk = CheckStopWatch(trayCheckLowWait, TrayWaitTime, false) || String.IsNullOrEmpty(RFIDIP);
if (CheckStopWatch(olcheckWatch, TrayWaitTime, false) && check2IsOk) if (CheckStopWatch(olcheckWatch, TrayWaitTime, false) && check2IsOk)
{ {
...@@ -338,6 +408,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -338,6 +408,21 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_OL_Tray_Check, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_OL_Tray_Check, IO_VALUE.HIGH));
} }
} }
catch (Exception ex)
{
LogUtil.error(Name + " HY71_OL_Wait " + " 出错:" + ex.ToString());
}
finally
{
Monitor.Exit(lockObj);
}
}
else
{
LogUtil.error(Name + " HY71_OL_Wait " + "失败,未得到锁");
}
}
internal void HY03_FrontStopUp(int timeout= 20000,bool frontStopUp=true) internal void HY03_FrontStopUp(int timeout= 20000,bool frontStopUp=true)
{ {
frontTrayCheckWait.Stop(); frontTrayCheckWait.Stop();
...@@ -1417,16 +1502,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -1417,16 +1502,16 @@ namespace OnlineStore.DeviceLibrary
{ {
if (DeviceID.Equals(208)) if (DeviceID.Equals(208))
{ {
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{
try
{
if (runStatus <= LineRunStatus.Wait) if (runStatus <= LineRunStatus.Wait)
{ {
return true; return true;
} }
else if (MoveInfo.MoveType.Equals(LineMoveType.None)) else if (MoveInfo.MoveType.Equals(LineMoveType.None))
{ {
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{
try
{
if (runStatus > LineRunStatus.Wait && MoveInfo.MoveType.Equals(LineMoveType.None)) if (runStatus > LineRunStatus.Wait && MoveInfo.MoveType.Equals(LineMoveType.None))
{ {
LogUtil.debug("进仓05托盘离开," + Name + "开始等待托盘检测信号 HY03_FrontStopUp"); LogUtil.debug("进仓05托盘离开," + Name + "开始等待托盘检测信号 HY03_FrontStopUp");
...@@ -1434,7 +1519,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -1434,7 +1519,6 @@ namespace OnlineStore.DeviceLibrary
return true; return true;
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(Name + " Move5Stop2Down " + " 出错:" + ex.ToString()); LogUtil.error(Name + " Move5Stop2Down " + " 出错:" + ex.ToString());
...@@ -1450,6 +1534,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1450,6 +1534,7 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
} }
}
else else
{ {
return true; return true;
...@@ -1458,6 +1543,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1458,6 +1543,10 @@ namespace OnlineStore.DeviceLibrary
} }
internal bool HYOut51_WaitFree() internal bool HYOut51_WaitFree()
{ {
if (!CanStartMove())
{
return false;
}
if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut)) if (Monitor.TryEnter(lockObj, TrayManager.mTimeOut))
{ {
try try
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!