Commit 1454cbb8 LN

1

1 个父辈 8ef2449f
......@@ -48,6 +48,8 @@
<!--是否打开托盘编码界面-->
<add key ="OpenRFIDWrite" value ="1"/>
<add key="DefaultPWD" value ="123456"/>
<!--当前调试的设备ID,分号分割-->
<add key ="DebugDeviceId" value ="103"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -788,7 +788,7 @@
this.tabPage2.Location = new System.Drawing.Point(4, 26);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1365, 645);
this.tabPage2.Size = new System.Drawing.Size(1319, 657);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = " 伺服信息 ";
this.tabPage2.UseVisualStyleBackColor = true;
......@@ -804,7 +804,7 @@
this.groupBox9.Controls.Add(this.txtBP2);
this.groupBox9.Location = new System.Drawing.Point(22, 516);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(644, 150);
this.groupBox9.Size = new System.Drawing.Size(836, 150);
this.groupBox9.TabIndex = 220;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "上料轴位置配置";
......@@ -916,7 +916,7 @@
//
this.axisMoveControl1.Location = new System.Drawing.Point(10, 5);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(678, 353);
this.axisMoveControl1.Size = new System.Drawing.Size(858, 349);
this.axisMoveControl1.TabIndex = 219;
//
// groupBox2
......@@ -930,7 +930,7 @@
this.groupBox2.Controls.Add(this.txtSizePosition);
this.groupBox2.Location = new System.Drawing.Point(22, 360);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(644, 147);
this.groupBox2.Size = new System.Drawing.Size(836, 147);
this.groupBox2.TabIndex = 218;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "升降轴位置配置";
......
......@@ -375,7 +375,7 @@ namespace OnlineStore.AssemblyLine
}
private void btnTrayLocationCylinder_Click(object sender, EventArgs e)
{
BtnMove(btnTrayLocationCylinder, "SL升降盘定位气缸前进", "SL升降盘定位气缸后退", IO_Type.SL_TrayLocation_Before, IO_Type.SL_TrayLocation_After);
BtnMove(btnTrayLocationCylinder, "SL升降盘定位气缸前进", "SL升降盘定位气缸后退", IO_Type.SL_TrayLocation_After, IO_Type.SL_TrayLocation_Before);
}
private void btnToroid_TopCylinder_Click(object sender, EventArgs e)
{
......
......@@ -52,6 +52,7 @@
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.lblTrayNum = new System.Windows.Forms.Label();
this.lblInstoreList = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
......@@ -68,7 +69,6 @@
this.txtP2 = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.lblName = new System.Windows.Forms.Label();
this.lblMoveInfo = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
......@@ -537,6 +537,17 @@
this.groupBox6.TabStop = false;
this.groupBox6.Text = "消息";
//
// lblMoveInfo
//
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(13, 29);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 280;
this.lblMoveInfo.Text = "运动信息:";
//
// lblTrayNum
//
this.lblTrayNum.AutoSize = true;
......@@ -574,7 +585,7 @@
//
this.axisMoveControl1.Location = new System.Drawing.Point(10, 7);
this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(678, 388);
this.axisMoveControl1.Size = new System.Drawing.Size(835, 344);
this.axisMoveControl1.TabIndex = 219;
//
// groupBox2
......@@ -588,9 +599,9 @@
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.btnP2);
this.groupBox2.Controls.Add(this.txtP2);
this.groupBox2.Location = new System.Drawing.Point(19, 396);
this.groupBox2.Location = new System.Drawing.Point(19, 369);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(646, 204);
this.groupBox2.Size = new System.Drawing.Size(815, 204);
this.groupBox2.TabIndex = 218;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "升降轴位置配置";
......@@ -749,17 +760,6 @@
this.lblName.Text = "出料流水线";
this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblMoveInfo
//
this.lblMoveInfo.AutoSize = true;
this.lblMoveInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblMoveInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblMoveInfo.Location = new System.Drawing.Point(13, 29);
this.lblMoveInfo.Name = "lblMoveInfo";
this.lblMoveInfo.Size = new System.Drawing.Size(68, 17);
this.lblMoveInfo.TabIndex = 280;
this.lblMoveInfo.Text = "运动信息:";
//
// FrmMoveEquip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
......
......@@ -29,7 +29,13 @@
private void InitializeComponent()
{
this.groupAxis = new System.Windows.Forms.GroupBox();
this.btnAxisStop = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.btnMCopy = new System.Windows.Forms.Button();
this.btnDelMove = new System.Windows.Forms.Button();
this.txtMiddleSpeed = new System.Windows.Forms.TextBox();
this.btnAddMove = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.txtServoStatue = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
......@@ -66,13 +72,19 @@
this.label45 = new System.Windows.Forms.Label();
this.label46 = new System.Windows.Forms.Label();
this.label49 = new System.Windows.Forms.Label();
this.btnAxisStop = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupAxis.SuspendLayout();
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupAxis
//
this.groupAxis.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupAxis.Controls.Add(this.groupBox1);
this.groupAxis.Controls.Add(this.btnAxisStop);
this.groupAxis.Controls.Add(this.panel1);
this.groupAxis.Controls.Add(this.comboBox1);
this.groupAxis.Controls.Add(this.lblServerOn);
......@@ -90,47 +102,112 @@
this.groupAxis.Controls.Add(this.label45);
this.groupAxis.Controls.Add(this.label46);
this.groupAxis.Controls.Add(this.label49);
this.groupAxis.Controls.Add(this.btnAxisStop);
this.groupAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupAxis.Location = new System.Drawing.Point(9, 4);
this.groupAxis.Name = "groupAxis";
this.groupAxis.Size = new System.Drawing.Size(648, 342);
this.groupAxis.Size = new System.Drawing.Size(791, 330);
this.groupAxis.TabIndex = 218;
this.groupAxis.TabStop = false;
this.groupAxis.Text = "伺服运动";
//
// btnAxisStop
//
this.btnAxisStop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.btnAxisStop.Cursor = System.Windows.Forms.Cursors.Default;
this.btnAxisStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAxisStop.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAxisStop.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnAxisStop.Location = new System.Drawing.Point(474, 116);
this.btnAxisStop.Name = "btnAxisStop";
this.btnAxisStop.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnAxisStop.Size = new System.Drawing.Size(110, 114);
this.btnAxisStop.TabIndex = 246;
this.btnAxisStop.Text = " 停止运动";
this.btnAxisStop.UseVisualStyleBackColor = false;
this.btnAxisStop.Click += new System.EventHandler(this.btnAxisStop_Click);
//
// panel1
//
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.txtServoStatue);
this.panel1.Controls.Add(this.label24);
this.panel1.Controls.Add(this.txtAlarmStatus);
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.panel1.Controls.Add(this.btnMCopy);
this.panel1.Controls.Add(this.btnDelMove);
this.panel1.Controls.Add(this.txtMiddleSpeed);
this.panel1.Controls.Add(this.btnAddMove);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.btnReadPosition);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.txtLimit2);
this.panel1.Controls.Add(this.txtBusyStatus);
this.panel1.Controls.Add(this.label22);
this.panel1.Controls.Add(this.label8);
this.panel1.Controls.Add(this.btnGetAlarm);
this.panel1.Controls.Add(this.label10);
this.panel1.Controls.Add(this.txtHomeStatus);
this.panel1.Controls.Add(this.lblCountPulse);
this.panel1.Controls.Add(this.txtLimit1);
this.panel1.Controls.Add(this.label11);
this.panel1.Controls.Add(this.txtHomeSingle);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.btnComAlarmClear);
this.panel1.Controls.Add(this.btnAxisReturnHome);
this.panel1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(11, 167);
this.panel1.Location = new System.Drawing.Point(11, 151);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(584, 163);
this.panel1.Size = new System.Drawing.Size(584, 171);
this.panel1.TabIndex = 219;
//
// btnMCopy
//
this.btnMCopy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnMCopy.Location = new System.Drawing.Point(500, 121);
this.btnMCopy.Name = "btnMCopy";
this.btnMCopy.Size = new System.Drawing.Size(69, 28);
this.btnMCopy.TabIndex = 334;
this.btnMCopy.Text = "复制";
this.btnMCopy.UseVisualStyleBackColor = true;
this.btnMCopy.Visible = false;
//
// btnDelMove
//
this.btnDelMove.BackColor = System.Drawing.SystemColors.Control;
this.btnDelMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelMove.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelMove.Location = new System.Drawing.Point(325, 113);
this.btnDelMove.Name = "btnDelMove";
this.btnDelMove.Size = new System.Drawing.Size(140, 45);
this.btnDelMove.TabIndex = 332;
this.btnDelMove.Text = "点动-(上升)";
this.btnDelMove.UseVisualStyleBackColor = false;
this.btnDelMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseDown);
this.btnDelMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseUp);
//
// txtMiddleSpeed
//
this.txtMiddleSpeed.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtMiddleSpeed.Location = new System.Drawing.Point(78, 122);
this.txtMiddleSpeed.MaxLength = 6;
this.txtMiddleSpeed.Name = "txtMiddleSpeed";
this.txtMiddleSpeed.Size = new System.Drawing.Size(73, 26);
this.txtMiddleSpeed.TabIndex = 331;
this.txtMiddleSpeed.Text = "100";
//
// btnAddMove
//
this.btnAddMove.BackColor = System.Drawing.SystemColors.Control;
this.btnAddMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAddMove.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAddMove.Location = new System.Drawing.Point(176, 113);
this.btnAddMove.Name = "btnAddMove";
this.btnAddMove.Size = new System.Drawing.Size(140, 45);
this.btnAddMove.TabIndex = 330;
this.btnAddMove.Text = "点动+(上升)";
this.btnAddMove.UseVisualStyleBackColor = false;
this.btnAddMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseDown);
this.btnAddMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseUp);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 127);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 329;
this.label1.Text = "点动速度:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(56, 24);
this.label5.Location = new System.Drawing.Point(67, 23);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(59, 17);
this.label5.TabIndex = 328;
......@@ -139,7 +216,7 @@
// txtServoStatue
//
this.txtServoStatue.Enabled = false;
this.txtServoStatue.Location = new System.Drawing.Point(121, 21);
this.txtServoStatue.Location = new System.Drawing.Point(133, 20);
this.txtServoStatue.Name = "txtServoStatue";
this.txtServoStatue.Size = new System.Drawing.Size(25, 23);
this.txtServoStatue.TabIndex = 327;
......@@ -147,7 +224,7 @@
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(171, 126);
this.label24.Location = new System.Drawing.Point(53, 215);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(71, 17);
this.label24.TabIndex = 316;
......@@ -157,7 +234,7 @@
// txtAlarmStatus
//
this.txtAlarmStatus.Enabled = false;
this.txtAlarmStatus.Location = new System.Drawing.Point(122, 57);
this.txtAlarmStatus.Location = new System.Drawing.Point(133, 52);
this.txtAlarmStatus.Name = "txtAlarmStatus";
this.txtAlarmStatus.Size = new System.Drawing.Size(25, 23);
this.txtAlarmStatus.TabIndex = 285;
......@@ -169,7 +246,7 @@
this.btnReadPosition.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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(343, 15);
this.btnReadPosition.Location = new System.Drawing.Point(195, 48);
this.btnReadPosition.Name = "btnReadPosition";
this.btnReadPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnReadPosition.Size = new System.Drawing.Size(110, 34);
......@@ -181,7 +258,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(54, 60);
this.label3.Location = new System.Drawing.Point(65, 55);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(59, 17);
this.label3.TabIndex = 286;
......@@ -190,7 +267,7 @@
// txtLimit2
//
this.txtLimit2.Enabled = false;
this.txtLimit2.Location = new System.Drawing.Point(251, 123);
this.txtLimit2.Location = new System.Drawing.Point(133, 212);
this.txtLimit2.Name = "txtLimit2";
this.txtLimit2.Size = new System.Drawing.Size(25, 23);
this.txtLimit2.TabIndex = 313;
......@@ -198,7 +275,7 @@
// txtBusyStatus
//
this.txtBusyStatus.Enabled = false;
this.txtBusyStatus.Location = new System.Drawing.Point(122, 90);
this.txtBusyStatus.Location = new System.Drawing.Point(133, 84);
this.txtBusyStatus.Name = "txtBusyStatus";
this.txtBusyStatus.Size = new System.Drawing.Size(25, 23);
this.txtBusyStatus.TabIndex = 288;
......@@ -206,7 +283,7 @@
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(171, 93);
this.label22.Location = new System.Drawing.Point(53, 183);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(71, 17);
this.label22.TabIndex = 312;
......@@ -217,7 +294,7 @@
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label8.Location = new System.Drawing.Point(156, 24);
this.label8.Location = new System.Drawing.Point(15, 54);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(59, 17);
this.label8.TabIndex = 255;
......@@ -226,7 +303,7 @@
// btnGetAlarm
//
this.btnGetAlarm.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnGetAlarm.Location = new System.Drawing.Point(343, 61);
this.btnGetAlarm.Location = new System.Drawing.Point(48, 255);
this.btnGetAlarm.Name = "btnGetAlarm";
this.btnGetAlarm.Size = new System.Drawing.Size(110, 34);
this.btnGetAlarm.TabIndex = 284;
......@@ -237,7 +314,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(47, 93);
this.label10.Location = new System.Drawing.Point(58, 87);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(66, 17);
this.label10.TabIndex = 289;
......@@ -246,23 +323,24 @@
// txtHomeStatus
//
this.txtHomeStatus.Enabled = false;
this.txtHomeStatus.Location = new System.Drawing.Point(122, 123);
this.txtHomeStatus.Location = new System.Drawing.Point(133, 116);
this.txtHomeStatus.Name = "txtHomeStatus";
this.txtHomeStatus.Size = new System.Drawing.Size(25, 23);
this.txtHomeStatus.TabIndex = 291;
//
// lblCountPulse
//
this.lblCountPulse.Location = new System.Drawing.Point(219, 21);
this.lblCountPulse.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblCountPulse.Location = new System.Drawing.Point(78, 51);
this.lblCountPulse.Name = "lblCountPulse";
this.lblCountPulse.ReadOnly = true;
this.lblCountPulse.Size = new System.Drawing.Size(88, 23);
this.lblCountPulse.Size = new System.Drawing.Size(103, 26);
this.lblCountPulse.TabIndex = 38;
//
// txtLimit1
//
this.txtLimit1.Enabled = false;
this.txtLimit1.Location = new System.Drawing.Point(251, 90);
this.txtLimit1.Location = new System.Drawing.Point(133, 180);
this.txtLimit1.Name = "txtLimit1";
this.txtLimit1.Size = new System.Drawing.Size(25, 23);
this.txtLimit1.TabIndex = 309;
......@@ -270,7 +348,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(8, 126);
this.label11.Location = new System.Drawing.Point(19, 119);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(105, 17);
this.label11.TabIndex = 292;
......@@ -279,7 +357,7 @@
// txtHomeSingle
//
this.txtHomeSingle.Enabled = false;
this.txtHomeSingle.Location = new System.Drawing.Point(251, 57);
this.txtHomeSingle.Location = new System.Drawing.Point(133, 148);
this.txtHomeSingle.Name = "txtHomeSingle";
this.txtHomeSingle.Size = new System.Drawing.Size(25, 23);
this.txtHomeSingle.TabIndex = 297;
......@@ -287,7 +365,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(183, 60);
this.label6.Location = new System.Drawing.Point(65, 151);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(59, 17);
this.label6.TabIndex = 300;
......@@ -296,7 +374,7 @@
// btnComAlarmClear
//
this.btnComAlarmClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnComAlarmClear.Location = new System.Drawing.Point(343, 107);
this.btnComAlarmClear.Location = new System.Drawing.Point(343, 59);
this.btnComAlarmClear.Name = "btnComAlarmClear";
this.btnComAlarmClear.Size = new System.Drawing.Size(110, 34);
this.btnComAlarmClear.TabIndex = 50;
......@@ -311,7 +389,7 @@
this.btnAxisReturnHome.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAxisReturnHome.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAxisReturnHome.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnAxisReturnHome.Location = new System.Drawing.Point(463, 15);
this.btnAxisReturnHome.Location = new System.Drawing.Point(343, 11);
this.btnAxisReturnHome.Name = "btnAxisReturnHome";
this.btnAxisReturnHome.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnAxisReturnHome.Size = new System.Drawing.Size(110, 34);
......@@ -325,7 +403,7 @@
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(89, 36);
this.comboBox1.Location = new System.Drawing.Point(89, 25);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(227, 28);
this.comboBox1.TabIndex = 301;
......@@ -337,7 +415,7 @@
this.lblServerOn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblServerOn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblServerOn.ForeColor = System.Drawing.Color.Red;
this.lblServerOn.Location = new System.Drawing.Point(48, 126);
this.lblServerOn.Location = new System.Drawing.Point(48, 115);
this.lblServerOn.Name = "lblServerOn";
this.lblServerOn.Size = new System.Drawing.Size(0, 19);
this.lblServerOn.TabIndex = 268;
......@@ -349,7 +427,7 @@
this.btnOpenAxis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOpenAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenAxis.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnOpenAxis.Location = new System.Drawing.Point(354, 32);
this.btnOpenAxis.Location = new System.Drawing.Point(354, 21);
this.btnOpenAxis.Name = "btnOpenAxis";
this.btnOpenAxis.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnOpenAxis.Size = new System.Drawing.Size(110, 34);
......@@ -365,7 +443,7 @@
this.btnCloseAxis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCloseAxis.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseAxis.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnCloseAxis.Location = new System.Drawing.Point(474, 32);
this.btnCloseAxis.Location = new System.Drawing.Point(474, 21);
this.btnCloseAxis.Name = "btnCloseAxis";
this.btnCloseAxis.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnCloseAxis.Size = new System.Drawing.Size(110, 34);
......@@ -381,7 +459,7 @@
this.txtASpeed.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtASpeed.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtASpeed.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtASpeed.Location = new System.Drawing.Point(225, 122);
this.txtASpeed.Location = new System.Drawing.Point(225, 111);
this.txtASpeed.MaxLength = 12;
this.txtASpeed.Name = "txtASpeed";
this.txtASpeed.RightToLeft = System.Windows.Forms.RightToLeft.No;
......@@ -395,7 +473,7 @@
this.label47.Cursor = System.Windows.Forms.Cursors.Default;
this.label47.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label47.ForeColor = System.Drawing.SystemColors.ControlText;
this.label47.Location = new System.Drawing.Point(160, 127);
this.label47.Location = new System.Drawing.Point(160, 116);
this.label47.Name = "label47";
this.label47.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.label47.Size = new System.Drawing.Size(59, 17);
......@@ -410,7 +488,7 @@
this.btnAxisVMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAxisVMove.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAxisVMove.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnAxisVMove.Location = new System.Drawing.Point(354, 119);
this.btnAxisVMove.Location = new System.Drawing.Point(354, 111);
this.btnAxisVMove.Name = "btnAxisVMove";
this.btnAxisVMove.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnAxisVMove.Size = new System.Drawing.Size(110, 34);
......@@ -426,7 +504,7 @@
this.btnAxisRMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAxisRMove.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAxisRMove.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnAxisRMove.Location = new System.Drawing.Point(474, 77);
this.btnAxisRMove.Location = new System.Drawing.Point(474, 66);
this.btnAxisRMove.Name = "btnAxisRMove";
this.btnAxisRMove.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnAxisRMove.Size = new System.Drawing.Size(110, 34);
......@@ -442,7 +520,7 @@
this.btnAxisAMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAxisAMove.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAxisAMove.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnAxisAMove.Location = new System.Drawing.Point(354, 78);
this.btnAxisAMove.Location = new System.Drawing.Point(354, 67);
this.btnAxisAMove.Name = "btnAxisAMove";
this.btnAxisAMove.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnAxisAMove.Size = new System.Drawing.Size(110, 34);
......@@ -457,7 +535,7 @@
this.txtAPosition.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtAPosition.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAPosition.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtAPosition.Location = new System.Drawing.Point(225, 80);
this.txtAPosition.Location = new System.Drawing.Point(225, 69);
this.txtAPosition.MaxLength = 12;
this.txtAPosition.Name = "txtAPosition";
this.txtAPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
......@@ -471,7 +549,7 @@
this.label48.Cursor = System.Windows.Forms.Cursors.Default;
this.label48.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label48.ForeColor = System.Drawing.SystemColors.ControlText;
this.label48.Location = new System.Drawing.Point(160, 85);
this.label48.Location = new System.Drawing.Point(160, 74);
this.label48.Name = "label48";
this.label48.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.label48.Size = new System.Drawing.Size(59, 17);
......@@ -482,7 +560,7 @@
// txtAxisValue
//
this.txtAxisValue.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAxisValue.Location = new System.Drawing.Point(89, 122);
this.txtAxisValue.Location = new System.Drawing.Point(89, 111);
this.txtAxisValue.MaxLength = 10;
this.txtAxisValue.Name = "txtAxisValue";
this.txtAxisValue.ReadOnly = true;
......@@ -493,7 +571,7 @@
// txtAxisDeviceName
//
this.txtAxisDeviceName.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtAxisDeviceName.Location = new System.Drawing.Point(89, 80);
this.txtAxisDeviceName.Location = new System.Drawing.Point(89, 69);
this.txtAxisDeviceName.MaxLength = 10;
this.txtAxisDeviceName.Name = "txtAxisDeviceName";
this.txtAxisDeviceName.ReadOnly = true;
......@@ -506,7 +584,7 @@
this.label45.AutoSize = true;
this.label45.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label45.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label45.Location = new System.Drawing.Point(32, 85);
this.label45.Location = new System.Drawing.Point(32, 74);
this.label45.Name = "label45";
this.label45.Size = new System.Drawing.Size(47, 17);
this.label45.TabIndex = 240;
......@@ -518,7 +596,7 @@
this.label46.AutoSize = true;
this.label46.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label46.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label46.Location = new System.Drawing.Point(44, 127);
this.label46.Location = new System.Drawing.Point(44, 116);
this.label46.Name = "label46";
this.label46.Size = new System.Drawing.Size(35, 17);
this.label46.TabIndex = 239;
......@@ -530,39 +608,49 @@
this.label49.AutoSize = true;
this.label49.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label49.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label49.Location = new System.Drawing.Point(28, 41);
this.label49.Location = new System.Drawing.Point(28, 30);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(51, 17);
this.label49.TabIndex = 233;
this.label49.Text = "AC伺服:";
this.label49.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnAxisStop
//
this.btnAxisStop.BackColor = System.Drawing.SystemColors.Control;
this.btnAxisStop.Cursor = System.Windows.Forms.Cursors.Default;
this.btnAxisStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAxisStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAxisStop.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnAxisStop.Location = new System.Drawing.Point(474, 119);
this.btnAxisStop.Name = "btnAxisStop";
this.btnAxisStop.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnAxisStop.Size = new System.Drawing.Size(110, 34);
this.btnAxisStop.TabIndex = 246;
this.btnAxisStop.Text = " 停止运动";
this.btnAxisStop.UseVisualStyleBackColor = true;
this.btnAxisStop.Click += new System.EventHandler(this.btnAxisStop_Click);
// groupBox1
//
this.groupBox1.Controls.Add(this.txtBusyStatus);
this.groupBox1.Controls.Add(this.label11);
this.groupBox1.Controls.Add(this.txtHomeStatus);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label24);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.btnGetAlarm);
this.groupBox1.Controls.Add(this.txtAlarmStatus);
this.groupBox1.Controls.Add(this.txtLimit2);
this.groupBox1.Controls.Add(this.txtServoStatue);
this.groupBox1.Controls.Add(this.label22);
this.groupBox1.Controls.Add(this.txtLimit1);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.txtHomeSingle);
this.groupBox1.Location = new System.Drawing.Point(605, 14);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(182, 308);
this.groupBox1.TabIndex = 302;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "状态";
//
// AxisMoveControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupAxis);
this.Name = "AxisMoveControl";
this.Size = new System.Drawing.Size(625, 351);
this.Size = new System.Drawing.Size(809, 341);
this.groupAxis.ResumeLayout(false);
this.groupAxis.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
......@@ -608,5 +696,11 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtServoStatue;
private System.Windows.Forms.Button btnMCopy;
private System.Windows.Forms.Button btnDelMove;
private System.Windows.Forms.TextBox txtMiddleSpeed;
private System.Windows.Forms.Button btnAddMove;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
}
}
......@@ -76,15 +76,25 @@ namespace OnlineStore.AssemblyLine
private void btnAxisVMove_Click(object sender, EventArgs e)
{
int speed = FormUtil.GetIntValue(txtASpeed);
int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info("点击【匀速运动】,【" + PortName + "_" + SlvAddr + "】 速度【" + speed + "】");
ACServerManager.SpeedMove(PortName, SlvAddr, speed);
}
private void btnAxisStop_Click(object sender, EventArgs e)
{
LogUtil.info("点击【停止运动】,【" + PortName + "_" + SlvAddr + "】 ");
ACServerManager.SuddenStop(PortName, SlvAddr);
if (btnAddMove.BackColor == Color.Green)
{
btnAddMove.BackColor = System.Drawing.SystemColors.Control;
}
if (btnDelMove.BackColor == Color.Green)
{
btnDelMove.BackColor = System.Drawing.SystemColors.Control;
}
btnReadPosition_Click(null, null);
}
private void btnComAlarmClear_Click(object sender, EventArgs e)
......@@ -131,11 +141,15 @@ namespace OnlineStore.AssemblyLine
txtAxisValue.Text = SlvAddr.ToString();
Color color = Color.Black;
if (comboBox1.SelectedIndex.Equals(0))
{
{
btnAddMove.Text = "点动+(下降)";
btnDelMove.Text = "点动-(上升)";
color = Color.Blue;
}
else if (comboBox1.SelectedIndex.Equals(1))
{
btnAddMove.Text = "点动+(上升)";
btnDelMove.Text = "点动-(下降)";
color = Color.Red;
}
btnOpenAxis.ForeColor = color;
......@@ -148,6 +162,8 @@ namespace OnlineStore.AssemblyLine
btnComAlarmClear.ForeColor = color;
btnReadPosition.ForeColor = color;
btnGetAlarm.ForeColor = color;
btnAddMove.ForeColor = color;
btnDelMove.ForeColor = color;
this.txtAlarmStatus.Text = "";
this.txtBusyStatus.Text = "";
......@@ -158,7 +174,59 @@ namespace OnlineStore.AssemblyLine
txtServoStatue.Text = "";
}
}
private void AxisMove( int speed)
{
LogUtil.info("【" + PortName + "_" + SlvAddr + "】点动: 速度:" + speed);
ACServerManager.SpeedMove(PortName, SlvAddr, speed);
}
private void btnAddMove_MouseDown(object sender, MouseEventArgs e)
{
if (btnAddMove.BackColor.Equals(System.Drawing.SystemColors.Control))
{
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnAddMove.BackColor = Color.Green;
AxisMove( speed);
}
}
private void btnAddMove_MouseUp(object sender, MouseEventArgs e)
{
if (btnAddMove.BackColor == Color.Green )
{
btnAddMove.BackColor = System.Drawing.SystemColors.Control;
ACServerManager.SuddenStop(PortName, SlvAddr);
btnReadPosition_Click(null, null);
}
}
private void btnDelMove_MouseDown(object sender, MouseEventArgs e)
{
if (btnDelMove.BackColor.Equals(System.Drawing.SystemColors.Control))
{
int speed = FormUtil.GetIntValue(txtMiddleSpeed);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnDelMove.BackColor = Color.Green;
AxisMove(-speed);
}
}
private void btnDelMove_MouseUp(object sender, MouseEventArgs e)
{
if ( btnDelMove.BackColor == Color.Green)
{
btnDelMove.BackColor = System.Drawing.SystemColors.Control;
ACServerManager.SuddenStop(PortName, SlvAddr);
btnReadPosition_Click(null, null);
}
}
}
}
......@@ -77,5 +77,7 @@ namespace OnlineStore.Common
public static string OpenRFIDWrite = "OpenRFIDWrite";
public static string DefaultPWD = "DefaultPWD";
public static string AgvServerIp = "AgvServerIp";
public static string DebugDeviceId = "DebugDeviceId";
}
}
......@@ -149,6 +149,11 @@ namespace OnlineStore.Common
}
}
public static string GetValue(object debugDeviceId)
{
throw new NotImplementedException();
}
/// <summary>
/// 更新配置文件信息
/// </summary>
......@@ -170,16 +175,7 @@ namespace OnlineStore.Common
LogUtil.error(LOGGER, "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
}
}
public static int GetIntValue(object line_dischargeLine_count)
{
throw new NotImplementedException();
}
public static string GetValue(object configPath_DischargeLine)
{
throw new NotImplementedException();
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
......
......@@ -117,14 +117,41 @@ namespace OnlineStore.DeviceLibrary
CodeManager.LoadConfig();
string ids = ConfigAppSettings.GetValue(Setting_Init.DebugDeviceId);
if (IsDebug)
{
List<int> testDeviceIdList = new List<int>() { 103, 104 };
ioList = new List<string>();
foreach (int id in testDeviceIdList)
try
{
FeedingEquip feed = FeedingEquipMap[103];
ioList.AddRange(feed.Config.IOIPList);
string[] testDeviceIdList = ids.Split(',');
ioList = new List<string>();
foreach (string str in testDeviceIdList)
{
int id = Convert.ToInt32(str);
if (FeedingEquipMap.ContainsKey(id))
{
FeedingEquip feed = FeedingEquipMap[id];
ioList.AddRange(feed.Config.IOIPList);
}
else if (ProvidingEquipMap.ContainsKey(id))
{
ProvidingEquip feed = ProvidingEquipMap[id];
ioList.AddRange(feed.Config.IOIPList);
}
else if (DisLineMap.ContainsKey(id))
{
DischargeLine feed = DisLineMap[id];
ioList.AddRange(feed.Config.IOIPList);
}
else if (MoveEquipMap.ContainsKey(id))
{
MoveEquip equip = MoveEquipMap[id];
ioList.AddRange(equip.Config.IOIPList);
}
}
}
catch (Exception ex)
{
LogUtil.error(Name + "加载调试设备出错:" + ex.ToString());
}
}
......@@ -136,8 +163,8 @@ namespace OnlineStore.DeviceLibrary
{
Task.Factory.StartNew(delegate
{
//连接rfip
RFIDManager.ConnectRFIOList(new List<string>(DeviceConfig.ProRFIpMap.Values));
//连接rfip
RFIDManager.ConnectRFIOList(new List<string>(DeviceConfig.ProRFIpMap.Values));
});
}
addLastDI(IO_Type.Airpressure_Check, IOValue(IO_Type.Airpressure_Check));
......
......@@ -15,8 +15,8 @@ namespace OnlineStore.DeviceLibrary
public partial class ACServerManager
{
public static bool IsShowMsg = false ;
private static int SleepMSendons = 20;
private static int ReviceOutTimeMS = 100;
private static int SleepMSendons = 50;
private static int ReviceOutTimeMS = 200;
private static Dictionary<string, Dictionary<string, int>> ComAddrValue = new Dictionary<string, Dictionary<string, int>>();
private static string mapObj = "";
......@@ -177,33 +177,33 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info("开始初始化伺服【" + portName + "】【" + slvAddr + "】");
//写入block
int sleep = 20;
int sleep = 50;
string slvAddrStr = string.Format(strFromat, slvAddr);
//block0=原点返回,正方向
string str0 = slvAddrStr + "104800 000408 00000420 00000000 ffff";
SendStrAndSleep(portName, str0, sleep);
//block1=原点返回,反方向
string str1 = slvAddrStr + "104804 000408 04000420 00000000 ffff";
SendStrAndSleep(portName, str1, sleep);
//block2=绝对位置运动
string str2 = slvAddrStr + "104808 000408 10000211EC78FFFF ffff";
SendStrAndSleep(portName, str2, sleep);
//block3=相对位置运动
string str3 = slvAddrStr + "10480C 000408 10000111EC78FFFF ffff";
SendStrAndSleep(portName, str3, sleep);
//block4=正方向匀速运动
string str4 = slvAddrStr + "104810 000408 10000311 00000000 ffff";
SendStrAndSleep(portName, str4, sleep);
//block5=反方向匀速运动
string str5 = slvAddrStr + "104814 000408 14000311 00000000 ffff";
SendStrAndSleep(portName, str5, sleep);
//block6=减速停止
string str6 = slvAddrStr + "104818 000408 00000500 00000000 ffff";
SendStrAndSleep(portName, str6, sleep);
////block0=原点返回,正方向
//string str0 = slvAddrStr + "104800 000408 00000420 00000000 ffff";
//SendStrAndSleep(portName, str0, sleep);
////block1=原点返回,反方向
//string str1 = slvAddrStr + "104804 000408 04000420 00000000 ffff";
//SendStrAndSleep(portName, str1, sleep);
////block2=绝对位置运动
//string str2 = slvAddrStr + "104808 000408 10000211EC78FFFF ffff";
//SendStrAndSleep(portName, str2, sleep);
////block3=相对位置运动
//string str3 = slvAddrStr + "10480C 000408 10000111EC78FFFF ffff";
//SendStrAndSleep(portName, str3, sleep);
////block4=正方向匀速运动
//string str4 = slvAddrStr + "104810 000408 10000311 00000000 ffff";
//SendStrAndSleep(portName, str4, sleep);
////block5=反方向匀速运动
//string str5 = slvAddrStr + "104814 000408 14000311 00000000 ffff";
//SendStrAndSleep(portName, str5, sleep);
////block6=减速停止
//string str6 = slvAddrStr + "104818 000408 00000500 00000000 ffff";
//SendStrAndSleep(portName, str6, sleep);
//block7=紧急停止
string str7 = slvAddrStr + "10481c 000408 00000510 00000000 ffff";
SendStrAndSleep(portName, str7, sleep);
////block7=紧急停止
//string str7 = slvAddrStr + "10481c 000408 00000510 00000000 ffff";
//SendStrAndSleep(portName, str7, sleep);
//0106460001009D12
//速度 V1 =100
......@@ -362,16 +362,28 @@ namespace OnlineStore.DeviceLibrary
}
public static void SetSpeed(string portName, int slvAddr, int speed)
{
int preSpeed = GetAddrValue(portName,slvAddr, ACCMDManager.Speed_Addr);
int preSpeed = GetAddrValue(portName, slvAddr, ACCMDManager.Speed_Addr);
if ((preSpeed.Equals(-1)) || (!preSpeed.Equals(Math.Abs(speed))))
{
string v1 = slvAddr + "064601 " + ACServerManager.SpeedToStr(speed, 4) + " ffff";
LogUtil.debug("轴【" + portName + "_" + slvAddr + "】更新速度为【" + speed + "】,发送数据【" + v1 + "】");
SendStrAndSleep(portName, v1, SleepMSendons);
UpdateAddrValue(portName,slvAddr, ACCMDManager.Speed_Addr, Math.Abs(speed));
Thread.Sleep(SleepMSendons);
}
for (int i = 1; i <= 3; i++)
{
bool result = SendStrAndSleep(portName, v1, SleepMSendons);
if (result)
{
break;
}
else
{
LogUtil.error("轴【" + portName + "_" + slvAddr + "】更新速度为【" + speed + "】,发送数据【" + v1 + "】,第【" + i + "】次失败");
Thread.Sleep(SleepMSendons);
}
}
UpdateAddrValue(portName, slvAddr, ACCMDManager.Speed_Addr, Math.Abs(speed));
Thread.Sleep(SleepMSendons);
}
}
public static void SpeedMove(string portName, int slvAddr, int speed)
{
......
......@@ -27,16 +27,18 @@ namespace OnlineStore.DeviceLibrary
}
return null;
}
public static void SendStrAndSleep(string portName, string str, int sleepS)
public static bool SendStrAndSleep(string portName, string str, int sleepS)
{
byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2);
SendData(portName, data);
bool result = SendData(portName, data);
System.Threading.Thread.Sleep(sleepS);
}
return result;
}
public static void SaveData(string portName, byte slvAddr, string regAddr, int value)
{
......@@ -88,13 +90,20 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info( "串口" + portName + " 收到数据:" + strSend + "");
}
}
public static void SendData(string portName, byte[] data)
public static bool SendData(string portName, byte[] data)
{
if (data == null)
{
return;
return false;
}
byte[] returnData = SendCommand(portName, data, ReviceOutTimeMS, 8);
int timeOut = ReviceOutTimeMS;
if (data[1].Equals((byte)10))
{
timeOut = 1000;
}
bool result = false;
byte[] returnData = SendCommand(portName, data, timeOut, 8, out result);
if (returnData != null)
{
string strSend = "";
......@@ -107,6 +116,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info("串口" + portName + " 收到数据:" + strSend + "");
}
}
return result;
}
/// <summary>
/// 发送数据并获取返回值
......@@ -163,7 +173,65 @@ namespace OnlineStore.DeviceLibrary
}
return returnData;
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <param name="result">返回结果,是否发送成功</param>
/// <returns>返回值的长度</returns>
public static byte[] SendCommand(string portName, byte[] data, int outTime, int reviceLength, out bool result)
{
if (outTime < 100)
{
outTime = 100;
}
byte[] returnData = null;
result = false;
try
{
if (data == null)
{
return returnData;
}
string strSend = "";
for (int i = 0; i < data.Length; i++)
{
strSend += string.Format("{0:X2} ", data[i]);
}
if (strSend.Equals(""))
{
return returnData;
}
if (IsShowMsg)
{
LogUtil.info("串口" + portName + " 写入数据:" + strSend + "");
}
AcSerialBean bean = GetSerialBean(portName);
if (bean == null)
{
LogUtil.debug("ACServerManager SendCommand 试图向未打开串口【" + portName + "】写入数据:" + strSend + "。");
}
else
{
int ret = bean.SendCommand(data, ref returnData, outTime, reviceLength);
if (!ret.Equals(reviceLength))
{
LogUtil.error("串口" + portName + " 写入数据:" + strSend + ",预计返回字节数【" + reviceLength + "】实际返回【" + ret + "】");
}
else
{
result = true;
}
System.Threading.Thread.Sleep(2);
}
}
catch (Exception ex)
{
LogUtil.info(ex.ToString());
}
return returnData;
}
public static void WriteData(string portName, int slvAddr, string addr, string data, byte cmd, int length)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!