优化报警器

优化报警信息是否需要报警器
master
lhiven 12 months ago
parent 017bb3a6f8
commit 5fe238bbe7

@ -0,0 +1,74 @@
using Rs.Framework;
using Rs.MotionPlat.Flow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Rs.MotionPlat.Commom
{
/// <summary>
/// 蜂鸣器管理
/// </summary>
public class BuzzerManager
{
private static BuzzerManager instance;
public static BuzzerManager Instance
{
get
{
if(instance == null)
instance = new BuzzerManager();
return instance;
}
}
bool bexit = false;
bool bRun = false;
public void On()
{
bRun = true;
}
public void Off()
{
bRun=false;
}
public void Exit()
{
bexit = true;
}
public void Run()
{
Task.Run(() => {
while (!bexit)
{
if(!bRun)
{
Thread.Sleep(100);
}
if (bRun)
{
if(MachineManage.Instance.MachineStatus!= EMachineStatus.Stop)
{
if(!GlobalVar.DisableBuzzer)
{
Ops.On("蜂鸣器");
Thread.Sleep(500);
Ops.Off("蜂鸣器");
Thread.Sleep(1000);
}
}
}
Thread.Sleep(100);
}
});
}
}
}

@ -17,28 +17,19 @@ namespace Rs.MotionPlat.Commom
/// <summary>
/// 显示模态弹框
/// </summary>
public static EButtonType ShowDialog(EButtonType buttons,string content,string title="")
public static EButtonType ShowDialog(EButtonType buttons,string content,string title="",bool warning=false)
{
if(!GlobalVar.DisableBuzzer)
if (warning)
{
Ops.On("蜂鸣器");
BuzzerManager.Instance.On();
}
LightManger.Instance.SetStatus(ELightStatus.Red);
LogHelper.Debug(content);
EButtonType ret = EButtonType.None;
FrmDialog fd = new FrmDialog();
ret = fd.ShowMessage(buttons, content, "",title);
if (!GlobalVar.DisableBuzzer)
{
Ops.Off("蜂鸣器");
}
if (MachineManage.Instance.MachineStatus== EMachineStatus.Stop)
if(warning)
{
LightManger.Instance.SetStatus(ELightStatus.Yellow);
}
else if(MachineManage.Instance.MachineStatus== EMachineStatus.Working)
{
LightManger.Instance.SetStatus(ELightStatus.Green);
BuzzerManager.Instance.Off();
}
return ret;
}
@ -51,10 +42,11 @@ namespace Rs.MotionPlat.Commom
/// <returns></returns>
public static EButtonType ShowDialog(AlarmEntity alarmInfo, EButtonType buttons)
{
if (!GlobalVar.DisableBuzzer)
{
Ops.On("蜂鸣器");
}
//if (!GlobalVar.DisableBuzzer)
//{
// Ops.On("蜂鸣器");
//}
BuzzerManager.Instance.On();
LightManger.Instance.SetStatus(ELightStatus.Red);
string logInfo = $"{alarmInfo.CN}";
LogHelper.Debug(logInfo);
@ -65,18 +57,19 @@ namespace Rs.MotionPlat.Commom
boxList.Add(alarmInfo.AlarmID, fd);
ret = fd.ShowMessage(buttons, alarmInfo.CN,alarmInfo.EN);
boxList.Remove(alarmInfo.AlarmID);
if (!GlobalVar.DisableBuzzer)
{
Ops.Off("蜂鸣器");
}
if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop)
{
LightManger.Instance.SetStatus(ELightStatus.Yellow);
}
else if (MachineManage.Instance.MachineStatus == EMachineStatus.Working)
{
LightManger.Instance.SetStatus(ELightStatus.Green);
}
//if (!GlobalVar.DisableBuzzer)
//{
// Ops.Off("蜂鸣器");
//}
//if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop)
//{
// LightManger.Instance.SetStatus(ELightStatus.Yellow);
//}
//else if (MachineManage.Instance.MachineStatus == EMachineStatus.Working)
//{
// LightManger.Instance.SetStatus(ELightStatus.Green);
//}
BuzzerManager.Instance.Off();
}
return ret;
}

@ -95,6 +95,7 @@ namespace Rs.MotionPlat.Commom
SimulateTesterManager.Instance.Init();
}
});
BuzzerManager.Instance.Run();
}
static void InitDb()

@ -134,7 +134,7 @@ namespace Rs.MotionPlat.Commom
if (errCode > Motion.ErrorCode.Ok)
{
//Msg.ShowError($"axis {axisname} move fail {errCode}");
Msgbox.ShowDialog(EButtonType.Ok, $"axis {axisname} move fail {errCode}");
Msgbox.ShowDialog(EButtonType.Ok, $"axis {axisname} move fail {errCode}","move",true);
}
}
}

@ -623,7 +623,7 @@ namespace Rs.MotionPlat.Entitys
Task.Run(() => {
string errInfo = $"tc{Index} test,code:{items[1]},desc:{items[2]}";
MessageQueue.Instance.Warn(errInfo);
Msgbox.ShowDialog(EButtonType.Ok, errInfo);
Msgbox.ShowDialog(EButtonType.Ok, errInfo,"testfixture error",true);
});
}
}

@ -524,7 +524,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow
}
else
{
Msgbox.ShowDialog(EButtonType.Retry, "Calib fail,please select retry");
Msgbox.ShowDialog(EButtonType.Retry, "Calib fail,please select retry", "tip", true);
}
break;
case ECalibrationCheckFlowStep.:

@ -212,7 +212,7 @@ namespace Rs.MotionPlat.Flow
//if(Stock2Flow.Instance.GetCurrentLayer()==1)
if(StockManager.GetCurrentLayer(2)==1)
{
EButtonType btn = Msgbox.ShowDialog( EButtonType.Retry| EButtonType.EndInput,"请更换料盘");
EButtonType btn = Msgbox.ShowDialog( EButtonType.Retry| EButtonType.EndInput,"请更换料盘","tip",true);
if(btn== EButtonType.Retry)
{
//先把轴移动到安全位
@ -330,7 +330,7 @@ namespace Rs.MotionPlat.Flow
}
else
{
Msgbox.ShowDialog(EButtonType.Ok, "Retest料盘已放满请更换料盘更换完成后点击确定");
Msgbox.ShowDialog(EButtonType.Ok, "Retest料盘已放满请更换料盘更换完成后点击确定","tip",true);
GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave);
ThreePointLocationFlow.Instance.Location(ETrayType.ReTest);
//放料
@ -344,7 +344,7 @@ namespace Rs.MotionPlat.Flow
else if (fixtureret.Result == EOneGrabSixteenResult.Slant)
{
//报警弹框
EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, $"穴位{ret.SlotIndex}定位失败,请把产品手动取走后点击跳过");
EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, $"穴位{ret.SlotIndex}定位失败,请把产品手动取走后点击跳过","tip",true);
if (buttonSelect == EButtonType.Skip)
{
exit = true;
@ -541,7 +541,7 @@ namespace Rs.MotionPlat.Flow
else
{
//提示更换料盘
Msgbox.ShowDialog(EButtonType.Ok, "NG料盘已满请更换料盘更换完成后点击确定");
Msgbox.ShowDialog(EButtonType.Ok, "NG料盘已满请更换料盘更换完成后点击确定","tip",true);
ThreePointLocationFlow.Instance.Location(ETrayType.Ng);
GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave);
}

@ -557,7 +557,7 @@ namespace Rs.MotionPlat.Flow
else
{
//取料失败报警
Msgbox.ShowDialog(EButtonType.Retry, "治具取料失败报警");
Msgbox.ShowDialog(EButtonType.Retry, "治具取料失败报警", "error", true);
}
break;
case EGrrFlowStep.:

@ -80,7 +80,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow
case EPrepareTray1FlowStep.:
if(HasTray() && GetCurrentLayer()>0)
{
Msgbox.ShowDialog(EButtonType.Retry, "Ok料仓处有料盘请点击重试后取走料盘");
Msgbox.ShowDialog(EButtonType.Retry, "Ok料仓处有料盘请点击重试后取走料盘", "error", true);
OutStock();
InStock();
prepareTrayStep = EPrepareTray1FlowStep.;

@ -94,7 +94,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow
}
else
{
Msgbox.ShowDialog(EButtonType.Retry, "Input料仓处料盘少于2盘选择重试后弹出料仓");
Msgbox.ShowDialog(EButtonType.Retry, "Input料仓处料盘少于2盘选择重试后弹出料仓", "error", true);
OutStock();
InStock();
prepareTrayStep = EPrepareTray2FlowStep.;

@ -90,7 +90,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow
}
else
{
Msgbox.ShowDialog(EButtonType.Retry, "Input料仓处料盘少于2盘选择重试后弹出料仓");
Msgbox.ShowDialog(EButtonType.Retry, "Input料仓处料盘少于2盘选择重试后弹出料仓","error",true);
OutStock();
InStock();
prepareTrayStep = EPrepareTray3FlowStep.;

@ -109,7 +109,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow
}
else if (stopwatch.ElapsedMilliseconds > 5000)
{
Msgbox.ShowDialog(EButtonType.Retry, "抽屉锁原位异常,请处理后点击重试");
Msgbox.ShowDialog(EButtonType.Retry, "抽屉锁原位异常,请处理后点击重试","error",true);
}
break;
case EOutStockFlowStep.:
@ -209,7 +209,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow
}
else if (stopwatch.ElapsedMilliseconds > 5000)
{
Msgbox.ShowDialog(EButtonType.Retry, "抽屉锁原位异常,请处理后点击重试");
Msgbox.ShowDialog(EButtonType.Retry, "抽屉锁原位异常,请处理后点击重试","error",true);
}
break;
case EInStockFlowStep.:

@ -329,7 +329,7 @@ namespace Rs.MotionPlat.Flow
}
if(noHasProduct.Count>0)
{
EButtonType btn = Msgbox.ShowDialog(EButtonType.Retry | EButtonType.Skip, "料盘未放满,请处理");
EButtonType btn = Msgbox.ShowDialog(EButtonType.Retry | EButtonType.Skip, "料盘未放满,请处理","tray info",true);
if(btn== EButtonType.Retry)
{
step = ETakeTrayFlowStep.;

@ -228,7 +228,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
else
{
Msgbox.ShowDialog(EButtonType.Recheck, $"治具{curFixture.Index}取料真空检测异常,请处理");
Msgbox.ShowDialog(EButtonType.Recheck, $"治具{curFixture.Index}取料真空检测异常,请处理","vac error",true);
}
break;

@ -159,7 +159,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
else
{
Msgbox.ShowDialog(EButtonType.Retry, "一拍十六拍照失败,请处理后点击重试");
Msgbox.ShowDialog(EButtonType.Retry, "一拍十六拍照失败,请处理后点击重试","grab fail",true);
flowStep = EProductLocationFlowStep.;
}
break;

@ -124,6 +124,7 @@
<Compile Include="Commom\ActiveForms.cs" />
<Compile Include="Commom\AxisAlias.cs" />
<Compile Include="Commom\AxisPosPrint.cs" />
<Compile Include="Commom\BuzzerManager.cs" />
<Compile Include="Commom\Enums.cs" />
<Compile Include="Commom\FixtureManager.cs" />
<Compile Include="Commom\GlobalTray.cs" />

@ -92,7 +92,7 @@ namespace Rs.MotionPlat.SysConfig
}
else if (fixtureret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)
{
EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Retry | EButtonType.Skip, $"穴位{i + 1}扫码失败");
EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Retry | EButtonType.Skip, $"穴位{i + 1}扫码失败","scan fail",true);
if (buttonSelect == EButtonType.Skip)
{
logInfo = $"{i + 1},NG\r\n";
@ -106,7 +106,7 @@ namespace Rs.MotionPlat.SysConfig
}
else if (fixtureret.Result == EOneGrabSixteenResult.Slant)
{
EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Retry | EButtonType.EndInput | EButtonType.Skip, $"穴位{i + 1}定位失败");
EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Retry | EButtonType.EndInput | EButtonType.Skip, $"穴位{i + 1}定位失败","location fail",true);
if (buttonSelect == EButtonType.EndInput)
{
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();

@ -61,6 +61,8 @@
this.radioButton9 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button14 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@ -440,11 +442,33 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "groupBox2";
//
// button14
//
this.button14.Location = new System.Drawing.Point(493, 479);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(75, 23);
this.button14.TabIndex = 33;
this.button14.Text = "button14";
this.button14.UseVisualStyleBackColor = true;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// button15
//
this.button15.Location = new System.Drawing.Point(594, 479);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(75, 23);
this.button15.TabIndex = 33;
this.button15.Text = "button14";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.button15_Click_1);
//
// TestFrm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1336, 854);
this.Controls.Add(this.button15);
this.Controls.Add(this.button14);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button12);
@ -503,5 +527,7 @@
private System.Windows.Forms.RadioButton radioButton9;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button15;
}
}

@ -318,5 +318,15 @@ namespace Rs.MotionPlat
});
}
private void button14_Click(object sender, EventArgs e)
{
BuzzerManager.Instance.On();
}
private void button15_Click_1(object sender, EventArgs e)
{
BuzzerManager.Instance.Off();
}
}
}

Loading…
Cancel
Save