Commit 0fdd68d1 几米阳光

部分逻辑修改

1 个父辈 ff5c8c23
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" /> <add key="App_AutoRun" value="1" />
<add key ="CodeRun" value ="1"/>
<add key="App_Title" value="料仓_批量上下料" /> <add key="App_Title" value="料仓_批量上下料" />
<add key="scanner_start_command" value="S" /> <add key="scanner_start_command" value="S" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)--> <!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
......
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
this.btnAutoMovej.Name = "btnAutoMovej"; this.btnAutoMovej.Name = "btnAutoMovej";
this.btnAutoMovej.Size = new System.Drawing.Size(131, 36); this.btnAutoMovej.Size = new System.Drawing.Size(131, 36);
this.btnAutoMovej.TabIndex = 30; this.btnAutoMovej.TabIndex = 30;
this.btnAutoMovej.Text = "自动轴-(向下)"; this.btnAutoMovej.Text = "上下料轴-(向下)";
this.btnAutoMovej.UseVisualStyleBackColor = false; this.btnAutoMovej.UseVisualStyleBackColor = false;
this.btnAutoMovej.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAutoMovej_MouseDown); this.btnAutoMovej.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAutoMovej_MouseDown);
this.btnAutoMovej.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAutoMovej_MouseUp); this.btnAutoMovej.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAutoMovej_MouseUp);
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
this.btnAutoMove.Name = "btnAutoMove"; this.btnAutoMove.Name = "btnAutoMove";
this.btnAutoMove.Size = new System.Drawing.Size(131, 36); this.btnAutoMove.Size = new System.Drawing.Size(131, 36);
this.btnAutoMove.TabIndex = 29; this.btnAutoMove.TabIndex = 29;
this.btnAutoMove.Text = "自动轴+(向上)"; this.btnAutoMove.Text = "上下料轴+(向上)";
this.btnAutoMove.UseVisualStyleBackColor = false; this.btnAutoMove.UseVisualStyleBackColor = false;
this.btnAutoMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAutoMove_MouseDown); this.btnAutoMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAutoMove_MouseDown);
this.btnAutoMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAutoMove_MouseUp); this.btnAutoMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAutoMove_MouseUp);
...@@ -325,9 +325,9 @@ ...@@ -325,9 +325,9 @@
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(39, 237); this.label7.Location = new System.Drawing.Point(39, 237);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(92, 17); this.label7.Size = new System.Drawing.Size(80, 17);
this.label7.TabIndex = 27; this.label7.TabIndex = 27;
this.label7.Text = "(轴五)自动轴"; this.label7.Text = "批量上下料轴";
// //
// FrmAxisDebug // FrmAxisDebug
// //
......
...@@ -27,6 +27,15 @@ ...@@ -27,6 +27,15 @@
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lblWarnMsg = new System.Windows.Forms.Label(); this.lblWarnMsg = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.btnUpdateStatus = new System.Windows.Forms.Button();
this.label24 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
this.btnReadLimit2 = new System.Windows.Forms.Button();
this.txtLimit2 = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.btnReadLimit1 = new System.Windows.Forms.Button();
this.txtLimit1 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.btnReadHomeSingle = new System.Windows.Forms.Button(); this.btnReadHomeSingle = new System.Windows.Forms.Button();
...@@ -71,6 +80,13 @@ ...@@ -71,6 +80,13 @@
this.label49 = new System.Windows.Forms.Label(); this.label49 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblAxisStatus = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.axis_5_Alarm = new UserFromControl.IOStatusControl();
this.txtBatchTarget = new System.Windows.Forms.TextBox();
this.lblCountPulse5 = new System.Windows.Forms.TextBox();
this.lblOutPulse5 = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.axis_1_Alarm = new UserFromControl.IOStatusControl(); this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl(); this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl(); this.axis_2_Alarm = new UserFromControl.IOStatusControl();
...@@ -202,7 +218,7 @@ ...@@ -202,7 +218,7 @@
this.groupBox6 = new System.Windows.Forms.GroupBox(); this.groupBox6 = new System.Windows.Forms.GroupBox();
this.lblBatchStatus = new System.Windows.Forms.Label(); this.lblBatchStatus = new System.Windows.Forms.Label();
this.btnBatchOutTest = new System.Windows.Forms.Button(); this.btnBatchOutTest = new System.Windows.Forms.Button();
this.btnBatchOutEnd = new System.Windows.Forms.Button(); this.btnBatchReset = new System.Windows.Forms.Button();
this.btnStartBatchInStore = new System.Windows.Forms.Button(); this.btnStartBatchInStore = new System.Windows.Forms.Button();
this.btnGetOutTray = new System.Windows.Forms.Button(); this.btnGetOutTray = new System.Windows.Forms.Button();
this.lblDoorStatus = new System.Windows.Forms.Label(); this.lblDoorStatus = new System.Windows.Forms.Label();
...@@ -239,6 +255,15 @@ ...@@ -239,6 +255,15 @@
// //
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.btnUpdateStatus);
this.groupBox5.Controls.Add(this.label24);
this.groupBox5.Controls.Add(this.label26);
this.groupBox5.Controls.Add(this.btnReadLimit2);
this.groupBox5.Controls.Add(this.txtLimit2);
this.groupBox5.Controls.Add(this.label22);
this.groupBox5.Controls.Add(this.label23);
this.groupBox5.Controls.Add(this.btnReadLimit1);
this.groupBox5.Controls.Add(this.txtLimit1);
this.groupBox5.Controls.Add(this.label6); this.groupBox5.Controls.Add(this.label6);
this.groupBox5.Controls.Add(this.label5); this.groupBox5.Controls.Add(this.label5);
this.groupBox5.Controls.Add(this.btnReadHomeSingle); this.groupBox5.Controls.Add(this.btnReadHomeSingle);
...@@ -284,15 +309,102 @@ ...@@ -284,15 +309,102 @@
this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox5.Location = new System.Drawing.Point(6, 2); this.groupBox5.Location = new System.Drawing.Point(6, 2);
this.groupBox5.Name = "groupBox5"; this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(497, 328); this.groupBox5.Size = new System.Drawing.Size(497, 403);
this.groupBox5.TabIndex = 216; this.groupBox5.TabIndex = 216;
this.groupBox5.TabStop = false; this.groupBox5.TabStop = false;
this.groupBox5.Text = "伺服运动"; this.groupBox5.Text = "伺服运动";
// //
// btnUpdateStatus
//
this.btnUpdateStatus.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateStatus.Cursor = System.Windows.Forms.Cursors.Default;
this.btnUpdateStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateStatus.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnUpdateStatus.Location = new System.Drawing.Point(203, 156);
this.btnUpdateStatus.Name = "btnUpdateStatus";
this.btnUpdateStatus.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpdateStatus.Size = new System.Drawing.Size(105, 33);
this.btnUpdateStatus.TabIndex = 309;
this.btnUpdateStatus.Text = "读取所有状态";
this.btnUpdateStatus.UseVisualStyleBackColor = true;
this.btnUpdateStatus.Click += new System.EventHandler(this.btnUpdateStatus_Click);
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(35, 369);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(80, 17);
this.label24.TabIndex = 308;
this.label24.Text = "负极限信号:";
//
// label26
//
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(155, 369);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(94, 17);
this.label26.TabIndex = 307;
this.label26.Text = "1=ON,0=OFF";
//
// btnReadLimit2
//
this.btnReadLimit2.Location = new System.Drawing.Point(286, 364);
this.btnReadLimit2.Name = "btnReadLimit2";
this.btnReadLimit2.Size = new System.Drawing.Size(105, 33);
this.btnReadLimit2.TabIndex = 306;
this.btnReadLimit2.Text = "读负极限信号";
this.btnReadLimit2.UseVisualStyleBackColor = true;
this.btnReadLimit2.Click += new System.EventHandler(this.btnReadLimit2_Click);
//
// txtLimit2
//
this.txtLimit2.Enabled = false;
this.txtLimit2.Location = new System.Drawing.Point(121, 366);
this.txtLimit2.Name = "txtLimit2";
this.txtLimit2.Size = new System.Drawing.Size(25, 23);
this.txtLimit2.TabIndex = 305;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(35, 334);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(80, 17);
this.label22.TabIndex = 304;
this.label22.Text = "正极限信号:";
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(155, 334);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(94, 17);
this.label23.TabIndex = 303;
this.label23.Text = "1=ON,0=OFF";
//
// btnReadLimit1
//
this.btnReadLimit1.Location = new System.Drawing.Point(286, 329);
this.btnReadLimit1.Name = "btnReadLimit1";
this.btnReadLimit1.Size = new System.Drawing.Size(105, 33);
this.btnReadLimit1.TabIndex = 302;
this.btnReadLimit1.Text = "读正极限信号";
this.btnReadLimit1.UseVisualStyleBackColor = true;
this.btnReadLimit1.Click += new System.EventHandler(this.btnReadLimit1_Click);
//
// txtLimit1
//
this.txtLimit1.Enabled = false;
this.txtLimit1.Location = new System.Drawing.Point(121, 331);
this.txtLimit1.Name = "txtLimit1";
this.txtLimit1.Size = new System.Drawing.Size(25, 23);
this.txtLimit1.TabIndex = 301;
//
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(49, 292); this.label6.Location = new System.Drawing.Point(49, 300);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(68, 17); this.label6.Size = new System.Drawing.Size(68, 17);
this.label6.TabIndex = 300; this.label6.TabIndex = 300;
...@@ -301,7 +413,7 @@ ...@@ -301,7 +413,7 @@
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(155, 292); this.label5.Location = new System.Drawing.Point(155, 300);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(94, 17); this.label5.Size = new System.Drawing.Size(94, 17);
this.label5.TabIndex = 299; this.label5.TabIndex = 299;
...@@ -309,7 +421,7 @@ ...@@ -309,7 +421,7 @@
// //
// btnReadHomeSingle // btnReadHomeSingle
// //
this.btnReadHomeSingle.Location = new System.Drawing.Point(278, 287); this.btnReadHomeSingle.Location = new System.Drawing.Point(286, 295);
this.btnReadHomeSingle.Name = "btnReadHomeSingle"; this.btnReadHomeSingle.Name = "btnReadHomeSingle";
this.btnReadHomeSingle.Size = new System.Drawing.Size(105, 33); this.btnReadHomeSingle.Size = new System.Drawing.Size(105, 33);
this.btnReadHomeSingle.TabIndex = 298; this.btnReadHomeSingle.TabIndex = 298;
...@@ -320,7 +432,7 @@ ...@@ -320,7 +432,7 @@
// txtHomeSingle // txtHomeSingle
// //
this.txtHomeSingle.Enabled = false; this.txtHomeSingle.Enabled = false;
this.txtHomeSingle.Location = new System.Drawing.Point(121, 289); this.txtHomeSingle.Location = new System.Drawing.Point(121, 297);
this.txtHomeSingle.Name = "txtHomeSingle"; this.txtHomeSingle.Name = "txtHomeSingle";
this.txtHomeSingle.Size = new System.Drawing.Size(25, 23); this.txtHomeSingle.Size = new System.Drawing.Size(25, 23);
this.txtHomeSingle.TabIndex = 297; this.txtHomeSingle.TabIndex = 297;
...@@ -338,7 +450,7 @@ ...@@ -338,7 +450,7 @@
// label16 // label16
// //
this.label16.AutoSize = true; this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(152, 260); this.label16.Location = new System.Drawing.Point(152, 268);
this.label16.Name = "label16"; this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(112, 17); this.label16.Size = new System.Drawing.Size(112, 17);
this.label16.TabIndex = 295; this.label16.TabIndex = 295;
...@@ -347,7 +459,7 @@ ...@@ -347,7 +459,7 @@
// label15 // label15
// //
this.label15.AutoSize = true; this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(152, 231); this.label15.Location = new System.Drawing.Point(152, 239);
this.label15.Name = "label15"; this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(124, 17); this.label15.Size = new System.Drawing.Size(124, 17);
this.label15.TabIndex = 294; this.label15.TabIndex = 294;
...@@ -356,7 +468,7 @@ ...@@ -356,7 +468,7 @@
// label14 // label14
// //
this.label14.AutoSize = true; this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(152, 198); this.label14.Location = new System.Drawing.Point(152, 206);
this.label14.Name = "label14"; this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(100, 17); this.label14.Size = new System.Drawing.Size(100, 17);
this.label14.TabIndex = 293; this.label14.TabIndex = 293;
...@@ -365,7 +477,7 @@ ...@@ -365,7 +477,7 @@
// label11 // label11
// //
this.label11.AutoSize = true; this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(3, 260); this.label11.Location = new System.Drawing.Point(3, 268);
this.label11.Name = "label11"; this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(114, 17); this.label11.Size = new System.Drawing.Size(114, 17);
this.label11.TabIndex = 292; this.label11.TabIndex = 292;
...@@ -374,14 +486,14 @@ ...@@ -374,14 +486,14 @@
// txtHomeStatus // txtHomeStatus
// //
this.txtHomeStatus.Enabled = false; this.txtHomeStatus.Enabled = false;
this.txtHomeStatus.Location = new System.Drawing.Point(121, 257); this.txtHomeStatus.Location = new System.Drawing.Point(121, 265);
this.txtHomeStatus.Name = "txtHomeStatus"; this.txtHomeStatus.Name = "txtHomeStatus";
this.txtHomeStatus.Size = new System.Drawing.Size(25, 23); this.txtHomeStatus.Size = new System.Drawing.Size(25, 23);
this.txtHomeStatus.TabIndex = 291; this.txtHomeStatus.TabIndex = 291;
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(278, 253); this.button2.Location = new System.Drawing.Point(286, 261);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(105, 33); this.button2.Size = new System.Drawing.Size(105, 33);
this.button2.TabIndex = 290; this.button2.TabIndex = 290;
...@@ -392,7 +504,7 @@ ...@@ -392,7 +504,7 @@
// label10 // label10
// //
this.label10.AutoSize = true; this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(42, 229); this.label10.Location = new System.Drawing.Point(42, 237);
this.label10.Name = "label10"; this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(75, 17); this.label10.Size = new System.Drawing.Size(75, 17);
this.label10.TabIndex = 289; this.label10.TabIndex = 289;
...@@ -401,14 +513,14 @@ ...@@ -401,14 +513,14 @@
// txtBusyStatus // txtBusyStatus
// //
this.txtBusyStatus.Enabled = false; this.txtBusyStatus.Enabled = false;
this.txtBusyStatus.Location = new System.Drawing.Point(121, 226); this.txtBusyStatus.Location = new System.Drawing.Point(121, 234);
this.txtBusyStatus.Name = "txtBusyStatus"; this.txtBusyStatus.Name = "txtBusyStatus";
this.txtBusyStatus.Size = new System.Drawing.Size(25, 23); this.txtBusyStatus.Size = new System.Drawing.Size(25, 23);
this.txtBusyStatus.TabIndex = 288; this.txtBusyStatus.TabIndex = 288;
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(278, 220); this.button1.Location = new System.Drawing.Point(286, 228);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(105, 33); this.button1.Size = new System.Drawing.Size(105, 33);
this.button1.TabIndex = 287; this.button1.TabIndex = 287;
...@@ -419,7 +531,7 @@ ...@@ -419,7 +531,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(49, 198); this.label2.Location = new System.Drawing.Point(49, 206);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 17); this.label2.Size = new System.Drawing.Size(68, 17);
this.label2.TabIndex = 286; this.label2.TabIndex = 286;
...@@ -428,14 +540,14 @@ ...@@ -428,14 +540,14 @@
// txtAlarmStatus // txtAlarmStatus
// //
this.txtAlarmStatus.Enabled = false; this.txtAlarmStatus.Enabled = false;
this.txtAlarmStatus.Location = new System.Drawing.Point(121, 195); this.txtAlarmStatus.Location = new System.Drawing.Point(121, 203);
this.txtAlarmStatus.Name = "txtAlarmStatus"; this.txtAlarmStatus.Name = "txtAlarmStatus";
this.txtAlarmStatus.Size = new System.Drawing.Size(25, 23); this.txtAlarmStatus.Size = new System.Drawing.Size(25, 23);
this.txtAlarmStatus.TabIndex = 285; this.txtAlarmStatus.TabIndex = 285;
// //
// btnGetAlarm // btnGetAlarm
// //
this.btnGetAlarm.Location = new System.Drawing.Point(278, 187); this.btnGetAlarm.Location = new System.Drawing.Point(286, 195);
this.btnGetAlarm.Name = "btnGetAlarm"; this.btnGetAlarm.Name = "btnGetAlarm";
this.btnGetAlarm.Size = new System.Drawing.Size(105, 33); this.btnGetAlarm.Size = new System.Drawing.Size(105, 33);
this.btnGetAlarm.TabIndex = 284; this.btnGetAlarm.TabIndex = 284;
...@@ -449,13 +561,14 @@ ...@@ -449,13 +561,14 @@
this.btnReadPosition.Cursor = System.Windows.Forms.Cursors.Default; 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.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.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnReadPosition.Location = new System.Drawing.Point(401, 162); this.btnReadPosition.Location = new System.Drawing.Point(401, 153);
this.btnReadPosition.Name = "btnReadPosition"; this.btnReadPosition.Name = "btnReadPosition";
this.btnReadPosition.RightToLeft = System.Windows.Forms.RightToLeft.No; this.btnReadPosition.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnReadPosition.Size = new System.Drawing.Size(90, 33); this.btnReadPosition.Size = new System.Drawing.Size(90, 33);
this.btnReadPosition.TabIndex = 278; this.btnReadPosition.TabIndex = 278;
this.btnReadPosition.Text = "读取位置"; this.btnReadPosition.Text = "读取位置";
this.btnReadPosition.UseVisualStyleBackColor = true; this.btnReadPosition.UseVisualStyleBackColor = true;
this.btnReadPosition.Visible = false;
this.btnReadPosition.Click += new System.EventHandler(this.btnReadPosition_Click); this.btnReadPosition.Click += new System.EventHandler(this.btnReadPosition_Click);
// //
// lblServerOn // lblServerOn
...@@ -639,7 +752,7 @@ ...@@ -639,7 +752,7 @@
// //
// btnComAlarmClear // btnComAlarmClear
// //
this.btnComAlarmClear.Location = new System.Drawing.Point(203, 114); this.btnComAlarmClear.Location = new System.Drawing.Point(203, 116);
this.btnComAlarmClear.Name = "btnComAlarmClear"; this.btnComAlarmClear.Name = "btnComAlarmClear";
this.btnComAlarmClear.Size = new System.Drawing.Size(105, 33); this.btnComAlarmClear.Size = new System.Drawing.Size(105, 33);
this.btnComAlarmClear.TabIndex = 50; this.btnComAlarmClear.TabIndex = 50;
...@@ -766,9 +879,9 @@ ...@@ -766,9 +879,9 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.richTextBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.richTextBox1.Location = new System.Drawing.Point(510, 576); this.richTextBox1.Location = new System.Drawing.Point(510, 473);
this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(519, 163); this.richTextBox1.Size = new System.Drawing.Size(515, 266);
this.richTextBox1.TabIndex = 256; this.richTextBox1.TabIndex = 256;
this.richTextBox1.Text = ""; this.richTextBox1.Text = "";
// //
...@@ -776,6 +889,13 @@ ...@@ -776,6 +889,13 @@
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.lblAxisStatus);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.axis_5_Alarm);
this.groupBox1.Controls.Add(this.txtBatchTarget);
this.groupBox1.Controls.Add(this.lblCountPulse5);
this.groupBox1.Controls.Add(this.lblOutPulse5);
this.groupBox1.Controls.Add(this.label20);
this.groupBox1.Controls.Add(this.axis_1_Alarm); this.groupBox1.Controls.Add(this.axis_1_Alarm);
this.groupBox1.Controls.Add(this.axis_3_Alarm); this.groupBox1.Controls.Add(this.axis_3_Alarm);
this.groupBox1.Controls.Add(this.axis_2_Alarm); this.groupBox1.Controls.Add(this.axis_2_Alarm);
...@@ -796,19 +916,89 @@ ...@@ -796,19 +916,89 @@
this.groupBox1.Controls.Add(this.label43); this.groupBox1.Controls.Add(this.label43);
this.groupBox1.Controls.Add(this.label42); this.groupBox1.Controls.Add(this.label42);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(6, 333); this.groupBox1.Location = new System.Drawing.Point(8, 187);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(497, 170); this.groupBox1.Size = new System.Drawing.Size(493, 212);
this.groupBox1.TabIndex = 217; this.groupBox1.TabIndex = 217;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "伺服状态"; this.groupBox1.Text = "伺服状态";
// //
// lblAxisStatus
//
this.lblAxisStatus.AutoSize = true;
this.lblAxisStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblAxisStatus.ForeColor = System.Drawing.Color.Green;
this.lblAxisStatus.Location = new System.Drawing.Point(193, 181);
this.lblAxisStatus.Name = "lblAxisStatus";
this.lblAxisStatus.Size = new System.Drawing.Size(152, 17);
this.lblAxisStatus.TabIndex = 280;
this.lblAxisStatus.Text = "点击按钮可读取轴实时状态";
//
// button3
//
this.button3.BackColor = System.Drawing.SystemColors.Control;
this.button3.Cursor = System.Windows.Forms.Cursors.Default;
this.button3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.ForeColor = System.Drawing.SystemColors.ControlText;
this.button3.Location = new System.Drawing.Point(91, 173);
this.button3.Name = "button3";
this.button3.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.button3.Size = new System.Drawing.Size(90, 33);
this.button3.TabIndex = 279;
this.button3.Text = "读取位置";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// axis_5_Alarm
//
this.axis_5_Alarm.IOName = "";
this.axis_5_Alarm.IOValue = 0;
this.axis_5_Alarm.isCanClick = false;
this.axis_5_Alarm.Location = new System.Drawing.Point(418, 37);
this.axis_5_Alarm.Name = "axis_5_Alarm";
this.axis_5_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_5_Alarm.TabIndex = 271;
//
// txtBatchTarget
//
this.txtBatchTarget.Location = new System.Drawing.Point(395, 139);
this.txtBatchTarget.Name = "txtBatchTarget";
this.txtBatchTarget.ReadOnly = true;
this.txtBatchTarget.Size = new System.Drawing.Size(87, 23);
this.txtBatchTarget.TabIndex = 270;
//
// lblCountPulse5
//
this.lblCountPulse5.Location = new System.Drawing.Point(395, 112);
this.lblCountPulse5.Name = "lblCountPulse5";
this.lblCountPulse5.ReadOnly = true;
this.lblCountPulse5.Size = new System.Drawing.Size(87, 23);
this.lblCountPulse5.TabIndex = 269;
//
// lblOutPulse5
//
this.lblOutPulse5.Location = new System.Drawing.Point(395, 85);
this.lblOutPulse5.Name = "lblOutPulse5";
this.lblOutPulse5.ReadOnly = true;
this.lblOutPulse5.Size = new System.Drawing.Size(87, 23);
this.lblOutPulse5.TabIndex = 268;
//
// label20
//
this.label20.AutoSize = true;
this.label20.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label20.Location = new System.Drawing.Point(392, 14);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(80, 17);
this.label20.TabIndex = 267;
this.label20.Text = "批量出入料轴";
//
// axis_1_Alarm // axis_1_Alarm
// //
this.axis_1_Alarm.IOName = ""; this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0; this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false; this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(127, 37); this.axis_1_Alarm.Location = new System.Drawing.Point(116, 37);
this.axis_1_Alarm.Name = "axis_1_Alarm"; this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39); this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264; this.axis_1_Alarm.TabIndex = 264;
...@@ -818,7 +1008,7 @@ ...@@ -818,7 +1008,7 @@
this.axis_3_Alarm.IOName = ""; this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0; this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false; this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(329, 37); this.axis_3_Alarm.Location = new System.Drawing.Point(318, 37);
this.axis_3_Alarm.Name = "axis_3_Alarm"; this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39); this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266; this.axis_3_Alarm.TabIndex = 266;
...@@ -828,7 +1018,7 @@ ...@@ -828,7 +1018,7 @@
this.axis_2_Alarm.IOName = ""; this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0; this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false; this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(224, 37); this.axis_2_Alarm.Location = new System.Drawing.Point(213, 37);
this.axis_2_Alarm.Name = "axis_2_Alarm"; this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39); this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265; this.axis_2_Alarm.TabIndex = 265;
...@@ -845,7 +1035,7 @@ ...@@ -845,7 +1035,7 @@
// //
// txtMiddleTarget // txtMiddleTarget
// //
this.txtMiddleTarget.Location = new System.Drawing.Point(105, 139); this.txtMiddleTarget.Location = new System.Drawing.Point(94, 139);
this.txtMiddleTarget.Name = "txtMiddleTarget"; this.txtMiddleTarget.Name = "txtMiddleTarget";
this.txtMiddleTarget.ReadOnly = true; this.txtMiddleTarget.ReadOnly = true;
this.txtMiddleTarget.Size = new System.Drawing.Size(87, 23); this.txtMiddleTarget.Size = new System.Drawing.Size(87, 23);
...@@ -853,7 +1043,7 @@ ...@@ -853,7 +1043,7 @@
// //
// txtInoutTarget // txtInoutTarget
// //
this.txtInoutTarget.Location = new System.Drawing.Point(306, 139); this.txtInoutTarget.Location = new System.Drawing.Point(295, 139);
this.txtInoutTarget.Name = "txtInoutTarget"; this.txtInoutTarget.Name = "txtInoutTarget";
this.txtInoutTarget.ReadOnly = true; this.txtInoutTarget.ReadOnly = true;
this.txtInoutTarget.Size = new System.Drawing.Size(87, 23); this.txtInoutTarget.Size = new System.Drawing.Size(87, 23);
...@@ -861,7 +1051,7 @@ ...@@ -861,7 +1051,7 @@
// //
// txtUpdownTarget // txtUpdownTarget
// //
this.txtUpdownTarget.Location = new System.Drawing.Point(206, 139); this.txtUpdownTarget.Location = new System.Drawing.Point(195, 139);
this.txtUpdownTarget.Name = "txtUpdownTarget"; this.txtUpdownTarget.Name = "txtUpdownTarget";
this.txtUpdownTarget.ReadOnly = true; this.txtUpdownTarget.ReadOnly = true;
this.txtUpdownTarget.Size = new System.Drawing.Size(87, 23); this.txtUpdownTarget.Size = new System.Drawing.Size(87, 23);
...@@ -873,13 +1063,13 @@ ...@@ -873,13 +1063,13 @@
this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label12.Location = new System.Drawing.Point(7, 142); this.label12.Location = new System.Drawing.Point(7, 142);
this.label12.Name = "label12"; this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(92, 17); this.label12.Size = new System.Drawing.Size(83, 17);
this.label12.TabIndex = 258; this.label12.TabIndex = 258;
this.label12.Text = "出入库目标值"; this.label12.Text = "出入库目标值:";
// //
// lblCountPulse1 // lblCountPulse1
// //
this.lblCountPulse1.Location = new System.Drawing.Point(105, 112); this.lblCountPulse1.Location = new System.Drawing.Point(94, 112);
this.lblCountPulse1.Name = "lblCountPulse1"; this.lblCountPulse1.Name = "lblCountPulse1";
this.lblCountPulse1.ReadOnly = true; this.lblCountPulse1.ReadOnly = true;
this.lblCountPulse1.Size = new System.Drawing.Size(87, 23); this.lblCountPulse1.Size = new System.Drawing.Size(87, 23);
...@@ -887,7 +1077,7 @@ ...@@ -887,7 +1077,7 @@
// //
// lblOutPulse1 // lblOutPulse1
// //
this.lblOutPulse1.Location = new System.Drawing.Point(105, 85); this.lblOutPulse1.Location = new System.Drawing.Point(94, 85);
this.lblOutPulse1.Name = "lblOutPulse1"; this.lblOutPulse1.Name = "lblOutPulse1";
this.lblOutPulse1.ReadOnly = true; this.lblOutPulse1.ReadOnly = true;
this.lblOutPulse1.Size = new System.Drawing.Size(87, 23); this.lblOutPulse1.Size = new System.Drawing.Size(87, 23);
...@@ -895,7 +1085,7 @@ ...@@ -895,7 +1085,7 @@
// //
// lblCountPulse3 // lblCountPulse3
// //
this.lblCountPulse3.Location = new System.Drawing.Point(306, 112); this.lblCountPulse3.Location = new System.Drawing.Point(295, 112);
this.lblCountPulse3.Name = "lblCountPulse3"; this.lblCountPulse3.Name = "lblCountPulse3";
this.lblCountPulse3.ReadOnly = true; this.lblCountPulse3.ReadOnly = true;
this.lblCountPulse3.Size = new System.Drawing.Size(87, 23); this.lblCountPulse3.Size = new System.Drawing.Size(87, 23);
...@@ -903,7 +1093,7 @@ ...@@ -903,7 +1093,7 @@
// //
// lblOutPulse3 // lblOutPulse3
// //
this.lblOutPulse3.Location = new System.Drawing.Point(306, 85); this.lblOutPulse3.Location = new System.Drawing.Point(295, 85);
this.lblOutPulse3.Name = "lblOutPulse3"; this.lblOutPulse3.Name = "lblOutPulse3";
this.lblOutPulse3.ReadOnly = true; this.lblOutPulse3.ReadOnly = true;
this.lblOutPulse3.Size = new System.Drawing.Size(87, 23); this.lblOutPulse3.Size = new System.Drawing.Size(87, 23);
...@@ -911,7 +1101,7 @@ ...@@ -911,7 +1101,7 @@
// //
// lblCountPulse2 // lblCountPulse2
// //
this.lblCountPulse2.Location = new System.Drawing.Point(207, 112); this.lblCountPulse2.Location = new System.Drawing.Point(196, 112);
this.lblCountPulse2.Name = "lblCountPulse2"; this.lblCountPulse2.Name = "lblCountPulse2";
this.lblCountPulse2.ReadOnly = true; this.lblCountPulse2.ReadOnly = true;
this.lblCountPulse2.Size = new System.Drawing.Size(87, 23); this.lblCountPulse2.Size = new System.Drawing.Size(87, 23);
...@@ -919,7 +1109,7 @@ ...@@ -919,7 +1109,7 @@
// //
// lblOutPulse2 // lblOutPulse2
// //
this.lblOutPulse2.Location = new System.Drawing.Point(206, 85); this.lblOutPulse2.Location = new System.Drawing.Point(195, 85);
this.lblOutPulse2.Name = "lblOutPulse2"; this.lblOutPulse2.Name = "lblOutPulse2";
this.lblOutPulse2.ReadOnly = true; this.lblOutPulse2.ReadOnly = true;
this.lblOutPulse2.Size = new System.Drawing.Size(87, 23); this.lblOutPulse2.Size = new System.Drawing.Size(87, 23);
...@@ -929,7 +1119,7 @@ ...@@ -929,7 +1119,7 @@
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.label4.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label4.Location = new System.Drawing.Point(303, 14); this.label4.Location = new System.Drawing.Point(292, 14);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 17); this.label4.Size = new System.Drawing.Size(80, 17);
this.label4.TabIndex = 100; this.label4.TabIndex = 100;
...@@ -939,7 +1129,7 @@ ...@@ -939,7 +1129,7 @@
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.label3.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.Location = new System.Drawing.Point(204, 14); this.label3.Location = new System.Drawing.Point(193, 14);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 17); this.label3.Size = new System.Drawing.Size(80, 17);
this.label3.TabIndex = 99; this.label3.TabIndex = 99;
...@@ -949,7 +1139,7 @@ ...@@ -949,7 +1139,7 @@
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Location = new System.Drawing.Point(106, 14); this.label1.Location = new System.Drawing.Point(95, 14);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 17); this.label1.Size = new System.Drawing.Size(80, 17);
this.label1.TabIndex = 97; this.label1.TabIndex = 97;
...@@ -961,9 +1151,9 @@ ...@@ -961,9 +1151,9 @@
this.label43.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label43.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label43.Location = new System.Drawing.Point(15, 87); this.label43.Location = new System.Drawing.Point(15, 87);
this.label43.Name = "label43"; this.label43.Name = "label43";
this.label43.Size = new System.Drawing.Size(80, 17); this.label43.Size = new System.Drawing.Size(71, 17);
this.label43.TabIndex = 23; this.label43.TabIndex = 23;
this.label43.Text = "输出脉冲值"; this.label43.Text = "输出脉冲值:";
// //
// label42 // label42
// //
...@@ -971,9 +1161,9 @@ ...@@ -971,9 +1161,9 @@
this.label42.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label42.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label42.Location = new System.Drawing.Point(15, 113); this.label42.Location = new System.Drawing.Point(15, 113);
this.label42.Name = "label42"; this.label42.Name = "label42";
this.label42.Size = new System.Drawing.Size(80, 17); this.label42.Size = new System.Drawing.Size(71, 17);
this.label42.TabIndex = 24; this.label42.TabIndex = 24;
this.label42.Text = "编码器计数"; this.label42.Text = "编码器计数:";
// //
// groupBox2 // groupBox2
// //
...@@ -1020,9 +1210,9 @@ ...@@ -1020,9 +1210,9 @@
this.groupBox2.Controls.Add(this.btnUpDownP6); this.groupBox2.Controls.Add(this.btnUpDownP6);
this.groupBox2.Controls.Add(this.btnUpDownP3); this.groupBox2.Controls.Add(this.btnUpDownP3);
this.groupBox2.Controls.Add(this.btnUpDownP4); this.groupBox2.Controls.Add(this.btnUpDownP4);
this.groupBox2.Location = new System.Drawing.Point(7, 343); this.groupBox2.Location = new System.Drawing.Point(7, 335);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(496, 396); this.groupBox2.Size = new System.Drawing.Size(496, 404);
this.groupBox2.TabIndex = 100; this.groupBox2.TabIndex = 100;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "出入库操作"; this.groupBox2.Text = "出入库操作";
...@@ -1041,7 +1231,7 @@ ...@@ -1041,7 +1231,7 @@
// btnClearLog // btnClearLog
// //
this.btnClearLog.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnClearLog.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClearLog.Location = new System.Drawing.Point(251, 347); this.btnClearLog.Location = new System.Drawing.Point(369, 349);
this.btnClearLog.Name = "btnClearLog"; this.btnClearLog.Name = "btnClearLog";
this.btnClearLog.Size = new System.Drawing.Size(105, 38); this.btnClearLog.Size = new System.Drawing.Size(105, 38);
this.btnClearLog.TabIndex = 224; this.btnClearLog.TabIndex = 224;
...@@ -1063,7 +1253,7 @@ ...@@ -1063,7 +1253,7 @@
// btnSavePosition // btnSavePosition
// //
this.btnSavePosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSavePosition.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSavePosition.Location = new System.Drawing.Point(362, 347); this.btnSavePosition.Location = new System.Drawing.Point(251, 349);
this.btnSavePosition.Name = "btnSavePosition"; this.btnSavePosition.Name = "btnSavePosition";
this.btnSavePosition.Size = new System.Drawing.Size(105, 38); this.btnSavePosition.Size = new System.Drawing.Size(105, 38);
this.btnSavePosition.TabIndex = 217; this.btnSavePosition.TabIndex = 217;
...@@ -1704,55 +1894,55 @@ ...@@ -1704,55 +1894,55 @@
// 启动ToolStripMenuItem // 启动ToolStripMenuItem
// //
this.启动ToolStripMenuItem.Name = "启动ToolStripMenuItem"; this.启动ToolStripMenuItem.Name = "启动ToolStripMenuItem";
this.启动ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.启动ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启动ToolStripMenuItem.Text = "启动"; this.启动ToolStripMenuItem.Text = "启动";
this.启动ToolStripMenuItem.Click += new System.EventHandler(this.启动ToolStripMenuItem_Click); this.启动ToolStripMenuItem.Click += new System.EventHandler(this.启动ToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
// //
// 停止ToolStripMenuItem // 停止ToolStripMenuItem
// //
this.停止ToolStripMenuItem.Name = "停止ToolStripMenuItem"; this.停止ToolStripMenuItem.Name = "停止ToolStripMenuItem";
this.停止ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.停止ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.停止ToolStripMenuItem.Text = "停止"; this.停止ToolStripMenuItem.Text = "停止";
this.停止ToolStripMenuItem.Click += new System.EventHandler(this.停止ToolStripMenuItem_Click); this.停止ToolStripMenuItem.Click += new System.EventHandler(this.停止ToolStripMenuItem_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
// //
// 复位ToolStripMenuItem // 复位ToolStripMenuItem
// //
this.复位ToolStripMenuItem.Name = "复位ToolStripMenuItem"; this.复位ToolStripMenuItem.Name = "复位ToolStripMenuItem";
this.复位ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.复位ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复位ToolStripMenuItem.Text = "复位"; this.复位ToolStripMenuItem.Text = "复位";
this.复位ToolStripMenuItem.Click += new System.EventHandler(this.复位ToolStripMenuItem_Click); this.复位ToolStripMenuItem.Click += new System.EventHandler(this.复位ToolStripMenuItem_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
// //
// 回待机点ToolStripMenuItem // 回待机点ToolStripMenuItem
// //
this.回待机点ToolStripMenuItem.Name = "回待机点ToolStripMenuItem"; this.回待机点ToolStripMenuItem.Name = "回待机点ToolStripMenuItem";
this.回待机点ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.回待机点ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.回待机点ToolStripMenuItem.Text = "回待机点"; this.回待机点ToolStripMenuItem.Text = "回待机点";
this.回待机点ToolStripMenuItem.Click += new System.EventHandler(this.回待机点ToolStripMenuItem_Click); this.回待机点ToolStripMenuItem.Click += new System.EventHandler(this.回待机点ToolStripMenuItem_Click);
// //
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
// //
// 退出ToolStripMenuItem // 退出ToolStripMenuItem
// //
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.退出ToolStripMenuItem.Text = "退出系统"; this.退出ToolStripMenuItem.Text = "退出系统";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
// //
...@@ -2011,16 +2201,16 @@ ...@@ -2011,16 +2201,16 @@
this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox4.Location = new System.Drawing.Point(8, 7); this.groupBox4.Location = new System.Drawing.Point(8, 7);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(493, 523); this.groupBox4.Size = new System.Drawing.Size(493, 175);
this.groupBox4.TabIndex = 271; this.groupBox4.TabIndex = 271;
this.groupBox4.TabStop = false; this.groupBox4.TabStop = false;
this.groupBox4.Text = "压紧轴"; this.groupBox4.Text = "压紧轴";
// //
// btnRelMove // btnRelMove
// //
this.btnRelMove.Location = new System.Drawing.Point(285, 103); this.btnRelMove.Location = new System.Drawing.Point(282, 61);
this.btnRelMove.Name = "btnRelMove"; this.btnRelMove.Name = "btnRelMove";
this.btnRelMove.Size = new System.Drawing.Size(105, 33); this.btnRelMove.Size = new System.Drawing.Size(100, 33);
this.btnRelMove.TabIndex = 96; this.btnRelMove.TabIndex = 96;
this.btnRelMove.Text = "相对运动"; this.btnRelMove.Text = "相对运动";
this.btnRelMove.UseVisualStyleBackColor = true; this.btnRelMove.UseVisualStyleBackColor = true;
...@@ -2029,7 +2219,7 @@ ...@@ -2029,7 +2219,7 @@
// txtAddr // txtAddr
// //
this.txtAddr.Enabled = false; this.txtAddr.Enabled = false;
this.txtAddr.Location = new System.Drawing.Point(228, 27); this.txtAddr.Location = new System.Drawing.Point(210, 27);
this.txtAddr.Name = "txtAddr"; this.txtAddr.Name = "txtAddr";
this.txtAddr.Size = new System.Drawing.Size(48, 23); this.txtAddr.Size = new System.Drawing.Size(48, 23);
this.txtAddr.TabIndex = 95; this.txtAddr.TabIndex = 95;
...@@ -2038,17 +2228,17 @@ ...@@ -2038,17 +2228,17 @@
// label18 // label18
// //
this.label18.AutoSize = true; this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(180, 30); this.label18.Location = new System.Drawing.Point(174, 30);
this.label18.Name = "label18"; this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(44, 17); this.label18.Size = new System.Drawing.Size(32, 17);
this.label18.TabIndex = 94; this.label18.TabIndex = 94;
this.label18.Text = "地址"; this.label18.Text = "地址";
// //
// btnGetPosition // btnGetPosition
// //
this.btnGetPosition.Location = new System.Drawing.Point(176, 210); this.btnGetPosition.Location = new System.Drawing.Point(387, 62);
this.btnGetPosition.Name = "btnGetPosition"; this.btnGetPosition.Name = "btnGetPosition";
this.btnGetPosition.Size = new System.Drawing.Size(105, 33); this.btnGetPosition.Size = new System.Drawing.Size(100, 33);
this.btnGetPosition.TabIndex = 93; this.btnGetPosition.TabIndex = 93;
this.btnGetPosition.Text = "查询位置"; this.btnGetPosition.Text = "查询位置";
this.btnGetPosition.UseVisualStyleBackColor = true; this.btnGetPosition.UseVisualStyleBackColor = true;
...@@ -2061,7 +2251,7 @@ ...@@ -2061,7 +2251,7 @@
this.cmbHomeType.Items.AddRange(new object[] { this.cmbHomeType.Items.AddRange(new object[] {
"0=反方向", "0=反方向",
"1=正方向"}); "1=正方向"});
this.cmbHomeType.Location = new System.Drawing.Point(67, 175); this.cmbHomeType.Location = new System.Drawing.Point(67, 133);
this.cmbHomeType.Name = "cmbHomeType"; this.cmbHomeType.Name = "cmbHomeType";
this.cmbHomeType.Size = new System.Drawing.Size(103, 25); this.cmbHomeType.Size = new System.Drawing.Size(103, 25);
this.cmbHomeType.TabIndex = 92; this.cmbHomeType.TabIndex = 92;
...@@ -2069,7 +2259,7 @@ ...@@ -2069,7 +2259,7 @@
// label13 // label13
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(5, 179); this.label13.Location = new System.Drawing.Point(5, 137);
this.label13.Name = "label13"; this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(68, 17); this.label13.Size = new System.Drawing.Size(68, 17);
this.label13.TabIndex = 91; this.label13.TabIndex = 91;
...@@ -2078,7 +2268,7 @@ ...@@ -2078,7 +2268,7 @@
// label17 // label17
// //
this.label17.AutoSize = true; this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(5, 145); this.label17.Location = new System.Drawing.Point(5, 104);
this.label17.Name = "label17"; this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(44, 17); this.label17.Size = new System.Drawing.Size(44, 17);
this.label17.TabIndex = 90; this.label17.TabIndex = 90;
...@@ -2086,7 +2276,7 @@ ...@@ -2086,7 +2276,7 @@
// //
// txtSpeed // txtSpeed
// //
this.txtSpeed.Location = new System.Drawing.Point(67, 142); this.txtSpeed.Location = new System.Drawing.Point(67, 100);
this.txtSpeed.MaxLength = 15; this.txtSpeed.MaxLength = 15;
this.txtSpeed.Name = "txtSpeed"; this.txtSpeed.Name = "txtSpeed";
this.txtSpeed.Size = new System.Drawing.Size(103, 23); this.txtSpeed.Size = new System.Drawing.Size(103, 23);
...@@ -2095,9 +2285,9 @@ ...@@ -2095,9 +2285,9 @@
// //
// btnVolMove // btnVolMove
// //
this.btnVolMove.Location = new System.Drawing.Point(176, 137); this.btnVolMove.Location = new System.Drawing.Point(176, 95);
this.btnVolMove.Name = "btnVolMove"; this.btnVolMove.Name = "btnVolMove";
this.btnVolMove.Size = new System.Drawing.Size(105, 33); this.btnVolMove.Size = new System.Drawing.Size(100, 33);
this.btnVolMove.TabIndex = 88; this.btnVolMove.TabIndex = 88;
this.btnVolMove.Text = "匀速运动"; this.btnVolMove.Text = "匀速运动";
this.btnVolMove.UseVisualStyleBackColor = true; this.btnVolMove.UseVisualStyleBackColor = true;
...@@ -2105,9 +2295,9 @@ ...@@ -2105,9 +2295,9 @@
// //
// btnClose // btnClose
// //
this.btnClose.Location = new System.Drawing.Point(171, 59); this.btnClose.Location = new System.Drawing.Point(375, 20);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(105, 33); this.btnClose.Size = new System.Drawing.Size(100, 33);
this.btnClose.TabIndex = 87; this.btnClose.TabIndex = 87;
this.btnClose.Text = "关闭串口"; this.btnClose.Text = "关闭串口";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
...@@ -2115,9 +2305,9 @@ ...@@ -2115,9 +2305,9 @@
// //
// btnOpen // btnOpen
// //
this.btnOpen.Location = new System.Drawing.Point(61, 59); this.btnOpen.Location = new System.Drawing.Point(265, 20);
this.btnOpen.Name = "btnOpen"; this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(105, 33); this.btnOpen.Size = new System.Drawing.Size(100, 33);
this.btnOpen.TabIndex = 86; this.btnOpen.TabIndex = 86;
this.btnOpen.Text = "打开串口"; this.btnOpen.Text = "打开串口";
this.btnOpen.UseVisualStyleBackColor = true; this.btnOpen.UseVisualStyleBackColor = true;
...@@ -2125,9 +2315,9 @@ ...@@ -2125,9 +2315,9 @@
// //
// btnStatusSearch // btnStatusSearch
// //
this.btnStatusSearch.Location = new System.Drawing.Point(285, 137); this.btnStatusSearch.Location = new System.Drawing.Point(282, 95);
this.btnStatusSearch.Name = "btnStatusSearch"; this.btnStatusSearch.Name = "btnStatusSearch";
this.btnStatusSearch.Size = new System.Drawing.Size(105, 33); this.btnStatusSearch.Size = new System.Drawing.Size(100, 33);
this.btnStatusSearch.TabIndex = 85; this.btnStatusSearch.TabIndex = 85;
this.btnStatusSearch.Text = "查询运动状态"; this.btnStatusSearch.Text = "查询运动状态";
this.btnStatusSearch.UseVisualStyleBackColor = true; this.btnStatusSearch.UseVisualStyleBackColor = true;
...@@ -2136,7 +2326,7 @@ ...@@ -2136,7 +2326,7 @@
// label19 // label19
// //
this.label19.AutoSize = true; this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(5, 111); this.label19.Location = new System.Drawing.Point(5, 70);
this.label19.Name = "label19"; this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(44, 17); this.label19.Size = new System.Drawing.Size(44, 17);
this.label19.TabIndex = 84; this.label19.TabIndex = 84;
...@@ -2144,7 +2334,7 @@ ...@@ -2144,7 +2334,7 @@
// //
// txtLinePosition // txtLinePosition
// //
this.txtLinePosition.Location = new System.Drawing.Point(67, 108); this.txtLinePosition.Location = new System.Drawing.Point(67, 66);
this.txtLinePosition.MaxLength = 15; this.txtLinePosition.MaxLength = 15;
this.txtLinePosition.Name = "txtLinePosition"; this.txtLinePosition.Name = "txtLinePosition";
this.txtLinePosition.Size = new System.Drawing.Size(103, 23); this.txtLinePosition.Size = new System.Drawing.Size(103, 23);
...@@ -2153,9 +2343,9 @@ ...@@ -2153,9 +2343,9 @@
// //
// btnHomeMove // btnHomeMove
// //
this.btnHomeMove.Location = new System.Drawing.Point(176, 171); this.btnHomeMove.Location = new System.Drawing.Point(176, 129);
this.btnHomeMove.Name = "btnHomeMove"; this.btnHomeMove.Name = "btnHomeMove";
this.btnHomeMove.Size = new System.Drawing.Size(105, 33); this.btnHomeMove.Size = new System.Drawing.Size(100, 33);
this.btnHomeMove.TabIndex = 12; this.btnHomeMove.TabIndex = 12;
this.btnHomeMove.Text = "原点返回"; this.btnHomeMove.Text = "原点返回";
this.btnHomeMove.UseVisualStyleBackColor = true; this.btnHomeMove.UseVisualStyleBackColor = true;
...@@ -2163,9 +2353,9 @@ ...@@ -2163,9 +2353,9 @@
// //
// btnClearPosition // btnClearPosition
// //
this.btnClearPosition.Location = new System.Drawing.Point(285, 210); this.btnClearPosition.Location = new System.Drawing.Point(387, 99);
this.btnClearPosition.Name = "btnClearPosition"; this.btnClearPosition.Name = "btnClearPosition";
this.btnClearPosition.Size = new System.Drawing.Size(105, 33); this.btnClearPosition.Size = new System.Drawing.Size(100, 33);
this.btnClearPosition.TabIndex = 11; this.btnClearPosition.TabIndex = 11;
this.btnClearPosition.Text = "清理位置"; this.btnClearPosition.Text = "清理位置";
this.btnClearPosition.UseVisualStyleBackColor = true; this.btnClearPosition.UseVisualStyleBackColor = true;
...@@ -2173,9 +2363,9 @@ ...@@ -2173,9 +2363,9 @@
// //
// btnStop // btnStop
// //
this.btnStop.Location = new System.Drawing.Point(285, 171); this.btnStop.Location = new System.Drawing.Point(282, 129);
this.btnStop.Name = "btnStop"; this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(105, 33); this.btnStop.Size = new System.Drawing.Size(100, 33);
this.btnStop.TabIndex = 10; this.btnStop.TabIndex = 10;
this.btnStop.Text = "紧急停止"; this.btnStop.Text = "紧急停止";
this.btnStop.UseVisualStyleBackColor = true; this.btnStop.UseVisualStyleBackColor = true;
...@@ -2183,9 +2373,9 @@ ...@@ -2183,9 +2373,9 @@
// //
// btnLineAbsMove // btnLineAbsMove
// //
this.btnLineAbsMove.Location = new System.Drawing.Point(176, 103); this.btnLineAbsMove.Location = new System.Drawing.Point(176, 61);
this.btnLineAbsMove.Name = "btnLineAbsMove"; this.btnLineAbsMove.Name = "btnLineAbsMove";
this.btnLineAbsMove.Size = new System.Drawing.Size(105, 33); this.btnLineAbsMove.Size = new System.Drawing.Size(100, 33);
this.btnLineAbsMove.TabIndex = 9; this.btnLineAbsMove.TabIndex = 9;
this.btnLineAbsMove.Text = "绝对运动"; this.btnLineAbsMove.Text = "绝对运动";
this.btnLineAbsMove.UseVisualStyleBackColor = true; this.btnLineAbsMove.UseVisualStyleBackColor = true;
...@@ -2219,17 +2409,16 @@ ...@@ -2219,17 +2409,16 @@
this.tabControl1.Location = new System.Drawing.Point(510, 36); this.tabControl1.Location = new System.Drawing.Point(510, 36);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(519, 538); this.tabControl1.Size = new System.Drawing.Size(519, 435);
this.tabControl1.TabIndex = 301; this.tabControl1.TabIndex = 301;
// //
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.groupBox5); this.tabPage2.Controls.Add(this.groupBox5);
this.tabPage2.Controls.Add(this.groupBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 26); this.tabPage2.Location = new System.Drawing.Point(4, 26);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(511, 508); this.tabPage2.Size = new System.Drawing.Size(511, 405);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服调试"; this.tabPage2.Text = "伺服调试";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
...@@ -2237,9 +2426,10 @@ ...@@ -2237,9 +2426,10 @@
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.groupBox4); this.tabPage3.Controls.Add(this.groupBox4);
this.tabPage3.Controls.Add(this.groupBox1);
this.tabPage3.Location = new System.Drawing.Point(4, 26); this.tabPage3.Location = new System.Drawing.Point(4, 26);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(511, 508); this.tabPage3.Size = new System.Drawing.Size(511, 405);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "压紧轴调试"; this.tabPage3.Text = "压紧轴调试";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
...@@ -2248,13 +2438,13 @@ ...@@ -2248,13 +2438,13 @@
// //
this.groupBox6.Controls.Add(this.lblBatchStatus); this.groupBox6.Controls.Add(this.lblBatchStatus);
this.groupBox6.Controls.Add(this.btnBatchOutTest); this.groupBox6.Controls.Add(this.btnBatchOutTest);
this.groupBox6.Controls.Add(this.btnBatchOutEnd); this.groupBox6.Controls.Add(this.btnBatchReset);
this.groupBox6.Controls.Add(this.btnStartBatchInStore); this.groupBox6.Controls.Add(this.btnStartBatchInStore);
this.groupBox6.Controls.Add(this.btnGetOutTray); this.groupBox6.Controls.Add(this.btnGetOutTray);
this.groupBox6.Controls.Add(this.lblDoorStatus); this.groupBox6.Controls.Add(this.lblDoorStatus);
this.groupBox6.Controls.Add(this.btnBatchInStore); this.groupBox6.Controls.Add(this.btnBatchInStore);
this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox6.Location = new System.Drawing.Point(7, 128); this.groupBox6.Location = new System.Drawing.Point(7, 124);
this.groupBox6.Name = "groupBox6"; this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(497, 209); this.groupBox6.Size = new System.Drawing.Size(497, 209);
this.groupBox6.TabIndex = 302; this.groupBox6.TabIndex = 302;
...@@ -2283,17 +2473,16 @@ ...@@ -2283,17 +2473,16 @@
this.btnBatchOutTest.UseVisualStyleBackColor = true; this.btnBatchOutTest.UseVisualStyleBackColor = true;
this.btnBatchOutTest.Click += new System.EventHandler(this.btnBatchOutTest_Click); this.btnBatchOutTest.Click += new System.EventHandler(this.btnBatchOutTest_Click);
// //
// btnBatchOutEnd // btnBatchReset
// //
this.btnBatchOutEnd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBatchReset.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBatchOutEnd.Location = new System.Drawing.Point(286, 156); this.btnBatchReset.Location = new System.Drawing.Point(282, 156);
this.btnBatchOutEnd.Name = "btnBatchOutEnd"; this.btnBatchReset.Name = "btnBatchReset";
this.btnBatchOutEnd.Size = new System.Drawing.Size(105, 38); this.btnBatchReset.Size = new System.Drawing.Size(175, 38);
this.btnBatchOutEnd.TabIndex = 227; this.btnBatchReset.TabIndex = 227;
this.btnBatchOutEnd.Text = "取出完成"; this.btnBatchReset.Text = "批量上下料模块复位";
this.btnBatchOutEnd.UseVisualStyleBackColor = true; this.btnBatchReset.UseVisualStyleBackColor = true;
this.btnBatchOutEnd.Visible = false; this.btnBatchReset.Click += new System.EventHandler(this.btnBatchOutEnd_Click);
this.btnBatchOutEnd.Click += new System.EventHandler(this.btnBatchOutEnd_Click);
// //
// btnStartBatchInStore // btnStartBatchInStore
// //
...@@ -2565,9 +2754,25 @@ ...@@ -2565,9 +2754,25 @@
private System.Windows.Forms.Button btnBatchInStore; private System.Windows.Forms.Button btnBatchInStore;
private System.Windows.Forms.Button btnGetOutTray; private System.Windows.Forms.Button btnGetOutTray;
private System.Windows.Forms.Button btnStartBatchInStore; private System.Windows.Forms.Button btnStartBatchInStore;
private System.Windows.Forms.Button btnBatchOutEnd; private System.Windows.Forms.Button btnBatchReset;
private System.Windows.Forms.Button btnBatchOutTest; private System.Windows.Forms.Button btnBatchOutTest;
private System.Windows.Forms.Label lblBatchStatus; private System.Windows.Forms.Label lblBatchStatus;
private UserFromControl.IOStatusControl axis_5_Alarm;
private System.Windows.Forms.TextBox txtBatchTarget;
private System.Windows.Forms.TextBox lblCountPulse5;
private System.Windows.Forms.TextBox lblOutPulse5;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label lblAxisStatus;
public System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.Button btnReadLimit2;
private System.Windows.Forms.TextBox txtLimit2;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Button btnReadLimit1;
private System.Windows.Forms.TextBox txtLimit1;
public System.Windows.Forms.Button btnUpdateStatus;
} }
} }
...@@ -148,18 +148,22 @@ namespace OnlineStore.AutoInOutStore ...@@ -148,18 +148,22 @@ namespace OnlineStore.AutoInOutStore
private bool LoadOk = false; private bool LoadOk = false;
private void FrmTest_Load(object sender, EventArgs e) private void FrmTest_Load(object sender, EventArgs e)
{ {
timer1.Start();
LogUtil.logBox = this.richTextBox1; LogUtil.logBox = this.richTextBox1;
initValue();
this.ShowInTaskbar = true; this.ShowInTaskbar = true;
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title); this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
HideForm();
initValue();
LoadOk = true; LoadOk = true;
cmbHomeType.SelectedIndex = 1; cmbHomeType.SelectedIndex = 1;
HideForm(); timer1.Start();
} }
private DateTime preReadModblsTime = DateTime.Now; private DateTime preReadModblsTime = DateTime.Now;
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
if (this.Visible.Equals(false))
{
return;
}
//HumitureServer.RandomData(store.Config.GetTempAddrList()); //HumitureServer.RandomData(store.Config.GetTempAddrList());
lblTemp.Text = store.currTempStr; lblTemp.Text = store.currTempStr;
//验证运动是否完成 //验证运动是否完成
...@@ -296,7 +300,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -296,7 +300,7 @@ namespace OnlineStore.AutoInOutStore
btnBatchInStore.Enabled = !dooIsOpen; btnBatchInStore.Enabled = !dooIsOpen;
btnGetOutTray.Enabled = !dooIsOpen; btnGetOutTray.Enabled = !dooIsOpen;
btnStartBatchInStore.Enabled = dooIsOpen; btnStartBatchInStore.Enabled = dooIsOpen;
btnBatchOutEnd.Enabled = dooIsOpen; btnBatchReset.Enabled = dooIsOpen;
} }
private void ReadPosistion() private void ReadPosistion()
...@@ -336,7 +340,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -336,7 +340,7 @@ namespace OnlineStore.AutoInOutStore
lblOutPulse2.Text = string.Format("{0:d}", lOutPulse2); lblOutPulse2.Text = string.Format("{0:d}", lOutPulse2);
int lCountPulse2 = ACServerManager.GetActualtPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue()); int lCountPulse2 = ACServerManager.GetActualtPosition(store.Config.UpDown_Axis.DeviceName, store.Config.UpDown_Axis.GetAxisValue());
lblCountPulse2.Text = string.Format("{0:d}", lCountPulse2); lblCountPulse2.Text = string.Format("{0:d}", lCountPulse2);
txtInoutTarget.Text = store.Config.InOut_Axis.TargetPosition.ToString(); txtUpdownTarget.Text = store.Config.UpDown_Axis.TargetPosition.ToString();
if (deviceName.Equals(store.Config.UpDown_Axis.DeviceName)) if (deviceName.Equals(store.Config.UpDown_Axis.DeviceName))
{ {
lblOutPulse.Text = lblOutPulse2.Text; lblOutPulse.Text = lblOutPulse2.Text;
...@@ -350,13 +354,28 @@ namespace OnlineStore.AutoInOutStore ...@@ -350,13 +354,28 @@ namespace OnlineStore.AutoInOutStore
lblOutPulse3.Text = string.Format("{0:d}", lOutPulse3); lblOutPulse3.Text = string.Format("{0:d}", lOutPulse3);
int lCountPulse3 = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue()); int lCountPulse3 = ACServerManager.GetActualtPosition(store.Config.InOut_Axis.DeviceName, store.Config.InOut_Axis.GetAxisValue());
lblCountPulse3.Text = string.Format("{0:d}", lCountPulse3); lblCountPulse3.Text = string.Format("{0:d}", lCountPulse3);
txtUpdownTarget.Text = store.Config.UpDown_Axis.TargetPosition.ToString(); txtInoutTarget.Text = store.Config.InOut_Axis.TargetPosition.ToString();
if (deviceName.Equals(store.Config.InOut_Axis.DeviceName)) if (deviceName.Equals(store.Config.InOut_Axis.DeviceName))
{ {
lblOutPulse.Text = lblOutPulse3.Text; lblOutPulse.Text = lblOutPulse3.Text;
lblCountPulse.Text = lblCountPulse3.Text; lblCountPulse.Text = lblCountPulse3.Text;
} }
} }
if (ACServerManager.ServerOnStatus(store.Config.Batch_Axis.DeviceName, store.Config.Batch_Axis.GetAxisValue()))
{
axis_5_Alarm.IOValue = ACServerManager.GetAlarmStatus(store.Config.Batch_Axis.DeviceName, store.Config.Batch_Axis.GetAxisValue());
int lOutPulse5 = ACServerManager.GetTargetPosition(store.Config.Batch_Axis.DeviceName, store.Config.Batch_Axis.GetAxisValue());
lblOutPulse5.Text = string.Format("{0:d}", lOutPulse5);
int lCountPulse5 = ACServerManager.GetActualtPosition(store.Config.Batch_Axis.DeviceName, store.Config.Batch_Axis.GetAxisValue());
lblCountPulse5.Text = string.Format("{0:d}", lCountPulse5);
txtBatchTarget.Text = store.Config.Batch_Axis.TargetPosition.ToString();
if (deviceName.Equals(store.Config.Batch_Axis.DeviceName))
{
lblOutPulse.Text = lblOutPulse5.Text;
lblCountPulse.Text = lblCountPulse5.Text;
}
}
lblAxisStatus.Text = "最后一次更新时间:" + DateTime.Now.ToLongTimeString();
} }
private void Bt_ClearCounter_Click(object sender, EventArgs e) private void Bt_ClearCounter_Click(object sender, EventArgs e)
...@@ -1470,7 +1489,8 @@ namespace OnlineStore.AutoInOutStore ...@@ -1470,7 +1489,8 @@ namespace OnlineStore.AutoInOutStore
if (AutomaticBaiting.DoorIsClose()) if (AutomaticBaiting.DoorIsClose())
{ {
AutomaticBaiting.BatchDoorClose(false); AutomaticBaiting.BatchDoorClose(false);
AutomaticBaiting.Reset(); bool result = AutomaticBaiting.Reset();
} }
else else
{ {
...@@ -1478,5 +1498,31 @@ namespace OnlineStore.AutoInOutStore ...@@ -1478,5 +1498,31 @@ namespace OnlineStore.AutoInOutStore
} }
} }
private void button3_Click(object sender, EventArgs e)
{
ReadPosistion();
}
private void btnReadLimit1_Click(object sender, EventArgs e)
{
int value = ACServerManager.GetLimitPositiveSingle(GetPortName(), GetSlaveAddr());
this.txtLimit1.Text = value.ToString();
}
private void btnReadLimit2_Click(object sender, EventArgs e)
{
int value = ACServerManager.GetLimitNegativeSingle(GetPortName(), GetSlaveAddr());
this.txtLimit2.Text = value.ToString();
}
private void btnUpdateStatus_Click(object sender, EventArgs e)
{
btnGetAlarm_Click(null, null);
button1_Click_1(null, null);
button2_Click(null, null);
btnReadHomeSingle_Click(null, null);
btnReadLimit1_Click(null, null);
btnReadLimit2_Click(null, null);
}
} }
} }
...@@ -72,5 +72,9 @@ namespace OnlineStore.Common ...@@ -72,5 +72,9 @@ namespace OnlineStore.Common
/// 上料轴转换系数,plus/mm /// 上料轴转换系数,plus/mm
/// </summary> /// </summary>
public static string AxisChangeValue = "AxisChangeValue"; public static string AxisChangeValue = "AxisChangeValue";
/// <summary>
/// 是否是代码运行,不需要连接设备
/// </summary>
public static string CodeRun = "CodeRun";
} }
} }
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
<Compile Include="ShuoKe\ShuoKeControls.cs" /> <Compile Include="ShuoKe\ShuoKeControls.cs" />
<Compile Include="store\model\AxisAlarmInfo.cs" /> <Compile Include="store\model\AxisAlarmInfo.cs" />
<Compile Include="store\model\FixtureCodeInfo.cs" /> <Compile Include="store\model\FixtureCodeInfo.cs" />
<Compile Include="store\AC_DeviceBase.cs" />
<Compile Include="store\InOrOutStoreParam.cs"> <Compile Include="store\InOrOutStoreParam.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
......
using System;
using System.Collections;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Diagnostics;
using log4net;
using System.Reflection;
using OnlineStore.Common;
namespace OnlineStore.DeviceLibrary
{
public class AITcpClient
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// ------------------------------------------------------------------------
// Constants for access
private const byte fctReadCoil = 1;
private const byte fctReadDiscreteInputs = 2;
private const byte fctReadHoldingRegister = 3;
private const byte fctReadInputRegister = 4;
private const byte fctWriteSingleCoil = 5;
private const byte fctWriteSingleRegister = 6;
private const byte fctWriteMultipleCoils = 15;
private const byte fctWriteMultipleRegister = 16;
private const byte fctReadWriteMultipleRegister = 23;
/// <summary>Constant for exception illegal function.</summary>
public const byte excIllegalFunction = 1;
/// <summary>Constant for exception illegal data address.</summary>
public const byte excIllegalDataAdr = 2;
/// <summary>Constant for exception illegal data value.</summary>
public const byte excIllegalDataVal = 3;
/// <summary>Constant for exception slave device failure.</summary>
public const byte excSlaveDeviceFailure = 4;
/// <summary>Constant for exception acknowledge.</summary>
public const byte excAck = 5;
/// <summary>Constant for exception slave is busy/booting up.</summary>
public const byte excSlaveIsBusy = 6;
/// <summary>Constant for exception gate path unavailable.</summary>
public const byte excGatePathUnavailable = 10;
/// <summary>Constant for exception not connected.</summary>
public const byte excExceptionNotConnected = 253;
/// <summary>Constant for exception connection lost.</summary>
public const byte excExceptionConnectionLost = 254;
/// <summary>Constant for exception response timeout.</summary>
public const byte excExceptionTimeout = 255;
/// <summary>Constant for exception wrong offset.</summary>
private const byte excExceptionOffset = 128;
/// <summary>Constant for exception send failt.</summary>
private const byte excSendFailt = 100;
// ------------------------------------------------------------------------
// Private declarations
private static ushort _timeout = 500;
private static ushort _refresh = 10;
private static bool _connected = false;
private static bool _autoConnectOfBreak = false;
private Socket socketClient;
private int M281_A_Len = 0;
private byte[] tcpSocketReviceBuffer = new byte[2048];
//private Socket tcpSynCl;
//private byte[] tcpSynClBuffer = new byte[2048];
// ------------------------------------------------------------------------
/// <summary>Response data event. This event is called when new data arrives</summary>
public delegate void ResponseData(string ip, ushort id, byte function, byte[] data,byte[] reviceData);
/// <summary>Response data event. This event is called when new data arrives</summary>
public event ResponseData OnResponseData;
/// <summary>Exception data event. This event is called when the data is incorrect</summary>
public delegate void ExceptionData(string ip, ushort id, byte function, byte exception, byte[] reviceData);
/// <summary>Exception data event. This event is called when the data is incorrect</summary>
public event ExceptionData OnException;
/// <summary>
/// autoConnectOfBreak
/// </summary>
public bool autoConnectOfBreak
{
get { return _autoConnectOfBreak; }
set { _autoConnectOfBreak = value; }
}
public static ushort timeout
{
get { return _timeout; }
set { _timeout = value; }
}
public ushort refresh
{
get { return _refresh; }
set { _refresh = value; }
}
public bool connected
{
get { return _connected; }
}
public AITcpClient()
{
}
public string IP = "";
public int Port = 0;
public int TimeOutTime = 0;
public AITcpClient(string ip, ushort port)
{
TimeOutTime = 2000;
connect(ip, port);
}
private System.Timers.Timer reviceTimer = new System.Timers.Timer();
public void connect(string ip, ushort port)
{
try
{
this.IP = ip;
this.Port = port;
OnResponseData = null;
// Connect asynchronous client
socketClient = new Socket(IPAddress.Parse(ip).AddressFamily, SocketType.Stream, ProtocolType.Tcp);
if (TimeOutTime <= 0)
{
socketClient.Connect(new IPEndPoint(IPAddress.Parse(ip), port));
socketClient.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, _timeout);
socketClient.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, _timeout);
socketClient.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
}
else
{
socketClient.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, _timeout);
socketClient.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, _timeout);
socketClient.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
IAsyncResult connResult = socketClient.BeginConnect(ip, port, null, null);
connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒
if (!connResult.IsCompleted)
{
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!");
return;
}
else
{
_connected = true;
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " success!");
}
}
//Thread threadReceive = new Thread(new ThreadStart(ReceiveHandle));
//threadReceive.Start();
reviceTimer.AutoReset = true;
reviceTimer.Elapsed += reviceTimer_Elapsed;
reviceTimer.Interval = 130;
reviceTimer.Enabled = true;
_connected = true;
}
catch (Exception error)
{
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!");
_connected = false;
}
}
public void WriteAIScope(ushort id, byte slaveId, string address, int value)
{
//0x000100000006FF0603EA0001
byte function = 0x06;
byte[] data = new byte[12];
byte[] _id = BitConverter.GetBytes((short)id);
data[0] = _id[0]; // Slave id high byte
data[1] = _id[1]; // Slave id low byte
data[2] = 0x00;
data[3] = 0x00;
data[4] = 0x00;
data[5] = 6; // Message size
data[6] = slaveId; // Slave address //必须设置为"1": 2012.04-24 覃发光;
data[7] = function; ; // Function code
byte[] _adr = SerialBean.StringToByte(address);
data[8] = _adr[0]; // Start address
data[9] = _adr[1]; // Start address
byte[] _length = BitConverter.GetBytes((short)1);
data[10] = _length[0]; // Number of data to read
data[11] = _length[1]; // Number of data to read
WriteAsyncData( data,id);
}
public void ReadAllAI(ushort id, string startAddress, int length, byte slaveId)
{
//0x 000100000006FF0302580010
byte function = 0x03;
byte[] data = CreateData(id, startAddress,(ushort) length, function, slaveId);
WriteAsyncData(data, id);
}
private byte[] CreateData(ushort id, string startAddress, ushort length, byte function, byte SlaveID)
{
byte[] data = new byte[12];
byte[] _id = BitConverter.GetBytes((short)id);
data[0] = _id[0]; // Slave id high byte
data[1] = _id[1]; // Slave id low byte
data[5] = 6; // Message size
data[6] = SlaveID; // Slave address //必须设置为"1": 2012.04-24 覃发光;
data[7] = function; // Function code
byte[] _adr = SerialBean.StringToByte(startAddress);
if (_adr.Length .Equals( 2))
{
data[8] = _adr[0]; // Start address
data[9] = _adr[1]; // Start address
}else if (_adr.Length.Equals(1))
{
data[8] = 0x00;
data[9] = _adr[0]; // Start address
}
else
{
data[8] = 0x00;
data[9] = 0x00;
}
byte[] _length = BitConverter.GetBytes((short)IPAddress.HostToNetworkOrder((short)length));
data[10] = _length[0]; // Number of data to read
data[11] = _length[1]; // Number of data to read
return data;
}
void reviceTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
ReviceDataProcess();
Thread.Sleep(10);
}
catch (Exception ex)
{
LOGGER.Error("出错:" + ex.ToString());
}
}
private void ReviceDataProcess()
{
int lengthIndex = 5;
byte[] rdata = Receive();
if (rdata != null)
{
string str = "";
foreach (byte by in rdata)
{
str = str + " " + by;
//if (str.Length > 200)
//{
// break;
//}
}
//这里rdata就是接收到的数据,
IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint;
//ushort id = BitConverter.ToUInt16(rdata, 0);
//byte function = rdata[7];
byte dataLength = rdata[lengthIndex];
int allLength = lengthIndex + 1 + dataLength;
if (rdata.Length > allLength)
{
//LogUtil.info(clientipe.ToString() + "收到数据(需要分包):" + str);
int currStartIndex = 0;
for (int i = 0; i < 100; i++)
{
try
{
if (rdata.Length < currStartIndex + lengthIndex)
{
LogUtil.error(clientipe.ToString() + "收到数据:" + str + "分包出错 [" + currStartIndex + "]");
break;
}
else
{
dataLength = rdata[currStartIndex + lengthIndex];
allLength = lengthIndex + 1 + dataLength;
byte[] thisData = new byte[allLength];
Array.Copy(rdata, currStartIndex, thisData, 0, allLength);
ushort id = BitConverter.ToUInt16(thisData, 0);
byte function = thisData[7];
DataProcess(clientipe.ToString(), id, function, thisData);
//剩余的数据处理
if (rdata.Length <= currStartIndex + allLength)
{
break;
}
currStartIndex = currStartIndex + allLength;
}
}
catch (Exception ex)
{
LogUtil.error(clientipe.ToString() + "收到数据:" + str + "分包出错 [" + currStartIndex + "]:" + ex.ToString());
}
}
}
else
{
LogUtil.debug(LOGGER, clientipe.ToString() + "收到数据(无需分包):" + str);
ushort id = BitConverter.ToUInt16(rdata, 0);
byte function = rdata[7];
DataProcess(clientipe.ToString(),id,function,rdata);
}
}
}
private void DataProcess(string clientIp, ushort id, byte function, byte[] rdata)
{
byte[] data;
if ((function >= fctWriteSingleCoil) && (function != fctReadWriteMultipleRegister))
{
data = new byte[2];
Array.Copy(rdata, 10, data, 0, 2);
}
// ------------------------------------------------------------
// Read response data
else
{
data = new byte[rdata[8]];
Array.Copy(rdata, 9, data, 0, rdata[8]);
}
// ------------------------------------------------------------
// Response data is slave exception
if (function > excExceptionOffset)
{
function -= excExceptionOffset;
CallException(id, function, rdata[8], rdata);
}
// ------------------------------------------------------------
// Response data is regular data
else if (OnResponseData != null)
{ //收到的数据打印出来
OnResponseData(clientIp, id, function, data, rdata);
}
}
private byte[] Receive()
{
try
{
if (socketClient == null || !socketClient.Connected || socketClient.Available < 1)
{
return null;
}
int size = socketClient.Available;
byte[] rData = new byte[size];
socketClient.Receive(rData, size, SocketFlags.None);
return rData;
}
catch (SocketException e)
{
if (socketClient != null)
{
socketClient.Close();
socketClient = null;
}
return null;
}
}
public void disconnect()
{
Dispose();
}
~AITcpClient()
{
Dispose();
}
public void Dispose()
{
reviceTimer.Enabled = false;
if (socketClient != null)
{
if (socketClient.Connected)
{
try { socketClient.Shutdown(SocketShutdown.Both); }
catch { }
socketClient.Close();
}
socketClient = null;
}
}
internal void CallException(ushort id, byte function, byte exception, byte[] rdata)
{
reviceTimer.Enabled = false;
if ((socketClient == null))
{
return;
}
if (exception == excExceptionConnectionLost)
{
//tcpSynCl = null;
socketClient = null;
return;
}
if (OnException != null)
{
OnException(socketClient.RemoteEndPoint.AddressFamily.ToString(), id, function, exception, rdata);
}
}
public void WriteAsyncData(byte[] write_data, ushort id)
{
try
{
if (socketClient == null)
{
LOGGER.Error("发送数据时发现socketClient=null");
return;
}
IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint;
if ((socketClient != null) && (socketClient.Connected))
{
try
{
//发送的数据打印出来
string str = "";
foreach (byte by in write_data)
{
str = str + " " + by;
}
//LogUtil.info( clientipe.ToString()+"发送数据:" + str);
socketClient.BeginSend(write_data, 0, write_data.Length, SocketFlags.None, new AsyncCallback(OnSend), null);
//socketClient.BeginReceive(tcpSocketReviceBuffer, 0, tcpSocketReviceBuffer.Length, SocketFlags.None, new AsyncCallback(OnReceive), socketClient);
ReviceDataProcess();
}
catch (SystemException error)
{
CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer);
}
}
else CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer);
}
catch (Exception ex)
{
LOGGER.Error("出错:"+ex.ToString());
}
}
// ------------------------------------------------------------------------
// Write asynchronous data acknowledge
private void OnSend(System.IAsyncResult result)
{
if (result.IsCompleted == false) CallException(0xFFFF, 0xFF, excSendFailt, tcpSocketReviceBuffer);
}
internal bool ISConnection()
{
if (socketClient == null)
{
return false;
}
if (socketClient.Connected == false)
{
return false;
}
return true;
}
}
}
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
//using FuBaRobot.LoadCSVLibrary;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 康奈德IO控制模块
/// </summary>
public class KNDAIManager
{
public static ushort DefaultAILength = 8;
public static byte DefualtSlaveID = 255;
private static string AIStartAddress = "0258";
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, AITcpClient> mastMap = new Dictionary<string, AITcpClient>();
public static Dictionary<string, List<KNDAI>> AIValueMap = new Dictionary<string, List<KNDAI>>();
private static object AIMapLock = "";
public static System.Timers.Timer timer = null;
private static ushort port = 502;
public static bool IsNeedReadAI = true;
public static void ConnectionIP(string ioIp)
{
if (timer == null)
{
timer = new System.Timers.Timer();
timer.Interval = 100;
timer.AutoReset = true;
timer.Elapsed += timer_Elapsed;
timer.Enabled = true;
}
AITcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
{
MBmaster = mastMap[ioIp];
if (null != MBmaster)
{
MBmaster.disconnect();
MBmaster.Dispose();
MBmaster = null;
lock (AIMapLock)
{
if (AIValueMap.ContainsKey(ioIp))
{
AIValueMap.Remove(ioIp);
}
}
}
mastMap.Remove(ioIp);
}
try
{
// Create new modbus master and add event functions
MBmaster = new AITcpClient(ioIp, port);
MBmaster.OnResponseData += new AITcpClient.ResponseData(MBmaster_OnResponseData);
MBmaster.OnException += new AITcpClient.ExceptionData(MBmaster_OnException);
MBmaster.autoConnectOfBreak = false;
mastMap.Add(ioIp, MBmaster);
Thread.Sleep(10);
WriteAIScope(ioIp, 1);
Thread.Sleep(10);
ReadAll(ioIp);
LogUtil.info(LOGGER, "连接AI模块[" + ioIp + "]");
}
catch (Exception error)
{
LogUtil.error(LOGGER, "连接AI模块[" + ioIp + "]出错:" + error.ToString());
}
}
private static void ReadAll(string ioIp)
{
//读取所有的DO
ReadMultipleAI(ioIp, DefualtSlaveID, AIStartAddress, DefaultAILength);
}
/// <summary>
/// 判断Io模块是否连接
/// </summary>
public static bool IsConnection(string ip)
{
try
{
List<string> list = new List<string>(mastMap.Keys);
foreach (string io in list)
{
if (io.Equals(ip))
{
//判断是否连接,如果没有连接自动重连
AITcpClient clinet = mastMap[io];
if (clinet.ISConnection())
{
return true;
}
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦:" + ex.ToString());
}
return false;
}
private static DateTime PreCheckTime = DateTime.Now;
private static bool isProcess = false;
private static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (isProcess)
{
return;
}
try
{
isProcess = true;
TimeSpan span = DateTime.Now - PreCheckTime;
List<string> list = new List<string>(mastMap.Keys);
foreach (string io in list)
{
//判断是否连接,如果没有连接自动重连
AITcpClient clinet = mastMap[io];
if (span.TotalSeconds > 3)
{
if (clinet.ISConnection())
{
if (IsNeedReadAI)
{
ReadAll(clinet.IP);
}
}
else
{
LogUtil.error(LOGGER, "AI模块" + io + "当前没有连上,重连" + io);
ConnectionIP(io);
}
PreCheckTime = DateTime.Now;
}
else
{
if (clinet.ISConnection())
{
if (IsNeedReadAI)
{
ReadAll(clinet.IP);
}
}
}
}
PreCheckTime = DateTime.Now;
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦:" + ex.ToString());
}
Thread.Sleep(1);
isProcess = false;
}
private static void WriteAIScope(string ioIp,int value)
{
// 0 表示 0 - 10V, 1 表示 0 - 5V
WriteAIScope(ioIp, DefualtSlaveID, "03EA", value);
}
private static void WriteAIScope(string ioIp, byte slaveId, string Adress, int value)
{
// 写 AI 模块采样范围,可以往寄存器里面写入 0 或 1。 0 表示 0 - 10V, 1 表示 0 - 5V。默
//认 0,写 AI 模块采样范围为 0 - 5V
ushort ID = 1;
AITcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
{
MBmaster = mastMap[ioIp];
MBmaster.WriteAIScope(ID, slaveId, Adress, value);
}
else
{
LogUtil.error(LOGGER, "WriteAIScope出错没有连接AI模块:" + ioIp);
}
}
private static void ReadMultipleAI(string ioIp, byte slaveId, string StartAddress, int length)
{
ushort ID = 1;
AITcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp))
{
MBmaster = mastMap[ioIp];
MBmaster.ReadAllAI(ID, StartAddress, length * 2, slaveId);
}
else
{
LogUtil.error(LOGGER, "ReadMultipleAI出错没有连接AI模块:" + ioIp);
}
}
public static void CloseAllConnection()
{
List<AITcpClient> list = new List<AITcpClient>();
foreach (AITcpClient tcp in list)
{
tcp.disconnect();
}
mastMap.Clear();
}
public static double ConvertAI(double aiValue,double defaultValue )
{
double xishu =(double) ConfigAppSettings.GetNumValue(Setting_Init.AI_ConvertPosition);
double result= Math.Round((aiValue-defaultValue)/xishu,2);
return result;
}
public static double GetAIValue(string ioiP, int index)
{
double aiValue = GetAIValue(ioiP, DefualtSlaveID, index-1);
return Math.Round(aiValue,2);
}
public static double GetAIValue(string ioIP, byte slaveId, int index)
{
double value = 0;
try
{
lock (AIMapLock)
{
if (AIValueMap.ContainsKey(ioIP))
{
List<KNDAI> allIo = new List<KNDAI>(AIValueMap[ioIP]);
List<KNDAI> list = (from m in allIo where m.SlaveId.Equals(slaveId) && m.AIIndex.Equals(index) select m).ToList<KNDAI>();
if (list.Count > 0)
{
value = list[0].AIValue;
}
}
}
}
catch (Exception ex)
{
LogUtil.error("GetAIValue 出错了 :ioIP[" + ioIP + "]index[" + index + "]:" + ex);
}
return value;
}
private static void SaveAIData(string ioIp, ushort ID, byte[] values)
{
try
{
if (values.Length.Equals(DefaultAILength * 4))
{
List<KNDAI> kndList = new List<KNDAI>();
string strFromat = "{0:X2}";
for (int index = 0; index < DefaultAILength; index++)
{
string str1 = String.Format(strFromat, values[index * 4 + 2]) + String.Format(strFromat, values[index * 4 + 3])
+ String.Format(strFromat, values[index * 4 + 1]) + String.Format(strFromat, values[index * 4]);
double value = BitToFloat(str1);
KNDAI io = new KNDAI(ioIp, (byte)DefualtSlaveID, index, value);
if (value > 0)
{
Console.WriteLine(str1 + " float convert = {0}", value);
}
kndList.Add(io);
}
lock (AIMapLock)
{
if (AIValueMap.ContainsKey(ioIp))
{
AIValueMap.Remove(ioIp);
}
AIValueMap.Add(ioIp, kndList);
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SaveAIData出错:" + ex.ToString());
}
}
private static float BitToFloat(string hexString)
{
uint num = uint.Parse(hexString, System.Globalization.NumberStyles.AllowHexSpecifier);
byte[] floatVals = BitConverter.GetBytes(num);
float f = BitConverter.ToSingle(floatVals, 0);
return f;
}
private static void MBmaster_OnResponseData(string ioIp, ushort ID, byte function, byte[] values, byte[] reviceData)
{
try
{
if (ioIp.IndexOf(":") > 0)
{
ioIp = ioIp.Substring(0, ioIp.IndexOf(":"));
}
string strFromat = "{0:X2}";
string reviceMsg = "";
foreach (byte data in reviceData)
{
reviceMsg = reviceMsg + " " + String.Format(strFromat, data);
if (reviceMsg.Length > 200)
{
break;
}
}
LOGGER.Debug ("Read data:【" + reviceMsg + "】 ");
if (ID == 0xFF)
{
return;
}
// ------------------------------------------------------------------------
// Identify requested data
ushort Func = ID;
if (Func == 0 && reviceData.Length > 8)
{
Func = reviceData[7];
}
byte SlaveId = 0xFF;
if (reviceData.Length >= 7)
{
SlaveId = reviceData[6];
}
switch (function)
{
case 1:
//LOGGER.Info("Read coils end:【" + reviceMsg + "】 ");
break;
case 2:
//LOGGER.Info("Read discrete inputs end:【" + reviceMsg + "】 ");
//SaveAIData(ioIp, SlaveId, values);
break;
case 3:
SaveAIData(ioIp, ID, values);
break;
case 4:
//LOGGER.Info("读入(多个)寄存器完成 end:【" + reviceMsg + "】 ");
break;
case 5:
//LOGGER.Info("Write single coil:【" + reviceMsg + "】 ");
break;
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "处理接受数据出错:" + ex.ToString());
}
}
private static void MBmaster_OnException(string ioIp, ushort id, byte function, byte exception, byte[] reviceData)
{
string exc = "Modbus says error: ";
switch (exception)
{
case AITcpClient.excIllegalFunction: exc += "Illegal function!"; break;
case AITcpClient.excIllegalDataAdr: exc += "Illegal data adress!"; break;
case AITcpClient.excIllegalDataVal: exc += "Illegal data value!"; break;
case AITcpClient.excSlaveDeviceFailure: exc += "Slave device failure!"; break;
case AITcpClient.excAck: exc += "Acknoledge!"; break;
case AITcpClient.excSlaveIsBusy: exc += "Slave is busy!"; break;
case AITcpClient.excGatePathUnavailable: exc += "Gateway path unavailbale!"; break;
case AITcpClient.excExceptionTimeout: exc += "Slave timed out!"; break;
case AITcpClient.excExceptionConnectionLost: exc += "Connection is lost!"; break;
case AITcpClient.excExceptionNotConnected: exc += "Not connected!"; break;
default:
break;
}
LOGGER.Error("接收数据出错:" + exc);
}
}
public class KNDAI
{
public KNDAI(string ioIp, byte ID, int index, double value)
{
this.IoIP = ioIp;
this.SlaveId = ID;
this.AIIndex = index;
this.AIValue = value;
UpdateTime = DateTime.Now;
}
/// <summary>
/// AI模块IP
/// </summary>
public string IoIP { get; set; }
/// <summary>
/// 地址
/// </summary>
public byte SlaveId { get; set; }
/// <summary>
/// 第几个AI
/// </summary>
public int AIIndex { get; set; }
/// <summary>
/// 值
/// </summary>
public double AIValue { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}
...@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
public static void HomeMove(string portName, int slvAddr, int speed) public static void HomeMove(string portName, int slvAddr, int speed)
{ {
//默认负方向原点返回
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_HomeMove1, 2); //byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_HomeMove1, 2);
//SendData(portName, data); //SendData(portName, data);
//旋转轴回正方向,其他轴回负方向 //旋转轴回正方向,其他轴回负方向
...@@ -310,8 +310,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -310,8 +310,8 @@ namespace OnlineStore.DeviceLibrary
//} //}
//else //else
//{ //{
//默认负方向原点返回
UpdateBlock(portName, slvAddr, ACCMDManager.Block_HomeMove1); UpdateBlock(portName, slvAddr, ACCMDManager.Block_HomeMove1);
LogUtil.debug("回原点:反方向");
//} //}
Thread.Sleep(SleepMSendons); Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr); OpenAndCloseSTB(portName, slvAddr);
......
...@@ -495,7 +495,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -495,7 +495,9 @@ namespace OnlineStore.DeviceLibrary
byte[] reviceData = SendCommand(portName, dataArray, 100, 6); byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.Home_Single); return GetCoilData(portName, reviceData, ACCMDManager.Home_Single);
} }
/// <summary>
/// 负极限
/// </summary>
public static int GetLimitNegativeSingle(string portName, int slvAddr) public static int GetLimitNegativeSingle(string portName, int slvAddr)
{ {
PreReadCoilAddr = ACCMDManager.Home_Single; PreReadCoilAddr = ACCMDManager.Home_Single;
...@@ -503,7 +505,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -503,7 +505,9 @@ namespace OnlineStore.DeviceLibrary
byte[] reviceData = SendCommand(portName, dataArray, 100, 6); byte[] reviceData = SendCommand(portName, dataArray, 100, 6);
return GetCoilData(portName, reviceData, ACCMDManager.Home_Single); return GetCoilData(portName, reviceData, ACCMDManager.Home_Single);
} }
/// <summary>
/// 正极限
/// </summary>
public static int GetLimitPositiveSingle(string portName, int slvAddr) public static int GetLimitPositiveSingle(string portName, int slvAddr)
{ {
PreReadCoilAddr = ACCMDManager.Home_Single; PreReadCoilAddr = ACCMDManager.Home_Single;
......
...@@ -39,10 +39,10 @@ DI,左侧门关闭,DoorColse_Single,203,192.168.200.11,0,左侧门关闭,X20,DI-24,0, ...@@ -39,10 +39,10 @@ DI,左侧门关闭,DoorColse_Single,203,192.168.200.11,0,左侧门关闭,X20,DI-24,0,
,,,101,192.168.200.11,0,,Y18,DO-22,0, ,,,101,192.168.200.11,0,,Y18,DO-22,0,
,,,102,192.168.200.11,0,,Y19,DO-23,0, ,,,102,192.168.200.11,0,,Y19,DO-23,0,
,,,103,192.168.200.11,0,,Y20,DO-24,0, ,,,103,192.168.200.11,0,,Y20,DO-24,0,
AXIS,(轴一)旋转轴,Middle_Axis,1,COM4,0,,,,, AXIS,(轴一)旋转轴,Middle_Axis,1,COM4,0,,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM5,0,,,,, AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM5,0,,,,,
AXIS,(轴三)进出轴,InOut_Axis,1,COM6,0,,,,, AXIS,(轴三)进出轴,InOut_Axis,1,COM6,0,,,,,
AXIS,(轴五)批量上下料轴,Batch_Axis,1,COM7,0,,,,, AXIS,(轴五)批量上下料轴,Batch_Axis,1,COM7,0,,,,,
,,,,,,,,,, ,,,,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,403000,,,,,,, PRO,升降轴 进料口取料点 P1,UpDownAxis_DoorOPosition_P1,403000,,,,,,,
...@@ -50,94 +50,94 @@ PRO,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,415000,,,,,,, ...@@ -50,94 +50,94 @@ PRO,升降轴 进料口出料前点 P2,UpDownAxis_DoorIPosition_P2,415000,,,,,,,
PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,, PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,,
PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,403000,,,,,,, PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,403000,,,,,,,
PRO,升降轴 待机点P1集合,UpDownAxis_P1_List,8#20000;12#22000,,,,,,, PRO,升降轴 待机点P1集合,UpDownAxis_P1_List,8#20000;12#22000,,,,,,,
PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,268093,,,,,,, PRO,旋转轴(轴一)P1 待机原位点,MiddleAxis_P1_Position,268093,,,,,,,
PRO,进出轴(轴3)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,, PRO,进出轴(轴三)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-75000,,,,,,, PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-75000,,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,, PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,, PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,, ,, PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,, ,,
PRO,设备是否处于调试状态(1=调试,0=正常),IsInDebug,0,,,,,,, PRO,设备是否调试状态(1=调试,0=正常),IsInDebug,0,,,,,,,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,, PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,预警温度,WarnTemperate,80,,,,,,, PRO,预警温度,WarnTemperate,80,,,,,,,
PRO,预警湿度,WarnHumidity,80,,,,,,, PRO,预警湿度,WarnHumidity,80,,,,,,,
PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,2500,,,,,,, PRO,(轴一)旋转轴目标速度,MiddleAxis_TargetSpeed,2500,,,,,,,
PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,800,,,,,,, PRO,(轴一)旋转轴加速度,MiddleAxis_AddSpeed,800,,,,,,,
PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,800,,,,,,, PRO,(轴一)旋转轴减速度,MiddleAxis_DelSpeed,800,,,,,,,
PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,800,,,,,,, PRO,(轴一)旋转轴原点低速度,MiddleAxis_HomeLowSpeed,800,,,,,,,
PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,60,,,,,,, PRO,(轴一)旋转轴原点高速,MiddleAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,500,,,,,,, PRO,(轴一)旋转轴原点加速度,MiddleAxis_HomeAddSpeed,500,,,,,,,
PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,1500,,,,,,, PRO,(轴二)升降轴轴目标速度,UpdownAxis_TargetSpeed,1500,,,,,,,
PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,400,,,,,,, PRO,(轴二)升降轴轴加速度,UpdownAxis_AddSpeed,400,,,,,,,
PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,400,,,,,,, PRO,(轴二)升降轴轴减速度,UpdownAxis_DelSpeed,400,,,,,,,
PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,,,, PRO,(轴二)升降轴轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,,,,
PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,,, PRO,(轴二)升降轴轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,,,
PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,,, PRO,(轴二)升降轴轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,1000,,,,,,, PRO,(轴三)进出轴目标速度,InoutAxis_TargetSpeed,1000,,,,,,,
PRO,(轴三)进出轴加速度,InoutAxis_AddSpeed,300,,,,,,, PRO,(轴三)进出轴加速度,InoutAxis_AddSpeed,300,,,,,,,
PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,300,,,,,,, PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,300,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,20,,,,,,, PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,, PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,, PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,,
PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,2500,,,,,,, PRO,升降轴(轴二)P1速度,UpDownAxis_P1_Speed,2500,,,,,,,
PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,2500,,,,,,, PRO,升降轴(轴二)P2速度,UpDownAxis_P2_Speed,2500,,,,,,,
PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,2500,,,,,,, PRO,升降轴(轴二)P3速度,UpDownAxis_P3_Speed,2500,,,,,,,
PRO,升降轴(轴2)P4速度,UpDownAxis_P4_Speed,1500,,,,,,, PRO,升降轴(轴二)P4速度,UpDownAxis_P4_Speed,1500,,,,,,,
PRO,升降轴(轴2)P5速度,UpDownAxis_P5_Speed,2500,,,,,,, PRO,升降轴(轴二)P5速度,UpDownAxis_P5_Speed,2500,,,,,,,
PRO,升降轴(轴2)P6速度,UpDownAxis_P6_Speed,1000,,,,,,, PRO,升降轴(轴二)P6速度,UpDownAxis_P6_Speed,1000,,,,,,,
PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,1000,,,,,,, PRO,升降轴(轴二)P7速度,UpDownAxis_P7_Speed,1000,,,,,,,
PRO,升降轴(轴2)P8速度,UpDownAxis_P8_Speed,1000,,,,,,, PRO,升降轴(轴二)P8速度,UpDownAxis_P8_Speed,1000,,,,,,,
PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,1200,,,,,,, PRO,旋转轴(轴一)P1速度,MiddleAxis_P1_Speed,1200,,,,,,,
PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,1200,,,,,,, PRO,旋转轴(轴一)P2速度,MiddleAxis_P2_Speed,1200,,,,,,,
PRO,进出轴(轴3)P1速度,InOutAxis_P1_Speed,1000,,,,,,, PRO,进出轴(轴三)P1速度,InOutAxis_P1_Speed,1000,,,,,,,
PRO,进出轴(轴3)P2速度,InOutAxis_P2_Speed,1000,,,,,,, PRO,进出轴(轴三)P2速度,InOutAxis_P2_Speed,1000,,,,,,,
PRO,进出轴(轴3)P3速度,InOutAxis_P3_Speed,1000,,,,,,, PRO,进出轴(轴三)P3速度,InOutAxis_P3_Speed,1000,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最小值,MiddleAxis_ErrorCountMin,10,,,,,, , PRO,(轴一)旋转轴最小误差脉冲值,MiddleAxis_ErrorCountMin,10,,,,,, ,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最小值,UpdownAxis_ErrorCountMin,10,,,,,,, PRO,(轴二)升降轴轴最小误差脉冲值,UpdownAxis_ErrorCountMin,10,,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最小值,InoutAxis_ErrorCountMin,10,,,,,,, PRO,(轴三)进出轴最小误差脉冲值,InoutAxis_ErrorCountMin,10,,,,,,,
PRO,(轴一)旋转轴停止时可误差的脉冲数的最大值,MiddleAxis_ErrorCountMax,1000,,,,,,, PRO,(轴一)旋转轴最大误差脉冲值,MiddleAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴二)升降轴轴停止时可误差的脉冲数的最大值,UpdownAxis_ErrorCountMax,1000,,,,,,, PRO,(轴二)升降轴轴最大误差脉冲值,UpdownAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴三)进出轴停止时可误差的脉冲数的最大值,InoutAxis_ErrorCountMax,1000,,,,,,, PRO,(轴三)进出轴最大误差脉冲值,InoutAxis_ErrorCountMax,1000,,,,,,,
PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,, PRO,出入库多少次,会自动重置旋转轴,Box_ResetMCount,1000,,,,,,,
PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,, PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,, , PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,, ,
PRO,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,, PRO,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,
PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,, PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,
PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,, PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,,
PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,, PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,, PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,
PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,, PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,
PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,, PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
PRO,需要吹气的温度(温度标准),Max_Temperature,0,,,,,, , PRO,需要吹气的温度(温度标准),Max_Temperature,0,,,,,, ,
PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,, PRO,需要吹气的湿度(湿度标准),Max_Humidity,10,,,,,,,
PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,, PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,, PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM1,,,,,,, PRO,温湿度端口号,Humiture_Port,COM1,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM3,,,,,,, PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM3,,,,,,,
PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,, PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,,
PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,, PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,,
PRO,硕科步进电机(压紧轴)控制停止位,CompressAxis_StopBits,1,,,,,,, PRO,硕科步进电机(压紧轴)控制停止位,CompressAxis_StopBits,1,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,15000,,,,,,, PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,50000,,,,,,, PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,50000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,30000,,,,,,, PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,30000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,15000,,,,,,, PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,15000,,,,,,, PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,15000,,,,,,,
PRO,硕科步进电机(压紧轴)控制归零速度(原点返回速度),CompressAxis_HomeSpeed,15000,,,,,,, PRO,硕科步进电机(压紧轴)原点返回速度,CompressAxis_HomeSpeed,15000,,,,,,,
PRO,硕科步进电机轴地址压紧轴),CompressAxis_Slv,1,,,,,, , PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,, ,
,,,,,,,,,, ,,,,,,,,,,
PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,50,,,,,,, PRO,(轴五)上料轴目标速度,BatchAxis_TargetSpeed,50,,,,,,,
PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,300,,,,,,, PRO,(轴五)上料轴加速度,BatchAxis_AddSpeed,300,,,,,,,
PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,300,,,,,,, PRO,(轴五)上料轴减速度,BatchAxis_DelSpeed,300,,,,,,,
PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,, PRO,(轴五)上料轴原点低速,BatchAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,, PRO,(轴五)上料轴原点高速,BatchAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,,, PRO,(轴五)上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,,,
PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,200,,,,,, , PRO,(轴五)上料轴P1点(出库时接料盘的位置),BatchAxis_P1,200,,,,,, ,
PRO,(轴五)上料轴停止时可误差的脉冲数的最小值,BatchAxis_ErrorCountMin,10,,,,,,, PRO,(轴五)上料轴最小误差脉冲值,BatchAxis_ErrorCountMin,10,,,,,,,
PRO,(轴五)上料轴停止时可误差的脉冲数的最大值,BatchAxis_ErrorCountMax,1000,,,,,,, PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,,
PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,, PRO,(轴五)上料轴最小限位,BatchAxis_PositionMin,0,,,,,,,
PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,, PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,50,,,,,,, PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,50,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.10#16;192.168.200.11#4,,,,,, , PRO,IO模块对应的DI数量,IO_DILength,192.168.200.10#16;192.168.200.11#4,,,,,, ,
......
...@@ -17,17 +17,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -17,17 +17,14 @@ namespace OnlineStore.DeviceLibrary
public partial class AC_SA_BoxBean : AC_Store public partial class AC_SA_BoxBean : AC_Store
{ {
private static bool IsIntSlvBlock = false; private static bool IsIntSlvBlock = false;
/// <summary>
/// 开始运行
/// </summary>
public static bool IsRun = false;
public string CID = ""; public string CID = "";
public AUTO_SA_Config Config; public AUTO_SA_Config Config;
/// <summary> /// <summary>
/// 记录最后一次 出库的posID,出库完成发送给服务器之后清除 /// 记录最后一次 出库的posID,出库完成发送给服务器之后清除
/// </summary> /// </summary>
public string lastPosId = ""; private string lastPosId = "";
public StoreStatus lastPosIdStatus = StoreStatus.StoreOnline; private StoreStatus lastPosIdStatus = StoreStatus.StoreOnline;
/// <summary> /// <summary>
/// 轴列表 /// 轴列表
/// </summary> /// </summary>
...@@ -35,38 +32,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -35,38 +32,22 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 轴报警信息 /// 轴报警信息
/// </summary> /// </summary>
private Dictionary<string , AxisAlarmInfo> AxisAlarmCodeMap = new Dictionary<string , AxisAlarmInfo>(); private Dictionary<string, AxisAlarmInfo> AxisAlarmCodeMap = new Dictionary<string, AxisAlarmInfo>();
/// <summary> private bool IsHasCompress_Axis = true;
/// 是否有压紧轴
/// </summary>
public bool IsHasCompress_Axis = true;
//public ScanSocket scanSocket = new ScanSocket();
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
public AC_SA_BoxBean(AUTO_SA_Config config) public AC_SA_BoxBean(AUTO_SA_Config config)
{ {
StoreName = ("料仓BOX_" + config.Id + " ").ToUpper(); StoreName = ("料仓BOX_" + config.Id + " ").ToUpper();
this.StoreID = config.Id; this.StoreID = config.Id;
this.Config = config; this.Config = config;
this.DIList = config.StoreDIList;
this.DOList = config.StoreDOList;
Init(); Init();
serverConnectTimer = new System.Timers.Timer();
serverConnectTimer.Interval = 1000;
serverConnectTimer.AutoReset = true;
serverConnectTimer.Enabled = false;
serverConnectTimer.Elapsed += server_connect_timer_Tick; serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 200;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed; IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
//添加调试
if (config.IsInDebug == 1)
{ IsDebug = (config.IsInDebug == 1);
IsDebug = true;
}
IsHasCompress_Axis = config.IsHasCompress_Axis.Equals(1); IsHasCompress_Axis = config.IsHasCompress_Axis.Equals(1);
Max_Humidity = config.Max_Humidity; Max_Humidity = config.Max_Humidity;
...@@ -77,36 +58,34 @@ namespace OnlineStore.DeviceLibrary ...@@ -77,36 +58,34 @@ namespace OnlineStore.DeviceLibrary
PositionNumList = new List<string>(); PositionNumList = new List<string>();
foreach (AutoStorePosition position in positionList) foreach (AutoStorePosition position in positionList)
{ {
if (position.StoreId.Equals(StoreID)) if (position.StoreId.Equals(StoreID) && AutoStorePosition.CheckPosition(position, Config))
{
bool result = AutoStorePosition.CheckPosition(position, Config);
if (result)
{ {
PositionNumList.Add(position.PositionNum); PositionNumList.Add(position.PositionNum);
} }
} }
}
//初始化摄像机配置 //初始化摄像机配置
string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName); string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName);
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType); string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
CodeManager.LoadConfig(nameStr,codeStr); CodeManager.LoadConfig(nameStr, codeStr);
AutomaticBaiting.Init();
//初始化 //连接设备 //初始化 //连接设备
if (ConfigAppSettings.GetIntValue(Setting_Init.CodeRun).Equals(1)) { }
else
{
KNDManager.ConnectionKND(Config.DIODeviceNameList); KNDManager.ConnectionKND(Config.DIODeviceNameList);
mainTimer.Enabled = false;
int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun); int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun);
if (isAuto == 1) mainTimer.Enabled = (isAuto == 1);
Task.Factory.StartNew(delegate
{ {
mainTimer.Enabled = true;
}
Thread.Sleep(300); Thread.Sleep(300);
//默认三个灯都亮 //默认三个灯都亮
KND.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW); KND.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
KND.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW); KND.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
KND.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW); KND.IOMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
});
}
} }
private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
...@@ -138,14 +117,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -138,14 +117,14 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public void MoveAxisConfig() public void MoveAxisConfig()
{ {
AUTO_SA_Config.ConfigAxis( Config); AUTO_SA_Config.ConfigAxis(Config);
moveAxisList = new List<ConfigMoveAxis>(); moveAxisList = new List<ConfigMoveAxis>();
moveAxisList.Add(Config.Middle_Axis); moveAxisList.Add(Config.Middle_Axis);
moveAxisList.Add(Config.UpDown_Axis); moveAxisList.Add(Config.UpDown_Axis);
moveAxisList.Add(Config.InOut_Axis); moveAxisList.Add(Config.InOut_Axis);
moveAxisList.Add(Config.Batch_Axis); moveAxisList.Add(Config.Batch_Axis);
this.AxisAlarmCodeMap = new Dictionary<string , AxisAlarmInfo>(); this.AxisAlarmCodeMap = new Dictionary<string, AxisAlarmInfo>();
this.AxisAlarmCodeMap.Add(Config.UpDown_Axis.DeviceName, new AxisAlarmInfo()); this.AxisAlarmCodeMap.Add(Config.UpDown_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(Config.InOut_Axis.DeviceName, new AxisAlarmInfo()); this.AxisAlarmCodeMap.Add(Config.InOut_Axis.DeviceName, new AxisAlarmInfo());
this.AxisAlarmCodeMap.Add(this.Config.Middle_Axis.DeviceName, new AxisAlarmInfo()); this.AxisAlarmCodeMap.Add(this.Config.Middle_Axis.DeviceName, new AxisAlarmInfo());
...@@ -168,6 +147,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -168,6 +147,12 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
} }
string canStart = AutomaticBaiting.CanStart();
if (!canStart.Equals(""))
{
LogUtil.info(StoreName + canStart);
return false;
}
autoNext = false; autoNext = false;
mainTimer.Enabled = false; mainTimer.Enabled = false;
alarmType = StoreAlarmType.None; alarmType = StoreAlarmType.None;
...@@ -186,6 +171,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -186,6 +171,7 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
AutomaticBaiting.Reset();
//TODO 启动时先所有轴远点返回,测试暂时关闭 //TODO 启动时先所有轴远点返回,测试暂时关闭
storeRunStatus = StoreRunStatus.HomeMoving; storeRunStatus = StoreRunStatus.HomeMoving;
HumitureController.Init(Config.Humiture_Port); HumitureController.Init(Config.Humiture_Port);
...@@ -193,7 +179,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -193,7 +179,6 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = true; mainTimer.Enabled = true;
IoCheckTimer.Enabled = true; IoCheckTimer.Enabled = true;
serverConnectTimer.Enabled = true; serverConnectTimer.Enabled = true;
IsRun = true;
return true; return true;
} }
else else
...@@ -237,7 +222,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -237,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NewMove(StoreMoveType.StoreReset); StoreMove.NewMove(StoreMoveType.StoreReset);
StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_InOutToP1); StoreMove.NextMoveStep(StoreMoveStep.BOX_M_H_TOP1_InOutToP1);
LogUtil.info(LOGGER, StoreName + "到待机状态,进出轴到P1,判断叉子没有料盘"); LogUtil.info(LOGGER, StoreName + "到待机状态,进出轴到P1,判断叉子没有料盘");
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed ); ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1_Position, Config.InOutAxis_P1_Speed);
//判断叉子没有料盘 //判断叉子没有料盘
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW)); //StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.TrayCheck_Fixture, IO_VALUE.LOW));
} }
...@@ -272,7 +257,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -272,7 +257,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NewMove(StoreMoveType.StoreReset); StoreMove.NewMove(StoreMoveType.StoreReset);
WarnMsg = ""; WarnMsg = "";
if (!RunAxis(true )) if (!RunAxis(true))
{ {
LogUtil.info(LOGGER, StoreName + "复位时打开轴失败,需要再次复位,直接报警停止复位"); LogUtil.info(LOGGER, StoreName + "复位时打开轴失败,需要再次复位,直接报警停止复位");
return; return;
...@@ -290,6 +275,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -290,6 +275,7 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_LocationCylinderBack);
LocationDownAndWait(); LocationDownAndWait();
} }
AutomaticBaiting.Reset();
isInPro = false; isInPro = false;
} }
private void InoutStartReset() private void InoutStartReset()
...@@ -420,7 +406,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -420,7 +406,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
{ {
LogUtil.debug("压紧轴绝对运动目标位置:"+targetPosition); LogUtil.debug("压紧轴绝对运动目标位置:" + targetPosition);
StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, targetPosition, false)); StoreMove.WaitList.Add(WaitResultInfo.WaitShuoKe(Config.CompressAxis_Slv, targetPosition, false));
ShuoKeControls.AbsMove(Config.CompressAxis_Slv, targetPosition); ShuoKeControls.AbsMove(Config.CompressAxis_Slv, targetPosition);
Thread.Sleep(100); Thread.Sleep(100);
...@@ -604,7 +590,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -604,7 +590,7 @@ namespace OnlineStore.DeviceLibrary
public void CloseAllAxis() public void CloseAllAxis()
{ {
LogUtil.info(StoreName+"关闭刹车,关闭伺服"); LogUtil.info(StoreName + "关闭刹车,关闭伺服");
KND.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); KND.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
foreach (ConfigMoveAxis axis in moveAxisList) foreach (ConfigMoveAxis axis in moveAxisList)
{ {
...@@ -631,7 +617,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -631,7 +617,8 @@ namespace OnlineStore.DeviceLibrary
else if (axisType == 3) else if (axisType == 3)
{ {
alarmCode = LineAlarm.InOutAxisAlarm; alarmCode = LineAlarm.InOutAxisAlarm;
}else if (axisType == 4) }
else if (axisType == 4)
{ {
alarmCode = LineAlarm.AutoAxisAlarm; alarmCode = LineAlarm.AutoAxisAlarm;
} }
...@@ -656,8 +643,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -656,8 +643,6 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Wait; storeRunStatus = StoreRunStatus.Wait;
mainTimer.Enabled = false; mainTimer.Enabled = false;
IsRun = false;
KNDManager.CloseAllDO(); KNDManager.CloseAllDO();
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
{ {
...@@ -684,7 +669,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -684,7 +669,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"); LogUtil.error(LOGGER, StoreName + "轴报警,关闭刹车,停止运动,关闭轴,打开报警灯");
KND.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); KND.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StopMove(true ); StopMove(true);
} }
else if (alarmType == StoreAlarmType.SuddenStop) else if (alarmType == StoreAlarmType.SuddenStop)
{ {
...@@ -701,7 +686,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -701,7 +686,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 "); LogUtil.error(LOGGER, StoreName + " 未检测到气压信号 ,打开刹车,停止运动,关闭轴,打开报警灯 ");
KND.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); KND.IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StoreMove.EndMove(); StoreMove.EndMove();
StopMove(true ); StopMove(true);
storeStatus = StoreStatus.SuddenStop; storeStatus = StoreStatus.SuddenStop;
} }
} }
...@@ -734,7 +719,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -734,7 +719,7 @@ namespace OnlineStore.DeviceLibrary
TimerProcess(); TimerProcess();
ShowTimeLog("TimerProcess"); ShowTimeLog("TimerProcess");
//检查运动轴报警 //检查运动轴报警
if (storeRunStatus > StoreRunStatus.Wait && (!isInSuddenDown)&&(!isNoAirCheck)) if (storeRunStatus > StoreRunStatus.Wait && (!isInSuddenDown) && (!isNoAirCheck))
{ {
ShowTimeLog("开始检测轴报警"); ShowTimeLog("开始检测轴报警");
CheckAxisAlarm(); CheckAxisAlarm();
...@@ -837,14 +822,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -837,14 +822,14 @@ namespace OnlineStore.DeviceLibrary
} }
private IO_VALUE lastAutoRun = IO_VALUE.LOW; private IO_VALUE lastAutoRun = IO_VALUE.LOW;
private IO_VALUE lastAirValue = IO_VALUE.LOW; private IO_VALUE lastAirValue = IO_VALUE.LOW;
public void IoCheckProcess() private void IoCheckProcess()
{ {
DateTime time = DateTime.Now; DateTime time = DateTime.Now;
if (storeRunStatus.Equals(StoreRunStatus.Wait)) if (storeRunStatus.Equals(StoreRunStatus.Wait))
{ {
//取新的Io状态 //取新的Io状态
IO_VALUE autoSingle = KND.IOValue(IO_Type.AutoRun_Single); IO_VALUE autoSingle = KND.IOValue(IO_Type.AutoRun_Single);
if (ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun) .Equals( 1)) if (ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun).Equals(1))
{ {
if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW)) if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW))
{ {
...@@ -921,7 +906,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -921,7 +906,7 @@ namespace OnlineStore.DeviceLibrary
//} //}
} }
private object safetyInProcess=""; private object safetyInProcess = "";
/// <summary> /// <summary>
/// 光栅处理 /// 光栅处理
/// </summary> /// </summary>
...@@ -977,7 +962,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -977,7 +962,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
public void TimerProcess() private void TimerProcess()
{ {
try try
{ {
...@@ -1137,7 +1122,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1137,7 +1122,7 @@ namespace OnlineStore.DeviceLibrary
if (currInOutFixture.WareNum.Equals("")) if (currInOutFixture.WareNum.Equals(""))
{ {
LogUtil.info(LOGGER, StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】"); LogUtil.info(LOGGER, StoreName + "开始执行排队中的出库【" + currInOutFixture.ToStr() + "】");
bool result = StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW),true); bool result = StartOutStoreMove(new InOutStoreParam("", currInOutFixture.PosId, currInOutFixture.plateH, currInOutFixture.plateW), true);
if (!result) if (!result)
{ {
LogUtil.info(LOGGER, StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列"); LogUtil.info(LOGGER, StoreName + " 执行排队中的出库【" + currInOutFixture.ToStr() + "】失败,重新加入等待队列");
...@@ -1229,7 +1214,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1229,7 +1214,7 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
if (Config.IsHasLocationCylinder>=1) if (Config.IsHasLocationCylinder >= 1)
{ {
//定位气缸停止 //定位气缸停止
KND.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW); KND.IOMove(IO_Type.LocationCylinder_Down, IO_VALUE.LOW);
...@@ -1243,6 +1228,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1243,6 +1228,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "StopMove"); LogUtil.info(LOGGER, StoreName + "StopMove");
KND.IOMove(IO_Type.Door_Down, IO_VALUE.LOW); KND.IOMove(IO_Type.Door_Down, IO_VALUE.LOW);
KND.IOMove(IO_Type.Door_Up, IO_VALUE.LOW); KND.IOMove(IO_Type.Door_Up, IO_VALUE.LOW);
AutomaticBaiting.StopMove();
//HDevelopExport.CloseAllCamera(); //HDevelopExport.CloseAllCamera();
isInPro = false; isInPro = false;
} }
...@@ -1266,8 +1252,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -1266,8 +1252,6 @@ namespace OnlineStore.DeviceLibrary
#region datalogic扫码枪代码 #region datalogic扫码枪代码
private bool isWaitScan = false;
private DateTime StartWaitScanTime = DateTime.Now;
private bool IsNotScanCode = false; private bool IsNotScanCode = false;
private bool IsScanCode = false; private bool IsScanCode = false;
/// <summary> /// <summary>
...@@ -1351,7 +1335,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1351,7 +1335,7 @@ namespace OnlineStore.DeviceLibrary
IsScanCode = false; IsScanCode = false;
InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW, 0); InOutStoreParam param = new InOutStoreParam(message, posId, plateH, plateW, 0);
StartInStoreMove(param,true); StartInStoreMove(param, true);
//如果当前正在出入库中,需要记录下来,等待空闲时执行 //如果当前正在出入库中,需要记录下来,等待空闲时执行
LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!"); LogUtil.info(LOGGER, StoreName + " 收到服务器入库命令:库位号【" + posId + "】二维码【" + message + "】 开始入库!");
} }
...@@ -1409,7 +1393,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1409,7 +1393,7 @@ namespace OnlineStore.DeviceLibrary
{ {
humidity = param.Humidity; humidity = param.Humidity;
temp = param.Temperate; temp = param.Temperate;
currTempStr=("当前湿度:" + humidity.ToString()+",当前温度:"+temp); currTempStr = ("当前湿度:" + humidity.ToString() + ",当前温度:" + temp);
} }
//double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList()); //double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
double currMaxHumidity = param.Humidity; double currMaxHumidity = param.Humidity;
...@@ -1498,7 +1482,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1498,7 +1482,7 @@ namespace OnlineStore.DeviceLibrary
private string CodeMsg = ""; private string CodeMsg = "";
private bool isInProcess = false; private bool isInProcess = false;
public void server_connect_timer_Tick(object sender, EventArgs e) private void server_connect_timer_Tick(object sender, EventArgs e)
{ {
if (isInProcess) if (isInProcess)
{ {
...@@ -1527,7 +1511,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1527,7 +1511,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 获取整个料仓的状态 /// 获取整个料仓的状态
/// </summary> /// </summary>
public Operation getLineBoxStatus() private Operation getLineBoxStatus()
{ {
//构建发送给服务器的对象 //构建发送给服务器的对象
Operation lineOperation = new Operation(); Operation lineOperation = new Operation();
...@@ -1541,10 +1525,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1541,10 +1525,7 @@ namespace OnlineStore.DeviceLibrary
lineOperation.status = (int)StoreStatus.Warning; lineOperation.status = (int)StoreStatus.Warning;
lineOperation.msg = WarnMsg; lineOperation.msg = WarnMsg;
} }
else if (IsRun)
{
lineOperation.status = (int)StoreStatus.StoreOnline;
}
lineOperation.status = (int)StoreStatus.StoreOnline; lineOperation.status = (int)StoreStatus.StoreOnline;
BoxStatus boxStatus = new BoxStatus(); BoxStatus boxStatus = new BoxStatus();
...@@ -1588,8 +1569,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -1588,8 +1569,6 @@ namespace OnlineStore.DeviceLibrary
lastPosId = ""; lastPosId = "";
} }
//温湿度
//ASTemperateParam param = HumitureServer.GetTemperateParam(Config.Temperate_Serveraddress);
ASTemperateParam param = HumitureController.LastData; ASTemperateParam param = HumitureController.LastData;
if (param != null) if (param != null)
{ {
...@@ -1605,7 +1584,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1605,7 +1584,7 @@ namespace OnlineStore.DeviceLibrary
return lineOperation; return lineOperation;
} }
public void SendLineStatus() private void SendLineStatus()
{ {
DateTime time = DateTime.Now; DateTime time = DateTime.Now;
//构建发送给服务器的对象 //构建发送给服务器的对象
...@@ -1661,7 +1640,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1661,7 +1640,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (CanStarInOut()) if (CanStarInOut())
{ {
StartOutStoreMove(new InOutStoreParam("", posId, position),true); StartOutStoreMove(new InOutStoreParam("", posId, position), true);
} }
else else
{ {
......
...@@ -29,12 +29,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -29,12 +29,9 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 出入库参数 #region 出入库参数
/// <summary>
/// 当前出入库的次数,超过配置的数量时,需要自动重置一下,再进行出入库
/// </summary>
private int CurrInOutCount = 0; private int CurrInOutCount = 0;
private int CurrInOutACount = 0; private int CurrInOutACount = 0;
private bool LoadParamPosition(InOutStoreParam param, bool IsBatch) private bool LoadParamPosition(InOutStoreParam param, bool IsBatch)
{ {
if (param == null) if (param == null)
...@@ -94,6 +91,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,6 +91,7 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 出入库结果验证 #region 出入库结果验证
private void InOutBackToP1(int InOut_P1) private void InOutBackToP1(int InOut_P1)
{ {
//判断是否在P1,如果是,不需要运行 //判断是否在P1,如果是,不需要运行
...@@ -271,7 +269,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -271,7 +269,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,叉子料盘检测有料"); LogUtil.error(LOGGER, StoreName + logMsg + " 出错,叉子料盘检测有料");
return false ; return false ;
} }
LogUtil.info(LOGGER, StoreName + logMsg , storeMoveColor); LogUtil.info(LOGGER, StoreName + logMsg );
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute; storeStatus = StoreStatus.InStoreExecute;
StoreMove.NewMove(StoreMoveType.InStore, param); StoreMove.NewMove(StoreMoveType.InStore, param);
...@@ -462,7 +460,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -462,7 +460,7 @@ namespace OnlineStore.DeviceLibrary
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!", storeMoveColor); LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态 //设备连接,入库后,BOX恢复原始状态
...@@ -521,7 +519,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -521,7 +519,7 @@ namespace OnlineStore.DeviceLibrary
} }
storeStatus = StoreStatus.OutStoreExecute; storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + logMsg, storeMoveColor); LogUtil.info(LOGGER, StoreName + logMsg);
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
StoreMove.NewMove(StoreMoveType.OutStore, param); StoreMove.NewMove(StoreMoveType.OutStore, param);
StoreMove.IsBatchInOutStore = IsBatchWork; StoreMove.IsBatchInOutStore = IsBatchWork;
...@@ -683,7 +681,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -683,7 +681,7 @@ namespace OnlineStore.DeviceLibrary
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!", storeMoveColor); LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore); InOutEndProcess(StoreMoveType.OutStore);
...@@ -701,7 +699,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -701,7 +699,7 @@ namespace OnlineStore.DeviceLibrary
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!", storeMoveColor); LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 整个出库流程结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore); InOutEndProcess(StoreMoveType.OutStore);
...@@ -808,10 +806,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -808,10 +806,10 @@ namespace OnlineStore.DeviceLibrary
} }
} }
#endregion #endregion
public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>(); public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>();
public object waitOutListLock = ""; public object waitOutListLock = "";
public void AddWaitOutInfo(FixtureCodeInfo code) public void AddWaitOutInfo(FixtureCodeInfo code)
{ {
lock (waitOutListLock) lock (waitOutListLock)
...@@ -819,6 +817,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -819,6 +817,8 @@ namespace OnlineStore.DeviceLibrary
waitOutStoreList.Add(code); waitOutStoreList.Add(code);
} }
} }
#region 自动出入库循环代码
private void InOutEndProcess(StoreMoveType storeMoveType) private void InOutEndProcess(StoreMoveType storeMoveType)
{ {
try try
...@@ -867,7 +867,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -867,7 +867,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid); LogUtil.info(LOGGER, StoreName + "自动进入下一个出库:posid=" + posid);
autoMsg = "自动出库:" + posid; autoMsg = "自动出库:" + posid;
StartOutStoreMove(new InOutStoreParam("", posid),false); StartOutStoreMove(new InOutStoreParam("", posid), false);
} }
} }
} }
...@@ -902,7 +902,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -902,7 +902,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid); LogUtil.info(LOGGER, StoreName + "自动进入下一个入库:posid=" + posid);
autoMsg = "自动入库:" + posid; autoMsg = "自动入库:" + posid;
StartInStoreMove(new InOutStoreParam("AAAA", posid),false); StartInStoreMove(new InOutStoreParam("AAAA", posid), false);
} }
} }
} }
...@@ -912,18 +912,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -912,18 +912,19 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, ex.ToString()); LogUtil.error(LOGGER, ex.ToString());
} }
} }
#endregion
private void InStoreLog(string msg) private void InStoreLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string isBatchMsg = StoreMove.IsBatchInOutStore ? "批量" : ""; string isBatchMsg = StoreMove.IsBatchInOutStore ? "批量" : "";
LogUtil.info(LOGGER, isBatchMsg+"【" + posId + "】" + msg, storeMoveColor); LogUtil.info(LOGGER, isBatchMsg+"【" + posId + "】" + msg);
} }
private void OutStoreLog(string msg) private void OutStoreLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
string isBatchMsg = StoreMove.IsBatchInOutStore ? "批量" : ""; string isBatchMsg = StoreMove.IsBatchInOutStore ? "批量" : "";
LogUtil.info(LOGGER, isBatchMsg+ "【" + posId + "】" + msg, storeMoveColor); LogUtil.info(LOGGER, isBatchMsg+ "【" + posId + "】" + msg);
} }
} }
} }
...@@ -16,6 +16,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,6 +16,7 @@ namespace OnlineStore.DeviceLibrary
public static int LastHeight = 0; public static int LastHeight = 0;
public static int LastSize = 0; public static int LastSize = 0;
public static string LastCode = ""; public static string LastCode = "";
public static string LastPosId = "";
public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue); public static int AxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.AxisChangeValue);
public static string WarnMsg = ""; public static string WarnMsg = "";
public static string Name = "自动上下料"; public static string Name = "自动上下料";
...@@ -78,9 +79,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -78,9 +79,20 @@ namespace OnlineStore.DeviceLibrary
BatchOutStoreCount = 0; BatchOutStoreCount = 0;
BatchOutStoreHeight = 0; BatchOutStoreHeight = 0;
LastCode = ""; LastCode = "";
LastPosId = "";
LastHeight = 0; LastHeight = 0;
LastSize = 0; LastSize = 0;
} }
public static void StopMove()
{
StoreMove.EndMove();
ClearInOutInfo();
KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.LOW);
CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down,false);
BatchDoorClose(false);
}
public static bool Reset() public static bool Reset()
{ {
string msg = CanStart(); string msg = CanStart();
...@@ -101,6 +113,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -101,6 +113,7 @@ namespace OnlineStore.DeviceLibrary
return true; return true;
} }
private static void ResetProcess() private static void ResetProcess()
{ {
...@@ -150,14 +163,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -150,14 +163,20 @@ namespace OnlineStore.DeviceLibrary
default: break; default: break;
} }
} }
public static bool StartInOut() public static bool StartInOut()
{ {
if((!StoreManager.Store.storeRunStatus.Equals(StoreRunStatus.Runing))||
(!StoreManager.Store.StoreMove.MoveType.Equals(StoreMoveType.None)))
{
LogUtil.error(Name + " 启动入料失败,料仓不在待机状态" + StoreManager.Store.storeRunStatus + ",MoveType" + StoreManager.Store.StoreMove.MoveType);
return false;
}
if (AutoBaitingStatus == StoreRunStatus.Runing && StoreMove.MoveType.Equals(StoreMoveType.None)) if (AutoBaitingStatus == StoreRunStatus.Runing && StoreMove.MoveType.Equals(StoreMoveType.None))
{ {
AutoBaitingStatus = StoreRunStatus.Busy; AutoBaitingStatus = StoreRunStatus.Busy;
StoreMove.NewMove(StoreMoveType.InStore); StoreMove.NewMove(StoreMoveType.InStore);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I01_MoveToUp); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I00_MoveToUp);
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH)) if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{ {
LogUtil.error(Name + " 启动入料 ,已检测到料盘,轴不需要上升"); LogUtil.error(Name + " 启动入料 ,已检测到料盘,轴不需要上升");
...@@ -171,10 +190,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -171,10 +190,11 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
LogUtil.error(Name + " 启动入料失败,AutoBaitingStatus=" + AutoBaitingStatus+ ",MoveType="+ StoreMove.MoveType); LogUtil.error(Name + " 启动入料失败, Status=" + AutoBaitingStatus+ ",MoveType="+ StoreMove.MoveType);
return false; return false;
} }
} }
private static int SuckingDisc_WorkCount = 0;
private static void InStoreProcess() private static void InStoreProcess()
{ {
...@@ -187,54 +207,66 @@ namespace OnlineStore.DeviceLibrary ...@@ -187,54 +207,66 @@ namespace OnlineStore.DeviceLibrary
return; return;
} }
if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I01_MoveToUp)) if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I00_MoveToUp))
{ {
SuckingDiscWork(); IsNeedScanCode();
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_SuckingDisc_Down)) }
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I01_ScanCode))
{ {
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I03_SuckingDisc_Work); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_SuckingDisc_Down);
LogUtil.info(Name + "入料: 开始吸料盘,等待上料机构检测到无料盘"); LogUtil.info(Name + "入料: 检测到料盘, 吸盘开始下降");
KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.HIGH); CylinderMove(IO_Type.SuckingDisc_Down, IO_Type.SuckingDisc_Up, true);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(200)); }
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.HIGH)); else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_SuckingDisc_Down))
{
SuckingDiscWork();
} }
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I03_SuckingDisc_Work)) else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I03_SuckingDisc_Work))
{ {
if (KND.IOValue(IO_Type.SuckingDisc_Air).Equals(IO_VALUE.HIGH))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Up); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Up);
LogUtil.info(Name + "入料: 吸盘上升,同时上料轴也上升"); LogUtil.info(Name + "入料: 吸盘上升,同时上料轴也上升");
CylinderMove(IO_Type.SuckingDisc_Up,IO_Type.SuckingDisc_Down, true); CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down, true);
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed); ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.Batch_Axis.TargetSpeed);
} }
else if (SuckingDisc_WorkCount < 3)
{
SuckingDiscWork();
}
else
{
//TODO 报警
WarnMsg = "吸盘已经尝试三次,仍然吸不到物料!";
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I04_SuckingDisc_Up)) else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I04_SuckingDisc_Up))
{ {
//需要料仓没有出入库才可以扫码 if (LastCode.Equals(""))
if (StoreManager.Store.CanStarInOut())
{ {
LastHeight = 0; StoreMove.NextMoveStep(StoreMoveStep.AUTO_I07_OpenDoor);
LastSize = 0; LogUtil.info(Name + "入料: 未扫到二维码,打开仓门");
LastCode = ""; CylinderMove(IO_Type.Door_Up, IO_Type.Door_Down, true);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I05_ScanCode); }
else if (StoreManager.Store.CanStarInOut())
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I05_GetPosId);
//计算高度 //计算高度
EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue()); EndMovePosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
int height = Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue; int height = Math.Abs(EndMovePosition - StartMovePosition) / AxisChangeValue;
int size = GetSize(); int size = GetSize();
LogUtil.info(Name + "入料: 开始扫码,料盘尺寸:【" + size + "*" + height + "】"); LogUtil.info(Name + "入料: 从服务器获取入库PosId,尺寸:【" + size + "*" + height + "】二维码【" + LastCode + "】");
LastHeight = height; LastHeight = height;
LastSize = size; LastSize = size;
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
StoreMove.OneWaitCanEndStep = true; StoreMove.OneWaitCanEndStep = true;
} }
} }
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I05_ScanCode)) else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I05_GetPosId))
{
if (LastCode.Equals(""))
{ {
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I07_OpenDoor);
LogUtil.info(Name + "入料: 未扫到二维码,打开仓门"); //判断是否开始入库
CylinderMove(IO_Type.Door_Up, IO_Type.Door_Down, true); if(StoreManager.Store.StoreMove.MoveType.Equals(StoreMoveType.InStore))
}
else
{ {
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_WaitTrayLeave); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_WaitTrayLeave);
LogUtil.info(Name + "入料: 开始入料,等待料盘拿走"); LogUtil.info(Name + "入料: 开始入料,等待料盘拿走");
...@@ -242,13 +274,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -242,13 +274,22 @@ namespace OnlineStore.DeviceLibrary
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck1, IO_VALUE.LOW)); StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck1, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck2, IO_VALUE.LOW)); StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.WidthCheck2, IO_VALUE.LOW));
} }
}else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I06_WaitTrayLeave)) else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I07_OpenDoor);
LogUtil.info(Name + "入料: 没有PosID,打开仓门等待拿走料盘");
CylinderMove(IO_Type.Door_Up, IO_Type.Door_Down, true);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I06_WaitTrayLeave))
{ {
if (StoreManager.Store.StoreMove.MoveStep >= StoreMoveStep.SI_07_DeviceBackFromDoor) if (StoreManager.Store.StoreMove.MoveStep >= StoreMoveStep.SI_07_DeviceBackFromDoor)
{ {
SuckingDiscWork(); IsNeedScanCode();
} }
} else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I07_OpenDoor)){ }
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I07_OpenDoor))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I08_WaitTakeTray); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I08_WaitTakeTray);
LogUtil.info(Name + "入料: 未扫到二维码,等待拿走料盘"); LogUtil.info(Name + "入料: 未扫到二维码,等待拿走料盘");
...@@ -270,23 +311,38 @@ namespace OnlineStore.DeviceLibrary ...@@ -270,23 +311,38 @@ namespace OnlineStore.DeviceLibrary
} }
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I10_CloseDoor)) else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I10_CloseDoor))
{ {
SuckingDiscWork(); IsNeedScanCode();
} }
else else
{ {
LogUtil.error(Name+"未找到步骤:"+StoreMove.MoveType); LogUtil.error(Name + "未找到步骤:" + StoreMove.MoveType);
} }
} }
/// <summary>
/// 吸盘下降开始吸走料盘
/// </summary>
private static void SuckingDiscWork() private static void SuckingDiscWork()
{ {
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I03_SuckingDisc_Work);
SuckingDisc_WorkCount++;
LogUtil.info(Name + "入料: 吸盘开始第"+SuckingDisc_WorkCount+"次工作");
KND.IOMove(IO_Type.SuckingDisc_Work, IO_VALUE.HIGH);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(500));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.HIGH));
StoreMove.OneWaitCanEndStep = true;
}
private static void IsNeedScanCode()
{
LastCode = "";
LastHeight = 0;
LastSize = 0;
LastPosId = "";
SuckingDisc_WorkCount = 0;
if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH)) if (KND.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{ {
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_SuckingDisc_Down); StoreMove.NextMoveStep(StoreMoveStep.AUTO_I01_ScanCode);
LogUtil.info(Name + "入料: 检测到料盘, 吸盘开始下降"); LogUtil.info(Name + "入料: 开始扫码 ");
CylinderMove(IO_Type.SuckingDisc_Down,IO_Type.SuckingDisc_Up, true); StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
GetCameraCode();
StoreMove.OneWaitCanEndStep = true;
} }
else else
{ {
...@@ -405,6 +461,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -405,6 +461,7 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
public static void BatchDoorOpen(bool isWait) public static void BatchDoorOpen(bool isWait)
{ {
ClearInOutInfo(); ClearInOutInfo();
...@@ -432,25 +489,5 @@ namespace OnlineStore.DeviceLibrary ...@@ -432,25 +489,5 @@ namespace OnlineStore.DeviceLibrary
KND.IOMove(IO_Type.BatchDoor_Close, IO_VALUE.HIGH); KND.IOMove(IO_Type.BatchDoor_Close, IO_VALUE.HIGH);
} }
//public static void SuckingDiscDown(bool isWait)
//{
// if (isWait)
// {
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Up, IO_VALUE.LOW));
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Down, IO_VALUE.HIGH));
// }
// KND.IOMove(IO_Type.SuckingDisc_Up, IO_VALUE.LOW);
// KND.IOMove(IO_Type.SuckingDisc_Down, IO_VALUE.HIGH);
//}
//public static void SuckingDiscUp(bool isWait)
//{
// if (isWait)
// {
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Down, IO_VALUE.LOW));
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Up, IO_VALUE.HIGH));
// }
// KND.IOMove(IO_Type.SuckingDisc_Down, IO_VALUE.LOW);
// KND.IOMove(IO_Type.SuckingDisc_Up, IO_VALUE.HIGH);
//}
} }
} }
...@@ -290,7 +290,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -290,7 +290,8 @@ namespace OnlineStore.DeviceLibrary
} }
foreach (string str in codeList) foreach (string str in codeList)
{ {
message = message + "=1+0x0-" + LastSize + "x" + LastHeight + " =" + str + spiltStr; message = message + spiltStr + str ;
//message = message + "=1+0x0-" + LastSize + "x" + LastHeight + " =" + str + spiltStr;
} }
LastCode = message; LastCode = message;
if (LastCode.Equals("")) if (LastCode.Equals(""))
...@@ -299,7 +300,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,7 +300,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg = "未扫到二维码,请拿走料盘"; WarnMsg = "未扫到二维码,请拿走料盘";
} }
KND.IOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW); KND.IOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
StoreManager.Store.onCodeReceived(message); // StoreManager.Store.onCodeReceived(message);
}); });
} }
#endregion #endregion
......
using HalconDotNet;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
public class HDevelopCodeLearn
{
public static HWindow hv_ExpDefaultWinHandle;
public static HTuple hv_AcqHandle = null;
public static void HDevelopStop()
{
//MessageBox.Show("Press button to continue", "Program stop");
}
public static void InitHalcon()
{
// Default settings used in HDevelop
HOperatorSet.SetSystem("width", 512);
HOperatorSet.SetSystem("height", 512);
}
public static void RunHalcon(HWindow Window, string camerName, string codeType, string paramPath, int codeCount)
{
InitHalcon();
hv_ExpDefaultWinHandle = Window;
action(camerName, codeType, paramPath, codeCount);
}
private static bool OpenCamera(string cameraName)
{
try
{ //[1] HD USB Camera
HOperatorSet.OpenFramegrabber("GigEVision", 0, 0, 0, 0, 0, 0, "default", -1,
"default", -1, "false", "default", cameraName, 0, -1, out hv_AcqHandle);
//HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb",
// -1, "false", "default", "[1] HD USB Camera", 0, -1, out hv_AcqHandle);
return true;
}
catch (Exception ex)
{
LogUtil.error("打开摄像机失败:" + ex.ToString() + ",调用关闭摄像头");
CloseCamera(cameraName);
return false;
}
}
private static void CloseCamera(string cameraName)
{
try
{
HOperatorSet.CloseFramegrabber(hv_AcqHandle);
hv_AcqHandle = null;
}
catch (Exception ex)
{
LogUtil.error("关闭摄像机失败:" + ex.ToString());
}
}
public static bool IsRun = false;
// Main procedure
private static bool action(string cameraName, string codeType, string paramPath, int codeCount)
{
IsRun = true;
IsLearnEnd = false;
IsTestEnd = false;
try
{
HTuple hv_code_type = codeType;
HTuple hv_model_path = paramPath;
HObject ho_Image = null, ho_SymbolXLDs = null;
HTuple hv_train_first = null, /*hv_AcqHandle = null,*/ hv_DataCodeHandle = null;
HTuple hv_ResultHandles = new HTuple(), hv_DecodedDataStrings = new HTuple();
HTuple hv_GenParamNames = new HTuple(), hv_ModelBeforeTraining = new HTuple();
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_Image);
HOperatorSet.GenEmptyObj(out ho_SymbolXLDs);
//Image Acquisition 04: Code generated by Image Acquisition 04
//Image Acquisition 01: Code generated by Image Acquisition 01
//hv_code_type = "Data Matrix ECC 200";
//hv_model_path = ("E:/BaiduNetdiskDownload/" + hv_code_type) + ".dcm";
hv_train_first = 1;
if (!OpenCamera(cameraName))
{
return false ;
}
//HOperatorSet.GrabImageStart(hv_AcqHandle, -1);
HOperatorSet.CreateDataCode2dModel(hv_code_type, new HTuple(), new HTuple(),
out hv_DataCodeHandle);
//set_data_code_2d_param (DataCodeHandle, 'strict_model', 'yes')
//set_data_code_2d_param (DataCodeHandle, 'persistence', 0)
//set_data_code_2d_param (DataCodeHandle, 'polarity', 'light_on_dark')
List<string> findCode = new List<string>();
if ((int)(hv_train_first) != 0)
{
while (findCode.Count < codeCount&&IsLearnEnd.Equals(false ))
{
ho_Image.Dispose();
HOperatorSet.GrabImageAsync(out ho_Image, hv_AcqHandle, -1);
//Image Acquisition 04: Do something
//write_image (Image, 'jpeg', 0, 'E:/BaiduNetdiskDownload/fuba2.jpg')
if (ho_Image != null)
{
ho_SymbolXLDs.Dispose();
HOperatorSet.FindDataCode2d(ho_Image, out ho_SymbolXLDs, hv_DataCodeHandle,
"train", "all", out hv_ResultHandles, out hv_DecodedDataStrings);
if ((int)(new HTuple((new HTuple(hv_DecodedDataStrings.TupleLength())).TupleNotEqual(
0))) != 0)
{
HOperatorSet.QueryDataCode2dParams(hv_DataCodeHandle, "get_model_params",
out hv_GenParamNames);
HOperatorSet.GetDataCode2dParam(hv_DataCodeHandle, hv_GenParamNames, out hv_ModelBeforeTraining);
HDevelopStop();
string[] resultList = hv_DecodedDataStrings.SArr;
foreach (string str in resultList)
{
if (!findCode.Contains(str))
{
LogUtil.info("["+cameraName + "][" + codeType + "]学习【" + str+"】");
findCode.Add(str);
}
}
}
ShowImage(ho_Image,ho_SymbolXLDs);
}
Thread.Sleep(500);
}
//*参数写入文件
LogUtil.info("["+cameraName + "][" + codeType + "]保存参数到文件【" + paramPath+"】");
HOperatorSet.WriteDataCode2dModel(hv_DataCodeHandle, hv_model_path);
HOperatorSet.ClearDataCode2dModel(hv_DataCodeHandle);
}
//Read the previously saved data code model
findCode = new List<string>();
HOperatorSet.ReadDataCode2dModel(hv_model_path, out hv_DataCodeHandle);
while (findCode.Count < codeCount&&IsTestEnd.Equals(false ))
{
ho_Image.Dispose();
HOperatorSet.GrabImageAsync(out ho_Image, hv_AcqHandle, -1);
//Image Acquisition 04: Do something
//write_image (Image, 'jpeg', 0, 'E:/BaiduNetdiskDownload/fuba2.jpg')
if (ho_Image != null)
{
ho_SymbolXLDs.Dispose();
HOperatorSet.FindDataCode2d(ho_Image, out ho_SymbolXLDs, hv_DataCodeHandle,
"stop_after_result_num", 5, out hv_ResultHandles, out hv_DecodedDataStrings);
ShowImage(ho_Image,ho_SymbolXLDs);
if ((int)(new HTuple((new HTuple(hv_DecodedDataStrings.TupleLength())).TupleNotEqual(
0))) != 0)
{
string[] resultList = hv_DecodedDataStrings.SArr;
foreach (string str in resultList)
{
if (!findCode.Contains(str))
{
findCode.Add(str);
LogUtil.info("[" + cameraName + "][" + codeType + "]检测到【" + str + "】");
}
}
}
}
Thread.Sleep(500);
}
HOperatorSet.ClearDataCode2dModel(hv_DataCodeHandle);
CloseCamera(cameraName);
ho_Image.Dispose();
ho_SymbolXLDs.Dispose();
IsRun = false;
return true;
}catch(Exception ex)
{
LogUtil.error("出错了:" + ex.ToString());
CloseCamera(cameraName);
IsRun = false;
return false;
}
}
public static bool IsTestEnd = false;
public static bool IsLearnEnd = false;
public static void StopLearn()
{
IsTestEnd = true;
IsLearnEnd = true;
}
private static int dWidth = 0;
private static int dHeight = 0;
private static void ShowImage(HObject ho_Image,HObject ho_SymbolXLDs)
{
if (dWidth <= 0)
{
HTuple width, height;
//int dWidth = 0; int dHeight = 0;
HOperatorSet.GetImageSize(ho_Image, out width, out height);
dWidth = (int)width.D;
dHeight = (int)height.D;
hv_ExpDefaultWinHandle.SetPart(0, 0, dHeight, dWidth);
}
HOperatorSet.DispObj(ho_Image, hv_ExpDefaultWinHandle);
HOperatorSet.DispObj(ho_SymbolXLDs, hv_ExpDefaultWinHandle);
}
}
}
using HalconDotNet;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
public class HDevelopExport
{
/// <summary>
/// 摄像机类别,只保存已经打开的摄像机
/// </summary>
public static Dictionary<string, HTuple> cameraHtuple = new Dictionary<string, HTuple>();
public static List<string> cameraNameList = new List<string>();
public static List<string> codeTypeList = new List<string>();
private static char spiltChar = '#';
/// <summary>
/// 初始化摄像机名称和二维码类型
/// </summary>
/// <param name="nameStr">摄像机名称,多个用#分割</param>
/// <param name="codeStr">二维码类型,多个用#分割</param>
public static void LoadConfig(string nameStr, string codeStr)
{
cameraNameList = new List<string>();
codeTypeList = new List<string>();
try
{
string[] nameArray = nameStr.Split(spiltChar);
foreach (string str in nameArray)
{
LogUtil.info("加载到摄像机名称:" + str.Trim());
cameraNameList.Add(str.Trim());
}
string[] codeArray = codeStr.Split(spiltChar);
foreach (string str in codeArray)
{
LogUtil.info("加载到二维码类型:" + str.Trim());
codeTypeList.Add(str.Trim());
}
}
catch (Exception ex)
{
LogUtil.error("解析摄像机配置出错:" + ex.ToString());
}
}
/// <summary>
/// 扫取二维码,会打开摄像机,正常情况下不关闭摄像机
/// </summary>
/// <returns></returns>
public static List<string> CameraScan(out string msg)
{
List<string> allCodeList = new List<string>();
msg = "";
try
{
//HDevelopExport.CloseAllCamera();
//打开所有摄像机
HDevelopExport.OpenAllCamera();
foreach (string cameraName in HDevelopExport.cameraNameList)
{
HObject ho_Image = HDevelopExport.GrabImage(cameraName);
List<string> codeList = HDevelopExport.GetCode(ho_Image);
//if (codeList.Count > 0)
//{
// Bitmap bitmap = HObject2Bpp24(ho_Image);
// if (Exist(bitmap))
// {
// msg = "盘尺寸错误";
// LogUtil.error("盘尺寸错误!");
// }
// bitmap = null;
//}
allCodeList.AddRange(codeList);
}
}
catch (Exception ex)
{
LogUtil.error("从摄像机获取二维码出错:" + ex.ToString());
LogUtil.error("关闭摄像机");
HDevelopExport.CloseAllCamera();
}
return allCodeList;
}
/// <summary>
/// 料盘是否存在,true在,false不在
/// </summary>
/// <param name="bmp"></param>
/// <returns></returns>
private static bool Exist(Bitmap bmp)
{
//8个点,距离边界1/10
Point[] pt = new Point[8];
int w = bmp.Width / 10;
int h = bmp.Height / 10;
pt[0] = new Point(10, 20); //左上1
pt[1] = new Point(20, 10); //左上2
pt[2] = new Point(bmp.Width - 10, 20); //右上1
pt[3] = new Point(bmp.Width - 20, 10); //右上2
pt[4] = new Point(10, bmp.Height - 20); //左下1
pt[5] = new Point(20, bmp.Height - 10); //左下2
pt[6] = new Point(bmp.Width - 10, bmp.Height - 20); //右下1
pt[7] = new Point(bmp.Width - 20, bmp.Height - 10); //右下2
//数量
int count = 0;
//颜色的范围,小于即不存在
Color range = Color.FromArgb(50, 50, 50);
for (int i = 0; i < pt.Length; i++)
{
Color cc = bmp.GetPixel(pt[i].X, pt[i].Y);
if (cc.R < range.R && cc.G < range.G && cc.B < range.B)
count++;
}
if (count >= 7) //满7个即可
return false;
else
return true;
}
public static Bitmap HObject2Bpp24(HObject image)
{
Bitmap res = null;
try
{
HTuple hred, hgreen, hblue, type, width, height;
HOperatorSet.GetImagePointer3(image, out hred, out hgreen, out hblue, out type, out width, out height);
res = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
Rectangle rect = new Rectangle(0, 0, width, height);
BitmapData bitmapData = res.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
unsafe
{
byte* bptr = (byte*)bitmapData.Scan0;
byte* r = ((byte*)hred.I);
byte* g = ((byte*)hgreen.I);
byte* b = ((byte*)hblue.I);
for (int i = 0; i < width * height; i++)
{
bptr[i * 4] = (b)[i];
bptr[i * 4 + 1] = (g)[i];
bptr[i * 4 + 2] = (r)[i];
bptr[i * 4 + 3] = 255;
}
}
res.UnlockBits(bitmapData);
}catch(Exception ex)
{
LogUtil.info("Hobject to BitMap 出错"+ex.ToString());
}
return res;
}
public static List<string> GetCode(HObject ho_Image, string symbolType)
{
List<string> list = new List<string>();
string[] array = GetQrCode(ho_Image, symbolType);
if (array != null)
{
list.AddRange(array);
}
return list;
}
public static List<string> GetCode(HObject ho_Image)
{
List<string> list = new List<string>();
foreach (string codeType in codeTypeList)
{
string[] array = GetQrCode(ho_Image, codeType);
if (array != null)
{
list.AddRange(array);
}
}
return list;
}
public static string GetCodeParamFilePath(string codePath)
{
string appPath = Application.StartupPath;
string path = appPath + ConfigAppSettings.GetValue(Setting_Init.CodeParamPath);
string filePath = path + codePath + ".dcm";
if (File.Exists(filePath))
{
return filePath;
}
else
{
return "";
}
}
// Procedures
//private static HTuple hv_DataCodeHandle = null;
private static string[] GetQrCode(HObject ho_Image, string symbolType)
{
try
{
DateTime date = DateTime.Now;
// Local iconic variables
HObject ho_SymbolXLDs;
// Local control variables
HTuple hv_ResultHandles = null;
//HTuple hv_DataCodeHandle = null, hv_ResultHandles = null;
HTuple hv_DecodedDataStrings = null;
HTuple hv_Area = null;
HTuple hv_Row1 = null;
HTuple hv_Column = null;
HTuple hv_PointOrder = null;
HTuple hv_DataCodeHandle = null;
// Initialize local and output iconic variables
HOperatorSet.GenEmptyObj(out ho_SymbolXLDs);
//LogUtil.info("GetQrCode:结束HOperatorSet.GenEmptyObj,已耗时:" + (DateTime.Now - date).ToString());
HOperatorSet.CreateDataCode2dModel(symbolType, "default_parameters", "maximum_recognition",
out hv_DataCodeHandle);
string hv_model_path = GetCodeParamFilePath(symbolType);
if (!hv_model_path.Equals(""))
{
HOperatorSet.ReadDataCode2dModel(hv_model_path, out hv_DataCodeHandle);
}
else
{
if (symbolType.Equals("Data Matrix ECC 200"))
{
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "timeout", 500);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "mirrored", "no");
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "contrast_min", 50);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "symbol_cols_min", 40);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "symbol_rows_min", 40);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "symbol_cols_max", 40);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "symbol_rows_max", 40);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "symbol_shape", "square");
}
else
{
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "timeout", 300);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "mirrored", "no");
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "model_type", 2);
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "module_gap_max", "no");
}
}
//LogUtil.info("GetQrCode:结束HOperatorSet.CreateDataCode2dModel,已耗时:" + (DateTime.Now - date).ToString());
ho_SymbolXLDs.Dispose();
LogUtil.debug("GetQrCode:结束ho_SymbolXLDs.Dispose,已耗时:" + (DateTime.Now - date).ToString());
HOperatorSet.FindDataCode2d(ho_Image, out ho_SymbolXLDs, hv_DataCodeHandle, "stop_after_result_num",
3, out hv_ResultHandles, out hv_DecodedDataStrings);
LogUtil.debug("GetQrCode:结束HOperatorSet.FindDataCode2d,已耗时:" + (DateTime.Now - date).ToString());
HOperatorSet.AreaCenterXld(ho_SymbolXLDs, out hv_Area, out hv_Row1, out hv_Column,
out hv_PointOrder);
//LogUtil.info("GetQrCode:结束HOperatorSet.AreaCenterXld,已耗时:" + (DateTime.Now - date).ToString());
HOperatorSet.ClearDataCode2dModel(hv_DataCodeHandle);
//LogUtil.info("GetQrCode:结束HOperatorSet.ClearDataCode2dModel,已耗时:" + (DateTime.Now - date).ToString());
string[] resultList = hv_DecodedDataStrings.SArr;
if (resultList.Length > 0)
{
for (int i = 0; i < hv_DecodedDataStrings.SArr.Length; i++)
{
try
{
int x = (int)Math.Round(hv_Column.DArr[i]);
int y = (int)Math.Round(hv_Row1.DArr[i]);
string str = "=" + x + "x" + y + "=" + hv_DecodedDataStrings.SArr[i];
hv_DecodedDataStrings[i] = str;
}
catch (Exception ex)
{
LogUtil.error("处理二维码出错:索引=" + i + "," + resultList.ToString());
}
}
}
LogUtil.debug("GetQrCode:结束处理二维码,已耗时:" + (DateTime.Now - date).ToString());
return resultList;
}
catch (Exception ex)
{
return new string[] { };
}
}
public static void OpenAllCamera()
{
foreach (string camera in cameraNameList)
{
OpenCamera(camera);
}
}
public static void CloseAllCamera()
{
foreach (string camera in cameraNameList)
{
CloseCamera(camera);
}
}
/// <summary>
/// 截取二维码,不需要位置
/// </summary>
public static string SubStrCode(string str)
{
string[] array = str.Split('=');
if (array.Length >= 3)
{
return array[2];
}
return "";
}
public static void OpenCamera(string cameraAddr)
{
try
{
//Local iconic variables
HTuple hv_AcqHandle = null;
if (cameraHtuple.ContainsKey(cameraAddr))
{
return;
//CloseCamera(cameraAddr);
}
// HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb",
//-1, "false", "default", "[0] Integrated Camera", 0, -1, out hv_AcqHandle);
HOperatorSet.OpenFramegrabber("GigEVision", 0, 0, 0, 0, 0, 0, "default", -1,
"default", -1, "false", "default", cameraAddr, 0,
-1, out hv_AcqHandle);
//003053242c50_Basler_acA250014gm
//HOperatorSet.GrabImageStart(hv_AcqHandle, -1);
cameraHtuple.Add(cameraAddr, hv_AcqHandle);
// IsOpen = true;
}
catch (Exception ex)
{
LogUtil.error("打开摄像机失败:" + ex.ToString() + ",调用关闭摄像头");
CloseCamera(cameraAddr);
}
}
public static void CloseCamera(string cameraStr)
{
try
{
if (cameraHtuple.ContainsKey(cameraStr))
{
HTuple hv_AcqHandle = cameraHtuple[cameraStr];
if (hv_AcqHandle != null)
{
HOperatorSet.CloseFramegrabber(hv_AcqHandle);
hv_AcqHandle = null;
}
cameraHtuple.Remove(cameraStr);
//IsOpen = false;
}
}
catch (Exception ex)
{
LogUtil.error("关闭摄像机失败:" + ex.ToString());
}
}
public static HObject GrabImage(string cameraStr)
{
HObject ho_Image = null;
try
{
if (cameraHtuple.ContainsKey(cameraStr))
{
HTuple hv_AcqHandle = cameraHtuple[cameraStr];
HOperatorSet.GenEmptyObj(out ho_Image);
ho_Image.Dispose();
// HOperatorSet.GrabImageAsync(out ho_Image, hv_AcqHandle,-1);
HOperatorSet.GrabImage(out ho_Image, hv_AcqHandle);
}
}
catch (Exception ex)
{
LogUtil.error("获取摄像机【" + cameraStr + "】的图片出错:" + ex.ToString());
}
return ho_Image;
}
public static bool IsOpen(string cameraStr)
{
return cameraHtuple.ContainsKey(cameraStr);
}
}
}
...@@ -15,12 +15,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -15,12 +15,10 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 康泰克单台自动料仓 /// 康泰克单台自动料仓
/// </summary> /// </summary>
public abstract class AC_Store : AC_DeviceBase public abstract class AC_Store
{ {
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public AC_Store()
{
}
public Stopwatch runTimeWatch = new Stopwatch(); public Stopwatch runTimeWatch = new Stopwatch();
/// <summary> /// <summary>
...@@ -45,6 +43,170 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,6 +43,170 @@ namespace OnlineStore.DeviceLibrary
public AlarmInfo alarmInfo = new AlarmInfo(); public AlarmInfo alarmInfo = new AlarmInfo();
/// <summary> /// <summary>
/// 料仓单个调试状态(默认不是调试状态)
/// </summary>
public bool IsDebug = false;
/// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
///2=急停,3=故障,4=警告,5=调试
/// 6=入库执行中,7=入仓完成,8=入仓失败
/// 9=出库执行,10=出仓完成,11=出库失败
/// </summary>
public StoreStatus storeStatus = StoreStatus.StoreOnline;
/// <summary>
/// 料仓状态
/// </summary>
public StoreRunStatus storeRunStatus = StoreRunStatus.Wait;
/// <summary>
/// 移动信息
/// </summary>
public StoreMoveInfo StoreMove = null;
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public string WarnMsg = "";
public string StoreName { get; set; }
public int StoreID { get; set; }
protected System.Timers.Timer mainTimer;
protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
public AC_Store()
{
}
/// <summary>
/// 初始化
/// </summary>
protected virtual void Init()
{
StoreMove = new StoreMoveInfo(StoreName);
mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false;
mainTimer.Interval = 300;
mainTimer.Elapsed += timersTimer_Elapsed;
mainTimer.AutoReset = true;
serverConnectTimer = new System.Timers.Timer();
serverConnectTimer.Interval = 1000;
serverConnectTimer.AutoReset = true;
serverConnectTimer.Enabled = false;
//serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 200;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
//IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
}
//public StoreRunStatus storeRunStatus
//{
// get
// {
// return storerunstatus;
// }
// set
// {
// StoreRunStatus oldStatus = storerunstatus;
// storerunstatus = value;
// }
//}
/// <summary>
/// 定时处理,监听信号,监听IO
/// </summary>
protected abstract void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e);
#region 出库
//public abstract bool StartOutStoreMove(InOutStoreParam param);
protected abstract void OutStoreProcess();
#endregion
#region 入库
//public abstract bool StartInStoreMove(InOutStoreParam param);
protected abstract void InStoreProcess();
#endregion
public string GetRunStr(StoreRunStatus runStatus, bool IsStore)
{
string sta = "运行中";
string aa = "";
switch (runStatus)
{
case StoreRunStatus.Busy:
sta = "忙碌";
break;
case StoreRunStatus.HomeMoving:
sta = "原点返回";
break;
case StoreRunStatus.Reset:
sta = "重置";
break;
case StoreRunStatus.Runing:
sta = "运行中";
break;
case StoreRunStatus.Wait:
sta = "等待启动";
break;
}
if (runStatus > StoreRunStatus.Wait)
{
//"0":"急停中", "1":"设备联机", "2":"故障中", "3":"入库执行中", "4":"出库执行中", 5":"料盘入仓位完成", "6":"料盘出仓位完成", 7":"设备调试中",
switch (storeStatus)
{
case StoreStatus.Debugging:
aa = "设备调试中";
break;
case StoreStatus.InStoreEnd:
aa = "料盘入仓位完成";
break;
case StoreStatus.InStoreExecute:
aa = "入库执行中";
break;
case StoreStatus.InTrouble:
aa = "故障中";
break;
case StoreStatus.OutStoreBoxEnd:
aa = "料盘出仓位完成";
break;
case StoreStatus.OutStoreExecute:
aa = "出库执行中";
break;
case StoreStatus.StoreOnline:
aa = "设备联机";
break;
case StoreStatus.SuddenStop:
aa = "急停中";
break;
case StoreStatus.OutMoveExecute:
aa = "出库完成";
break;
case StoreStatus.InStoreFaild:
aa = "入库失败(" + WarnMsg + ")";
break;
case StoreStatus.OutStoreFaild:
aa = "出库失败(" + WarnMsg + ")";
break;
}
if (!aa.Equals(""))
{
return sta + "_" + aa;
}
else
{
return sta;
}
}
else
{
return sta;
}
}
/// <summary>
/// 记录上一次的部分IO状态,主要是急停,气压检测信号,复位信号,用来判断是否io发生改变 /// 记录上一次的部分IO状态,主要是急停,气压检测信号,复位信号,用来判断是否io发生改变
/// </summary> /// </summary>
public Dictionary<string, IO_VALUE> DILastValueMap = new Dictionary<string, IO_VALUE>(); public Dictionary<string, IO_VALUE> DILastValueMap = new Dictionary<string, IO_VALUE>();
......
...@@ -366,7 +366,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -366,7 +366,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 先上升到料盘检测1(上料机构)信号亮 /// 先上升到料盘检测1(上料机构)信号亮
/// </summary> /// </summary>
AUTO_I01_MoveToUp, AUTO_I00_MoveToUp,
/// <summary>
/// 扫码
/// </summary>
AUTO_I01_ScanCode,
/// <summary> /// <summary>
/// 吸盘下降 /// 吸盘下降
...@@ -384,9 +388,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -384,9 +388,9 @@ namespace OnlineStore.DeviceLibrary
AUTO_I04_SuckingDisc_Up, AUTO_I04_SuckingDisc_Up,
/// <summary> /// <summary>
/// 扫码 /// 从服务器获取PosID
/// </summary> /// </summary>
AUTO_I05_ScanCode, AUTO_I05_GetPosId,
/// <summary> /// <summary>
/// 等待料盘被叉子拿走 /// 等待料盘被叉子拿走
......
...@@ -294,7 +294,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -294,7 +294,6 @@ namespace OnlineStore.DeviceLibrary
public static WaitResultInfo WaitCodeOK() public static WaitResultInfo WaitCodeOK()
{ {
WaitResultInfo wait = new WaitResultInfo(); WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = 11; wait.WaitType = 11;
return wait; return wait;
} }
......
...@@ -81,10 +81,13 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -81,10 +81,13 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (array.Length >= titleIndex.Count) if (array.Length >= titleIndex.Count)
{ {
if (array.Length > 0 && array[0].Equals("")) if (array.Length > 0 )
{
if (array[0].Equals("") || array[1].Equals("") || array[2].Equals("") || array[3].Equals("") || array[4].Equals(""))
{ {
continue; continue;
} }
}
var bllIns = type.Assembly.CreateInstance(type.FullName); var bllIns = type.Assembly.CreateInstance(type.FullName);
//取得属性集合 //取得属性集合
PropertyInfo[] props = type.GetProperties(); PropertyInfo[] props = type.GetProperties();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!