Commit 7bbe83b1 张东亮

20220730 进仓门口连续流入托盘问题处理

1 个父辈 6595b475
...@@ -364,8 +364,7 @@ namespace OnlineStore.AssemblyLine ...@@ -364,8 +364,7 @@ namespace OnlineStore.AssemblyLine
{ {
MessageBox.Show(lineBean.Name + "当前状态:" + lineBean.runStatus + ",不能启动!"); MessageBox.Show(lineBean.Name + "当前状态:" + lineBean.runStatus + ",不能启动!");
return; return;
} }
RFIDManager.ClearAllBuff();
LogUtil.info("点击 开始启动"); LogUtil.info("点击 开始启动");
startTimer.Interval = 300; startTimer.Interval = 300;
startTimer.Elapsed += timer_Elapsed; startTimer.Elapsed += timer_Elapsed;
...@@ -447,7 +446,6 @@ namespace OnlineStore.AssemblyLine ...@@ -447,7 +446,6 @@ namespace OnlineStore.AssemblyLine
MessageBox.Show(lineBean.Name + "流水线未启动,无法复位"); MessageBox.Show(lineBean.Name + "流水线未启动,无法复位");
return; return;
} }
RFIDManager.ClearAllBuff();
LogUtil.info(lineBean.Name + "点击:复位"); LogUtil.info(lineBean.Name + "点击:复位");
lineBean.Reset(); lineBean.Reset();
} }
......
...@@ -13,11 +13,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,11 +13,11 @@ namespace OnlineStore.DeviceLibrary
public abstract class EquipBase : KTK_Store public abstract class EquipBase : KTK_Store
{ {
public bool IsDebug = false; public bool IsDebug = false;
public bool UseAxis = false; public bool UseAxis = false;
public ConcurrentQueue<InOutParam> waitOutStoreList = new ConcurrentQueue<InOutParam>(); public ConcurrentQueue<InOutParam> waitOutStoreList = new ConcurrentQueue<InOutParam>();
public List<InOutParam> waitInStoreList = new List<InOutParam>(); public List<InOutParam> waitInStoreList = new List<InOutParam>();
internal object waitInListLock = ""; internal object waitInListLock = "";
/// <summary> /// <summary>
///移栽装置后面分为两条移动线 ///移栽装置后面分为两条移动线
/// </summary> /// </summary>
...@@ -36,7 +36,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -36,7 +36,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public AxisBean UpdownAxis = null; public AxisBean UpdownAxis = null;
public delegate void TrayProcessEnd(int swNum, int trayNum); public delegate void TrayProcessEnd(int swNum, int trayNum);
protected virtual void StopMoveProcess() protected virtual void StopMoveProcess()
{ {
} }
...@@ -68,22 +68,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -68,22 +68,22 @@ namespace OnlineStore.DeviceLibrary
} }
this.alarmType = alarmType; this.alarmType = alarmType;
if (alarmType.Equals(LineAlarmType.SuddenStop) || alarmType.Equals(LineAlarmType.NoAirCheck) if (alarmType.Equals(LineAlarmType.SuddenStop) || alarmType.Equals(LineAlarmType.NoAirCheck)
||alarmType.Equals(LineAlarmType.AxisAlarm)||alarmType.Equals(LineAlarmType.AxisMoveError)) || alarmType.Equals(LineAlarmType.AxisAlarm) || alarmType.Equals(LineAlarmType.AxisMoveError))
{ {
if (baseConfig.DType.Equals(DeviceType.FeedingEquip)) if (baseConfig.DType.Equals(DeviceType.FeedingEquip))
{ {
//如果是入料机构,轴报警是直接停止并自动切换为调试模式,防止托盘卡 //如果是入料机构,轴报警是直接停止并自动切换为调试模式,防止托盘卡
LogInfo("报警类型:"+ alarmType + ",自动停止运行并切换为调试模式,防止托盘卡 "); LogInfo("报警类型:" + alarmType + ",自动停止运行并切换为调试模式,防止托盘卡 ");
LineManager.Line.FeedingEquipMap[DeviceID].ChangeDebug(true); LineManager.Line.FeedingEquipMap[DeviceID].ChangeDebug(true);
StopRun(); StopRun();
} }
else else
{ {
StopMove(); StopMove();
} }
} }
} }
public virtual void CheckAlarmProcess(LineMoveInfo moveInfo,LineAlarmType alarmType) public virtual void CheckAlarmProcess(LineMoveInfo moveInfo, LineAlarmType alarmType)
{ {
} }
...@@ -136,19 +136,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -136,19 +136,19 @@ namespace OnlineStore.DeviceLibrary
private DateTime lastProTimer = DateTime.Now; private DateTime lastProTimer = DateTime.Now;
protected int TimerMaxSeconds = 3; protected int TimerMaxSeconds = 3;
public void TimerProcess() public void TimerProcess()
{ {
if (Monitor.TryEnter(lockMainTimer)) if (Monitor.TryEnter(lockMainTimer))
{ {
try try
{ {
TimeSpan span = DateTime.Now - lastProTimer; //TimeSpan span = DateTime.Now - lastProTimer;
if (isInPro && span.TotalSeconds < TimerMaxSeconds) //if (isInPro && span.TotalSeconds < TimerMaxSeconds)
{ //{
return; // return;
} //}
isInPro = true; //isInPro = true;
lastProTimer = DateTime.Now; //lastProTimer = DateTime.Now;
try try
{ {
if (IsDebug && runStatus <= LineRunStatus.Wait) if (IsDebug && runStatus <= LineRunStatus.Wait)
...@@ -168,16 +168,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -168,16 +168,16 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "TimerProcess出错:", ex); LogUtil.error(Name + "TimerProcess出错:", ex);
} }
isInPro = false; // isInPro = false;
} }
finally finally
{ {
Monitor.Exit(lockMainTimer); Monitor.Exit(lockMainTimer);
} }
} }
} }
protected DateTime preIoTimerOutTime = DateTime.Now; protected DateTime preIoTimerOutTime = DateTime.Now;
protected virtual void IOTimeOutProcess() protected virtual void IOTimeOutProcess()
{ {
try try
{ {
...@@ -191,7 +191,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,7 +191,7 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
//若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过 //若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过
if (MoveInfo.MoveType.Equals(LineMoveType.None)&& SecondMoveInfo.MoveType.Equals(LineMoveType.None)&& MoveInfo.IsInWait.Equals(false) && SecondMoveInfo.IsInWait.Equals(false)) if (MoveInfo.MoveType.Equals(LineMoveType.None) && SecondMoveInfo.MoveType.Equals(LineMoveType.None) && MoveInfo.IsInWait.Equals(false) && SecondMoveInfo.IsInWait.Equals(false))
{ {
LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 "); LogUtil.info(Name + "清理信号超时报警【" + WarnMsg + "】 ");
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
...@@ -201,11 +201,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -201,11 +201,11 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("IOTimeOutProcess出错:",ex); LogUtil.error("IOTimeOutProcess出错:", ex);
} }
} }
protected bool CanStartRun() protected bool CanStartRun()
{ {
string canResult = LineManager.Line.CanStart(); string canResult = LineManager.Line.CanStart();
...@@ -226,6 +226,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -226,6 +226,8 @@ namespace OnlineStore.DeviceLibrary
isNoAirCheck = false; isNoAirCheck = false;
preTrayNum = 0; preTrayNum = 0;
currTrayNum = 0; currTrayNum = 0;
StopReadRfid();
ClearAllBuff();
} }
public void ChangeDebug(bool isDebug) public void ChangeDebug(bool isDebug)
{ {
...@@ -270,7 +272,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -270,7 +272,7 @@ namespace OnlineStore.DeviceLibrary
//顶升气缸下降 //顶升气缸下降
CylinderMove(null, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(null, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
Thread.Sleep(30); Thread.Sleep(30);
} }
} }
internal virtual bool OpenStopCylinderOk(TimeSpan span) internal virtual bool OpenStopCylinderOk(TimeSpan span)
{ {
...@@ -324,7 +326,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -324,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
if (baseConfig.DType.Equals(DeviceType.MoveEquip) || baseConfig.DType.Equals(DeviceType.ProvidingEquip)) if (baseConfig.DType.Equals(DeviceType.MoveEquip) || baseConfig.DType.Equals(DeviceType.ProvidingEquip))
{ {
LogInfo("CloseCylinderStop: 上升阻挡气缸,关闭上下气缸,顶升气缸IO"); LogInfo("CloseCylinderStop: 上升阻挡气缸,关闭上下气缸,顶升气缸IO");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
//上下气缸上升 //上下气缸上升
...@@ -337,21 +339,163 @@ namespace OnlineStore.DeviceLibrary ...@@ -337,21 +339,163 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW); IOMove(IO_Type.TopCylinder_UP, IO_VALUE.LOW);
IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW); IOMove(IO_Type.TopCylinder_Down, IO_VALUE.LOW);
Thread.Sleep(30); Thread.Sleep(30);
} }
}
#region 获取rfid缓存功能
internal ConcurrentQueue<RFIDBuff> RfidBuff = new ConcurrentQueue<RFIDBuff>();
internal bool pauseReadRfid = true;
//internal Thread readBuffRfidThread;
internal System.Timers.Timer readBuffRfidTimer;
internal void StartReadRfid()
{
pauseReadRfid = false;
}
internal void StopReadRfid()
{
pauseReadRfid = true;
}
internal bool UpdateTrayNumFromBuff()
{
trayCount++;
//此处先对托盘号进行验证
preTrayNum = currTrayNum;
if (!TrayManager.HasCheck1(DeviceID))
{
currTrayNum = TrayManager.Move5TrayNum;
LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] [" + preTrayNum + "] 当前托盘 [" + currTrayNum + "] 使用横移分流2缓存托盘号 Move5TrayNum ");
}
else
{
currTrayNum = GetTrayBuffNum(DeviceID);
LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] [" + preTrayNum + "] 当前托盘 [" + currTrayNum + "]");
if (preTrayNum.Equals(currTrayNum) && currTrayNum > 0)
{
TrayManager.TrayErrorMsg = DateTime.Now.ToLongTimeString() + " " + Name + "托盘号出现错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],连续两个托盘号一样";
LogUtil.error(Name + "托盘号错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],连续两个托盘号一样");
}
else if (!TrayManager.CheckIsRightNum(currTrayNum, preTrayNum))
{
TrayManager.TrayErrorMsg = DateTime.Now.ToLongTimeString() + " " + Name + "托盘号出现错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],托盘号不连续";
LogUtil.error(Name + "托盘号错乱:上一个托盘[" + preTrayNum + "] 当前托盘 [" + currTrayNum + "],托盘号不连续");
}
}
return true;
}
object locReadRfid = new object();
internal void ReadRfidBuff(object sender, System.Timers.ElapsedEventArgs e)
{
if(Monitor.TryEnter(locReadRfid))
{
string ip = RFIDManager.GetRFIP(DeviceID);
try
{
//while (true)
{
if (pauseReadRfid)
{
return;
}
if (RfidBuff.Count > 2)
{
LogUtil.debug($"[{Name}][{ip}]RFID缓存数量大于2个,强制清除队列缓存:{JsonHelper.SerializeObject(RfidBuff)}");
ClearAllBuff();
}
//获取盘号
RFIDData data = RFIDManager.ReadRFID(ip, true);
if (data.Num == 0)
return;
RFIDBuff rFIDBuff = new RFIDBuff() { FIDData = data };
int idx = RfidBuff.ToList().FindIndex(s => s.TrayNum.Equals(rFIDBuff.TrayNum));
if (idx == -1)
{
RfidBuff.Enqueue(rFIDBuff);
LogUtil.debug($"[{Name}][{ip}]RFID加入缓存:{JsonHelper.SerializeObject(rFIDBuff)}");
}
Thread.Sleep(50);
}
}
catch (Exception ex)
{
LogUtil.error($"【{Name}】【{ip}】ReadRfidBuff 出错", ex);
}
finally
{
Monitor.Exit(locReadRfid);
}
}
}
RFIDData getFirstTrayNum(string ip)
{
if (RfidBuff != null && RfidBuff.TryDequeue(out RFIDBuff rFID))
{
LogUtil.debug($"[{Name}][{ip}]取第一个RFID:{JsonHelper.SerializeObject(rFID)}");
return rFID.FIDData;
}
else
return new RFIDData();
} }
internal void ClearAllBuff()
{
if (RfidBuff.Count > 0)
{
RfidBuff = new ConcurrentQueue<RFIDBuff>();
LogUtil.debug($"[{Name}]清除所有RFID缓存");
}
}
int DefaultTrayNum = RFIDManager.DefaultTrayNum;
private int GetTrayBuffNum(int subType)
{
if (DefaultTrayNum > 0)
{
return DefaultTrayNum;
}
if (subType.Equals(104))
{
return LineManager.Line.Sw23TrayNum;
}
else if (subType.Equals(101))
{
return LineManager.Line.Sw41TrayNum;
}
string ip = RFIDManager.GetRFIP(subType);
RFIDData data;
data = getFirstTrayNum(ip);
if (data != null)
{
if (data.RFType.Equals('E'))
{
return data.Num;
}
else if (data.RFType > 0)
{
LogUtil.error("RFID [ " + ip + " ] 读到数据 " + data.NumStr() + " 返回盘号 0");
}
else
{
LogUtil.debug("RFID [ " + ip + " ] 读到数据 " + data.NumStr() + " 返回盘号 0");
}
return 0;
}
return 0;
}
#endregion
internal bool UpdateTrayNum() internal bool UpdateTrayNum()
{ {
trayCount++; trayCount++;
//此处先对托盘号进行验证 //此处先对托盘号进行验证
preTrayNum = currTrayNum; preTrayNum = currTrayNum;
if (!TrayManager.HasCheck1(DeviceID)) if (!TrayManager.HasCheck1(DeviceID))
{ {
currTrayNum = TrayManager.Move5TrayNum; currTrayNum = TrayManager.Move5TrayNum;
LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] [" + preTrayNum + "] 当前托盘 [" + currTrayNum + "] 使用横移分流2缓存托盘号 Move5TrayNum "); LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] [" + preTrayNum + "] 当前托盘 [" + currTrayNum + "] 使用横移分流2缓存托盘号 Move5TrayNum ");
} }
else else
{ {
currTrayNum = RFIDManager.GetTrayNum(DeviceID, true); currTrayNum = RFIDManager.GetTrayNum(DeviceID, true);
LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] [" + preTrayNum + "] 当前托盘 [" + currTrayNum + "]"); LogUtil.LOGGER.Info(Name + " [" + trayCount + "] IP [" + RFIDManager.GetRFIP(DeviceID) + "] [" + preTrayNum + "] 当前托盘 [" + currTrayNum + "]");
if (preTrayNum.Equals(currTrayNum) && currTrayNum > 0) if (preTrayNum.Equals(currTrayNum) && currTrayNum > 0)
...@@ -379,7 +523,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -379,7 +523,7 @@ namespace OnlineStore.DeviceLibrary
if (!UseAxis) if (!UseAxis)
{ {
return true; return true;
} }
IOMove(axis.Config.ServerOnDO, IO_VALUE.HIGH); IOMove(axis.Config.ServerOnDO, IO_VALUE.HIGH);
string msg = ""; string msg = "";
bool result = axis.Open(isCheck, out msg); bool result = axis.Open(isCheck, out msg);
...@@ -388,10 +532,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -388,10 +532,10 @@ namespace OnlineStore.DeviceLibrary
IOMove(axis.Config.BreakOnDO, IO_VALUE.HIGH); IOMove(axis.Config.BreakOnDO, IO_VALUE.HIGH);
return true; return true;
} }
SetWarnMsg(Name + msg,axis.Config.DisplayStr+"_轴报警"); SetWarnMsg(Name + msg, axis.Config.DisplayStr + "_轴报警");
//WarnMsg = DateTime.Now.ToLongTimeString() + " " + Name + msg; //WarnMsg = DateTime.Now.ToLongTimeString() + " " + Name + msg;
Alarm(LineAlarmType.AxisAlarm); Alarm(LineAlarmType.AxisAlarm);
return false; return false;
} }
public void CloseAxis(AxisBean axis) public void CloseAxis(AxisBean axis)
...@@ -431,9 +575,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -431,9 +575,9 @@ namespace OnlineStore.DeviceLibrary
} }
foreach (WaitResultInfo wait in list) foreach (WaitResultInfo wait in list)
{ {
if (wait == null ) if (wait == null)
{ {
LogUtil.error(Name+"[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] wait == null 跳过此项等待"); LogUtil.error(Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] wait == null 跳过此项等待");
continue; continue;
} }
if (wait.IsEnd) if (wait.IsEnd)
...@@ -458,7 +602,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -458,7 +602,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg); wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
if (wait.IsEnd) if (wait.IsEnd)
{ {
RunLogUtil.AxisLog(new AxisMoveLog(Name, wait.AxisInfo.Explain, "绝对运动", wait.TargetPosition, wait.TargetSpeed, moveInfo.LastSetpTime, DateTime.Now, moveInfo.MoveParam.PosId, moveInfo.MoveParam.WareCode)); RunLogUtil.AxisLog(new AxisMoveLog(Name, wait.AxisInfo.Explain, "绝对运动", wait.TargetPosition, wait.TargetSpeed, moveInfo.LastSetpTime, DateTime.Now, moveInfo.MoveParam.PosId, moveInfo.MoveParam.WareCode));
...@@ -468,7 +612,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -468,7 +612,7 @@ namespace OnlineStore.DeviceLibrary
{ {
isOk = false; isOk = false;
string type = moveInfo.GetStepDes() + "_轴运动报警"; string type = moveInfo.GetStepDes() + "_轴运动报警";
SetWarnMsg(msg, type,moveInfo); SetWarnMsg(msg, type, moveInfo);
Alarm(LineAlarmType.AxisMoveError); Alarm(LineAlarmType.AxisMoveError);
CheckAlarmProcess(moveInfo, LineAlarmType.AxisMoveError); CheckAlarmProcess(moveInfo, LineAlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14); LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
...@@ -493,10 +637,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -493,10 +637,10 @@ namespace OnlineStore.DeviceLibrary
if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && alarmType <= LineAlarmType.IoSingleTimeOut) if (span.TotalSeconds > LineManager.Config.IOSingle_TimerOut && alarmType <= LineAlarmType.IoSingleTimeOut)
{ {
ConfigIO io = baseConfig.getWaitIO(wait.IoType); ConfigIO io = baseConfig.getWaitIO(wait.IoType);
string msg= moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒"; string msg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
string type = moveInfo.GetStepDes() + "_" + "超时报警"; string type = moveInfo.GetStepDes() + "_" + "超时报警";
SetWarnMsg(msg, type,moveInfo); SetWarnMsg(msg, type, moveInfo);
//WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒"; //WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
//LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13); //LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13);
if (NoAlarm()) if (NoAlarm())
...@@ -505,7 +649,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -505,7 +649,7 @@ namespace OnlineStore.DeviceLibrary
CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut); CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut);
} }
} }
if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2) if (rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6 && span.TotalSeconds < LineManager.Config.IOSingle_TimerOut * 2)
{ {
preRWTime = DateTime.Now; preRWTime = DateTime.Now;
string msg = moveInfo.Name + " [" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:"; string msg = moveInfo.Name + " [" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] " + NotOkMsg + "已等待 " + Math.Round(span.TotalSeconds, 1) + "秒,重写DO:";
...@@ -548,7 +692,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -548,7 +692,7 @@ namespace OnlineStore.DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore)) else if (wait.WaitType.Equals(WaitEnum.W009_BoxCanInstore))
{ {
int storeId = moveInfo.MoveParam.GetStoreId(); int storeId = moveInfo.MoveParam.GetStoreId();
wait.IsEnd = LineServer.BoxCanReviceTray(storeId,out NotOkMsg); wait.IsEnd = LineServer.BoxCanReviceTray(storeId, out NotOkMsg);
} }
else else
{ {
...@@ -582,26 +726,27 @@ namespace OnlineStore.DeviceLibrary ...@@ -582,26 +726,27 @@ namespace OnlineStore.DeviceLibrary
} }
else if (span.TotalSeconds > moveInfo.TimeOutSeconds) else if (span.TotalSeconds > moveInfo.TimeOutSeconds)
{ {
int second = 10; int second = 10;
if (IsLowAlarm(moveInfo)) if (IsLowAlarm(moveInfo))
{ {
second = 30; second = 30;
} }
second = (int)( span.TotalSeconds / moveInfo.TimeOutSeconds) *10; second = (int)(span.TotalSeconds / moveInfo.TimeOutSeconds) * 10;
if (second > 120) if (second > 120)
{ {
second = 120; second = 120;
}else if (second < 10) }
else if (second < 10)
{ {
second = 10; second = 10;
} }
//WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒"; //WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second); //LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
string msg= moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒"; string msg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
string type = moveInfo.GetStepDes() + "_" + "超时报警"; string type = moveInfo.GetStepDes() + "_" + "超时报警";
SetWarnMsg(msg, type,moveInfo, second); SetWarnMsg(msg, type, moveInfo, second);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut); CheckAlarmProcess(moveInfo, LineAlarmType.IoSingleTimeOut);
} }
...@@ -611,7 +756,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -611,7 +756,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(moveInfo.Name + " [" + moveInfo.MoveStep + "] CheckWait 出错:", ex); LogUtil.error(moveInfo.Name + " [" + moveInfo.MoveStep + "] CheckWait 出错:", ex);
} }
} }
private bool IsLowAlarm(LineMoveInfo moveInfo) private bool IsLowAlarm(LineMoveInfo moveInfo)
{ {
//托盘卡的信号不报警,只提示 //托盘卡的信号不报警,只提示
...@@ -721,8 +866,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -721,8 +866,8 @@ namespace OnlineStore.DeviceLibrary
msg += "runS: " + runStatus + "\n"; msg += "runS: " + runStatus + "\n";
msg += "lineS: " + lineStatus + "\n"; msg += "lineS: " + lineStatus + "\n";
msg += "alarm: " + alarmType +" "+LastAlarmTime.ToLongTimeString()+ "\n"; msg += "alarm: " + alarmType + " " + LastAlarmTime.ToLongTimeString() + "\n";
msg += "MoveT:"+ MoveInfo.MoveType+"\n"; msg += "MoveT:" + MoveInfo.MoveType + "\n";
msg += "MoveS :" + MoveInfo.SLog + "\n"; msg += "MoveS :" + MoveInfo.SLog + "\n";
msg += "SMoveT:" + SecondMoveInfo.MoveType + "\n"; msg += "SMoveT:" + SecondMoveInfo.MoveType + "\n";
msg += "SMoveS:" + SecondMoveInfo.MoveStep + ""; msg += "SMoveS:" + SecondMoveInfo.MoveStep + "";
......
...@@ -205,7 +205,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -205,7 +205,7 @@ namespace OnlineStore.DeviceLibrary
if (Config.SidesWayNum <= 0) if (Config.SidesWayNum <= 0)
{ {
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
CheckLog("托盘检测:" + SecondMoveInfo.SLog + "阻挡1上升,等待FL_TrayCheck=1 ,最多等待30秒"); CheckLog("托盘检测:" + SecondMoveInfo.SLog + "阻挡1上升,等待FL_TrayCheck=1");//,最多等待30秒
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_TrayCheck, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.FL_TrayCheck, IO_VALUE.HIGH));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000)); //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
//SecondMoveInfo.OneWaitCanEndStep = true; //SecondMoveInfo.OneWaitCanEndStep = true;
......
...@@ -215,7 +215,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -215,7 +215,7 @@ namespace OnlineStore.DeviceLibrary
IoCheckTimer.Elapsed += IoCheckTimerProcess; IoCheckTimer.Elapsed += IoCheckTimerProcess;
IoCheckTimer.AutoReset = true; IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
serverConTimer = new System.Timers.Timer(); serverConTimer = new System.Timers.Timer();
serverConTimer.Interval = 3000; serverConTimer.Interval = 3000;
serverConTimer.AutoReset = true; serverConTimer.AutoReset = true;
...@@ -291,9 +291,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -291,9 +291,9 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "链条转动超过5秒,先停止链条转动"); LogUtil.info(Name + "链条转动超过5秒,先停止链条转动");
WriteDrivetMotorRun(IO_VALUE.LOW); WriteDrivetMotorRun(IO_VALUE.LOW);
if (!DisableShunt2) if (!DisableShunt2)
{ {
IOMove(IO_Type.Shunt2_StopDown1_Front, IO_VALUE.LOW ); IOMove(IO_Type.Shunt2_StopDown1_Front, IO_VALUE.LOW);
} }
} }
if (runStatus.Equals(LineRunStatus.Wait)) if (runStatus.Equals(LineRunStatus.Wait))
{ {
...@@ -332,7 +332,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -332,7 +332,7 @@ namespace OnlineStore.DeviceLibrary
// TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ; // TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ;
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
mainTimer.Enabled = false; mainTimer.Enabled = false;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
isInSuddenDown = false; isInSuddenDown = false;
isNoAirCheck = false; isNoAirCheck = false;
TrayManager.TrayErrorMsg = ""; TrayManager.TrayErrorMsg = "";
...@@ -383,7 +383,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -383,7 +383,7 @@ namespace OnlineStore.DeviceLibrary
public override bool Reset() public override bool Reset()
{ {
mainTimer.Enabled = false; mainTimer.Enabled = false;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
bool isNeedAllReset = false; bool isNeedAllReset = false;
if (isInSuddenDown || isNoAirCheck) if (isInSuddenDown || isNoAirCheck)
...@@ -410,7 +410,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -410,7 +410,7 @@ namespace OnlineStore.DeviceLibrary
RHomeOp(); RHomeOp();
foreach (EquipBase equip in AllEquipMap.Values) foreach (EquipBase equip in AllEquipMap.Values)
{ {
//如果已经转动5秒,先停止链条 //如果已经转动5秒,先停止链条
TimeSpan span = DateTime.Now - rstartTime; TimeSpan span = DateTime.Now - rstartTime;
if (span.TotalSeconds > 5) if (span.TotalSeconds > 5)
...@@ -426,7 +426,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -426,7 +426,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error(Name + "复位过程中发现 runStatus=Wait,中断启动"); LogUtil.error(Name + "复位过程中发现 runStatus=Wait,中断启动");
return false; return false;
} }
EquipReset(equip, isNeedAllReset); EquipReset(equip, isNeedAllReset);
} }
if (runStatus.Equals(LineRunStatus.Wait)) if (runStatus.Equals(LineRunStatus.Wait))
...@@ -464,7 +464,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -464,7 +464,7 @@ namespace OnlineStore.DeviceLibrary
{ {
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
mainTimer.Enabled = false; mainTimer.Enabled = false;
serverConTimer.Enabled = false ; serverConTimer.Enabled = false;
AgvClient.SetCancelState(true); AgvClient.SetCancelState(true);
RFIDManager.Close(); RFIDManager.Close();
//停止运行时,把阻挡气缸上升 //停止运行时,把阻挡气缸上升
...@@ -500,7 +500,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -500,7 +500,7 @@ namespace OnlineStore.DeviceLibrary
TimeSpan span = DateTime.Now - StartTime; TimeSpan span = DateTime.Now - StartTime;
LogUtil.info(Name + ",停止运行,总运行时间:" + span.ToString()); LogUtil.info(Name + ",停止运行,总运行时间:" + span.ToString());
} }
public DateTime LastAlarmTime = DateTime.Now; public DateTime LastAlarmTime = DateTime.Now;
public override void Alarm(LineAlarmType alarmType) public override void Alarm(LineAlarmType alarmType)
{ {
if (alarmType.Equals(LineAlarmType.None).Equals(false)) if (alarmType.Equals(LineAlarmType.None).Equals(false))
...@@ -538,7 +538,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -538,7 +538,7 @@ namespace OnlineStore.DeviceLibrary
Shunt2Stop(); Shunt2Stop();
foreach (EquipBase equip in this.AllEquipMap.Values) foreach (EquipBase equip in this.AllEquipMap.Values)
{ {
if (equip.runStatus>LineRunStatus.Wait) if (equip.runStatus > LineRunStatus.Wait)
{ {
equip.Alarm(alarmType); equip.Alarm(alarmType);
} }
...@@ -547,7 +547,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -547,7 +547,7 @@ namespace OnlineStore.DeviceLibrary
equip.CloseCylinderStop(); equip.CloseCylinderStop();
} }
} }
} }
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH); IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH);
} }
...@@ -566,7 +566,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -566,7 +566,7 @@ namespace OnlineStore.DeviceLibrary
private void CloseLed() private void CloseLed()
{ {
CheckAndMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW); CheckAndMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
CheckAndMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); CheckAndMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
CheckAndMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW); CheckAndMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
...@@ -589,12 +589,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -589,12 +589,12 @@ namespace OnlineStore.DeviceLibrary
{ {
yellowShanShuo = true; yellowShanShuo = true;
} }
if (isInSuddenDown||isNoAirCheck||alarmType>LineAlarmType.AxisAlarm ) if (isInSuddenDown || isNoAirCheck || alarmType > LineAlarmType.AxisAlarm)
{ {
isNeedAlarmLed = true; isNeedAlarmLed = true;
} }
else if(alarmType.Equals(LineAlarmType.None).Equals(false)||TrayManager.TrayErrorMsg!="") else if (alarmType.Equals(LineAlarmType.None).Equals(false) || TrayManager.TrayErrorMsg != "")
{ {
yellowShanShuo = true; yellowShanShuo = true;
} }
...@@ -720,12 +720,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -720,12 +720,12 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "收到急停信号,等待300后再次验证急停"); LogUtil.error(Name + "收到急停信号,等待300后再次验证急停");
//Task.Factory.StartNew(delegate //Task.Factory.StartNew(delegate
//{ //{
Thread.Sleep(300); Thread.Sleep(300);
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{ {
SetWarnMsg("收到急停信号,报警急停","急停报警"); SetWarnMsg("收到急停信号,报警急停", "急停报警");
Alarm(LineAlarmType.SuddenStop); Alarm(LineAlarmType.SuddenStop);
} }
//}); //});
} }
} }
...@@ -752,72 +752,66 @@ namespace OnlineStore.DeviceLibrary ...@@ -752,72 +752,66 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "定时检测报警出错:", ex); LogUtil.error(Name + "定时检测报警出错:", ex);
} }
Thread.Sleep(1); Thread.Sleep(1);
} }
/// <summary> /// <summary>
/// 定时处理,监听信号,监听IO /// 定时处理,监听信号,监听IO
/// </summary> /// </summary>
protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) protected override void mainTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
if(Monitor.TryEnter(lockMainTimer)) try
{ {
try DateTime time = DateTime.Now;
if (runStatus.Equals(LineRunStatus.Wait))
{ {
DateTime time = DateTime.Now; //取新的Io状态
if (runStatus.Equals(LineRunStatus.Wait)) IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN);
IO_VALUE lastFuwei = DILastValueMap[IO_Type.Reset_BTN];
addLastDI(IO_Type.Reset_BTN, fuweiValue);
bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1;
//收到复位信号后启动
if (isAutoStart && fuweiValue.Equals(IO_VALUE.HIGH) && lastFuwei.Equals(IO_VALUE.LOW))
{ {
//取新的Io状态 //没有启动时收到启动按钮
IO_VALUE fuweiValue = IOValue(IO_Type.Reset_BTN); LogUtil.info(Name + "没有启动时收到启动按钮,开始调用启动方法!");
IO_VALUE lastFuwei = DILastValueMap[IO_Type.Reset_BTN]; bool isOk = StartRun();
addLastDI(IO_Type.Reset_BTN, fuweiValue); if (!isOk)
bool isAutoStart = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) == 1;
//收到复位信号后启动
if (isAutoStart && fuweiValue.Equals(IO_VALUE.HIGH) && lastFuwei.Equals(IO_VALUE.LOW))
{ {
//没有启动时收到启动按钮 LogUtil.error("启动失败,等待下次启动");
LogUtil.info(Name + "没有启动时收到启动按钮,开始调用启动方法!"); mainTimer.Enabled = true;
bool isOk = StartRun();
if (!isOk)
{
LogUtil.error("启动失败,等待下次启动");
mainTimer.Enabled = true;
}
} }
return;
} }
//判断急停 return;
else if (this.runStatus >= LineRunStatus.HomeMoving) }
//判断急停
else if (this.runStatus >= LineRunStatus.HomeMoving)
{
foreach (EquipBase moveEquip in this.AllEquipMap.Values)
{ {
foreach (EquipBase moveEquip in this.AllEquipMap.Values) if (!moveEquip.IsDebug)
{ {
if (!moveEquip.IsDebug) moveEquip.TimerProcess();
{
moveEquip.TimerProcess();
}
} }
LineTimerPro();
} }
TimeSpan span = DateTime.Now - time; LineTimerPro();
if (span.TotalMilliseconds > 1000)
{
LogUtil.error(Name + "主定时器处理耗时:" + FormUtil.GetSpanStr(span));
}
}
catch (Exception ex)
{
LogUtil.error(Name + "主定时器出错:", ex);
} }
finally
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 1000)
{ {
Monitor.Exit(lockMainTimer); LogUtil.error(Name + "主定时器处理耗时:" + FormUtil.GetSpanStr(span));
} }
Thread.Sleep(1);
} }
catch (Exception ex)
{
LogUtil.error(Name + "主定时器出错:", ex);
}
Thread.Sleep(1);
} }
private bool busyPro = false ; private bool busyPro = false;
private DateTime busyProTime = DateTime.Now; private DateTime busyProTime = DateTime.Now;
private int maxSeconds = 3; private int maxSeconds = 3;
private void LineTimerPro() private void LineTimerPro()
...@@ -852,7 +846,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -852,7 +846,7 @@ namespace OnlineStore.DeviceLibrary
default: break; default: break;
} }
SideWayTimerProcess(); SideWayTimerProcess();
ShuntTimerProcess(); ShuntTimerProcess();
...@@ -877,10 +871,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -877,10 +871,10 @@ namespace OnlineStore.DeviceLibrary
{ {
if ((DateTime.Now - lastAirCloseTime).TotalSeconds > Config.AirCheckSeconds) if ((DateTime.Now - lastAirCloseTime).TotalSeconds > Config.AirCheckSeconds)
{ {
SetWarnMsg("持续"+Config.AirCheckSeconds+"秒未检测到气压信号","未检测到气压信号"); SetWarnMsg("持续" + Config.AirCheckSeconds + "秒未检测到气压信号", "未检测到气压信号");
//SendAlarmCode(0, LineAlarm.NoAirCheck); //SendAlarmCode(0, LineAlarm.NoAirCheck);
airValue = IO_VALUE.LOW; airValue = IO_VALUE.LOW;
Alarm(LineAlarmType.NoAirCheck ); Alarm(LineAlarmType.NoAirCheck);
} }
} }
else else
...@@ -923,21 +917,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -923,21 +917,22 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
}catch(Exception ex) }
catch (Exception ex)
{ {
LogUtil.error("IsReviceInPosId【"+ posId + "】出错:" + ex.ToString()); LogUtil.error("IsReviceInPosId【" + posId + "】出错:" + ex.ToString());
} }
return isReviceInfo; return isReviceInfo;
} }
#endregion #endregion
internal override void StopMove( ) internal override void StopMove()
{ {
foreach (EquipBase equip in this.AllEquipMap.Values) foreach (EquipBase equip in this.AllEquipMap.Values)
{ {
if (!equip.IsDebug) if (!equip.IsDebug)
{ {
equip.StopMove(); equip.StopMove();
} }
else else
...@@ -947,7 +942,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -947,7 +942,7 @@ namespace OnlineStore.DeviceLibrary
} }
MoveInfo.EndMove(); MoveInfo.EndMove();
WriteDrivetMotorRun(IO_VALUE.LOW); WriteDrivetMotorRun(IO_VALUE.LOW);
IOMove(IO_Type.SW4_MotorRun, IO_VALUE.LOW); IOMove(IO_Type.SW4_MotorRun, IO_VALUE.LOW);
IOMove(IO_Type.SW4_TopCylinder_Down, IO_VALUE.LOW); IOMove(IO_Type.SW4_TopCylinder_Down, IO_VALUE.LOW);
IOMove(IO_Type.SW4_TopCylinder_Up, IO_VALUE.LOW); IOMove(IO_Type.SW4_TopCylinder_Up, IO_VALUE.LOW);
...@@ -1043,7 +1038,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1043,7 +1038,7 @@ namespace OnlineStore.DeviceLibrary
else if (span.TotalSeconds > 120) else if (span.TotalSeconds > 120)
{ {
string wMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒"; string wMsg = Name + "[" + MoveInfo.MoveStep + "][" + msg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
SetWarnMsg(wMsg,$"{msg}超时", MoveInfo); SetWarnMsg(wMsg, $"{msg}超时", MoveInfo);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
} }
} }
...@@ -1059,13 +1054,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -1059,13 +1054,13 @@ namespace OnlineStore.DeviceLibrary
msg += " " + lineStatus + "\n"; msg += " " + lineStatus + "\n";
msg += "alarm: " + alarmType + "\n"; msg += "alarm: " + alarmType + "\n";
msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n"; msg += "Move:" + MoveInfo.MoveType + " " + MoveInfo.SLog + "\n";
msg += "横移41托盘:" + Sw41TrayNum.ToString().PadLeft(2,'0') + ":" + SW41_MoveInfo.MoveType + " " + SW41_MoveInfo.MoveStep + "\n"; msg += "横移41托盘:" + Sw41TrayNum.ToString().PadLeft(2, '0') + ":" + SW41_MoveInfo.MoveType + " " + SW41_MoveInfo.MoveStep + "\n";
msg += "横移23托盘:" + Sw23TrayNum.ToString().PadLeft(2,'0') + ":" + SW23_MoveInfo.MoveType + " " + SW23_MoveInfo.MoveStep + "\n"; msg += "横移23托盘:" + Sw23TrayNum.ToString().PadLeft(2, '0') + ":" + SW23_MoveInfo.MoveType + " " + SW23_MoveInfo.MoveStep + "\n";
//msg += "分流1托盘: " + ShuntTrayNum + " (" + ShuntWaitTrayNum + ")\n"; //msg += "分流1托盘: " + ShuntTrayNum + " (" + ShuntWaitTrayNum + ")\n";
msg += "分流1: " + Shunt_MoveInfo.MoveType + " " + Shunt_MoveInfo.MoveStep +" "+ ShuntTrayNum + " (" + ShuntWaitTrayNum + ") " + "\n"; msg += "分流1: " + Shunt_MoveInfo.MoveType + " " + Shunt_MoveInfo.MoveStep + " " + ShuntTrayNum + " (" + ShuntWaitTrayNum + ") " + "\n";
//msg += "分流2托盘: " + Shunt2TrayNum + " (" + Shunt2WaitTrayNum + ")\n"; //msg += "分流2托盘: " + Shunt2TrayNum + " (" + Shunt2WaitTrayNum + ")\n";
msg += "分流2: " + Shunt2_MoveInfo.MoveType + " " + Shunt2_MoveInfo.MoveStep + " " + Shunt2TrayNum + "\n"; msg += "分流2: " + Shunt2_MoveInfo.MoveType + " " + Shunt2_MoveInfo.MoveStep + " " + Shunt2TrayNum + "\n";
return msg; return msg;
} }
...@@ -1104,7 +1099,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1104,7 +1099,7 @@ namespace OnlineStore.DeviceLibrary
conLastTime = DateTime.Now; conLastTime = DateTime.Now;
List<AlarmMsg> alarmList = new List<AlarmMsg>(); List<AlarmMsg> alarmList = new List<AlarmMsg>();
if (!alarmType.Equals(LineAlarmType.None) && !alarmType.Equals(LineAlarmType.IoSingleTimeOut)) if (!alarmType.Equals(LineAlarmType.None) && !alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{ {
alarmList.Add(new AlarmMsg(Name, "line." + alarmType, WarnMsg)); alarmList.Add(new AlarmMsg(Name, "line." + alarmType, WarnMsg));
} }
...@@ -1115,8 +1110,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -1115,8 +1110,8 @@ namespace OnlineStore.DeviceLibrary
IOErrorMsg = ioMsg; IOErrorMsg = ioMsg;
} }
if (String.IsNullOrEmpty(IOErrorMsg).Equals(false)) if (String.IsNullOrEmpty(IOErrorMsg).Equals(false))
{ {
alarmList.Add(new AlarmMsg(Name, "line.IO" , IOErrorMsg)); alarmList.Add(new AlarmMsg(Name, "line.IO", IOErrorMsg));
} }
//int num = TrayDisableManager.GetDisableList().Count; //int num = TrayDisableManager.GetDisableList().Count;
...@@ -1130,7 +1125,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1130,7 +1125,7 @@ namespace OnlineStore.DeviceLibrary
//} //}
foreach (EquipBase equip in AllEquipMap.Values) foreach (EquipBase equip in AllEquipMap.Values)
{ {
if (equip.alarmType.Equals(LineAlarmType.None) || equip.WarnMsg.Contains("获取库位号超时")|| if (equip.alarmType.Equals(LineAlarmType.None) || equip.WarnMsg.Contains("获取库位号超时") ||
equip.alarmType.Equals(LineAlarmType.IoSingleTimeOut)) equip.alarmType.Equals(LineAlarmType.IoSingleTimeOut))
{ {
continue; continue;
...@@ -1151,7 +1146,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1151,7 +1146,7 @@ namespace OnlineStore.DeviceLibrary
conIsPro = false; conIsPro = false;
} }
} }
public MoveEquip GetMoveByDId(int deviceId) public MoveEquip GetMoveByDId(int deviceId)
...@@ -1160,14 +1155,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -1160,14 +1155,14 @@ namespace OnlineStore.DeviceLibrary
{ {
return MoveEquipMap[deviceId]; return MoveEquipMap[deviceId];
} }
foreach(MoveEquip m in MoveEquipMap.Values) foreach (MoveEquip m in MoveEquipMap.Values)
{ {
if (m.StoreID.Equals(deviceId)) if (m.StoreID.Equals(deviceId))
{ {
return m; return m;
} }
} }
return null; return null;
} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -107,10 +107,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -107,10 +107,12 @@ namespace OnlineStore.DeviceLibrary
{ {
ShuntTrayNum = ShuntWaitTrayNum; ShuntTrayNum = ShuntWaitTrayNum;
ShuntWaitTrayNum = -1; ShuntWaitTrayNum = -1;
LogUtil.debug($"UpateShuntTrayNum:ShuntTrayNum={ShuntTrayNum},ShuntWaitTrayNum=-1");
} }
public void ShuntStop() public void ShuntStop()
{ {
ShuntWaitTrayNum = -1; ShuntWaitTrayNum = -1;
LogUtil.debug($"ShuntWaitTrayNum=-1");
ShuntCheck1Watch.Stop(); ShuntCheck1Watch.Stop();
shuntCheck4Watch.Stop(); shuntCheck4Watch.Stop();
...@@ -249,18 +251,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,18 +251,22 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt04_Stop1Down); Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt04_Stop1Down);
LogUtil.info(Name + "[" + ShuntTrayNum + "]" + "分流横移: 不需要分流,直接放行,Shunt_StopDown1_Front 下降1200 "); LogUtil.info(Name + "[" + ShuntTrayNum + "]" + "分流横移: 不需要分流,直接放行,Shunt_StopDown1_Front ");
IOMove(IO_Type.Shunt_StopDown1_Front, IO_VALUE.HIGH, 1200); IOMove(IO_Type.Shunt_StopDown1_Front, IO_VALUE.HIGH);//1200
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_StopDown1_Front, IO_VALUE.HIGH));
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_Check1_Front, IO_VALUE.LOW));
} }
} }
else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt04_Stop1Down)) else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt04_Stop1Down))
{ {
Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt05_WaitCheck1Low); Shunt_MoveInfo.NextMoveStep(LineMoveStep.Shunt05_WaitCheck1Low);
ShuntLog("分流横移: 不需要分流,等待检测1信号消失 "); ShuntLog("分流横移: 不需要分流,等待检测1信号消失300ms ");
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_Check1_Front, IO_VALUE.LOW)); Shunt_MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Shunt_Check1_Front, IO_VALUE.LOW));
} }
else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt05_WaitCheck1Low)) else if (Shunt_MoveInfo.MoveStep.Equals(LineMoveStep.Shunt05_WaitCheck1Low))
{ {
IOMove(IO_Type.Shunt_StopDown1_Front, IO_VALUE.LOW);
Shunt_MoveInfo.EndMove(); Shunt_MoveInfo.EndMove();
ShuntLog("分流横移: 已离开 "); ShuntLog("分流横移: 已离开 ");
} }
......
...@@ -61,6 +61,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,6 +61,11 @@ namespace OnlineStore.DeviceLibrary
ClampNeedCheck = config.DIList.ContainsKey(IO_Type.ClampCylinder_Check); ClampNeedCheck = config.DIList.ContainsKey(IO_Type.ClampCylinder_Check);
UpdownAxis = new AxisBean(config.UpDown_Axis, Name); UpdownAxis = new AxisBean(config.UpDown_Axis, Name);
readBuffRfidTimer = new System.Timers.Timer();
readBuffRfidTimer.Enabled = false;
readBuffRfidTimer.Interval = 300;
readBuffRfidTimer.Elapsed += ReadRfidBuff;
readBuffRfidTimer.AutoReset = true;
} }
public override bool StartRun(bool isDebug = false) public override bool StartRun(bool isDebug = false)
...@@ -177,6 +182,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -177,6 +182,11 @@ namespace OnlineStore.DeviceLibrary
} }
private void ResetEnd() private void ResetEnd()
{ {
//启动rfid监听
//readBuffRfidThread = new Thread(ReadRfidBuff);
//readBuffRfidThread.IsBackground = true;
//readBuffRfidThread.Start();
readBuffRfidTimer.Enabled = true;
LogInfo(MoveInfo.MoveType + " 完成!"); LogInfo(MoveInfo.MoveType + " 完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
MoveInfo.EndMove(); MoveInfo.EndMove();
...@@ -232,6 +242,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -232,6 +242,7 @@ namespace OnlineStore.DeviceLibrary
CheckAndMove(IO_Type.ClampCylinder_Slack, IO_VALUE.LOW); CheckAndMove(IO_Type.ClampCylinder_Slack, IO_VALUE.LOW);
CheckAndMove(IO_Type.ClampCylinder_Tighten, IO_VALUE.LOW); CheckAndMove(IO_Type.ClampCylinder_Tighten, IO_VALUE.LOW);
runStatus = LineRunStatus.Wait; runStatus = LineRunStatus.Wait;
readBuffRfidTimer.Enabled = false;
} }
......
...@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_52_CylinderDown); MoveInfo.NextMoveStep(LineMoveStep.MO_52_CylinderDown);
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸下降 "); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸下降 ");
UpdownDownP3Move(MoveInfo.MoveParam.PlateH,MoveInfo.MoveParam.PlateW); UpdownDownP3Move(MoveInfo.MoveParam.PlateH, MoveInfo.MoveParam.PlateW);
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down); // CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down);
} }
else else
...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升,同时顶升气缸先下降"); OutLog("出库 " + MoveInfo.SLog + ": 上下气缸上升,同时顶升气缸先下降");
UpdownUpMove(); UpdownUpMove();
CylinderMove(null, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(null, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_66_CylinderUp)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MO_66_CylinderUp))
{ {
// 减去需要的盘数 // 减去需要的盘数
...@@ -255,7 +255,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -255,7 +255,7 @@ namespace OnlineStore.DeviceLibrary
} }
#endregion #endregion
} }
private void MO_55_CylinderUp() private void MO_55_CylinderUp()
{ {
MoveInfo.NextMoveStep(LineMoveStep.MO_55_CylinderUp); MoveInfo.NextMoveStep(LineMoveStep.MO_55_CylinderUp);
...@@ -301,7 +301,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -301,7 +301,7 @@ namespace OnlineStore.DeviceLibrary
lineStatus = LineStatus.InStoreExecute; lineStatus = LineStatus.InStoreExecute;
MoveInfo.MoveParam = param; MoveInfo.MoveParam = param;
MoveInfo.NewMove(LineMoveType.InStore); MoveInfo.NewMove(LineMoveType.InStore);
LogInfo("入库【" + posId + "】处理(移栽):MI_01_ToLineUp, 前后气缸后退,等待夹爪无料"); LogInfo("入库【" + posId + "】处理(移栽):MI_01_ToLineUp, 前后气缸后退,等待夹爪无料");
MoveInfo.NextMoveStep(LineMoveStep.MI_01_ToLineUp); MoveInfo.NextMoveStep(LineMoveStep.MI_01_ToLineUp);
...@@ -321,9 +321,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -321,9 +321,9 @@ namespace OnlineStore.DeviceLibrary
} }
private void MI_18_UpdownUp() private void MI_18_UpdownUp()
{ {
MoveInfo.NextMoveStep(LineMoveStep.MI_18_UpdownUp); MoveInfo.NextMoveStep(LineMoveStep.MI_18_UpdownUp);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up); CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown); SecondMoveInfo.NextMoveStep(LineMoveStep.MO_14_TopDown);
CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); CylinderMove(SecondMoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
} }
...@@ -342,16 +342,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -342,16 +342,16 @@ namespace OnlineStore.DeviceLibrary
{ {
if (!UseAxis) if (!UseAxis)
{ {
if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_03_CylinderDown)&&MoveInfo.IsTimeOut(20)) if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_03_CylinderDown) && MoveInfo.IsTimeOut(20))
{ {
//顶升气缸上升到位,升降气缸下降不到位 //顶升气缸上升到位,升降气缸下降不到位
if(CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP)&& if (CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP) &&
IOValue(IO_Type.UpDownCylinder_Up).Equals(IO_VALUE.LOW) && IOValue(IO_Type.UpDownCylinder_Up).Equals(IO_VALUE.LOW) &&
IOValue(IO_Type.UpDownCylinder_Down).Equals(IO_VALUE.LOW)) IOValue(IO_Type.UpDownCylinder_Down).Equals(IO_VALUE.LOW))
{ {
LogUtil.error(Name + "入库 [" + posId + "],升降气缸下降到托盘[" + currTrayNum + "]取料失败,升降轴上升,禁用托盘,同时放行托盘"); LogUtil.error(Name + "入库 [" + posId + "],升降气缸下降到托盘[" + currTrayNum + "]取料失败,升降轴上升,禁用托盘,同时放行托盘");
LogInfo("入库 [" + posId + "]" + MoveInfo.SLog + ": 升降轴上升,禁用托盘,同时放行托盘,顶升气缸1下降"); LogInfo("入库 [" + posId + "]" + MoveInfo.SLog + ": 升降轴上升,禁用托盘,同时放行托盘,顶升气缸1下降");
TrayDisableManager.AddDisable(currTrayNum, Name, "入库取料失败"); TrayDisableManager.AddDisable(currTrayNum, Name, "入库取料失败");
MI_18_UpdownUp(); MI_18_UpdownUp();
} }
} }
...@@ -377,21 +377,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -377,21 +377,21 @@ namespace OnlineStore.DeviceLibrary
} }
} }
else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_02_TopUP)) else if (MoveInfo.MoveStep.Equals(LineMoveStep.MI_02_TopUP))
{ {
//判断料盘检测信号是否正确 //判断料盘检测信号是否正确
if (CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP) && if (CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP) &&
LineManager.useTrayCheck.Contains(DeviceID) && LineManager.useTrayCheck.Contains(DeviceID) &&
IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.LOW)) IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.LOW))
{ {
ConfigIO io = Config.getWaitIO(IO_Type.TrayCheck); ConfigIO io = Config.getWaitIO(IO_Type.TrayCheck);
if(io!=null) if (io != null)
{ {
LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.TrayCheck)); LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.TrayCheck));
} }
LogUtil.error(Name + "入库 [" + posId + "],托盘【 " + currTrayNum + "】,有料托盘料盘检测信号不亮,升降轴上升,禁用托盘,同时放行托盘"); LogUtil.error(Name + "入库 [" + posId + "],托盘【 " + currTrayNum + "】,有料托盘料盘检测信号不亮,升降轴上升,禁用托盘,同时放行托盘");
LogInfo("入库 [" + posId + "]" + MoveInfo.SLog + ": 升降轴上升,禁用托盘,同时放行托盘,顶升气缸1下降"); LogInfo("入库 [" + posId + "]" + MoveInfo.SLog + ": 升降轴上升,禁用托盘,同时放行托盘,顶升气缸1下降");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮"); TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮");
MI_18_UpdownUp(); MI_18_UpdownUp();
} }
else else
{ {
...@@ -528,7 +528,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -528,7 +528,7 @@ namespace OnlineStore.DeviceLibrary
if (sendCount >= 3) if (sendCount >= 3)
{ {
SetWarnMsg(MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + " 等待BOX开始入库超时 已发送" + sendCount + "次","等待BOX开始入库超时"); SetWarnMsg(MoveInfo.Name + "[" + MoveInfo.MoveStep + "] " + " 等待BOX开始入库超时 已发送" + sendCount + "次", "等待BOX开始入库超时");
//LogUtil.error(WarnMsg); //LogUtil.error(WarnMsg);
Alarm(LineAlarmType.IoSingleTimeOut); Alarm(LineAlarmType.IoSingleTimeOut);
} }
...@@ -597,7 +597,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -597,7 +597,7 @@ namespace OnlineStore.DeviceLibrary
// return false; // return false;
//} //}
//判断是否验证成功,如果验证失败,不入库 //判断是否验证成功,如果验证失败,不入库
if (LineServer.RightInPosId(StoreID, cc.PosId)) if (LineServer.RightInPosId(StoreID, cc.PosId))
{ {
SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.InStoreNg); SecondMoveInfo.MoveParam = new InOutParam(cc.TrayNumber, cc.WareCode, cc.PosId, cc.PlateH, cc.PlateW, cc.InStoreNg);
return true; return true;
...@@ -641,7 +641,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -641,7 +641,7 @@ namespace OnlineStore.DeviceLibrary
if (isFull.Equals(false)) if (isFull.Equals(false))
{ {
//顶升上升时才判断 //顶升上升时才判断
if (CylinderIsOk(IO_Type.TopCylinder_Down,IO_Type.TopCylinder_UP)&& if (CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP) &&
LineManager.useTrayCheck.Contains(DeviceID) && LineManager.useTrayCheck.Contains(DeviceID) &&
IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.HIGH)) IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.HIGH))
{ {
...@@ -724,7 +724,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -724,7 +724,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (reIndex >= 0) if (reIndex >= 0)
{ {
if (CylinderIsOk(IO_Type.TopCylinder_Down,IO_Type.TopCylinder_UP)&& if (CylinderIsOk(IO_Type.TopCylinder_Down, IO_Type.TopCylinder_UP) &&
LineManager.useTrayCheck.Contains(DeviceID) && LineManager.useTrayCheck.Contains(DeviceID) &&
IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.LOW)) IOValue(IO_Type.TrayCheck).Equals(IO_VALUE.LOW))
{ {
...@@ -756,7 +756,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -756,7 +756,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "托盘号【" + currTrayNum + "】入库信息【" + currCode.ToStr() + "】料仓未验证成功,不拦截托盘,更新此托盘为NG,从waitInStoreList中删除,取消入库任务"); LogUtil.error(Name + "托盘号【" + currTrayNum + "】入库信息【" + currCode.ToStr() + "】料仓未验证成功,不拦截托盘,更新此托盘为NG,从waitInStoreList中删除,取消入库任务");
TrayManager.UpdateInStoreNG(currTrayNum, true, "Box验证入库失败"); TrayManager.UpdateInStoreNG(currTrayNum, true, "Box验证入库失败");
waitInStoreList.RemoveAt(reIndex); waitInStoreList.RemoveAt(reIndex);
SServerManager.cancelPutInTask(Name, currCode.WareCode,true); SServerManager.cancelPutInTask(Name, currCode.WareCode, true);
return false; return false;
} }
...@@ -791,7 +791,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -791,7 +791,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("*******" + logName + ",清理入库任务:【" + param.ToStr() + "】"); LogInfo("*******" + logName + ",清理入库任务:【" + param.ToStr() + "】");
if (IsCancel) if (IsCancel)
{ {
SServerManager.cancelPutInTask(Name, param.WareCode,false ); SServerManager.cancelPutInTask(Name, param.WareCode, false);
} }
return true; return true;
} }
...@@ -837,7 +837,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -837,7 +837,7 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 阻挡气缸1-1上升)"); CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 阻挡气缸1-1上升)");
if (TrayManager.HasCheck1(DeviceID)) if (TrayManager.HasCheck1(DeviceID))
{ {
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); 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_Down1, IO_VALUE.LOW));
} }
...@@ -845,9 +845,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -845,9 +845,9 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false); bool check2IsOk = TrayManager.checkWatch(trayCheck2LowWait, TrayManager.SwTrayWaitTime, false);
if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.HIGH)&& TrayManager.HasCheck1(DeviceID)) if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.HIGH) && TrayManager.HasCheck1(DeviceID))
{ {
if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk && canpro) if (TrayManager.checkWatch(trayCheckWait, TrayManager.SwTrayWaitTime, false) && check2IsOk && canpro)
{ {
...@@ -856,12 +856,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -856,12 +856,14 @@ namespace OnlineStore.DeviceLibrary
//托盘在第一个阻挡处 //托盘在第一个阻挡处
SecondMoveInfo.NewMove(LineMoveType.CheckFixture); SecondMoveInfo.NewMove(LineMoveType.CheckFixture);
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_00_Stop1Down);
CheckLog(" 托盘检测:料盘检测StopCylinder_Check1 " + SecondMoveInfo.SLog + "阻挡气缸1-1下降 , 等待 StopCylinder_Check1=0,清理托盘RFID");
ClearTrayRFID(); ClearTrayRFID();
ClearAllBuff();
StartReadRfid();
CheckLog(" 托盘检测:料盘检测StopCylinder_Check1 " + SecondMoveInfo.SLog + "阻挡气缸1-1下降 , 等待 StopCylinder_Check1=0,清理托盘RFID,开始记录rfid缓存");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);//TrayManager.StopDTime IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);//TrayManager.StopDTime
SecondMoveInfo.OneWaitCanEndStep = true; SecondMoveInfo.OneWaitCanEndStep = true;
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000)); //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
} }
} }
...@@ -911,28 +913,28 @@ namespace OnlineStore.DeviceLibrary ...@@ -911,28 +913,28 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopDownWait); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_01_StopDownWait);
//CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 再次等待前阻挡检测消失或托盘到达"); CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 再次等待前阻挡检测消失");
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 300ms后StopCylinder_Check1上升"); //CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 100ms后StopCylinder_Check1上升");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); // IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
// SecondMoveInfo.OneWaitCanEndStep = true; // SecondMoveInfo.OneWaitCanEndStep = true;
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW)); // SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check1, IO_VALUE.LOW));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH)); // SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
} }
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_01_StopDownWait)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_01_StopDownWait))
{ {
MIO_02_FixtureCheck(); MIO_02_FixtureCheck();
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_02_FixtureCheck)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MIO_02_FixtureCheck))
{ {
//if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH)) //if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
//{ //{
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_03_Stop2Down);
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 再次等待托盘信号"); CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 再次等待托盘信号");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
//} //}
//else //else
//{ //{
...@@ -953,9 +955,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -953,9 +955,18 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
try
{
StopReadRfid();
LogUtil.info($"【{Name}】停止记录rfid缓存");
}
catch (Exception ex1)
{
LogUtil.error($"【{Name}】停止记录rfid缓存:", ex1);
}
//判断是否需要顶升 //判断是否需要顶升
bool isNeed = false; bool isNeed = false;
UpdateTrayNum(); UpdateTrayNumFromBuff();
bool isFull = TrayManager.TrayIsFull(currTrayNum); bool isFull = TrayManager.TrayIsFull(currTrayNum);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false)) if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{ {
...@@ -1153,37 +1164,29 @@ namespace OnlineStore.DeviceLibrary ...@@ -1153,37 +1164,29 @@ namespace OnlineStore.DeviceLibrary
} }
else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_19_StopCylinder_Back)) else if (SecondMoveInfo.MoveStep.Equals(LineMoveStep.MO_19_StopCylinder_Back))
{ {
if(RFIDManager.CheckHasSecond(DeviceID)) CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
{ // IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
CheckLog("连续托盘流入处理,仓门口还有一个托盘需要放行"); SecondMoveInfo.EndMove();
MIO_02_FixtureCheck();
}
else
{
CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.EndMove();
}
} }
#endregion #endregion
} }
private void MIO_02_FixtureCheck() private void MIO_02_FixtureCheck()
{ {
//if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.LOW) || IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH)) //if (IOValue(IO_Type.StopCylinder_Check1).Equals(IO_VALUE.LOW) || IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
//{ //{
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_02_FixtureCheck); SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_02_FixtureCheck);
CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 阻挡气缸1-1上升,等待 阻挡2托盘检测=1)"); CheckLog("托盘阻挡" + SecondMoveInfo.SLog + " 阻挡气缸1-1上升,等待 阻挡2托盘检测=1)");
if (DeviceID.Equals(5)) if (DeviceID.Equals(5))
{ {
SecondMoveInfo.TimeOutSeconds = 20; SecondMoveInfo.TimeOutSeconds = 20;
} }
//SecondMoveInfo.OneWaitCanEndStep = true; //SecondMoveInfo.OneWaitCanEndStep = true;
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH)); SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Check2, IO_VALUE.HIGH));
//最多等待30秒 //最多等待30秒
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000)); //SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(30000));
//} //}
//else //else
//{ //{
...@@ -1191,7 +1194,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1191,7 +1194,7 @@ namespace OnlineStore.DeviceLibrary
// LogInfo(SecondMoveInfo.SLog + "未等到信号 StopCylinder_Check1=LOW,或 StopCylinder_Check2=HIGH,结束处理 "); // LogInfo(SecondMoveInfo.SLog + "未等到信号 StopCylinder_Check1=LOW,或 StopCylinder_Check2=HIGH,结束处理 ");
// SecondMoveInfo.EndMove(); // SecondMoveInfo.EndMove();
//} //}
} }
private void MO_16_Stop2Down() private void MO_16_Stop2Down()
{ {
if (LineManager.Line.Move9CanStop2Down(DeviceID, currTrayNum)) if (LineManager.Line.Move9CanStop2Down(DeviceID, currTrayNum))
...@@ -1204,7 +1207,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1204,7 +1207,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (SecondMoveInfo.IsTimeOut(120)) else if (SecondMoveInfo.IsTimeOut(120))
{ {
MoveTimeoutAlarm(SecondMoveInfo, "等待分流横移1空闲"); MoveTimeoutAlarm(SecondMoveInfo, $"等待分流横移1空闲【{LineManager.Line.ShuntWaitTrayNum}】");
//WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveType + "][" + SecondMoveInfo.SLog + "]等待分流横移1空闲[" + Math.Round(SecondMoveInfo.StepSpan().TotalSeconds, 1) + "]秒"; //WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveType + "][" + SecondMoveInfo.SLog + "]等待分流横移1空闲[" + Math.Round(SecondMoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 12); //LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut); //Alarm(LineAlarmType.IoSingleTimeOut);
...@@ -1236,12 +1239,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -1236,12 +1239,12 @@ namespace OnlineStore.DeviceLibrary
return true; return true;
} }
if (SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture) && SecondMoveInfo.MoveStep >= LineMoveStep.MIO_03_Stop2Down) if (SecondMoveInfo.MoveType.Equals(LineMoveType.CheckFixture) && SecondMoveInfo.MoveStep >= LineMoveStep.MIO_03_Stop2Down)
{ {
return true; return true;
} }
if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.StopCylinder_Check2).Equals(IO_VALUE.HIGH))
{ {
return true; return true;
} }
return false; return false;
} }
......
...@@ -7,6 +7,7 @@ using System.Collections.Concurrent; ...@@ -7,6 +7,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -14,7 +15,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public class RFIDManager public class RFIDManager
{ {
private static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum); public static int DefaultTrayNum = ConfigAppSettings.GetIntValue(Setting_Init.DefaultTrayNum);
private static ReadAll readAll = new ReadAll("TheRFID"); private static ReadAll readAll = new ReadAll("TheRFID");
private static bool IsOpen = false; private static bool IsOpen = false;
private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>(); private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
...@@ -40,53 +41,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -40,53 +41,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("Open 出错:" + ex.ToString()); LogUtil.error("Open 出错:" + ex.ToString());
} }
} }
public static ConcurrentDictionary<string, ConcurrentQueue<RFIDBuff>> RfidBuff = new ConcurrentDictionary<string, ConcurrentQueue<RFIDBuff>>();
static int getFirstTrayNum(string ip, int curNum)
{
RFIDBuff rFIDBuff = new RFIDBuff() { TrayNum = curNum, UpdateTime = DateTime.Now };
if (!RfidBuff.ContainsKey(ip))
{
RfidBuff.TryAdd(ip, new ConcurrentQueue<RFIDBuff>());
RfidBuff[ip].Enqueue(rFIDBuff);
}
else
{
if (!RfidBuff[ip].Contains(rFIDBuff))
RfidBuff[ip].Enqueue(rFIDBuff);
}
LogUtil.info($"[{ip}]加入缓存:{JsonHelper.SerializeObject(rFIDBuff)}");
if (RfidBuff[ip].TryDequeue(out RFIDBuff rFID))
{
LogUtil.info($"[{ip}]取第一个RFID:{JsonHelper.SerializeObject(rFID)}");
return rFID.TrayNum;
}
else
return 0;
}
static void clearTrayNumBuff(string ip)
{
//if (RfidBuff.ContainsKey(ip))
//{
// if (RfidBuff[ip].Count>0)
// RfidBuff[ip] = new ConcurrentQueue<RFIDBuff>();
//}
//LogUtil.info($"[{ip}]清除RFID缓存");
}
public static void ClearAllBuff()
{
//RfidBuff = new ConcurrentDictionary<string, ConcurrentQueue<RFIDBuff>>();
//LogUtil.info($"清除所有RFID缓存");
}
public static bool CheckHasSecond(int subType)
{
//string ip = GetRFIP(subType);
//if (RfidBuff.ContainsKey(ip))
//{
// if (RfidBuff[ip].Count > 0)
// return true;
//}
return false;
}
public static int GetTrayNum(int subType, bool isClear = false) public static int GetTrayNum(int subType, bool isClear = false)
{ {
if (DefaultTrayNum > 0) if (DefaultTrayNum > 0)
...@@ -109,7 +63,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -109,7 +63,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (data.RFType.Equals('E')) if (data.RFType.Equals('E'))
{ {
return data.Num;// return getFirstTrayNum(ip, data.Num); return data.Num;
} }
else if (data.RFType > 0) else if (data.RFType > 0)
{ {
...@@ -139,7 +93,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -139,7 +93,6 @@ namespace OnlineStore.DeviceLibrary
string ip = GetRFIP(subType); string ip = GetRFIP(subType);
RFIDData data = ReadRFID(ip, true); RFIDData data = ReadRFID(ip, true);
clearTrayNumBuff(ip);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -210,16 +163,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -210,16 +163,8 @@ namespace OnlineStore.DeviceLibrary
} }
public class RFIDBuff public class RFIDBuff
{ {
public int TrayNum { get; set; } public RFIDData FIDData { get; set; }
public DateTime UpdateTime { get; set; } public int TrayNum { get { return FIDData.Num; } }
public override bool Equals(object obj)
{
RFIDBuff buf = obj as RFIDBuff;
if (buf == null)
return false;
return this.TrayNum.Equals(buf.TrayNum);
}
} }
public class RFIDData public class RFIDData
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!