Commit 066a96c2 LN

报警验证修改

1 个父辈 547fd939
......@@ -255,12 +255,12 @@ namespace OnlineStore.AssemblyLine
lineBean.StopRun();
}
// IOManager.instance.CloseAllDO();
// IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection();
//AIManager.CloseConnect();
ACServerManager.CloseAllPort();
// CodeManager.CloseAllCamera();
// TrayManager.RfidReader.Close();
// CodeManager.CloseAllCamera();
TrayManager.RfidReader.Close();
//this.Close();
System.Environment.Exit(System.Environment.ExitCode);
}
......@@ -492,7 +492,8 @@ namespace OnlineStore.AssemblyLine
if ((lineBean.runStatus.Equals(LineRunStatus.HomeMoving) || lineBean.runStatus.Equals(LineRunStatus.Reset))
&& lineBean.alarmType.Equals(LineAlarmType.None))
{
SetMenuS(复位RToolStripMenuItem, false); SetMenuS(启动AToolStripMenuItem, false);
SetMenuS(复位RToolStripMenuItem, false);
SetMenuS(启动AToolStripMenuItem, false);
}
else
{
......
......@@ -166,7 +166,7 @@ namespace OnlineStore.DeviceLibrary
if (IOValue(IO_Type.DLine_Reset).Equals(IO_VALUE.HIGH))
{
if (alarmType.Equals(LineAlarmType.None))
if (NoAlarm())
{
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
......@@ -188,7 +188,7 @@ namespace OnlineStore.DeviceLibrary
BusyMoveProcess();
//判断流水线打开了才可以运行
if (runStatus.Equals(LineRunStatus.Runing) && alarmType.Equals(LineAlarm.None))
if (runStatus.Equals(LineRunStatus.Runing) && NoAlarm())
{
//判断是否需要入库
if (IOValue(IO_Type.DLine_Exit_Check3).Equals(IO_VALUE.LOW) && LineRuning.Equals(false))
......@@ -218,7 +218,7 @@ namespace OnlineStore.DeviceLibrary
IOTimeOutProcess();
//判断红灯状态
if (alarmType.Equals(LineAlarmType.None))
if (NoAlarm())
{
IOMove(IO_Type.DLine_RunAlarm, IO_VALUE.LOW);
}
......
......@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
internal bool CanStartOut(int lineNum)
{
if (alarmType.Equals(LineAlarm.None).Equals(false) || runStatus.Equals(LineRunStatus.Runing).Equals(false))
if (NoAlarm() || runStatus.Equals(LineRunStatus.Runing).Equals(false))
{
return false;
}
......
......@@ -392,7 +392,7 @@ namespace OnlineStore.DeviceLibrary
{
TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut)
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut&&NoAlarm())
{
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "等待" + NotOkMsg + " 超时";
......@@ -461,7 +461,7 @@ namespace OnlineStore.DeviceLibrary
{
moveInfo.EndStepWait();
}
else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
else if (span.TotalSeconds > moveInfo.TimeOutSeconds )
{
WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待[" + NotOkMsg
+ "]超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
......
......@@ -323,7 +323,7 @@ namespace OnlineStore.DeviceLibrary
}
if (IOValue(IO_Type.SL_Reset_BTN).Equals(IO_VALUE.HIGH))
{
if (alarmType.Equals(LineAlarmType.None))
if (NoAlarm())
{
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
......@@ -343,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
}
BusyMoveProcess();
//判断流水线打开了才可以运行
if (MoveInfo.MoveType.Equals(LineMoveType.None)&&alarmType.Equals(LineAlarmType.None))
if (MoveInfo.MoveType.Equals(LineMoveType.None)&&NoErrorAlarm())
{
if ( Config.IsCanOut.Equals(0))
{
......@@ -354,7 +354,7 @@ namespace OnlineStore.DeviceLibrary
StartOutStoreP();
}
}
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None) &&( isInSuddenDown.Equals(false)&&isNoAirCheck.Equals(false)))
if (SecondMoveInfo.MoveType.Equals(LineMoveType.None) && NoErrorAlarm())
{
StartCheckFixture();
}
......
......@@ -50,10 +50,10 @@ namespace OnlineStore.DeviceLibrary
{
return;
}
if (Config.SidesWayNum > 0)
{
bool isTestNeed = (LineManager.Line.runStatus <= LineRunStatus.Wait);
bool isNeedTray = (LineManager.Line.SwNoProcess(Config.SidesWayNum));
if (IOValue(IO_Type.SW_TrayCheck).Equals(IO_VALUE.HIGH) && (isTestNeed || isNeedTray))
......@@ -69,7 +69,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(SecondMoveInfo, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
}
else
{
{
preTrayNum = currTrayNum;
currTrayNum = num;
TrayManager.UpdateSWState(Config.SidesWayNum, 1);
......@@ -80,13 +80,13 @@ namespace OnlineStore.DeviceLibrary
////判断是否是需要的托盘
//if (CurrTrayIsNeed(num, true))
//{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
SecondMoveInfo.NewMove(LineMoveType.CheckFixture, CheckParam);
TrayManager.UpdateSWState(Config.SidesWayNum, 2);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopCylinder1Down);
CheckLog("检测到SW_StopCheck:" + SecondMoveInfo.SLog + "阻挡气缸下降 ,最多等待1秒");
IOMove(IO_Type.SW_StopDown, IO_VALUE.HIGH);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopDown, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopDown, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
//}
//else
//{
......@@ -103,7 +103,7 @@ namespace OnlineStore.DeviceLibrary
{
// int num = TrayManager.GetTrayNum(DeviceID);
//托盘在两个阻挡内
if ( IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH))
if (IOValue(IO_Type.FL_TrayCheck).Equals(IO_VALUE.HIGH))
{
SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
CheckLog("检测到FL_TrayCheck:" + SecondMoveInfo.SLog + " FL阻挡1上升)");
......@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
{
CheckLog("托盘检测:" + SecondMoveInfo.SLog + "阻挡气缸上升,等待SW_TrayCheck=1)");
IOMove(IO_Type.SW_StopDown, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopDown, IO_VALUE.LOW));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_StopDown, IO_VALUE.LOW));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SW_TrayCheck, IO_VALUE.HIGH));
}
}
......@@ -710,23 +710,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.FI_25_MoveCylinder_Up);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移机构上升, 托盘开始放行");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Down, IO_Type.SL_MoveCylinder_Up);
//Task.Factory.StartNew(delegate
//{
// //更新托盘条码信息
// string code = CodeManager.ProcessCode(LastCodeList);
// TrayManager.UpdateTrayInfo(currTrayNum, true, 1, code, "", LastHeight, LastWidth);
// if (code.Equals(""))
// {
// TrayManager.UpdateInStoreNG(currTrayNum, true, "扫码失败");
// }
// //从服务器获取库位号
// string result = StoreServerManager.CodeReceived(Name, currTrayNum, LastCodeList, LastHeight, LastWidth);
// if (!result.Equals(""))
// {
// TrayManager.UpdateInStoreNG(currTrayNum, true, result);
// LogUtil.error(Name + "托盘【" + currTrayNum + "】" + result);
// }
//});
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_12_MoveOk);
}
......@@ -830,7 +813,7 @@ namespace OnlineStore.DeviceLibrary
FI_12_MoveCylinder_Give();
}
else
{
{
//无料盘
MoveInfo.ShelfNoTray = true;
MoveInfo.NextMoveStep(LineMoveStep.FI_31_BatchAxisToP2);
......@@ -876,10 +859,11 @@ namespace OnlineStore.DeviceLibrary
if (LastHeight <= 8) { LastHeight = 8; }
else
{
LastHeight = (int)Math.Ceiling(1F * (LastHeight-2) / 4) * 4;
LastHeight = (int)Math.Ceiling(1F * (LastHeight - 2 - 4) / 4) * 4;
}
if (LastHeight <= 8) { LastHeight = 8; }
LogUtil.info(msg + ",归类为" + LastHeight);
return LastHeight;
return LastHeight;
}
public int GetWidth()
{
......
......@@ -125,9 +125,9 @@ namespace OnlineStore.DeviceLibrary
if (IsDebug)
{
rfidList = new List<string>() {
"192.168.210.116","192.168.210.120","192.168.210.121"
};
//rfidList = new List<string>() {
// "192.168.210.116","192.168.210.120","192.168.210.121"
//};
try
{
cioList = new List<string>();
......@@ -183,15 +183,15 @@ namespace OnlineStore.DeviceLibrary
{
IOManager.instance.ConnectionIOList(cioList);
Thread.Sleep(5);
if (!IsDebug)
{
//Task.Factory.StartNew(delegate
//{
// string[] rfidArray = rfidList.ToArray();
// //连接rfip
// TrayManager.RfidReader.Open(rfidArray);
//});
}
// if (!IsDebug)
//{
// Task.Factory.StartNew(delegate
// {
// string[] rfidArray = rfidList.ToArray();
// //连接rfip
// TrayManager.RfidReader.Open(rfidArray);
// });
//}
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
addLastDI(IO_Type.SuddenStop_BTN, IOValue(IO_Type.SuddenStop_BTN));
addLastDI(IO_Type.Reset_BTN, IOValue(IO_Type.Reset_BTN));
......@@ -323,7 +323,6 @@ namespace OnlineStore.DeviceLibrary
isInprocess = false;
isInSuddenDown = false;
isNoAirCheck = false;
alarmType = LineAlarmType.None;
TrayManager.TrayErrorMsg = "";
SetWarnMsg("");
PreIsHasProcess = true;
......@@ -376,7 +375,7 @@ namespace OnlineStore.DeviceLibrary
isNeedAllReset = true;
LogUtil.error( Name + "收到复位信号,在急停中或没有气压中,强制所有设备复位,清理出库需要的托盘数量~");
}
else if ((runStatus == LineRunStatus.HomeMoving || runStatus == LineRunStatus.Reset) && alarmType.Equals(LineAlarmType.None))
else if ((runStatus == LineRunStatus.HomeMoving || runStatus == LineRunStatus.Reset) && NoAlarm())
{
LogUtil.error( Name + "收到复位信号,已经在复位或原点返回中,且当前无报警,不处理复位");
return false;
......@@ -405,7 +404,7 @@ namespace OnlineStore.DeviceLibrary
//调试状态不再重置
if (!equip.IsDebug)
{
if (isNeedAllReset || TrayManager.ErrorDeviceId.Equals(equip.DeviceID) || (!equip.alarmType.Equals(LineAlarmType.None)))
if (isNeedAllReset || TrayManager.ErrorDeviceId.Equals(equip.DeviceID) || (!NoAlarm()))
{
LogUtil.info(Name + "收到复位信号," + equip.Name + " 需要复位");
equip.Reset();
......@@ -608,14 +607,14 @@ namespace OnlineStore.DeviceLibrary
bool isNeedAlarmLed = false;
bool isInOut = false;
if (alarmType.Equals(LineAlarmType.None).Equals(false) || isNoAirCheck || isInSuddenDown || TrayManager.TrayErrorMsg != "")
if (NoAlarm().Equals(false) || TrayManager.TrayErrorMsg != "")
{
isNeedAlarmLed = true;
}
foreach (MoveEquip moveEquip in MoveEquipMap.Values)
{
if (!moveEquip.alarmType.Equals(LineAlarmType.None))
if (!moveEquip.NoAlarm())
{
isNeedAlarmLed = true;
}
......@@ -908,7 +907,7 @@ namespace OnlineStore.DeviceLibrary
{
if ((moveEquip.runStatus.Equals(LineRunStatus.HomeMoving) || moveEquip.runStatus.Equals(LineRunStatus.Reset)) && moveEquip.IsDebug.Equals(false))
{
if (moveEquip.alarmType.Equals(LineAlarmType.None))
if (moveEquip.NoAlarm())
{
isOk = false;
break;
......
......@@ -200,7 +200,7 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut)
{
ConfigIO io = Config.getWaitIO(wait.IoType);
if (alarmType.Equals(LineAlarmType.None))
if (NoAlarm())
{
WarnMsg = Name + " 等待" + NotOkMsg + "超时";
Alarm(LineAlarmType.IoSingleTimeOut);
......@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary
{
checkWaitInfo.EndStepWait();
}
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds&&alarmType.Equals(LineAlarmType.None))
else if (span.TotalSeconds > checkWaitInfo.TimeOutSeconds )
{
WarnMsg = checkWaitInfo.Name + "[" + checkWaitInfo.MoveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, 100);
......@@ -852,7 +852,7 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
public bool CanOutStore(int id)
{
if (!alarmType.Equals(LineAlarmType.None) || isInSuddenDown || isNoAirCheck)
if (!NoErrorAlarm())
{
return false;
}
......@@ -861,7 +861,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
MoveEquip move = MoveEquipMap[id];
if (!move.alarmType.Equals(LineAlarmType.None) || move.waitInStoreList.Count > 0 || move.IsDebug || move.waitOutStoreList.Count > 0)
if (!move.NoAlarm() || move.waitInStoreList.Count > 0 || move.IsDebug || move.waitOutStoreList.Count > 0)
{
return false;
}
......@@ -882,7 +882,7 @@ namespace OnlineStore.DeviceLibrary
public bool CanIntore(int id)
{
if ( isInSuddenDown || isNoAirCheck)
if (!NoErrorAlarm())
{
return false;
}
......@@ -891,7 +891,7 @@ namespace OnlineStore.DeviceLibrary
return false;
}
MoveEquip move = MoveEquipMap[id];
if (!move.alarmType.Equals(LineAlarmType.None) || move.IsDebug || move.waitOutStoreList.Count > 0)
if (!move.NoAlarm() || move.IsDebug || move.waitOutStoreList.Count > 0)
{
return false;
}
......
......@@ -13,7 +13,7 @@ namespace OnlineStore.DeviceLibrary
public class TrayManager
{
public static int StopDownWaitTime = 1000;
// public static RFID RfidReader = new RFID();
public static RFID RfidReader = new RFID();
///// <summary>
///// 出库时,可以不下降直接放料盘的宽度
///// </summary>
......@@ -185,34 +185,27 @@ namespace OnlineStore.DeviceLibrary
public static int GetTrayNum(int subType, bool isClear = false)
{
return 9;
//if (subType.Equals(104))
//{
// return LineManager.Line.Sw23TrayNum;
//}
//else if (subType.Equals(101))
//{
// return LineManager.Line.Sw41TrayNum;
//}
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
}
else if (subType.Equals(101))
{
return LineManager.Line.Sw41TrayNum;
}
string ip = GetRFIP(subType);
//获取盘号
RFIDData data = ReadRFID(ip,isClear);
if (data != null)
{
if (data.RFType.Equals((byte)'E'))
{
return data.Num;
}
return 0;
}
//string ip = GetRFIP(subType);
////获取盘号
//RFIDData data = ReadRFID(ip);
//if (data != null)
//{
// if (data.RFType.Equals((byte)'E'))
// {
// return data.Num;
// }
// return 0;
// //else
// //{
// // LogUtil.error("读取托盘RFID[" + subType + "][" + ip + "]的数据出错:" + data.ToStr());
// //}
//}
//if (isClear)
//{
// RfidReader.Clear(ip);
//}
return 0;
}
public static RFIDData GetShelfData(int subType)
......@@ -222,25 +215,24 @@ namespace OnlineStore.DeviceLibrary
}
public static RFIDData ReadRFID(string ip)
public static RFIDData ReadRFID(string ip,bool isClear=false)
{
//try
//{
// if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
// {
// //获取盘号
// byte[] data = RfidReader.Read(ip);
// if (data != null && data.Length >= 2)
// {
// RFIDData d = new RFIDData(data);
// return d;
// }
// }
//}
//catch (Exception ex)
//{
// //LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
//}
try
{
if (String.IsNullOrEmpty(ip).Equals(false) && LineManager.Line.rfidList.Contains(ip))
{
RFIDData data= new RFIDData(RfidReader.Read(ip));
if (isClear)
{
RfidReader.Clear(ip);
}
return data;
}
}
catch (Exception ex)
{
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return new RFIDData(-1, -1);
}
......@@ -363,8 +355,11 @@ namespace OnlineStore.DeviceLibrary
{
try
{
RFType = data[1];
Num = Convert.ToInt32(data[2]);
if (data != null && data.Length > 2)
{
RFType = data[1];
Num = Convert.ToInt32(data[2]);
}
}
catch (Exception ex)
{
......
......@@ -167,15 +167,37 @@ namespace OnlineStore.DeviceLibrary
case LineAlarmType.IoSingleTimeOut:
aType = 3;
break;
case LineAlarmType.StellAlarm:
aType = 2;
alarmDetial = "5";
break;
default: break;
}
alarmInfo = new AlarmInfo(DeviceID, aType, alarmDetial, alarmMsg, inoutStatus);
}
protected bool NoErrorAlarm()
{
if (isInSuddenDown || isNoAirCheck)
{
return false;
}
if (alarmType > LineAlarmType.IoSingleTimeOut)
{
return false;
}
return true;
}
internal bool NoAlarm()
{
if (isInSuddenDown || isNoAirCheck)
{
return false;
}
if (alarmType.Equals(LineAlarmType.None))
{
return true ;
}
return false ;
}
/// <summary>
/// 开始运行
/// </summary>
......
......@@ -928,32 +928,30 @@ namespace OnlineStore.DeviceLibrary
public enum LineAlarmType
{
/// <summary>
/// 没有报警
/// 没有报警,数字越大报警级别越大
/// </summary>
None = 0,
/// <summary>
/// 轴报警
/// </summary>
AxisAlarm = 1,
/// <summary>
/// 收到急停
/// io信号超时未收到
/// </summary>
SuddenStop = 10,
IoSingleTimeOut = 10,
/// <summary>
/// 没有气压信号
/// 轴报警
/// </summary>
NoAirCheck = 11,
AxisAlarm = 1000,
/// <summary>
/// 轴运动错误,没有达到指定脉冲,但是io判断已停止运动
/// </summary>
AxisMoveError = 20,
AxisMoveError = 1001,
/// <summary>
/// io信号超时未收到
/// 没有气压信号
/// </summary>
IoSingleTimeOut = 30,
NoAirCheck = 9999,
/// <summary>
/// 电钢报警
/// 收到急停
/// </summary>
StellAlarm=50,
SuddenStop = 10000,
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!