Commit a4fa7477 ke.sun

1

1 个父辈 ee359df2
......@@ -44,12 +44,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmMoveTest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMoveTest.Designer.cs">
<DependentUpon>FrmMoveTest.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SerialBean.cs" />
......@@ -59,9 +53,6 @@
<Compile Include="FrmACTest.Designer.cs">
<DependentUpon>FrmACTest.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FrmMoveTest.resx">
<DependentUpon>FrmMoveTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
......@@ -178,11 +178,11 @@
//
this.chbAutoRead.AutoSize = true;
this.chbAutoRead.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbAutoRead.Location = new System.Drawing.Point(172, 18);
this.chbAutoRead.Location = new System.Drawing.Point(220, 17);
this.chbAutoRead.Name = "chbAutoRead";
this.chbAutoRead.Size = new System.Drawing.Size(89, 21);
this.chbAutoRead.Size = new System.Drawing.Size(75, 21);
this.chbAutoRead.TabIndex = 244;
this.chbAutoRead.Text = "自动读取IO";
this.chbAutoRead.Text = "自动读取";
this.chbAutoRead.UseVisualStyleBackColor = true;
//
// btnReadAllDi
......@@ -223,7 +223,7 @@
this.txtDoName.Location = new System.Drawing.Point(69, 15);
this.txtDoName.MaxLength = 10;
this.txtDoName.Name = "txtDoName";
this.txtDoName.Size = new System.Drawing.Size(89, 23);
this.txtDoName.Size = new System.Drawing.Size(123, 23);
this.txtDoName.TabIndex = 241;
this.txtDoName.Text = "0";
//
......@@ -384,7 +384,6 @@
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmIOStatus";
......
......@@ -28,8 +28,6 @@
this.lblWarnMsg = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.lblServerOn = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cmbAxisHomeType = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.btnOpenAxis = new System.Windows.Forms.Button();
......@@ -171,6 +169,7 @@
this.txtPosition3 = new System.Windows.Forms.TextBox();
this.txtPosition2 = new System.Windows.Forms.TextBox();
this.txtPosition1 = new System.Windows.Forms.TextBox();
this.btnReadPosition = new System.Windows.Forms.Button();
this.groupBox5.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -198,9 +197,8 @@
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.btnReadPosition);
this.groupBox5.Controls.Add(this.lblServerOn);
this.groupBox5.Controls.Add(this.label2);
this.groupBox5.Controls.Add(this.cmbAxisHomeType);
this.groupBox5.Controls.Add(this.label7);
this.groupBox5.Controls.Add(this.label8);
this.groupBox5.Controls.Add(this.btnOpenAxis);
......@@ -242,28 +240,6 @@
this.lblServerOn.Size = new System.Drawing.Size(0, 19);
this.lblServerOn.TabIndex = 268;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(19, 166);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 17);
this.label2.TabIndex = 277;
this.label2.Text = "原点方向:";
//
// cmbAxisHomeType
//
this.cmbAxisHomeType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbAxisHomeType.FormattingEnabled = true;
this.cmbAxisHomeType.Items.AddRange(new object[] {
"正方向",
"负方向"});
this.cmbAxisHomeType.Location = new System.Drawing.Point(95, 159);
this.cmbAxisHomeType.Name = "cmbAxisHomeType";
this.cmbAxisHomeType.Size = new System.Drawing.Size(88, 25);
this.cmbAxisHomeType.TabIndex = 276;
//
// label7
//
this.label7.AutoSize = true;
......@@ -1810,35 +1786,35 @@
// 查看IOToolStripMenuItem
//
this.查看IOToolStripMenuItem.Name = "查看IOToolStripMenuItem";
this.查看IOToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.查看IOToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.查看IOToolStripMenuItem.Text = "查看IO";
this.查看IOToolStripMenuItem.Click += new System.EventHandler(this.查看IOToolStripMenuItem_Click);
//
// 料仓运转ONToolStripMenuItem
//
this.料仓运转ONToolStripMenuItem.Name = "料仓运转ONToolStripMenuItem";
this.料仓运转ONToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.料仓运转ONToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.料仓运转ONToolStripMenuItem.Text = "料仓运转ON";
this.料仓运转ONToolStripMenuItem.Click += new System.EventHandler(this.料仓运转ONToolStripMenuItem_Click);
//
// 料仓运转OFFToolStripMenuItem
//
this.料仓运转OFFToolStripMenuItem.Name = "料仓运转OFFToolStripMenuItem";
this.料仓运转OFFToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.料仓运转OFFToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.料仓运转OFFToolStripMenuItem.Text = "料仓运转OFF";
this.料仓运转OFFToolStripMenuItem.Click += new System.EventHandler(this.料仓运转OFFToolStripMenuItem_Click);
//
// 打开舱门ToolStripMenuItem
//
this.打开舱门ToolStripMenuItem.Name = "打开舱门ToolStripMenuItem";
this.打开舱门ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.打开舱门ToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.打开舱门ToolStripMenuItem.Text = "打开仓门";
this.打开舱门ToolStripMenuItem.Click += new System.EventHandler(this.打开舱门ToolStripMenuItem_Click);
//
// 关闭仓门ToolStripMenuItem
//
this.关闭仓门ToolStripMenuItem.Name = "关闭仓门ToolStripMenuItem";
this.关闭仓门ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.关闭仓门ToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
this.关闭仓门ToolStripMenuItem.Text = "关闭仓门";
this.关闭仓门ToolStripMenuItem.Click += new System.EventHandler(this.关闭仓门ToolStripMenuItem_Click);
//
......@@ -1993,6 +1969,21 @@
this.txtPosition1.Size = new System.Drawing.Size(87, 23);
this.txtPosition1.TabIndex = 265;
//
// btnReadPosition
//
this.btnReadPosition.BackColor = System.Drawing.SystemColors.Control;
this.btnReadPosition.Cursor = System.Windows.Forms.Cursors.Default;
this.btnReadPosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReadPosition.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnReadPosition.Location = new System.Drawing.Point(458, 162);
this.btnReadPosition.Name = "btnReadPosition";
this.btnReadPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnReadPosition.Size = new System.Drawing.Size(105, 30);
this.btnReadPosition.TabIndex = 278;
this.btnReadPosition.Text = "读取位置";
this.btnReadPosition.UseVisualStyleBackColor = true;
this.btnReadPosition.Click += new System.EventHandler(this.btnReadPosition_Click);
//
// FrmStoreBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
......@@ -2165,8 +2156,6 @@
private System.Windows.Forms.Button btnClearLog;
private System.Windows.Forms.Button btnRelMove;
private System.Windows.Forms.ToolStripMenuItem 料仓运转ONToolStripMenuItem;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cmbAxisHomeType;
private System.Windows.Forms.ToolStripMenuItem 扫码测试ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 料仓运转OFFToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 打开舱门ToolStripMenuItem;
......@@ -2181,9 +2170,7 @@
private System.Windows.Forms.TextBox txtPosition1;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Label lblServerOn;
public System.Windows.Forms.Button btnReadPosition;
}
}
......@@ -152,8 +152,6 @@ namespace OnlineStore.ACSingleStore
}
private void FrmTest_Load(object sender, EventArgs e)
{
cmbAxisHomeType.SelectedIndex = 1;
cmbHomeType.SelectedIndex = 0;
LogUtil.logBox = this.richTextBox1;
initValue();
this.ShowInTaskbar = true;
......@@ -164,7 +162,7 @@ namespace OnlineStore.ACSingleStore
{
//验证运动是否完成
CheckWait();
//CheckWait();
string portName = txtAxisDeviceName.Text;
int SlvAddr = FormUtil.GetIntValue(txtAxisValue);
......@@ -173,43 +171,13 @@ namespace OnlineStore.ACSingleStore
if (ACServerManager.ServerOnStatus(portName, SlvAddr) )
{
lblServerOn.Text = "伺服ON";
}
else
{
lblServerOn.Text = "伺服OFF";
}
if (ACServerManager.ServerOnStatus(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue()) )
{
axis_1_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
axis_1_Alarm.ShowData();
int lOutPulse1 = ACServerManager.GetTargetPosition(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
lblOutPulse1.Text = string.Format("{0:d}", lOutPulse1);
int lCountPulse1 = ACServerManager.GetActualtPosition(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
lblCountPulse1.Text = string.Format("{0:d}", lCountPulse1);
txtMiddleTarget.Text = store.Config.Middle_Axis.TargetPosition.ToString();
}
if (ACServerManager.ServerOnStatus(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue()) )
{
axis_2_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
axis_2_Alarm.ShowData();
int lOutPulse2 = ACServerManager.GetTargetPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
lblOutPulse2.Text = string.Format("{0:d}", lOutPulse2);
int lCountPulse2 = ACServerManager.GetActualtPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
lblCountPulse2.Text = string.Format("{0:d}", lCountPulse2);
txtInoutTarget.Text = store.Config.InOut_Axis.TargetPosition.ToString();
}
if (ACServerManager.ServerOnStatus(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue()) )
{
axis_3_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
int lOutPulse3 = ACServerManager.GetTargetPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
lblOutPulse3.Text = string.Format("{0:d}", lOutPulse3);
int lCountPulse3 = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
lblCountPulse3.Text = string.Format("{0:d}", lCountPulse3);
txtUpdownTarget.Text = store.Config.UpDown_Axis.TargetPosition.ToString();
}
//ReadPosistion();
if (store.storeRunStatus > StoreRunStatus.Wait)
{
if (启动ToolStripMenuItem.Enabled.Equals(true))
......@@ -287,6 +255,40 @@ namespace OnlineStore.ACSingleStore
}
}
private void ReadPosistion()
{
if (ACServerManager.ServerOnStatus(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue()))
{
axis_1_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
axis_1_Alarm.ShowData();
int lOutPulse1 = ACServerManager.GetTargetPosition(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
lblOutPulse1.Text = string.Format("{0:d}", lOutPulse1);
int lCountPulse1 = ACServerManager.GetActualtPosition(store.Config.Middle_Axis.DeviceName, store.Config.Middle_Axis.GetAxisValue());
lblCountPulse1.Text = string.Format("{0:d}", lCountPulse1);
txtMiddleTarget.Text = store.Config.Middle_Axis.TargetPosition.ToString();
}
if (ACServerManager.ServerOnStatus(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue()))
{
axis_2_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
axis_2_Alarm.ShowData();
int lOutPulse2 = ACServerManager.GetTargetPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
lblOutPulse2.Text = string.Format("{0:d}", lOutPulse2);
int lCountPulse2 = ACServerManager.GetActualtPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
lblCountPulse2.Text = string.Format("{0:d}", lCountPulse2);
txtInoutTarget.Text = store.Config.InOut_Axis.TargetPosition.ToString();
}
if (ACServerManager.ServerOnStatus(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue()))
{
axis_3_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
int lOutPulse3 = ACServerManager.GetTargetPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
lblOutPulse3.Text = string.Format("{0:d}", lOutPulse3);
int lCountPulse3 = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
lblCountPulse3.Text = string.Format("{0:d}", lCountPulse3);
txtUpdownTarget.Text = store.Config.UpDown_Axis.TargetPosition.ToString();
}
}
private void Bt_ClearCounter_Click(object sender, EventArgs e)
{
string portName = txtAxisDeviceName.Text;
......@@ -325,11 +327,7 @@ namespace OnlineStore.ACSingleStore
{
stop_button_Click(null, null);
}
foreach (string str in store.Config.SMCDeviceNameList)
{
//KTKSMCManager.WExit(str);
ACServerManager.ColsePort(str);
}
KNDManager.CloseAllDO();
StoreOpenStatus(false);
KNDManager.CloseAllConnection();
......@@ -448,21 +446,21 @@ namespace OnlineStore.ACSingleStore
private void btnAxisAMove_Click(object sender, EventArgs e)
{
ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
//ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
if (axisC.PositionIsHasLimit() && (axisC.PositionMin > position || axisC.PositionMax < position))
{
MessageBox.Show("位置超出" + axisC.Explain + "上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
return;
}
//if (axisC.PositionIsHasLimit() && (axisC.PositionMin > position || axisC.PositionMax < position))
//{
// MessageBox.Show("位置超出" + axisC.Explain + "上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// return;
//}
ACServerManager.AbsMove(portName, SlvAddr, position, speed / 10);
}
private void btnAxisVMove_Click(object sender, EventArgs e)
{
ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
//ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int speed = FormUtil.GetIntValue(txtASpeed);
......@@ -471,18 +469,18 @@ namespace OnlineStore.ACSingleStore
private void btnAxisRMove_Click(object sender, EventArgs e)
{
ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
//ConfigMoveAxis axisC = store.moveAxisList[cmbAxisList.SelectedIndex];
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
int currPositon = ACServerManager.GetActualtPosition(portName, SlvAddr);
int newPosition = position + currPositon;
if (axisC.PositionIsHasLimit() && (axisC.PositionMin > newPosition || axisC.PositionMax < newPosition))
{
MessageBox.Show("位置超出"+axisC.Explain+"上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
return;
}
//int currPositon = ACServerManager.GetActualtPosition(portName, SlvAddr);
// int newPosition = position + currPositon;
// if (axisC.PositionIsHasLimit() && (axisC.PositionMin > newPosition || axisC.PositionMax < newPosition))
//{
// MessageBox.Show("位置超出"+axisC.Explain+"上下限(" + axisC.PositionMin + "-" + axisC.PositionMax + ")");
// return;
//}
ACServerManager.RelMove(portName, SlvAddr, position, speed);
}
......@@ -609,8 +607,8 @@ namespace OnlineStore.ACSingleStore
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
ACServerManager.OpenPort(portName);
ACServerManager.InitSlvAddr(portName, SlvAddr);
Thread.Sleep(100);
//ACServerManager.InitSlvAddr(portName, SlvAddr);
//Thread.Sleep(100);
ACServerManager.AlarmClear(portName, SlvAddr);
Thread.Sleep(100);
ACServerManager.ServoOn(portName, SlvAddr);
......@@ -1117,7 +1115,15 @@ namespace OnlineStore.ACSingleStore
private void btnAxisReturnHome_Click(object sender, EventArgs e)
{
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
int speed = FormUtil.GetIntValue(txtASpeed);
ACServerManager.HomeMove(portName, SlvAddr, speed);
}
private void btnReadPosition_Click(object sender, EventArgs e)
{
ReadPosistion();
}
}
}
......@@ -193,7 +193,7 @@ namespace OnlineStore.DeviceLibrary
string v1 = slvAddrStr + "064601 " + SpeedToStr(targetSpeed, 4) + " ffff";
SendStr(portName, v1);
RelMove(portName, slvAddr, position, targetSpeed);
RelMove(portName, slvAddr, position);
}
public static void RelMove(string portName, int slvAddr, int position)
{
......
......@@ -647,6 +647,7 @@ namespace OnlineStore.DeviceLibrary
public void CloseAllAxis()
{
LogUtil.info(StoreName+"关闭刹车,关闭伺服");
KNDIOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
foreach (ConfigMoveAxis axis in moveAxisList)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!