Commit 71c6157f LN

超时时间单位改为秒

1 个父辈 67deef22
......@@ -43,7 +43,7 @@ namespace OnlineStore.AssemblyLine
List<string> rfidList = new List<string>(LineManager.Line. rfidList);
foreach (string ip in rfidList)
{
string con = RFIDManager.ReadRFID(ip) .ToStr() ;
string con = RFIDManager.ReadRFID(ip) .NumStr() ;
msg += ("RFID[" + ip + "]:").PadLeft(26, ' ') + con + "\n";
}
lblRFID.Text += msg;
......
......@@ -73,7 +73,7 @@ namespace OnlineStore.AssemblyLine
string resul = "";
if (data != null)
{
resul = data.ToStr();
resul = data.NumStr();
numNum.Value = data.Num;
int selIndex = data.RFType - 64;
if (selIndex >= 0 && selIndex <= comboxType.Items.Count)
......@@ -105,7 +105,7 @@ namespace OnlineStore.AssemblyLine
string resul = "";
if (data != null)
{
resul = data.ToStr();
resul = data.NumStr();
numNum.Value = data.Num;
int selIndex = data.RFType - 64;
if (selIndex >= 0 && selIndex <= comboxType.Items.Count)
......
......@@ -66,7 +66,7 @@ PRO,0,入料流水线3-上料模块-RFID-IP,PRO_RFIP_103-1,192.168.210.115,,,,,
,,,,,,,,,
PRO,0,当多久没操作时流水线休眠(秒),Sleep_MSeconds,600,,,,,
PRO,0,气压检测信号关闭需要持续的时间,AirCheckSeconds,600,,,,,
PRO,0,IO信号超时时间(毫秒),IOSingle_TimerOut,15000,,,,,
PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,
PRO,0,IO模块对应的DI数量,IO_DILength,192.168.101.33#8;192.168.101.35#8;192.168.101.37#8;192.168.101.39#8;192.168.101.41#8;,,,,,
PRO,0,模块对应的DO数量,IO_DOLength,192.168.101.33#8;192.168.101.35#8;192.168.101.37#8;192.168.101.39#8;192.168.101.41#8;,,,,,
,,,,,,,,,
......
......@@ -184,7 +184,7 @@ namespace OnlineStore.DeviceLibrary
Line3LastTrayP++;
LogInfo(hengyiName + "出口有料,等待料盘到达分盘装置位置");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Location_Check3, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SeparateDevice_Check, IO_VALUE.HIGH));
}
else if (MoveInfo.MoveStep.Equals(LineMoveStep.DO_06_Wait_SeparateDevice_Check))
{
......
......@@ -251,7 +251,7 @@ namespace OnlineStore.DeviceLibrary
{
return true;
}
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalMilliseconds < LineManager.Config.IOSingle_TimerOut * 2)
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
......@@ -271,7 +271,7 @@ namespace OnlineStore.DeviceLibrary
{
return true;
}
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalMilliseconds < LineManager.Config.IOSingle_TimerOut * 2)
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH);
......@@ -423,14 +423,14 @@ namespace OnlineStore.DeviceLibrary
{
TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut && NoAlarm())
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && NoAlarm())
{
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "等待" + NotOkMsg + " 超时";
Alarm(LineAlarmType.IoSingleTimeOut);
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID + 13);
}
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalMilliseconds < LineManager.Config.IOSingle_TimerOut * 2)
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
string msg = moveInfo.Name + " " + NotOkMsg + "已等待 " + Math.Abs(span.TotalSeconds) + "秒,重写DO:";
......
......@@ -704,21 +704,23 @@ namespace OnlineStore.DeviceLibrary
try
{
//判断料架的编码是否正确
byte[] data = null;
CurrShelfId = RFIDManager.GetShelfId(DeviceID, out data);
if (CurrShelfId.Equals(""))
{
//MoveInfo.EndMove();
//runStatus = LineRunStatus.Runing;
LogUtil.info(" 定位工位料架检测到料架,获取料架号失败");
return false;
}
RFIDData rfidD = RFIDManager.GetShelfId(DeviceID);
CurrShelfId = rfidD.NumStr();
byte[] data = rfidD.ToData();
//if (CurrShelfId.Equals(""))
//{
// //MoveInfo.EndMove();
// //runStatus = LineRunStatus.Runing;
// LogUtil.info(" 定位工位料架检测到料架,获取料架号失败");
// return false;
//}
//发送料架信息给调度系统
AgvClient.SendRFID(Config.AgvInName, data);
LogUtil.info(Name + "定位工位料架编号:" + CurrShelfId);
}catch(Exception ex)
}
catch (Exception ex)
{
LogUtil.error(Name+ "UpdateShelfId出错:"+ex.ToString());
LogUtil.error(Name + "UpdateShelfId出错:" + ex.ToString());
}
return true;
}
......
......@@ -170,6 +170,7 @@ namespace OnlineStore.DeviceLibrary
Task.Factory.StartNew(delegate
{
LogUtil.info(Name + "开始连接IO模块 ");
IOManager.instance.ConnectionIOList(cioList);
//Thread.Sleep(5);
//Task.Factory.StartNew(delegate
......@@ -915,7 +916,7 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg(moveEquip.Name + "下降阻挡气缸超时,已等待" + FormUtil.GetSpanStr(span));
LogUtil.error(moveEquip.Name + "下降阻挡气缸超时,已等待" + FormUtil.GetSpanStr(span), 112);
}
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalMilliseconds < LineManager.Config.IOSingle_TimerOut * 2)
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
LogUtil.error(Name + "复位中:等待" + msg + "已【" + FormUtil.GetSpanStr(span) + "】重新调用OpenStopCylinder方法");
......
......@@ -182,7 +182,7 @@ namespace OnlineStore.DeviceLibrary
{
TimeSpan rwSpan = DateTime.Now - preRWTime;
//一分钟还未检测到
if (span.TotalMilliseconds > LineManager.Config.IOSingle_TimerOut && NoAlarm())
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && NoAlarm())
{
ConfigIO io = baseConfig.getWaitIO(wait.IoType);
WarnMsg = Name + "等待" + NotOkMsg + " 超时";
......@@ -190,7 +190,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID + 13);
}
//超过报警时长
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalMilliseconds < LineManager.Config.IOSingle_TimerOut * 2)
else if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{
preRWTime = DateTime.Now;
string msg = checkWaitInfo.Name + " " + NotOkMsg + "已等待 " + Math.Abs(span.TotalSeconds) + "秒,重写DO:";
......@@ -257,8 +257,31 @@ namespace OnlineStore.DeviceLibrary
}
}
/// <summary>
/// 判断指定的皮带线是否可用
/// </summary>
/// <param name="lineNum"></param>
/// <returns></returns>
internal bool ProvidingCanUse(List<int> lineList)
{
//有一条线可用就返回true
foreach (int lineNum in lineList)
{
int deviceN = 200 + lineNum;
if (ProvidingEquipMap.ContainsKey(deviceN))
{
ProvidingEquip pro = ProvidingEquipMap[deviceN];
if (pro.runStatus >= LineRunStatus.HomeMoving && pro.isInSuddenDown.Equals(false) && pro.isNoAirCheck.Equals(false))
{
return true;
}
}
}
return false;
}
#endregion
#region 出库
......
......@@ -343,12 +343,14 @@ namespace OnlineStore.DeviceLibrary
InTurn = false;
}
}
private int canWhileCount = 3;
public void StartLineRun(string moveDO, string checkDI, TurnEndDel endProcess, int timeOutMS = 30000)
{
InTurn = true;
this.turnEnd = endProcess;
Task.Factory.StartNew(delegate
{
canWhileCount = 3;
LineRunAndWait(moveDO, checkDI, timeOutMS);
});
}
......@@ -357,7 +359,7 @@ namespace OnlineStore.DeviceLibrary
{
LastMoveDO = moveDO;
LastCheckDI = checkDI;
LogUtil.debug("开始转动:" + moveDO+",等待信号:"+checkDI+"");
LogUtil.debug(subType+ "开始转动:" + moveDO+",等待信号:"+checkDI+"");
IOManager.IOMove(moveDO, IO_VALUE.HIGH, subType);
InTurn = true;
DateTime startTime = DateTime.Now;
......@@ -387,12 +389,12 @@ namespace OnlineStore.DeviceLibrary
{
if (result.Equals(""))
{
LogUtil.debug("验证" + checkDI + "=Low结束:" + result);
LogUtil.debug(subType + "验证" + checkDI + "=Low结束:" + result);
}
else
{
LogUtil.info("[" + moveDO + "] [" + checkDI + "] 验证" + checkDI + "=Low结束:" + result);
LogUtil.info(subType + "[" + moveDO + "] [" + checkDI + "] 验证" + checkDI + "=Low结束:" + result);
}
break;
}
......@@ -416,17 +418,23 @@ namespace OnlineStore.DeviceLibrary
//判断Buzy及位置是否结束
else if (IOManager.IOValue(checkDI, subType).Equals(IO_VALUE.HIGH))
{
if (canWhileCount > 0 && span.TotalMilliseconds < 500)
{
canWhileCount--;
LogUtil.info(subType + " 异常停止,重新开始转动:[" + moveDO + "] [" + checkDI + "] 耗时 [" + FormUtil.GetSpanStr(span) + "]["+canWhileCount+"]");
LineRunAndWait(moveDO, checkDI, timeOutMS);
}
isStop = true;
}
if (isStop)
{
if (result.Equals(""))
{
LogUtil.debug("停止运动:" + result + " " + moveDO);
{
LogUtil.info(subType + "停止运动:[" + moveDO + "] [" + checkDI + "] 耗时 ["+FormUtil.GetSpanStr(span)+ "][" + canWhileCount + "]");
}
else
{
LogUtil.info("[" + moveDO + "] [" + checkDI + "] 停止运动:" + result + " " + moveDO);
LogUtil.info(subType + "[" + moveDO + "] [" + checkDI + "] 停止运动:" + result + " " + moveDO);
}
LastEndTime = DateTime.Now;
IOManager.IOMove(moveDO, IO_VALUE.LOW, subType);
......
......@@ -80,8 +80,9 @@ namespace OnlineStore.DeviceLibrary
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
}
}
private InOutParam CheckIsNeedOutStore()
{
private InOutParam CheckIsNeedOutStore( )
{
int lineNum = DeviceID % 100;
TrayInfo trayInfo = TrayManager.GetTrayInfo(currTrayNum);
if (!trayInfo.IsFull)
{
......@@ -90,13 +91,15 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - trayInfo.LastUpdateTime;
int youxianS = 180;
InOutParam inoup = trayInfo.InoutPar;
//入料失败料
if (trayInfo.IsFull && trayInfo.InoutPar.InStoreNg && this.Config.SidesWayNum.Equals(4))
{
{
//入料失败料
return inoup;
}
else if (trayInfo.InOrOutStore.Equals(ReelType.OutStore) && inoup.urgentReel.Equals(false) && inoup.cutReel.Equals(false))
{
List<int> mustLine = new List<int> ();
List<int> firstLine = new List<int> ();
//urgentReel: true 表示紧急料,需要出到料串上
//cutReel: true 表示分盘料,需要出到料串上
//smallReel: true 小料(7x8),放置到小料架上
......@@ -104,69 +107,70 @@ namespace OnlineStore.DeviceLibrary
//rfidLoc:
//是否是小盘
if (inoup.smallReel)
{
{
if (inoup.rfidLoc >= 70 && inoup.rfidLoc <= 72)
{
// 70,71,72时只能分配到3 / 4号皮带线;
if (DeviceID.Equals(203) || DeviceID.Equals(204))
{
return inoup;
}
}
else if (span.TotalSeconds > youxianS || inoup.rfidLoc.Equals(-1))
{
//,值为 - 1时,可以自由分配皮带线,,超过指定时间后随机分配
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
return inoup;
}
}
mustLine = new List<int> { 3,4};
}
else if (inoup.rfidLoc <= 46)
{
// 小料时,架位为1 - 46优先走1 / 2号皮带线
if (DeviceID.Equals(201) || DeviceID.Equals(202))
{
return inoup;
}
firstLine = new List<int> { 1, 2 };
}
else if (inoup.rfidLoc >= 47)
{
// ,47 - 92优先走3 / 4号皮带线,
if (DeviceID.Equals(203) || DeviceID.Equals(204))
{
return inoup;
}
firstLine = new List<int> { 3, 4 };
}
}
else
{
// 料架的架位大料时,架位1 - 6优先走1 / 2号皮带线, 7 - 12优先走3 / 4号皮带线
if (span.TotalSeconds > youxianS || inoup.rfidLoc.Equals(-1))
//大料12号只能走1号2后皮带线
// 料架的架位大料时,架位1 - 6,12号优先走1 / 2号皮带线,
//7 - 11优先走3 / 4号皮带线
if (inoup.Equals(12))
{
//,值为 - 1时,可以自由分配皮带线,
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
return inoup;
}
// 大料12号只能走1号2后皮带线
mustLine = new List<int> { 1, 2 };
}
else if (inoup.rfidLoc <= 6)
{
if (DeviceID.Equals(201) || DeviceID.Equals(202))
{
return inoup;
}
firstLine = new List<int> { 1, 2 };
}
else if (inoup.rfidLoc >= 7)
{
if (DeviceID.Equals(203) || DeviceID.Equals(204))
{
return inoup;
}
firstLine = new List<int> { 3, 4 };
}
}
if (mustLine.Count > 0)
{
if (mustLine.Contains(lineNum))
{
return inoup;
}
}else if (firstLine.Count > 0)
{
if (firstLine.Contains(lineNum))
{
return inoup;
}else if (LineManager.Line.ProvidingCanUse(firstLine).Equals(false))
{
//优先线不可用
return inoup;
}else if(span.TotalSeconds > youxianS)
{
//超过指定的时间
return inoup;
}
}
else
{
return inoup;
}
}
//TODO 判断是否是需要移栽出料的料盘
return null;
}
......@@ -231,8 +235,8 @@ namespace OnlineStore.DeviceLibrary
{
TrayManager.UpdateTrayNumError(-1, "");
}
//出料中,需要拦盘
InOutParam param = CheckIsNeedOutStore();
//出料中,需要拦盘
InOutParam param = CheckIsNeedOutStore( );
if(param != null)
{
SecondMoveInfo.MoveParam = param;
......
......@@ -63,30 +63,31 @@ namespace OnlineStore.DeviceLibrary
}
else if (data.RFType > 0)
{
LogUtil.error("RFID [ " + ip + " ] 读到数据 " + data.ToStr() + " 返回盘号 0");
LogUtil.error("RFID [ " + ip + " ] 读到数据 " + data.NumStr() + " 返回盘号 0");
}
else
{
LogUtil.debug("RFID [ " + ip + " ] 读到数据 " + data.ToStr() + " 返回盘号 0");
LogUtil.debug("RFID [ " + ip + " ] 读到数据 " + data.NumStr() + " 返回盘号 0");
}
return 0;
}
return 0;
}
public static string GetShelfId(int subType,out byte[] bytedata)
}
public static RFIDData GetShelfId(int subType )
{
string ip = GetRFIP(subType, 1);
RFIDData data= ReadRFID(ip);
bytedata = data.ToData();
if (data.RFType.Equals('B'))
{
return data.RFType.ToString() + "" + data.Num.ToString().PadLeft(2, '0');
}else if (data.Num > 0)
{
LogUtil.error("RFID [ " + ip + " ] 读到数据 " + data.ToStr() + " 返回料架号为空");
}
return "";
RFIDData data= ReadRFID(ip,true);
//此处料串为B料架
//bytedata = data.ToData();
//if (data.RFType.Equals('B'))
//{
// return data.RFType.ToString() + "" + data.Num.ToString().PadLeft(2, '0');
//}else if (data.Num > 0)
//{
// LogUtil.error("RFID [ " + ip + " ] 读到数据 " + data.ToStr() + " 返回料架号为空");
//}
return data;
}
public static RFIDData ReadRFID(string ip, bool isClear = false)
......@@ -109,11 +110,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error("RFID [ " + ip + " ] 读到数据=null");
}
RFIDData data = new RFIDData(bdata);
//if (isClear)
//{
// RFIDReader.Clear(ip);
//}
RFIDData data = new RFIDData(bdata);
return data;
}
}
......@@ -186,7 +183,7 @@ namespace OnlineStore.DeviceLibrary
{
return new byte[] { (byte)RFType, (byte)Num };
}
public string ToStr()
public string NumStr()
{
return "" + RFType + "" + ((int)Num).ToString().PadLeft(2, '0');
//return " [" + RFType + "],[" + Num + "] ";
......
......@@ -50,7 +50,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// PRO IO信号超时时间(秒) IOSingle_TimerOut 5000
/// PRO IO信号超时时间(秒) IOSingle_TimerOut 5000
/// </summary>
[ConfigProAttribute("IOSingle_TimerOut",false)]
public int IOSingle_TimerOut { get; set; }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!