Commit 2efb4cde LN

点位调试功能优化,自动出入库bug修改

1 个父辈 c7937a15
......@@ -87,39 +87,60 @@ namespace OnlineStore.DeviceLibrary
{
if (HomeIsEnd(box.Config.UpDown_Axis))
{
CurrStep=(StoreMoveStep.AP_03_MiddleMove);
if (paramInfo.UpdownStartPosition.Equals(0))
{
CurrStep = (StoreMoveStep.AP_04_MiddleMove);
ConfigMoveAxis axis = box.Config.Middle_Axis;
int p = paramInfo.GetCurrMiddleP();
LogUtil.info(LogName + CurrStep + " " + 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);
ConfigMoveAxis iaxis = box.Config.UpDown_Axis;
LogUtil.info(LogName + CurrStep + " " + currIndex + ":升降轴移动到开始位置:" + paramInfo.UpdownStartPosition);
AxisManager.instance.AbsMove(iaxis.DeviceName, (short)iaxis.GetAxisValue(), paramInfo.UpdownStartPosition, box.Config.UpDownAxis_P1_Speed, iaxis.AddSpeed, iaxis.DelSpeed);
}
}
}else if (CurrStep.Equals(StoreMoveStep.AP_03_UpdownMove))
{
if (AbsMoveIsEnd(box.Config.UpDown_Axis, paramInfo.UpdownStartPosition))
{
CurrStep = (StoreMoveStep.AP_04_MiddleMove);
ConfigMoveAxis axis = box.Config.Middle_Axis;
int p = paramInfo.GetCurrMiddleP();
LogUtil.info(LogName + CurrStep + " " + currIndex + ":旋转轴移动到目标位置:" + p);
AxisManager.instance.AbsMove(axis.DeviceName, (short)axis.GetAxisValue(), p, box.Config.MiddleAxis_P1_Speed, axis.AddSpeed, axis.DelSpeed);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_03_MiddleMove))
else if (CurrStep.Equals(StoreMoveStep.AP_04_MiddleMove))
{
int p = paramInfo.GetCurrMiddleP();
if (AbsMoveIsEnd(box.Config.Middle_Axis, p))
{
CurrStep=(StoreMoveStep.AP_04_InoutToP);
CurrStep=(StoreMoveStep.AP_05_InoutToP);
ConfigMoveAxis iaxis = box.Config.InOut_Axis;
LogUtil.info(LogName + CurrStep + " " + currIndex + ":进出轴移动到目标位置:" + paramInfo.InoutTargetPosition);
AxisManager.instance.AbsMove(iaxis.DeviceName, (short)iaxis.GetAxisValue(), paramInfo.InoutTargetPosition, box.Config.InOutAxis_P1_Speed, iaxis.AddSpeed, iaxis.DelSpeed);
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_04_InoutToP))
else if (CurrStep.Equals(StoreMoveStep.AP_05_InoutToP))
{
if (AbsMoveIsEnd(box.Config.InOut_Axis, paramInfo.InoutTargetPosition))
{
CurrStep=(StoreMoveStep.AP_05_UpdownMove);
CurrStep=(StoreMoveStep.AP_06_UpdownMove);
ConfigMoveAxis axis = box.Config.UpDown_Axis;
LogUtil.info(LogName + CurrStep + " " + currIndex + ":升降轴移动到目标位置:" + paramInfo.UpdownTargetPosition);
AxisManager.instance.AbsMove(axis.DeviceName, (short)axis.GetAxisValue(), paramInfo.UpdownTargetPosition, paramInfo.UpdownSpeed, axis.AddSpeed, axis.DelSpeed);
toolTimer.Interval = 50;
}
}
else if (CurrStep.Equals(StoreMoveStep.AP_05_UpdownMove))
else if (CurrStep.Equals(StoreMoveStep.AP_06_UpdownMove))
{
try
{
......@@ -286,7 +307,7 @@ namespace OnlineStore.DeviceLibrary
{
string msgStr = "请确认以下对点位参数,点击“确定”按钮开始自动校准点位:\r\n";
msgStr += " 进出轴前进位置:" + InoutTargetPosition + "\r\n";
msgStr += " 升降轴目标位置:" + UpdownTargetPosition + ",速度:"+UpdownSpeed+"\r\n";
msgStr += " 升降轴开始位置:"+UpdownStartPosition+",目标位置:" + UpdownTargetPosition + ",速度:"+UpdownSpeed+"\r\n";
msgStr += " 旋转轴位置列表:";
foreach (int mP in MiddlePositionList)
......
......@@ -939,7 +939,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private string autoInoutCode = "AUTOINOUT";
private void InOutEndProcess(StoreMoveType storeMoveType)
private void InOutEndProcess( StoreMoveType storeMoveType)
{
try
{
......@@ -952,49 +952,47 @@ namespace OnlineStore.DeviceLibrary
}
if (storeMoveType.Equals(StoreMoveType.InStore))
{
int newIndex = autoPositionIndex - 1;
int newIndex = autoPositionIndex;
if (newIndex < 0)
{
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{
newIndex = AutoStartIndex;
LogUtil.info( Name + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
LogUtil.info(Name + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动出入库结束!";
LogUtil.info( Name + "下一个索引不存在,自动 出入库结束!");
LogUtil.info(Name + "下一个索引不存在,自动 出入库结束!");
return;
}
}
else
{
autoPositionIndex = newIndex;
string posid = PositionNumList[autoPositionIndex];
InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid);
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info( Name + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
LogUtil.info(Name + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把出库信息存入排队列表中");
Reset(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(inoutinfo);
}
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info( Name + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
LogUtil.info(Name + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false);
autoMsg = "自动出库:" + posid;
AddWaitOutInfo(inoutinfo);
}
else
{
LogUtil.info( Name + "自动进入下一个出库:posid=" + posid);
LogUtil.info(Name + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutParam(inoutinfo));
}
}
}
else if (storeMoveType.Equals(StoreMoveType.OutStore))
{
int newIndex = autoPositionIndex - autoJiange;
......@@ -1003,46 +1001,28 @@ namespace OnlineStore.DeviceLibrary
if (AutoStartIndex >= 0 && AutoStartIndex < PositionNumList.Count)
{
newIndex = AutoStartIndex;
LogUtil.info( Name + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
LogUtil.info(Name + "下一个索引不存在,重新开始自动出入库,索引【" + AutoStartIndex + "】");
}
else
{
autoNext = false;
autoMsg = "自动出入库结束!";
LogUtil.info( Name + "下一个索引不存在,自动 出入库结束!");
LogUtil.info(Name + "下一个索引不存在,自动 出入库结束!");
return;
}
}
else
{
autoPositionIndex = newIndex;
string posid = PositionNumList[newIndex];
InOutPosInfo inoutinfo = new InOutPosInfo(autoInoutCode, posid);
//判断是否需要重置
if (CurrInOutACount >= Config.Box_ResetACount)
{
LogUtil.info( Name + "自动进入下一个入库:posid=" + posid + ",当时已经出入库" + CurrInOutACount + "次,需要重置BOX,先把入库信息存入排队列表中");
Reset(false);
autoMsg = "自动入库:" + posid;
AddWaitOutInfo(inoutinfo);
}
else if (CurrInOutCount >= Config.Box_ResetMCount)
{
LogUtil.info( Name + "自动进入下一个出库:posid=" + posid + ",当时已经出入库" + CurrInOutCount + "次,需要重置BOX旋转轴,先把出库信息存入排队列表中");
//ResetMiddleAxis(false);
autoMsg = "自动入库:" + posid;
AddWaitOutInfo(inoutinfo);
}
else
{
LogUtil.info( Name + "自动进入下一个入库:posid=" + posid);
LogUtil.info(Name + "自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutParam(inoutinfo));
}
}
}
}
catch (Exception ex)
{
LogUtil.error( ex.ToString());
LogUtil.error(" InOutEndProcess Error "+ex.ToString());
}
}
......
......@@ -393,21 +393,25 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
AP_02_UpdownHome,
/// <summary>
/// 位置校准:升降轴移动到开始位置
/// </summary>
AP_03_UpdownMove,
/// <summary>
/// 校准位置:旋转轴选择到对应位置
/// </summary>
AP_03_MiddleMove,
AP_04_MiddleMove,
/// <summary>
/// 校准位置:进出轴到前进位置
/// </summary>
AP_04_InoutToP,
AP_05_InoutToP,
/// <summary>
/// 校准位置:升降轴开始匀速移动到目标位置
/// </summary>
AP_05_UpdownMove,
AP_06_UpdownMove,
/// <summary>
/// 校准位置:保存当前列位置
/// </summary>
AP_06_SaveAndNext,
AP_07_SaveAndNext,
#endregion
}
......
......@@ -21,6 +21,8 @@ namespace OnlineStore.ACSingleStore
{
private BoxAutoPoint autoP;
private string LogName="自动对点位";
private string DefaultfilePath = "";
private bool IsStart = false;
private BoxBean Box = null;
//private PToolInfo workInfo = new PToolInfo();
......@@ -29,10 +31,16 @@ namespace OnlineStore.ACSingleStore
InitializeComponent();
this.Box = box;
autoP = new BoxAutoPoint(box);
DefaultfilePath = Application.StartupPath + @"\" + box.Name + @"position\";
if (!Directory.Exists(DefaultfilePath))
{
Directory.CreateDirectory(DefaultfilePath);
LogUtil.info(LogName + "创建位置保存文件夹:" + DefaultfilePath);
}
lblFileP.Text = DefaultfilePath;
this.Text = name + "_自动对点位 ";
LogName = this.Text;
txtUpdownStart.Text = 0.ToString();
FrmTool.CheckForIllegalCrossThreadCalls = false;
}
private int P3Offset = 0;
......@@ -114,7 +122,8 @@ namespace OnlineStore.ACSingleStore
group3.Enabled = !isStart;
group4.Enabled = !isStart;
group5.Enabled = true;
group6.Enabled = !isStart ;
//group6.Enabled = !isStart ;
group6.Enabled = true;
btnStart.Enabled = !isStart;
btnStop.Enabled = isStart;
axisJogControl1.Enabled = !isStart;
......@@ -143,7 +152,7 @@ namespace OnlineStore.ACSingleStore
{
workMoveStatus(false);
}
if (lblFileP.Text.Equals(""))
if (!IsStart)
{
lblMoveInfo.Text = "请按步骤确认位置信息,然后点击“开始校对位置”按钮启动位置校准";
}
......@@ -182,8 +191,15 @@ namespace OnlineStore.ACSingleStore
private void btnOpenFolder_Click(object sender, EventArgs e)
{
if (IsStart)
{
System.Diagnostics.Process.Start("Explorer.exe", autoP.paramInfo.FileTargetPath);
}
else
{
System.Diagnostics.Process.Start("Explorer.exe", DefaultfilePath);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
......@@ -269,13 +285,14 @@ namespace OnlineStore.ACSingleStore
txtInout.Focus();
return;
}
int speed = FormUtil.GetIntValue(txtSpeed);
if (speed <= (0))
int SPostion = FormUtil.GetIntValue(txtUpdownStart);
if (SPostion < 0)
{
MessageBox.Show(ResourceCulture.GetString("请输入正确的速度"), "提示");
txtSpeed.Focus();
MessageBox.Show("请输入正确的升降轴开始位置", "提示");
txtUpdownStart.Focus();
return;
}
txtUpdownStart.Text = SPostion.ToString();
int TPostion = FormUtil.GetIntValue(txtTargetPosition);
if (TPostion <= 0)
{
......@@ -283,7 +300,13 @@ namespace OnlineStore.ACSingleStore
txtTargetPosition.Focus();
return;
}
int speed = FormUtil.GetIntValue(txtSpeed);
if (speed <= (0))
{
MessageBox.Show(ResourceCulture.GetString("请输入正确的速度"), "提示");
txtSpeed.Focus();
return;
}
P3Offset = FormUtil.GetIntValue(txtP3Offset);
P4Offset = FormUtil.GetIntValue(txtP4Offset);
P5Offset = FormUtil.GetIntValue(txtP5Offset);
......@@ -293,6 +316,7 @@ namespace OnlineStore.ACSingleStore
autoP.paramInfo = new PToolInfo();
autoP.paramInfo.InoutTargetPosition = inoutP;
autoP.paramInfo.UpdownStartPosition = SPostion;
autoP.paramInfo.UpdownTargetPosition = TPostion;
autoP.paramInfo.UpdownSpeed = speed;
autoP.paramInfo.MiddlePositionList = new List<int>();
......@@ -324,10 +348,10 @@ namespace OnlineStore.ACSingleStore
autoP.paramInfo.LastValue = IO_VALUE.LOW;
string date = DateTime.Now.ToString("yyyyMMddHHmm");
string filePath = Application.StartupPath + @"\position\"+ date + @"\";
string filePath = DefaultfilePath + date + @"\";
if (Directory.Exists(filePath))
{
DialogResult result = MessageBox.Show("文件夹【" + filePath + "】已存在,将清除文件夹内容,是否确定清除?",
DialogResult result = MessageBox.Show("文件夹【" + filePath + "】已存在,将覆盖文件夹内容,是否确定继续?",
"确认提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (!result.Equals(DialogResult.OK))
{
......@@ -346,7 +370,8 @@ namespace OnlineStore.ACSingleStore
autoP.StopMove();
LogUtil.info(LogName + "开始校对位置:" + msg + " 启动定时器 ");
autoP.Start();
lblFileP.Text = "目标文件夹:" + filePath;
lblFileP.Text = filePath;
IsStart = true;
}
}
......
......@@ -126,15 +126,6 @@
<metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_position.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
......
......@@ -58,3 +58,11 @@
自动复位有问题。
保存位置弹出提示框。
20201025
1.点位调试:左右侧BOX位置分文件夹保存。
2.点位调试:增加升降轴开始位置,方便仓门列的库位调试。
3.点位调试:打开文件夹默认可用。
4.自动出入库修改。
......@@ -426,6 +426,11 @@ namespace HuichuanLibrary
Console.WriteLine(BoardName() + msg);
HCLogUtil.info(BoardName() + msg);
}
private static void DebugLog(string msg)
{
Console.WriteLine(BoardName() + msg);
HCLogUtil.debug(BoardName() + msg);
}
}
public class AxisSts
{
......
......@@ -255,7 +255,7 @@ namespace HuichuanLibrary
}
else
{
ShowLog(" Axis[" + axisNo + "] StartPtpMove " + ptpType + " OK");
DebugLog(" Axis[" + axisNo + "] StartPtpMove " + ptpType + " OK");
return true;
}
}
......@@ -274,7 +274,7 @@ namespace HuichuanLibrary
}
else
{
ShowLog(" Axis[" + axisNo + "] SetSingleAxMvPara OK");
DebugLog(" Axis[" + axisNo + "] SetSingleAxMvPara OK");
return true;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!