Commit 92a16664 刘韬

0712

1 个父辈 1a0fe5f3
正在显示 49 个修改的文件 包含 1651 行增加534 行删除

namespace AutoScanAndLabel
{
partial class AboutBox1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.labelProductName = new System.Windows.Forms.Label();
this.labelVersion = new System.Windows.Forms.Label();
this.labelCopyright = new System.Windows.Forms.Label();
this.labelCompanyName = new System.Windows.Forms.Label();
this.textBoxDescription = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.tableLayoutPanel.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel
//
this.tableLayoutPanel.ColumnCount = 2;
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.98701F));
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 87.01299F));
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4);
this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5);
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel.Location = new System.Drawing.Point(9, 8);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 6;
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.Size = new System.Drawing.Size(417, 245);
this.tableLayoutPanel.TabIndex = 0;
//
// labelProductName
//
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelProductName.Location = new System.Drawing.Point(60, 0);
this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 16);
this.labelProductName.Name = "labelProductName";
this.labelProductName.Size = new System.Drawing.Size(354, 16);
this.labelProductName.TabIndex = 19;
this.labelProductName.Text = "产品名称";
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelVersion
//
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelVersion.Location = new System.Drawing.Point(60, 24);
this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 16);
this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(354, 16);
this.labelVersion.TabIndex = 0;
this.labelVersion.Text = "版本";
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelCopyright
//
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCopyright.Location = new System.Drawing.Point(60, 48);
this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 16);
this.labelCopyright.Name = "labelCopyright";
this.labelCopyright.Size = new System.Drawing.Size(354, 16);
this.labelCopyright.TabIndex = 21;
this.labelCopyright.Text = "版权";
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelCompanyName
//
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCompanyName.Location = new System.Drawing.Point(60, 72);
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 16);
this.labelCompanyName.Name = "labelCompanyName";
this.labelCompanyName.Size = new System.Drawing.Size(354, 16);
this.labelCompanyName.TabIndex = 22;
this.labelCompanyName.Text = "公司名称";
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// textBoxDescription
//
this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBoxDescription.Location = new System.Drawing.Point(60, 99);
this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.textBoxDescription.Multiline = true;
this.textBoxDescription.Name = "textBoxDescription";
this.textBoxDescription.ReadOnly = true;
this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxDescription.Size = new System.Drawing.Size(354, 116);
this.textBoxDescription.TabIndex = 23;
this.textBoxDescription.TabStop = false;
this.textBoxDescription.Text = "说明";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.okButton.Location = new System.Drawing.Point(339, 221);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 21);
this.okButton.TabIndex = 24;
this.okButton.Text = "确定(&O)";
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// AboutBox1
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(435, 261);
this.Controls.Add(this.tableLayoutPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox1";
this.Padding = new System.Windows.Forms.Padding(9, 8, 9, 8);
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "AboutBox1";
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.Label labelProductName;
private System.Windows.Forms.Label labelVersion;
private System.Windows.Forms.Label labelCopyright;
private System.Windows.Forms.Label labelCompanyName;
private System.Windows.Forms.TextBox textBoxDescription;
private System.Windows.Forms.Button okButton;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoScanAndLabel
{
partial class AboutBox1 : Form
{
public AboutBox1()
{
InitializeComponent();
this.Text = String.Format("关于 {0}", AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("版本 {0}", AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
this.textBoxDescription.Text = AssemblyDescription;
}
#region 程序集特性访问器
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
public string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
public string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
string updatetime = "";
var version = AssemblyVersion;
string[] strArray = version.Split('.');
if (strArray.Length.Equals(4))
{
int days = Convert.ToInt32(strArray[2]);
int seconds = Convert.ToInt32(strArray[3]);
DateTime d1 = DateTime.Parse("2000-01-01");
var newData = d1.AddDays(days);
newData = newData.AddSeconds(seconds * 2);
updatetime = "LastUpdate: "+newData.ToString("yyyy-MM-dd HH:mm:ss");
}
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description + updatetime;
}
}
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
#endregion
private void okButton_Click(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
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<add key="App_AutoRun" value="1" /> <add key="App_AutoRun" value="1" />
<add key="CameraName" value="GigE:acA3800-10gc (23124327)#" /> <add key="CameraName" value="GigE:acA3800-10gc (23124327)#" />
<add key="Config_Pwd" value="123456" /> <add key="Config_Pwd" value="123456" />
<add key="CodeType" value="QR Code#Data Matrix ECC 200#barcode" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="Conifg\" />
<add key="CodeCount" value="3" />
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>false</Deterministic>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
...@@ -32,6 +33,9 @@ ...@@ -32,6 +33,9 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Asa.PrintLabel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Asa.PrintLabel, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
...@@ -67,6 +71,12 @@ ...@@ -67,6 +71,12 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AboutBox1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutBox1.Designer.cs">
<DependentUpon>AboutBox1.cs</DependentUpon>
</Compile>
<Compile Include="AxisControl.cs"> <Compile Include="AxisControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -99,6 +109,15 @@ ...@@ -99,6 +109,15 @@
<Compile Include="SettingControl.Designer.cs"> <Compile Include="SettingControl.Designer.cs">
<DependentUpon>SettingControl.cs</DependentUpon> <DependentUpon>SettingControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UC\ConfigControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC\ConfigControl.designer.cs">
<DependentUpon>ConfigControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AboutBox1.resx">
<DependentUpon>AboutBox1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AxisControl.resx"> <EmbeddedResource Include="AxisControl.resx">
<DependentUpon>AxisControl.cs</DependentUpon> <DependentUpon>AxisControl.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
...@@ -125,6 +144,9 @@ ...@@ -125,6 +144,9 @@
<EmbeddedResource Include="SettingControl.resx"> <EmbeddedResource Include="SettingControl.resx">
<DependentUpon>SettingControl.cs</DependentUpon> <DependentUpon>SettingControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UC\ConfigControl.resx">
<DependentUpon>ConfigControl.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>
...@@ -152,5 +174,8 @@ ...@@ -152,5 +174,8 @@
<Name>LoadCSVLibrary</Name> <Name>LoadCSVLibrary</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file \ No newline at end of file
...@@ -29,71 +29,48 @@ namespace AutoScanAndLabel ...@@ -29,71 +29,48 @@ namespace AutoScanAndLabel
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnSavePos = new System.Windows.Forms.Button();
this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl(); this.axisMoveControl1 = new DeviceLibrary.AxisMoveControl();
this.groupBox3.SuspendLayout(); this.panel1 = new System.Windows.Forms.Panel();
this.configControl1 = new AutoScanAndLabel.ConfigControl();
this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox3
//
this.groupBox3.Controls.Add(this.tableLayoutPanel1);
this.groupBox3.Location = new System.Drawing.Point(565, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(628, 520);
this.groupBox3.TabIndex = 107;
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 = 6;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 14);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(616, 500);
this.tableLayoutPanel1.TabIndex = 102;
//
// btnSavePos
//
this.btnSavePos.Location = new System.Drawing.Point(1054, 529);
this.btnSavePos.Name = "btnSavePos";
this.btnSavePos.Size = new System.Drawing.Size(133, 31);
this.btnSavePos.TabIndex = 108;
this.btnSavePos.Text = "全部保存";
this.btnSavePos.UseVisualStyleBackColor = true;
this.btnSavePos.Click += new System.EventHandler(this.btnSavePos_Click);
//
// axisMoveControl1 // axisMoveControl1
// //
this.axisMoveControl1.Location = new System.Drawing.Point(0, 3); this.axisMoveControl1.Location = new System.Drawing.Point(3, 3);
this.axisMoveControl1.Name = "axisMoveControl1"; this.axisMoveControl1.Name = "axisMoveControl1";
this.axisMoveControl1.Size = new System.Drawing.Size(559, 400); this.axisMoveControl1.Size = new System.Drawing.Size(559, 400);
this.axisMoveControl1.TabIndex = 0; this.axisMoveControl1.TabIndex = 0;
// //
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.axisMoveControl1);
this.panel1.Controls.Add(this.configControl1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1234, 924);
this.panel1.TabIndex = 2;
//
// configControl1
//
this.configControl1.Config = null;
this.configControl1.Location = new System.Drawing.Point(568, 3);
this.configControl1.Name = "configControl1";
this.configControl1.Size = new System.Drawing.Size(651, 754);
this.configControl1.TabIndex = 1;
//
// AxisControl // AxisControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.btnSavePos); this.Controls.Add(this.panel1);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.axisMoveControl1);
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(1234, 924);
this.Load += new System.EventHandler(this.AxisControl_Load); this.Load += new System.EventHandler(this.AxisControl_Load);
this.groupBox3.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -101,8 +78,7 @@ namespace AutoScanAndLabel ...@@ -101,8 +78,7 @@ namespace AutoScanAndLabel
#endregion #endregion
private DeviceLibrary.AxisMoveControl axisMoveControl1; private DeviceLibrary.AxisMoveControl axisMoveControl1;
private System.Windows.Forms.GroupBox groupBox3; private ConfigControl configControl1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnSavePos;
} }
} }
...@@ -26,124 +26,13 @@ namespace AutoScanAndLabel ...@@ -26,124 +26,13 @@ namespace AutoScanAndLabel
if (!state) if (!state)
return; return;
axisMoveControl1.LoadData(RobotManage.mainMachine); axisMoveControl1.LoadData(RobotManage.mainMachine);
LoadPosList(); configControl1.Config = RobotManage.Config;
}
void LoadPosList() {
this.tableLayoutPanel1.RowStyles.Clear();
//this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26));
int r = 0;
int c = 0;
int lastSubType = 0;
Random random = new Random(1);
Color color = Color.Black;
foreach (ConfigBase configBase in RobotManage.Config.configList) {
if (configBase.SubType < 10 || configBase.SubType>20 || configBase.ProType != "PRO")
continue;
if (configBase.SubType != lastSubType)
{
if (lastSubType > 0)
r++;
lastSubType = configBase.SubType;
color = Color.FromArgb(random.Next(30,150), random.Next(30, 150), random.Next(30, 150));
}
//this.tableLayoutPanel1.RowCount++;
Button button = new Button();
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, 27);
button.Text = configBase.Explain;
button.Click += Button_Click;
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(80, 23);
textBox.Text = configBase.ProValue;
textBox.Tag = configBase.SubType - 10;
textBox.KeyPress += TextBox_KeyPress;
textBox.TextChanged += TextBox_TextChanged;
TextBox textBox2 = new TextBox();
textBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
textBox2.Name = configBase.ProName+"_speed";
textBox2.Margin = new Padding(4, 8, 0, 0);
textBox2.Size = new System.Drawing.Size(80, 23);
textBox2.Text = configBase.TargetSpeed.ToString();
textBox2.Tag = configBase.SubType - 10;
textBox2.KeyPress += TextBox_KeyPress;
textBox2.TextChanged += TextBox_TextChanged;
tableLayoutPanel1.Controls.Add(button, c, r);
tableLayoutPanel1.Controls.Add(textBox, c + 1, r);
if (configBase.SubType<20)
tableLayoutPanel1.Controls.Add(textBox2, c + 2, r);
r++;
if (r > 15)
{
r = 0;
c += 3;
}
}
} }
private void TextBox_TextChanged(object sender, EventArgs e)
{
var s = (sender as TextBox).Text;
if (!int.TryParse(s, out _))
{
(sender as TextBox).Text = lastvalue;
}
}
string lastvalue = "";
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var s = (sender as TextBox).Text;
if (int.TryParse(s, out _))
lastvalue = s;
}
private void Button_Click(object sender, EventArgs e)
{
var cc = tableLayoutPanel1.Controls.Find(((Button)sender).Name,false);
//Console.WriteLine(cc[1].Name);
//Console.WriteLine(cc[1].Tag);
//Console.WriteLine(cc[1].Text);
ConfigMoveAxis configMoveAxis = getConfigMoveAxis((int)cc[1].Tag);
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), configMoveAxis.TargetSpeed, configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
}
ConfigMoveAxis getConfigMoveAxis(int Axisid) {
foreach (ConfigMoveAxis configMoveAxis in RobotManage.Config.moveAxisList) {
if (configMoveAxis.GetAxisValue() == Axisid)
return configMoveAxis;
}
return null;
}
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)
pi.SetValue(RobotManage.Config, int.Parse(textBox.Text));
}
CSVConfigReader.SaveConfig(RobotManage.Config.ConfigFilePath, RobotManage.Config);
}
private void AxisControl_Load(object sender, EventArgs e) private void AxisControl_Load(object sender, EventArgs e)
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using ConfigHelper; using ConfigHelper;
using DeviceLibrary; using DeviceLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
...@@ -9,6 +10,7 @@ using System.Data; ...@@ -9,6 +10,7 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -21,6 +23,11 @@ namespace AutoScanAndLabel ...@@ -21,6 +23,11 @@ namespace AutoScanAndLabel
InitializeComponent(); InitializeComponent();
this.FormClosing += Form1_FormClosing; this.FormClosing += Form1_FormClosing;
this.Text = Config.Get(Setting_Init.App_Title); this.Text = Config.Get(Setting_Init.App_Title);
t1.Interval = 1000;
t1.Tick += T1_Tick;
t1.Start();
GC.KeepAlive(t1);
} }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) private void Form1_FormClosing(object sender, FormClosingEventArgs e)
...@@ -36,6 +43,8 @@ namespace AutoScanAndLabel ...@@ -36,6 +43,8 @@ namespace AutoScanAndLabel
IOControl ioc = new IOControl(); IOControl ioc = new IOControl();
AxisControl ac = new AxisControl(); AxisControl ac = new AxisControl();
SettingControl sc = new SettingControl(); SettingControl sc = new SettingControl();
readonly System.Windows.Forms.Timer t1 = new System.Windows.Forms.Timer();
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
List<CodeInfo> codeInfos = new List<CodeInfo>(); List<CodeInfo> codeInfos = new List<CodeInfo>();
...@@ -44,7 +53,7 @@ namespace AutoScanAndLabel ...@@ -44,7 +53,7 @@ namespace AutoScanAndLabel
//codeInfos.Add(new CodeInfo("", 564, 684)); //codeInfos.Add(new CodeInfo("", 564, 684));
btn_run.Enabled = false; btn_run.Enabled = false;
btn_stop.Enabled = false; //btn_stop.Enabled = false;
#region 报警信息listview初始化 #region 报警信息listview初始化
listView1.View = View.Details; listView1.View = View.Details;
ColumnHeader emptycol = new ColumnHeader(); ColumnHeader emptycol = new ColumnHeader();
...@@ -85,11 +94,18 @@ namespace AutoScanAndLabel ...@@ -85,11 +94,18 @@ namespace AutoScanAndLabel
#endregion #endregion
LogUtil.info("开始初始化"); LogUtil.info("开始初始化");
cb_EnableBuzzer.Checked = Config.Get("EnableBuzzer", true);
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
RobotManage.Init(); RobotManage.Init();
} }
private void AlarmBuzzer_BuzzerStateChange(object sender, bool e)
{
btn_PauseBuzzer.Visible = e;
}
private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
{ {
e.NewWidth = (sender as ListView).Columns[e.ColumnIndex].Width; e.NewWidth = (sender as ListView).Columns[e.ColumnIndex].Width;
...@@ -101,11 +117,15 @@ namespace AutoScanAndLabel ...@@ -101,11 +117,15 @@ namespace AutoScanAndLabel
AddForm("相关设置", sc); AddForm("相关设置", sc);
AddForm("日志", lc); AddForm("日志", lc);
} }
public delegate void setstatedelegate(List<MoveInfo> moveinfoList); //public delegate void setstatedelegate(List<MoveInfo> moveinfoList);
private void MainMachine_ProcessMoveinfoEvent(List<MoveInfo> moveinfoList) private void MainMachine_ProcessMoveinfoEvent(List<MoveInfo> moveinfoList)
{ {
var d = new setstatedelegate(SetState); //var d = new setstatedelegate(SetState);
this.Invoke(d, moveinfoList); //this.Invoke(d, moveinfoList);
}
private void T1_Tick(object sender, EventArgs e)
{
SetState(MoveInfo.List);
} }
void SetState(List<MoveInfo> moveInfoList) void SetState(List<MoveInfo> moveInfoList)
{ {
...@@ -113,10 +133,15 @@ namespace AutoScanAndLabel ...@@ -113,10 +133,15 @@ namespace AutoScanAndLabel
stateView.Items.Clear(); stateView.Items.Clear();
foreach (MoveInfo moveInfo in moveInfoList) foreach (MoveInfo moveInfo in moveInfoList)
{ {
if (moveInfo.Name=="重置" && RobotManage.mainMachine.runStatus != RunStatus.HomeReset)
{
continue;
}
ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.Name, moveInfo.MoveStep.ToString(),moveInfo.GetStateStr() }); ListViewItem lvi = new ListViewItem(new string[] { "", moveInfo.Name, moveInfo.MoveStep.ToString(),moveInfo.GetStateStr() });
stateView.Items.Add(lvi); stateView.Items.Add(lvi);
} }
ListViewItem lvi1 = new ListViewItem(new string[] { "", "Printer", RobotManage.mainMachine.LastPrintStatus.ToString(), ConfigHelper.Config.Get(Setting_Init.PrinterName) }); var printstatus = RobotManage.mainMachine.LastPrintStatus;
ListViewItem lvi1 = new ListViewItem(new string[] { "", "Printer", (printstatus == Asa.PrintLabel.PrinterStatus.Unknown)?"Wait": printstatus.ToString(), ConfigHelper.Config.Get(Setting_Init.PrinterName) });
stateView.Items.Add(lvi1); stateView.Items.Add(lvi1);
this.ResumeLayout(true); this.ResumeLayout(true);
...@@ -175,7 +200,7 @@ namespace AutoScanAndLabel ...@@ -175,7 +200,7 @@ namespace AutoScanAndLabel
if (state) if (state)
{ {
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; RobotManage.mainMachine.ProcessMoveinfoEvent += MainMachine_ProcessMoveinfoEvent;
} }
...@@ -215,7 +240,10 @@ namespace AutoScanAndLabel ...@@ -215,7 +240,10 @@ namespace AutoScanAndLabel
RobotManage.Start(); RobotManage.Start();
userpause = false; userpause = false;
if (RobotManage.isRunning) if (RobotManage.isRunning)
{
btn_stop.Enabled = true;
(sender as Button).Text = "暂停运行"; (sender as Button).Text = "暂停运行";
}
} }
else if (!userpause) else if (!userpause)
{ {
...@@ -229,12 +257,16 @@ namespace AutoScanAndLabel ...@@ -229,12 +257,16 @@ namespace AutoScanAndLabel
RobotManage.UserPause(userpause); RobotManage.UserPause(userpause);
(sender as Button).Text = "暂停运行"; (sender as Button).Text = "暂停运行";
} }
} }
private void btn_stop_Click(object sender, EventArgs e) private void btn_stop_Click(object sender, EventArgs e)
{ {
btn_run.Text = "启动"; btn_run.Text = "启动";
RobotManage.Stop(); Task.Run(()=>{RobotManage.Stop(); });
RobotManage.UserPause(false);
userpause = false;
btn_stop.Enabled = false;
} }
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -242,6 +274,9 @@ namespace AutoScanAndLabel ...@@ -242,6 +274,9 @@ namespace AutoScanAndLabel
if (RobotManage.isRunning) { if (RobotManage.isRunning) {
MessageBox.Show("机器尚在运行,不能退出,请先停止运行."); MessageBox.Show("机器尚在运行,不能退出,请先停止运行.");
} else { } else {
RobotManage.Stop();
RobotManage.ShutDown();
Thread.Sleep(2000);
Application.Exit(); Application.Exit();
} }
} }
...@@ -255,5 +290,116 @@ namespace AutoScanAndLabel ...@@ -255,5 +290,116 @@ namespace AutoScanAndLabel
{ {
RobotManage.IgnoreGratingSignal((sender as CheckBox).Checked); RobotManage.IgnoreGratingSignal((sender as CheckBox).Checked);
} }
private void 二维码识别调试ToolStripMenuItem_Click(object sender, EventArgs e)
{
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
if (Camera._cam != null)
{
Camera._cam.CloseAll();
}
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.ShowDialog();
frm.Dispose();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
}
private void btn_releaseleftshelf_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.SafeReleaseLeftShelf || RobotManage.mainMachine.LeftMoveInfo.MoveStep < MoveStep.L01 || RobotManage.mainMachine.LeftMoveInfo.MoveStep > MoveStep.L30_LabelFinish) {
MessageBox.Show("左侧料串当前没有就位, 不能释放");
return;
}
RobotManage.mainMachine.SafeReleaseLeftShelf = true;
btn_releaseleftshelf.BackColor = Color.OrangeRed;
Task.Run(()=> {
int timeout = 2 * 60;
while (RobotManage.mainMachine.SafeReleaseLeftShelf && timeout>0) {
Task.Delay(500).Wait();
timeout--;
if (timeout % 2 == 0)
{
Invoke((EventHandler)delegate
{
btn_releaseleftshelf.Text = $"左侧料串等待释放中({timeout / 2})";
});
}
if ((RobotManage.mainMachine.LeftMoveInfo.MoveStep== MoveStep.L20_WaitLabel || RobotManage.mainMachine.LeftMoveInfo.MoveStep== MoveStep.L10_WaitReelPut) && RobotManage.mainMachine.RightMoveInfo.MoveStep == MoveStep.Wait)
{
RobotManage.mainMachine.LeftMoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
}
}
Invoke((EventHandler)delegate
{
btn_releaseleftshelf.BackColor = Color.Transparent;
btn_releaseleftshelf.Text = "安全释放左侧料串";
});
});
}
private void btn_releaserightshelf_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.SafeReleaseRightShelf || RobotManage.mainMachine.RightMoveInfo.MoveStep < MoveStep.R01 || RobotManage.mainMachine.RightMoveInfo.MoveStep > MoveStep.R11_NextReel)
{
MessageBox.Show("右侧料串当前没有就位, 不能释放");
return;
}
RobotManage.mainMachine.SafeReleaseRightShelf = true;
btn_releaserightshelf.BackColor = Color.OrangeRed;
Task.Run(() => {
int timeout = 2 * 60;
while (RobotManage.mainMachine.SafeReleaseRightShelf && timeout > 0)
{
Task.Delay(500).Wait();
timeout--;
if (timeout % 2 == 0)
{
Invoke((EventHandler)delegate
{
btn_releaserightshelf.Text = $"右侧料串等待释放中({timeout / 2})";
});
}
}
Invoke((EventHandler)delegate
{
btn_releaserightshelf.BackColor = Color.Transparent;
btn_releaserightshelf.Text = "安全释放右侧料串";
});
});
}
private void btn_maulstart_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.RightMoveInfo.MoveStep != MoveStep.Wait) {
MessageBox.Show("右侧料串正在运行,不能手动上料");
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.LOW))
{
MessageBox.Show("没有检测到料串,不能手动上料");
return;
}
RobotManage.mainMachine.RightMoveInfo.NewMove(MoveStep.R01);
LogUtil.info("手动:右侧有新料,准备上料");
}
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 aboutBox1 = new AboutBox1();
aboutBox1.ShowDialog();
}
private void cb_EnableBuzzer_CheckedChanged(object sender, EventArgs e)
{
Config.Set("EnableBuzzer", cb_EnableBuzzer.Checked);
Config.SaveChange();
AlarmBuzzer.Enable = cb_EnableBuzzer.Checked;
}
private void btn_PauseBuzzer_Click(object sender, EventArgs e)
{
AlarmBuzzer.MuteOnce();
}
} }
} }
...@@ -247,13 +247,13 @@ namespace AutoScanAndLabel ...@@ -247,13 +247,13 @@ namespace AutoScanAndLabel
} }
private void btn右侧电滚筒进入_Click(object sender, EventArgs e) private void btn右侧电滚筒进入_Click(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.LOW); IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH);
} }
private void btn右侧电滚筒退出_Click(object sender, EventArgs e) private void btn右侧电滚筒退出_Click(object sender, EventArgs e)
{ {
IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.RightMoto_Reverse, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH);
} }
......
...@@ -31,7 +31,7 @@ namespace AutoScanAndLabel ...@@ -31,7 +31,7 @@ namespace AutoScanAndLabel
} }
Environment.CurrentDirectory = Application.StartupPath;
XmlConfigurator.Configure(); XmlConfigurator.Configure();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
......
...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices; ...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下 // 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改 // 控制。更改这些特性值可修改
// 与程序集关联的信息。 // 与程序集关联的信息。
[assembly: AssemblyTitle("SO827-AutoScanAndLabel")] [assembly: AssemblyTitle("自动扫码贴标机")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("上海挚锦科技有限公司")]
[assembly: AssemblyProduct("SO827-AutoScanAndLabel")] [assembly: AssemblyProduct("自动扫码贴标机")]
[assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
...@@ -31,6 +31,6 @@ using System.Runtime.InteropServices; ...@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
// //
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]
...@@ -36,11 +36,8 @@ namespace AutoScanAndLabel ...@@ -36,11 +36,8 @@ namespace AutoScanAndLabel
this.cb_labelselect = new System.Windows.Forms.ComboBox(); this.cb_labelselect = new System.Windows.Forms.ComboBox();
this.cb_printerselect = new System.Windows.Forms.ComboBox(); this.cb_printerselect = new System.Windows.Forms.ComboBox();
this.chbAutoRun = new System.Windows.Forms.CheckBox(); this.chbAutoRun = new System.Windows.Forms.CheckBox();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.btn_labelDebug = new System.Windows.Forms.Button();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnSavePos = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
...@@ -106,56 +103,28 @@ namespace AutoScanAndLabel ...@@ -106,56 +103,28 @@ namespace AutoScanAndLabel
// chbAutoRun // chbAutoRun
// //
this.chbAutoRun.AutoSize = true; this.chbAutoRun.AutoSize = true;
this.chbAutoRun.Location = new System.Drawing.Point(14, 214); this.chbAutoRun.Location = new System.Drawing.Point(3, 192);
this.chbAutoRun.Name = "chbAutoRun"; this.chbAutoRun.Name = "chbAutoRun";
this.chbAutoRun.Size = new System.Drawing.Size(84, 16); this.chbAutoRun.Size = new System.Drawing.Size(84, 16);
this.chbAutoRun.TabIndex = 1; this.chbAutoRun.TabIndex = 1;
this.chbAutoRun.Text = "开机自启动"; this.chbAutoRun.Text = "开机自启动";
this.chbAutoRun.UseVisualStyleBackColor = true; this.chbAutoRun.UseVisualStyleBackColor = true;
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged); //
// // btn_labelDebug
// groupBox3 //
// this.btn_labelDebug.Location = new System.Drawing.Point(182, 192);
this.groupBox3.Controls.Add(this.tableLayoutPanel1); this.btn_labelDebug.Name = "btn_labelDebug";
this.groupBox3.Location = new System.Drawing.Point(421, 3); this.btn_labelDebug.Size = new System.Drawing.Size(140, 28);
this.groupBox3.Name = "groupBox3"; this.btn_labelDebug.TabIndex = 2;
this.groupBox3.Size = new System.Drawing.Size(285, 413); this.btn_labelDebug.Text = "贴标调试";
this.groupBox3.TabIndex = 108; this.btn_labelDebug.UseVisualStyleBackColor = true;
this.groupBox3.TabStop = false; this.btn_labelDebug.Visible = false;
this.groupBox3.Text = "点位列表"; this.btn_labelDebug.Click += new System.EventHandler(this.btn_labelDebug_Click);
//
// 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;
//
// 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 // SettingControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.btnSavePos); this.Controls.Add(this.btn_labelDebug);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.chbAutoRun); this.Controls.Add(this.chbAutoRun);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "SettingControl"; this.Name = "SettingControl";
...@@ -163,7 +132,6 @@ namespace AutoScanAndLabel ...@@ -163,7 +132,6 @@ namespace AutoScanAndLabel
this.Load += new System.EventHandler(this.SettingControl_Load); this.Load += new System.EventHandler(this.SettingControl_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -178,8 +146,6 @@ namespace AutoScanAndLabel ...@@ -178,8 +146,6 @@ namespace AutoScanAndLabel
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox chbAutoRun; private System.Windows.Forms.CheckBox chbAutoRun;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.Button btn_labelDebug;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button btnSavePos;
} }
} }
using ConfigHelper; using CodeLibrary;
using ConfigHelper;
using DeviceLibrary; using DeviceLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
...@@ -21,7 +22,10 @@ namespace AutoScanAndLabel ...@@ -21,7 +22,10 @@ namespace AutoScanAndLabel
{ {
InitializeComponent(); InitializeComponent();
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent; RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
//chbAutoRun.Enabled = false;
chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun)); chbAutoRun.Checked = Convert.ToBoolean(ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun));
this.chbAutoRun.CheckedChanged += new System.EventHandler(this.chbAutoRun_CheckedChanged);
//chbAutoRun.Enabled = true;
} }
private void RobotManage_LoadFinishEvent(bool state, string msg) private void RobotManage_LoadFinishEvent(bool state, string msg)
...@@ -46,101 +50,9 @@ namespace AutoScanAndLabel ...@@ -46,101 +50,9 @@ namespace AutoScanAndLabel
cb_printerselect.Text = PrintName; cb_printerselect.Text = PrintName;
cb_labelselect.Text = labelName; 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")
{
if (!int.TryParse(s.Text, out _))
s.Text = lastvalue;
}
else if (s.Tag.ToString() == "Double")
{
if (!double.TryParse(s.Text, out _))
s.Text = lastvalue;
}
s.SelectionStart = lastselectindex;
}
string lastvalue = "";
int lastselectindex = 0;
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var s = (sender as TextBox);
if (s.Tag.ToString() == "Int32")
{
if (int.TryParse(s.Text, out _))
lastvalue = s.Text;
}
else if (s.Tag.ToString() == "Double")
{
if (double.TryParse(s.Text, out _))
lastvalue = s.Text;
}
lastselectindex = s.SelectionStart;
}
private void SettingControl_Load(object sender, EventArgs e) private void SettingControl_Load(object sender, EventArgs e)
{ {
...@@ -203,26 +115,30 @@ namespace AutoScanAndLabel ...@@ -203,26 +115,30 @@ namespace AutoScanAndLabel
} }
} }
private void btnSavePos_Click(object sender, EventArgs e) private void btn_labelDebug_Click(object sender, EventArgs e)
{ {
for (int i = 0; i < tableLayoutPanel1.Controls.Count; i++) Bitmap bitmap = new Bitmap("16-51-26-94.bmp");
{ List<CodeInfo> tlci = EyemDecode2.Decoder(ref bitmap);
if (tableLayoutPanel1.Controls[i].GetType().Name != "TextBox") bitmap.Dispose();
continue; tlci.Add(new CodeInfo("", 1453, 3556));
LabelParam labelParam = new LabelParam();
labelParam.codeInfos = tlci;
labelParam.bitmapfilename = "16-51-26-94.bmp";
Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Point p = Common.CalcLabelPoint(labelParam, Right_Batch_Point, RobotManage.Config.Label_R_Offset, out int labelAngle);
//匹配照片角度与贴标旋转轴的角度差
labelAngle += RobotManage.Config.Label_R_Angle_Diff;
//计算贴标角度的脉冲值
int labelAxisPos = RobotManage.Config.Label_R_360 / 360 * labelAngle;
//计算像素点位与中心点的差
Point p1 = new Point(p.X - Right_Batch_Point.X, p.Y - Right_Batch_Point.Y);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
p1.X = (int)(p1.X * RobotManage.Config.Cam_Pixel_X_Ratio) + RobotManage.Config.Label_X_Base;
p1.Y = (int)(p1.Y * RobotManage.Config.Cam_Pixel_Y_Ratio) + RobotManage.Config.Label_Y_Base;
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 if (pi.PropertyType.Name == "Double")
pi.SetValue(RobotManage.Config, double.Parse(textBox.Text));
else
pi.SetValue(RobotManage.Config, textBox.Text);
}
}
CSVConfigReader.SaveConfig(RobotManage.Config.ConfigFilePath, RobotManage.Config);
} }
} }
} }
using DeviceLibrary;
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 ConfigControl : UserControl
{
private DeviceConfig _Config;
public DeviceConfig Config
{
get { return _Config; }
set
{
if (value == null)
return;
_Config = value;
LoadPosList();
}
}
public ConfigControl()
{
InitializeComponent();
}
void LoadPosList()
{
int maxrow = tableLayoutPanel1.Height / 34;
this.tableLayoutPanel1.RowStyles.Clear();
tableLayoutPanel1.Controls.Clear();
//this.tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType., 26));
int r = 0;
int c = 0;
int lastSubType = 0;
Random random = new Random(1);
Color color = Color.Black;
foreach (ConfigBase configBase in Config.configList)
{
if (configBase.SubType < 10)
continue;
if (configBase.SubType != lastSubType)
{
if (lastSubType > 0)
{
//r++;
//tableLayoutPanel1.Controls.Add(new Label(), c, r++);
}
lastSubType = configBase.SubType;
color = Color.FromArgb(random.Next(30, 150), random.Next(30, 150), random.Next(30, 150));
}
//this.tableLayoutPanel1.RowCount++;
if (configBase.SubType < 20)
{
Button button = new Button();
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, 27);
button.Text = configBase.Explain;
button.Click += Button_Click;
button.ForeColor = color;
button.Tag = configBase.SubType%10;
tableLayoutPanel1.Controls.Add(button, c, r);
}
else {
Label button = new Label();
button.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
button.Name = configBase.ProName;
button.Text = configBase.Explain;
button.AutoSize = false;
button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
button.ForeColor = color;
tableLayoutPanel1.Controls.Add(button, c, r);
}
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(180, 23);
textBox.Text = configBase.ProValue;
textBox.KeyPress += TextBox_KeyPress;
textBox.TextChanged += TextBox_TextChanged;
tableLayoutPanel1.Controls.Add(textBox, c + 1, r);
PropertyInfo pi = Config.GetType().GetProperty(configBase.ProName);
if (pi != null)
{
textBox.Tag = pi.PropertyType.Name;
}
if (configBase.SubType < 20)
{
TextBox textBox2 = new TextBox();
textBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
textBox2.Name = configBase.ProName + "_speed";
textBox2.Margin = new Padding(4, 8, 0, 0);
textBox2.Size = new System.Drawing.Size(80, 23);
textBox2.Text = configBase.TargetSpeed.ToString();
textBox2.Tag = configBase.SubType - 10;
textBox2.KeyPress += TextBox_KeyPress;
textBox2.TextChanged += TextBox_TextChanged;
tableLayoutPanel1.Controls.Add(textBox2, c + 2, r);
textBox.Tag = "Int32";
}
else {
tableLayoutPanel1.SetColumnSpan(textBox, 2);
}
r++;
if (r > maxrow)
{
r = 0;
c += 3;
}
}
if (r <= maxrow+1) {
Label button1 = new Label();
tableLayoutPanel1.Controls.Add(button1, c, r++);
}
}
private void TextBox_TextChanged(object sender, EventArgs e)
{
var lastlen = lastvalue.Length;
var s = (sender as TextBox);
if (s.Tag.ToString() == "Int32")
{
if (!int.TryParse(s.Text, out _))
s.Text = lastvalue;
//s.SelectionStart = lastselectindex;
}
else if (s.Tag.ToString() == "Double")
{
if (!double.TryParse(s.Text, out _))
s.Text = lastvalue;
//s.SelectionStart = lastselectindex;
}
}
string lastvalue = "";
int lastselectindex = 0;
private void TextBox_KeyPress(object sender, KeyPressEventArgs e)
{
var s = (sender as TextBox);
if (s.Tag.ToString() == "Int32")
{
if (int.TryParse(s.Text, out _))
lastvalue = s.Text;
}
else if (s.Tag.ToString() == "Double")
{
if (double.TryParse(s.Text, out _))
lastvalue = s.Text;
}
lastselectindex = s.SelectionStart;
}
private void Button_Click(object sender, EventArgs e)
{
var cc = tableLayoutPanel1.Controls.Find(((Button)sender).Name, false);
var speed = tableLayoutPanel1.Controls.Find(((Button)sender).Name+ "_speed", false);
ConfigMoveAxis configMoveAxis = getConfigMoveAxis((int)((Button)sender).Tag);
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), int.Parse(speed[0].Text), configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
}
ConfigMoveAxis getConfigMoveAxis(int Axisid)
{
foreach (ConfigMoveAxis configMoveAxis in Config.moveAxisList)
{
if (configMoveAxis.GetAxisValue() == Axisid)
return configMoveAxis;
}
return null;
}
private void ConfigControl_Load(object sender, EventArgs e)
{
}
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 = Config.GetType().GetProperty(textBox.Name);
if (pi != null)
{
if (pi.PropertyType.Name == "Int32")
pi.SetValue(Config, int.Parse(textBox.Text));
else if (pi.PropertyType.Name == "Double")
pi.SetValue(Config, double.Parse(textBox.Text));
else
pi.SetValue(Config, textBox.Text);
}
}
CSVConfigReader.SaveConfig(Config.ConfigFilePath, Config);
}
}
}

namespace AutoScanAndLabel
{
partial class ConfigControl
{
/// <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.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnSavePos = new System.Windows.Forms.Button();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox3.Controls.Add(this.tableLayoutPanel1);
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(628, 461);
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 = 6;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel1.Location = new System.Drawing.Point(6, 14);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(616, 441);
this.tableLayoutPanel1.TabIndex = 102;
//
// btnSavePos
//
this.btnSavePos.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSavePos.Location = new System.Drawing.Point(3, 470);
this.btnSavePos.Name = "btnSavePos";
this.btnSavePos.Size = new System.Drawing.Size(133, 31);
this.btnSavePos.TabIndex = 109;
this.btnSavePos.Text = "全部保存";
this.btnSavePos.UseVisualStyleBackColor = true;
this.btnSavePos.Click += new System.EventHandler(this.btnSavePos_Click);
//
// ConfigControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnSavePos);
this.Controls.Add(this.groupBox3);
this.Name = "ConfigControl";
this.Size = new System.Drawing.Size(1096, 504);
this.Load += new System.EventHandler(this.ConfigControl_Load);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button btnSavePos;
}
}
<?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
此文件类型无法预览
...@@ -49,6 +49,7 @@ namespace OnlineStore.Common ...@@ -49,6 +49,7 @@ namespace OnlineStore.Common
/// 启用贴标功能 /// 启用贴标功能
/// </summary> /// </summary>
public static string UseLabel = "UseLabel"; public static string UseLabel = "UseLabel";
public static string CodeType = "CodeType";
public static string CodeParamPath = "CodeParamPath";
} }
} }
...@@ -128,9 +128,14 @@ namespace OnlineStore.Common ...@@ -128,9 +128,14 @@ namespace OnlineStore.Common
{ {
error(LOGGER, errorMsg, ex); error(LOGGER, errorMsg, ex);
} }
public static string lastlog = "";
public static void info(string msg) public static void info(string msg)
{ {
info(LOGGER, msg); if (lastlog != msg)
{
info(LOGGER, msg);
lastlog = msg;
}
} }
} }
......
...@@ -169,7 +169,7 @@ namespace DeviceLibrary ...@@ -169,7 +169,7 @@ namespace DeviceLibrary
public static bool HomeMoveIsEnd(MoveInfo MoveInfo, ConfigMoveAxis axis, out string msg) public static bool HomeMoveIsEnd(MoveInfo MoveInfo, ConfigMoveAxis axis, out string msg)
{ {
msg = ""; msg = "";
if (AxisManager.IsHomeMoveEnd(axis.DeviceName, axis.GetAxisValue())) if (AxisManager.IsHomeMoveEnd(axis.DeviceName, axis.GetAxisValue()))// || AxisManager.AxisStsINP(axis.DeviceName, axis.GetAxisValue()).Equals(1))
{ {
//原点完成并且位置=0 //原点完成并且位置=0
int outCount = AxisManager.GetActualtPosition(axis.DeviceName, axis.GetAxisValue()); int outCount = AxisManager.GetActualtPosition(axis.DeviceName, axis.GetAxisValue());
...@@ -221,12 +221,12 @@ namespace DeviceLibrary ...@@ -221,12 +221,12 @@ namespace DeviceLibrary
return; return;
} }
LastPosition = -1; LastPosition = -1;
if (targetSpeed > Config.TargetSpeed || targetSpeed <= 0) //if (targetSpeed <= 0)//targetSpeed > Config.TargetSpeed ||
{ //{
targetSpeed = Config.TargetSpeed; // targetSpeed = Config.TargetSpeed;
} //}
//小于1,表示是目标速度的百分比 //小于1,表示是目标速度的百分比
else if (targetSpeed <= 1) if (targetSpeed <= 1)
{ {
targetSpeed = Config.TargetSpeed * targetSpeed; targetSpeed = Config.TargetSpeed * targetSpeed;
} }
......
...@@ -3,7 +3,10 @@ using OnlineStore.Common; ...@@ -3,7 +3,10 @@ using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging;
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;
...@@ -89,19 +92,50 @@ namespace DeviceLibrary ...@@ -89,19 +92,50 @@ namespace DeviceLibrary
return new Point((int)x2, (int)y2); return new Point((int)x2, (int)y2);
} }
public static Point CalcLabelPoint(List<CodeInfo> codeInfos, Point org,int widthOffset,out int labelAngle) { public static Point CalcLabelPoint(LabelParam labelParam, Point org,int Label_R_Offset, out int labelAngle) {
SolidBrush blue = new SolidBrush(Color.BlueViolet);
SolidBrush red = new SolidBrush(Color.Red);
SolidBrush yeelow = new SolidBrush(Color.Yellow);
SolidBrush AliceBlue = new SolidBrush(Color.AliceBlue);
Font font = new Font(FontFamily.GenericSansSerif, 60);
Pen Greenpen = new Pen(Color.Green, 10);
Bitmap srcbitmap;
if (File.Exists(labelParam.bitmapfilename))
{
srcbitmap = new Bitmap(labelParam.bitmapfilename);
}
else {
srcbitmap = new Bitmap(5472,3648);
}
Bitmap bitmap = new Bitmap(srcbitmap.Width, srcbitmap.Height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
g.DrawImage(srcbitmap, 0, 0);
srcbitmap.Dispose();
Size pointsize = new Size(30, 30);
int widthOffset = 0;
//Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y); //Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Point Right_Batch_Point = org; Point Right_Batch_Point = org;
g.FillEllipse(blue, new Rectangle(Right_Batch_Point, pointsize));
List<int> angles = new List<int>(); List<int> angles = new List<int>();
codeInfos.ForEach((c) => { labelParam.codeInfos.ForEach((c) => {
//Point op = Common.PointRotate(Right_Batch_Point, new Point(c.X, c.Y), 83d / 180 * Math.PI); //Point op = Common.PointRotate(Right_Batch_Point, new Point(c.X, c.Y), 83d / 180 * Math.PI);
//c.X = op.X; //c.X = op.X;
//c.Y = op.Y; //c.Y = op.Y;
Point op = new Point(c.X, c.Y); Point op = new Point(c.X, c.Y);
g.FillEllipse(blue, new Rectangle(op, pointsize));
var a = (int)getAngle(Right_Batch_Point, op); var a = (int)getAngle(Right_Batch_Point, op);
a += ConfigHelper.Config.Get<int>("AngleChange"); //a += ConfigHelper.Config.Get<int>("AngleChange");
a = a < 0 ? 360 + a : a; a = a < 0 ? 360 + a : a;
//g.FillEllipse(red, new Rectangle(PointRotate(org, op, a), pointsize));
angles.Add(a); angles.Add(a);
widthOffset = (int)Common.distance(org, op);
}); });
angles.Sort(); angles.Sort();
//if (angles.Count > 1) { //if (angles.Count > 1) {
...@@ -120,11 +154,50 @@ namespace DeviceLibrary ...@@ -120,11 +154,50 @@ namespace DeviceLibrary
bigangles = angles[i]; bigangles = angles[i];
} }
} }
labelAngle = bigangles + biglen / 2; if (labelParam.PlateW > 7 && angles.Count==2) {
labelAngle = labelAngle > 360 ? 360 - labelAngle : labelAngle; labelAngle = angles[0] + 120;
}
else
{
labelAngle = bigangles + biglen / 2;
}
labelAngle = labelAngle > 360 ? labelAngle- 360 : labelAngle;
//g.FillEllipse(red, new Rectangle(PointRotate(org, op, labelAngle), pointsize));
//贴标坐标
var p2 = PointWithAngle(org, labelAngle, widthOffset); var p2 = PointWithAngle(org, labelAngle, widthOffset);
return p2;
//贴标偏移
var p3 = PointWithAngle(p2, labelAngle+180, Label_R_Offset);
//贴标角度,右侧为0度,+180转换到左侧为0度
labelAngle += 180;
labelAngle = labelAngle > 360 ? labelAngle - 360 : labelAngle;
g.FillEllipse(yeelow, new Rectangle(p2, pointsize));
g.FillEllipse(red, new Rectangle(p3, pointsize));
g.Save();
g.Dispose();
string dir = "/image/labeldebug/";
Directory.CreateDirectory(dir);
bitmap.Save(dir+DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") +".jpg",ImageFormat.Jpeg);
bitmap.Dispose();
return p3;
}
public T DeepClone<T>(T _object)
{
T dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, _object);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (T)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
} }
} }
public class Msg public class Msg
......
...@@ -32,7 +32,7 @@ namespace DeviceLibrary ...@@ -32,7 +32,7 @@ namespace DeviceLibrary
/// 物品二维码信息 /// 物品二维码信息
/// </summary> /// </summary>
public string WareCode { get; set; } public string WareCode { get; set; }
public string bitmapfilename = "";
public List<CodeInfo> codeInfos { get; set; } public List<CodeInfo> codeInfos { get; set; }
/// <summary> /// <summary>
/// 料盘高度 /// 料盘高度
...@@ -51,12 +51,9 @@ namespace DeviceLibrary ...@@ -51,12 +51,9 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public string NgMsg = ""; public string NgMsg = "";
public int HeightPos = 0;
public LabelParam clone() { public LabelParam clone() {
MemoryStream stream = new MemoryStream(); return this.MemberwiseClone() as LabelParam;
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, this);
stream.Position = 0;
return formatter.Deserialize(stream) as LabelParam;
} }
public string ToStr() public string ToStr()
......
...@@ -15,22 +15,26 @@ namespace DeviceLibrary ...@@ -15,22 +15,26 @@ namespace DeviceLibrary
{ {
void BtnProcess() void BtnProcess()
{ {
//右侧按钮按下,有料,出料
if (RightMoveInfo.IsStep(MoveStep.Wait) if (RightMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH)) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.HIGH))
{ {
RightMoveInfo.NewMove(MoveStep.R30_OutShelf); RightMoveInfo.NewMove(MoveStep.R30_OutShelf);
} }
//右侧按钮按下,无料,阻挡下降
else if (RightMoveInfo.IsStep(MoveStep.Wait) else if (RightMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.RightStopUP).Equals(IO_VALUE.LOW)) && IOValue(IO_Type.RightStopUP).Equals(IO_VALUE.LOW))
{ {
IOMove(IO_Type.RightStopUP, IO_VALUE.LOW); CylinderMove(null, IO_Type.RightStopUP, IO_Type.RightStopDown);
} }
if (LeftMoveInfo.IsStep(MoveStep.Wait) if (LeftMoveInfo.IsStep(MoveStep.Wait)
&& IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH)) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.LeftCar_Check).Equals(IO_VALUE.HIGH))
{ {
LeftMoveInfo.NewMove(MoveStep.L50_OutShelf); LeftMoveInfo.NewMove(MoveStep.L50_OutShelf);
} }
...@@ -39,7 +43,7 @@ namespace DeviceLibrary ...@@ -39,7 +43,7 @@ namespace DeviceLibrary
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.LeftStopUP).Equals(IO_VALUE.LOW)) && IOValue(IO_Type.LeftStopUP).Equals(IO_VALUE.LOW))
{ {
IOMove(IO_Type.LeftStopUP, IO_VALUE.LOW); CylinderMove(null, IO_Type.LeftStopUP, IO_Type.LeftStopDown);
} }
} }
......
...@@ -14,11 +14,7 @@ namespace DeviceLibrary ...@@ -14,11 +14,7 @@ namespace DeviceLibrary
public void StopMove(bool ServoOff=false) public void StopMove(bool ServoOff=false)
{ {
runStatus = RunStatus.Stop; runStatus = RunStatus.Stop;
ResetMoveInfo.EndMove(); MoveInfo.List.ForEach((m)=> { m.EndMove(); });
RightMoveInfo.EndMove();
LeftMoveInfo.EndMove();
LabelMoveInfo.EndMove();
MiddleMoveInfo.EndMove();
AxisBean.StopMultiAxis(AxisBean.List); AxisBean.StopMultiAxis(AxisBean.List);
if (ServoOff) if (ServoOff)
...@@ -131,12 +127,21 @@ namespace DeviceLibrary ...@@ -131,12 +127,21 @@ namespace DeviceLibrary
} }
else else
{ {
bool _isOk = AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0); bool isbusy = AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1);
if (_isOk) if (!isbusy)
{ {
//TODO 判断是否达到高度,如果未达到,继续上升 int outCount = AxisManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
axisBean.StopAxisCheckMove(); int errorCount = Math.Abs(outCount - wait.TargetPosition);
wait.IsEnd= true; if (errorCount <= wait.AxisInfo.CanErrorCountMax)
{
axisBean.StopAxisCheckMove();
wait.IsEnd = true;
}
else
{
axisBean.AbsMove(null, wait.TargetPosition, wait.TargetSpeed);
wait.IsEnd = false;
}
} }
} }
} }
...@@ -187,35 +192,41 @@ namespace DeviceLibrary ...@@ -187,35 +192,41 @@ 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 alarmMsg = "") public void Alarm(AlarmType _alarmType, string alarmMsg = "")
{ {
if (alarmType.Equals(AlarmType.None).Equals(false)) if (_alarmType.Equals(AlarmType.None).Equals(false))
{ {
LastAlarmTime = DateTime.Now; LastAlarmTime = DateTime.Now;
} }
//SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType); //SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType);
if (this.alarmType.Equals(alarmType)) if (this.alarmType.Equals(_alarmType))
{ {
return; return;
} }
LogUtil.error(Name + " 报警,报警类型:" + alarmType); LogUtil.error(Name + " 报警,报警类型:" + _alarmType);
if (this.alarmType == AlarmType.SuddenStop && _alarmType == AlarmType.None) {
electricClamp.ClosePort();
electricClamp.OpenPort(ConfigHelper.Config.Get("ElectricGripperPort"));
}
this.alarmType = alarmType; this.alarmType = _alarmType;
if (alarmType.Equals(AlarmType.AxisAlarm) || alarmType.Equals(AlarmType.AxisMoveError)) if (_alarmType.Equals(AlarmType.AxisAlarm) || _alarmType.Equals(AlarmType.AxisMoveError))
{ {
LogUtil.error(Name + "轴报警, 停止运动, 打开报警灯"); LogUtil.error(Name + "轴报警, 停止运动, 打开报警灯");
StopMove(true); StopMove(true);
} }
else if (alarmType == AlarmType.SuddenStop) else if (_alarmType == AlarmType.SuddenStop)
{ {
//isInSuddenDown = true; //isInSuddenDown = true;
LogUtil.error(Name + "收到急停信号,停止运动, 打开报警灯 "); LogUtil.error(Name + "收到急停信号,停止运动, 打开报警灯 ");
StopMove(true); StopMove(true);
//storeStatus = StoreStatus.SuddenStop; //storeStatus = StoreStatus.SuddenStop;
} }
else if (alarmType.Equals(AlarmType.NoAirCheck)) else if (_alarmType.Equals(AlarmType.NoAirCheck))
{ {
//isNoAirCheck = true; //isNoAirCheck = true;
LogUtil.error(Name + " 未检测到气压信号 ,停止运动, 打开报警灯 "); LogUtil.error(Name + " 未检测到气压信号 ,停止运动, 打开报警灯 ");
...@@ -241,7 +252,7 @@ namespace DeviceLibrary ...@@ -241,7 +252,7 @@ namespace DeviceLibrary
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
} }
} }
IO_VALUE IOValue(string ioType) { public IO_VALUE IOValue(string ioType) {
return IOManager.IOValue(ioType); return IOManager.IOValue(ioType);
} }
void IOMove(string IoType, IO_VALUE value, bool isCheck = false, int msTime = 0) void IOMove(string IoType, IO_VALUE value, bool isCheck = false, int msTime = 0)
......
...@@ -35,7 +35,7 @@ namespace DeviceLibrary ...@@ -35,7 +35,7 @@ namespace DeviceLibrary
&& IOValue(IO_Type.LeftFornt_Check).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.LeftFornt_Check).Equals(IO_VALUE.HIGH)
&& IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW)) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW))
{ {
LeftMoveInfo.NewMove(MoveStep.R40_InShelf); LeftMoveInfo.NewMove(MoveStep.L60_InShelf);
LogUtil.info("IOMonitor:左侧检测到入料信号"); LogUtil.info("IOMonitor:左侧检测到入料信号");
} }
if (LeftMoveInfo.IsStep(MoveStep.Wait) if (LeftMoveInfo.IsStep(MoveStep.Wait)
......
...@@ -22,30 +22,44 @@ namespace DeviceLibrary ...@@ -22,30 +22,44 @@ namespace DeviceLibrary
switch (LabelMoveInfo.MoveStep) switch (LabelMoveInfo.MoveStep)
{ {
case MoveStep.Lbl01: case MoveStep.Lbl01:
LabelMoveInfo.NextMoveStep(MoveStep.Lbl_WaitPrint);
Label_X_Axis.AbsMove(LabelMoveInfo, Config.Label_X_P2, Config.Label_X_P2_speed); Label_X_Axis.AbsMove(LabelMoveInfo, Config.Label_X_P2, Config.Label_X_P2_speed);
Label_Y_Axis.AbsMove(LabelMoveInfo, Config.Label_Y_P2, Config.Label_Y_P2_speed); Label_Y_Axis.AbsMove(LabelMoveInfo, Config.Label_Y_P2, Config.Label_Y_P2_speed);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed); Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
LabelMoveInfo.NextMoveStep(MoveStep.Lbl_WaitPrint); Label_R_Axis.AbsMove(LabelMoveInfo, Config.Label_R_P2, Config.Label_Z_P2_speed);
LabelMoveInfo.log("Label_XYZ转到取标点,等待标签打印完毕"); LabelMoveInfo.log("Label_XYZ转到取标点,等待标签打印完毕");
break; break;
case MoveStep.Lbl_WaitPrint:
if (LastPrintStatus == Asa.PrintLabel.PrinterStatus.Idle) {
LabelMoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
}
break;
case MoveStep.Lbl_Printted: case MoveStep.Lbl_Printted:
LabelMoveInfo.NextMoveStep(MoveStep.Lbl02); LabelMoveInfo.NextMoveStep(MoveStep.Lbl03);
CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Bck, IO_Type.LabelCylinder_Fwd); LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown;
IOMove(IO_Type.LabelCylinder_Work, IO_VALUE.HIGH); IOMove(IO_Type.LabelCylinder_Work, IO_VALUE.HIGH);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P3, Config.Label_Z_P3_speed);
//CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Bck, IO_Type.LabelCylinder_Fwd);
LabelMoveInfo.log("标签打印完毕,取标气缸下降,开始吸气."); LabelMoveInfo.log("标签打印完毕,取标气缸下降,开始吸气.");
break; break;
case MoveStep.Lbl02: case MoveStep.Lbl03:
CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Fwd, IO_Type.LabelCylinder_Bck); LabelMoveInfo.NextMoveStep(MoveStep.Lbl04);
LabelMoveInfo.NextMoveStep(MoveStep.Lbl03); LabelMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
break;
case MoveStep.Lbl04:
LabelMoveInfo.NextMoveStep(MoveStep.Lbl05);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
//CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Fwd, IO_Type.LabelCylinder_Bck);
LabelMoveInfo.log("标签打印完毕,取标气缸上升,取起标签."); LabelMoveInfo.log("标签打印完毕,取标气缸上升,取起标签.");
break; break;
case MoveStep.Lbl03: case MoveStep.Lbl05:
if (LeftMoveInfo.MoveStep == MoveStep.L20_WaitLabel) if (LeftMoveInfo.MoveStep == MoveStep.L20_WaitLabel)
{ {
LabelMoveInfo.NextMoveStep(MoveStep.Lbl10); LabelMoveInfo.NextMoveStep(MoveStep.Lbl10);
} }
else if (LabelMoveInfo.IsTimeOut(60)) { else if (LabelMoveInfo.IsTimeOut(60)) {
LabelMoveInfo.log("等待左侧料可贴标."); LabelMoveInfo.log("等待左侧料可贴标.");
} }
break; break;
case MoveStep.Lbl10: case MoveStep.Lbl10:
...@@ -62,37 +76,46 @@ namespace DeviceLibrary ...@@ -62,37 +76,46 @@ namespace DeviceLibrary
break; break;
} }
//计算照片中贴标的像素位置 //计算照片中贴标的像素位置
Point p = Common.CalcLabelPoint(LabelMoveInfo.MoveParam.codeInfos, Right_Batch_Point, widthOffset, out int labelAngle); Point p = Common.CalcLabelPoint(LabelMoveInfo.MoveParam, Right_Batch_Point, Config.Label_R_Offset, out int labelAngle);
//匹配照片角度与贴标旋转轴的角度差 //匹配照片角度与贴标旋转轴的角度差
labelAngle += Config.Label_R_Angle_Diff; labelAngle += Config.Label_R_Angle_Diff;
labelAngle = labelAngle > 360 ? labelAngle - 360 : labelAngle;
//计算贴标角度的脉冲值 //计算贴标角度的脉冲值
int labelAxisPos = Config.Label_R_360 / 360 * labelAngle; int labelAxisPos = Config.Label_R_360 / 360 * labelAngle;
//计算像素点位与中心点的差 //计算像素点位与中心点的差
Point p1 = new Point(p.X - Right_Batch_Point.X , p.Y - Right_Batch_Point.Y); Point Label_p3 = new Point(p.X - Right_Batch_Point.X , p.Y - Right_Batch_Point.Y);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲 //计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
p1.X = (int)(p1.X * Config.Cam_Pixel_X_Ratio) + Config.Label_X_Base; Label_p3.X = (int)(Label_p3.X * Config.Cam_Pixel_X_Ratio) + Config.Label_X_P3;
p1.Y = (int)(p1.Y * Config.Cam_Pixel_Y_Ratio) + Config.Label_Y_Base; Label_p3.Y = (int)(Label_p3.Y * Config.Cam_Pixel_Y_Ratio) + Config.Label_Y_P3;
LabelMoveInfo.log($"计算贴标像素点位为{p},轴点位为{p1},角度{labelAngle},R轴{labelAxisPos},盘宽{LabelMoveInfo.MoveParam.PlateW}");
Label_X_Axis.AbsMove(LabelMoveInfo, p.X, Config.Label_X_P2_speed); LabelMoveInfo.log($"计算贴标像素点位为{p},轴点位为{Label_p3},角度{labelAngle},R轴{labelAxisPos},盘宽{LabelMoveInfo.MoveParam.PlateW}");
Label_Y_Axis.AbsMove(LabelMoveInfo, p.Y, Config.Label_Y_P2_speed);
Label_R_Axis.AbsMove(LabelMoveInfo, labelAxisPos, Config.Label_R_P2_speed);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P3, Config.Label_Z_P3_speed);
LabelMoveInfo.NextMoveStep(MoveStep.Lbl11); LabelMoveInfo.NextMoveStep(MoveStep.Lbl11);
Label_X_Axis.AbsMove(LabelMoveInfo, Label_p3.X, Config.Label_X_P3_speed);
Label_Y_Axis.AbsMove(LabelMoveInfo, Label_p3.Y, Config.Label_Y_P3_speed);
Label_R_Axis.AbsMove(LabelMoveInfo, labelAxisPos, Config.Label_R_P2_speed);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
LabelMoveInfo.log("Label_XYZ转到贴标点."); LabelMoveInfo.log("Label_XYZ转到贴标点.");
break; break;
case MoveStep.Lbl11: case MoveStep.Lbl11:
LabelMoveInfo.NextMoveStep(MoveStep.Lbl12); LabelMoveInfo.NextMoveStep(MoveStep.Lbl12);
CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Bck, IO_Type.LabelCylinder_Fwd); Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P5, Config.Label_Z_P5_speed);
IOMove(IO_Type.LabelCylinder_Work, IO_VALUE.LOW); LabelMoveInfo.log("下降.");
LabelMoveInfo.log("取标气缸下降,关闭吸气.");
break; break;
case MoveStep.Lbl12: case MoveStep.Lbl12:
CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Fwd, IO_Type.LabelCylinder_Bck);
LabelMoveInfo.NextMoveStep(MoveStep.Lbl13); LabelMoveInfo.NextMoveStep(MoveStep.Lbl13);
LabelMoveInfo.log("取标气缸上升."); IOMove(IO_Type.LabelCylinder_Work, IO_VALUE.LOW);
LabelMoveInfo.log("关闭吸气.");
break; break;
case MoveStep.Lbl13: case MoveStep.Lbl13:
LabelMoveInfo.NextMoveStep(MoveStep.Lbl14);
Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P4, Config.Label_Z_P4_speed);
LabelMoveInfo.log("上升.");
break;
case MoveStep.Lbl14:
LeftMoveInfo.NextMoveStep(MoveStep.L30_LabelFinish); LeftMoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
LabelMoveInfo.NextMoveStep(MoveStep.Lbl01); LabelMoveInfo.NextMoveStep(MoveStep.Lbl01);
LabelMoveInfo.log("完成贴标."); LabelMoveInfo.log("完成贴标.");
...@@ -112,6 +135,10 @@ namespace DeviceLibrary ...@@ -112,6 +135,10 @@ namespace DeviceLibrary
{ {
state += "等待标签打印"; state += "等待标签打印";
} }
if (LabelMoveInfo.MoveStep == MoveStep.Wait)
{
state += "等待中";
}
return state; return state;
} }
......
...@@ -28,45 +28,52 @@ namespace DeviceLibrary ...@@ -28,45 +28,52 @@ namespace DeviceLibrary
void LedProcess(object o) void LedProcess(object o)
{ {
StandbyLed.LedState = LedState.off;
AlarmLed.LedState = LedState.off;
RunningLed.LedState = LedState.off;
RightLed.LedState = LedState.off;
LeftLed.LedState = LedState.off;
//无法运行,量报警灯 //无法运行,量报警灯
if (canRunning) if (!canRunning)
{ {
AlarmLed.LedState = LedState.on; AlarmLed.LedState = LedState.on;
StandbyLed.LedState = LedState.off;
}
else {
AlarmLed.LedState = LedState.off;
StandbyLed.LedState = LedState.on;
} }
//所有过程都在运动,闪烁运行中灯 //所有过程都在运动,闪烁运行中灯
if (!RightMoveInfo.IsStep(MoveStep.Wait) //if (!RightMoveInfo.IsStep(MoveStep.Wait)
|| !LeftMoveInfo.IsStep(MoveStep.Wait) // || !LeftMoveInfo.IsStep(MoveStep.Wait)
|| !MiddleMoveInfo.IsStep(MoveStep.M_Standby) // || !MiddleMoveInfo.IsStep(MoveStep.M_Standby)
|| LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint)) // || LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
//{
// RunningLed.LedState = LedState.on;
//}
if (alarmType != AlarmType.None)
{ {
RunningLed.LedState = LedState.blink; AlarmLed.LedState = LedState.on;
AlarmBuzzer.ON();
} }
else { else {
RunningLed.LedState = LedState.off; AlarmBuzzer.OFF();
} }
if (runStatus == RunStatus.HomeReset)
if (alarmType == AlarmType.AxisAlarm {
|| alarmType == AlarmType.AxisAlarm StandbyLed.LedState = LedState.blink;
|| alarmType == AlarmType.AxisMoveError) {
AlarmLed.LedState = LedState.on;
} }
if (runStatus == RunStatus.Running) if (runStatus == RunStatus.Running)
{ {
RunningLed.LedState = LedState.on;
//右侧料串已空 //右侧料串已空
if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray) if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray && IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.HIGH))
RightLed.LedState = LedState.on;
else if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray)
RightLed.LedState = LedState.blink; RightLed.LedState = LedState.blink;
else
RightLed.LedState = LedState.off;
//左侧料串已满 //左侧料串已满
if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray) if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray && IOValue(IO_Type.LeftCar_Check).Equals(IO_VALUE.HIGH))
LeftLed.LedState = LedState.blink;
else if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray)
LeftLed.LedState = LedState.blink; LeftLed.LedState = LedState.blink;
else
LeftLed.LedState = LedState.off;
} }
Led.LedGroup.ForEach((x) => { x.run(); }); Led.LedGroup.ForEach((x) => { x.run(); });
} }
......
...@@ -13,6 +13,8 @@ namespace DeviceLibrary ...@@ -13,6 +13,8 @@ namespace DeviceLibrary
{ {
bool LeftShelfNoTray = false; bool LeftShelfNoTray = false;
int LeftCount = 0; int LeftCount = 0;
public volatile bool SafeReleaseLeftShelf = false;
void LeftProcess() void LeftProcess()
{ {
if (CheckWait(LeftMoveInfo)) if (CheckWait(LeftMoveInfo))
...@@ -22,7 +24,9 @@ namespace DeviceLibrary ...@@ -22,7 +24,9 @@ namespace DeviceLibrary
{ {
case MoveStep.L01: case MoveStep.L01:
LeftCount = 0; LeftCount = 0;
LeftShelfNoTray = false;
LeftMoveInfo.NextMoveStep(MoveStep.L03); LeftMoveInfo.NextMoveStep(MoveStep.L03);
CylinderMove(null, IO_Type.LeftStopDown, IO_Type.LeftStopUP);
LeftBatchAxisToP2(true); LeftBatchAxisToP2(true);
LeftMoveInfo.log($"批量轴上升到P2位置,第一次提升,LeftStartMovePosition={LeftStartMovePosition}"); LeftMoveInfo.log($"批量轴上升到P2位置,第一次提升,LeftStartMovePosition={LeftStartMovePosition}");
break; break;
...@@ -43,26 +47,29 @@ namespace DeviceLibrary ...@@ -43,26 +47,29 @@ namespace DeviceLibrary
} }
break; break;
case MoveStep.L04: case MoveStep.L04:
var currpos = Left_Batch_Axis.GetAclPosition()-Config.Left_Batch_ChangeValue*80; var currpos = Left_Batch_Axis.GetAclPosition()- LeftMoveInfo.MoveParam.HeightPos;
if (currpos < Config.Left_Batch_P1) if (currpos < Config.Left_Batch_P1)
{ {
//LeftShelfNoTray = true;
LeftMoveInfo.NextMoveStep(MoveStep.L40_ShelfFull); LeftMoveInfo.NextMoveStep(MoveStep.L40_ShelfFull);
LeftMoveInfo.log($"批量轴已下降到底,料串已满,Left_Batch_P1={Config.Left_Batch_P1},needpos={currpos}"); LeftMoveInfo.log($"批量轴已下降到底,料串已满,Left_Batch_P1={Config.Left_Batch_P1},needpos={currpos}");
} }
else else
{ {
LeftMoveInfo.NextMoveStep(MoveStep.L10_WaitReelPut); LeftMoveInfo.NextMoveStep(MoveStep.L10_WaitReelPut);
Left_Batch_Axis.AbsMove(LeftMoveInfo, currpos, Config.Left_Batch_P1_speed); //Left_Batch_Axis.AbsMove(LeftMoveInfo, currpos, Config.Left_Batch_P1_speed);
LeftMoveInfo.log($"批量轴已下降一张料盘位置,等待料盘放入,needpos={currpos}"); //LeftMoveInfo.log($"批量轴已下降一张料盘位置,等待料盘放入,needpos={currpos}");
} }
break; break;
case MoveStep.L10_WaitReelPut: case MoveStep.L10_WaitReelPut:
Msg.add("左侧等待料盘放入", MsgLevel.info);
break; break;
case MoveStep.L11_ReelPutted: case MoveStep.L11_ReelPutted:
LeftCount++; LeftCount++;
LeftMoveInfo.NextMoveStep(MoveStep.L12); LeftMoveInfo.NextMoveStep(MoveStep.L12);
LeftBatchAxisToP2(false); LeftBatchAxisToP1();
LeftMoveInfo.log($"料盘已放入,批量轴上升,LeftStartMovePosition={LeftStartMovePosition}"); //LeftMoveInfo.log($"料盘已放入,批量轴上升,LeftStartMovePosition={LeftStartMovePosition}");
LeftMoveInfo.log($"左侧料盘已放入,批量轴下降");
break; break;
case MoveStep.L12: case MoveStep.L12:
if (IOValue(IO_Type.LeftOverHead_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.LeftOverHead_Check).Equals(IO_VALUE.HIGH))
...@@ -81,10 +88,20 @@ namespace DeviceLibrary ...@@ -81,10 +88,20 @@ namespace DeviceLibrary
case MoveStep.L20_WaitLabel: case MoveStep.L20_WaitLabel:
break; break;
case MoveStep.L30_LabelFinish: case MoveStep.L30_LabelFinish:
LeftMoveInfo.NextMoveStep(MoveStep.L04); if (SafeReleaseLeftShelf) {
LeftMoveInfo.log($"贴标完成,准备下一盘料"); //LeftShelfNoTray = true;
SafeReleaseLeftShelf = false;
LeftMoveInfo.NextMoveStep(MoveStep.L40_ShelfFull);
LeftMoveInfo.log($"用户请求释放料架");
}
else
{
LeftMoveInfo.NextMoveStep(MoveStep.L04);
LeftMoveInfo.log($"贴标完成,准备下一盘料");
}
break; break;
case MoveStep.L40_ShelfFull: case MoveStep.L40_ShelfFull:
LeftShelfNoTray = true;
LeftMoveInfo.NextMoveStep(MoveStep.LEND); LeftMoveInfo.NextMoveStep(MoveStep.LEND);
Left_Batch_Axis.AbsMove(LeftMoveInfo, Config.Left_Batch_P1, Config.Left_Batch_P1_speed); Left_Batch_Axis.AbsMove(LeftMoveInfo, Config.Left_Batch_P1, Config.Left_Batch_P1_speed);
LeftMoveInfo.log($"料串已满,批量轴下降到P1位置"); LeftMoveInfo.log($"料串已满,批量轴下降到P1位置");
...@@ -94,7 +111,7 @@ namespace DeviceLibrary ...@@ -94,7 +111,7 @@ namespace DeviceLibrary
LeftMoveInfo.log($"结束运动"); LeftMoveInfo.log($"结束运动");
break; break;
//} //}
//料出料流程 //料出料流程
//switch (LeftMoveInfo.MoveStep) //switch (LeftMoveInfo.MoveStep)
//{ //{
case MoveStep.L50_OutShelf: case MoveStep.L50_OutShelf:
...@@ -124,11 +141,11 @@ namespace DeviceLibrary ...@@ -124,11 +141,11 @@ namespace DeviceLibrary
break; break;
case MoveStep.L54: case MoveStep.L54:
LeftMoveInfo.NextMoveStep(MoveStep.REND); LeftMoveInfo.NextMoveStep(MoveStep.REND);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW, false, 500); IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH, false, 500);
LeftMoveInfo.log($"电滚停止"); LeftMoveInfo.log($"电滚停止");
break; break;
//} //}
//料入料流程 //料入料流程
//switch (LeftMoveInfo.MoveStep) //switch (LeftMoveInfo.MoveStep)
//{ //{
case MoveStep.L60_InShelf: case MoveStep.L60_InShelf:
...@@ -138,7 +155,7 @@ namespace DeviceLibrary ...@@ -138,7 +155,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.L61: case MoveStep.L61:
LeftMoveInfo.NextMoveStep(MoveStep.L62); LeftMoveInfo.NextMoveStep(MoveStep.L62);
IOMove(IO_Type.LeftStopUP, IO_VALUE.LOW); CylinderMove(null, IO_Type.LeftStopUP, IO_Type.LeftStopDown);
LeftMoveInfo.log($"阻挡下降"); LeftMoveInfo.log($"阻挡下降");
break; break;
case MoveStep.L62: case MoveStep.L62:
...@@ -148,24 +165,28 @@ namespace DeviceLibrary ...@@ -148,24 +165,28 @@ namespace DeviceLibrary
MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH)); MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(6000));
LeftMoveInfo.OneWaitCanEndStep = true; LeftMoveInfo.OneWaitCanEndStep = true;
LeftMoveInfo.log($"等待料到位"); LeftMoveInfo.log($"等待料到位");
break; break;
case MoveStep.L63: case MoveStep.L63:
LeftMoveInfo.NextMoveStep(MoveStep.L64); LeftMoveInfo.NextMoveStep(MoveStep.L64);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.LOW, false, 500); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
IOMove(IO_Type.LeftStopUP, IO_VALUE.HIGH);
LeftMoveInfo.log($"电滚筒停止,阻挡上升");
break; break;
case MoveStep.L64: case MoveStep.L64:
LeftMoveInfo.NextMoveStep(MoveStep.L65);
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH, false, 500);
CylinderMove(null, IO_Type.LeftStopDown, IO_Type.LeftStopUP);
LeftMoveInfo.log($"电滚筒停止,阻挡上升");
break;
case MoveStep.L65:
if (IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH))
{ {
LeftMoveInfo.NewMove(MoveStep.L01); LeftMoveInfo.NewMove(MoveStep.L01);
LeftMoveInfo.log($"料进入开始上料"); LeftMoveInfo.log($"料进入开始上料");
} }
else else
{ {
LeftMoveInfo.NextMoveStep(MoveStep.LEND); LeftMoveInfo.NextMoveStep(MoveStep.LEND);
LeftMoveInfo.log($"料进入失败"); LeftMoveInfo.log($"料进入失败");
} }
break; break;
default: default:
...@@ -179,16 +200,16 @@ namespace DeviceLibrary ...@@ -179,16 +200,16 @@ namespace DeviceLibrary
string state = ""; string state = "";
if (IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH))
{ {
state += $"有料窜,已提取{RightCount}张料盘"; state += $"有料串,已放置{LeftCount}张料盘";
if (LeftShelfNoTray) if (LeftShelfNoTray)
state += ",料串已清空"; state += ",料串已";
else else
state += "."; state += ".";
state += "当前ReelID:" + LeftMoveInfo.MoveParam.WareCode; state += "当前ReelID:" + LeftMoveInfo.MoveParam.WareCode;
} }
else else
{ {
return "无料"; return "无料";
} }
return state; return state;
...@@ -221,9 +242,25 @@ namespace DeviceLibrary ...@@ -221,9 +242,25 @@ namespace DeviceLibrary
Config.Left_Batch_Axis.TargetPosition = targetP2; Config.Left_Batch_Axis.TargetPosition = targetP2;
Left_Batch_Axis.AbsMove(null, targetP2, targetSpeed); Left_Batch_Axis.AbsMove(null, targetP2, targetSpeed);
//开始检测信号 //开始检测信号
Left_Batch_Axis.BatchAxisStartCheck(IO_Type.LeftTop_Check, IO_VALUE.LOW); Left_Batch_Axis.BatchAxisStartCheck(IO_Type.LeftTop_Check, IO_VALUE.HIGH);
} }
/// <summary>
/// 左批量轴下降到X23对射信号灭
/// </summary>
void LeftBatchAxisToP1()
{
int targetP1 = Config.Left_Batch_P1;
int targetSpeed = Config.Left_Batch_P2_speed;
LeftMoveInfo.TimeOutSeconds = 200;
LeftMoveInfo.CanWhileCount = 0;
// 需要增加定时器,获取验证信号并停止伺服
LeftStartMovePosition = Left_Batch_Axis.GetAclPosition();
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitBatchAxisMove(Config.Left_Batch_Axis, targetP1, targetSpeed));
Config.Left_Batch_Axis.TargetPosition = targetP1;
Left_Batch_Axis.AbsMove(null, targetP1, targetSpeed);
//开始检测信号
Left_Batch_Axis.BatchAxisStartCheck(IO_Type.LeftTop_Check, IO_VALUE.LOW);
}
} }
} }
...@@ -41,17 +41,17 @@ namespace DeviceLibrary ...@@ -41,17 +41,17 @@ namespace DeviceLibrary
else else
{ {
if (sta == Asa.PrintLabel.PrinterStatus.Idle) { if (sta == Asa.PrintLabel.PrinterStatus.Idle) {
Task.Run(()=> { //Task.Run(()=> {
while (true) // while (true)
{ // {
if (LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint)) // if (LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
{ // {
LabelMoveInfo.NextMoveStep(MoveStep.Lbl_Printted); // LabelMoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
break; // break;
} // }
Task.Delay(500).Wait(); // Task.Delay(500).Wait();
} // }
}); //});
} }
LogUtil.info(" PrintLabel 收到打印机新状态:【" + sta + "】【" + msg + "】,与之前状态一样 "); LogUtil.info(" PrintLabel 收到打印机新状态:【" + sta + "】【" + msg + "】,与之前状态一样 ");
} }
......
...@@ -30,7 +30,7 @@ namespace DeviceLibrary ...@@ -30,7 +30,7 @@ namespace DeviceLibrary
R08, R08,
R10_WaitReelLeave, //等待料盘离开 R10_WaitReelLeave, //等待料盘离开
R11_NextReel, //开始下一盘料 R11_NextReel, //开始下一盘料
R12_ShelfNoTray, //料已清空 R12_ShelfNoTray, //料已清空
R20, R20,
R21, R21,
REND, REND,
...@@ -63,19 +63,19 @@ namespace DeviceLibrary ...@@ -63,19 +63,19 @@ namespace DeviceLibrary
L30_LabelFinish, L30_LabelFinish,
L40_ShelfFull, L40_ShelfFull,
LEND, LEND,
//出料流程 //出料流程
L50_OutShelf, L50_OutShelf,
L51, L51,
L52, L52,
L53, L53,
L54, L54,
//入料流程 //入料流程
L60_InShelf, L60_InShelf,
L61, L61,
L62, L62,
L63, L63,
L64, L64,
L65,
M_Standby, M_Standby,
M02, M02,
...@@ -86,6 +86,8 @@ namespace DeviceLibrary ...@@ -86,6 +86,8 @@ namespace DeviceLibrary
M07, M07,
M_ReturnToP1, M_ReturnToP1,
M08, M08,
M09,
M10,
M20_ToNgBox, M20_ToNgBox,
M21, M21,
M22, M22,
......
...@@ -49,6 +49,7 @@ namespace DeviceLibrary ...@@ -49,6 +49,7 @@ namespace DeviceLibrary
IsLoadOk = false; IsLoadOk = false;
msg += "IO板卡初始化失败\n"; msg += "IO板卡初始化失败\n";
} }
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msg); LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msg);
} }
...@@ -67,11 +68,14 @@ namespace DeviceLibrary ...@@ -67,11 +68,14 @@ namespace DeviceLibrary
if (!IsDebug) if (!IsDebug)
return; return;
} }
var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort");
electricGripper.OpenPort(ElectricGripperPort);
mainThread = new Thread(new ThreadStart(mainMachine.Run)); mainThread = new Thread(new ThreadStart(mainMachine.Run));
mainThread.Start(); mainThread.Start();
isRunning = true; isRunning = true;
GC.KeepAlive(mainThread); GC.KeepAlive(mainThread);
Task.Run(()=> { Task.Run(()=> {
AxisBean.List.ForEach((x) => { AxisManager.AlarmClear(x.Config.DeviceName, x.Config.GetAxisValue()); });
Task.Delay(1000).Wait(); Task.Delay(1000).Wait();
if (mainMachine.DeviceCheck()) if (mainMachine.DeviceCheck())
mainMachine.BeginHomeReset(true); mainMachine.BeginHomeReset(true);
...@@ -84,11 +88,17 @@ namespace DeviceLibrary ...@@ -84,11 +88,17 @@ namespace DeviceLibrary
LogUtil.info("开始停止系统."); LogUtil.info("开始停止系统.");
mainMachine.Stop(); mainMachine.Stop();
mainMachine.UserPause = false;
//IOManager.CloseAllConnection();
//electricGripper.ClosePort();
isRunning = false;
}
public static void ShutDown()
{
LogUtil.info("开始关闭系统.");
IOManager.CloseAllConnection(); IOManager.CloseAllConnection();
electricGripper.ClosePort(); electricGripper.ClosePort();
isRunning = false;
} }
public static void UserPause(bool userpause) { public static void UserPause(bool userpause) {
mainMachine.UserPause = userpause; mainMachine.UserPause = userpause;
if (userpause) if (userpause)
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位 类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,取料机构旋转轴,Take_Middle_Axis,0,HC,,500,1000,1000,100,200,1000,10,100,0,0 AXIS,,进料提升轴,Right_Batch_Axis,0,HC,,40000,130000,130000,2000,20000,80000,10,100,0,0
AXIS,,取料机构上下轴,Take_UpDown_Axis,1,HC,,1000,1000,1000,200,500,500,10,100,0,0 AXIS,,出料提升轴,Left_Batch_Axis,1,HC,,40000,130000,130000,2000,20000,80000,10,100,0,0
AXIS,,左轨道提升轴,Left_Batch_Axis,2,HC,,3000,1000,1000,200,1000,200,10,100,0,0 AXIS,,取料升降轴,Take_UpDown_Axis,2,HC,,40000,130000,130000,1000,4000,15000,10,100,0,0
AXIS,,右轨道提升轴,Right_Batch_Axis,3,HC,,3000,1000,1000,200,1000,200,10,100,0,0 AXIS,,取料旋转轴,Take_Middle_Axis,3,HC,,1000,10000,10000,500,3000,7000,10,100,0,0
AXIS,,贴标移栽机构X轴,Label_X_Axis,4,HC,,100,700,700,50,250,500,10,100,0,0 AXIS,,贴标移栽机构X轴,Label_X_Axis,4,HC,,90000,1000000,1000000,3000,30000,100000,10,100,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,100,700,700,50,150,500,10,100,0,0 AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,90000,1000000,1000000,3000,30000,100000,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,,90000,1000000,1000000,2000,10000,40000,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,,700,2100,2100,20,350,5000,500,100,0,0
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,30,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,, PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,30,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,, PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,20,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,, PRO,30,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,20,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,, PRO,30,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,30,右侧相机名称,RightCameraName,123123,,,,,,,,,,,, PRO,30,右侧相机名称,RightCameraName,GigE:MV-CE200-10GC (00E78064919),,,,,,,,,,,,
PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,, PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,, PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,90,,,,,,,,,,,, PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,0,,,,,,,,,,,,
PRO,30,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,, PRO,30,贴标R轴偏置距离像素,Label_R_Offset,0,,,,,,,,,,,,
PRO,30,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,, PRO,30,贴标R轴360度脉冲,Label_R_360,7031,,,,,,,,,,,,
PRO,30,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,, PRO,0,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
PRO,0,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,, PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,, PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,, PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,, PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,, PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,10,取料旋转轴待机点P1,Take_Middle_P1,1,,,99,,,,,,,,, PRO,13,取料旋转轴待机点P1,Take_Middle_P1,22888,,,3000,,,,,,,,,
PRO,10,取料旋转轴右取料点P2,Take_Middle_P2,2,,,99,,,,,,,,, PRO,13,取料旋转轴右取料点P2,Take_Middle_P2,16979,,,3000,,,,,,,,,
PRO,10,取料旋转轴左取料点P3,Take_Middle_P3,3,,,99,,,,,,,,, PRO,13,取料旋转轴左取料点P3,Take_Middle_P3,28948,,,3000,,,,,,,,,
PRO,10,取料旋转轴NG放料点P5,Take_Middle_P5,4,,,99,,,,,,,,, PRO,13,取料旋转轴NG放料点P5,Take_Middle_P5,1036,,,3000,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,11,取料上下轴待机点P1,Take_UpDown_P1,6,,,88,,,,,,,,, PRO,12,取料升降轴待机点P1,Take_UpDown_P1,10,,,50000,,,,,,,,,
PRO,11,取料上下轴取料高点P2,Take_UpDown_P2,7,,,88,,,,,,,,, PRO,12,取料升降轴取料高点P2,Take_UpDown_P2,10,,,50000,,,,,,,,,
PRO,11,取料上下轴取右料低点P3,Take_UpDown_P3,8,,,88,,,,,,,,, PRO,12,取料升降轴取右料低点P3,Take_UpDown_P3,195734,,,50000,,,,,,,,,
PRO,11,取料上下轴取左料低点P4,Take_UpDown_P4,9,,,88,,,,,,,,, PRO,12,取料升降轴取左料低点P4,Take_UpDown_P4,190738,,,50000,,,,,,,,,
PRO,11,取料上下轴NG放料点P5,Take_UpDown_P5,10,,,88,,,,,,,,, PRO,12,取料升降轴NG放料点P5,Take_UpDown_P5,165312,,,30000,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,12,右提升轴低点P1,Right_Batch_P1,12,,,66,,,,,,,,, PRO,10,进料升轴低点P1,Right_Batch_P1,5,,,16000,,,,,,,,,
PRO,12,右提升轴高点P2,Right_Batch_P2,13,,,66,,,,,,,,, PRO,10,进料升轴高点P2,Right_Batch_P2,891747,,,16000,,,,,,,,,
PRO,12,左提升轴低点P1,Left_Batch_P1,14,,,66,,,,,,,,, PRO,11,出料升轴低点P1,Left_Batch_P1,5,,,16000,,,,,,,,,
PRO,12,左提升轴高点P2,Left_Batch_P2,15,,,66,,,,,,,,, PRO,11,出料升轴高点P2,Left_Batch_P2,891747,,,16000,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,13,贴标X轴待机点P1,Label_X_P1,17,,,77,,,,,,,,, PRO,14,贴标X轴待机点P1,Label_X_P1,5,,,90000,,,,,,,,,
PRO,13,贴标X轴取标点P2,Label_X_P2,18,,,77,,,,,,,,, PRO,14,贴标X轴取标点P2,Label_X_P2,10500,,,90000,,,,,,,,,
PRO,14,贴标X轴贴标基准点P3,Label_X_P3,508371,,,90000,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,14,贴标Y轴待机点P1,Label_Y_P1,21,,,44,,,,,,,,, PRO,15,贴标Y轴待机点P1,Label_Y_P1,5,,,90000,,,,,,,,,
PRO,14,贴标Y轴取标点P2,Label_Y_P2,22,,,44,,,,,,,,, PRO,15,贴标Y轴取标点P2,Label_Y_P2,80942,,,90000,,,,,,,,,
PRO,15,贴标Y轴贴标基准点P3,Label_Y_P3,96438,,,90000,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,15,贴标Z轴待机点P1,Label_Z_P1,25,,,44,,,,,,,,, PRO,16,贴标Z轴待机点P1,Label_Z_P1,5,,,90000,,,,,,,,,
PRO,15,贴标Z轴取标点P2,Label_Z_P2,26,,,44,,,,,,,,, PRO,16,贴标Z轴取标前点P2,Label_Z_P2,5,,,90000,,,,,,,,,
PRO,15,贴标Z轴贴标点P3,Label_Z_P3,27,,,44,,,,,,,,, PRO,16,贴标Z轴取标点P3,Label_Z_P3,113000,,,90000,,,,,,,,,
PRO,16,贴标Z轴贴标前点P4,Label_Z_P4,5,,,90000,,,,,,,,,
PRO,16,贴标Z轴贴标点P5,Label_Z_P5,142804,,,90000,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
PRO,16,贴标R轴待机点P1,Label_R_P1,29,,,22,,,,,,,,, PRO,17,贴标R轴待机点P1,Label_R_P1,0,,,700,,,,,,,,,
PRO,16,贴标R轴取标点P2,Label_R_P2,30,,,22,,,,,,,,, PRO,17,贴标R轴取标点P2,Label_R_P2,1715,,,700,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
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,,,,,,,,,,
...@@ -81,6 +86,9 @@ DI,0,出料定位料盘检测,LeftTop_Check,23,HC,X23,,,,,,,,,, ...@@ -81,6 +86,9 @@ DI,0,出料定位料盘检测,LeftTop_Check,23,HC,X23,,,,,,,,,,
DI,0,出料定位料盘超限检测,LeftOverHead_Check,24,HC,X24,,,,,,,,,, DI,0,出料定位料盘超限检测,LeftOverHead_Check,24,HC,X24,,,,,,,,,,
DI,0,吸嘴气缸前进端,LabelCylinder_Fwd,25,HC,X25,,,,,,,,,, DI,0,吸嘴气缸前进端,LabelCylinder_Fwd,25,HC,X25,,,,,,,,,,
DI,0,吸嘴气缸后退端,LabelCylinder_Bck,26,HC,X26,,,,,,,,,, DI,0,吸嘴气缸后退端,LabelCylinder_Bck,26,HC,X26,,,,,,,,,,
DI,0,7寸料盘检测,TraySize_7,27,HC,X27,,,,,,,,,,
DI,0,13寸料盘检测,TraySize_13,28,HC,X28,,,,,,,,,,
DI,0,15寸料盘检测,TraySize_15,29,HC,X29,,,,,,,,,,
,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,
DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y00,,,,,,,,,, DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y00,,,,,,,,,,
DO,0,故障指示灯,Alarm_HddLed,1,HC,Y01,,,,,,,,,, DO,0,故障指示灯,Alarm_HddLed,1,HC,Y01,,,,,,,,,,
......
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
...@@ -78,6 +81,7 @@ ...@@ -78,6 +81,7 @@
<Compile Include="AutoScanAndLabel\MoveStep.cs" /> <Compile Include="AutoScanAndLabel\MoveStep.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _Common.cs" /> <Compile Include="AutoScanAndLabel\MainMachine _Common.cs" />
<Compile Include="AutoScanAndLabel\MainMachine _RightProcess.cs" /> <Compile Include="AutoScanAndLabel\MainMachine _RightProcess.cs" />
<Compile Include="DeviceLibrary\AlarmBuzzer.cs" />
<Compile Include="DeviceLibrary\CodeManager.cs" /> <Compile Include="DeviceLibrary\CodeManager.cs" />
<Compile Include="AutoScanAndLabel\RobotManage.cs" /> <Compile Include="AutoScanAndLabel\RobotManage.cs" />
<Compile Include="AutoScanAndLabel\IRobot.cs" /> <Compile Include="AutoScanAndLabel\IRobot.cs" />
...@@ -122,6 +126,7 @@ ...@@ -122,6 +126,7 @@
<None Include="Config\general.config"> <None Include="Config\general.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class AlarmBuzzer
{
delegate void on();
static on ondelegate;
static on offdelegate;
static bool enable = false;
public static bool Enable { get => enable;set {
enable = value;
if (!value) {
OFF();
}
} }
static AlarmBuzzerState State = AlarmBuzzerState.OFF;
public static event EventHandler<bool> BuzzerStateChange;
public static void SetOnOffAction(Action ona, Action offa) {
ondelegate = new on(ona);
offdelegate = new on(offa);
}
public static void ON(bool force=false) {
if (!Enable)
return;
if (force || (State != AlarmBuzzerState.ON && State != AlarmBuzzerState.MuteOnce))
{
State = AlarmBuzzerState.ON;
ondelegate();
BuzzerStateChange?.Invoke(null, true);
}
}
public static void OFF()
{
State = AlarmBuzzerState.OFF;
offdelegate();
BuzzerStateChange?.Invoke(null, false);
}
public static void MuteOnce()
{
if (State == AlarmBuzzerState.ON)
{
State = AlarmBuzzerState.MuteOnce;
offdelegate();
BuzzerStateChange?.Invoke(null, false);
}
}
}
enum AlarmBuzzerState
{
ON,
OFF,
MuteOnce
}
}
...@@ -54,9 +54,9 @@ namespace DeviceLibrary ...@@ -54,9 +54,9 @@ namespace DeviceLibrary
instance.HomeMove(portName, slvAddr, highVel, lowVel, acc); instance.HomeMove(portName, slvAddr, highVel, lowVel, acc);
} }
public static void SpeedMove(string portName, short slvAddr, int speed) public static void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec)
{ {
instance.SpeedMove(portName, slvAddr, speed); instance.SpeedMove(portName, slvAddr, speed,acc,dec);
} }
public static void SuddenStop(string portName, short slvAddr) public static void SuddenStop(string portName, short slvAddr)
{ {
...@@ -85,6 +85,10 @@ namespace DeviceLibrary ...@@ -85,6 +85,10 @@ namespace DeviceLibrary
{ {
return instance.GetActualtPosition(portName, slvAddr); return instance.GetActualtPosition(portName, slvAddr);
} }
public static int AxisStsINP(string portName, short slvAddr)
{
return instance.AxisStsINP(portName, slvAddr);
}
public static int GetAlarmStatus(string portName, short slvAddr) public static int GetAlarmStatus(string portName, short slvAddr)
{ {
return instance.GetAlarmStatus(portName, slvAddr); return instance.GetAlarmStatus(portName, slvAddr);
......
using System; using OnlineStore.Common;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -30,7 +31,7 @@ namespace DeviceLibrary ...@@ -30,7 +31,7 @@ namespace DeviceLibrary
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(ConfigHelper.Config.Get("ElectricGripperPushForce",40), 4.5f, 15);
clampTimes++; clampTimes++;
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100)); moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
...@@ -38,6 +39,10 @@ namespace DeviceLibrary ...@@ -38,6 +39,10 @@ namespace DeviceLibrary
return true; return true;
} }
else { else {
if (axis.ErrorCode > 0) {
LogUtil.info($"ElectricGripper ErrorCode:{axis.ErrorCode}");
axis.ResetError();
}
return false; return false;
} }
} }
...@@ -46,7 +51,7 @@ namespace DeviceLibrary ...@@ -46,7 +51,7 @@ namespace DeviceLibrary
GripperType = GripperTypeE.Release; GripperType = GripperTypeE.Release;
if (!IsBusy) if (!IsBusy)
{ {
axis.GoHome(); axis.MoveAbsolute(0, 30, 500, 500, 0.1f);
clampTimes = 0; clampTimes = 0;
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100)); moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
...@@ -75,6 +80,8 @@ namespace DeviceLibrary ...@@ -75,6 +80,8 @@ namespace DeviceLibrary
{ {
get get
{ {
LogUtil.info($"ElectricGripper IsReached:{axis.IsReached},IsMoving:{axis.IsMoving}");
//return false;
return !axis.IsReached; return !axis.IsReached;
} }
} }
......
...@@ -97,7 +97,10 @@ namespace DeviceLibrary ...@@ -97,7 +97,10 @@ namespace DeviceLibrary
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr); AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.ServoOn.Equals(1); return axisS.ServoOn.Equals(1);
} }
public int AxisStsINP(string portName, short slvAddr)
{
return HCBoardManager.GetAxisSts(slvAddr).INP;
}
public void ServoOff(string portName, short slvAddr) public void ServoOff(string portName, short slvAddr)
{ {
HCBoardManager.ServoOff(slvAddr); HCBoardManager.ServoOff(slvAddr);
...@@ -108,9 +111,9 @@ namespace DeviceLibrary ...@@ -108,9 +111,9 @@ namespace DeviceLibrary
HCBoardManager.ServoOn(slvAddr); HCBoardManager.ServoOn(slvAddr);
} }
public void SpeedMove(string portName, short slvAddr, int speed) public void SpeedMove(string portName, short slvAddr, int speed,int acc=0, int dec=0)
{ {
HCBoardManager.SpeedMove(slvAddr, speed); HCBoardManager.SpeedMove(slvAddr, speed, acc, dec);
} }
public void SuddenStop(string portName, short slvAddr) public void SuddenStop(string portName, short slvAddr)
{ {
......
using OnlineStore.Common; using HuichuanLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -25,7 +26,7 @@ namespace DeviceLibrary ...@@ -25,7 +26,7 @@ namespace DeviceLibrary
void RelMove(string portName, short slvAddr, int position, int targetSpeed , int ptpAcc , int ptpDec ); void RelMove(string portName, short slvAddr, int position, int targetSpeed , int ptpAcc , int ptpDec );
void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc); void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc);
void SpeedMove(string portName, short slvAddr, int speed); void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec);
void SuddenStop(string portName, short slvAddr); void SuddenStop(string portName, short slvAddr);
bool isInPosition(string portName, short slvAddr, int PPosition, int canErrorCount, bool isLog = false); bool isInPosition(string portName, short slvAddr, int PPosition, int canErrorCount, bool isLog = false);
...@@ -52,6 +53,7 @@ namespace DeviceLibrary ...@@ -52,6 +53,7 @@ namespace DeviceLibrary
/// </summary> /// </summary>
int GetLimitPositiveSingle(string portName, short slvAddr); int GetLimitPositiveSingle(string portName, short slvAddr);
int AxisStsINP(string portName, short slvAddr);
short GetErrorCode(string portName, short slvAddr); short GetErrorCode(string portName, short slvAddr);
} }
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>
\ No newline at end of file \ No newline at end of file
...@@ -115,8 +115,17 @@ namespace DeviceLibrary ...@@ -115,8 +115,17 @@ namespace DeviceLibrary
return; return;
} }
int speed = FormUtil.GetIntValue(txtASpeed); int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info(boxBean.Name+"点击【匀速运动】,【" + PortName + "_" + SlvAddr + "】 速度【" + speed + "】"); //LogUtil.info(boxBean.Name+"点击【匀速运动】,【" + PortName + "_" + SlvAddr + "】 速度【" + speed + "】");
AxisManager.SpeedMove(PortName, SlvAddr, speed); //AxisManager.SpeedMove(PortName, SlvAddr, speed,acc,dec);
foreach (ConfigMoveAxis a in axisList)
{
if (a.IsSameAxis(PortName, SlvAddr))
{
LogUtil.info(boxBean.Name + "点击【匀速运动】,【" + PortName + "_" + SlvAddr + "】 速度【" + speed + "】" + $",AddSpeed:{a.AddSpeed}, DelSpeed:{a.DelSpeed}");
AxisManager.SpeedMove(PortName, SlvAddr, speed, a.AddSpeed, a.DelSpeed);
}
}
} }
private void btnAxisStop_Click(object sender, EventArgs e) private void btnAxisStop_Click(object sender, EventArgs e)
...@@ -241,8 +250,16 @@ namespace DeviceLibrary ...@@ -241,8 +250,16 @@ namespace DeviceLibrary
} }
private void AxisMove(int speed) private void AxisMove(int speed)
{ {
LogUtil.info(boxBean.Name+"【" + PortName + "_" + SlvAddr + "】点动: 速度:" + speed);
AxisManager.SpeedMove(PortName, SlvAddr, speed); foreach (ConfigMoveAxis a in axisList)
{
if (a.IsSameAxis(PortName, SlvAddr))
{
//LogUtil.info(boxBean.Name + "点击【原点返回】,【" + PortName + "_" + SlvAddr + "】 速度【" + a.HomeHighSpeed + "】");
LogUtil.info(boxBean.Name + "【" + PortName + "_" + SlvAddr + "】点动: 速度:" + speed + $",AddSpeed:{a.AddSpeed}, DelSpeed:{a.DelSpeed}");
AxisManager.SpeedMove(PortName, SlvAddr, speed, a.AddSpeed, a.DelSpeed);
}
}
} }
private void btnAddMove_MouseDown(object sender, MouseEventArgs e) private void btnAddMove_MouseDown(object sender, MouseEventArgs e)
{ {
......
...@@ -82,10 +82,10 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -82,10 +82,10 @@ namespace OnlineStore.LoadCSVLibrary
[CSVAttribute("加速时间")] [CSVAttribute("加速时间")]
public short AddSpeed { get; set; } public int AddSpeed { get; set; }
[CSVAttribute("减速时间")] [CSVAttribute("减速时间")]
public short DelSpeed { get; set; } public int DelSpeed { get; set; }
[CSVAttribute("原点低速度")] [CSVAttribute("原点低速度")]
public int HomeLowSpeed { get; set; } public int HomeLowSpeed { get; set; }
......
...@@ -136,6 +136,21 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -136,6 +136,21 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
public static string LabelCylinder_Bck = "LabelCylinder_Bck"; public static string LabelCylinder_Bck = "LabelCylinder_Bck";
/// <summary> /// <summary>
/// DI,0,7寸料盘检测,TraySize_7,27,HC,X27,,,,,,,,,,
/// </summary>
public static string TraySize_7 = "TraySize_7";
/// <summary>
/// DI,0,13寸料盘检测,TraySize_13,28,HC,X28,,,,,,,,,,
/// </summary>
public static string TraySize_13 = "TraySize_13";
/// <summary>
/// DI,0,15寸料盘检测,TraySize_15,29,HC,X29,,,,,,,,,,
/// </summary>
public static string TraySize_15 = "TraySize_15";
/// <summary>
/// DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y00,,,,,,,,,, /// DO,0,自动指示灯,AutoRun_HddLed,0,HC,Y00,,,,,,,,,,
/// </summary> /// </summary>
public static string AutoRun_HddLed = "AutoRun_HddLed"; public static string AutoRun_HddLed = "AutoRun_HddLed";
......
...@@ -95,6 +95,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -95,6 +95,11 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_R_Angle_Diff")] [ConfigProAttribute("Label_R_Angle_Diff")]
public int Label_R_Angle_Diff { get; set; } public int Label_R_Angle_Diff { get; set; }
/// <summary> /// <summary>
/// PRO,30,贴标R轴偏置距离像素,Label_R_Offset,0,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_R_Offset")]
public int Label_R_Offset { get; set; }
/// <summary>
/// PRO,20,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,, /// PRO,20,贴标R轴360度脉冲,Label_R_360,9,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_R_360")] [ConfigProAttribute("Label_R_360")]
...@@ -237,16 +242,26 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -237,16 +242,26 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Label_Z_P1")] [ConfigProAttribute("Label_Z_P1")]
public int Label_Z_P1 { get; set; } public int Label_Z_P1 { get; set; }
/// <summary> /// <summary>
/// PRO,0,贴标Z轴取标点P2,Label_Z_P2,26,,,,,,,,,,,, /// PRO,0,贴标Z轴取标点P2,Label_Z_P2,26,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_Z_P2")] [ConfigProAttribute("Label_Z_P2")]
public int Label_Z_P2 { get; set; } public int Label_Z_P2 { get; set; }
/// <summary> /// <summary>
/// PRO,0,贴标Z轴标点P3,Label_Z_P3,27,,,,,,,,,,,, /// PRO,0,贴标Z轴标点P3,Label_Z_P3,27,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_Z_P3")] [ConfigProAttribute("Label_Z_P3")]
public int Label_Z_P3 { get; set; } public int Label_Z_P3 { get; set; }
/// <summary> /// <summary>
/// PRO,0,贴标Z轴贴标前点P4,Label_Z_P4,27,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P4")]
public int Label_Z_P4 { get; set; }
/// <summary>
/// PRO,0,贴标Z轴贴标点P5,Label_Z_P5,27,,,,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P5")]
public int Label_Z_P5 { get; set; }
/// <summary>
/// PRO,0,贴标R轴待机点P1,Label_R_P1,29,,,,,,,,,,,, /// PRO,0,贴标R轴待机点P1,Label_R_P1,29,,,,,,,,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("Label_R_P1")] [ConfigProAttribute("Label_R_P1")]
...@@ -371,12 +386,37 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -371,12 +386,37 @@ 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,贴标Z轴贴标前点P4,Label_Z_P4,27,,,90000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P4_speed")]
public int Label_Z_P4_speed { get; set; }
/// <summary>
/// PRO,16,贴标Z轴贴标点P5,Label_Z_P5,27,,,90000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Z_P5_speed")]
public int Label_Z_P5_speed { get; set; }
/// <summary>
/// PRO,14,贴标X轴贴标基准点P3,Label_X_P3,18,,,90000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P3")]
public int Label_X_P3 { get; set; }
/// <summary>
/// PRO,15,贴标Y轴贴标基准点P3,Label_Y_P3,22,,,90000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P3")]
public int Label_Y_P3 { get; set; }
/// <summary>
/// PRO,14,贴标X轴贴标基准点P3,Label_X_P3,18,,,90000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_X_P3_speed")]
public int Label_X_P3_speed { get; set; }
/// <summary>
/// PRO,15,贴标Y轴贴标基准点P3,Label_Y_P3,22,,,90000,,,,,,,,,
/// </summary>
[ConfigProAttribute("Label_Y_P3_speed")]
public int Label_Y_P3_speed { get; set; }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!