Commit 7bbe83b1 张东亮

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

1 个父辈 6595b475
...@@ -365,7 +365,6 @@ namespace OnlineStore.AssemblyLine ...@@ -365,7 +365,6 @@ 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();
} }
......
...@@ -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;
......
...@@ -292,7 +292,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,7 +292,7 @@ namespace OnlineStore.DeviceLibrary
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))
...@@ -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();
//停止运行时,把阻挡气缸上升 //停止运行时,把阻挡气缸上升
...@@ -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);
} }
...@@ -589,11 +589,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -589,11 +589,11 @@ 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;
} }
...@@ -723,7 +723,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -723,7 +723,7 @@ namespace OnlineStore.DeviceLibrary
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);
} }
//}); //});
...@@ -758,8 +758,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -758,8 +758,6 @@ namespace OnlineStore.DeviceLibrary
/// </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; DateTime time = DateTime.Now;
...@@ -809,15 +807,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -809,15 +807,11 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error(Name + "主定时器出错:", ex); LogUtil.error(Name + "主定时器出错:", ex);
} }
finally
{
Monitor.Exit(lockMainTimer);
}
Thread.Sleep(1); 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()
...@@ -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,15 +917,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -923,15 +917,16 @@ 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)
...@@ -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,11 +1054,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -1059,11 +1054,11 @@ 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";
...@@ -1116,7 +1111,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1116,7 +1111,7 @@ namespace OnlineStore.DeviceLibrary
} }
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;
...@@ -1160,7 +1155,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1160,7 +1155,7 @@ 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))
{ {
......
...@@ -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
...@@ -342,10 +342,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -342,10 +342,10 @@ 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))
{ {
...@@ -384,7 +384,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -384,7 +384,7 @@ namespace OnlineStore.DeviceLibrary
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));
} }
...@@ -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);
} }
...@@ -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;
} }
...@@ -847,7 +847,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -847,7 +847,7 @@ namespace OnlineStore.DeviceLibrary
{ {
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,14 +913,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -911,14 +913,14 @@ 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))
...@@ -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,18 +1164,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1153,18 +1164,10 @@ 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("连续托盘流入处理,仓门口还有一个托盘需要放行");
MIO_02_FixtureCheck();
}
else
{
CheckLog("托盘放行 SecondMove:(托盘放行结束) "); CheckLog("托盘放行 SecondMove:(托盘放行结束) ");
// IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH); // IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
SecondMoveInfo.EndMove(); SecondMoveInfo.EndMove();
} }
}
#endregion #endregion
} }
private void MIO_02_FixtureCheck() private void MIO_02_FixtureCheck()
...@@ -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);
......
...@@ -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!