Commit 556fc0fa 几米阳光

出料时批量上下轴要先下降,叉子才能下降。修改压紧轴运动代码

1 个父辈 5b74988c
...@@ -31,8 +31,10 @@ ...@@ -31,8 +31,10 @@
<add key="CodeParamPath" value="\CodeParam\" /> <add key="CodeParamPath" value="\CodeParam\" />
<add key="InOutDefaultPosition" value="10000" /> <add key="InOutDefaultPosition" value="10000" />
<add key="Config_Pwd" value="123456" /> <add key="Config_Pwd" value="123456" />
<!--5000脉冲对应1mm--> <!--批量上下料轴5000脉冲对应1mm-->
<add key="AxisChangeValue" value="5000" /> <add key="AxisChangeValue" value="5000" />
<!--压紧轴计量检测信号亮1次的脉冲值-->
<add key ="ComAxisChangeValue" value ="2400"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
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.btnUpdateSpeed = new System.Windows.Forms.Button();
this.btnUpdateStatus = new System.Windows.Forms.Button(); this.btnUpdateStatus = new System.Windows.Forms.Button();
this.label24 = new System.Windows.Forms.Label(); this.label24 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label(); this.label26 = new System.Windows.Forms.Label();
...@@ -82,10 +83,14 @@ ...@@ -82,10 +83,14 @@
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblAxisStatus = new System.Windows.Forms.Label(); this.lblAxisStatus = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.axis_5_Alarm = new UserFromControl.IOStatusControl();
this.txtBatchTarget = new System.Windows.Forms.TextBox(); this.txtBatchTarget = new System.Windows.Forms.TextBox();
this.lblCountPulse5 = new System.Windows.Forms.TextBox(); this.lblCountPulse5 = new System.Windows.Forms.TextBox();
this.lblOutPulse5 = new System.Windows.Forms.TextBox(); this.lblOutPulse5 = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.label38 = new System.Windows.Forms.Label(); this.label38 = new System.Windows.Forms.Label();
this.txtMiddleTarget = new System.Windows.Forms.TextBox(); this.txtMiddleTarget = new System.Windows.Forms.TextBox();
this.txtInoutTarget = new System.Windows.Forms.TextBox(); this.txtInoutTarget = new System.Windows.Forms.TextBox();
...@@ -227,6 +232,7 @@ ...@@ -227,6 +232,7 @@
this.btnTempClose = new System.Windows.Forms.Button(); this.btnTempClose = new System.Windows.Forms.Button();
this.btnTempInit = new System.Windows.Forms.Button(); this.btnTempInit = new System.Windows.Forms.Button();
this.groupBox6 = new System.Windows.Forms.GroupBox(); this.groupBox6 = new System.Windows.Forms.GroupBox();
this.lblBatchMsg = new System.Windows.Forms.Label();
this.btnOpenDoor = new System.Windows.Forms.Button(); this.btnOpenDoor = new System.Windows.Forms.Button();
this.lblWaitTragGo = new System.Windows.Forms.Label(); this.lblWaitTragGo = new System.Windows.Forms.Label();
this.btnWaitTrgGo = new System.Windows.Forms.Button(); this.btnWaitTrgGo = new System.Windows.Forms.Button();
...@@ -237,12 +243,7 @@ ...@@ -237,12 +243,7 @@
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();
this.btnBatchInStore = new System.Windows.Forms.Button(); this.btnBatchInStore = new System.Windows.Forms.Button();
this.lblBatchMsg = new System.Windows.Forms.Label(); this.lblComMsg = new System.Windows.Forms.Label();
this.axis_5_Alarm = new UserFromControl.IOStatusControl();
this.axis_1_Alarm = new UserFromControl.IOStatusControl();
this.axis_3_Alarm = new UserFromControl.IOStatusControl();
this.axis_2_Alarm = new UserFromControl.IOStatusControl();
this.btnUpdateSpeed = new System.Windows.Forms.Button();
this.groupBox5.SuspendLayout(); this.groupBox5.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
...@@ -337,13 +338,28 @@ ...@@ -337,13 +338,28 @@
this.groupBox5.TabStop = false; this.groupBox5.TabStop = false;
this.groupBox5.Text = "伺服运动"; this.groupBox5.Text = "伺服运动";
// //
// btnUpdateSpeed
//
this.btnUpdateSpeed.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateSpeed.Cursor = System.Windows.Forms.Cursors.Default;
this.btnUpdateSpeed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateSpeed.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnUpdateSpeed.Location = new System.Drawing.Point(312, 154);
this.btnUpdateSpeed.Name = "btnUpdateSpeed";
this.btnUpdateSpeed.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpdateSpeed.Size = new System.Drawing.Size(90, 33);
this.btnUpdateSpeed.TabIndex = 310;
this.btnUpdateSpeed.Text = "更改速度";
this.btnUpdateSpeed.UseVisualStyleBackColor = true;
this.btnUpdateSpeed.Click += new System.EventHandler(this.btnUpdateSpeed_Click);
//
// btnUpdateStatus // btnUpdateStatus
// //
this.btnUpdateStatus.BackColor = System.Drawing.SystemColors.Control; this.btnUpdateStatus.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateStatus.Cursor = System.Windows.Forms.Cursors.Default; 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.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.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnUpdateStatus.Location = new System.Drawing.Point(203, 156); this.btnUpdateStatus.Location = new System.Drawing.Point(203, 154);
this.btnUpdateStatus.Name = "btnUpdateStatus"; this.btnUpdateStatus.Name = "btnUpdateStatus";
this.btnUpdateStatus.RightToLeft = System.Windows.Forms.RightToLeft.No; this.btnUpdateStatus.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpdateStatus.Size = new System.Drawing.Size(105, 33); this.btnUpdateStatus.Size = new System.Drawing.Size(105, 33);
...@@ -463,7 +479,7 @@ ...@@ -463,7 +479,7 @@
// chbAutoRead // chbAutoRead
// //
this.chbAutoRead.AutoSize = true; this.chbAutoRead.AutoSize = true;
this.chbAutoRead.Location = new System.Drawing.Point(47, 165); this.chbAutoRead.Location = new System.Drawing.Point(47, 160);
this.chbAutoRead.Name = "chbAutoRead"; this.chbAutoRead.Name = "chbAutoRead";
this.chbAutoRead.Size = new System.Drawing.Size(99, 21); this.chbAutoRead.Size = new System.Drawing.Size(99, 21);
this.chbAutoRead.TabIndex = 296; this.chbAutoRead.TabIndex = 296;
...@@ -584,7 +600,7 @@ ...@@ -584,7 +600,7 @@
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, 153); this.btnReadPosition.Location = new System.Drawing.Point(401, 154);
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);
...@@ -599,7 +615,7 @@ ...@@ -599,7 +615,7 @@
this.lblServerOn.AutoSize = true; this.lblServerOn.AutoSize = true;
this.lblServerOn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblServerOn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblServerOn.ForeColor = System.Drawing.Color.Red; this.lblServerOn.ForeColor = System.Drawing.Color.Red;
this.lblServerOn.Location = new System.Drawing.Point(48, 167); this.lblServerOn.Location = new System.Drawing.Point(48, 161);
this.lblServerOn.Name = "lblServerOn"; this.lblServerOn.Name = "lblServerOn";
this.lblServerOn.Size = new System.Drawing.Size(0, 19); this.lblServerOn.Size = new System.Drawing.Size(0, 19);
this.lblServerOn.TabIndex = 268; this.lblServerOn.TabIndex = 268;
...@@ -902,9 +918,9 @@ ...@@ -902,9 +918,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, 473); this.richTextBox1.Location = new System.Drawing.Point(510, 486);
this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(571, 266); this.richTextBox1.Size = new System.Drawing.Size(571, 251);
this.richTextBox1.TabIndex = 256; this.richTextBox1.TabIndex = 256;
this.richTextBox1.Text = ""; this.richTextBox1.Text = "";
// //
...@@ -939,7 +955,7 @@ ...@@ -939,7 +955,7 @@
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(8, 187); this.groupBox1.Location = new System.Drawing.Point(8, 199);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(549, 212); this.groupBox1.Size = new System.Drawing.Size(549, 212);
this.groupBox1.TabIndex = 217; this.groupBox1.TabIndex = 217;
...@@ -972,6 +988,16 @@ ...@@ -972,6 +988,16 @@
this.button3.UseVisualStyleBackColor = true; this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click); 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 // txtBatchTarget
// //
this.txtBatchTarget.Location = new System.Drawing.Point(395, 139); this.txtBatchTarget.Location = new System.Drawing.Point(395, 139);
...@@ -1006,6 +1032,36 @@ ...@@ -1006,6 +1032,36 @@
this.label20.TabIndex = 267; this.label20.TabIndex = 267;
this.label20.Text = "批量出入料轴"; this.label20.Text = "批量出入料轴";
// //
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(116, 37);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(318, 37);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(213, 37);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// label38 // label38
// //
this.label38.AutoSize = true; this.label38.AutoSize = true;
...@@ -2191,6 +2247,7 @@ ...@@ -2191,6 +2247,7 @@
// //
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox4.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.groupBox4.Controls.Add(this.lblComMsg);
this.groupBox4.Controls.Add(this.btnRelMove); this.groupBox4.Controls.Add(this.btnRelMove);
this.groupBox4.Controls.Add(this.txtAddr); this.groupBox4.Controls.Add(this.txtAddr);
this.groupBox4.Controls.Add(this.label18); this.groupBox4.Controls.Add(this.label18);
...@@ -2212,16 +2269,16 @@ ...@@ -2212,16 +2269,16 @@
this.groupBox4.Controls.Add(this.label25); this.groupBox4.Controls.Add(this.label25);
this.groupBox4.Controls.Add(this.comboBoxPortName); this.groupBox4.Controls.Add(this.comboBoxPortName);
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, 4);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(549, 175); this.groupBox4.Size = new System.Drawing.Size(549, 194);
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(282, 61); this.btnRelMove.Location = new System.Drawing.Point(282, 54);
this.btnRelMove.Name = "btnRelMove"; this.btnRelMove.Name = "btnRelMove";
this.btnRelMove.Size = new System.Drawing.Size(100, 33); this.btnRelMove.Size = new System.Drawing.Size(100, 33);
this.btnRelMove.TabIndex = 96; this.btnRelMove.TabIndex = 96;
...@@ -2232,7 +2289,7 @@ ...@@ -2232,7 +2289,7 @@
// txtAddr // txtAddr
// //
this.txtAddr.Enabled = false; this.txtAddr.Enabled = false;
this.txtAddr.Location = new System.Drawing.Point(210, 27); this.txtAddr.Location = new System.Drawing.Point(210, 22);
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;
...@@ -2241,7 +2298,7 @@ ...@@ -2241,7 +2298,7 @@
// label18 // label18
// //
this.label18.AutoSize = true; this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(174, 30); this.label18.Location = new System.Drawing.Point(174, 25);
this.label18.Name = "label18"; this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(32, 17); this.label18.Size = new System.Drawing.Size(32, 17);
this.label18.TabIndex = 94; this.label18.TabIndex = 94;
...@@ -2249,7 +2306,7 @@ ...@@ -2249,7 +2306,7 @@
// //
// btnGetPosition // btnGetPosition
// //
this.btnGetPosition.Location = new System.Drawing.Point(387, 62); this.btnGetPosition.Location = new System.Drawing.Point(387, 54);
this.btnGetPosition.Name = "btnGetPosition"; this.btnGetPosition.Name = "btnGetPosition";
this.btnGetPosition.Size = new System.Drawing.Size(100, 33); this.btnGetPosition.Size = new System.Drawing.Size(100, 33);
this.btnGetPosition.TabIndex = 93; this.btnGetPosition.TabIndex = 93;
...@@ -2264,7 +2321,7 @@ ...@@ -2264,7 +2321,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, 133); this.cmbHomeType.Location = new System.Drawing.Point(67, 126);
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;
...@@ -2272,7 +2329,7 @@ ...@@ -2272,7 +2329,7 @@
// label13 // label13
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(5, 137); this.label13.Location = new System.Drawing.Point(5, 130);
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;
...@@ -2281,7 +2338,7 @@ ...@@ -2281,7 +2338,7 @@
// label17 // label17
// //
this.label17.AutoSize = true; this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(5, 104); this.label17.Location = new System.Drawing.Point(5, 97);
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;
...@@ -2289,7 +2346,7 @@ ...@@ -2289,7 +2346,7 @@
// //
// txtSpeed // txtSpeed
// //
this.txtSpeed.Location = new System.Drawing.Point(67, 100); this.txtSpeed.Location = new System.Drawing.Point(67, 93);
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);
...@@ -2298,7 +2355,7 @@ ...@@ -2298,7 +2355,7 @@
// //
// btnVolMove // btnVolMove
// //
this.btnVolMove.Location = new System.Drawing.Point(176, 95); this.btnVolMove.Location = new System.Drawing.Point(176, 88);
this.btnVolMove.Name = "btnVolMove"; this.btnVolMove.Name = "btnVolMove";
this.btnVolMove.Size = new System.Drawing.Size(100, 33); this.btnVolMove.Size = new System.Drawing.Size(100, 33);
this.btnVolMove.TabIndex = 88; this.btnVolMove.TabIndex = 88;
...@@ -2308,7 +2365,7 @@ ...@@ -2308,7 +2365,7 @@
// //
// btnClose // btnClose
// //
this.btnClose.Location = new System.Drawing.Point(375, 20); this.btnClose.Location = new System.Drawing.Point(375, 15);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(100, 33); this.btnClose.Size = new System.Drawing.Size(100, 33);
this.btnClose.TabIndex = 87; this.btnClose.TabIndex = 87;
...@@ -2318,7 +2375,7 @@ ...@@ -2318,7 +2375,7 @@
// //
// btnOpen // btnOpen
// //
this.btnOpen.Location = new System.Drawing.Point(265, 20); this.btnOpen.Location = new System.Drawing.Point(265, 15);
this.btnOpen.Name = "btnOpen"; this.btnOpen.Name = "btnOpen";
this.btnOpen.Size = new System.Drawing.Size(100, 33); this.btnOpen.Size = new System.Drawing.Size(100, 33);
this.btnOpen.TabIndex = 86; this.btnOpen.TabIndex = 86;
...@@ -2328,7 +2385,7 @@ ...@@ -2328,7 +2385,7 @@
// //
// btnStatusSearch // btnStatusSearch
// //
this.btnStatusSearch.Location = new System.Drawing.Point(282, 95); this.btnStatusSearch.Location = new System.Drawing.Point(282, 88);
this.btnStatusSearch.Name = "btnStatusSearch"; this.btnStatusSearch.Name = "btnStatusSearch";
this.btnStatusSearch.Size = new System.Drawing.Size(100, 33); this.btnStatusSearch.Size = new System.Drawing.Size(100, 33);
this.btnStatusSearch.TabIndex = 85; this.btnStatusSearch.TabIndex = 85;
...@@ -2339,7 +2396,7 @@ ...@@ -2339,7 +2396,7 @@
// label19 // label19
// //
this.label19.AutoSize = true; this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(5, 70); this.label19.Location = new System.Drawing.Point(5, 63);
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;
...@@ -2347,7 +2404,7 @@ ...@@ -2347,7 +2404,7 @@
// //
// txtLinePosition // txtLinePosition
// //
this.txtLinePosition.Location = new System.Drawing.Point(67, 66); this.txtLinePosition.Location = new System.Drawing.Point(67, 59);
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);
...@@ -2356,7 +2413,7 @@ ...@@ -2356,7 +2413,7 @@
// //
// btnHomeMove // btnHomeMove
// //
this.btnHomeMove.Location = new System.Drawing.Point(176, 129); this.btnHomeMove.Location = new System.Drawing.Point(176, 122);
this.btnHomeMove.Name = "btnHomeMove"; this.btnHomeMove.Name = "btnHomeMove";
this.btnHomeMove.Size = new System.Drawing.Size(100, 33); this.btnHomeMove.Size = new System.Drawing.Size(100, 33);
this.btnHomeMove.TabIndex = 12; this.btnHomeMove.TabIndex = 12;
...@@ -2366,7 +2423,7 @@ ...@@ -2366,7 +2423,7 @@
// //
// btnClearPosition // btnClearPosition
// //
this.btnClearPosition.Location = new System.Drawing.Point(387, 99); this.btnClearPosition.Location = new System.Drawing.Point(387, 88);
this.btnClearPosition.Name = "btnClearPosition"; this.btnClearPosition.Name = "btnClearPosition";
this.btnClearPosition.Size = new System.Drawing.Size(100, 33); this.btnClearPosition.Size = new System.Drawing.Size(100, 33);
this.btnClearPosition.TabIndex = 11; this.btnClearPosition.TabIndex = 11;
...@@ -2376,7 +2433,7 @@ ...@@ -2376,7 +2433,7 @@
// //
// btnStop // btnStop
// //
this.btnStop.Location = new System.Drawing.Point(282, 129); this.btnStop.Location = new System.Drawing.Point(282, 122);
this.btnStop.Name = "btnStop"; this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(100, 33); this.btnStop.Size = new System.Drawing.Size(100, 33);
this.btnStop.TabIndex = 10; this.btnStop.TabIndex = 10;
...@@ -2386,7 +2443,7 @@ ...@@ -2386,7 +2443,7 @@
// //
// btnLineAbsMove // btnLineAbsMove
// //
this.btnLineAbsMove.Location = new System.Drawing.Point(176, 61); this.btnLineAbsMove.Location = new System.Drawing.Point(176, 54);
this.btnLineAbsMove.Name = "btnLineAbsMove"; this.btnLineAbsMove.Name = "btnLineAbsMove";
this.btnLineAbsMove.Size = new System.Drawing.Size(100, 33); this.btnLineAbsMove.Size = new System.Drawing.Size(100, 33);
this.btnLineAbsMove.TabIndex = 9; this.btnLineAbsMove.TabIndex = 9;
...@@ -2397,7 +2454,7 @@ ...@@ -2397,7 +2454,7 @@
// label25 // label25
// //
this.label25.AutoSize = true; this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(5, 30); this.label25.Location = new System.Drawing.Point(5, 25);
this.label25.Name = "label25"; this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(56, 17); this.label25.Size = new System.Drawing.Size(56, 17);
this.label25.TabIndex = 1; this.label25.TabIndex = 1;
...@@ -2407,7 +2464,7 @@ ...@@ -2407,7 +2464,7 @@
// //
this.comboBoxPortName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxPortName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxPortName.FormattingEnabled = true; this.comboBoxPortName.FormattingEnabled = true;
this.comboBoxPortName.Location = new System.Drawing.Point(67, 26); this.comboBoxPortName.Location = new System.Drawing.Point(67, 21);
this.comboBoxPortName.Name = "comboBoxPortName"; this.comboBoxPortName.Name = "comboBoxPortName";
this.comboBoxPortName.Size = new System.Drawing.Size(103, 25); this.comboBoxPortName.Size = new System.Drawing.Size(103, 25);
this.comboBoxPortName.TabIndex = 0; this.comboBoxPortName.TabIndex = 0;
...@@ -2423,7 +2480,7 @@ ...@@ -2423,7 +2480,7 @@
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(575, 435); this.tabControl1.Size = new System.Drawing.Size(575, 446);
this.tabControl1.TabIndex = 301; this.tabControl1.TabIndex = 301;
// //
// tabPage2 // tabPage2
...@@ -2432,7 +2489,7 @@ ...@@ -2432,7 +2489,7 @@
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(567, 405); this.tabPage2.Size = new System.Drawing.Size(567, 416);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服调试"; this.tabPage2.Text = "伺服调试";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
...@@ -2443,7 +2500,7 @@ ...@@ -2443,7 +2500,7 @@
this.tabPage3.Controls.Add(this.groupBox1); 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(567, 405); this.tabPage3.Size = new System.Drawing.Size(567, 416);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "压紧轴调试"; this.tabPage3.Text = "压紧轴调试";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
...@@ -2593,6 +2650,16 @@ ...@@ -2593,6 +2650,16 @@
this.groupBox6.TabStop = false; this.groupBox6.TabStop = false;
this.groupBox6.Text = "批量上下料操作"; this.groupBox6.Text = "批量上下料操作";
// //
// lblBatchMsg
//
this.lblBatchMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBatchMsg.ForeColor = System.Drawing.Color.Red;
this.lblBatchMsg.Location = new System.Drawing.Point(14, 49);
this.lblBatchMsg.Name = "lblBatchMsg";
this.lblBatchMsg.Size = new System.Drawing.Size(472, 43);
this.lblBatchMsg.TabIndex = 233;
this.lblBatchMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnOpenDoor // btnOpenDoor
// //
this.btnOpenDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOpenDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
...@@ -2609,7 +2676,7 @@ ...@@ -2609,7 +2676,7 @@
this.lblWaitTragGo.AutoSize = true; this.lblWaitTragGo.AutoSize = true;
this.lblWaitTragGo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblWaitTragGo.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblWaitTragGo.ForeColor = System.Drawing.Color.Red; this.lblWaitTragGo.ForeColor = System.Drawing.Color.Red;
this.lblWaitTragGo.Location = new System.Drawing.Point(147, 104); this.lblWaitTragGo.Location = new System.Drawing.Point(141, 105);
this.lblWaitTragGo.Name = "lblWaitTragGo"; this.lblWaitTragGo.Name = "lblWaitTragGo";
this.lblWaitTragGo.Size = new System.Drawing.Size(250, 22); this.lblWaitTragGo.Size = new System.Drawing.Size(250, 22);
this.lblWaitTragGo.TabIndex = 231; this.lblWaitTragGo.TabIndex = 231;
...@@ -2618,7 +2685,7 @@ ...@@ -2618,7 +2685,7 @@
// btnWaitTrgGo // btnWaitTrgGo
// //
this.btnWaitTrgGo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnWaitTrgGo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnWaitTrgGo.Location = new System.Drawing.Point(19, 96); this.btnWaitTrgGo.Location = new System.Drawing.Point(22, 98);
this.btnWaitTrgGo.Name = "btnWaitTrgGo"; this.btnWaitTrgGo.Name = "btnWaitTrgGo";
this.btnWaitTrgGo.Size = new System.Drawing.Size(105, 38); this.btnWaitTrgGo.Size = new System.Drawing.Size(105, 38);
this.btnWaitTrgGo.TabIndex = 230; this.btnWaitTrgGo.TabIndex = 230;
...@@ -2703,70 +2770,16 @@ ...@@ -2703,70 +2770,16 @@
this.btnBatchInStore.UseVisualStyleBackColor = true; this.btnBatchInStore.UseVisualStyleBackColor = true;
this.btnBatchInStore.Click += new System.EventHandler(this.btnBatchInStore_Click); this.btnBatchInStore.Click += new System.EventHandler(this.btnBatchInStore_Click);
// //
// lblBatchMsg // lblComMsg
//
this.lblBatchMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBatchMsg.ForeColor = System.Drawing.Color.Red;
this.lblBatchMsg.Location = new System.Drawing.Point(14, 49);
this.lblBatchMsg.Name = "lblBatchMsg";
this.lblBatchMsg.Size = new System.Drawing.Size(472, 43);
this.lblBatchMsg.TabIndex = 233;
this.lblBatchMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// axis_5_Alarm
// //
this.axis_5_Alarm.IOName = ""; this.lblComMsg.AutoSize = true;
this.axis_5_Alarm.IOValue = 0; this.lblComMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.axis_5_Alarm.isCanClick = false; this.lblComMsg.ForeColor = System.Drawing.Color.Green;
this.axis_5_Alarm.Location = new System.Drawing.Point(418, 37); this.lblComMsg.Location = new System.Drawing.Point(29, 165);
this.axis_5_Alarm.Name = "axis_5_Alarm"; this.lblComMsg.Name = "lblComMsg";
this.axis_5_Alarm.Size = new System.Drawing.Size(43, 39); this.lblComMsg.Size = new System.Drawing.Size(80, 17);
this.axis_5_Alarm.TabIndex = 271; this.lblComMsg.TabIndex = 281;
// this.lblComMsg.Text = "步进电机信息";
// axis_1_Alarm
//
this.axis_1_Alarm.IOName = "";
this.axis_1_Alarm.IOValue = 0;
this.axis_1_Alarm.isCanClick = false;
this.axis_1_Alarm.Location = new System.Drawing.Point(116, 37);
this.axis_1_Alarm.Name = "axis_1_Alarm";
this.axis_1_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_1_Alarm.TabIndex = 264;
//
// axis_3_Alarm
//
this.axis_3_Alarm.IOName = "";
this.axis_3_Alarm.IOValue = 0;
this.axis_3_Alarm.isCanClick = false;
this.axis_3_Alarm.Location = new System.Drawing.Point(318, 37);
this.axis_3_Alarm.Name = "axis_3_Alarm";
this.axis_3_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_3_Alarm.TabIndex = 266;
//
// axis_2_Alarm
//
this.axis_2_Alarm.IOName = "";
this.axis_2_Alarm.IOValue = 0;
this.axis_2_Alarm.isCanClick = false;
this.axis_2_Alarm.Location = new System.Drawing.Point(213, 37);
this.axis_2_Alarm.Name = "axis_2_Alarm";
this.axis_2_Alarm.Size = new System.Drawing.Size(43, 39);
this.axis_2_Alarm.TabIndex = 265;
//
// btnUpdateSpeed
//
this.btnUpdateSpeed.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateSpeed.Cursor = System.Windows.Forms.Cursors.Default;
this.btnUpdateSpeed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateSpeed.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnUpdateSpeed.Location = new System.Drawing.Point(312, 156);
this.btnUpdateSpeed.Name = "btnUpdateSpeed";
this.btnUpdateSpeed.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpdateSpeed.Size = new System.Drawing.Size(90, 33);
this.btnUpdateSpeed.TabIndex = 310;
this.btnUpdateSpeed.Text = "更改速度";
this.btnUpdateSpeed.UseVisualStyleBackColor = true;
this.btnUpdateSpeed.Click += new System.EventHandler(this.btnUpdateSpeed_Click);
// //
// FrmStoreBox // FrmStoreBox
// //
...@@ -3036,6 +3049,7 @@ ...@@ -3036,6 +3049,7 @@
public System.Windows.Forms.Button btnUpdownP2; public System.Windows.Forms.Button btnUpdownP2;
private System.Windows.Forms.Label lblBatchMsg; private System.Windows.Forms.Label lblBatchMsg;
public System.Windows.Forms.Button btnUpdateSpeed; public System.Windows.Forms.Button btnUpdateSpeed;
private System.Windows.Forms.Label lblComMsg;
} }
} }
...@@ -87,7 +87,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -87,7 +87,7 @@ namespace OnlineStore.AutoInOutStore
//txtUpDownP1.Text = ktkPosition.UpDownAxis_DoorOPosition_P1.ToString(); //txtUpDownP1.Text = ktkPosition.UpDownAxis_DoorOPosition_P1.ToString();
} }
txtSpeed.Text = store.Config.CompressAxis_EndSpeed.ToString();
List<string> port = new List<string>(SerialPort.GetPortNames()); List<string> port = new List<string>(SerialPort.GetPortNames());
comboBoxPortName.DataSource = port; comboBoxPortName.DataSource = port;
if (port.IndexOf(store.Config.CompressAxis_PortName) >= 0) if (port.IndexOf(store.Config.CompressAxis_PortName) >= 0)
...@@ -1433,7 +1433,9 @@ namespace OnlineStore.AutoInOutStore ...@@ -1433,7 +1433,9 @@ namespace OnlineStore.AutoInOutStore
} }
private void btnGetPosition_Click(object sender, EventArgs e) private void btnGetPosition_Click(object sender, EventArgs e)
{ {
ShuoKeControls.GetABSPosition(store.Config.CompressAxis_Slv); int value = ShuoKeControls.GetABSPosition(store.Config.CompressAxis_Slv);
lblComMsg.Text=DateTime.Now.ToLongTimeString() + "实时位置:" + value;
} }
private void btnStop_Click(object sender, EventArgs e) private void btnStop_Click(object sender, EventArgs e)
{ {
...@@ -1460,7 +1462,8 @@ namespace OnlineStore.AutoInOutStore ...@@ -1460,7 +1462,8 @@ namespace OnlineStore.AutoInOutStore
} }
private void btnStatusSearch_Click(object sender, EventArgs e) private void btnStatusSearch_Click(object sender, EventArgs e)
{ {
ShuoKeControls.GetStatus(store.Config.CompressAxis_Slv); ShuoKeInfo info = ShuoKeControls.GetStatus(store.Config.CompressAxis_Slv);
lblComMsg.Text = info.ToShowStr();
} }
private void FormComStatus(bool isOpen) private void FormComStatus(bool isOpen)
{ {
......
...@@ -72,6 +72,12 @@ X22_气压检测: ...@@ -72,6 +72,12 @@ X22_气压检测:
20181219-20181224修改
批量出库时,轴先移动到检测点亮,然后下降指定的高度,叉子出到批量装置时,把料盘放在批量上下轴上。
增加配置:上料轴最大出料高度,
上料轴出料时需要距离检测信号下降的高度。
压紧轴改为同步返回数据模式,压紧轴增加计量检测功能。
......
...@@ -76,5 +76,7 @@ namespace OnlineStore.Common ...@@ -76,5 +76,7 @@ namespace OnlineStore.Common
/// 是否是代码运行,不需要连接设备 /// 是否是代码运行,不需要连接设备
/// </summary> /// </summary>
public static string CodeRun = "CodeRun"; public static string CodeRun = "CodeRun";
public static string ComAxisChangeValue = "ComAxisChangeValue";
} }
} }
...@@ -116,9 +116,9 @@ namespace OnlineStore.Common ...@@ -116,9 +116,9 @@ namespace OnlineStore.Common
private static byte[] buildCheckData(byte[] sendData, int length) private static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
......
...@@ -461,23 +461,23 @@ namespace OnlineStore.Common ...@@ -461,23 +461,23 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
/// <param name="s"></param> /// <param name="s"></param>
/// <returns></returns> /// <returns></returns>
public static byte[] StringToByte(string s) //public static byte[] StringToByte(string s)
{ //{
string temps = ReplaceSpace(s); // string temps = ReplaceSpace(s);
if (temps.Length % 2 != 0) // if (temps.Length % 2 != 0)
{ // {
temps = "0" + temps; // temps = "0" + temps;
} // }
byte[] tempb = new byte[50]; // byte[] tempb = new byte[50];
int j = 0; // int j = 0;
for (int i = 0; i < temps.Length; i = i + 2, j++) // for (int i = 0; i < temps.Length; i = i + 2, j++)
{ // {
tempb[j] = Convert.ToByte(temps.Substring(i, 2), 16); // tempb[j] = Convert.ToByte(temps.Substring(i, 2), 16);
} // }
byte[] send = new byte[j]; // byte[] send = new byte[j];
Array.Copy(tempb, send, j); // Array.Copy(tempb, send, j);
return send; // return send;
} //}
//除去空格 //除去空格
public static string ReplaceSpace(string str) public static string ReplaceSpace(string str)
...@@ -525,33 +525,33 @@ namespace OnlineStore.Common ...@@ -525,33 +525,33 @@ namespace OnlineStore.Common
pChecksum = check; pChecksum = check;
} }
public static void CalculateCRC(byte[] pByte, int nNumberOfBytes, out ushort pChecksum) //public static void CalculateCRC(byte[] pByte, int nNumberOfBytes, out ushort pChecksum)
{ //{
int nBit; // int nBit;
ushort nShiftedBit; // ushort nShiftedBit;
pChecksum = 0xFFFF; // pChecksum = 0xFFFF;
for (int nByte = 0; nByte < nNumberOfBytes; nByte++) // for (int nByte = 0; nByte < nNumberOfBytes; nByte++)
{ // {
pChecksum ^= pByte[nByte]; // pChecksum ^= pByte[nByte];
for (nBit = 0; nBit < 8; nBit++) // for (nBit = 0; nBit < 8; nBit++)
{ // {
if ((pChecksum & 0x1) == 1) // if ((pChecksum & 0x1) == 1)
{ // {
nShiftedBit = 1; // nShiftedBit = 1;
} // }
else // else
{ // {
nShiftedBit = 0; // nShiftedBit = 0;
} // }
pChecksum >>= 1; // pChecksum >>= 1;
if (nShiftedBit != 0) // if (nShiftedBit != 0)
{ // {
pChecksum ^= 0xA001; // pChecksum ^= 0xA001;
} // }
} // }
} // }
} //}
#endregion #endregion
} }
......
...@@ -67,12 +67,13 @@ ...@@ -67,12 +67,13 @@
<Compile Include="PanasonicServo\ACCMDManager.cs" /> <Compile Include="PanasonicServo\ACCMDManager.cs" />
<Compile Include="PanasonicServo\ACServerManager.cs" /> <Compile Include="PanasonicServo\ACServerManager.cs" />
<Compile Include="PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="ShuoKe\MeteringSignalBean.cs" />
<Compile Include="ShuoKe\ShuoKeController.cs" />
<Compile Include="store\LineMoveP.cs" /> <Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs"> <Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.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\InOrOutStoreParam.cs"> <Compile Include="store\InOrOutStoreParam.cs">
......
...@@ -141,9 +141,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -141,9 +141,9 @@ namespace OnlineStore.DeviceLibrary
public static byte[] buildCheckData(byte[] sendData, int length) public static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
...@@ -186,7 +186,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -186,7 +186,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteCoil; sendData[1] = CMD_WriteCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(dataValue); byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -219,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadCoil; sendData[1] = CMD_ReadCoil;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -231,7 +231,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -231,7 +231,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(length.ToString()); byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -262,7 +262,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -262,7 +262,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8 ]; byte[] sendData = new byte[8 ];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_ReadRegisters; sendData[1] = CMD_ReadRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -274,7 +274,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -274,7 +274,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(length.ToString()); byte[] dataByte = AcSerialBean.StringToByte(length.ToString());
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
...@@ -304,7 +304,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -304,7 +304,7 @@ namespace OnlineStore.DeviceLibrary
byte[] sendData = new byte[8]; byte[] sendData = new byte[8];
sendData[0] = (byte)slvAddr; sendData[0] = (byte)slvAddr;
sendData[1] = CMD_WriteRegisters; sendData[1] = CMD_WriteRegisters;
byte[] addrByte = SerialBean.StringToByte(addr.ToString()); byte[] addrByte = AcSerialBean.StringToByte(addr.ToString());
if (addrByte.Length == 1) if (addrByte.Length == 1)
{ {
sendData[2] = 0x00; sendData[2] = 0x00;
...@@ -316,7 +316,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -316,7 +316,7 @@ namespace OnlineStore.DeviceLibrary
sendData[2] = addrByte[0]; sendData[2] = addrByte[0];
} }
byte[] dataByte = SerialBean.StringToByte(dataValue); byte[] dataByte = AcSerialBean.StringToByte(dataValue);
if (dataByte.Length == 1) if (dataByte.Length == 1)
{ {
sendData[4] = 0x00; sendData[4] = 0x00;
......
...@@ -246,8 +246,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -246,8 +246,8 @@ namespace OnlineStore.DeviceLibrary
public static void RelMove(string portName, int slvAddr, int position) public static void RelMove(string portName, int slvAddr, int position)
{ {
//int position = Convert.ToInt32(txtPosition.Text); //int position = Convert.ToInt32(txtPosition.Text);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8")); byte[] positionData = AcSerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff"); byte[] data = AcSerialBean.StringToByte("0110480C 000408 10000111EC78FFFF ffff");
data[0] = (byte)slvAddr; data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
...@@ -397,8 +397,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,8 +397,8 @@ namespace OnlineStore.DeviceLibrary
public static void AbsMove(string portName, int slvAddr, int position) public static void AbsMove(string portName, int slvAddr, int position)
{ {
//int position = Convert.ToInt32(txtPosition.Text, 10); //int position = Convert.ToInt32(txtPosition.Text, 10);
byte[] positionData = SerialBean.StringToByte(position.ToString("X8")); byte[] positionData = AcSerialBean.StringToByte(position.ToString("X8"));
byte[] data = SerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff"); byte[] data = AcSerialBean.StringToByte("01104808 000408 10000211 EC78FFFF ffff");
data[0] = (byte)slvAddr; data[0] = (byte)slvAddr;
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
......
...@@ -41,7 +41,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -41,7 +41,7 @@ namespace OnlineStore.DeviceLibrary
//} //}
public static void SendStrAndSleep(string portName, string str, int sleepS) public static void SendStrAndSleep(string portName, string str, int sleepS)
{ {
byte[] data = SerialBean.StringToByte(str); byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2); data = ACCMDManager.buildCheckData(data, data.Length - 2);
...@@ -50,7 +50,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,7 +50,7 @@ namespace OnlineStore.DeviceLibrary
} }
public static void SendStr(string portName, string str) public static void SendStr(string portName, string str)
{ {
byte[] data = SerialBean.StringToByte(str); byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2); data = ACCMDManager.buildCheckData(data, data.Length - 2);
...@@ -283,7 +283,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -283,7 +283,7 @@ namespace OnlineStore.DeviceLibrary
public static void SendStr(string portName, int slvAddr, string str) public static void SendStr(string portName, int slvAddr, string str)
{ {
//string str = txtSendStr.Text; //string str = txtSendStr.Text;
byte[] data = SerialBean.StringToByte(str); byte[] data = AcSerialBean.StringToByte(str);
data[data.Length - 1] = 0x00; data[data.Length - 1] = 0x00;
data[data.Length - 2] = 0x00; data[data.Length - 2] = 0x00;
data = ACCMDManager.buildCheckData(data, data.Length - 2); data = ACCMDManager.buildCheckData(data, data.Length - 2);
......
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 压紧机构计量检测信号处理
/// </summary>
public class MeteringSignal
{
public static int ComAxisChangeValue = ConfigAppSettings.GetIntValue(Setting_Init.ComAxisChangeValue);
/// <summary>
/// 信号变化次数
/// </summary>
public static int SignalChangeCount=0;
public static int TragetChangeCount = 0;
public static IO_VALUE PreSignalValue = IO_VALUE.LOW;
private static System.Timers.Timer timer = null;
public static void StartCheck(int targetPositon, int currPosition)
{
int chazhi = Math.Abs(targetPositon - currPosition);
int count = chazhi / ComAxisChangeValue;
if (count > 0 && chazhi > ComAxisChangeValue)
{
StartCheck(count);
}
}
private static void StartCheck(int targetCount)
{
TragetChangeCount = targetCount;
if (timer == null)
{
timer = new System.Timers.Timer();
timer.Interval = 50;
timer.AutoReset = true;
timer.Elapsed += Timer_Elapsed;
timer.Enabled = false;
}
LogUtil.debug("开始压紧轴计量检测,预计变化" + TragetChangeCount + "次");
IsInProcess = false;
PreSignalValue = IO_VALUE.LOW;
SignalChangeCount = 0;
timer.Start();
}
public static void StopCheck()
{
if(timer==null)
{ return; }
timer.Stop();
}
private static bool IsInProcess = false;
protected static void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (IsInProcess) { return; }
IsInProcess = true;
IO_VALUE value = KND.IOValue(IO_Type.CompressAxis_Check);
if (value.Equals(IO_VALUE.HIGH) && PreSignalValue.Equals(IO_VALUE.LOW))
{
SignalChangeCount++;
LogUtil.debug("检测到信号变化,已经变化" + SignalChangeCount + "次");
}
PreSignalValue = value;
if (TragetChangeCount <= SignalChangeCount)
{
timer.Stop();
}
IsInProcess = false;
}
}
}
using log4net;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 硕科控制模块代码
/// </summary>
public class ShuoKeControls
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static AcSerialBean bean = null;
public static bool isRun = false;
private static Dictionary<int, ShuoKeInfo> shuokeMap = new Dictionary<int, ShuoKeInfo>();
public static string PortName = "";
private static int SleepMS = 50;
private static int DReviceLength = 5;
#region 串口操作
public static bool ResertInitPort(string comPortName, int baudRate, int tparity, int dataBits, StopBits stopBits)
{
PortName = comPortName;
if (isRun)
{
ClosePort();
}
return InitPort(comPortName, baudRate, tparity, dataBits, stopBits);
}
public static bool InitPort(string comPortName, int baudRate, int tparity, int dataBits, StopBits stopBits)
{
if (isRun)
{
return true;
}
try
{
PortName = comPortName;
Parity parity = (Parity)tparity;
bean = new AcSerialBean(comPortName, baudRate, parity, 8, stopBits);
bool result = bean.openPort();
if (!result)
{
return false;
}
//bean.DataReceived += DataReceived;
isRun = true;
}
catch (Exception ex)
{
isRun = false;
LogUtil.error(LOGGER, "打开步进控制器串口失败:" + ex.ToString());
return false;
}
return true;
}
public static void ClosePort()
{
isRun = false;
if (bean == null)
{
return;
}
bean.closePort();
LogUtil.info(LOGGER, "关闭步进控制器串口完成");
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <returns>返回值的长度</returns>
public static byte[] SendCommand( byte[] data, int outTime, int reviceLength)
{
if (outTime <= 0)
{
outTime = 30;
}
if (outTime > 80)
{
outTime = 80;
}
byte[] returnData = null;
try
{
if (data == null)
{
return returnData;
}
string strSend = "";
for (int i = 0; i < data.Length; i++)
{
strSend += string.Format("{0:X2} ", data[i]);
}
if (strSend.Equals(""))
{
return returnData;
}
LogUtil.debug("串口" + PortName + " 写入数据:" + strSend + "");
if (bean == null)
{
LogUtil.debug(" 试图向未打开串口【" + PortName + "】写入数据:" + strSend + "。");
}
else
{
bean.SendCommand(data, ref returnData, outTime, reviceLength);
}
}
catch (Exception ex)
{
LogUtil.info(ex.ToString());
}
return returnData;
}
private static void DataReceived(string portName, object sender, SerialDataReceivedEventArgs e, byte[] bits)
{
string strSend = "";
for (int i = 0; i < bits.Length; i++)
{
strSend += string.Format("{0:X2} ", bits[i]);
}
if (strSend.Equals(""))
{
return;
}
//校验
ushort pChecksum = 0;
AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
if (!bits[bits.Length - 2].Equals(checkByte[0]))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】,校验错误");
return;
}
}
else
{
if (!bits[bits.Length - 1].Equals(checkByte[0]) || (!bits[bits.Length - 2].Equals(checkByte[1])))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】,校验错误");
return;
}
}
LogUtil.debug(LOGGER, " 【" + portName + "】 收到数据【" + strSend + "】");
int slvAddr = (int)bits[0];
byte cmd = bits[1];
//查询状态
if (cmd.Equals(ShuoKeCMD.SearchMoveStatus))
{
ShuoKeInfo info = DataToStatus(bits);
}
else if (cmd.Equals(ShuoKeCMD.GetAbsPosition))
{
int position = DataToPosition(bits);
}
}
private static bool CheckByte(byte[] bits)
{
string strSend = "";
for (int i = 0; i < bits.Length; i++)
{
strSend += string.Format("{0:X2} ", bits[i]);
}
//校验
ushort pChecksum = 0;
AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
if (!bits[bits.Length - 2].Equals(checkByte[0]))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, "【" + PortName + "】收到数据【" + strSend + "】校验错误");
return false ;
}
}
else
{
if (!bits[bits.Length - 1].Equals(checkByte[0]) || (!bits[bits.Length - 2].Equals(checkByte[1])))
{
bean.clearInBuffer();
LogUtil.info(LOGGER, "【" + PortName + "】收到数据【" + strSend + "】校验错误");
return false ;
}
}return true;
}
private static int DataToPosition(byte[] bits)
{
int absValue = -1;
if (!CheckByte(bits))
{
return absValue;
}
if (bits.Length >= 7)
{
int slvAddr = (int)bits[0];
byte[] positionData = new byte[4];
Array.Copy(bits, 3, positionData, 0, 4);
string a = AcSerialBean.byteToHexStr(positionData);
absValue = Convert.ToInt32(a, 16);
LogUtil.debug(LOGGER, "收到驱动器【" + slvAddr + "】绝对位置【" + absValue + "】");
if (shuokeMap.ContainsKey(slvAddr))
{
shuokeMap[slvAddr].LastPosition = absValue;
}
else
{
ShuoKeInfo info = new ShuoKeInfo(slvAddr, absValue);
shuokeMap.Add(slvAddr, info);
}
}
return absValue;
}
private static ShuoKeInfo DataToStatus(byte[] bits)
{
ShuoKeInfo info = new ShuoKeInfo(-1, -1);
if (!CheckByte(bits))
{
return info;
}
if (bits.Length >= 8)
{
//[数据1]:1表示运动中,0表示停止
//[数据2]:LL-左限位IO状态 1表示有效 0表示无效
//[数据3]:O-原点IO状态 1表示有效 0表示无效,,=1表示原点灭,=0表示当前原点亮
// [数据4]:RL-右限位IO状态 1表示有效 0表示无效
//[数据5]:EN-使能IO状态 1表示有效 0表示无效
int slvAddr = (int)bits[0];
byte cmd = bits[1];
int isInMove = bits[3];
int isLLimit = bits[4];
int isOrg = bits[5];
int isRLimit = bits[6];
int isEn = bits[7];
info = new ShuoKeInfo(isInMove, slvAddr, isLLimit, isOrg, isRLimit, isEn);
try
{
if (shuokeMap.ContainsKey(slvAddr))
{
info.LastPosition = shuokeMap[slvAddr].LastPosition;
shuokeMap.Remove(slvAddr);
}
shuokeMap.Add(slvAddr, info);
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "记录状态出错:" + ex.ToString());
}
LogUtil.debug(LOGGER, "收到驱动器【" + slvAddr + "】运动状态:运动【" + isInMove + "】左限位【" + isLLimit + "】右限位【" + isRLimit + "】原点【" + isOrg + "】使能【" + isEn + "】");
}
return info;
}
public static int GetLastPosition(int slvAddr)
{
if (shuokeMap.ContainsKey(slvAddr))
{
ShuoKeInfo info = shuokeMap[slvAddr];
return info.LastPosition;
}
return -1;
}
#endregion
#region 逻辑判断
public static bool IsMoveEnd(int slvAddr, int targetPosition, DateTime time, out string msg)
{
ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
msg = " IsInMove【" + shuokeInfo.IsInMove + "】 ";
if (shuokeInfo.IsInMove == 0 && shuokeInfo.UpdateTime > time)
{
int position = GetABSPosition(slvAddr);
msg += "位置【" + position + "】";
if (Math.Abs(position - targetPosition) < 10 || targetPosition.Equals(-2000))
{
return true;
}
else
{
LogUtil.info("【" + PortName + "】 目标位置【" + targetPosition + "】当前位置【" + position + "】,已经不再运动中");
}
}
return false;
}
public static bool IsHomeMoveEnd(int slvAddr, DateTime time, out string msg)
{
ShuoKeInfo shuokeInfo = GetStatus(slvAddr);
msg = " IsInMove【" + shuokeInfo.IsInMove + "】Org【" + shuokeInfo.Org + "】";
if (shuokeInfo.IsInMove .Equals(0) && shuokeInfo.Org.Equals(0)&&shuokeInfo.UpdateTime>time)
{
return true;
}
return false;
}
#endregion
#region 驱动器操作方法
public static ShuoKeInfo GetStatus(int slvAddr)
{
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.SearchMoveStatus, 0x00, 0,10);
return DataToStatus(reviceData);
}
public static void DStoop(int slvAddr)
{
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.DStopMove, 0x00, 0,DReviceLength);
}
public static void SuddownStop(int slvAddr)
{
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.SuddownStopMove, 0x00, 0, DReviceLength);
}
public static int GetABSPosition(int slvAddr)
{
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.GetAbsPosition, 0x00, 0, 9);
return DataToPosition(reviceData);
}
// <param name="homeType">0=反方向,1=正方向</param>
public static void HomeMove(int slvAddr, byte homeType)
{
string fangx = homeType.Equals(0) ? "反方向" : "正方向";
LogUtil.info("压紧轴原点返回:" + fangx);
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.HomeMove, 0x01, homeType, DReviceLength);
}
public static void SetConfigSpeed(AUTO_SA_Config Config)
{
ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetAddSpeed, Config.CompressAxis_AddSpeed);
ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetDelSpeed, Config.CompressAxis_DelSpeed);
ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetEndSpeed, Config.CompressAxis_EndSpeed);
ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetHomeSpeed, Config.CompressAxis_HomeSpeed);
ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetMaxSpeed, Config.CompressAxis_MaxSpeed);
ShuoKeControls.SetSpeed(Config.CompressAxis_Slv, ShuoKeCMD.SetStartSpeed, Config.CompressAxis_StartSpeed);
}
public static void VolMove(int slvAddr, int speed)
{
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.VolMove, 0x04, speed, DReviceLength);
}
public static void AbsMove(int slvAddr, int TargetPosition)
{
// 47、设置绝对位置并开始运动:不支持广播(开环的32位脉冲统计长度)
//正负数表示绝对位置,如果已经到位置,则不做运动。(M4505S特有命令)
//发送: 应答:
//[设备地址] 0x01 [设备地址] 0x01
//[命令] 0x50 [命令] 0x50
//[数据长度] 4 [数据长度] 0
//[数据] xxxxxxxx [数据] 无
//[CRC校验1] 0xnn [CRC校验1] 0xnn
//[CRC校验2] 0xnn [CRC校验2] 0xnn
//数据:4BYTE,(支持32位有符号脉冲位置)
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.AbsMove, 0x04, TargetPosition, DReviceLength);
}
public static void RelativeMove(int slvAddr, int position)
{
//1是正方向
byte fangxiang = 0x01;
if (position < 0)
{
fangxiang = 0x00;
position = Math.Abs(position);
}
byte dataLength = 0x04;
byte[] sendData = new byte[5 + dataLength];
sendData[0] = (byte)slvAddr;
sendData[1] = ShuoKeCMD.RelativeMove;
sendData[2] = dataLength;
sendData[3] = 0x00;
sendData[4] = 0x00;
sendData[5] = 0x00;
sendData[6] = 0x00;
string speed = Convert.ToString(position, 16);
byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++)
{
if (i >= 4)
{
break;
}
sendData[6 - (speedByte.Length - 1 - i)] = speedByte[i];
}
sendData[3] = fangxiang;
sendData = buildCheckData(sendData, 3 + dataLength);
byte[] reviceData = SendCommand(sendData,SleepMS,DReviceLength);
Thread.Sleep(SleepMS);
}
public static void PositionClear(int slvAddr, byte setCMD)
{
byte[] reviceData = SendData(slvAddr, setCMD, 0x00, 0, DReviceLength);
}
/// <summary>
/// 设置电机的速度
/// </summary>
/// <param name="slvAddr">电机地址</param>
/// <param name="setCMD">设置速度的命令号</param>
/// <param name="speedValue">速度值</param>
public static void SetSpeed(int slvAddr, byte setCMD, int speedValue)
{
byte[] reviceData = SendData(slvAddr, setCMD, 0x04, speedValue, DReviceLength);
Thread.Sleep(10);
}
private static byte[] SendData(int slvAddr, byte cmd, byte dataLength, int dataValue, int reviceDataLength)
{
byte[] sendData = new byte[5 + dataLength];
sendData[0] = (byte)slvAddr;
sendData[1] = cmd;
sendData[2] = dataLength;
if (dataLength.Equals(0x00))
{
}
else if (dataLength.Equals(0x01))
{
sendData[3] = (byte)dataValue;
}
else if (dataLength.Equals(0x04))
{
sendData[3] = 0x00;
sendData[4] = 0x00;
sendData[5] = 0x00;
sendData[6] = 0x00;
string speed = Convert.ToString(dataValue, 16);
byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++)
{
if (i >= 4)
{
break;
}
sendData[6 - (speedByte.Length - 1 - i)] = speedByte[i];
}
}
sendData = buildCheckData(sendData, 3 + dataLength);
byte[] reviceData = SendCommand(sendData, SleepMS, reviceDataLength);
Thread.Sleep(SleepMS);
return reviceData;
}
private static byte[] buildCheckData(byte[] sendData, int length)
{
ushort pChecksum = 0;
AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1)
{
sendData[length] = checkByte[0];
sendData[length + 1] = 0x00;
}
else
{
sendData[length + 1] = checkByte[0];
sendData[length] = checkByte[1];
}
return sendData;
}
#endregion
}
public class ShuoKeCMD
{
/// <summary>
/// 设置运动初速度://SndHex:01 25 04 00 00 00 64 FC DE
/// </summary>
public static byte SetStartSpeed = 0x25;
/// <summary>
/// 设置运动最大速度://SndHex:01 27 04 00 00 27 10 E6 EB
/// </summary>
public static byte SetMaxSpeed = 0x27;
/// <summary>
/// 设置运动末速度://SndHex:01 29 04 00 00 03 E8 FD 47
/// </summary>
public static byte SetEndSpeed = 0x29;
/// <summary>
/// 设置运动加速度://SndHex:01 2B 04 00 00 13 88 F1 4D
/// </summary>
public static byte SetAddSpeed = 0x2B;
/// <summary>
/// 设置运动减速度://SndHex:01 2D 04 00 00 03 E8 FC C3
/// </summary>
public static byte SetDelSpeed = 0x2D;
/// <summary>
/// 设置归零运动速度://SndHex:01 2F 04 00 00 27 10 E7 A3
/// </summary>
public static byte SetHomeSpeed = 0x2F;
/// <summary>
/// //查找原点命令:
//SndHex:01 3E 01 00 61 84
/// </summary>
public static byte HomeMove = 0x3E;
/// <summary>
/// 绝对位置运动//SndHex:01 50 04 FF FF D8 F0 AC 30
/// </summary>
public static byte AbsMove = 0x50;
/// <summary>
/// 急停命令://SndHex:01 3C 00 31 00
/// </summary>
public static byte SuddownStopMove = 0x3C;
/// <summary>
/// 减速停止命令://SndHex:01 3D 00 30 90
/// </summary>
public static byte DStopMove = 0x3D;
/// <summary>
/// 绝对位置清零: //SndHex:01 38 00 33 C0
/// </summary>
public static byte AbsPositionClear = 0x38;
/// <summary>
/// 相对位置清零: //SndHex:01 3A 00 32 A0
/// </summary>
public static byte RelPositionClear = 0x3A;
/// <summary>
/// 查询运动状态://SndHex:01 3B 00 33 30
/// </summary>
public static byte SearchMoveStatus = 0x3B;
/// <summary>
//查询设备地址://SndHex:00 21 00 69 90
/// </summary>
public static byte SearchSlvAddr = 0x21;
/// <summary>
/// 设置32位运动速度,并恒速运动:SndHex:01 33 04 00 00 27 10 E5 FF
/// </summary>
public static byte VolMove = 0x33;
/// <summary>
/// 查询绝对位置
/// </summary>
public static byte GetAbsPosition = 0x37;
/// <summary>
/// 相对位置运动
/// </summary>
public static byte RelativeMove = 0x32;
}
public class ShuoKeInfo
{
public ShuoKeInfo(int slv, int position)
{
this.IsInMove = -1;
this.SlvAddr = slv;
this.LLimit = -1;
this.RLimit = -1;
this.Org = -1;
this.En = -1;
UpdateTime = DateTime.Now;
LastPosition = position;
}
public ShuoKeInfo(int ismove, int slv, int ll, int org, int rl, int en)
{
this.IsInMove = ismove;
this.SlvAddr = slv;
this.LLimit = ll;
this.RLimit = rl;
this.Org = org;
this.En = en;
UpdateTime = DateTime.Now;
LastPosition = 0;
}
public int LastPosition { get; set; }
/// <summary>
/// 驱动器地址
/// </summary>
public int SlvAddr { get; set; }
/// <summary>
/// 是否在运动中
/// </summary>
public int IsInMove { get; set; }
/// <summary>
/// 左极限
/// </summary>
public int LLimit { get; set; }
/// <summary>
/// 右极限
/// </summary>
public int RLimit { get; set; }
/// <summary>
/// 原点信号是否有效
/// </summary>
public int Org { get; set; }
/// <summary>
/// 使能是否有效
/// </summary>
public int En { get; set; }
public DateTime UpdateTime { get; set; }
public string ToShowStr()
{
return "运动[" + IsInMove + "]左限位[" + LLimit + "]右限位[" + RLimit + "]原点[" + Org + "]使能[" + En + "][" + UpdateTime.ToShortTimeString() + "]";
}
}
}
...@@ -94,9 +94,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,9 +94,9 @@ namespace OnlineStore.DeviceLibrary
//校验 //校验
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum); AcSerialBean.CalculateCRC(bits, bits.Length - 2, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
if (!bits[bits.Length - 2].Equals(checkByte[0])) if (!bits[bits.Length - 2].Equals(checkByte[0]))
...@@ -299,7 +299,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,7 +299,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = 0x00; sendData[5] = 0x00;
sendData[6] = 0x00; sendData[6] = 0x00;
string speed = Convert.ToString(position, 16); string speed = Convert.ToString(position, 16);
byte[] speedByte = SerialBean.StringToByte(speed); byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++) for (int i = 0; i < speedByte.Length; i++)
{ {
...@@ -349,7 +349,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -349,7 +349,7 @@ namespace OnlineStore.DeviceLibrary
sendData[5] = 0x00; sendData[5] = 0x00;
sendData[6] = 0x00; sendData[6] = 0x00;
string speed = Convert.ToString(dataValue, 16); string speed = Convert.ToString(dataValue, 16);
byte[] speedByte = SerialBean.StringToByte(speed); byte[] speedByte = AcSerialBean.StringToByte(speed);
for (int i = 0; i < speedByte.Length; i++) for (int i = 0; i < speedByte.Length; i++)
{ {
...@@ -367,9 +367,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -367,9 +367,9 @@ namespace OnlineStore.DeviceLibrary
private static byte[] buildCheckData(byte[] sendData, int length) private static byte[] buildCheckData(byte[] sendData, int length)
{ {
ushort pChecksum = 0; ushort pChecksum = 0;
SerialBean.CalculateCRC(sendData, length, out pChecksum); AcSerialBean.CalculateCRC(sendData, length, out pChecksum);
string checkStr = Convert.ToString(pChecksum, 16); string checkStr = Convert.ToString(pChecksum, 16);
byte[] checkByte = SerialBean.StringToByte(checkStr); byte[] checkByte = AcSerialBean.StringToByte(checkStr);
if (checkByte.Length == 1) if (checkByte.Length == 1)
{ {
sendData[length] = checkByte[0]; sendData[length] = checkByte[0];
......
...@@ -139,7 +139,8 @@ PRO,(轴五)上料轴最大误差脉冲值,BatchAxis_ErrorCountMax,1000,,,,,,, ...@@ -139,7 +139,8 @@ 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,300,,,,,,, PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,300,,,,,,,
,,,,,,,,,, PRO,(轴五)上料轴出料时距离检测信号需要下降的高度,BatchAxis_OutDownPosition,3000,,,,,,,
PRO,(轴五)上料轴最最大料盘高度,到达后无法批量出库,BatchAxis_MaxHeight,100,,,,,,,
,,,,,,,,,, ,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.202.11#16;192.168.200.12#4,,,,,, , PRO,IO模块对应的DI数量,IO_DILength,192.168.202.11#16;192.168.200.12#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.202.11#16;192.168.200.12#4,,,,,,, PRO,模块对应的DO数量,IO_DOLength,192.168.202.11#16;192.168.200.12#4,,,,,,,
...@@ -292,24 +292,24 @@ namespace OnlineStore.DeviceLibrary ...@@ -292,24 +292,24 @@ namespace OnlineStore.DeviceLibrary
{ {
string portName = Config.InOut_Axis.DeviceName; string portName = Config.InOut_Axis.DeviceName;
int slvAddr = Config.InOut_Axis.GetAxisValue(); int slvAddr = Config.InOut_Axis.GetAxisValue();
if (ACServerManager.GetHomeEndStatus(portName, slvAddr).Equals(1) //if (ACServerManager.GetHomeEndStatus(portName, slvAddr).Equals(1)
&& ACServerManager.GetHomeSingle(portName, slvAddr).Equals(1)) // && ACServerManager.GetHomeSingle(portName, slvAddr).Equals(1))
{ //{
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutMove); // StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutMove);
LogUtil.info(LOGGER, StoreName + "复位中,进出轴原点亮且已经原点返回过,先相对走-5000"); // LogUtil.info(LOGGER, StoreName + "复位中,进出轴原点亮且已经原点返回过,先相对走-5000");
int currPos = ACServerManager.GetActualtPosition(portName, slvAddr); // int currPos = ACServerManager.GetActualtPosition(portName, slvAddr);
int targetPos = currPos - 5000; // int targetPos = currPos - 5000;
ACAxisMove(Config.InOut_Axis, targetPos, Config.InoutAxis_HomeLowSpeed); // ACAxisMove(Config.InOut_Axis, targetPos, Config.InoutAxis_HomeLowSpeed);
ResetCloseDoor(); // ResetCloseDoor();
} //}
else //else
{ //{
StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack); StoreMove.NextMoveStep(StoreMoveStep.BOX_H_InOutBack);
LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回"); LogUtil.info(LOGGER, StoreName + "复位中,进出轴开始原点返回");
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000)); StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
ResetCloseDoor(); ResetCloseDoor();
} //}
} }
/// <summary> /// <summary>
/// 复位处理 /// 复位处理
...@@ -426,9 +426,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -426,9 +426,17 @@ namespace OnlineStore.DeviceLibrary
} }
private void ComMoveToPosition(int targetPosition) private void ComMoveToPosition(int targetPosition)
{ {
ComMoveToPosition(targetPosition, false);
}
private void ComMoveToPosition(int targetPosition, bool isNeedCheckSingle)
{
if (IsHasCompress_Axis) if (IsHasCompress_Axis)
{ {
LogUtil.debug("压紧轴绝对运动目标位置:" + targetPosition); LogUtil.debug("压紧轴绝对运动目标位置:" + targetPosition);
if (isNeedCheckSingle)
{
MeteringSignal.StartCheck(targetPosition, ShuoKeControls.GetABSPosition(Config.CompressAxis_Slv));
}
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);
......
...@@ -204,29 +204,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -204,29 +204,32 @@ namespace OnlineStore.DeviceLibrary
} }
else if (wait.WaitType == (int)Wait_Type.ShuoKe_5) else if (wait.WaitType == (int)Wait_Type.ShuoKe_5)
{ {
ShuoKeInfo info = null; string msg = "";
if (wait.IsHomeMove) wait.IsEnd = ShuoKeIsEnd(wait, out msg);
{ NotOkMsg = NotOkMsg + " " + msg;
wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info); //ShuoKeInfo info = null;
} //if (wait.IsHomeMove)
else //{
{ // wait.IsEnd = ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info);
wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info); //}
} //else
if (!wait.IsEnd) //{
{ // wait.IsEnd = ShuoKeControls.IsMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out info);
if (info == null) //}
{ //if (!wait.IsEnd)
//{
// if (info == null)
// {
NotOkMsg += "info=null;"; // NotOkMsg += "info=null;";
} // }
else // else
{ // {
NotOkMsg += "" + info.ToShowStr(); // NotOkMsg += "" + info.ToShowStr();
} // }
ShuoKeControls.GetStatus(wait.SlvAddr); // ShuoKeControls.GetStatus(wait.SlvAddr);
} //}
} }
if (wait.IsEnd) if (wait.IsEnd)
{ {
...@@ -269,6 +272,36 @@ namespace OnlineStore.DeviceLibrary ...@@ -269,6 +272,36 @@ namespace OnlineStore.DeviceLibrary
Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType); Alarm(StoreAlarmType.IoSingleTimeOut, "", WarnMsg, StoreMove.MoveType);
} }
} }
private bool ShuoKeIsEnd(WaitResultInfo wait, out string msg)
{
//bool result = false;
msg = "";
if (wait.IsHomeMove)
{
return ShuoKeControls.IsHomeMoveEnd(wait.SlvAddr, StoreMove.LastSetpTime, out msg);
}
else
{
bool isend = ShuoKeControls.IsMoveEnd(wait.SlvAddr, wait.TargetPosition, StoreMove.LastSetpTime, out msg);
if (isend)
{
bool isCheckOk = (MeteringSignal.TragetChangeCount <= MeteringSignal.SignalChangeCount);
if (isCheckOk || MeteringSignal.TragetChangeCount <= 0)
{
MeteringSignal.StopCheck();
return true;
}
else
{
msg = "压紧轴计量检测目标【" + MeteringSignal.TragetChangeCount + "】实际【" + MeteringSignal.SignalChangeCount + "】";
LogUtil.error("压紧轴已经停止运动,但是 " + msg);
return false;
}
}
}
return false;
}
#endregion #endregion
...@@ -397,7 +430,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,7 +430,7 @@ namespace OnlineStore.DeviceLibrary
{ {
InStoreLog("入库:SI_06 压紧轴压紧,压紧轴到P2 "); InStoreLog("入库:SI_06 压紧轴压紧,压紧轴到P2 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_06_CompressWork); StoreMove.NextMoveStep(StoreMoveStep.SI_06_CompressWork);
ComMoveToPosition(moveP.ComPress_P2); ComMoveToPosition(moveP.ComPress_P2,true);
} }
else else
{ {
...@@ -471,7 +504,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -471,7 +504,7 @@ namespace OnlineStore.DeviceLibrary
//SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd); //SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag); StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3); ComMoveToPosition(moveP.ComPress_P3,true);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag) else if (StoreMove.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
...@@ -587,6 +620,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -587,6 +620,13 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
} }
int height = param.GetACPosition().BagHeight;
if (AutomaticBaiting.BatchOutStoreHeight+ height > Config.BatchAxis_MaxHeight)
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,当前高【"+ AutomaticBaiting.BatchOutStoreHeight + "】出库料盘高【"+ height + "】,最大高【"+ Config.BatchAxis_MaxHeight + "】");
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构已满,请先拿出料盘");
return false;
}
storeStatus = StoreStatus.OutStoreExecute; storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + logMsg); LogUtil.info(LOGGER, StoreName + logMsg);
...@@ -630,10 +670,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -630,10 +670,35 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep == StoreMoveStep.SO_02_DeviceBack) else if (StoreMove.MoveStep == StoreMoveStep.SO_02_DeviceBack)
{ {
StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition); StoreMove.NextMoveStep(StoreMoveStep.SO_03_ToBagPosition);
if (StoreMove.IsBatchInOutStore)
{
int targetValue = GetBatchTargetValue(Config.BatchAxis_OutDownPosition);
if (targetValue >= 1000 + moveP.BatchAxis_DownValue)
{
StoreMove.TimeOutSeconds = 120;
ACAxisMove(Config.Batch_Axis, targetValue, Config.BatchAxis_P1_Speed);
OutStoreLog("出库:SO_03 批量上下料轴下降【" + Config.BatchAxis_OutDownPosition + "】目标【" + targetValue + "】 ");
}
else
{
AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight =1000;
OutStoreLog("出库:SO_03批量上下料轴需要下降【" + Config.BatchAxis_OutDownPosition + "】目标【" + targetValue + "】 ,请检查料盘是否已满");
//停止出库
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.error(LOGGER, StoreName + " 【" + posId + "】 出库中断,请检查料盘是否已满,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
return;
}
}
OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)"); OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
ComMoveToPosition(moveP.ComPress_P3); ComMoveToPosition(moveP.ComPress_P3);
ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed); ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed); ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition) else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition)
{ {
...@@ -645,7 +710,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -645,7 +710,7 @@ namespace OnlineStore.DeviceLibrary
{ {
OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) "); OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice); StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
ComMoveToPosition(moveP.ComPress_P2); ComMoveToPosition(moveP.ComPress_P2,true);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed); ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
} }
else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice) else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice)
...@@ -707,7 +772,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -707,7 +772,7 @@ namespace OnlineStore.DeviceLibrary
{ {
StoreMove.NextMoveStep(StoreMoveStep.SO_11_PutTray); StoreMove.NextMoveStep(StoreMoveStep.SO_11_PutTray);
OutStoreLog("出库:SO_11_PutTray 放下料盘,升降轴到P8(出库低点),压紧轴至P3(压紧前点)"); OutStoreLog("出库:SO_11_PutTray 放下料盘,升降轴到P8(出库低点),压紧轴至P3(压紧前点)");
ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3); ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3,true);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_OutLow_P8, Config.UpDownAxis_P8_Speed); ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_OutLow_P8, Config.UpDownAxis_P8_Speed);
} }
else if (KND.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH)) else if (KND.IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.HIGH))
...@@ -770,15 +835,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -770,15 +835,19 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
private void BatchAxisUpTrayHeight() private int GetBatchTargetValue(int downValue)
{ {
//上料轴需要向下走
int currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis); int currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis);
if (currPosition.Equals(-1)) if (currPosition.Equals(-1))
{ {
currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis); currPosition = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis);
} }
int targetValue = currPosition - StoreMove.MoveParam.MoveP.BatchAxis_DownValue; int targetValue = currPosition - downValue;
return targetValue;
}
private void BatchAxisUpTrayHeight()
{
int targetValue = GetBatchTargetValue(StoreMove.MoveParam.MoveP.BatchAxis_DownValue);
//记录高度 //记录高度
AutomaticBaiting.BatchOutStoreCount++; AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetACPosition().BagHeight; AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.GetACPosition().BagHeight;
......
...@@ -566,6 +566,19 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -566,6 +566,19 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// PRO(轴五)上料轴出料时距离检测信号需要下降的高度 BatchAxis_OutDownPosition
///</summary>
[ConfigProAttribute("BatchAxis_OutDownPosition", true)]
public int BatchAxis_OutDownPosition { get; set; }
/// <summary>
/// PRO(轴五)上料轴最最大料盘高度,到达后无法批量出库 BatchAxis_MaxHeight
///</summary>
[ConfigProAttribute("BatchAxis_MaxHeight", true)]
public int BatchAxis_MaxHeight { get; set; }
/// <summary>
/// PRO,默认的料盘宽度(不可更改),Default_TrayWidth,7 /// PRO,默认的料盘宽度(不可更改),Default_TrayWidth,7
/// </summary> /// </summary>
[ConfigProAttribute("Default_TrayWidth")] [ConfigProAttribute("Default_TrayWidth")]
...@@ -581,6 +594,8 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -581,6 +594,8 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("IO_DOLength")] [ConfigProAttribute("IO_DOLength")]
public string IO_DOLength { get; set; } public string IO_DOLength { get; set; }
private Dictionary<string, ushort> DILengthMap = null; private Dictionary<string, ushort> DILengthMap = null;
private Dictionary<string, ushort> DOLengthMap = null; private Dictionary<string, ushort> DOLengthMap = null;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!