Commit eb2722ae LN

增加升降轴对位置功能

1 个父辈 ace18d91
......@@ -2604,7 +2604,6 @@
this.升降轴位置调试ToolStripMenuItem.Name = "升降轴位置调试ToolStripMenuItem";
this.升降轴位置调试ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
this.升降轴位置调试ToolStripMenuItem.Text = "升降轴位置调试";
this.升降轴位置调试ToolStripMenuItem.Visible = false;
this.升降轴位置调试ToolStripMenuItem.Click += new System.EventHandler(this.升降轴位置调试ToolStripMenuItem_Click);
//
// toolStripSeparator11
......
......@@ -1799,8 +1799,8 @@ namespace OnlineStore.AutoInOutStore
int ioIndex = 0;
if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
{
ioIP = store.Config.StoreDIList[IO_Type.UpdownPositionSingal].DeviceName;
ioIndex = store.Config.StoreDIList[IO_Type.UpdownPositionSingal].GetIOAddr();
ioIP = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].DeviceName;
ioIndex = store.Config.StoreDIList[IO_Type.TrayCheck_Fixture].GetIOAddr();
}
FrmPositionTool frm = new FrmPositionTool(PortName, slvAddr, ioIP, ioIndex);
frm.ShowDialog();
......
......@@ -47,7 +47,7 @@ namespace OnlineStore.AutoInOutStore
ACServerManager.IsShowMsg = false;
LogUtil.logBox = this.richTextBox1;
//ACServerManager.richeBox = this.richTextBox1;
formStatus(false);
CheckForIllegalCrossThreadCalls = false;
txtPortName.Text = PortName;
txtAddr.Text = SlvAddr.ToString();
......@@ -57,12 +57,26 @@ namespace OnlineStore.AutoInOutStore
if (IOManager.instance == null)
{
IOManager.Init();
IOManager.instance.ConnectionIOList(new List<string> { IoIp });
IOManager.instance.ConnectionIOList(new List<string> { /*IoIp*/ });
}
//判断伺服是否已经打开
bool isOn = ACServerManager.ServerOnStatus(PortName, SlvAddr);
formStatus(isOn);
timer1.Start();
ioStatusControl1.IOName = "检测信号";
}
private void btnServoOn_Click(object sender, EventArgs e)
{
//PositionList.Add(32000);
//PositionList.Add(38000);
//PositionList.Add(44000);
//PositionList.Add(50000);
//PositionList.Add(56000);
//P3Offset = FormUtil.GetIntValue(txtP3Offset);
//P4Offset = FormUtil.GetIntValue(txtP4Offset);
//P5Offset = FormUtil.GetIntValue(txtP5Offset);
//P6Offset = FormUtil.GetIntValue(txtP6Offset);
//StopTimer();
this.PortName = txtPortName.Text;
this.SlvAddr = FormUtil.GetIntValue(txtAddr);
bool result = ACServerManager.OpenPort(PortName);
......@@ -85,6 +99,7 @@ namespace OnlineStore.AutoInOutStore
{
}
}
private void btnServoOff_Click(object sender, EventArgs e)
......@@ -102,9 +117,7 @@ namespace OnlineStore.AutoInOutStore
}
ACServerManager.ServoOff(PortName, SlvAddr);
formStatus(false );
formStatus(false);
}
private void formStatus(bool p)
......@@ -163,9 +176,13 @@ namespace OnlineStore.AutoInOutStore
txtSpeed.Focus();
return;
}
P3Offset = FormUtil.GetIntValue(txtP3Offset);
P4Offset = FormUtil.GetIntValue(txtP4Offset);
P5Offset = FormUtil.GetIntValue(txtP5Offset);
P6Offset = FormUtil.GetIntValue(txtP6Offset);
LastValue = IO_VALUE.LOW;
string fileName = txtFileName.Text;
string filePath = Application.StartupPath + @"\" + fileName;
string filePath = Application.StartupPath + @"\logs\" + fileName;
if (File.Exists(filePath))
{
DialogResult result = MessageBox.Show("文件【"+filePath+"】已存在,是否确定覆盖?","", MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
......@@ -176,10 +193,25 @@ namespace OnlineStore.AutoInOutStore
}
PositionList = new List<int>();
LogUtil.info(LogName + "伺服开始运动,速度【"+speed+"】位置【"+position+"】启动定时器 ");
formMoveStatus(false);
ACServerManager.AbsMove(PortName, SlvAddr, position,speed);
toolTimer.Start();
}
private int P3Offset = 0;
private int P4Offset = 0;
private int P5Offset = 0;
private int P6Offset = 0;
private void formMoveStatus(bool status)
{
txtFileName.Enabled = status;
txtP5Offset.Enabled = status;
txtP3Offset.Enabled = status;
txtP4Offset.Enabled = status;
txtP6Offset.Enabled = status;
txtSpeed.Enabled = status;
txtPosition.Enabled = status;
}
private void btnSdStop_Click(object sender, EventArgs e)
{
toolTimer.Stop();
......@@ -190,9 +222,6 @@ namespace OnlineStore.AutoInOutStore
{
return IOManager.instance.GetDIValue(IoIp, 0, (ushort)IoIndex);
}
private int TargetPostion = 0;
private bool isInProcesss = false;
private DateTime LastTime = DateTime.Now;
......@@ -249,20 +278,27 @@ namespace OnlineStore.AutoInOutStore
return;
}
LogUtil.info(LogName + "伺服已停止运动,停止定时器,记录数据");
string resultstr = "";
List<string> strList = new List<string>();
strList.Add("编号,标准位置,升降轴库位出料前点P5,升降轴库位出料缓冲点P6,升降轴库位入料前点P3,升降轴库位入料缓冲点P4");
int index = 1;
foreach (int p in PositionList)
{
resultstr += index + "," + p + "\r\n";
int P3 = p + P3Offset;
int P4 = p + P4Offset;
int P5 = p + P5Offset;
int P6 = p + P6Offset;
string resultstr = index + "," + p + ","+P5+","+P6+","+P3+","+P4+"";
strList.Add(resultstr);
index++;
}
string fileName = txtFileName.Text;
string filePath = Application.StartupPath + @"\" + fileName;
string filePath = Application.StartupPath + @"\logs\" + fileName;
try
{
// Clipboard.SetDataObject(resultstr);
File.WriteAllText(filePath, resultstr);
File.WriteAllLines(filePath, strList.ToArray());
LogUtil.error(LogName + "保存位置到文件【" + filePath + "】成功");
}
......@@ -270,10 +306,10 @@ namespace OnlineStore.AutoInOutStore
{
LogUtil.error(LogName + "保存位置到文件【" + filePath + "】出错:" + ex.ToString());
}
formMoveStatus(true );
}
private void timer1_Tick(object sender, EventArgs e)
{
try
{
ioStatusControl1.IOValue = (int)GetSingleValue();
......@@ -281,9 +317,7 @@ namespace OnlineStore.AutoInOutStore
}
catch (Exception ex)
{
}
}
private void FrmPositionTool_FormClosing(object sender, FormClosingEventArgs e)
......@@ -295,12 +329,11 @@ namespace OnlineStore.AutoInOutStore
}
//ACServerManager.CloseAllPort();
IOManager.instance.CloseAllConnection();
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer.exe", Application.StartupPath);
System.Diagnostics.Process.Start("Explorer.exe", Application.StartupPath + @"\logs\");
}
private void btnExit_Click(object sender, EventArgs e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!