diff --git a/Rs.SkyLine/Flow/AlarmConstID.cs b/Rs.SkyLine/Flow/AlarmConstID.cs index 8883f7f..a463465 100644 --- a/Rs.SkyLine/Flow/AlarmConstID.cs +++ b/Rs.SkyLine/Flow/AlarmConstID.cs @@ -438,6 +438,11 @@ namespace Rs.MotionPlat.Flow /// public const int 轴回原失败 = 1099; + /// + /// 皮带上有料盘报警 + /// + public const int 皮带上有料盘报警 = 1100; + diff --git a/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs b/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs index b0c5e64..f235ec6 100644 --- a/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/StockTrayFlow.cs @@ -675,27 +675,37 @@ namespace Rs.AutoDischarge.V3.Flow } break; case EStockTrayUnloadFlowStep.到下料降速位: - if(m_stockType== ETrayType.Ok || m_stockType== ETrayType.Ng|| m_stockType== ETrayType.Multi) + //determine whether there is a tray at the silo,and alarm if there is a tray + if (Ops.IsOn($"{(int)m_stockType}号料仓上料位光电检测")) { - if(!GlobalVar.DisableStockTrayKnock && GlobalVar.EnableTrayPreUnloadKnock) - { - TrayShake.Shake(m_stockType); - } - } - errCode = StockFlow.MoveOffset(SysConfigParam.GetValue("HighSpeedDistance"), GlobalVar.StockBeltSpeed); - Thread.Sleep(30); - if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis) - { - logInfo = GetClassName() + $"{GetTrayName()} 料仓到下料降速位"; - MessageQueue.Instance.Insert(logInfo); - unloadStep = EStockTrayUnloadFlowStep.等待到下料降速位; + alarmEntity = AlarmCollection.Get(AlarmConstID.皮带上有料盘报警).Transform((int)m_stockType); + AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null); } else { - //PromptMessageBox.ShowAxisAlarmDialog(StockFlow, errCode); - alarmEntity = AlarmCollection.Get($"{StockFlow.Config.AxisName}运动异常").Transform(errCode.ToString()); - AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null); + if (m_stockType == ETrayType.Ok || m_stockType == ETrayType.Ng || m_stockType == ETrayType.Multi) + { + if (!GlobalVar.DisableStockTrayKnock && GlobalVar.EnableTrayPreUnloadKnock) + { + TrayShake.Shake(m_stockType); + } + } + errCode = StockFlow.MoveOffset(SysConfigParam.GetValue("HighSpeedDistance"), GlobalVar.StockBeltSpeed); + Thread.Sleep(30); + if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis) + { + logInfo = GetClassName() + $"{GetTrayName()} 料仓到下料降速位"; + MessageQueue.Instance.Insert(logInfo); + unloadStep = EStockTrayUnloadFlowStep.等待到下料降速位; + } + else + { + //PromptMessageBox.ShowAxisAlarmDialog(StockFlow, errCode); + alarmEntity = AlarmCollection.Get($"{StockFlow.Config.AxisName}运动异常").Transform(errCode.ToString()); + AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Ok, null); + } } + break; case EStockTrayUnloadFlowStep.等待到下料降速位: if (Ops.IsStop(StockFlow) || GlobalVar.VirtualAxis) @@ -707,7 +717,7 @@ namespace Rs.AutoDischarge.V3.Flow } break; case EStockTrayUnloadFlowStep.到下料结束位: - targetFlow = 1000; + targetFlow = 100000; errCode = StockFlow.MoveOffset(targetFlow, GlobalVar.StockBeltSpeed / 4); Thread.Sleep(30); if (errCode == ErrorCode.Ok || GlobalVar.VirtualAxis) @@ -730,11 +740,90 @@ namespace Rs.AutoDischarge.V3.Flow { logInfo = GetClassName() + $"{GetTrayName()}料仓{(int)m_stockType}号料仓上料位光电检测 OK"; MessageQueue.Instance.Insert(logInfo); - Thread.Sleep(500); - StockFlow.Stop(); - Thread.Sleep(200); - - unloadStep = EStockTrayUnloadFlowStep.到下料托盘气缸下方; + int checkCount = 1; + int hasSing = 0; + Stopwatch sw= Stopwatch.StartNew(); + bool exit = false; + while (!exit) + { + if(sw.ElapsedMilliseconds < 1000 * GlobalVar.StockFlowSlowSpeedTime) + { + while (checkCount <= 10) + { + Thread.Sleep(100); + if (Ops.IsOn($"{(int)m_stockType}号料仓上料位光电检测") || GlobalVar.VirtualAxis) + { + LogHelper.Debug($"{checkCount} 次检测{(int)m_stockType}号料仓上料位光电检测 OK{hasSing}"); + hasSing++; + } + else + { + LogHelper.Debug($"{checkCount} 次检测{(int)m_stockType}号料仓上料位光电检测 NG"); + } + checkCount++; + } + if (hasSing > 8) + { + StockFlow.Stop(); + Thread.Sleep(200); + unloadStep = EStockTrayUnloadFlowStep.到下料托盘气缸下方; + sw.Stop(); + exit = true; + } + else + { + checkCount = 0; + hasSing = 0; + } + } + else + { + LogHelper.Debug("10秒内未检测到料盘"); + sw.Stop(); + StockFlow.Stop(); + Ops.On($"{(int)m_stockType}号料仓斜推气缸"); + Thread.Sleep(500); + Ops.Off($"{(int)m_stockType}号料仓斜推气缸"); + Thread.Sleep(500); + + switch (m_stockType) + { + case ETrayType.Empty1: + alarmEntity = AlarmCollection.Get(AlarmConstID.料仓上料位光电检测1号报警).Transform(m_stockType.ToString()); + break; + case ETrayType.Input: + alarmEntity = AlarmCollection.Get(AlarmConstID.料仓上料位光电检测2号报警).Transform(m_stockType.ToString()); + break; + case ETrayType.Ok: + alarmEntity = AlarmCollection.Get(AlarmConstID.料仓上料位光电检测3号报警).Transform(m_stockType.ToString()); + break; + case ETrayType.Ng: + alarmEntity = AlarmCollection.Get(AlarmConstID.料仓上料位光电检测4号报警).Transform(m_stockType.ToString()); + break; + case ETrayType.Multi: + alarmEntity = AlarmCollection.Get(AlarmConstID.料仓上料位光电检测5号报警).Transform(m_stockType.ToString()); + break; + case ETrayType.Empty2: + alarmEntity = AlarmCollection.Get(AlarmConstID.料仓上料位光电检测6号报警).Transform(m_stockType.ToString()); + break; + default: + break; + } + if (alarmEntity != null) + { + MessageQueue.Instance.Warn(GetClassName() + alarmEntity.CN); + AlarmMessageBox.ShowDialog(alarmEntity, ETipButton.Retry, null); + timer.Restart(); + exit = true; + unloadStep = EStockTrayUnloadFlowStep.到下料结束位; + } + else + { + Msg.ShowError($"翻译文件中未找到料仓上料位光电检测{(int)m_stockType}号报警"); + } + + } + } } } else diff --git a/Rs.SkyLine/Properties/AssemblyInfo.cs b/Rs.SkyLine/Properties/AssemblyInfo.cs index 487ca3e..7039b38 100644 --- a/Rs.SkyLine/Properties/AssemblyInfo.cs +++ b/Rs.SkyLine/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ using System.Runtime.InteropServices; // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: - [assembly: AssemblyVersion("20.25.07.01")] + [assembly: AssemblyVersion("20.25.08.04")] //[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]