Commit c20a9f00 LN

点位调试增加报警日志

1 个父辈 b1b24648
......@@ -11,11 +11,12 @@ namespace OnlineStore.DeviceLibrary
{
public class BoxAutoPoint
{
private StoreMoveStep CurrStep;
private StoreMoveInfo MoveInfo;
private BoxBean box = null;
private System.Timers.Timer toolTimer = new System.Timers.Timer();
public PToolInfo paramInfo = new PToolInfo();
private string LogName = "";
public string WarnMsg = "";
public BoxAutoPoint(BoxBean box)
{
toolTimer.Enabled = false;
......@@ -23,8 +24,9 @@ namespace OnlineStore.DeviceLibrary
toolTimer.AutoReset = true;
toolTimer.Elapsed += ToolTimer_Elapsed;
this.box = box;
CurrStep = StoreMoveStep.Wait;
LogName = box.Name + "校准点位 ";
MoveInfo = new StoreMoveInfo(box.DeviceID);
MoveInfo.NextMoveStep( StoreMoveStep.Wait);
}
public bool IsStop()
......@@ -34,8 +36,9 @@ namespace OnlineStore.DeviceLibrary
public void Start()
{
CurrStep=(StoreMoveStep.AP_01_InoutHome);
LogUtil.info(LogName + CurrStep + "第" + paramInfo.CurrIndex + "列,旋转轴位置[" + paramInfo.GetCurrMiddleP() + "] :进出轴先原点返回");
WarnMsg = "";
MoveInfo.NextMoveStep(StoreMoveStep.AP_01_InoutHome);
LogUtil.info(LogName + MoveInfo + "第" + paramInfo.CurrIndex + "列,旋转轴位置[" + paramInfo.GetCurrMiddleP() + "] :进出轴先原点返回");
ConfigMoveAxis axis = box.Config.InOut_Axis;
AxisManager.instance.HomeMove(axis.DeviceName, (short)axis.GetAxisValue(), axis.HomeHighSpeed, axis.HomeLowSpeed, axis.HomeAddSpeed);
toolTimer.Interval = 500;
......@@ -75,76 +78,101 @@ namespace OnlineStore.DeviceLibrary
try
{
int currIndex = paramInfo.CurrIndex;
if (CurrStep.Equals(StoreMoveStep.AP_01_InoutHome))
if (MoveInfo.MoveStep.Equals(StoreMoveStep.AP_01_InoutHome))
{
if (HomeIsEnd(box.Config.InOut_Axis))
{
CurrStep = (StoreMoveStep.AP_02_UpdownHome);
MoveInfo.NextMoveStep(StoreMoveStep.AP_02_UpdownHome);
LogUtil.info(LogName + CurrStep + " " + currIndex + ":升降轴原点返回");
LogUtil.info(LogName + MoveInfo + " " + currIndex + ":升降轴原点返回");
ConfigMoveAxis axis = box.Config.UpDown_Axis;
AxisManager.instance.HomeMove(axis.DeviceName, (short)axis.GetAxisValue(), axis.HomeHighSpeed, axis.HomeLowSpeed, axis.HomeAddSpeed);
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = LogName + "[" + MoveInfo.MoveStep + "]等待进出轴原点返回 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error(WarnMsg);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_02_UpdownHome))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.AP_02_UpdownHome))
{
if (HomeIsEnd(box.Config.UpDown_Axis))
{
if (paramInfo.UpdownStartPosition.Equals(0))
{
CurrStep = (StoreMoveStep.AP_04_MiddleMove);
MoveInfo.NextMoveStep(StoreMoveStep.AP_04_MiddleMove);
ConfigMoveAxis axis = box.Config.Middle_Axis;
int p = paramInfo.GetCurrMiddleP();
LogUtil.info(LogName + CurrStep + " " + currIndex + ":旋转轴移动到目标位置:" + p);
LogUtil.info(LogName + MoveInfo + " " + currIndex + ":旋转轴移动到目标位置:" + p);
AxisManager.instance.AbsMove(axis.DeviceName, (short)axis.GetAxisValue(), p, box.Config.MiddleAxis_P1_Speed, axis.AddSpeed, axis.DelSpeed);
}
else
{
CurrStep = (StoreMoveStep.AP_03_UpdownMove);
MoveInfo.NextMoveStep(StoreMoveStep.AP_03_UpdownMove);
ConfigMoveAxis iaxis = box.Config.UpDown_Axis;
LogUtil.info(LogName + CurrStep + " " + currIndex + ":升降轴移动到开始位置:" + paramInfo.UpdownStartPosition);
LogUtil.info(LogName + MoveInfo + " " + currIndex + ":升降轴移动到开始位置:" + paramInfo.UpdownStartPosition);
AxisManager.instance.AbsMove(iaxis.DeviceName, (short)iaxis.GetAxisValue(), paramInfo.UpdownStartPosition, box.Config.UpDownAxis_P1_Speed, iaxis.AddSpeed, iaxis.DelSpeed);
}
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = LogName + "[" + MoveInfo.MoveStep + "]等待升降轴原点返回 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error(WarnMsg);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_03_UpdownMove))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.AP_03_UpdownMove))
{
if (AbsMoveIsEnd(box.Config.UpDown_Axis, paramInfo.UpdownStartPosition))
{
CurrStep = (StoreMoveStep.AP_04_MiddleMove);
MoveInfo.NextMoveStep(StoreMoveStep.AP_04_MiddleMove);
ConfigMoveAxis axis = box.Config.Middle_Axis;
int p = paramInfo.GetCurrMiddleP();
LogUtil.info(LogName + CurrStep + " " + currIndex + ":旋转轴移动到目标位置:" + p);
LogUtil.info(LogName + MoveInfo + " " + currIndex + ":旋转轴移动到目标位置:" + p);
AxisManager.instance.AbsMove(axis.DeviceName, (short)axis.GetAxisValue(), p, box.Config.MiddleAxis_P1_Speed, axis.AddSpeed, axis.DelSpeed);
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = LogName + "[" + MoveInfo.MoveStep + "]等待升降轴到开始位置:" + paramInfo.UpdownStartPosition + " 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error(WarnMsg);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_04_MiddleMove))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.AP_04_MiddleMove))
{
int p = paramInfo.GetCurrMiddleP();
if (AbsMoveIsEnd(box.Config.Middle_Axis, p))
{
CurrStep = (StoreMoveStep.AP_05_InoutToP);
MoveInfo.NextMoveStep(StoreMoveStep.AP_05_InoutToP);
ConfigMoveAxis iaxis = box.Config.InOut_Axis;
LogUtil.info(LogName + CurrStep + " " + currIndex + ":进出轴移动到目标位置:" + paramInfo.InoutTargetPosition);
LogUtil.info(LogName + MoveInfo + " " + currIndex + ":进出轴移动到目标位置:" + paramInfo.InoutTargetPosition);
AxisManager.instance.AbsMove(iaxis.DeviceName, (short)iaxis.GetAxisValue(), paramInfo.InoutTargetPosition, box.Config.InOutAxis_P1_Speed, iaxis.AddSpeed, iaxis.DelSpeed);
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = LogName + "[" + MoveInfo.MoveStep + "]旋转轴移动到目标位置"+ p + " 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error(WarnMsg);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_05_InoutToP))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.AP_05_InoutToP))
{
if (AbsMoveIsEnd(box.Config.InOut_Axis, paramInfo.InoutTargetPosition))
{
CurrStep = (StoreMoveStep.AP_06_UpdownMove);
MoveInfo.NextMoveStep(StoreMoveStep.AP_06_UpdownMove);
ConfigMoveAxis axis = box.Config.UpDown_Axis;
LogUtil.info(LogName + CurrStep + " " + currIndex + ":升降轴移动到目标位置:" + paramInfo.UpdownTargetPosition);
LogUtil.info(LogName + MoveInfo + " " + currIndex + ":升降轴移动到目标位置:" + paramInfo.UpdownTargetPosition);
AxisManager.instance.AbsMove(axis.DeviceName, (short)axis.GetAxisValue(), paramInfo.UpdownTargetPosition, paramInfo.UpdownSpeed, axis.AddSpeed, axis.DelSpeed);
toolTimer.Interval = 50;
}
else if (MoveInfo.IsTimeOut(120))
{
WarnMsg = LogName + "[" + MoveInfo.MoveStep + "]进出轴移动到目标位置" + paramInfo.InoutTargetPosition + " 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒 ";
LogUtil.error(WarnMsg);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_06_UpdownMove))
else if (MoveInfo.MoveStep.Equals(StoreMoveStep.AP_06_UpdownMove))
{
try
{
......@@ -165,7 +193,7 @@ namespace OnlineStore.DeviceLibrary
{
preValue = paramInfo.PositionList[num - 2];
}
LogUtil.info(LogName + CurrStep + " " + currIndex + "【" + num + "】【" + currPos + "】【" + Math.Abs(currPos - preValue) + "】");
LogUtil.info(LogName + MoveInfo + " " + currIndex + "【" + num + "】【" + currPos + "】【" + Math.Abs(currPos - preValue) + "】");
paramInfo.LastValue = IO_VALUE.HIGH;
paramInfo.LastGetPTime = DateTime.Now;
......@@ -187,7 +215,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error("BoxAutoPoint ToolTimer_Elapsed 出错:未找到"+ CurrStep + "的处理" );
LogUtil.error("BoxAutoPoint ToolTimer_Elapsed 出错:未找到" + MoveInfo.MoveStep + "的处理");
}
}catch(Exception ex)
{
......@@ -266,9 +294,14 @@ namespace OnlineStore.DeviceLibrary
ACServerManager.instance.SuddenStop(box.Config.Middle_Axis.DeviceName, box.Config.Middle_Axis.GetAxisValue());
}
public string CurrStr()
{
string str= "位置校准中:"+CurrStep + "\r\n" +
{
string str= "位置校准中:"+MoveInfo + "\r\n" +
"当前第" + (paramInfo.CurrIndex + 1) + "/" + paramInfo.MiddlePositionList.Count + "列,已校准库位" + paramInfo.PositionList.Count + "个";
if (WarnMsg != "")
{
str += "\r\n" + WarnMsg;
}
return str;
}
}
......
......@@ -35,6 +35,8 @@
this.lblFileP = new System.Windows.Forms.Label();
this.btnOpenFolder = new System.Windows.Forms.Button();
this.group2 = new System.Windows.Forms.GroupBox();
this.txtUpdownStart = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.txtTargetPosition = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.btnUpdownP = new System.Windows.Forms.Button();
......@@ -69,8 +71,6 @@
this.panel1 = new System.Windows.Forms.Panel();
this.axisJogControl1 = new OnlineStore.ACSingleStore.AxisJogControl();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.txtUpdownStart = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.panelAll.SuspendLayout();
this.group6.SuspendLayout();
this.group2.SuspendLayout();
......@@ -108,7 +108,7 @@
this.lblMoveInfo.ForeColor = System.Drawing.Color.Blue;
this.lblMoveInfo.Location = new System.Drawing.Point(422, 379);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(498, 67);
this.lblMoveInfo.Size = new System.Drawing.Size(498, 94);
this.lblMoveInfo.TabIndex = 324;
this.lblMoveInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
......@@ -158,6 +158,25 @@
this.group2.TabStop = false;
this.group2.Text = "第二步:确认(轴二)升降轴最高位置:";
//
// txtUpdownStart
//
this.txtUpdownStart.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtUpdownStart.Location = new System.Drawing.Point(126, 23);
this.txtUpdownStart.MaxLength = 30;
this.txtUpdownStart.Name = "txtUpdownStart";
this.txtUpdownStart.Size = new System.Drawing.Size(105, 26);
this.txtUpdownStart.TabIndex = 260;
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(8, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(110, 20);
this.label1.TabIndex = 261;
this.label1.Text = "升降轴开始位置:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtTargetPosition
//
this.txtTargetPosition.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......@@ -533,25 +552,6 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// txtUpdownStart
//
this.txtUpdownStart.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtUpdownStart.Location = new System.Drawing.Point(126, 23);
this.txtUpdownStart.MaxLength = 30;
this.txtUpdownStart.Name = "txtUpdownStart";
this.txtUpdownStart.Size = new System.Drawing.Size(105, 26);
this.txtUpdownStart.TabIndex = 260;
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(8, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(110, 20);
this.label1.TabIndex = 261;
this.label1.Text = "升降轴开始位置:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// FrmTool
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......
......@@ -167,7 +167,7 @@ namespace OnlineStore.ACSingleStore
if (group1.Enabled.Equals(true))
{
workMoveStatus(true);
}
}
lblMoveInfo.Text = autoP.CurrStr();
}
......
......@@ -152,7 +152,7 @@ namespace HuichuanLibrary
}
else
{
ShowLog(" Axis[" + axisNo + "] FinishHoming OK!");
DebugLog(" Axis[" + axisNo + "] FinishHoming OK!");
return true;
}
}
......@@ -296,7 +296,7 @@ namespace HuichuanLibrary
}
else
{
ShowLog(" Axis[" + axisNo + "] MoveStop OK");
DebugLog(" Axis[" + axisNo + "] MoveStop OK");
return true;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!