Commit 1eb794b3 刘韬

代码备份

1 个父辈 60d216c1
正在显示 35 个修改的文件 包含 2323 行增加550 行删除
...@@ -33,6 +33,17 @@ ...@@ -33,6 +33,17 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Asa.PrintLabel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\PrintLabel\PrintLabel\bin\Debug\Asa.PrintLabel.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.7703.30209, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath> <HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
...@@ -74,8 +85,20 @@ ...@@ -74,8 +85,20 @@
<Compile Include="IOControl.Designer.cs"> <Compile Include="IOControl.Designer.cs">
<DependentUpon>IOControl.cs</DependentUpon> <DependentUpon>IOControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="LogControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="LogControl.Designer.cs">
<DependentUpon>LogControl.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SettingControl.Designer.cs">
<DependentUpon>SettingControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AxisControl.resx"> <EmbeddedResource Include="AxisControl.resx">
<DependentUpon>AxisControl.cs</DependentUpon> <DependentUpon>AxisControl.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
...@@ -86,6 +109,9 @@ ...@@ -86,6 +109,9 @@
<EmbeddedResource Include="IOControl.resx"> <EmbeddedResource Include="IOControl.resx">
<DependentUpon>IOControl.cs</DependentUpon> <DependentUpon>IOControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="LogControl.resx">
<DependentUpon>LogControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
...@@ -96,6 +122,9 @@ ...@@ -96,6 +122,9 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<EmbeddedResource Include="SettingControl.resx">
<DependentUpon>SettingControl.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
...@@ -41,7 +41,7 @@ namespace AutoScanAndLabel ...@@ -41,7 +41,7 @@ namespace AutoScanAndLabel
this.groupBox3.Controls.Add(this.tableLayoutPanel1); this.groupBox3.Controls.Add(this.tableLayoutPanel1);
this.groupBox3.Location = new System.Drawing.Point(565, 3); this.groupBox3.Location = new System.Drawing.Point(565, 3);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(628, 545); this.groupBox3.Size = new System.Drawing.Size(628, 520);
this.groupBox3.TabIndex = 107; this.groupBox3.TabIndex = 107;
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = "点位列表"; this.groupBox3.Text = "点位列表";
...@@ -62,12 +62,12 @@ namespace AutoScanAndLabel ...@@ -62,12 +62,12 @@ namespace AutoScanAndLabel
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(616, 525); this.tableLayoutPanel1.Size = new System.Drawing.Size(616, 500);
this.tableLayoutPanel1.TabIndex = 102; this.tableLayoutPanel1.TabIndex = 102;
// //
// btnSavePos // btnSavePos
// //
this.btnSavePos.Location = new System.Drawing.Point(1054, 554); this.btnSavePos.Location = new System.Drawing.Point(1054, 529);
this.btnSavePos.Name = "btnSavePos"; this.btnSavePos.Name = "btnSavePos";
this.btnSavePos.Size = new System.Drawing.Size(133, 31); this.btnSavePos.Size = new System.Drawing.Size(133, 31);
this.btnSavePos.TabIndex = 108; this.btnSavePos.TabIndex = 108;
...@@ -92,6 +92,7 @@ namespace AutoScanAndLabel ...@@ -92,6 +92,7 @@ namespace AutoScanAndLabel
this.Font = new System.Drawing.Font("新宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Font = new System.Drawing.Font("新宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "AxisControl"; this.Name = "AxisControl";
this.Size = new System.Drawing.Size(1274, 602); this.Size = new System.Drawing.Size(1274, 602);
this.Load += new System.EventHandler(this.AxisControl_Load);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
......
...@@ -38,20 +38,23 @@ namespace AutoScanAndLabel ...@@ -38,20 +38,23 @@ namespace AutoScanAndLabel
Random random = new Random(1); Random random = new Random(1);
Color color = Color.Black; Color color = Color.Black;
foreach (ConfigBase configBase in RobotManage.Config.configList) { foreach (ConfigBase configBase in RobotManage.Config.configList) {
if (configBase.SubType < 10 || configBase.ProType != "PRO") if (configBase.SubType < 10 || configBase.SubType>20 || configBase.ProType != "PRO")
continue; continue;
if (configBase.SubType != lastSubType) if (configBase.SubType != lastSubType)
{ {
if (lastSubType > 0)
r++;
lastSubType = configBase.SubType; lastSubType = configBase.SubType;
color = Color.FromArgb(random.Next(30,150), random.Next(30, 150), random.Next(30, 150)); color = Color.FromArgb(random.Next(30,150), random.Next(30, 150), random.Next(30, 150));
} }
//this.tableLayoutPanel1.RowCount++; //this.tableLayoutPanel1.RowCount++;
Button button = new Button(); Button button = new Button();
button.FlatStyle = System.Windows.Forms.FlatStyle.Flat; button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); button.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
button.Name = configBase.ProName; button.Name = configBase.ProName;
button.Size = new System.Drawing.Size(225, 34); button.Size = new System.Drawing.Size(225, 27);
button.Text = configBase.Explain; button.Text = configBase.Explain;
button.Click += Button_Click; button.Click += Button_Click;
button.ForeColor = color; button.ForeColor = color;
...@@ -77,11 +80,12 @@ namespace AutoScanAndLabel ...@@ -77,11 +80,12 @@ namespace AutoScanAndLabel
tableLayoutPanel1.Controls.Add(button, c, r); tableLayoutPanel1.Controls.Add(button, c, r);
tableLayoutPanel1.Controls.Add(textBox, c + 1, r); tableLayoutPanel1.Controls.Add(textBox, c + 1, r);
if (configBase.SubType<20)
tableLayoutPanel1.Controls.Add(textBox2, c + 2, r); tableLayoutPanel1.Controls.Add(textBox2, c + 2, r);
r++; r++;
if (r > 12) if (r > 15)
{ {
r = 0; r = 0;
c += 3; c += 3;
...@@ -135,9 +139,15 @@ namespace AutoScanAndLabel ...@@ -135,9 +139,15 @@ namespace AutoScanAndLabel
TextBox textBox = (TextBox)tableLayoutPanel1.Controls[i]; TextBox textBox = (TextBox)tableLayoutPanel1.Controls[i];
PropertyInfo pi= RobotManage.Config.GetType().GetProperty(textBox.Name); PropertyInfo pi= RobotManage.Config.GetType().GetProperty(textBox.Name);
if(pi!=null)
pi.SetValue(RobotManage.Config, int.Parse(textBox.Text)); pi.SetValue(RobotManage.Config, int.Parse(textBox.Text));
} }
CSVConfigReader.SaveConfig(RobotManage.Config.ConfigFilePath, RobotManage.Config); CSVConfigReader.SaveConfig(RobotManage.Config.ConfigFilePath, RobotManage.Config);
} }
private void AxisControl_Load(object sender, EventArgs e)
{
}
} }
} }
...@@ -31,22 +31,22 @@ namespace AutoScanAndLabel ...@@ -31,22 +31,22 @@ namespace AutoScanAndLabel
{ {
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.设备操作ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.设备操作ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.启动ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.复位ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.停止ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.启用调试模式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.启用调试模式ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.cb_IgnoreSafecheck = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.stateView = new System.Windows.Forms.ListView();
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = new System.Windows.Forms.Button(); this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button(); this.btn_run = new System.Windows.Forms.Button();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.cb_IgnoreGratingSignal = new System.Windows.Forms.CheckBox();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// menuStrip1 // menuStrip1
...@@ -57,19 +57,13 @@ namespace AutoScanAndLabel ...@@ -57,19 +57,13 @@ namespace AutoScanAndLabel
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1342, 29); this.menuStrip1.Size = new System.Drawing.Size(1350, 29);
this.menuStrip1.TabIndex = 0; this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
// //
// 设备操作ToolStripMenuItem // 设备操作ToolStripMenuItem
// //
this.设备操作ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.设备操作ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.启动ToolStripMenuItem,
this.toolStripSeparator1,
this.复位ToolStripMenuItem,
this.toolStripSeparator2,
this.停止ToolStripMenuItem,
this.toolStripSeparator3,
this.启用调试模式ToolStripMenuItem, this.启用调试模式ToolStripMenuItem,
this.toolStripSeparator4, this.toolStripSeparator4,
this.退出ToolStripMenuItem}); this.退出ToolStripMenuItem});
...@@ -78,56 +72,24 @@ namespace AutoScanAndLabel ...@@ -78,56 +72,24 @@ namespace AutoScanAndLabel
this.设备操作ToolStripMenuItem.Size = new System.Drawing.Size(86, 25); this.设备操作ToolStripMenuItem.Size = new System.Drawing.Size(86, 25);
this.设备操作ToolStripMenuItem.Text = "设备操作"; this.设备操作ToolStripMenuItem.Text = "设备操作";
// //
// 启动ToolStripMenuItem
//
this.启动ToolStripMenuItem.Name = "启动ToolStripMenuItem";
this.启动ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.启动ToolStripMenuItem.Text = "启动";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
//
// 复位ToolStripMenuItem
//
this.复位ToolStripMenuItem.Name = "复位ToolStripMenuItem";
this.复位ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复位ToolStripMenuItem.Text = "复位";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// 停止ToolStripMenuItem
//
this.停止ToolStripMenuItem.Name = "停止ToolStripMenuItem";
this.停止ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.停止ToolStripMenuItem.Text = "停止";
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
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(180, 26); this.启用调试模式ToolStripMenuItem.Size = new System.Drawing.Size(176, 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(177, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(173, 6);
// //
// 退出ToolStripMenuItem // 退出ToolStripMenuItem
// //
this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退出ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.退出ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Text = "退出";
this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click);
// //
// tabControl1 // tabControl1
// //
...@@ -139,28 +101,76 @@ namespace AutoScanAndLabel ...@@ -139,28 +101,76 @@ namespace AutoScanAndLabel
this.tabControl1.Location = new System.Drawing.Point(0, 106); this.tabControl1.Location = new System.Drawing.Point(0, 106);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1342, 618); this.tabControl1.Size = new System.Drawing.Size(1350, 605);
this.tabControl1.TabIndex = 1; this.tabControl1.TabIndex = 1;
// //
// tabPage1
//
this.tabPage1.Controls.Add(this.cb_IgnoreGratingSignal);
this.tabPage1.Controls.Add(this.cb_IgnoreSafecheck);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 30);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(1342, 571);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// cb_IgnoreSafecheck
//
this.cb_IgnoreSafecheck.AutoSize = true;
this.cb_IgnoreSafecheck.Location = new System.Drawing.Point(653, 42);
this.cb_IgnoreSafecheck.Name = "cb_IgnoreSafecheck";
this.cb_IgnoreSafecheck.Size = new System.Drawing.Size(215, 25);
this.cb_IgnoreSafecheck.TabIndex = 2;
this.cb_IgnoreSafecheck.Text = "忽略安全检查(含安全光栅)";
this.cb_IgnoreSafecheck.UseVisualStyleBackColor = true;
this.cb_IgnoreSafecheck.CheckedChanged += new System.EventHandler(this.cb_IgnoreSafecheck_CheckedChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.stateView);
this.groupBox1.Location = new System.Drawing.Point(21, 32);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(598, 225);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "运行状态";
//
// stateView
//
this.stateView.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.stateView.Dock = System.Windows.Forms.DockStyle.Fill;
this.stateView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.stateView.HideSelection = false;
this.stateView.Location = new System.Drawing.Point(3, 25);
this.stateView.MultiSelect = false;
this.stateView.Name = "stateView";
this.stateView.Size = new System.Drawing.Size(592, 197);
this.stateView.TabIndex = 0;
this.stateView.UseCompatibleStateImageBehavior = false;
//
// listView1 // listView1
// //
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.listView1.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.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(516, 0); this.listView1.Location = new System.Drawing.Point(516, 0);
this.listView1.MultiSelect = false; this.listView1.MultiSelect = false;
this.listView1.Name = "listView1"; this.listView1.Name = "listView1";
this.listView1.ShowGroups = false; this.listView1.ShowGroups = false;
this.listView1.Size = new System.Drawing.Size(826, 134); this.listView1.Size = new System.Drawing.Size(834, 134);
this.listView1.TabIndex = 2; this.listView1.TabIndex = 2;
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.UseCompatibleStateImageBehavior = false;
// //
// btn_stop // btn_stop
// //
this.btn_stop.Location = new System.Drawing.Point(131, 57); this.btn_stop.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stop.Location = new System.Drawing.Point(149, 47);
this.btn_stop.Name = "btn_stop"; this.btn_stop.Name = "btn_stop";
this.btn_stop.Size = new System.Drawing.Size(75, 23); this.btn_stop.Size = new System.Drawing.Size(105, 37);
this.btn_stop.TabIndex = 3; this.btn_stop.TabIndex = 3;
this.btn_stop.Text = "停止"; this.btn_stop.Text = "停止";
this.btn_stop.UseVisualStyleBackColor = true; this.btn_stop.UseVisualStyleBackColor = true;
...@@ -168,29 +178,32 @@ namespace AutoScanAndLabel ...@@ -168,29 +178,32 @@ namespace AutoScanAndLabel
// //
// btn_run // btn_run
// //
this.btn_run.Location = new System.Drawing.Point(25, 57); this.btn_run.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_run.Location = new System.Drawing.Point(25, 47);
this.btn_run.Name = "btn_run"; this.btn_run.Name = "btn_run";
this.btn_run.Size = new System.Drawing.Size(75, 23); this.btn_run.Size = new System.Drawing.Size(105, 37);
this.btn_run.TabIndex = 4; this.btn_run.TabIndex = 4;
this.btn_run.Text = "启动"; this.btn_run.Text = "启动";
this.btn_run.UseVisualStyleBackColor = true; this.btn_run.UseVisualStyleBackColor = true;
this.btn_run.Click += new System.EventHandler(this.btn_run_Click); this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
// //
// tabPage1 // cb_IgnoreGratingSignal
// //
this.tabPage1.Location = new System.Drawing.Point(4, 30); this.cb_IgnoreGratingSignal.AutoSize = true;
this.tabPage1.Name = "tabPage1"; this.cb_IgnoreGratingSignal.Location = new System.Drawing.Point(653, 73);
this.tabPage1.Size = new System.Drawing.Size(1334, 584); this.cb_IgnoreGratingSignal.Name = "cb_IgnoreGratingSignal";
this.tabPage1.TabIndex = 0; this.cb_IgnoreGratingSignal.Size = new System.Drawing.Size(125, 25);
this.tabPage1.Text = "tabPage1"; this.cb_IgnoreGratingSignal.TabIndex = 2;
this.tabPage1.UseVisualStyleBackColor = true; this.cb_IgnoreGratingSignal.Text = "忽略安全光栅";
this.cb_IgnoreGratingSignal.UseVisualStyleBackColor = true;
this.cb_IgnoreGratingSignal.CheckedChanged += new System.EventHandler(this.cb_IgnoreGratingSignal_CheckedChanged);
// //
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1342, 724); this.ClientSize = new System.Drawing.Size(1350, 711);
this.Controls.Add(this.btn_stop); this.Controls.Add(this.btn_stop);
this.Controls.Add(this.btn_run); this.Controls.Add(this.btn_run);
this.Controls.Add(this.listView1); this.Controls.Add(this.listView1);
...@@ -204,6 +217,9 @@ namespace AutoScanAndLabel ...@@ -204,6 +217,9 @@ namespace AutoScanAndLabel
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -213,20 +229,18 @@ namespace AutoScanAndLabel ...@@ -213,20 +229,18 @@ namespace AutoScanAndLabel
private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem 设备操作ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 设备操作ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 启动ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem 复位ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem 停止ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 退出ToolStripMenuItem;
private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem 启用调试模式ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 启用调试模式ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.Button btn_stop; private System.Windows.Forms.Button btn_stop;
private System.Windows.Forms.Button btn_run; private System.Windows.Forms.Button btn_run;
private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.ListView stateView;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox cb_IgnoreSafecheck;
private System.Windows.Forms.CheckBox cb_IgnoreGratingSignal;
} }
} }
using DeviceLibrary; using CodeLibrary;
using ConfigHelper;
using DeviceLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -17,34 +19,115 @@ namespace AutoScanAndLabel ...@@ -17,34 +19,115 @@ namespace AutoScanAndLabel
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
this.FormClosing += Form1_FormClosing;
this.Text = Config.Get(Setting_Init.App_Title);
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
}
}
LogControl lc = new LogControl();
IOControl ioc = new IOControl();
AxisControl ac = new AxisControl();
SettingControl sc = new SettingControl();
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
List<CodeInfo> codeInfos = new List<CodeInfo>();
//codeInfos.Add(new CodeInfo("", 528, 406));
codeInfos.Add(new CodeInfo("", 925, 520));
//codeInfos.Add(new CodeInfo("", 564, 684));
var p = Common.CalcLabelPoint(codeInfos, new Point(672,456),200);
//MessageBox.Show(p.ToString());
//Point p1 = new Point(100, 100);
//Point p2 = new Point(1, 99);
//double a =Common.getAngle(p1, p2);
//a = a < 0 ? 360 - a : a;
////a = a - 180;
///MessageBox.Show(a.ToString());
//double d = 100;
//var x2 = p2.X + d * Math.Cos(a / 180 * Math.PI);
//var y2 = p2.Y + d * Math.Sin(a / 180 * Math.PI);
//MessageBox.Show(new Point((int)x2, (int)y2).ToString());
//MessageBox.Show(Common.PointRotate(p1, p2,83d/180*Math.PI).ToString());
btn_run.Enabled = false; btn_run.Enabled = false;
btn_stop.Enabled = false; btn_stop.Enabled = false;
#region 报警信息listview初始化
listView1.View = View.Details; listView1.View = View.Details;
ColumnHeader emptycol = new ColumnHeader();
emptycol.Text = "";
emptycol.Width = 0;
ColumnHeader msgcol = new ColumnHeader(); ColumnHeader msgcol = new ColumnHeader();
msgcol.Text = "信息"; msgcol.Text = "信息";
msgcol.Width = 600; msgcol.Width = 600;
ColumnHeader timecol = new ColumnHeader(); ColumnHeader timecol = new ColumnHeader();
timecol.Text = "时间"; timecol.Text = "时间";
timecol.Width = 150; timecol.Width = 150;
listView1.Columns.Add(emptycol);
listView1.Columns.Add(timecol); listView1.Columns.Add(timecol);
listView1.Columns.Add(msgcol); listView1.Columns.Add(msgcol);
listView1.ColumnWidthChanging += listView_ColumnWidthChanging;
#endregion
#region 状态信息listview初始化
stateView.View = View.Details;
ColumnHeader c1 = new ColumnHeader();
c1.Text = "";
c1.Width = 0;
ColumnHeader c2 = new ColumnHeader();
c2.Text = "模块";
c2.Width = 100;
ColumnHeader c3 = new ColumnHeader();
c3.Text = "步骤";
c3.Width = 100;
ColumnHeader c4 = new ColumnHeader();
c3.Text = "信息";
c3.Width = 300;
stateView.Columns.Add(c1);
stateView.Columns.Add(c2);
stateView.Columns.Add(c3);
stateView.ColumnWidthChanging += listView_ColumnWidthChanging;
#endregion
LogUtil.info("开始初始化"); LogUtil.info("开始初始化");
//MainControl mc = new MainControl();
//AddForm("控制", mc);
IOControl ioc = new IOControl();
AddForm("IO调试", ioc);
AxisControl ac = new AxisControl();
AddForm("伺服调试", ac);
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RobotManage.Init(); RobotManage.Init();
} }
private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
{
e.NewWidth = (sender as ListView).Columns[e.ColumnIndex].Width;
e.Cancel = true;
}
void addTablePage() {
AddForm("IO调试", ioc);
AddForm("伺服调试", ac);
AddForm("相关设置", sc);
AddForm("日志", lc);
}
public delegate void setstatedelegate(List<MoveInfo> moveinfoList);
private void MainMachine_ProcessMoveinfoEvent(List<MoveInfo> moveinfoList)
{
var d = new setstatedelegate(SetState);
this.Invoke(d, moveinfoList);
}
void SetState(List<MoveInfo> moveInfoList)
{
stateView.Items.Clear();
foreach (MoveInfo moveInfo in moveInfoList)
{
ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.Name, moveInfo.MoveStep.ToString() });
stateView.Items.Add(lvi);
}
}
private void AddForm(string text, UserControl form) private void AddForm(string text, UserControl form)
{ {
//text = text.PadLeft(10, ' '); //text = text.PadLeft(10, ' ');
...@@ -73,6 +156,17 @@ namespace AutoScanAndLabel ...@@ -73,6 +156,17 @@ namespace AutoScanAndLabel
(sender as ToolStripMenuItem).Text = !RobotManage.IsDebug ? "启用调试模式" : "停用调试模式"; (sender as ToolStripMenuItem).Text = !RobotManage.IsDebug ? "启用调试模式" : "停用调试模式";
RobotManage.Init(); RobotManage.Init();
if (RobotManage.IsDebug)
{
addTablePage();
}
else {
for (int i = tabControl1.TabPages.Count-1; i > 0; i--)
{
tabControl1.TabPages[i].Parent = null;
}
}
} }
public delegate void setmsgdelegate(List<Msg> msgs); public delegate void setmsgdelegate(List<Msg> msgs);
...@@ -89,19 +183,25 @@ namespace AutoScanAndLabel ...@@ -89,19 +183,25 @@ namespace AutoScanAndLabel
btn_run.Enabled = true; btn_run.Enabled = true;
btn_stop.Enabled = true; btn_stop.Enabled = true;
RobotManage.mainMachine.ProcessMsgEvent += MainMachine_ProcessMsgEvent; RobotManage.mainMachine.ProcessMsgEvent += MainMachine_ProcessMsgEvent;
RobotManage.mainMachine.ProcessMoveinfoEvent += MainMachine_ProcessMoveinfoEvent;
} }
var lm = new List<Msg>();
foreach (string ms in msg.Split(new char[] { '\n' },StringSplitOptions.RemoveEmptyEntries))
{
var m = new Msg(); var m = new Msg();
m.datetime = DateTime.Now; m.datetime = DateTime.Now;
m.msgtxt = msg; m.msgtxt = ms;
m.msgLevel = state ? MsgLevel.info : MsgLevel.warning; m.msgLevel = state ? MsgLevel.info : MsgLevel.warning;
SetMsg(new List<Msg> { m }); lm.Add(m);
}
SetMsg(lm);
} }
void SetMsg(List<Msg> msgs) void SetMsg(List<Msg> msgs)
{ {
listView1.Items.Clear(); listView1.Items.Clear();
foreach (Msg msg in msgs) foreach (Msg msg in msgs)
{ {
ListViewItem lvi = new ListViewItem(new string[] { msg.datetime.ToString(), msg.msgtxt }); ListViewItem lvi = new ListViewItem(new string[] {"", msg.datetime.ToString(), msg.msgtxt });
if (msg.msgLevel==MsgLevel.info) if (msg.msgLevel==MsgLevel.info)
lvi.ForeColor = Color.DarkGreen; lvi.ForeColor = Color.DarkGreen;
else else
...@@ -139,5 +239,24 @@ namespace AutoScanAndLabel ...@@ -139,5 +239,24 @@ namespace AutoScanAndLabel
btn_run.Text = "启动"; btn_run.Text = "启动";
RobotManage.Stop(); RobotManage.Stop();
} }
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (RobotManage.isRunning) {
MessageBox.Show("机器尚在运行,不能退出,请先停止运行.");
} else {
Application.Exit();
}
}
private void cb_IgnoreSafecheck_CheckedChanged(object sender, EventArgs e)
{
RobotManage.IgnoreSafecheck((sender as CheckBox).Checked);
}
private void cb_IgnoreGratingSignal_CheckedChanged(object sender, EventArgs e)
{
RobotManage.IgnoreGratingSignal((sender as CheckBox).Checked);
}
} }
} }
...@@ -31,30 +31,33 @@ namespace AutoScanAndLabel ...@@ -31,30 +31,33 @@ namespace AutoScanAndLabel
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnCloseAll = new System.Windows.Forms.Button(); this.btnCloseAll = new System.Windows.Forms.Button();
this.btnRelax = new System.Windows.Forms.Button(); this.btn夹爪放松 = new System.Windows.Forms.Button();
this.btnClamp = new System.Windows.Forms.Button(); this.btn右侧电滚筒退出 = new System.Windows.Forms.Button();
this.btnLineStop = new System.Windows.Forms.Button(); this.btn左侧电滚筒退出 = new System.Windows.Forms.Button();
this.btnLineRun = new System.Windows.Forms.Button(); this.btn打开设备光源 = new System.Windows.Forms.Button();
this.btnDeviceLed = new System.Windows.Forms.Button(); this.btn打开相机光源 = new System.Windows.Forms.Button();
this.btnCamerLed = new System.Windows.Forms.Button(); this.btn左侧阻挡下降 = new System.Windows.Forms.Button();
this.btnTopDown = new System.Windows.Forms.Button(); this.btn左侧阻挡上升 = new System.Windows.Forms.Button();
this.btnTopUp = new System.Windows.Forms.Button();
this.btnOpenDo = new System.Windows.Forms.Button(); this.btnOpenDo = new System.Windows.Forms.Button();
this.btnCloseDO = new System.Windows.Forms.Button(); this.btnCloseDO = new System.Windows.Forms.Button();
this.txtDOIndex = new System.Windows.Forms.TextBox(); this.txtDOIndex = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.txtWriteTime = new System.Windows.Forms.TextBox(); this.txtWriteTime = new System.Windows.Forms.TextBox();
this.btnBack = new System.Windows.Forms.Button(); this.btn右侧阻挡下降 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.btn_Stop = new System.Windows.Forms.Button(); this.btn右侧电滚筒进入 = new System.Windows.Forms.Button();
this.btn_Down = new System.Windows.Forms.Button(); this.btn左侧电滚筒进入 = new System.Windows.Forms.Button();
this.btn_Up = new System.Windows.Forms.Button(); this.btn右侧阻挡上升 = new System.Windows.Forms.Button();
this.btnFoward = new System.Windows.Forms.Button();
this.cmbWriteIO = new System.Windows.Forms.ComboBox(); this.cmbWriteIO = new System.Windows.Forms.ComboBox();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btn夹爪夹紧 = new System.Windows.Forms.Button();
this.btn关闭相机光源 = new System.Windows.Forms.Button();
this.btn关闭设备光源 = new System.Windows.Forms.Button();
this.btn左侧电滚筒停止 = new System.Windows.Forms.Button();
this.btn右侧电滚筒停止 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
...@@ -65,25 +68,28 @@ namespace AutoScanAndLabel ...@@ -65,25 +68,28 @@ namespace AutoScanAndLabel
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.btnCloseAll); this.groupBox1.Controls.Add(this.btnCloseAll);
this.groupBox1.Controls.Add(this.btnRelax); this.groupBox1.Controls.Add(this.btn夹爪夹紧);
this.groupBox1.Controls.Add(this.btnClamp); this.groupBox1.Controls.Add(this.btn夹爪放松);
this.groupBox1.Controls.Add(this.btnLineStop); this.groupBox1.Controls.Add(this.btn右侧电滚筒停止);
this.groupBox1.Controls.Add(this.btnLineRun); this.groupBox1.Controls.Add(this.btn左侧电滚筒停止);
this.groupBox1.Controls.Add(this.btnDeviceLed); this.groupBox1.Controls.Add(this.btn右侧电滚筒退出);
this.groupBox1.Controls.Add(this.btnCamerLed); this.groupBox1.Controls.Add(this.btn左侧电滚筒退出);
this.groupBox1.Controls.Add(this.btnTopDown); this.groupBox1.Controls.Add(this.btn关闭设备光源);
this.groupBox1.Controls.Add(this.btnTopUp); this.groupBox1.Controls.Add(this.btn关闭相机光源);
this.groupBox1.Controls.Add(this.btn打开设备光源);
this.groupBox1.Controls.Add(this.btn打开相机光源);
this.groupBox1.Controls.Add(this.btn左侧阻挡下降);
this.groupBox1.Controls.Add(this.btn左侧阻挡上升);
this.groupBox1.Controls.Add(this.btnOpenDo); this.groupBox1.Controls.Add(this.btnOpenDo);
this.groupBox1.Controls.Add(this.btnCloseDO); this.groupBox1.Controls.Add(this.btnCloseDO);
this.groupBox1.Controls.Add(this.txtDOIndex); this.groupBox1.Controls.Add(this.txtDOIndex);
this.groupBox1.Controls.Add(this.label14); this.groupBox1.Controls.Add(this.label14);
this.groupBox1.Controls.Add(this.txtWriteTime); this.groupBox1.Controls.Add(this.txtWriteTime);
this.groupBox1.Controls.Add(this.btnBack); this.groupBox1.Controls.Add(this.btn右侧阻挡下降);
this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.btn_Stop); this.groupBox1.Controls.Add(this.btn右侧电滚筒进入);
this.groupBox1.Controls.Add(this.btn_Down); this.groupBox1.Controls.Add(this.btn左侧电滚筒进入);
this.groupBox1.Controls.Add(this.btn_Up); this.groupBox1.Controls.Add(this.btn右侧阻挡上升);
this.groupBox1.Controls.Add(this.btnFoward);
this.groupBox1.Controls.Add(this.cmbWriteIO); this.groupBox1.Controls.Add(this.cmbWriteIO);
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(521, 3); this.groupBox1.Location = new System.Drawing.Point(521, 3);
...@@ -97,7 +103,7 @@ namespace AutoScanAndLabel ...@@ -97,7 +103,7 @@ namespace AutoScanAndLabel
// //
this.btnCloseAll.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCloseAll.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCloseAll.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCloseAll.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseAll.Location = new System.Drawing.Point(167, 421); this.btnCloseAll.Location = new System.Drawing.Point(167, 515);
this.btnCloseAll.Name = "btnCloseAll"; this.btnCloseAll.Name = "btnCloseAll";
this.btnCloseAll.Size = new System.Drawing.Size(125, 34); this.btnCloseAll.Size = new System.Drawing.Size(125, 34);
this.btnCloseAll.TabIndex = 302; this.btnCloseAll.TabIndex = 302;
...@@ -105,93 +111,89 @@ namespace AutoScanAndLabel ...@@ -105,93 +111,89 @@ namespace AutoScanAndLabel
this.btnCloseAll.UseVisualStyleBackColor = false; this.btnCloseAll.UseVisualStyleBackColor = false;
this.btnCloseAll.Click += new System.EventHandler(this.btnCloseAll_Click); this.btnCloseAll.Click += new System.EventHandler(this.btnCloseAll_Click);
// //
// btnRelax // btn夹爪放松
// //
this.btnRelax.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn夹爪放松.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRelax.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn夹爪放松.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRelax.Location = new System.Drawing.Point(167, 363); this.btn夹爪放松.Location = new System.Drawing.Point(167, 372);
this.btnRelax.Name = "btnRelax"; this.btn夹爪放松.Name = "btn夹爪放松";
this.btnRelax.Size = new System.Drawing.Size(125, 34); this.btn夹爪放松.Size = new System.Drawing.Size(125, 34);
this.btnRelax.TabIndex = 297; this.btn夹爪放松.TabIndex = 297;
this.btnRelax.Text = "取料气缸放松"; this.btn夹爪放松.Text = "夹爪放松";
this.btnRelax.UseVisualStyleBackColor = false; this.btn夹爪放松.UseVisualStyleBackColor = false;
// this.btn夹爪放松.Click += new System.EventHandler(this.btn夹爪放松_Click);
// btnClamp //
// // btn右侧电滚筒退出
this.btnClamp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; //
this.btnClamp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn右侧电滚筒退出.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClamp.Location = new System.Drawing.Point(167, 326); this.btn右侧电滚筒退出.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClamp.Name = "btnClamp"; this.btn右侧电滚筒退出.Location = new System.Drawing.Point(167, 282);
this.btnClamp.Size = new System.Drawing.Size(125, 34); this.btn右侧电滚筒退出.Name = "btn右侧电滚筒退出";
this.btnClamp.TabIndex = 296; this.btn右侧电滚筒退出.Size = new System.Drawing.Size(125, 34);
this.btnClamp.Text = "取料气缸夹紧"; this.btn右侧电滚筒退出.TabIndex = 296;
this.btnClamp.UseVisualStyleBackColor = false; this.btn右侧电滚筒退出.Text = "右侧电滚筒退出";
// this.btn右侧电滚筒退出.UseVisualStyleBackColor = false;
// btnLineStop this.btn右侧电滚筒退出.Click += new System.EventHandler(this.btn右侧电滚筒退出_Click);
// //
this.btnLineStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; // btn左侧电滚筒退出
this.btnLineStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); //
this.btnLineStop.Location = new System.Drawing.Point(31, 363); this.btn左侧电滚筒退出.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLineStop.Name = "btnLineStop"; this.btn左侧电滚筒退出.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLineStop.Size = new System.Drawing.Size(125, 34); this.btn左侧电滚筒退出.Location = new System.Drawing.Point(31, 282);
this.btnLineStop.TabIndex = 295; this.btn左侧电滚筒退出.Name = "btn左侧电滚筒退出";
this.btnLineStop.Text = "线体停止"; this.btn左侧电滚筒退出.Size = new System.Drawing.Size(125, 34);
this.btnLineStop.UseVisualStyleBackColor = false; this.btn左侧电滚筒退出.TabIndex = 294;
// this.btn左侧电滚筒退出.Text = "左侧电滚筒退出";
// btnLineRun this.btn左侧电滚筒退出.UseVisualStyleBackColor = false;
// this.btn左侧电滚筒退出.Click += new System.EventHandler(this.btn左侧电滚筒退出_Click);
this.btnLineRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat; //
this.btnLineRun.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); // btn打开设备光源
this.btnLineRun.Location = new System.Drawing.Point(31, 326); //
this.btnLineRun.Name = "btnLineRun"; this.btn打开设备光源.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLineRun.Size = new System.Drawing.Size(125, 34); this.btn打开设备光源.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLineRun.TabIndex = 294; this.btn打开设备光源.Location = new System.Drawing.Point(167, 421);
this.btnLineRun.Text = "线体正转"; this.btn打开设备光源.Name = "btn打开设备光源";
this.btnLineRun.UseVisualStyleBackColor = false; this.btn打开设备光源.Size = new System.Drawing.Size(125, 34);
// this.btn打开设备光源.TabIndex = 293;
// btnDeviceLed this.btn打开设备光源.Text = "打开设备光源";
// this.btn打开设备光源.UseVisualStyleBackColor = false;
this.btnDeviceLed.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn打开设备光源.Click += new System.EventHandler(this.btn打开设备光源_Click);
this.btnDeviceLed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); //
this.btnDeviceLed.Location = new System.Drawing.Point(31, 461); // btn打开相机光源
this.btnDeviceLed.Name = "btnDeviceLed"; //
this.btnDeviceLed.Size = new System.Drawing.Size(125, 34); this.btn打开相机光源.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDeviceLed.TabIndex = 293; this.btn打开相机光源.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDeviceLed.Text = "打开设备光源"; this.btn打开相机光源.Location = new System.Drawing.Point(31, 421);
this.btnDeviceLed.UseVisualStyleBackColor = false; this.btn打开相机光源.Name = "btn打开相机光源";
// this.btn打开相机光源.Size = new System.Drawing.Size(125, 34);
// btnCamerLed this.btn打开相机光源.TabIndex = 290;
// this.btn打开相机光源.Text = "打开相机光源";
this.btnCamerLed.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn打开相机光源.UseVisualStyleBackColor = false;
this.btnCamerLed.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn打开相机光源.Click += new System.EventHandler(this.btn打开相机光源_Click);
this.btnCamerLed.Location = new System.Drawing.Point(31, 421); //
this.btnCamerLed.Name = "btnCamerLed"; // btn左侧阻挡下降
this.btnCamerLed.Size = new System.Drawing.Size(125, 34); //
this.btnCamerLed.TabIndex = 290; this.btn左侧阻挡下降.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCamerLed.Text = "打开相机光源"; this.btn左侧阻挡下降.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCamerLed.UseVisualStyleBackColor = false; this.btn左侧阻挡下降.Location = new System.Drawing.Point(31, 191);
// this.btn左侧阻挡下降.Name = "btn左侧阻挡下降";
// btnTopDown this.btn左侧阻挡下降.Size = new System.Drawing.Size(125, 34);
// this.btn左侧阻挡下降.TabIndex = 289;
this.btnTopDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn左侧阻挡下降.Text = "左侧阻挡下降";
this.btnTopDown.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn左侧阻挡下降.UseVisualStyleBackColor = false;
this.btnTopDown.Location = new System.Drawing.Point(31, 206); this.btn左侧阻挡下降.Click += new System.EventHandler(this.btn左侧阻挡下降_Click);
this.btnTopDown.Name = "btnTopDown"; //
this.btnTopDown.Size = new System.Drawing.Size(125, 34); // btn左侧阻挡上升
this.btnTopDown.TabIndex = 289; //
this.btnTopDown.Text = "横移顶升气缸下降"; this.btn左侧阻挡上升.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnTopDown.UseVisualStyleBackColor = false; this.btn左侧阻挡上升.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
// this.btn左侧阻挡上升.Location = new System.Drawing.Point(31, 154);
// btnTopUp this.btn左侧阻挡上升.Name = "btn左侧阻挡上升";
// this.btn左侧阻挡上升.Size = new System.Drawing.Size(125, 34);
this.btnTopUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn左侧阻挡上升.TabIndex = 288;
this.btnTopUp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn左侧阻挡上升.Text = "左侧阻挡上升";
this.btnTopUp.Location = new System.Drawing.Point(31, 169); this.btn左侧阻挡上升.UseVisualStyleBackColor = false;
this.btnTopUp.Name = "btnTopUp"; this.btn左侧阻挡上升.Click += new System.EventHandler(this.btn左侧阻挡上升_Click);
this.btnTopUp.Size = new System.Drawing.Size(125, 34);
this.btnTopUp.TabIndex = 288;
this.btnTopUp.Text = "横移顶升气缸上升";
this.btnTopUp.UseVisualStyleBackColor = false;
// //
// btnOpenDo // btnOpenDo
// //
...@@ -251,16 +253,17 @@ namespace AutoScanAndLabel ...@@ -251,16 +253,17 @@ namespace AutoScanAndLabel
this.txtWriteTime.TabIndex = 238; this.txtWriteTime.TabIndex = 238;
this.txtWriteTime.Text = "0"; this.txtWriteTime.Text = "0";
// //
// btnBack // btn右侧阻挡下降
// //
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn右侧阻挡下降.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn右侧阻挡下降.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(167, 206); this.btn右侧阻挡下降.Location = new System.Drawing.Point(167, 191);
this.btnBack.Name = "btnBack"; this.btn右侧阻挡下降.Name = "btn右侧阻挡下降";
this.btnBack.Size = new System.Drawing.Size(125, 34); this.btn右侧阻挡下降.Size = new System.Drawing.Size(125, 34);
this.btnBack.TabIndex = 251; this.btn右侧阻挡下降.TabIndex = 251;
this.btnBack.Text = "提升线体后退"; this.btn右侧阻挡下降.Text = "右侧阻挡下降";
this.btnBack.UseVisualStyleBackColor = false; this.btn右侧阻挡下降.UseVisualStyleBackColor = false;
this.btn右侧阻挡下降.Click += new System.EventHandler(this.btn右侧阻挡下降_Click);
// //
// label5 // label5
// //
...@@ -274,49 +277,41 @@ namespace AutoScanAndLabel ...@@ -274,49 +277,41 @@ namespace AutoScanAndLabel
this.label5.Text = "定时(ms):"; this.label5.Text = "定时(ms):";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// //
// btn_Stop // btn右侧电滚筒进入
// //
this.btn_Stop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn右侧电滚筒进入.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_Stop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn右侧电滚筒进入.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_Stop.Location = new System.Drawing.Point(167, 246); this.btn右侧电滚筒进入.Location = new System.Drawing.Point(167, 242);
this.btn_Stop.Name = "btn_Stop"; this.btn右侧电滚筒进入.Name = "btn右侧电滚筒进入";
this.btn_Stop.Size = new System.Drawing.Size(125, 34); this.btn右侧电滚筒进入.Size = new System.Drawing.Size(125, 34);
this.btn_Stop.TabIndex = 250; this.btn右侧电滚筒进入.TabIndex = 250;
this.btn_Stop.Text = "提升线体停止"; this.btn右侧电滚筒进入.Text = "右侧电滚筒进入";
this.btn_Stop.UseVisualStyleBackColor = false; this.btn右侧电滚筒进入.UseVisualStyleBackColor = false;
// this.btn右侧电滚筒进入.Click += new System.EventHandler(this.btn右侧电滚筒进入_Click);
// btn_Down //
// // btn左侧电滚筒进入
this.btn_Down.FlatStyle = System.Windows.Forms.FlatStyle.Flat; //
this.btn_Down.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn左侧电滚筒进入.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_Down.Location = new System.Drawing.Point(167, 286); this.btn左侧电滚筒进入.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_Down.Name = "btn_Down"; this.btn左侧电滚筒进入.Location = new System.Drawing.Point(31, 242);
this.btn_Down.Size = new System.Drawing.Size(125, 34); this.btn左侧电滚筒进入.Name = "btn左侧电滚筒进入";
this.btn_Down.TabIndex = 250; this.btn左侧电滚筒进入.Size = new System.Drawing.Size(125, 34);
this.btn_Down.Text = "定位销下降"; this.btn左侧电滚筒进入.TabIndex = 250;
this.btn_Down.UseVisualStyleBackColor = false; this.btn左侧电滚筒进入.Text = "左侧电滚筒进入";
// this.btn左侧电滚筒进入.UseVisualStyleBackColor = false;
// btn_Up this.btn左侧电滚筒进入.Click += new System.EventHandler(this.btn左侧电滚筒进入_Click);
// //
this.btn_Up.FlatStyle = System.Windows.Forms.FlatStyle.Flat; // btn右侧阻挡上升
this.btn_Up.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); //
this.btn_Up.Location = new System.Drawing.Point(31, 286); this.btn右侧阻挡上升.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_Up.Name = "btn_Up"; this.btn右侧阻挡上升.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_Up.Size = new System.Drawing.Size(125, 34); this.btn右侧阻挡上升.Location = new System.Drawing.Point(167, 154);
this.btn_Up.TabIndex = 250; this.btn右侧阻挡上升.Name = "btn右侧阻挡上升";
this.btn_Up.Text = "定位销上升"; this.btn右侧阻挡上升.Size = new System.Drawing.Size(125, 34);
this.btn_Up.UseVisualStyleBackColor = false; this.btn右侧阻挡上升.TabIndex = 250;
// this.btn右侧阻挡上升.Text = "右侧阻挡上升";
// btnFoward this.btn右侧阻挡上升.UseVisualStyleBackColor = false;
// this.btn右侧阻挡上升.Click += new System.EventHandler(this.btn右侧阻挡上升_Click);
this.btnFoward.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnFoward.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnFoward.Location = new System.Drawing.Point(167, 169);
this.btnFoward.Name = "btnFoward";
this.btnFoward.Size = new System.Drawing.Size(125, 34);
this.btnFoward.TabIndex = 250;
this.btnFoward.Text = "提升线体前进";
this.btnFoward.UseVisualStyleBackColor = false;
// //
// cmbWriteIO // cmbWriteIO
// //
...@@ -389,6 +384,66 @@ namespace AutoScanAndLabel ...@@ -389,6 +384,66 @@ namespace AutoScanAndLabel
this.tableLayoutPanel1.Size = new System.Drawing.Size(244, 713); this.tableLayoutPanel1.Size = new System.Drawing.Size(244, 713);
this.tableLayoutPanel1.TabIndex = 102; this.tableLayoutPanel1.TabIndex = 102;
// //
// btn夹爪夹紧
//
this.btn夹爪夹紧.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn夹爪夹紧.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn夹爪夹紧.Location = new System.Drawing.Point(30, 372);
this.btn夹爪夹紧.Name = "btn夹爪夹紧";
this.btn夹爪夹紧.Size = new System.Drawing.Size(125, 34);
this.btn夹爪夹紧.TabIndex = 297;
this.btn夹爪夹紧.Text = "夹爪夹紧";
this.btn夹爪夹紧.UseVisualStyleBackColor = false;
this.btn夹爪夹紧.Click += new System.EventHandler(this.btn夹爪夹紧_Click);
//
// btn关闭相机光源
//
this.btn关闭相机光源.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn关闭相机光源.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn关闭相机光源.Location = new System.Drawing.Point(31, 461);
this.btn关闭相机光源.Name = "btn关闭相机光源";
this.btn关闭相机光源.Size = new System.Drawing.Size(125, 34);
this.btn关闭相机光源.TabIndex = 290;
this.btn关闭相机光源.Text = "关闭相机光源";
this.btn关闭相机光源.UseVisualStyleBackColor = false;
this.btn关闭相机光源.Click += new System.EventHandler(this.btn关闭相机光源_Click);
//
// btn关闭设备光源
//
this.btn关闭设备光源.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn关闭设备光源.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn关闭设备光源.Location = new System.Drawing.Point(167, 461);
this.btn关闭设备光源.Name = "btn关闭设备光源";
this.btn关闭设备光源.Size = new System.Drawing.Size(125, 34);
this.btn关闭设备光源.TabIndex = 293;
this.btn关闭设备光源.Text = "关闭设备光源";
this.btn关闭设备光源.UseVisualStyleBackColor = false;
this.btn关闭设备光源.Click += new System.EventHandler(this.btn关闭设备光源_Click);
//
// btn左侧电滚筒停止
//
this.btn左侧电滚筒停止.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn左侧电滚筒停止.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn左侧电滚筒停止.Location = new System.Drawing.Point(30, 322);
this.btn左侧电滚筒停止.Name = "btn左侧电滚筒停止";
this.btn左侧电滚筒停止.Size = new System.Drawing.Size(125, 34);
this.btn左侧电滚筒停止.TabIndex = 294;
this.btn左侧电滚筒停止.Text = "左侧电滚筒停止";
this.btn左侧电滚筒停止.UseVisualStyleBackColor = false;
this.btn左侧电滚筒停止.Click += new System.EventHandler(this.btn左侧电滚筒停止_Click);
//
// btn右侧电滚筒停止
//
this.btn右侧电滚筒停止.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn右侧电滚筒停止.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn右侧电滚筒停止.Location = new System.Drawing.Point(166, 322);
this.btn右侧电滚筒停止.Name = "btn右侧电滚筒停止";
this.btn右侧电滚筒停止.Size = new System.Drawing.Size(125, 34);
this.btn右侧电滚筒停止.TabIndex = 296;
this.btn右侧电滚筒停止.Text = "右侧电滚筒停止";
this.btn右侧电滚筒停止.UseVisualStyleBackColor = false;
this.btn右侧电滚筒停止.Click += new System.EventHandler(this.btn右侧电滚筒停止_Click);
//
// IOControl // IOControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -412,29 +467,32 @@ namespace AutoScanAndLabel ...@@ -412,29 +467,32 @@ namespace AutoScanAndLabel
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnCloseAll; private System.Windows.Forms.Button btnCloseAll;
private System.Windows.Forms.Button btnRelax; private System.Windows.Forms.Button btn夹爪放松;
private System.Windows.Forms.Button btnClamp; private System.Windows.Forms.Button btn右侧电滚筒退出;
private System.Windows.Forms.Button btnLineStop; private System.Windows.Forms.Button btn左侧电滚筒退出;
private System.Windows.Forms.Button btnLineRun; private System.Windows.Forms.Button btn打开设备光源;
private System.Windows.Forms.Button btnDeviceLed; private System.Windows.Forms.Button btn打开相机光源;
private System.Windows.Forms.Button btnCamerLed; private System.Windows.Forms.Button btn左侧阻挡下降;
private System.Windows.Forms.Button btnTopDown; private System.Windows.Forms.Button btn左侧阻挡上升;
private System.Windows.Forms.Button btnTopUp;
private System.Windows.Forms.Button btnOpenDo; private System.Windows.Forms.Button btnOpenDo;
private System.Windows.Forms.Button btnCloseDO; private System.Windows.Forms.Button btnCloseDO;
private System.Windows.Forms.TextBox txtDOIndex; private System.Windows.Forms.TextBox txtDOIndex;
private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox txtWriteTime; private System.Windows.Forms.TextBox txtWriteTime;
private System.Windows.Forms.Button btnBack; private System.Windows.Forms.Button btn右侧阻挡下降;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btn_Stop; private System.Windows.Forms.Button btn右侧电滚筒进入;
private System.Windows.Forms.Button btn_Down; private System.Windows.Forms.Button btn左侧电滚筒进入;
private System.Windows.Forms.Button btn_Up; private System.Windows.Forms.Button btn右侧阻挡上升;
private System.Windows.Forms.Button btnFoward;
private System.Windows.Forms.ComboBox cmbWriteIO; private System.Windows.Forms.ComboBox cmbWriteIO;
private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button btn夹爪夹紧;
private System.Windows.Forms.Button btn关闭设备光源;
private System.Windows.Forms.Button btn关闭相机光源;
private System.Windows.Forms.Button btn右侧电滚筒停止;
private System.Windows.Forms.Button btn左侧电滚筒停止;
} }
} }
...@@ -204,5 +204,93 @@ namespace AutoScanAndLabel ...@@ -204,5 +204,93 @@ namespace AutoScanAndLabel
{ {
IOManager.CloseAllDO(); IOManager.CloseAllDO();
} }
public void CylinderMove(MoveInfo moveInfo, string IoLowType, string IoHighType)
{
IOManager.IOMove(IoLowType, IO_VALUE.LOW);
IOManager.IOMove(IoHighType, IO_VALUE.HIGH);
}
private void btn左侧阻挡上升_Click(object sender, EventArgs e)
{
CylinderMove(null, IO_Type.LeftStopDown, IO_Type.LeftStopUP);
}
private void btn左侧阻挡下降_Click(object sender, EventArgs e)
{
CylinderMove(null, IO_Type.LeftStopUP, IO_Type.LeftStopDown);
}
private void btn右侧阻挡上升_Click(object sender, EventArgs e)
{
CylinderMove(null, IO_Type.RightStopDown, IO_Type.RightStopUP);
}
private void btn右侧阻挡下降_Click(object sender, EventArgs e)
{
CylinderMove(null, IO_Type.RightStopUP, IO_Type.RightStopDown);
}
private void btn左侧电滚筒进入_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH);
}
private void btn左侧电滚筒退出_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH);
}
private void btn左侧电滚筒停止_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW);
}
private void btn右侧电滚筒进入_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH);
}
private void btn右侧电滚筒退出_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH);
}
private void btn右侧电滚筒停止_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.LOW);
}
private void btn夹爪夹紧_Click(object sender, EventArgs e)
{
RobotManage.electricGripper.Clamp();
}
private void btn夹爪放松_Click(object sender, EventArgs e)
{
RobotManage.electricGripper.Release();
}
private void btn打开相机光源_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
}
private void btn关闭相机光源_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
}
private void btn打开设备光源_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
}
private void btn关闭设备光源_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.LOW);
}
} }
} }

namespace AutoScanAndLabel
{
partial class LogControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.logBox = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// logBox
//
this.logBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.logBox.Font = new System.Drawing.Font("新宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logBox.Location = new System.Drawing.Point(0, 0);
this.logBox.Name = "logBox";
this.logBox.ShortcutsEnabled = false;
this.logBox.Size = new System.Drawing.Size(746, 495);
this.logBox.TabIndex = 0;
this.logBox.Text = "";
//
// LogControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.logBox);
this.Name = "LogControl";
this.Size = new System.Drawing.Size(746, 495);
this.Load += new System.EventHandler(this.LogControl_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.RichTextBox logBox;
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoScanAndLabel
{
public partial class LogControl : UserControl
{
public LogControl()
{
InitializeComponent();
showLogProDelegate = new ShowLogProDelegate(ShowLogPro);
LogUtil.ShowLog += LogUtil_ShowLog;
}
delegate void ShowLogProDelegate(string msg, Color color);
ShowLogProDelegate showLogProDelegate;
private void LogUtil_ShowLog(string msg, Color color)
{
if (this.InvokeRequired)
this.Invoke(showLogProDelegate, msg, color);
else
ShowLogPro(msg, color);
}
private List<string> logList = new List<string>();
public int showCount = 30;
private void ShowLogPro(string msg, Color color)
{
try
{
if (logList.Count >= showCount)
{
logList.RemoveAt(0);
}
DateTime now = DateTime.Now;
logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
logBox.Text= string.Join("", logList);
logBox.Select(logBox.Text.Length, 0);
logBox.ScrollToCaret();
}
catch (Exception ex)
{
LogUtil.error("出错:" + ex.ToString());
}
}
private void LogControl_Load(object sender, EventArgs e)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
using log4net.Config; using ConfigHelper;
using log4net.Config;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -15,11 +19,58 @@ namespace AutoScanAndLabel ...@@ -15,11 +19,58 @@ namespace AutoScanAndLabel
[STAThread] [STAThread]
static void Main() static void Main()
{ {
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
{
IntPtr formhwnd = FindWindow(null, Config.Get(Setting_Init.App_Title));
ShowWindow(formhwnd, SW_RESTORE);
SwitchToThisWindow(formhwnd, true);
//MessageBox.Show("该程序已经启动", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
XmlConfigurator.Configure(); XmlConfigurator.Configure();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); Application.Run(new Form1());
} }
#region Win32函数的声明
/// <summary>
/// 找到某个窗口与给出的类别名和窗口名相同窗口
/// </summary>
/// <param name="lpClassName">类别名</param>
/// <param name="lpWindowName">窗口名</param>
/// <returns>成功找到返回窗口句柄,否则返回null</returns>
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// 切换到窗口并把窗口设入前台,类似 SetForegroundWindow方法的功能
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="fAltTab">True代表窗口正在通过Alt/Ctrl +Tab被切换</param>
[DllImport("user32.dll ", SetLastError = true)]
static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
/// <summary>
/// 设置窗口的显示状态
/// </summary>
/// <param name="hWnd">窗口句柄</param>
/// <param name="cmdShow">指示窗口如何被显示</param>
/// <returns>如果窗体之前是可见,返回值为非零;如果窗体之前被隐藏,返回值为零</returns>
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9;
#endregion
} }
} }

namespace AutoScanAndLabel
{
partial class SettingControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.btn_labeledit = new System.Windows.Forms.Button();
this.cb_labelselect = new System.Windows.Forms.ComboBox();
this.cb_printerselect = new System.Windows.Forms.ComboBox();
this.chbAutoRun = new System.Windows.Forms.CheckBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label3 = new System.Windows.Forms.Label();
this.btnSavePos = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.btn_labeledit);
this.groupBox1.Controls.Add(this.cb_labelselect);
this.groupBox1.Controls.Add(this.cb_printerselect);
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(319, 160);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "打印设置";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(19, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 2;
this.label2.Text = "标签名";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(19, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 2;
this.label1.Text = "打印机";
//
// btn_labeledit
//
this.btn_labeledit.Location = new System.Drawing.Point(179, 115);
this.btn_labeledit.Name = "btn_labeledit";
this.btn_labeledit.Size = new System.Drawing.Size(107, 31);
this.btn_labeledit.TabIndex = 1;
this.btn_labeledit.Text = "标签编辑";
this.btn_labeledit.UseVisualStyleBackColor = true;
this.btn_labeledit.Click += new System.EventHandler(this.btn_labeledit_Click);
//
// cb_labelselect
//
this.cb_labelselect.FormattingEnabled = true;
this.cb_labelselect.Location = new System.Drawing.Point(88, 75);
this.cb_labelselect.Name = "cb_labelselect";
this.cb_labelselect.Size = new System.Drawing.Size(198, 20);
this.cb_labelselect.TabIndex = 0;
this.cb_labelselect.SelectedIndexChanged += new System.EventHandler(this.cb_labelselect_SelectedIndexChanged);
//
// cb_printerselect
//
this.cb_printerselect.FormattingEnabled = true;
this.cb_printerselect.Location = new System.Drawing.Point(88, 37);
this.cb_printerselect.Name = "cb_printerselect";
this.cb_printerselect.Size = new System.Drawing.Size(198, 20);
this.cb_printerselect.TabIndex = 0;
this.cb_printerselect.SelectedIndexChanged += new System.EventHandler(this.cb_printerselect_SelectedIndexChanged);
//
// chbAutoRun
//
this.chbAutoRun.AutoSize = true;
this.chbAutoRun.Location = new System.Drawing.Point(14, 214);
this.chbAutoRun.Name = "chbAutoRun";
this.chbAutoRun.Size = new System.Drawing.Size(84, 16);
this.chbAutoRun.TabIndex = 1;
this.chbAutoRun.Text = "开机自启动";
this.chbAutoRun.UseVisualStyleBackColor = true;
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.tableLayoutPanel1);
this.groupBox3.Location = new System.Drawing.Point(421, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(285, 413);
this.groupBox3.TabIndex = 108;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "点位列表";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 59.83936F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40.16064F));
this.tableLayoutPanel1.Font = new System.Drawing.Font("新宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 20);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(273, 387);
this.tableLayoutPanel1.TabIndex = 102;
//
// label3
//
this.label3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label3.Location = new System.Drawing.Point(107, 259);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 23);
this.label3.TabIndex = 109;
this.label3.Text = "label3";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnSavePos
//
this.btnSavePos.Location = new System.Drawing.Point(583, 422);
this.btnSavePos.Name = "btnSavePos";
this.btnSavePos.Size = new System.Drawing.Size(123, 34);
this.btnSavePos.TabIndex = 110;
this.btnSavePos.Text = "全部保存";
this.btnSavePos.UseVisualStyleBackColor = true;
this.btnSavePos.Click += new System.EventHandler(this.btnSavePos_Click);
//
// SettingControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.btnSavePos);
this.Controls.Add(this.label3);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.chbAutoRun);
this.Controls.Add(this.groupBox1);
this.Name = "SettingControl";
this.Size = new System.Drawing.Size(984, 497);
this.Load += new System.EventHandler(this.SettingControl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox cb_labelselect;
private System.Windows.Forms.ComboBox cb_printerselect;
private System.Windows.Forms.Button btn_labeledit;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox chbAutoRun;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnSavePos;
}
}
using ConfigHelper;
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoScanAndLabel
{
public partial class SettingControl : UserControl
{
public SettingControl()
{
InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun));
}
private void RobotManage_LoadFinishEvent(bool state, string msg)
{
if (!state)
return;
cb_printerselect.Items.Clear();
cb_labelselect.Items.Clear();
foreach (string sPrint in System.Drawing.Printing.PrinterSettings.InstalledPrinters)//获取所有打印机名称
{
cb_printerselect.Items.Add(sPrint);
}
if (RobotManage.PrintBean != null)
{
foreach (string labelname in RobotManage.PrintBean.GetLabelName())
{
cb_labelselect.Items.Add(labelname);
}
}
string PrintName = ConfigHelper.Config.Get(Setting_Init.PrinterName);
string labelName = ConfigHelper.Config.Get(Setting_Init.LabelName);
cb_printerselect.Text = PrintName;
cb_labelselect.Text = labelName;
LoadPosList();
}
void LoadPosList()
{
this.tableLayoutPanel1.RowStyles.Clear();
int r = 0;
int c = 0;
int lastSubType = 0;
Random random = new Random(2);
Color color = Color.Black;
foreach (ConfigBase configBase in RobotManage.Config.configList)
{
if (configBase.SubType < 30 || configBase.ProType != "PRO")
continue;
if (configBase.SubType != lastSubType)
{
lastSubType = configBase.SubType;
color = Color.FromArgb(random.Next(30, 150), random.Next(30, 150), random.Next(30, 150));
}
//this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 18));
Label button = new Label();
button.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
//button.BackColor = color;
//button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
//button.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
button.Name = configBase.ProName;
//button.Size = new System.Drawing.Size(225, 23);
button.Text = configBase.Explain;
button.AutoSize = false;
button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
button.ForeColor = color;
TextBox textBox = new TextBox();
//textBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
textBox.Name = configBase.ProName;
//textBox.Margin = new Padding(4, 8, 0, 0);
textBox.Size = new System.Drawing.Size(150, 23);
textBox.Text = configBase.ProValue;
textBox.KeyPress += TextBox_KeyPress;
textBox.TextChanged += TextBox_TextChanged;
PropertyInfo pi = RobotManage.Config.GetType().GetProperty(configBase.ProName);
if (pi != null)
{
textBox.Tag = pi.PropertyType.Name;
}
tableLayoutPanel1.Controls.Add(button, c, r);
tableLayoutPanel1.Controls.Add(textBox, c + 1, r);
r++;
if (r > 15)
{
r = 0;
c += 3;
}
}
}
private void TextBox_TextChanged(object sender, EventArgs e)
{
var s = (sender as TextBox);
if (s.Tag.ToString() != "Int32")
return;
if (!int.TryParse(s.Text, out _))
{
s.Text = lastvalue;
}
}
string lastvalue = "";
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var s = (sender as TextBox);
if (s.Tag.ToString() != "Int32")
return;
if (int.TryParse(s.Text, out _))
lastvalue = s.Text;
}
private void SettingControl_Load(object sender, EventArgs e)
{
}
private void cb_printerselect_SelectedIndexChanged(object sender, EventArgs e)
{
Config.Set(Setting_Init.PrinterName, (sender as ComboBox).Text);
Config.SaveChange();
RobotManage.LoadPrintSetting();
}
private void cb_labelselect_SelectedIndexChanged(object sender, EventArgs e)
{
Config.Set(Setting_Init.LabelName, (sender as ComboBox).Text);
Config.SaveChange();
RobotManage.LoadPrintSetting();
}
private void btn_labeledit_Click(object sender, EventArgs e)
{
RobotManage.PrintBean.EditLabel();
RobotManage_LoadFinishEvent(true, "");
RobotManage.LoadPrintSetting();
}
public static void AutoRun(string strName, bool value)
{
try
{
//创建启动对象
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
//设置运行文件
startInfo.FileName = System.Windows.Forms.Application.StartupPath + "\\AuToRunManager.exe";
//设置启动参数
startInfo.Arguments = String.Join(" ", new string[2] { strName, value.ToString() });
//设置启动动作,确保以管理员身份运行
startInfo.Verb = "runas";
//如果不是管理员,则启动UAC
System.Diagnostics.Process.Start(startInfo);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void chbAutoRun_CheckedChanged(object sender, EventArgs e)
{
if (chbAutoRun.Checked)
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 1);
AutoRun(Application.ExecutablePath, true);
}
else
{
ConfigAppSettings.SaveValue(Setting_Init.App_AutoRun, 0);
AutoRun(Application.ExecutablePath, false);
}
}
private void btnSavePos_Click(object sender, EventArgs e)
{
for (int i = 0; i < tableLayoutPanel1.Controls.Count; i++)
{
if (tableLayoutPanel1.Controls[i].GetType().Name != "TextBox")
continue;
TextBox textBox = (TextBox)tableLayoutPanel1.Controls[i];
PropertyInfo pi = RobotManage.Config.GetType().GetProperty(textBox.Name);
if (pi != null)
{
if (pi.PropertyType.Name=="Int32")
pi.SetValue(RobotManage.Config, int.Parse(textBox.Text));
else
pi.SetValue(RobotManage.Config, textBox.Text);
}
}
CSVConfigReader.SaveConfig(RobotManage.Config.ConfigFilePath, RobotManage.Config);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -13,17 +13,14 @@ namespace OnlineStore.Common ...@@ -13,17 +13,14 @@ namespace OnlineStore.Common
{ {
public class LogUtil public class LogUtil
{ {
//public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOX");
//private static LogUtil instance = new LogUtil();
public delegate void ShowLogDelegate(string msg, Color color); public delegate void ShowLogDelegate(string msg, Color color);
public event ShowLogDelegate ShowLog; public static event ShowLogDelegate ShowLog;
public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender"); public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
public static readonly ILog rfidLog = LogManager.GetLogger("RfidLog");
//public static readonly ILog timeCount = LogManager.GetLogger("Count");
public static ConcurrentDictionary<int, DateTime> lastErrorLogTime = new ConcurrentDictionary<int, DateTime>(); public static ConcurrentDictionary<int, DateTime> lastErrorLogTime = new ConcurrentDictionary<int, DateTime>();
public static int showCount = 15;
public static bool debug_opened = false; public static bool debug_opened = false;
public static void info(ILog log, string msg) public static void info(ILog log, string msg)
...@@ -57,11 +54,6 @@ namespace OnlineStore.Common ...@@ -57,11 +54,6 @@ namespace OnlineStore.Common
} }
} }
public static void RfidLog(string msg)
{
rfidLog.Debug(msg);
}
public static void error(string errorMsg, int type, int seconds = 10) public static void error(string errorMsg, int type, int seconds = 10)
{ {
try try
...@@ -105,11 +97,11 @@ namespace OnlineStore.Common ...@@ -105,11 +97,11 @@ namespace OnlineStore.Common
private static object lockObj = ""; private static object lockObj = "";
private static void AddToBox(string msg, Color color) private static void AddToBox(string msg, Color color)
{ {
if (Monitor.TryEnter(lockObj, 2)) if (Monitor.TryEnter(lockObj, 10))
{ {
try try
{ {
ShowLogPro(msg, color); ShowLog?.Invoke(msg, color);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -125,35 +117,7 @@ namespace OnlineStore.Common ...@@ -125,35 +117,7 @@ namespace OnlineStore.Common
LOGGER.Debug("ShowLogPro【" + msg + "】失败,未得到锁"); LOGGER.Debug("ShowLogPro【" + msg + "】失败,未得到锁");
} }
} }
private static List<string> logList = new List<string>();
public static string LastText = "";
[HandleProcessCorruptedStateExceptions]
private static void ShowLogPro(string msg, Color color)
{
try
{
if (logList.Count >= showCount)
{
logList.RemoveAt(0);
}
string text = "";
foreach (string str in logList)
{
text += str;
}
System.DateTime now = System.DateTime.Now;
logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
}
catch (AccessViolationException e)
{
LOGGER.Error(" ShowLogPro 出错:" + e.ToString());
}
catch (Exception ex)
{
LOGGER.Error("出错:" + ex.ToString());
}
}
private static DateTime lastTime = DateTime.Now; private static DateTime lastTime = DateTime.Now;
public static void debug(string msg) public static void debug(string msg)
......
...@@ -25,7 +25,6 @@ namespace DeviceLibrary ...@@ -25,7 +25,6 @@ namespace DeviceLibrary
AxisName = deviceName + " " + Config.Explain + "[" + Config.DeviceName + "-" + Config.GetAxisValue() + "]"; AxisName = deviceName + " " + Config.Explain + "[" + Config.DeviceName + "-" + Config.GetAxisValue() + "]";
} }
private bool IsIntSlvBlock = false;
public bool Open(bool isCheck, out string Msg) public bool Open(bool isCheck, out string Msg)
{ {
Msg = ""; Msg = "";
...@@ -44,7 +43,6 @@ namespace DeviceLibrary ...@@ -44,7 +43,6 @@ namespace DeviceLibrary
return false; return false;
} }
} }
IsIntSlvBlock = true;
return true; return true;
} }
/// <summary> /// <summary>
...@@ -154,16 +152,14 @@ namespace DeviceLibrary ...@@ -154,16 +152,14 @@ namespace DeviceLibrary
AxisManager.SuddenStop(axis.DeviceName, axis.GetAxisValue()); AxisManager.SuddenStop(axis.DeviceName, axis.GetAxisValue());
Thread.Sleep(100); Thread.Sleep(100);
} }
LogUtil.error(MoveInfo.Name + axis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error($"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次");
"],误差过大," + clearMsg + "重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, axis.AddSpeed, axis.DelSpeed); AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, axis.AddSpeed, axis.DelSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
Thread.Sleep(200); Thread.Sleep(200);
} }
else else
{ {
msg = " " + MoveInfo.SLog + MoveInfo.Name + axis.DisplayStr + ",目标位置[" + targetPosition + "]当前位置[" + outCount msg = $"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr},目标位置{targetPosition},当前位置{outCount},误差过大,需要报警";
+ "],误差过大,需要报警";
LogUtil.error(msg, 600); LogUtil.error(msg, 600);
} }
} }
...@@ -191,7 +187,7 @@ namespace DeviceLibrary ...@@ -191,7 +187,7 @@ namespace DeviceLibrary
} }
else else
{ {
msg = MoveInfo.Name + " " + MoveInfo.SLog + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; msg = MoveInfo.Name + " " + MoveInfo.MoveStep + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(msg); LogUtil.error(msg);
} }
} }
......
using System; using CodeLibrary;
using OnlineStore.Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DeviceLibrary namespace DeviceLibrary
{ {
class Common public class Common
{ {
/**获取角度*/
// 求3点形成的夹角
public static float getAngle2(Point pt1, Point pt2, Point pt0)
{
double ma_x = pt1.X - pt0.X;
double ma_y = pt1.Y - pt0.Y;
double mb_x = pt2.X - pt0.X;
double mb_y = pt2.Y - pt0.Y;
double k = (ma_x * mb_y - mb_x * ma_y);
if (k != 0)
{
k = (k / Math.Sqrt(k * k));
}
else
{
k = 1;
}
double v1 = (ma_x * mb_x) + (ma_y * mb_y);
double ma_val = Math.Sqrt(ma_x * ma_x + ma_y * ma_y);
double mb_val = Math.Sqrt(mb_x * mb_x + mb_y * mb_y);
double cosM = v1 / (ma_val * mb_val);
return (float)(Math.Acos(cosM) * 180 / Math.PI * k);
}
public static double getAngle(Point pt1, Point pt2)
{
double mb_x = pt2.X - pt1.X;
double mb_y = pt2.Y - pt1.Y;
double rotation = Math.Atan2(mb_y, mb_x);
/*
if (pt2.Y >= pt1.Y) {
if (pt2.X >= pt1.X) { }
else
{
rotation = Math.PI - rotation;
}
} else {
if (pt2.X >= pt1.X)
{
rotation = 2 * Math.PI - rotation;
}
else
{
rotation = Math.PI + rotation;
}
}*/
rotation = rotation / Math.PI * 180;
return rotation;
//double angle = 360 - rotation + 90;
//angle = angle < 0 ? 360 + angle : angle;
//angle = angle % 360;
//return Math.Floor(angle / 360 * 24);
}
public static double distance(Point p1, Point p2)
{
double result;
result = Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y));
return result;
}
/// <summary>
/// 以中心点旋转Angle角度
/// </summary>
/// <param name="origin">中心点</param>
/// <param name="reRotate">待旋转的点</param>
/// <param name="angle">旋转角度, 逆时针</param>
public static Point PointRotate(Point origin, Point rePoint, double angle)
{
double x = (rePoint.X - origin.X) * Math.Cos(angle) - (rePoint.Y - origin.Y) * Math.Sin(angle) + origin.X;
double y = (rePoint.X - origin.X) * Math.Sin(angle) + (rePoint.Y - origin.Y) * Math.Cos(angle) + origin.Y;
//rePoint.X = x;
//rePoint.Y = y;
return new Point((int)x, (int)y);
}
/// <summary>
/// 以指定点为中心,测算指定角度,指定长度位置的点
/// </summary>
/// <param name="p1">原点</param>
/// <param name="angle">角度</param>
/// <param name="distance">距离</param>
/// <returns></returns>
public static Point PointWithAngle(Point p1, double angle, double distance) {
var x2 = p1.X + distance * Math.Cos(angle / 180 * Math.PI);
var y2 = p1.Y + distance * Math.Sin(angle / 180 * Math.PI);
return new Point((int)x2, (int)y2);
}
public static Point CalcLabelPoint(List<CodeInfo> codeInfos, Point org,int widthOffset) {
//Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Point Right_Batch_Point = org;
List<int> angles = new List<int>();
codeInfos.ForEach((c) => {
//Point op = Common.PointRotate(Right_Batch_Point, new Point(c.X, c.Y), 83d / 180 * Math.PI);
//c.X = op.X;
//c.Y = op.Y;
Point op = new Point(c.X, c.Y);
var a = (int)getAngle(Right_Batch_Point, op);
a = a < 0 ? 360 + a : a;
angles.Add(a);
});
angles.Sort();
//if (angles.Count > 1) {
angles.Add(360 + angles[0]);
//}
int biglen = 0;
int bigangles = 0;
for (int i = 0; i < angles.Count; i++) {
if (angles.Count() - i < 2)
break;
var x = angles[i+1] - angles[i];
if (x > biglen)
{
biglen = x;
bigangles = angles[i];
}
}
var a2 = bigangles + biglen / 2;
a2 = a2 > 360 ? 360 - a2 : a2;
var p2 = PointWithAngle(org, a2, widthOffset);
return p2;
}
} }
public class Msg public class Msg
{ {
...@@ -17,12 +150,24 @@ namespace DeviceLibrary ...@@ -17,12 +150,24 @@ namespace DeviceLibrary
public DateTime datetime; public DateTime datetime;
public static List<Msg> get() { public static List<Msg> get() {
if (_setlogones) {
_setlogones = false;
foreach (var m in msg)
LogUtil.info(m.msgtxt);
}
return msg; return msg;
} }
public static void add(string m, MsgLevel ml) public static void add(string m, MsgLevel ml)
{ {
msg.Add(new Msg { msgtxt = m, msgLevel = ml, datetime=DateTime.Now }); msg.Add(new Msg { msgtxt = m, msgLevel = ml, datetime=DateTime.Now });
} }
static bool _setlogones = false;
internal static void setlogones()
{
_setlogones = true;
}
public static void clear() public static void clear()
{ {
msg.Clear(); msg.Clear();
......
using CodeLibrary; using CodeLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -12,24 +14,20 @@ namespace DeviceLibrary ...@@ -12,24 +14,20 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// 创建新出入库信息 /// 创建新出入库信息
/// </summary> /// </summary>
/// <param name="type">出入库类型</param>
/// <param name="wareNo">二维码内容</param> /// <param name="wareNo">二维码内容</param>
/// <param name="platew">宽度</param> /// <param name="platew">宽度</param>
/// <param name="plateh">高度</param> /// <param name="plateh">高度</param>
/// <param name="IsNg">是否是入库NG料</param> /// <param name="IsNg">是否是入库NG料</param>
/// <param name="ngMsg">NG消息</param> /// <param name="ngMsg">NG消息</param>
public LabelParam(MoveType type, string wareNo = "", int platew = 0, int plateh = 0, bool _IsNg = false, string ngMsg = "") public LabelParam(string wareNo = "", int platew = 0, int plateh = 0, bool _IsNg = false, string ngMsg = "")
{ {
WareCode = wareNo; WareCode = wareNo;
PlateW = platew; PlateW = platew;
PlateH = plateh; PlateH = plateh;
IsNg = _IsNg; IsNg = _IsNg;
NgMsg = ngMsg; NgMsg = ngMsg;
moveType = type;
} }
public MoveType moveType = MoveType.None;
/// <summary> /// <summary>
/// 物品二维码信息 /// 物品二维码信息
/// </summary> /// </summary>
...@@ -53,17 +51,24 @@ namespace DeviceLibrary ...@@ -53,17 +51,24 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public string NgMsg = ""; public string NgMsg = "";
public LabelParam clone() {
MemoryStream stream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, this);
stream.Position = 0;
return formatter.Deserialize(stream) as LabelParam;
}
public string ToStr() public string ToStr()
{ {
if (IsNg) if (IsNg)
{ {
return " 入库失败[BOX_" + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] "; return "[" + WareCode + "], [" + PlateW + "x" + PlateH + "]";
} }
else else
{ {
return " 入库 [" + "] [" + WareCode + "], [" + PlateW + "x" + PlateH + "] "; return "[" + WareCode + "], [" + PlateW + "x" + PlateH + "]";
} }
} }
......
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
partial class MainMachine
{
void BtnProcess()
{
if (RightMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH))
{
RightMoveInfo.NewMove(MoveStep.R30_OutShelf);
}
else if (RightMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.RightStopUP).Equals(IO_VALUE.LOW))
{
IOMove(IO_Type.RightStopUP, IO_VALUE.LOW);
}
if (LeftMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH))
{
LeftMoveInfo.NewMove(MoveStep.L50_OutShelf);
}
else if (LeftMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.LeftStopUP).Equals(IO_VALUE.LOW))
{
IOMove(IO_Type.LeftStopUP, IO_VALUE.LOW);
}
}
}
}
...@@ -35,11 +35,10 @@ namespace DeviceLibrary ...@@ -35,11 +35,10 @@ namespace DeviceLibrary
string WarnMsg = ""; string WarnMsg = "";
bool CheckWait(MoveInfo MoveInfo) bool CheckWait(MoveInfo MoveInfo)
{ {
List<WaitResultInfo> list = MoveInfo.WaitList;
//当等待超过一分钟时,需要打印提示 //当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime; TimeSpan span = DateTime.Now - MoveInfo.LastSetpTime;
string NotOkMsg = ""; string NotOkMsg = "";
if (list.Count <= 0) if (MoveInfo.WaitList.Count <= 0)
{ {
MoveInfo.EndStepWait(); MoveInfo.EndStepWait();
return false; return false;
...@@ -49,7 +48,7 @@ namespace DeviceLibrary ...@@ -49,7 +48,7 @@ namespace DeviceLibrary
{ {
isOk = false; isOk = false;
} }
foreach (WaitResultInfo wait in list) foreach (WaitResultInfo wait in MoveInfo.WaitList)
{ {
if (wait.IsEnd) if (wait.IsEnd)
{ {
...@@ -74,7 +73,8 @@ namespace DeviceLibrary ...@@ -74,7 +73,8 @@ namespace DeviceLibrary
{ {
isOk = false; isOk = false;
WarnMsg = msg; WarnMsg = msg;
Alarm(AlarmType.AxisMoveError, GetAlarmCodeByAxis(wait.AxisInfo).ToString(), WarnMsg, MoveInfo.MoveType); Alarm(AlarmType.AxisMoveError, WarnMsg);
Msg.add(WarnMsg, MsgLevel.warning);
break; break;
} }
} }
...@@ -83,15 +83,17 @@ namespace DeviceLibrary ...@@ -83,15 +83,17 @@ namespace DeviceLibrary
ConfigIO io = RobotManage.Config.getWaitIO(wait.IoType); ConfigIO io = RobotManage.Config.getWaitIO(wait.IoType);
NotOkMsg = " 等待【" + io.DisplayStr + "】=【" + wait.IoValue + "】"; NotOkMsg = " 等待【" + io.DisplayStr + "】=【" + wait.IoValue + "】";
wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = IOManager.IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = RobotManage.Config.IOSingle_TimerOut;
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
int timeOutMs = RobotManage.Config.IOSingle_TimerOut;
if (span.TotalMilliseconds > timeOutMs && NoAlarm()) if (span.TotalMilliseconds > timeOutMs && NoAlarm())
{ {
WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时"; WarnMsg = Name + "[" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时";
Alarm(AlarmType.IoSingleTimeOut, io.ElectricalDefinition, WarnMsg, MoveInfo.MoveType); Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
LogUtil.error(Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", logType + 14); Msg.add(WarnMsg, MsgLevel.warning);
LogUtil.error(WarnMsg, logType + 14);
//MoveInfo.errlog(WarnMsg);
if (!MoveInfo.OneWaitCanEndStep) if (!MoveInfo.OneWaitCanEndStep)
{ {
isOk = false; isOk = false;
...@@ -164,7 +166,7 @@ namespace DeviceLibrary ...@@ -164,7 +166,7 @@ namespace DeviceLibrary
} }
else if (span.TotalSeconds > MoveInfo.TimeOutSeconds) else if (span.TotalSeconds > MoveInfo.TimeOutSeconds)
{ {
WarnMsg = Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒"; WarnMsg = Name + "[" + MoveInfo.MoveStep + "]等待" + NotOkMsg + "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
int second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10; int second = (int)(MoveInfo.TimeOutSeconds / span.TotalSeconds) * 10;
if (second > 120) if (second > 120)
...@@ -176,7 +178,9 @@ namespace DeviceLibrary ...@@ -176,7 +178,9 @@ namespace DeviceLibrary
second = 10; second = 10;
} }
LogUtil.error(WarnMsg, logType + 100, second); LogUtil.error(WarnMsg, logType + 100, second);
Alarm(AlarmType.IoSingleTimeOut, "", WarnMsg, MoveInfo.MoveType); //MoveInfo.errlog(WarnMsg);
Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
Msg.add(WarnMsg, MsgLevel.warning);
} }
return true; return true;
} }
...@@ -185,7 +189,7 @@ namespace DeviceLibrary ...@@ -185,7 +189,7 @@ namespace DeviceLibrary
/// </summary> /// </summary>
AlarmType alarmType = AlarmType.None; AlarmType alarmType = AlarmType.None;
DateTime LastAlarmTime = DateTime.Now; DateTime LastAlarmTime = DateTime.Now;
public void Alarm(AlarmType alarmType, string alarmDetial = "", string alarmMsg = "", MoveType storeMoveType = MoveType.None) public void Alarm(AlarmType alarmType, string alarmMsg = "")
{ {
if (alarmType.Equals(AlarmType.None).Equals(false)) if (alarmType.Equals(AlarmType.None).Equals(false))
{ {
...@@ -193,7 +197,7 @@ namespace DeviceLibrary ...@@ -193,7 +197,7 @@ namespace DeviceLibrary
} }
//SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType); //SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType);
if (this.alarmType.Equals(alarmType) && alarmType != AlarmType.SuddenStop && alarmType != AlarmType.NoAirCheck) if (this.alarmType.Equals(alarmType))
{ {
return; return;
} }
...@@ -221,37 +225,8 @@ namespace DeviceLibrary ...@@ -221,37 +225,8 @@ namespace DeviceLibrary
//storeStatus = StoreStatus.SuddenStop; //storeStatus = StoreStatus.SuddenStop;
} }
} }
int GetAlarmCodeByAxis(ConfigMoveAxis axis)
{/*
int alarmCode = LineAlarm.InOutAxisAlarm;
int axisType = axis.GetAxisValue() % 4;
if (axisType == 1)
{
alarmCode = LineAlarm.MiddleAxisAlarm;
}
else if (axisType == 2)
{
alarmCode = LineAlarm.UpDownAxisAlarm;
}
else if (axisType == 3)
{
alarmCode = LineAlarm.InOutAxisAlarm;
}
else
{
alarmCode = LineAlarm.CompressAxisAlarm;
}
return alarmCode;
*/
return 0;
}
internal bool NoAlarm() internal bool NoAlarm()
{ {
//if (isInSuddenDown || isNoAirCheck)
{
return false;
}
if (alarmType.Equals(AlarmType.None)) if (alarmType.Equals(AlarmType.None))
{ {
return true; return true;
......
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
partial class MainMachine
{
void IOMonitor()
{
if (RightMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.RightFornt_Check).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.LOW))
{
RightMoveInfo.NewMove(MoveStep.R40_InShelf);
LogUtil.info("IOMonitor:右侧检测到入料信号");
}
if (RightMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH)
&& !RightShelfNoTray)
{
RightMoveInfo.NewMove(MoveStep.R01);
LogUtil.info("IOMonitor:右侧有新料,准备上料");
}
if (LeftMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.LeftFornt_Check).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW))
{
LeftMoveInfo.NewMove(MoveStep.R40_InShelf);
LogUtil.info("IOMonitor:左侧检测到入料信号");
}
if (LeftMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH)
&& !LeftShelfNoTray)
{
LeftMoveInfo.NewMove(MoveStep.L01);
LogUtil.info("IOMonitor:左侧有新料,准备上料");
}
}
}
}
...@@ -3,8 +3,10 @@ using OnlineStore.Common; ...@@ -3,8 +3,10 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DeviceLibrary namespace DeviceLibrary
...@@ -47,8 +49,21 @@ namespace DeviceLibrary ...@@ -47,8 +49,21 @@ namespace DeviceLibrary
} }
break; break;
case MoveStep.Lbl10: case MoveStep.Lbl10:
Label_X_Axis.AbsMove(LabelMoveInfo, Config.Label_X_P3, Config.Label_X_P3_speed); Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Label_Y_Axis.AbsMove(LabelMoveInfo, Config.Label_Y_P3, Config.Label_Y_P3_speed); int widthOffset = Config.Label_Offset_Pixel_7;
switch (LabelMoveInfo.MoveParam.PlateW) {
case 13:
widthOffset = Config.Label_Offset_Pixel_13;
break;
case 15:
widthOffset = Config.Label_Offset_Pixel_15;
break;
}
Point p = Common.CalcLabelPoint(LabelMoveInfo.MoveParam.codeInfos, Right_Batch_Point, widthOffset);
Point p1 = new Point(p.X*Config.Cam_Pixel_X_Ratio,p.Y* Config.Cam_Pixel_Y_Ratio);
LabelMoveInfo.log($"计算贴标像素点位为{p},轴点位为{p1},盘宽{LabelMoveInfo.MoveParam.PlateW}");
Label_X_Axis.AbsMove(LabelMoveInfo, p.X, Config.Label_X_P2_speed);
Label_Y_Axis.AbsMove(LabelMoveInfo, p.Y, Config.Label_Y_P2_speed);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P3, Config.Label_Z_P3_speed); Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P3, Config.Label_Z_P3_speed);
LabelMoveInfo.NextMoveStep(MoveStep.Lbl11); LabelMoveInfo.NextMoveStep(MoveStep.Lbl11);
LabelMoveInfo.log("Label_XYZ转到贴标点."); LabelMoveInfo.log("Label_XYZ转到贴标点.");
...@@ -69,6 +84,9 @@ namespace DeviceLibrary ...@@ -69,6 +84,9 @@ namespace DeviceLibrary
LabelMoveInfo.NextMoveStep(MoveStep.Lbl01); LabelMoveInfo.NextMoveStep(MoveStep.Lbl01);
LabelMoveInfo.log("完成贴标."); LabelMoveInfo.log("完成贴标.");
break; break;
default:
LabelMoveInfo.log($"未找到对应步骤:{LabelMoveInfo.MoveStep}");
break;
} }
} }
......
using CodeLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
partial class MainMachine
{
Led AlarmLed;
Led StandbyLed;
Led RunningLed;
Led RightLed;
Led LeftLed;
List<Led> LedGroup;
System.Threading.Timer ledtimer;
void LedProcessInit()
{
ledtimer = new System.Threading.Timer(new TimerCallback(LedProcess), null, 0, 1000);
GC.KeepAlive(ledtimer);
}
void LedProcess(object o)
{
//无法运行,量报警灯
if (canRunning)
{
AlarmLed.LedState = LedState.on;
StandbyLed.LedState = LedState.off;
}
else {
AlarmLed.LedState = LedState.off;
StandbyLed.LedState = LedState.on;
}
//所有过程都在运动,闪烁运行中灯
if (!RightMoveInfo.IsStep(MoveStep.Wait)
|| !LeftMoveInfo.IsStep(MoveStep.Wait)
|| !MiddleMoveInfo.IsStep(MoveStep.M_Standby)
|| LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
{
RunningLed.LedState = LedState.blink;
}
else {
RunningLed.LedState = LedState.off;
}
if (alarmType == AlarmType.AxisAlarm
|| alarmType == AlarmType.AxisAlarm
|| alarmType == AlarmType.AxisMoveError) {
AlarmLed.LedState = LedState.on;
}
//右侧料串已空
if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH))
RightLed.LedState = LedState.blink;
else
RightLed.LedState = LedState.off;
//左侧料串已满
if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH))
LeftLed.LedState = LedState.blink;
else
LeftLed.LedState = LedState.off;
LedGroup.ForEach((x) => { x.run(); });
}
}
public class Led {
public LedState LedState = LedState.off;
ushort ledio;
public Led(ushort io) {
ledio = io;
}
IO_VALUE iovalue;
IO_VALUE lastiovalue;
public void run() {
if (this.LedState == LedState.on) {
iovalue = IO_VALUE.HIGH;
}
if (this.LedState == LedState.off)
{
iovalue = IO_VALUE.LOW;
}
if (this.LedState == LedState.blink)
{
if (iovalue == IO_VALUE.LOW)
{
iovalue = IO_VALUE.HIGH;
}
else {
iovalue = IO_VALUE.LOW;
}
}
if (iovalue != lastiovalue) {
lastiovalue = iovalue;
IOManager.WriteSingleDO("", 0x00, ledio, iovalue);
}
}
}
public enum LedState {
off,
on,
blink
}
}
...@@ -70,6 +70,7 @@ namespace DeviceLibrary ...@@ -70,6 +70,7 @@ namespace DeviceLibrary
} }
else else
{ {
LabelMoveInfo.MoveParam = LeftMoveInfo.MoveParam.clone();
LeftMoveInfo.NextMoveStep(MoveStep.L20_WaitLabel); LeftMoveInfo.NextMoveStep(MoveStep.L20_WaitLabel);
LeftMoveInfo.log($"批量轴完成上升,等待贴标"); LeftMoveInfo.log($"批量轴完成上升,等待贴标");
} }
...@@ -87,8 +88,88 @@ namespace DeviceLibrary ...@@ -87,8 +88,88 @@ namespace DeviceLibrary
break; break;
case MoveStep.LEND: case MoveStep.LEND:
LeftMoveInfo.EndMove(); LeftMoveInfo.EndMove();
LeftMoveInfo.log($"结束运动");
break; break;
//}
//料窜出料流程
//switch (LeftMoveInfo.MoveStep)
//{
case MoveStep.L50_OutShelf:
LeftMoveInfo.NextMoveStep(MoveStep.L51);
Left_Batch_Axis.AbsMove(LeftMoveInfo, Config.Left_Batch_P1, Config.Left_Batch_P1_speed);
LeftMoveInfo.log($"批量轴下降到P1位置");
break;
case MoveStep.L51:
LeftMoveInfo.NextMoveStep(MoveStep.L52);
CylinderMove(null, IO_Type.LeftStopUP, IO_Type.LeftStopDown);
LeftMoveInfo.log($"阻挡下降");
break;
case MoveStep.L52:
LeftMoveInfo.NextMoveStep(MoveStep.L53);
IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.HIGH);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH, false);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.LOW));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
LeftMoveInfo.log($"电滚筒向外滚动");
break;
case MoveStep.L53:
LeftMoveInfo.NextMoveStep(MoveStep.L54);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftFornt_Check, IO_VALUE.LOW));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
LeftMoveInfo.OneWaitCanEndStep = true;
LeftMoveInfo.log($"等待前置检测拉低");
break;
case MoveStep.L54:
LeftMoveInfo.NextMoveStep(MoveStep.REND);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW, false, 500);
LeftMoveInfo.log($"电滚停止");
break;
//}
//料窜入料流程
//switch (LeftMoveInfo.MoveStep)
//{
case MoveStep.L60_InShelf:
LeftMoveInfo.NextMoveStep(MoveStep.L61);
Left_Batch_Axis.AbsMove(LeftMoveInfo, Config.Left_Batch_P1, Config.Left_Batch_P1_speed);
LeftMoveInfo.log($"批量轴下降到P1位置");
break;
case MoveStep.L61:
LeftMoveInfo.NextMoveStep(MoveStep.L62);
IOMove(IO_Type.LeftStopUP, IO_VALUE.LOW);
LeftMoveInfo.log($"阻挡下降");
break;
case MoveStep.L62:
LeftMoveInfo.NextMoveStep(MoveStep.L63);
IOMove(IO_Type.LeftMoto_Reverse, IO_VALUE.LOW);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH, false);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
LeftMoveInfo.OneWaitCanEndStep = true;
LeftMoveInfo.log($"等待料窜到位");
break;
case MoveStep.L63:
LeftMoveInfo.NextMoveStep(MoveStep.L64);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW, false, 500);
IOMove(IO_Type.LeftStopUP, IO_VALUE.HIGH);
LeftMoveInfo.log($"电滚筒停止,阻挡上升");
break;
case MoveStep.L64:
if (IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH))
{
LeftMoveInfo.NewMove(MoveStep.L01);
LeftMoveInfo.log($"料窜进入开始上料");
}
else
{
LeftMoveInfo.NextMoveStep(MoveStep.LEND);
LeftMoveInfo.log($"料窜进入失败");
} }
break;
default:
LeftMoveInfo.log($"未找到对应步骤:{LeftMoveInfo.MoveStep}");
break;
}
} }
......
...@@ -19,14 +19,17 @@ namespace DeviceLibrary ...@@ -19,14 +19,17 @@ namespace DeviceLibrary
switch (MiddleMoveInfo.MoveStep) switch (MiddleMoveInfo.MoveStep)
{ {
case MoveStep.M01: case MoveStep.M_Standby:
if (RightMoveInfo.MoveStep == MoveStep.R10_WaitReelLeave) if (RightMoveInfo.MoveStep == MoveStep.R10_WaitReelLeave)
{ {
MiddleMoveInfo.NextMoveStep(MoveStep.M02); MiddleMoveInfo.NextMoveStep(MoveStep.M02);
Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P2, Config.Take_Middle_P2_speed); Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P2, Config.Take_Middle_P2_speed);
Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P2, Config.Take_UpDown_P2_speed); Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P2, Config.Take_UpDown_P2_speed);
electricClamp.Release(); electricClamp.Release();
//复制右侧料盘信息
MiddleMoveInfo.MoveParam = RightMoveInfo.MoveParam.clone();
MiddleMoveInfo.log("右侧可以取料,旋转轴/上下轴转到P2点"); MiddleMoveInfo.log("右侧可以取料,旋转轴/上下轴转到P2点");
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightArm_Check, IO_VALUE.HIGH));
} }
else if (MiddleMoveInfo.IsTimeOut(60)) { else if (MiddleMoveInfo.IsTimeOut(60)) {
MiddleMoveInfo.log("等待右侧可以取料"); MiddleMoveInfo.log("等待右侧可以取料");
...@@ -50,9 +53,37 @@ namespace DeviceLibrary ...@@ -50,9 +53,37 @@ namespace DeviceLibrary
MiddleMoveInfo.log("上下轴返回P2点"); MiddleMoveInfo.log("上下轴返回P2点");
break; break;
case MoveStep.M05: case MoveStep.M05:
if (electricClamp.IsClamp)
{
MiddleMoveInfo.NextMoveStep(MoveStep.M06); MiddleMoveInfo.NextMoveStep(MoveStep.M06);
RightMoveInfo.NextMoveStep(MoveStep.R11_NextReel); RightMoveInfo.NextMoveStep(MoveStep.R11_NextReel);
MiddleMoveInfo.log("通知右侧料串,料已取走"); MiddleMoveInfo.log("通知右侧料串,料已取走");
}
else if (LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut){
if (MiddleMoveInfo.MoveParam.IsNg)
{
Msg.add("抓料失败请手动处理,请将料盘放入:NG箱,按右侧按钮继续", MsgLevel.warning);
}
else {
Msg.add("抓料失败请手动处理,请将料盘放入: 左侧料串,按右侧按钮继续", MsgLevel.warning);
}
if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH))
{
RightMoveInfo.NextMoveStep(MoveStep.R11_NextReel);
if (MiddleMoveInfo.MoveParam.IsNg)
{
MiddleMoveInfo.NextMoveStep(MoveStep.M_ReturnToP1);
}
else {
MiddleMoveInfo.NextMoveStep(MoveStep.M06);
}
}
}
else if (MiddleMoveInfo.IsTimeOut(60))
{
MiddleMoveInfo.log("抓料失败,等待左侧允许放料");
}
break; break;
case MoveStep.M06: case MoveStep.M06:
if (MiddleMoveInfo.MoveParam.IsNg) if (MiddleMoveInfo.MoveParam.IsNg)
...@@ -60,14 +91,10 @@ namespace DeviceLibrary ...@@ -60,14 +91,10 @@ namespace DeviceLibrary
MiddleMoveInfo.NextMoveStep(MoveStep.M20_ToNgBox); MiddleMoveInfo.NextMoveStep(MoveStep.M20_ToNgBox);
MiddleMoveInfo.log("判断为NG料"); MiddleMoveInfo.log("判断为NG料");
} }
//等待计算盘高 //等待右侧料窜计算盘高
else if (RightMoveInfo.MoveStep >= MoveStep.R06 && RightMoveInfo.MoveStep <= MoveStep.R10_WaitReelLeave) else if (RightMoveInfo.MoveStep >= MoveStep.R06_GettedReelHigh && RightMoveInfo.MoveStep <= MoveStep.R10_WaitReelLeave)
{ {
MiddleMoveInfo.NextMoveStep(MoveStep.M07); MiddleMoveInfo.NextMoveStep(MoveStep.M07);
MiddleMoveInfo.MoveParam.IsNg = RightMoveInfo.MoveParam.IsNg;
MiddleMoveInfo.MoveParam.WareCode = RightMoveInfo.MoveParam.WareCode;
MiddleMoveInfo.MoveParam.codeInfos = RightMoveInfo.MoveParam.codeInfos;
MiddleMoveInfo.MoveParam.PlateW = MiddleMoveInfo.MoveParam.PlateW;
MiddleMoveInfo.MoveParam.PlateH = LastHeight; MiddleMoveInfo.MoveParam.PlateH = LastHeight;
MiddleMoveInfo.NextMoveStep(MoveStep.M07); MiddleMoveInfo.NextMoveStep(MoveStep.M07);
...@@ -83,9 +110,18 @@ namespace DeviceLibrary ...@@ -83,9 +110,18 @@ namespace DeviceLibrary
if (LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut) if (LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut)
{ {
MiddleMoveInfo.NextMoveStep(MoveStep.M08); MiddleMoveInfo.NextMoveStep(MoveStep.M08);
if (electricClamp.IsClamp)
{
Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P3, Config.Take_Middle_P3_speed); Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P3, Config.Take_Middle_P3_speed);
Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P4, Config.Take_UpDown_P4_speed); Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P4, Config.Take_UpDown_P4_speed);
MiddleMoveInfo.log("左侧允许放料,旋转轴/上下周到P3/P4"); MiddleMoveInfo.log("左侧允许放料,旋转轴/上下周到P3/P4");
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftArm_Check, IO_VALUE.HIGH));
}
else {
//Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P1, Config.Take_Middle_P1_speed);
//Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P1, Config.Take_UpDown_P1_speed);
MiddleMoveInfo.log("没有抓到料,继续下一步");
}
} }
else if (MiddleMoveInfo.IsTimeOut(60)) else if (MiddleMoveInfo.IsTimeOut(60))
{ {
...@@ -95,12 +131,13 @@ namespace DeviceLibrary ...@@ -95,12 +131,13 @@ namespace DeviceLibrary
case MoveStep.M08: case MoveStep.M08:
MiddleMoveInfo.NextMoveStep(MoveStep.M_ReturnToP1); MiddleMoveInfo.NextMoveStep(MoveStep.M_ReturnToP1);
electricClamp.Release(); electricClamp.Release();
LeftMoveInfo.MoveParam = MiddleMoveInfo.MoveParam.clone();
LeftMoveInfo.NextMoveStep(MoveStep.L11_ReelPutted); LeftMoveInfo.NextMoveStep(MoveStep.L11_ReelPutted);
MiddleMoveInfo.log("取料夹爪放松,通知左侧料窜已放入,左侧等待3秒"); MiddleMoveInfo.log("取料夹爪放松,通知左侧料窜已放入,左侧等待3秒");
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
break; break;
case MoveStep.M_ReturnToP1: case MoveStep.M_ReturnToP1:
MiddleMoveInfo.NextMoveStep(MoveStep.M01); MiddleMoveInfo.NextMoveStep(MoveStep.M_Standby);
Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P1, Config.Take_Middle_P1_speed); Take_Middle_Axis.AbsMove(MiddleMoveInfo, Config.Take_Middle_P1, Config.Take_Middle_P1_speed);
Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P1, Config.Take_UpDown_P1_speed); Take_UpDown_Axis.AbsMove(MiddleMoveInfo, Config.Take_UpDown_P1, Config.Take_UpDown_P1_speed);
MiddleMoveInfo.log("放料完成,旋转轴/上下轴返回待机点"); MiddleMoveInfo.log("放料完成,旋转轴/上下轴返回待机点");
...@@ -116,7 +153,9 @@ namespace DeviceLibrary ...@@ -116,7 +153,9 @@ namespace DeviceLibrary
electricClamp.Release(); electricClamp.Release();
MiddleMoveInfo.log("取料夹爪放松,放料入NG位置."); MiddleMoveInfo.log("取料夹爪放松,放料入NG位置.");
break; break;
default:
MiddleMoveInfo.log($"未找到对应步骤:{MiddleMoveInfo.MoveStep}");
break;
} }
} }
......
...@@ -13,18 +13,13 @@ namespace DeviceLibrary ...@@ -13,18 +13,13 @@ namespace DeviceLibrary
partial class MainMachine partial class MainMachine
{ {
string PrintName = ConfigAppSettings.GetValue(Setting_Init.PrinterName);
Asa.PrintLabel PrintBean = null; //Asa.PrintLabel PrintBean = null;
public void InitPrint() public void InitPrint()
{ {
PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label"); //RobotManage.PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label");
PrintBean.PrintStatusChanged += Print_PrintStatusChanged; RobotManage.PrintBean.PrintStatusChanged += Print_PrintStatusChanged;
string labelName = ConfigAppSettings.GetValue(Setting_Init.LabelName); /*
PrintBean.LoadLabel(labelName);
PrintBean.Printer(PrintName, false);
LogUtil.info("PrintLabel 打印机初始化完成【" + labelName + "】【" + PrintName + "】");
System.Drawing.Printing.PrintDocument print = new System.Drawing.Printing.PrintDocument(); System.Drawing.Printing.PrintDocument print = new System.Drawing.Printing.PrintDocument();
string sDefault = print.PrinterSettings.PrinterName;//默认打印机名 string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
LogUtil.info("PrintLabel 本机默认打印机:" + sDefault); LogUtil.info("PrintLabel 本机默认打印机:" + sDefault);
...@@ -33,8 +28,9 @@ namespace DeviceLibrary ...@@ -33,8 +28,9 @@ namespace DeviceLibrary
{ {
LogUtil.info("PrintLabel 打印机_" + index + "_名称:" + sPrint); LogUtil.info("PrintLabel 打印机_" + index + "_名称:" + sPrint);
index++; index++;
}*/
} }
}
Asa.PrintLabel.PrinterStatus LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown; Asa.PrintLabel.PrinterStatus LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown;
void Print_PrintStatusChanged(Asa.PrintLabel.PrinterStatus sta, string msg) void Print_PrintStatusChanged(Asa.PrintLabel.PrinterStatus sta, string msg)
{ {
...@@ -45,7 +41,17 @@ namespace DeviceLibrary ...@@ -45,7 +41,17 @@ namespace DeviceLibrary
else else
{ {
if (sta == Asa.PrintLabel.PrinterStatus.Idle) { if (sta == Asa.PrintLabel.PrinterStatus.Idle) {
Task.Run(()=> {
while (true)
{
if (LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
{
LabelMoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
break;
}
Task.Delay(500).Wait();
}
});
} }
LogUtil.info(" PrintLabel 收到打印机新状态:【" + sta + "】【" + msg + "】,与之前状态一样 "); LogUtil.info(" PrintLabel 收到打印机新状态:【" + sta + "】【" + msg + "】,与之前状态一样 ");
} }
...@@ -64,7 +70,7 @@ namespace DeviceLibrary ...@@ -64,7 +70,7 @@ namespace DeviceLibrary
text.Add("DateTime", System.DateTime.Now.ToString("F")); text.Add("DateTime", System.DateTime.Now.ToString("F"));
text.Add("FactoryCode", FactoryCode); text.Add("FactoryCode", FactoryCode);
PrintBean.Print(text); RobotManage.PrintBean.Print(text);
LogUtil.info("PrintLabel 打印标签 StartPrintLabel 结束 "); LogUtil.info("PrintLabel 打印标签 StartPrintLabel 结束 ");
} }
catch (Exception ex) catch (Exception ex)
...@@ -75,15 +81,9 @@ namespace DeviceLibrary ...@@ -75,15 +81,9 @@ namespace DeviceLibrary
public Task DoPrint(string aaa) { public Task DoPrint(string aaa) {
return Task.Run((aaa)=> { return Task.Run(() =>
StartPrintLabel(aaa, aaa, aaa);
while()
if (LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
{ {
StartPrintLabel(aaa, aaa, aaa);
}
}); });
} }
......
...@@ -3,6 +3,7 @@ using OnlineStore.Common; ...@@ -3,6 +3,7 @@ using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -16,7 +17,7 @@ namespace DeviceLibrary ...@@ -16,7 +17,7 @@ namespace DeviceLibrary
{ {
if (CheckWait(RightMoveInfo)) if (CheckWait(RightMoveInfo))
return; return;
//常规上料扫码流程
switch (RightMoveInfo.MoveStep) switch (RightMoveInfo.MoveStep)
{ {
case MoveStep.R01: case MoveStep.R01:
...@@ -36,14 +37,15 @@ namespace DeviceLibrary ...@@ -36,14 +37,15 @@ namespace DeviceLibrary
Right_Batch_Axis.AbsMove(RightMoveInfo, RightStartMovePosition, Config.Right_Batch_P2_speed); Right_Batch_Axis.AbsMove(RightMoveInfo, RightStartMovePosition, Config.Right_Batch_P2_speed);
RightMoveInfo.log($"批量轴上升过头,下降到:RightStartMovePosition={RightStartMovePosition}"); RightMoveInfo.log($"批量轴上升过头,下降到:RightStartMovePosition={RightStartMovePosition}");
} }
else { else
{
RightMoveInfo.NextMoveStep(MoveStep.R04); RightMoveInfo.NextMoveStep(MoveStep.R04);
} }
break; break;
case MoveStep.R04: case MoveStep.R04:
if (IOValue(IO_Type.RightTop_Check).Equals(IO_VALUE.LOW) && RightShelfNoTray.Equals(false)) if (IOValue(IO_Type.RightTop_Check).Equals(IO_VALUE.LOW) && RightShelfNoTray.Equals(false))
{ {
RightMoveInfo.NextMoveStep(MoveStep.R06); RightMoveInfo.NextMoveStep(MoveStep.R06_GettedReelHigh);
GetHeight(); GetHeight();
ScanCode(); ScanCode();
RightMoveInfo.log($"开始扫码,并获取上一盘料高度,LastHeight={LastHeight}"); RightMoveInfo.log($"开始扫码,并获取上一盘料高度,LastHeight={LastHeight}");
...@@ -70,10 +72,9 @@ namespace DeviceLibrary ...@@ -70,10 +72,9 @@ namespace DeviceLibrary
RightMoveInfo.log($"批量轴已上升到顶,料串已满."); RightMoveInfo.log($"批量轴已上升到顶,料串已满.");
} }
break; break;
case MoveStep.R06: case MoveStep.R06_GettedReelHigh:
if (RightScanTask.IsCompleted) if (RightScanTask.IsCompleted)
{ {
RightMoveInfo.NextMoveStep(MoveStep.R10_WaitReelLeave);
var x = RightScanTask.Result; var x = RightScanTask.Result;
if (x.Count == 0) if (x.Count == 0)
{ {
...@@ -83,11 +84,14 @@ namespace DeviceLibrary ...@@ -83,11 +84,14 @@ namespace DeviceLibrary
else else
{ {
RightMoveInfo.MoveParam.codeInfos = x; RightMoveInfo.MoveParam.codeInfos = x;
//调用标签打印
DoPrint("123"); DoPrint("123");
RightMoveInfo.log($"已完成扫码,等待料盘被取走 Count={x.Count}"); RightMoveInfo.log($"已完成扫码,等待料盘被取走 Count={x.Count}");
} }
RightMoveInfo.NextMoveStep(MoveStep.R10_WaitReelLeave);
} }
else if (RightMoveInfo.IsTimeOut(10)) { else if (RightMoveInfo.IsTimeOut(10))
{
RightMoveInfo.log($"等待扫码超时"); RightMoveInfo.log($"等待扫码超时");
} }
break; break;
...@@ -98,17 +102,95 @@ namespace DeviceLibrary ...@@ -98,17 +102,95 @@ namespace DeviceLibrary
RightMoveInfo.log($"料盘已取走,开始准备下一盘料"); RightMoveInfo.log($"料盘已取走,开始准备下一盘料");
break; break;
case MoveStep.R12_ShelfNoTray: case MoveStep.R12_ShelfNoTray:
RightMoveInfo.NextMoveStep(MoveStep.R20); RightMoveInfo.NextMoveStep(MoveStep.REND);
Right_Batch_Axis.AbsMove(RightMoveInfo, Config.Right_Batch_P1, Config.Right_Batch_P1_speed); Right_Batch_Axis.AbsMove(RightMoveInfo, Config.Right_Batch_P1, Config.Right_Batch_P1_speed);
RightMoveInfo.log($"料窜已取完, 批量轴下降到P1"); RightMoveInfo.log($"料窜已取完, 批量轴下降到P1");
break; break;
case MoveStep.R20: case MoveStep.REND:
RightMoveInfo.log($"结束运动");
RightMoveInfo.EndMove(); RightMoveInfo.EndMove();
break; break;
case MoveStep.REND: //}
//料窜出料流程
//switch (RightMoveInfo.MoveStep)
//{
case MoveStep.R30_OutShelf:
RightMoveInfo.NextMoveStep(MoveStep.R31);
Right_Batch_Axis.AbsMove(RightMoveInfo, Config.Right_Batch_P1, Config.Right_Batch_P1_speed);
RightMoveInfo.log($"批量轴下降到P1位置");
break;
case MoveStep.R31:
RightMoveInfo.NextMoveStep(MoveStep.R32);
CylinderMove(null, IO_Type.RightStopUP, IO_Type.RightStopDown);
RightMoveInfo.log($"阻挡下降");
break;
case MoveStep.R32:
RightMoveInfo.NextMoveStep(MoveStep.R33);
IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.HIGH);
IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH, false);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightEnd_Check, IO_VALUE.LOW));
RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
RightMoveInfo.log($"电滚筒向外滚动");
break; break;
case MoveStep.R33:
RightMoveInfo.NextMoveStep(MoveStep.R34);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightFornt_Check, IO_VALUE.LOW));
RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
RightMoveInfo.OneWaitCanEndStep = true;
RightMoveInfo.log($"等待前置检测拉低");
break;
case MoveStep.R34:
RightMoveInfo.NextMoveStep(MoveStep.REND);
IOMove(IO_Type.RightMoto_Run, IO_VALUE.LOW, false, 500);
RightMoveInfo.log($"电滚停止");
break;
//}
//料窜入料流程
//switch (RightMoveInfo.MoveStep)
//{
case MoveStep.R40_InShelf:
RightMoveInfo.NextMoveStep(MoveStep.R41);
Right_Batch_Axis.AbsMove(RightMoveInfo, Config.Right_Batch_P1, Config.Right_Batch_P1_speed);
RightMoveInfo.log($"批量轴下降到P1位置");
break;
case MoveStep.R41:
RightMoveInfo.NextMoveStep(MoveStep.R42);
IOMove(IO_Type.RightStopUP, IO_VALUE.LOW);
RightMoveInfo.log($"阻挡下降");
break;
case MoveStep.R42:
RightMoveInfo.NextMoveStep(MoveStep.R43);
IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.LOW);
IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH, false);
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightEnd_Check, IO_VALUE.HIGH));
RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
RightMoveInfo.OneWaitCanEndStep = true;
RightMoveInfo.log($"等待料窜到位");
break;
case MoveStep.R43:
RightMoveInfo.NextMoveStep(MoveStep.R44);
IOMove(IO_Type.RightMoto_Run, IO_VALUE.LOW, false,500);
IOMove(IO_Type.RightStopUP, IO_VALUE.HIGH);
RightMoveInfo.log($"电滚筒停止,阻挡上升");
break;
case MoveStep.R44:
if (IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH))
{
RightMoveInfo.NewMove(MoveStep.R01);
RightMoveInfo.log($"料窜进入开始上料");
} }
else
{
RightMoveInfo.NextMoveStep(MoveStep.REND);
RightMoveInfo.log($"料窜进入失败");
} }
break;
default:
RightMoveInfo.log($"未找到对应步骤:{RightMoveInfo.MoveStep}");
break;
}
}
/// <summary> /// <summary>
/// 扫码线程 /// 扫码线程
/// </summary> /// </summary>
...@@ -132,6 +214,13 @@ namespace DeviceLibrary ...@@ -132,6 +214,13 @@ namespace DeviceLibrary
LastCodeList = CodeManager.CameraScan(new List<string> { Config.RightCameraName }); LastCodeList = CodeManager.CameraScan(new List<string> { Config.RightCameraName });
} }
IOMove(IO_Type.Camera_Led, IO_VALUE.LOW); IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
//Point Right_Batch_Point = new Point(Config.Right_Batch_X, Config.Right_Batch_Y);
//LastCodeList.ForEach((c)=> {
// Point op = Common.PointRotate(Right_Batch_Point, new Point(c.X, c.Y), 83d / 180 * Math.PI);
// c.X = op.X;
// c.Y = op.Y;
//});
return LastCodeList; return LastCodeList;
})); }));
} }
......
...@@ -13,7 +13,18 @@ namespace DeviceLibrary ...@@ -13,7 +13,18 @@ namespace DeviceLibrary
public partial class MainMachine : IRobot public partial class MainMachine : IRobot
{ {
public string Name { get; set; } = "移载"; public string Name { get; set; } = "移载";
public bool canRunning { get; set; } = false; private bool _canRunning=true;
public bool canRunning
{
get { return _canRunning; }
set
{
if (_canRunning != value) {
Msg.setlogones();
}
_canRunning = value;
}
}
public bool isBusy { get; set; } = false; public bool isBusy { get; set; } = false;
public bool isAlarm { get; set; } = false; public bool isAlarm { get; set; } = false;
public RunStatus runStatus { get; set; } = RunStatus.Stop; public RunStatus runStatus { get; set; } = RunStatus.Stop;
...@@ -29,9 +40,13 @@ namespace DeviceLibrary ...@@ -29,9 +40,13 @@ namespace DeviceLibrary
MoveInfo LabelMoveInfo; MoveInfo LabelMoveInfo;
MoveInfo MiddleMoveInfo; MoveInfo MiddleMoveInfo;
List<MoveInfo> moveInfoList;
public delegate void ProcessMsg(List<Msg> msg); public delegate void ProcessMsg(List<Msg> msg);
public event ProcessMsg ProcessMsgEvent; public event ProcessMsg ProcessMsgEvent;
public delegate void ProcessMoveinfo(List<MoveInfo> moveinfoList);
public event ProcessMoveinfo ProcessMoveinfoEvent;
AxisBean Take_Middle_Axis; AxisBean Take_Middle_Axis;
AxisBean Take_UpDown_Axis; AxisBean Take_UpDown_Axis;
AxisBean Left_Batch_Axis; AxisBean Left_Batch_Axis;
...@@ -62,8 +77,15 @@ namespace DeviceLibrary ...@@ -62,8 +77,15 @@ namespace DeviceLibrary
LabelMoveInfo = new MoveInfo("贴标"); LabelMoveInfo = new MoveInfo("贴标");
MiddleMoveInfo = new MoveInfo("移栽"); MiddleMoveInfo = new MoveInfo("移栽");
MiddleMoveInfo.NextMoveStep(MoveStep.M01); moveInfoList = new List<MoveInfo> { RightMoveInfo, MiddleMoveInfo, LabelMoveInfo, LeftMoveInfo, ResetMoveInfo };
LabelMoveInfo.NextMoveStep(MoveStep.Lbl01);
AlarmLed = new Led(Config.DOList[IO_Type.Alarm_HddLed].GetIOAddr());
StandbyLed = new Led(Config.DOList[IO_Type.RunSign_HddLed].GetIOAddr());
RunningLed = new Led(Config.DOList[IO_Type.AutoRun_HddLed].GetIOAddr());
RightLed = new Led(Config.DOList[IO_Type.RightState_Led].GetIOAddr());
LeftLed = new Led(Config.DOList[IO_Type.LeftState_Led].GetIOAddr());
LedGroup = new List<Led> { AlarmLed, StandbyLed, RunningLed, RightLed, LeftLed };
Take_Middle_Axis = new AxisBean(Config.Take_Middle_Axis, Name); Take_Middle_Axis = new AxisBean(Config.Take_Middle_Axis, Name);
Take_UpDown_Axis = new AxisBean(Config.Take_UpDown_Axis, Name); Take_UpDown_Axis = new AxisBean(Config.Take_UpDown_Axis, Name);
...@@ -74,10 +96,11 @@ namespace DeviceLibrary ...@@ -74,10 +96,11 @@ namespace DeviceLibrary
Label_Z_Axis = new AxisBean(Config.Label_Z_Axis, Name); Label_Z_Axis = new AxisBean(Config.Label_Z_Axis, Name);
Label_R_Axis = new AxisBean(Config.Label_R_Axis, Name); Label_R_Axis = new AxisBean(Config.Label_R_Axis, Name);
electricClamp = new ElectricGripper(); electricClamp = RobotManage.electricGripper;
electricClamp.OpenPort("");
InitPrint(); InitPrint();
LedProcessInit();
} }
/// <summary> /// <summary>
/// 整机启动变量 /// 整机启动变量
...@@ -91,6 +114,7 @@ namespace DeviceLibrary ...@@ -91,6 +114,7 @@ namespace DeviceLibrary
canRunning = DeviceCheck(); canRunning = DeviceCheck();
if (canRunning) if (canRunning)
{ {
BtnProcess();
canRunning = SafeCheck(); canRunning = SafeCheck();
} }
Thread.Sleep(50); Thread.Sleep(50);
...@@ -98,6 +122,7 @@ namespace DeviceLibrary ...@@ -98,6 +122,7 @@ namespace DeviceLibrary
continue; continue;
if (runStatus == RunStatus.Running) if (runStatus == RunStatus.Running)
{ {
IOMonitor();
RightProcess(); RightProcess();
MiddleProcess(); MiddleProcess();
LeftProcess(); LeftProcess();
...@@ -113,10 +138,11 @@ namespace DeviceLibrary ...@@ -113,10 +138,11 @@ namespace DeviceLibrary
} }
finally { finally {
ProcessMsgEvent?.Invoke(Msg.get()); ProcessMsgEvent?.Invoke(Msg.get());
ProcessMoveinfoEvent?.Invoke(moveInfoList);
Msg.clear(); Msg.clear();
} }
} }
LogUtil.info("主线程已退出.");
} }
public void Stop() { public void Stop() {
mstart = false; mstart = false;
...@@ -131,8 +157,8 @@ namespace DeviceLibrary ...@@ -131,8 +157,8 @@ namespace DeviceLibrary
OpenAllServo(); OpenAllServo();
alarmType = AlarmType.None; alarmType = AlarmType.None;
runStatus = RunStatus.HomeReset; runStatus = RunStatus.HomeReset;
ResetMoveInfo.NextMoveStep(MoveStep.H01_HomeReset); ResetMoveInfo.NewMove(MoveStep.H01_HomeReset);
RightMoveInfo.log("开始回原"); ResetMoveInfo.log("开始回原");
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
void HomeReset() void HomeReset()
...@@ -192,10 +218,14 @@ namespace DeviceLibrary ...@@ -192,10 +218,14 @@ namespace DeviceLibrary
case MoveStep.HEND_HomeReset: case MoveStep.HEND_HomeReset:
ResetMoveInfo.log("回源完成"); ResetMoveInfo.log("回源完成");
ResetMoveInfo.EndMove(); ResetMoveInfo.EndMove();
MiddleMoveInfo.NewMove(MoveStep.M_Standby);
LabelMoveInfo.NewMove(MoveStep.Lbl01);
runStatus = RunStatus.Running;
break; break;
} }
} }
public bool IgnoreSafecheck=false;
public bool IgnoreGratingSignal = false;
bool SafeCheck() { bool SafeCheck() {
bool ok = true; bool ok = true;
if (UserPause) if (UserPause)
...@@ -206,6 +236,7 @@ namespace DeviceLibrary ...@@ -206,6 +236,7 @@ namespace DeviceLibrary
if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW))
{ {
Msg.add("安全光栅被遮挡", MsgLevel.warning); Msg.add("安全光栅被遮挡", MsgLevel.warning);
if (!IgnoreSafecheck && !IgnoreGratingSignal)
ok = false; ok = false;
} }
if (IOValue(IO_Type.HasNgBox).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.HasNgBox).Equals(IO_VALUE.LOW))
...@@ -215,17 +246,19 @@ namespace DeviceLibrary ...@@ -215,17 +246,19 @@ namespace DeviceLibrary
} }
if (IOValue(IO_Type.HasPrinter).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.HasPrinter).Equals(IO_VALUE.LOW))
{ {
Msg.add("没有检测到NG料箱", MsgLevel.warning); Msg.add("没有检测打印机", MsgLevel.warning);
ok = false; ok = false;
} }
if (IOValue(IO_Type.LeftBackDoor_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.LeftBackDoor_Check).Equals(IO_VALUE.LOW))
{ {
Msg.add("左后门没有关闭", MsgLevel.warning); Msg.add("左后门没有关闭", MsgLevel.warning);
if (!IgnoreSafecheck)
ok = false; ok = false;
} }
if (IOValue(IO_Type.RightBackDoor_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.RightBackDoor_Check).Equals(IO_VALUE.LOW))
{ {
Msg.add("右后门没有关闭", MsgLevel.warning); Msg.add("右后门没有关闭", MsgLevel.warning);
if (!IgnoreSafecheck)
ok = false; ok = false;
} }
return ok; return ok;
...@@ -234,14 +267,20 @@ namespace DeviceLibrary ...@@ -234,14 +267,20 @@ namespace DeviceLibrary
/// 最后一次气压检测变为0的时间 /// 最后一次气压检测变为0的时间
/// </summary> /// </summary>
DateTime lastAirCloseTime = DateTime.MinValue; DateTime lastAirCloseTime = DateTime.MinValue;
bool DeviceCheck() {
public bool DeviceCheck() {
bool ok = true; bool ok = true;
bool SuddenStop = false;
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{ {
Msg.add("急停中",MsgLevel.warning); Alarm(AlarmType.SuddenStop);
Msg.add("急停中", MsgLevel.warning);
ok = false;
}
else if (alarmType == AlarmType.SuddenStop) {
Msg.add("系统需要重置", MsgLevel.info);
ok = false; ok = false;
SuddenStop = true;
} }
if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW))
{ {
...@@ -258,11 +297,11 @@ namespace DeviceLibrary ...@@ -258,11 +297,11 @@ namespace DeviceLibrary
else { else {
lastAirCloseTime = DateTime.MinValue; lastAirCloseTime = DateTime.MinValue;
} }
if (!SuddenStop) if (alarmType!=AlarmType.SuddenStop)
{ {
foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList) foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList)
{ {
if (AxisManager.GetAlarmStatus("", configMoveAxis.GetAxisValue) == 1) if (AxisManager.GetAlarmStatus("", configMoveAxis.GetAxisValue()) == 1)
{ {
Msg.add($"{configMoveAxis.DeviceName}:运动报警", MsgLevel.warning); Msg.add($"{configMoveAxis.DeviceName}:运动报警", MsgLevel.warning);
ok = false; ok = false;
......
...@@ -13,39 +13,21 @@ namespace DeviceLibrary ...@@ -13,39 +13,21 @@ namespace DeviceLibrary
public int TimeOutSeconds = 60; public int TimeOutSeconds = 60;
public MoveInfo(string name) public MoveInfo(string name)
{ {
moveType = MoveType.None; MoveParam = new LabelParam();
MoveParam = new LabelParam(MoveType.None);
this.moveStep = MoveStep.Wait; this.moveStep = MoveStep.Wait;
IsInWait = false; IsInWait = false;
this.Name = name; this.Name = name;
} }
public string Name { get; set; } public string Name { get; set; }
public DateTime LastSetpTime { get; set; } public DateTime LastSetpTime { get; set; }
public bool OneWaitCanEndStep = false; public bool OneWaitCanEndStep = false;
public string SLog
{
get { return " " + MoveStep + " "; }
}
private MoveType moveType = MoveType.None;
public MoveType MoveType
{
get { return moveType; }
}
public LabelParam MoveParam { get; set; } public LabelParam MoveParam { get; set; }
public bool IsInWait { get; set; } public bool IsInWait { get; set; }
MoveStep moveStep; MoveStep moveStep;
public int CanWhileCount = 0; public int CanWhileCount = 0;
public MoveStep MoveStep public MoveStep MoveStep
...@@ -55,6 +37,11 @@ namespace DeviceLibrary ...@@ -55,6 +37,11 @@ namespace DeviceLibrary
public int ErrorLogType { get; internal set; } public int ErrorLogType { get; internal set; }
public void NewMove(MoveStep step)
{
this.MoveParam = new LabelParam();
NextMoveStep(step);
}
public void NextMoveStep(MoveStep step) public void NextMoveStep(MoveStep step)
{ {
// PreMoveStep = moveStep; // PreMoveStep = moveStep;
...@@ -73,37 +60,20 @@ namespace DeviceLibrary ...@@ -73,37 +60,20 @@ namespace DeviceLibrary
IsInWait = false; IsInWait = false;
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
} }
void NewMove(MoveType type, LabelParam param = null)
{
moveStep = MoveStep.Wait;
this.moveType = type;
if (param == null)
{
param = new LabelParam(type);
}
this.MoveParam = param;
LastSetpTime = DateTime.Now;
WaitList = new List<WaitResultInfo>();
}
public void EndMove() public void EndMove()
{ {
this.moveType = MoveType.None; this.MoveParam = new LabelParam();
this.MoveParam = new LabelParam(moveType);
moveStep = MoveStep.Wait; moveStep = MoveStep.Wait;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
IsInWait = false; IsInWait = false;
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
CanWhileCount = 0; CanWhileCount = 0;
} }
public MoveInfo clone()
{
return (MoveInfo)this.MemberwiseClone();
}
public List<WaitResultInfo> WaitList = new List<WaitResultInfo>(); public List<WaitResultInfo> WaitList = new List<WaitResultInfo>();
public bool IsStep(MoveStep step)
internal bool IsStep(MoveStep step)
{ {
return moveStep.Equals(step); return moveStep.Equals(step);
} }
...@@ -131,6 +101,18 @@ namespace DeviceLibrary ...@@ -131,6 +101,18 @@ namespace DeviceLibrary
LogUtil.info(msg); LogUtil.info(msg);
} }
} }
string lasterrmsg = "";
public void errlog(string msg)
{
msg = $"[{Name}][{moveStep}][{MoveParam.WareCode}]{msg}";
if (String.Compare(lasterrmsg, msg, StringComparison.Ordinal) != 0)
{
lasterrmsg = msg;
LogUtil.error(msg);
}
}
} }
public class WaitResultInfo public class WaitResultInfo
...@@ -205,11 +187,12 @@ namespace DeviceLibrary ...@@ -205,11 +187,12 @@ namespace DeviceLibrary
wait.IsHomeMove = false; wait.IsHomeMove = false;
return wait; return wait;
} }
public static WaitResultInfo WaitAction(Func<WaitResultInfo, bool> a) public static WaitResultInfo WaitAction(Func<WaitResultInfo, bool> a,string msg)
{ {
WaitResultInfo wait = new WaitResultInfo(); WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W013_Action; wait.WaitType = WaitEnum.W013_Action;
wait.Action = a; wait.Action = a;
wait.ActionMsg = msg;
return wait; return wait;
} }
...@@ -254,6 +237,10 @@ namespace DeviceLibrary ...@@ -254,6 +237,10 @@ namespace DeviceLibrary
{ {
return "扫码完成"; return "扫码完成";
} }
else if (WaitType.Equals(WaitEnum.W013_Action))
{
return ActionMsg;
}
else else
{ {
return "Wait位置类型:WaitType=【" + WaitType + "】"; return "Wait位置类型:WaitType=【" + WaitType + "】";
...@@ -272,10 +259,6 @@ namespace DeviceLibrary ...@@ -272,10 +259,6 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public ConfigMoveAxis AxisInfo { get; set; } public ConfigMoveAxis AxisInfo { get; set; }
/// <summary> /// <summary>
/// 电钢地址
/// </summary>
public byte SlvAddr { get; set; }
/// <summary>
/// IO类型 /// IO类型
/// </summary> /// </summary>
public String IoType { get; set; } public String IoType { get; set; }
...@@ -309,8 +292,7 @@ namespace DeviceLibrary ...@@ -309,8 +292,7 @@ namespace DeviceLibrary
/// 等待事件代理 /// 等待事件代理
/// </summary> /// </summary>
public Func<WaitResultInfo, bool> Action { get; set; } public Func<WaitResultInfo, bool> Action { get; set; }
public string ActionMsg { get; set; }
public int AgvAction = 0;
} }
internal class WaitEnum internal class WaitEnum
...@@ -352,27 +334,4 @@ namespace DeviceLibrary ...@@ -352,27 +334,4 @@ namespace DeviceLibrary
/// </summary> /// </summary>
internal static int W013_Action = 13; internal static int W013_Action = 13;
} }
public enum MoveType
{
/// <summary>
/// 没有任何操作
/// </summary>
None = 0,
/// <summary>
/// 入库
/// </summary>
InStore = 1,
/// <summary>
/// 出库
/// </summary>
OutStore = 2,
/// <summary>
/// 原点返回
/// </summary>
ReturnHome = 3,
/// <summary>
/// 重置
/// </summary>
Reset = 4,
}
} }
...@@ -9,7 +9,7 @@ namespace DeviceLibrary ...@@ -9,7 +9,7 @@ namespace DeviceLibrary
public enum MoveStep public enum MoveStep
{ {
Wait, Wait,
//回原流程
H01_HomeReset, H01_HomeReset,
H02_HomeReset, H02_HomeReset,
H03_HomeReset, H03_HomeReset,
...@@ -19,21 +19,35 @@ namespace DeviceLibrary ...@@ -19,21 +19,35 @@ namespace DeviceLibrary
H07_HomeReset, H07_HomeReset,
HEND_HomeReset, HEND_HomeReset,
//右侧常规扫码流程
R01, R01,
R02, R02,
R03, R03,
R04, R04,
R05, R05,
R06, R06_GettedReelHigh, //获取料盘高度
R07, R07,
R08, R08,
R10_WaitReelLeave, R10_WaitReelLeave, //等待料盘离开
R11_NextReel, R11_NextReel, //开始下一盘料
R12_ShelfNoTray, R12_ShelfNoTray, //料窜已清空
R20, R20,
R21, R21,
REND, REND,
//入料流程
R30_OutShelf,
R31,
R32,
R33,
R34,
R35,
//出料流程
R40_InShelf,
R41,
R42,
R43,
R44,
R45,
L01, L01,
...@@ -49,9 +63,21 @@ namespace DeviceLibrary ...@@ -49,9 +63,21 @@ namespace DeviceLibrary
L30_LabelFinish, L30_LabelFinish,
L40_ShelfFull, L40_ShelfFull,
LEND, LEND,
//出料窜流程
L50_OutShelf,
L51,
L52,
L53,
L54,
//入料窜流程
L60_InShelf,
L61,
L62,
L63,
L64,
M01, M_Standby,
M02, M02,
M03, M03,
M04, M04,
......
...@@ -15,33 +15,38 @@ namespace DeviceLibrary ...@@ -15,33 +15,38 @@ namespace DeviceLibrary
{ {
public static MainMachine mainMachine; public static MainMachine mainMachine;
public static Robot_Config Config; public static Robot_Config Config;
public static bool IsLoadOk = false; public static bool IsLoadOk = true;
public static bool IsDebug = false; public static bool IsDebug = false;
public delegate void LoadFinish(bool state,string msg); public delegate void LoadFinish(bool state,string msg);
public static event LoadFinish LoadFinishEvent; public static event LoadFinish LoadFinishEvent;
public static bool isRunning = false; public static bool isRunning = false;
public static Asa.PrintLabel PrintBean;
public static ElectricGripper electricGripper;
static string baseDir = Application.StartupPath; static string baseDir = Application.StartupPath;
static Thread mainThread; static Thread mainThread;
public static void Init() { public static void Init() {
try try
{ {
CodeManager.LoadConfig();
string msg = ""; string msg = "";
string configFile = Path.Combine(baseDir, "config\\Config.csv"); string configFile = Path.Combine(baseDir, "config\\Config.csv");
Config = new Robot_Config(0, "", configFile); Config = new Robot_Config(0, "", configFile);
Config = (Robot_Config)CSVConfigReader.LoadConfig(Config); Config = (Robot_Config)CSVConfigReader.LoadConfig(Config);
CodeManager.LoadConfig();
PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label");
var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort");
electricGripper = new ElectricGripper();
if (!electricGripper.OpenPort(ElectricGripperPort)) {
msg += $"电夹爪通讯失败:{ElectricGripperPort}\n";
IsLoadOk = false;
}
mainMachine = new MainMachine(RobotManage.Config); mainMachine = new MainMachine(RobotManage.Config);
if (!IOManager.ConnectionIOList(new List<string>())) if (!IOManager.ConnectionIOList(new List<string>()))
{ {
IsLoadOk = false; IsLoadOk = false;
msg = "IO板卡初始化失败,无法启动."; msg += "IO板卡初始化失败\n";
}
else
{
IsLoadOk = true;
} }
LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msg); LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msg);
...@@ -52,6 +57,7 @@ namespace DeviceLibrary ...@@ -52,6 +57,7 @@ namespace DeviceLibrary
} }
public static void Start() { public static void Start() {
Init();
if (!IsLoadOk) if (!IsLoadOk)
{ {
LogUtil.info("系统还未加载完毕,无法启动"); LogUtil.info("系统还未加载完毕,无法启动");
...@@ -62,6 +68,7 @@ namespace DeviceLibrary ...@@ -62,6 +68,7 @@ namespace DeviceLibrary
GC.KeepAlive(mainThread); GC.KeepAlive(mainThread);
Task.Run(()=> { Task.Run(()=> {
Task.Delay(1000).Wait(); Task.Delay(1000).Wait();
if (mainMachine.DeviceCheck())
mainMachine.BeginHomeReset(true); mainMachine.BeginHomeReset(true);
}); });
...@@ -69,12 +76,45 @@ namespace DeviceLibrary ...@@ -69,12 +76,45 @@ namespace DeviceLibrary
public static void Stop() public static void Stop()
{ {
isRunning = false; LogUtil.info("开始停止系统.");
mainMachine.Stop(); mainMachine.Stop();
IOManager.CloseAllConnection();
electricGripper.ClosePort();
isRunning = false;
} }
public static void UserPause(bool userpause) { public static void UserPause(bool userpause) {
mainMachine.UserPause = userpause; mainMachine.UserPause = userpause;
if (userpause)
LogUtil.info("用户暂停");
else
LogUtil.info("用户取消暂停");
}
public static void IgnoreSafecheck(bool s)
{
mainMachine.IgnoreSafecheck = s;
if (s)
LogUtil.info("用户设置忽略安全检查");
else
LogUtil.info("用户取消忽略安全检查");
}
public static void IgnoreGratingSignal(bool s)
{
mainMachine.IgnoreGratingSignal = s;
if (s)
LogUtil.info("用户设置忽略安全光栅");
else
LogUtil.info("用户取消忽略安全光栅");
}
public static void LoadPrintSetting()
{
string PrintName = ConfigHelper.Config.Get(Setting_Init.PrinterName);
string labelName = ConfigHelper.Config.Get(Setting_Init.LabelName);
RobotManage.PrintBean.LoadLabel(labelName);
RobotManage.PrintBean.Printer(PrintName, false);
LogUtil.info("PrintLabel 打印机初始化完成【" + labelName + "】【" + PrintName + "】");
} }
} }
} }
...@@ -8,11 +8,22 @@ AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,100,700,700,50,150,500,10,100,0,0 ...@@ -8,11 +8,22 @@ AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,100,700,700,50,150,500,10,100,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,100,800,800,50,150,500,10,100,0,0 AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,100,800,800,50,150,500,10,100,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,10,2000,2000,1,5,200,500,100,0,0 AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,10,2000,2000,1,5,200,500,100,0,0
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,, PRO,30,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,, PRO,30,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,0,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,, PRO,20,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,0,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,, PRO,20,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,0,右侧相机,RightCameraName,123123,,,,,,,,,,,, PRO,30,右侧相机名称,RightCameraName,123123,,,,,,,,,,,,
PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,90,,,,,,,,,,,,
PRO,30,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,,
PRO,30,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
PRO,30,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,10,取料旋转轴待机点P1,Take_Middle_P1,1,,,99,,,,,,,,, PRO,10,取料旋转轴待机点P1,Take_Middle_P1,1,,,99,,,,,,,,,
PRO,10,取料旋转轴右取料点P2,Take_Middle_P2,2,,,99,,,,,,,,, PRO,10,取料旋转轴右取料点P2,Take_Middle_P2,2,,,99,,,,,,,,,
...@@ -32,11 +43,9 @@ PRO,12,左提升轴高点P2,Left_Batch_P2,15,,,66,,,,,,,,, ...@@ -32,11 +43,9 @@ PRO,12,左提升轴高点P2,Left_Batch_P2,15,,,66,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,, PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,,
PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,, PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,,
PRO,13,贴标X轴贴标点P3,Label_X_P3,19,,,77,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,, PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,,
PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,, PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,,
PRO,14,贴标Y轴贴标点P3,Label_Y_P3,23,,,44,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,, PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,,
PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,, PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,,
...@@ -44,7 +53,6 @@ PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,, ...@@ -44,7 +53,6 @@ PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,, PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,,
PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,, PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,,
PRO,16,贴标R轴360度脉冲,Label_R_P3,31,,,22,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
DI,0,急停,SuddenStop_BTN,0,HC,X00,,,,,,,,,, DI,0,急停,SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,进料口确认按钮,Right_BTN,1,HC,X01,,,,,,,,,, DI,0,进料口确认按钮,Right_BTN,1,HC,X01,,,,,,,,,,
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary">
<HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath> <HintPath>..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\ConfigHelper\ConfigHelper\bin\Debug\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath> <HintPath>..\..\RC1271-DUOStore\dll\halcondotnet.dll</HintPath>
</Reference> </Reference>
...@@ -64,6 +67,9 @@ ...@@ -64,6 +67,9 @@
<Compile Include="AutoScanAndLabel\AxisBean.cs" /> <Compile Include="AutoScanAndLabel\AxisBean.cs" />
<Compile Include="AutoScanAndLabel\Common.cs" /> <Compile Include="AutoScanAndLabel\Common.cs" />
<Compile Include="AutoScanAndLabel\LabelParam.cs" /> <Compile Include="AutoScanAndLabel\LabelParam.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _IOMonitor.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _LedProcess.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _BtnProcess.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _Printer.cs" /> <Compile Include="AutoScanAndLabel\MainMachine _Printer.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _LabelProcess.cs" /> <Compile Include="AutoScanAndLabel\MainMachine _LabelProcess.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _MiddleProcess.cs" /> <Compile Include="AutoScanAndLabel\MainMachine _MiddleProcess.cs" />
......
...@@ -9,7 +9,6 @@ namespace DeviceLibrary ...@@ -9,7 +9,6 @@ namespace DeviceLibrary
public class ElectricGripper public class ElectricGripper
{ {
private int subType = 0;
private Neotel.Rmaxis axis; private Neotel.Rmaxis axis;
public Enum GripperType = GripperTypeE.None; public Enum GripperType = GripperTypeE.None;
...@@ -29,7 +28,7 @@ namespace DeviceLibrary ...@@ -29,7 +28,7 @@ namespace DeviceLibrary
{ {
GripperType = GripperTypeE.Gripper; GripperType = GripperTypeE.Gripper;
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction))); moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction),"夹爪夹紧"));
if (!IsBusy) if (!IsBusy)
{ {
axis.Push(30, 7, 500); axis.Push(30, 7, 500);
...@@ -57,7 +56,7 @@ namespace DeviceLibrary ...@@ -57,7 +56,7 @@ namespace DeviceLibrary
else else
{ {
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction))); moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), "夹爪放松"));
return false; return false;
} }
} }
......
...@@ -63,7 +63,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -63,7 +63,7 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// PRO,0,右侧相机,RightCameraName,324234234,,,,,,,,,,,, /// PRO,0,右侧相机名称,RightCameraName,324234234,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("RightCameraName")] [ConfigProAttribute("RightCameraName")]
public string RightCameraName { get; set; } public string RightCameraName { get; set; }
...@@ -79,6 +79,62 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -79,6 +79,62 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Left_Batch_ChangeValue")] [ConfigProAttribute("Left_Batch_ChangeValue")]
public int Left_Batch_ChangeValue { get; set; } public int Left_Batch_ChangeValue { get; set; }
/// <summary>
/// PRO,0,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Right_Batch_X")]
public int Right_Batch_X { get; set; }
/// <summary>
/// PRO,0,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Right_Batch_Y")]
public int Right_Batch_Y { get; set; }
/// <summary>
/// PRO,20,贴标R轴0位角度差,Label_R_Angle_Diff,90,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_Angle_Diff")]
public int Label_R_Angle_Diff { get; set; }
/// <summary>
/// PRO,20,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_360")]
public int Label_R_360 { get; set; }
/// <summary>
/// PRO,20,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_Base")]
public int Label_X_Base { get; set; }
/// <summary>
/// PRO,20,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_Base")]
public int Label_Y_Base { get; set; }
/// <summary>
/// PRO,20,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Cam_Pixel_X_Ratio")]
public int Cam_Pixel_X_Ratio { get; set; }
/// <summary>
/// PRO,20,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Cam_Pixel_Y_Ratio")]
public int Cam_Pixel_Y_Ratio { get; set; }
/// <summary>
/// PRO,20,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Pixel_7")]
public int Label_Offset_Pixel_7 { get; set; }
/// <summary>
/// PRO,20,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Pixel_13")]
public int Label_Offset_Pixel_13 { get; set; }
/// <summary>
/// PRO,20,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Offset_Pixel_15")]
public int Label_Offset_Pixel_15 { get; set; }
/// <summary> /// <summary>
/// PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,, /// PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
...@@ -166,11 +222,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -166,11 +222,6 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_X_P2")] [ConfigProAttribute("Label_X_P2")]
public int Label_X_P2 { get; set; } public int Label_X_P2 { get; set; }
/// <summary> /// <summary>
/// PRO,0,贴标X轴贴标点P3,Label_X_P3,19,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P3")]
public int Label_X_P3 { get; set; }
/// <summary>
/// PRO,0,贴标Y轴待机点P1,Label_Y_P1,21,,,,,,,,,,,, /// PRO,0,贴标Y轴待机点P1,Label_Y_P1,21,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_Y_P1")] [ConfigProAttribute("Label_Y_P1")]
...@@ -181,11 +232,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -181,11 +232,6 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_Y_P2")] [ConfigProAttribute("Label_Y_P2")]
public int Label_Y_P2 { get; set; } public int Label_Y_P2 { get; set; }
/// <summary> /// <summary>
/// PRO,0,贴标Y轴贴标点P3,Label_Y_P3,23,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P3")]
public int Label_Y_P3 { get; set; }
/// <summary>
/// PRO,0,贴标Z轴待机点P1,Label_Z_P1,25,,,,,,,,,,,, /// PRO,0,贴标Z轴待机点P1,Label_Z_P1,25,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_Z_P1")] [ConfigProAttribute("Label_Z_P1")]
...@@ -210,11 +256,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -210,11 +256,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("Label_R_P2")] [ConfigProAttribute("Label_R_P2")]
public int Label_R_P2 { get; set; } public int Label_R_P2 { get; set; }
/// <summary>
/// PRO,0,贴标R轴360度脉冲,Label_R_P3,31,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_P3")]
public int Label_R_P3 { get; set; }
...@@ -295,11 +337,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -295,11 +337,6 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_X_P2_speed")] [ConfigProAttribute("Label_X_P2_speed")]
public int Label_X_P2_speed { get; set; } public int Label_X_P2_speed { get; set; }
/// <summary> /// <summary>
/// PRO,13,贴标X轴贴标点P3,Label_X_P3,19,,,77,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P3_speed")]
public int Label_X_P3_speed { get; set; }
/// <summary>
/// PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,, /// PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_Y_P1_speed")] [ConfigProAttribute("Label_Y_P1_speed")]
...@@ -310,11 +347,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -310,11 +347,6 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_Y_P2_speed")] [ConfigProAttribute("Label_Y_P2_speed")]
public int Label_Y_P2_speed { get; set; } public int Label_Y_P2_speed { get; set; }
/// <summary> /// <summary>
/// PRO,14,贴标Y轴贴标点P3,Label_Y_P3,23,,,44,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P3_speed")]
public int Label_Y_P3_speed { get; set; }
/// <summary>
/// PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,, /// PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_Z_P1_speed")] [ConfigProAttribute("Label_Z_P1_speed")]
...@@ -339,11 +371,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -339,11 +371,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("Label_R_P2_speed")] [ConfigProAttribute("Label_R_P2_speed")]
public int Label_R_P2_speed { get; set; } public int Label_R_P2_speed { get; set; }
/// <summary>
/// PRO,16,贴标R轴360度脉冲,Label_R_P3,31,,,22,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_P3_speed")]
public int Label_R_P3_speed { get; set; }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!