V1.0 在用版本

This commit is contained in:
CPL 2024-03-07 14:03:22 +08:00
commit 51c051fde1
872 changed files with 3217500 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>GeBoShi</RootNamespace>
<AssemblyName>GeBoShi</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.cs">
<DependentUpon>Main.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

47
LeatherProject/GeBoShi/Main.Designer.cs generated Normal file
View File

@ -0,0 +1,47 @@
namespace GeBoShi
{
partial class Main
{
/// <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 Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(978, 602);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GeBoShi
{
public partial class Main : Form
{
public Main()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GeBoShi
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Thread.Sleep(500);
Process instance = RunningInstance();
if (instance == null)
{
Application.ThreadException += Application_ThreadException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
else
{
MessageBox.Show("当前程序已经运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0);
}
}
//不允许有两个程序同时启动
public static Process RunningInstance()
{
Process current = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(current.ProcessName);
//遍历正在有相同名字运行的例程
foreach (Process process in processes)
{
//忽略现有的例程
if (process.Id != current.Id)
{
//确保例程从EXE文件运行
if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") ==
current.MainModule.FileName)
{
//返回另一个例程实例
return process;
}
}
}
//没有其它的例程返回Null
return null;
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Exception ex = e.Exception;
using (StreamWriter sw = new StreamWriter(Directory.GetCurrentDirectory() + "\\ErrorLog.txt", true))
{
sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
sw.WriteLine("Global捕获到未处理异常" + ex.GetType().ToString());
sw.WriteLine("异常信息:" + ex.Message);
sw.WriteLine("异常堆栈:" + ex.StackTrace);
sw.WriteLine();
}
MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息{1}\r\n异常堆栈{2}", ex.GetType(), ex.Message, ex.StackTrace));
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("GeBoShi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GeBoShi")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("fdb83436-dad7-4dc3-ae23-a249cba74b68")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace GeBoShi.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GeBoShi.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GeBoShi.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

View File

@ -0,0 +1,71 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeatherApp", "LeatherApp\LeatherApp.csproj", "{456EED9B-2908-45A3-BA59-22FCC12DB782}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GETestApp", "GETestApp\GETestApp.csproj", "{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "Models\Models.csproj", "{47694C39-2448-4BE5-80A4-70D78B59272B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "Service\Service.csproj", "{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeBoShi", "GeBoShi\GeBoShi.csproj", "{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Debug|Any CPU.Build.0 = Debug|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Debug|x64.ActiveCfg = Debug|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Debug|x64.Build.0 = Debug|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Release|Any CPU.ActiveCfg = Release|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Release|Any CPU.Build.0 = Release|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Release|x64.ActiveCfg = Release|Any CPU
{456EED9B-2908-45A3-BA59-22FCC12DB782}.Release|x64.Build.0 = Release|Any CPU
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Debug|x64.ActiveCfg = Debug|x64
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Debug|x64.Build.0 = Debug|x64
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Release|Any CPU.Build.0 = Release|Any CPU
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Release|x64.ActiveCfg = Release|x64
{FCDFDE64-DFE2-4A36-BA32-9D2F7C198AEA}.Release|x64.Build.0 = Release|x64
{47694C39-2448-4BE5-80A4-70D78B59272B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Debug|x64.ActiveCfg = Debug|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Debug|x64.Build.0 = Debug|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Release|Any CPU.Build.0 = Release|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Release|x64.ActiveCfg = Release|Any CPU
{47694C39-2448-4BE5-80A4-70D78B59272B}.Release|x64.Build.0 = Release|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Debug|x64.ActiveCfg = Debug|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Debug|x64.Build.0 = Debug|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Release|Any CPU.Build.0 = Release|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Release|x64.ActiveCfg = Release|Any CPU
{1CCED98A-7AF6-47F3-B9F9-A9E7DAD461B4}.Release|x64.Build.0 = Release|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Debug|x64.ActiveCfg = Debug|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Debug|x64.Build.0 = Debug|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Release|Any CPU.Build.0 = Release|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Release|x64.ActiveCfg = Release|Any CPU
{FDB83436-DAD7-4DC3-AE23-A249CBA74B68}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4809A0B1-F4FD-4DFE-9AF1-2C8FF64C2382}
EndGlobalSection
EndGlobal

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,346 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Runtime.InteropServices;
namespace LeatherApp
{
public class API
{
[StructLayout(LayoutKind.Sequential)]
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;//lpData大小
public IntPtr lpData;
}
public const int WM_COPYDATA = 0x004A;
public const int WM_CLOSE = 0x10;
//定义常数用作函数StretechBlt中正常色彩复制的光栅操作码
public const int Srccopy = 0xCC0020;
//'定义常数用作函数StretechBlt中反色复制的光栅操作码
public const int NotSrccopy = 0x330008;
//定义常数用作函数SetWindowPos中使窗口位于所有窗口最上面一层避免被其它窗口遮挡
public const int HWND_TOPMOST = -1;
public const int SWP_NOMOVE = 2;
public const int SWP_NOSIZE = 1;
public const int SWP_NOACTIVATE = 0x10;
public const int HWND_TOP = 0;
public const int HWND_NOTOPMOST = -2;
//SetStretchBltMode模式
public const int STRETCH_ANDSCANS = 1;
public const int STRETCH_DELETESCANS = 3;
public const int STRETCH_ORSCANS = 2;
public const int STRETCH_HALFTONE = 4;
//
[DllImport("User32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
public const int WS_SHOWNORMAL = 1;
[DllImport("shell32.dll")]
public static extern int ShellExecute(IntPtr hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
[DllImport("user32.dll")]
public static extern IntPtr GetActiveWindow();
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
public static extern bool IsWindow(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern int GetClassName(IntPtr hwnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.dll")]
public static extern int DrawText(IntPtr hdc, string lpStr, int nCount, RECT lpRect, int wFormat);
public const int DT_CENTER = 0x1;
public const int DT_BOTTOM = 0x8;
public const int DT_SINGLELINE = 0x20;
public const int GWL_STYLE = -16;
public const UInt32 WS_MINIMIZEBOX = 0x20000;
public const UInt32 WS_MAXIMIZEBOX = 0x10000;
public const UInt32 WS_SYSMENU = 0x80000;
public const UInt32 WS_CAPTION = 0xC00000;
public const int GWL_EXSTYLE = -20;
public const int LWA_COLORKEY = 1;
public const int LWA_ALPHA = 2;
public const int WS_EX_LAYERED = 0x80000;
[DllImport("user32.dll")]
public static extern UInt32 GetWindowLong(IntPtr hwnd, int nIndex);
[DllImport("user32.dll")]
public static extern UInt32 SetWindowLong(IntPtr hwnd, int nIndex, UInt32 dwNewLong);
[DllImport("user32.dll")]
public static extern UInt32 SetLayeredWindowAttributes(IntPtr hwnd, int cKey, int bAlpha, int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DeleteFile(string lpFileName);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CopyFile(string lpExistingFileName, string lpNewFileName, bool bFailIfExists);
//窗体拖动
public const UInt32 WM_SYSCOMMAND = 0x112;
public const UInt32 SC_MOVE = 0xF010;
public const UInt32 HTCAPTION = 0x2;
[DllImport("user32.dll")]
public static extern UInt32 ReleaseCapture();
[DllImport("user32.dll")]
public static extern UInt32 SendMessage(IntPtr hWnd, UInt32 wMsg, UInt32 wParam, IntPtr lParam);
[DllImport("user32.dll")]//函数声明,用于将窗口置于最上方
public static extern int SetWindowPos(IntPtr hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
[DllImport("user32.dll")]//函数声明,用于获得整个屏幕的窗口句柄,以作为绘制的源
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]//函数声明,用于用于获得指定窗口一个设备环境。
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("gdi32.dll")]//
public static extern int SetStretchBltMode(IntPtr hdc, int nStretchMode);
[DllImport("gdi32.dll")]//函数声明,用于将屏幕任意位置的一个矩形位置复制到另一个位置并实现镜像翻转
public static extern int StretchBlt(IntPtr hdc, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, int dwRop);
[DllImport("user32.dll")]//函数声明,释放窗口的设备环境
public static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
//最前显示4个
[DllImport("user32.dll")]
public static extern int SetActiveWindow(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern int SetForegroundWindow(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern int SetFocus(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern int BringWindowToTop(IntPtr hwnd);
//
[DllImport("user32.dll")]
public static extern IntPtr LoadCursorFromFile(string lpFileName);
[DllImport("user32.dll")]
public static extern IntPtr SetCursor(IntPtr cursorHandle);
[DllImport("user32.dll")]
public static extern uint DestroyCursor(IntPtr cursorHandle);
public struct POINTAPI
{
public int x;
public int y;
}
[DllImport("user32.dll")]
public static extern int SetCursorPos(int x, int y);
[DllImport("user32.dll")]
public static extern int GetCursorPos(ref POINTAPI lpPoint);
[DllImport("user32.dll")]
public static extern IntPtr GetCursor();
public struct ICONINFO
{
public bool fIcon; // Specifies whether this structure defines an icon or a cursor. A value of TRUE specifies
public Int32 xHotspot; // Specifies the x-coordinate of a cursor's hot spot. If this structure defines an icon, the hot
public Int32 yHotspot; // Specifies the y-coordinate of the cursor's hot spot. If this structure defines an icon, the hot
public IntPtr hbmMask; // (HBITMAP) Specifies the icon bitmask bitmap. If this structure defines a black and white icon,
public IntPtr hbmColor; // (HBITMAP) Handle to the icon color bitmap. This member can be optional if this
}
public struct CURSORINFO
{
public Int32 cbSize;
public Int32 flags;
public Int32 hCursor;
public POINTAPI ptScreenPos;
}
[DllImport("user32.dll", EntryPoint = "GetIconInfo")]
public static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo);
[DllImport("user32.dll")]
public static extern bool GetCursorInfo(out CURSORINFO pci);
[DllImport("user32.dll")]
public static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon);
public const int DI_MASK = 0x0001;
public const int DI_IMAGE = 0x0002;
public const int DI_NORMAL = 0x0003;
public const int DI_COMPAT = 0x0004;
public const int DI_DEFAULTSIZE = 0x0008;
[DllImport("user32.dll")]
public static extern int DrawIconEx(IntPtr hdc, int xLeft, int yTop, IntPtr hIcon, int cxWidth, int cyWidth, int istepIfAniCur, int hbrFlickerFreeDraw, int diFlags);
[DllImport("gdi32.dll")]
public static extern int DeleteObject(IntPtr hObject);
[DllImport("user32.dll")]
public static extern IntPtr WindowFromPoint(int xPoint, int yPoint);
[DllImport("user32.dll")]
public static extern IntPtr GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);
[DllImport("kernel32.dll")]
public static extern IntPtr GetCurrentThreadId();
[DllImport("user32.dll")]
public static extern int AttachThreadInput(IntPtr idAttach, IntPtr idAttachTo, bool fAttach);
[DllImport("user32.dll")]
public static extern int MoveWindow(IntPtr hwnd, int x, int y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
public static extern bool IsZoomed(IntPtr hwnd);//判断窗口是否为最大化
[DllImport("user32.dll")]
public static extern bool IsIconic(IntPtr hwnd);//判断窗口是否为最小化
//控制播放器
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("kernel32.dll")]
public static extern void Sleep(int i);
[DllImport("User32.dll", EntryPoint = "PostMessage")]
public static extern int PostMessage(
IntPtr hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
int lParam // second message parameter
);
public const int WM_USER = 0x0400;
public const int WMU_WLQ = WM_USER + 88;
public const int PARA_PLAY = 0x1;
public const int PARA_STOP = 0x2;
public const int PARA_FULL = 0x4;
public const int PARA_MIN = 0x8;
public const int PARA_MAX = 0x10;
public const int PARA_MOVEL = 0x20;
public const int PARA_MOVER = 0x40;
//
//播放器消息命令:
public const int PLAYER_PLAY = WM_USER + 0x0001;//播放
public const int PLAYER_BREAK = WM_USER + 0x0002;//暂停
public const int PLAYER_FULL = WM_USER + 0x0004;//全屏
public const int PLAYER_NOFULL = WM_USER + 0x0008;//退出全屏
public const int PLAYER_STOP = WM_USER + 0x0010;//停止
public const int PLAYER_EXIT = WM_USER + 0x0020;//退出
public const int PLAYER_SHOW = WM_USER + 0x0040;//显示窗体
public const int PLAYER_HIDE = WM_USER + 0x0080;//隐藏窗体
public const int PLAYER_PLAY_FULL = WM_USER + 0x0021;//播放并全屏
public const int PLAYER_BREAK_HIDE = WM_USER + 0x0022;//暂停并隐藏
//
public const int SW_HIDE = 0;
public const int SW_SHOWNORMAL = 1;
public const int SW_NORMAL = 1;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMAXIMIZED = 3;
public const int SW_MAXIMIZE = 3;
public const int SW_SHOWNOACTIVATE = 4;
public const int SW_SHOW = 5;
public const int SW_MINIMIZE = 6;
public const int SW_SHOWMINNOACTIVE = 7;
public const int SW_SHOWNA = 8;
public const int SW_RESTORE = 9;
public const int SW_SHOWDEFAULT = 10;
public const int SW_FORCEMINIMIZE = 11;
public const int SW_MAX = 11;
//自定义消息
public const int WM_MOVENEXT = WM_USER + 5;//dsd纸用、电信最初屏幕上签名版本[to副屏]
public const int WM_MOVEFIRST = WM_USER + 6;//dsd纸用、电信最初屏幕上签名版本[to主屏]
public const int WM_MOVENEXT1 = WM_USER + 7;//电信最新[切屏]到副屏
public const int WM_MOVEFIRST1 = WM_USER + 8;//电信最新[签名完成]到主屏
public const int WM_ShowSignWin = WM_USER + 10;//电信最新[打印小票]弹出半透明窗口(扩展屏)
public const int WM_HideSignWin = WM_USER + 11;//电信最新[半透明窗口左上角对号图片按钮](扩展屏)
public const int WM_ShowSignWin2 = WM_USER + 12;//电信最新[打印小票]弹出半透明窗口(主屏)
public const int WM_HideSignWin2 = WM_USER + 13;//电信最新[半透明窗口左上角对号图片按钮](主屏)
public const int WM_LookPrimaryScreen = WM_USER + 20;//电信最新[副屏监视主屏]
public const int WM_UnLookPrimaryScreen = WM_USER + 21;//电信最新[取消副屏监视主屏]
//声明读写INI文件的API函数
[DllImport("kernel32")]
public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
//
public const UInt32 MF_BYPOSITION = 0x400;
public const UInt32 MF_BYCOMMAND = 0x0;
public const UInt32 SC_CLOSE = 0xF060;
public const UInt32 SC_MAXIMIZE = 0xF030;
public const UInt32 SC_MINIMIZE = 0xF020;
public const UInt32 WS_EX_APPWINDOW = 0x40000;
[DllImport("user32.dll")]
public static extern IntPtr GetSystemMenu(IntPtr hwnd, bool bRevert);
[DllImport("user32.dll")]
public static extern int RemoveMenu(IntPtr hMenu, UInt32 nPosition, UInt32 wFlags);
[DllImport("user32.dll")]
public static extern int ModifyMenu(IntPtr hMenu, int nPosition, int wFlags, int wIDNewItem, int lpString);
[DllImport("user32.dll")]
public static extern UInt32 SetWindowText(IntPtr hwnd, string lpString);
public struct RECT
{
public RECT(int _left, int _top, int _right, int _bottom)
{
Left = _left;
Top = _top;
Right = _right;
Bottom = _bottom;
}
public int Left;
public int Top;
public int Right;
public int Bottom;
}
[DllImport("user32.dll")]
public static extern int GetWindowRect(IntPtr hwnd, out API.RECT lpRect);
[DllImport("user32.dll")]
public static extern int ClipCursor(RECT lpRect);
public const int WM_KEYDOWN = 0x100;
public const int WM_KEYUP = 0x101;
//HOT KEY
[DllImport("kernel32.dll")]
public static extern uint GlobalAddAtom(string lpHotKeyName);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool RegisterHotKey(
IntPtr hWnd, //要定义热键的窗口的句柄
uint id, //定义热键ID不能与其它ID重复
KeyModifiers fsModifiers, //标识热键是否在按Alt、Ctrl、Shift、Windows等键时才会生效
System.Windows.Forms.Keys vk //定义热键的内容
);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool UnregisterHotKey(
IntPtr hWnd, //要取消热键的窗口的句柄
uint id //要取消热键的ID
);
//定义了辅助键的名称(将数字转变为字符以便于记忆,也可去除此枚举而直接使用数值)
[Flags()]
public enum KeyModifiers
{
None = 0,
Alt = 1,
Ctrl = 2,
Shift = 4,
WindowsKey = 8
}
//====================
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
//标题栏厚度
public const int SM_CYCAPTION = 4;
//边框宽度
public const int SM_CYBORDER = 6;
[DllImport("user32.dll", SetLastError = true)]
public static extern int GetSystemMetrics(int nIndex);
[DllImport("kernel32.dll")]
public static extern void OutputDebugString(string lpOutputString);
}
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.31.0" newVersion="8.0.31.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,229 @@
using LeatherApp.Utils;
using Newtonsoft.Json.Linq;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace LeatherApp
{
public class Config
{
public static string appBasePath;
public static Models.User loginUser;
//对应文件DefectItemList.json
public static JArray defectItemList;
//
public static JArray colorNameList;//, materialNameList;
//CMDProcess目录下的命令JSON文件
public static Dictionary<CMDName, JObject> CMDProcess;
//剩余N米提示(M)
public static int residueWarnningLen = 10;
//瑕疵暂停跳过几张图
public static int defectPauseSkipPhotoCount=5;
//DB
//有些服务器防火墙有问题需要加上 min pool size=1 避免认为是恶意请求
//如果用到bulkCopy需要加 AllowLoadLocalInfile=true
//public static string dbMysqlCon = "server=localhost;Database=ProductionDB;Uid=root;Pwd=123456;";
public static string DBConStr = "server=localhost;Database=LeatherDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true";
public static string ErpDBConStr = "server=localhost;Database=LeatherDB;Uid=root;Pwd=123456; AllowLoadLocalInfile=true";
public static string ErpSql = "select top 1 a,b,c from tableA where code=@code order by id desc";
//LOG
public static string LogPath;
//DEV
public static bool StopCodeScanner = false;
public static bool StopIO = false;
public static bool StopPLC=true;
public static bool StopLight = true;
public static string PlcIPAdrees;
public static short PlcRackN=0, PlcSolt=1;
public static string Carmer1ConfigFilePath,Carmer2ConfigFilePath;
public static string IOCard_DeviceNum = "PCI-1730,BID#0";
public static bool ScannerReversalX = false;
public static bool ScannerReversalY = false;
public static string Light_PortName;//COM端口号
public static LightDevNameEnum Light_Name = LightDevNameEnum.;
public static CamerDevNameEnum Camer_Name = CamerDevNameEnum.;
//LIB
public static string model_path = "";//./models/best_0805_bs8.onnx
//public static string labels_path = "./models/hexin.names";
public static int cm2px_x = 1;
public static int cm2px_y = 1;
//边缘孔洞宽(门幅计算包含,识别库去除)
public static int MarginHoleWidth = 120, MiddleSuperposition;
public static int expand_pixel=50;
public static string ImagePath;
public static bool IsSaveAllImage, IsSaveDefectSourceImage, IsSaveDefectCutImage;
//材质Material
public static string[] SuedeList = new string[0];
public static void LoadAllConfig()
{
if (string.IsNullOrWhiteSpace(appBasePath))
appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
LoadDefectItemList();
LoadColorNameList();
//LoadMaterialNameList();
//----
string lsCmdPath = appBasePath + "\\CMDProcess\\";
if (!Directory.Exists(lsCmdPath))
Directory.CreateDirectory(lsCmdPath);
string fileName;
CMDProcess = new Dictionary<CMDName, JObject>();
foreach (int item in Enum.GetValues(typeof(CMDName)))//item为key值
{
//string name = Enum.GetName(typeof(CMDName), item);//获取名称
fileName = lsCmdPath + item + ".json";
if (File.Exists(fileName))
CMDProcess.Add((CMDName)item, JObject.Parse(File.ReadAllText(fileName)));
//else
// CMDProcess.Add((CMDName)item, null);
}
// ----
IniFile ini = new IniFile(appBasePath + "\\SysConfig.ini");
//[DB]
DBConStr = ini.ReadString("DB", "DBConStr", "");
//[Erp]
ErpDBConStr = ini.ReadString("ErpDB", "ErpDBConStr", "");
ErpSql = ini.ReadString("ErpDB", "ErpSql", "");
//[LOG]
LogPath = ini.ReadString("LOG", "LogPath", "");
//[CONTROL]
defectPauseSkipPhotoCount = ini.ReadInt("CONTROL", "DefectPauseSkipPhotoCount", 0);
//[DEV]
StopCodeScanner = ini.ReadBool("DEV", "StopCodeScanner", false);
StopIO = ini.ReadBool("DEV", "StopIO", false);
StopPLC = ini.ReadBool("DEV", "StopPLC", false);
PlcIPAdrees = ini.ReadString("DEV", "PlcIPAdrees", "");
PlcRackN = ini.ReadShort("DEV", "PlcRackN", PlcRackN);
PlcSolt = ini.ReadShort("DEV", "PlcSolt", PlcSolt);
StopLight = ini.ReadBool("DEV", "StopLight", false);
Carmer1ConfigFilePath = ini.ReadString("DEV", "Carmer1ConfigFilePath", "");
Carmer2ConfigFilePath = ini.ReadString("DEV", "Carmer2ConfigFilePath", "");
IOCard_DeviceNum = ini.ReadString("DEV", "IOCard_DeviceNum", "");
Light_Name = (LightDevNameEnum)ini.ReadInt("DEV", "Light_Name");
Light_PortName = ini.ReadString("DEV", "Light_PortName", "");
Camer_Name = (CamerDevNameEnum)ini.ReadInt("DEV", "Camer_Name");
ScannerReversalX = ini.ReadBool("DEV", "ScannerReversalX", false);
ScannerReversalY = ini.ReadBool("DEV", "ScannerReversalY", false);
//[LIB]
model_path = ini.ReadString("LIB", "model_path", "");
//labels_path = ini.ReadString("LIB", "labels_path", "");
cm2px_x = ini.ReadInt("LIB", "cm2px_x", 1);
cm2px_y = ini.ReadInt("LIB", "cm2px_y", 1);
MarginHoleWidth = ini.ReadInt("LIB", "MarginHoleWidth", 0);
MiddleSuperposition = ini.ReadInt("LIB", "MiddleSuperposition", 0);
expand_pixel=ini.ReadInt("LIB", "expand_pixel", 50);
ImagePath = ini.ReadString("LIB", "ImagePath", "");
IsSaveAllImage = ini.ReadBool("LIB", "IsSaveAllImage", false);
IsSaveDefectSourceImage = ini.ReadBool("LIB", "IsSaveDefectSourceImage", false);
IsSaveDefectCutImage = ini.ReadBool("LIB", "IsSaveDefectCutImage", false);
//
string lsTmp = ini.ReadString("Material", "SuedeList", "").Trim();
if(!string.IsNullOrWhiteSpace(lsTmp))
SuedeList=lsTmp.Split(new char[] { ',',';'});
}
#region defectItemList <=> DefectItemList.json
public static void LoadDefectItemList()
{
if (string.IsNullOrWhiteSpace(appBasePath))
appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string configPath = appBasePath + "\\DefectItemList.json";
string lsTmp = File.ReadAllText(configPath);
defectItemList = JArray.Parse(lsTmp);
}
public static void SaveDefectItemList(JArray newValue)
{
if (string.IsNullOrWhiteSpace(appBasePath))
appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string configPath = appBasePath + "\\DefectItemList.json";
File.WriteAllText(configPath, newValue.ToString());
}
public static JObject getDefectItem(string code)
{
var item=Config.defectItemList.FirstOrDefault(m => m.Value<string>("code")==code);
if(item==null)
return null;
return (JObject)item;
}
public static JObject getDefectItem(int id)
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<int>("id") == id);
if (item == null)
return null;
return (JObject)item;
}
public static string getDefectCode(int id)
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<int>("id") == id);
if (item == null)
return "";
return ((JObject)item).Value<string>("code");
}
public static string getDefectName(string code)
{
var item = Config.defectItemList.FirstOrDefault(m => m.Value<string>("code") == code);
if (item == null)
return "";
return ((JObject)item).Value<string>("name");
}
#endregion
#region colorNameList <=> ColorNameList.json
public static void LoadColorNameList()
{
if (string.IsNullOrWhiteSpace(appBasePath))
appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string configPath = appBasePath + "\\ColorNameList.json";
string lsTmp = File.ReadAllText(configPath);
colorNameList = JArray.Parse(lsTmp);
}
public static JObject getColorItem(int code)
{
var item = Config.colorNameList.FirstOrDefault(m => m.Value<int>("code") == code);
if (item == null)
return null;
return (JObject)item;
}
//public static void LoadMaterialNameList()
//{
// if (string.IsNullOrWhiteSpace(appBasePath))
// appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
// string configPath = appBasePath + "\\MaterialName.json";
// string lsTmp = File.ReadAllText(configPath);
// materialNameList = JArray.Parse(lsTmp);
//}
//public static JObject getMaterialItem(string code)
//{
// var item = Config.materialNameList.FirstOrDefault(m => m.Value<string>("code") == code);
// if (item == null)
// return null;
// return (JObject)item;
//}
#endregion
}
}

View File

@ -0,0 +1,191 @@
using LeatherApp.Device;
using LeatherApp.Interface;
using Newtonsoft.Json.Linq;
using S7.Net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp
{
public class DevContainer
{
public PLCDev devPlc;
public PhotoLib libPhoto;
public ScannerCodeDev devCodeScanner;//= new CodeScannerDev();
public IOCardDev devIOCard;//=new IOCardDev();
public LightDev devLight;//=new LightDev();
public ABSCamerCardDev devCamer1;
public ABSCamerCardDev devCamer2;
public DefectLib libDefect;//=new DefectLib();
public Action<DateTime,WarningEnum, string> WarningEvent;
public Action<bool, string> StateChange;
public Action<string, string> OutDebugEvent;
public bool state = false;
private Thread t;
private PictureBox preView1, preView2;
public void start(PictureBox view1, PictureBox view2)
{
this.preView1 = view1;
this.preView2 = view2;
//devCodeScanner = new ScannerCodeDev();
//devCodeScanner.WarningEvent = WarningEvent;
//if (!devCodeScanner.start()) throw new Exception("扫码器初始化失败!");
t = new System.Threading.Thread(run);
t.IsBackground = true;
t.Start();
}
public void stop()
{
try
{
state = false;
try { devIOCard.stop(); } catch { }
try { devPlc.stop(); } catch { }
try { devLight.stop(); } catch { }
try { devCamer1.stop(); devCamer1.close(); } catch { }
try { devCamer2.stop(); devCamer2.close(); } catch { }
try { devCodeScanner.stop(); } catch { }
try { libDefect.stop(); } catch { }
try { libPhoto.stop(); } catch { }
}
catch { }
}
private void run()
{
try
{
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.Normal, "初始化设备...",null,null);
devCodeScanner = new ScannerCodeDev();
devCodeScanner.WarningEvent = WarningEvent;
if (!Config.StopCodeScanner)
devCodeScanner.start();
devPlc = new PLCDev();
devPlc.WarningEvent = WarningEvent;
libPhoto = new PhotoLib();
libPhoto.WarningEvent = WarningEvent;
libDefect = new DefectLib();
libDefect.WarningEvent = WarningEvent;
devIOCard = new IOCardDev();
devIOCard.WarningEvent = WarningEvent;
devLight = new LightDev(Config.Light_Name);
devLight.WarningEvent = WarningEvent;
if (Config.Camer_Name == CamerDevNameEnum.)
{
devCamer2 = new CamerCardDev();
devCamer1 = new CamerCardDev();
}
else
{
devCamer1 = new CamerCardDevIK();
devCamer2 = new CamerCardDevIK();
}
devCamer1.WarningEvent = WarningEvent;
devCamer2.WarningEvent = WarningEvent;
//启动
string appBasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "1");
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "打开设备...");
if (!Config.StopIO && !devIOCard.start(Config.IOCard_DeviceNum)) throw new Exception("I/O板卡初始化失败");
if (!Config.StopPLC && !devPlc.start(CpuType.S71200, Config.PlcIPAdrees, Config.PlcRackN, Config.PlcSolt)) throw new Exception("Plc连接失败");
if (!Config.StopLight && !devLight.start(int.Parse(Config.Light_PortName.Substring(3)))) throw new Exception("光源设备初始化失败!");
if (!libPhoto.start()) throw new Exception("图像库初始化失败!");
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "2");
if (!libDefect.start()) throw new Exception("缺陷库初始化失败!");
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "3");
if (!File.Exists(appBasePath+ "\\DevCfg\\" + Config.Carmer1ConfigFilePath) || !File.Exists(appBasePath + "\\DevCfg\\" + Config.Carmer2ConfigFilePath))
throw new Exception($"相机配置文件不存在({Config.Carmer1ConfigFilePath}或{Config.Carmer2ConfigFilePath})");
string scanner1Path = appBasePath + "\\temp\\";
if (!Directory.Exists(scanner1Path + "scanner\\")) Directory.CreateDirectory(scanner1Path + "scanner\\");
if (!devCamer2.open(1, 0)) throw new Exception("相机初始化失败!");
if (!devCamer2.start(this.preView1, scanner1Path + "scanner\\")) throw new Exception("相机1打开失败");
if (!devCamer1.open(0, 0)) throw new Exception("相机初始化失败!");
if (!devCamer1.start(this.preView2, scanner1Path + "scanner\\")) throw new Exception("相机0打开失败");
//
state = true;
StateChange?.Invoke(true, "成功");
}
catch (Exception ex)
{
stop();
StateChange?.Invoke(false, ex.Message);
}
}
/// <summary>
/// I/O指令输出
/// </summary>
/// <param name="key">CMDName</param>
/// <param name="isStrobe">频闪</param>
/// <param name="recover">输出sleep下后恢复原信号</param>
/// <param name="recoverWaitTime">sleep多久后反转</param>
/// <returns></returns>
public bool io_output(CMDName key, bool isStrobe = false, bool recover = false, int recoverWaitTime = 100)
{
if (Config.CMDProcess.ContainsKey(key))
return io_output(key.ToString(), Config.CMDProcess[key], isStrobe, recover, recoverWaitTime);
return false;
}
/// <summary>
/// I/O指令输出
/// </summary>
/// <param name="processParam"></param>
/// <param name="isStrobe">频闪</param>
/// <param name="recover">输出sleep(recoverWaitTime)下,后恢复原信号</param>
/// <param name="recoverWaitTime">sleep 后反转</param>
public bool io_output(string tagName, JObject processParam, bool isStrobe = false, bool recover = false, int recoverWaitTime = 100)
{
bool result = false;
string[] OUT_OP_SHOW = processParam.Value<JArray>("OUT_OP_SHOW").ToObject<List<string>>().ToArray();
OUT_OP_SHOW = Utils.Util.IODataFormatBinaryStr(OUT_OP_SHOW, true);
for (int i = 0; i < OUT_OP_SHOW.Length; i++)
{
for (int j = 0; j < OUT_OP_SHOW[i].Length; j++)
{
int jj = OUT_OP_SHOW[i].Length - j - 1;
if (OUT_OP_SHOW[i][jj] == 'L' || OUT_OP_SHOW[i][jj] == 'H')
{
if (recover)
{
if (recoverWaitTime > 0)
{
OutDebugEvent?.Invoke(tagName, $"向I/O输出引脚{i}-{j},信号{OUT_OP_SHOW[i][jj]},输出时长:{recoverWaitTime}ms");
devIOCard.writeBitState(i, j, OUT_OP_SHOW[i][jj] == 'H', isStrobe);
Thread.Sleep(recoverWaitTime);
}
OutDebugEvent?.Invoke(tagName, $"向I/O输出引脚{i}-{j},信号{OUT_OP_SHOW[i][jj] == 'L'}");
devIOCard.writeBitState(i, j, OUT_OP_SHOW[i][jj] == 'L');
}
else
{
OutDebugEvent?.Invoke(tagName, $"向I/O输出引脚{i}-{j},信号{OUT_OP_SHOW[i][jj]}");
devIOCard.writeBitState(i, j, OUT_OP_SHOW[i][jj] == 'H', isStrobe);
}
result = true;
}
}
}
return result;
}
}
}

View File

@ -0,0 +1,824 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using LeatherApp.Interface;
//using MvCamCtrl.NET;
using MvFGCtrlC.NET;
using Newtonsoft.Json.Linq;
using OpenCvSharp;
using OpenCvSharp.Dnn;
//using static ControllerDllCSharp.ClassLibControllerDll;
namespace LeatherApp.Device
{
public class CamerCardDev : ABSCamerCardDev,IDisposable
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWindow(IntPtr hWnd);
[DllImport("kernel32.dll", EntryPoint = "RtlCopyMemory", SetLastError = false)]
public static extern void CopyMemory(IntPtr dest, IntPtr src, uint count);
//
private int scanIndex = 0; //实际拍照从1开始命名因先加的1
private string bmpSavePath;
/// <summary>
/// 曝光 3.00-10000.00
/// </summary>
public float ExposureTime { get; private set; }
/// <summary>
/// 增益 0-23.981199
/// </summary>
public float Gain { get; private set; }
/// <summary>
/// 帧率 0-429496.718750
/// </summary>
public float ResultingFrameRate { get; private set; }
/// <summary>
/// 图片大小
/// </summary>
public System.Drawing.Size size { get; private set; }
/// <summary>
/// 是否连续模式
/// </summary>
public bool isContinuousMode { get; private set; }
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
//public string ErrInfo { get; private set; }
//private System.Timers.Timer timer = new System.Timers.Timer();
private int _scannerCardIndex = 0;//采集卡索引
private int _scannerIndex=0;//相机索引(一个采集卡上可插多个相机)
#region
public enum SAVE_IAMGE_TYPE
{
Image_Undefined = 0, // ch:未定义的图像格式 | en:Undefined Image Type
Image_Bmp = 1, // ch:BMP图像格式 | en:BMP Image Type
Image_Jpeg = 2, // ch:JPEG图像格式 | en:Jpeg Image Type
}
// ch:判断用户自定义像素格式 | en:Determine custom pixel format
public const Int32 CUSTOMER_PIXEL_FORMAT = unchecked((Int32)0x80000000);
public const UInt32 TRIGGER_MODE_ON = 1; // ch:触发模式开 | en:Trigger mode on
public const UInt32 TRIGGER_MODE_OFF = 0; // ch:触发模式关 | en:Trigger mode off
CSystem m_cSystem = new CSystem(); // ch:操作采集卡 | en:Interface operations
CInterface m_cInterface = null; // ch:操作采集卡和设备 | en:Interface and device operation
CDevice m_cDevice = null; // ch:操作设备和流 | en:Device and stream operation
CStream m_cStream = null; // ch:操作流和缓存 | en:Stream and buffer operation
uint m_nInterfaceNum = 0; // ch:采集卡数量 | en:Interface number
bool m_bIsIFOpen = false; // ch:采集卡是否打开 | en:Whether to open interface
bool m_bIsDeviceOpen = false; // ch:设备是否打开 | en:Whether to open device
bool m_bIsGrabbing = false; // ch:是否在抓图 | en:Whether to start grabbing
uint m_nTriggerMode = TRIGGER_MODE_OFF; // ch:触发模式 | en:Trigger Mode
bool m_bThreadState = false; // ch:线程状态 | en:Thread state
Thread m_hGrabThread = null; // ch:取流线程 | en:Grabbing thread
private static Object m_LockForSaveImage = new Object(); // ch:存图锁 | en:Lock for saving image
IntPtr m_pDataBuf = IntPtr.Zero; // ch:数据缓存 | en:Data buffer
uint m_nDataBufSize = 0; // ch:数据缓存大小 | en:Length of data buffer
IntPtr m_pSaveImageBuf = IntPtr.Zero; // ch:图像缓存 | en:Image buffer
uint m_nSaveImageBufSize = 0; // ch:图像缓存大小 | en:Length of image buffer
MV_FG_INPUT_IMAGE_INFO m_stImageInfo = new MV_FG_INPUT_IMAGE_INFO(); // ch:图像信息 | en:Image info
delegate void ShowDisplayError(int nRet);
//显示图像控件句柄
private PictureBox previewHwnd=null;
#endregion
public CamerCardDev( )
{
}
public override bool open(int cardIndex = 0,int scannerIndex = 0)
{
if (IsInit) return true;
//m_stIFInfoList = _m_stIFInfoList;
_scannerCardIndex = cardIndex;
_scannerIndex = scannerIndex;
System.GC.Collect();
try
{
int nRet = 0;
bool bChanged = false;
// ch:枚举采集卡 | en:Enum interface
nRet = m_cSystem.UpdateInterfaceList(
CParamDefine.MV_FG_CAMERALINK_INTERFACE | CParamDefine.MV_FG_GEV_INTERFACE | CParamDefine.MV_FG_CXP_INTERFACE | CParamDefine.MV_FG_XoF_INTERFACE,
ref bChanged);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Enum Interface failed, ErrorCode:" + nRet.ToString("X"));
return false;
}
m_nInterfaceNum = 0;
// ch:获取采集卡数量 | en:Get interface num
nRet = m_cSystem.GetNumInterfaces(ref m_nInterfaceNum);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Get interface number failed, ErrorCode:" + nRet.ToString("X"));
return false;
}
if (0 == m_nInterfaceNum)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "No interface found");
return false;
}
if (cardIndex + 1 > m_nInterfaceNum)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "cardIndex > interface.count!");
return false;
}
//打开采集卡
// 如果已经打开,则先关闭采集卡
if (null != m_cInterface)
{
m_cInterface.CloseInterface();
m_cInterface = null;
}
// ch:打开采集卡,获得采集卡句柄 | en:Open interface, get handle
nRet = m_cSystem.OpenInterface((uint)cardIndex, out m_cInterface);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Open Interface failed, ErrorCode:" + nRet.ToString("X"));
return false;
}
m_bIsIFOpen = true;
//====枚举设备
uint nDeviceNum = 0;
// ch:枚举采集卡上的相机 | en:Enum camera of interface
nRet = m_cInterface.UpdateDeviceList(ref bChanged);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Update device list failed, ErrorCode:" + nRet.ToString("X"));
return false;
}
// ch:获取设备数量 | en:Get device number
nRet = m_cInterface.GetNumDevices(ref nDeviceNum);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Get devices number failed, ErrorCode:" + nRet.ToString("X"));
return false;
}
if (0 == nDeviceNum)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "No Device found");
return false;
}
if (scannerIndex + 1 > nDeviceNum)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "scannerIndex > Device.count!");
return false;
}
//====打开设备
// 如果已经打开,则先关闭通道
if (null != m_cStream)
{
m_cStream.CloseStream();
m_cStream = null;
}
// 如果已经打开,则先关闭设备
if (null != m_cDevice)
{
m_cDevice.CloseDevice();
m_cDevice = null;
}
// ch:打开设备,获得设备句柄 | en:Open device, get handle
nRet = m_cInterface.OpenDevice((uint)scannerIndex, out m_cDevice);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Open device failed, ErrorCode:" + nRet.ToString("X"));
return false;
}
m_bIsDeviceOpen = true;
//=====打开触发模式
CParam cDeviceParam = new CParam(m_cInterface);
// ch:打开触发模式 | en:Open Trigger Mode
//nRet = cDeviceParam.SetEnumValue("TriggerMode", TRIGGER_MODE_ON);
//if (CErrorCode.MV_FG_SUCCESS != nRet)
//{
// WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Turn on trigger mode failed, ErrorCode:" + nRet.ToString("X"));
// //关闭设备和采集卡
// m_cDevice.CloseDevice();
// m_bIsDeviceOpen = false;
// m_cInterface.CloseInterface();
// m_cInterface = null;
// return false;
//}
m_nTriggerMode = TRIGGER_MODE_ON;
cDeviceParam.SetEnumValue("TriggerSource", (uint)0);//CC1=0
// ch:注册回调函数 | en:Register image callback //本类不使用回调,使用线程主动循环读取
//ImageCallback = new MyCamera.cbOutputExdelegate(ImageCallbackFunc);
//nRet = device.MV_CC_RegisterImageCallBackEx_NET(ImageCallback, IntPtr.Zero);
//if (MyCamera.MV_OK != nRet)
//{
// WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, $"Register image callback failed! ({nRet})");
// return false;
//}
//开始采集
//startGrab();
//
getParam();
IsInit = true;
//timer.Elapsed += Timer_Elapsed;
//timer.Interval = 100;
//timer.Enabled = true;
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, ex.Message);
return false;
}
}
public override void close()
{
if (!IsInit) return;
try
{
IsInit = false;
//=====关闭设备
if (m_bThreadState)
{
m_bThreadState = false;
m_hGrabThread.Join();
}
int nRet = 0;
if (m_bIsGrabbing)
{
// ch:停止取流 | en:Stop Acquisition
nRet = m_cStream.StopAcquisition();
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low,"Stop acquistion failed, ErrorCode:" + nRet.ToString("X"));
}
m_bIsGrabbing = false;
}
if (null != m_cStream)
{
// ch:关闭流通道 | en:Close stream channel
nRet = m_cStream.CloseStream();
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low,"Close stream channel failed, ErrorCode:" + nRet.ToString("X"));
}
m_cStream = null;
}
if (null != m_cDevice)
{
// ch:关闭设备 | en:Close device
nRet = m_cDevice.CloseDevice();
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low,"Close device failed, ErrorCode:" + nRet.ToString("X"));
}
m_cDevice = null;
}
m_bIsDeviceOpen = false;
if (IntPtr.Zero != m_pDataBuf)
{
Marshal.FreeHGlobal(m_pDataBuf);
m_pDataBuf = IntPtr.Zero;
}
m_nDataBufSize = 0;
if (IntPtr.Zero != m_pSaveImageBuf)
{
Marshal.FreeHGlobal(m_pSaveImageBuf);
m_pSaveImageBuf = IntPtr.Zero;
}
m_nSaveImageBufSize = 0;
//======关闭采集卡
if (null == m_cInterface)
return;
// ch:关闭采集卡 | en:Close interface
nRet = m_cInterface.CloseInterface();
//if (CErrorCode.MV_FG_SUCCESS != nRet)
//{
// WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low,"Close interface failed, ErrorCode:" + nRet.ToString("X"));
// return;
//}
m_cInterface = null;
m_bIsIFOpen = false;
}
catch { }
}
/// <summary>
///
/// </summary>
/// <param name="hwnd">显示图像控件句柄</param>
/// <returns></returns>
public override bool start(PictureBox preview_Hwnd,string bmp_save_path)
{
if (!IsInit) return false;
this.previewHwnd= preview_Hwnd;
this.bmpSavePath = bmp_save_path;
//开始采集
startGrab();
return true;
}
/// <summary>
/// 停止采集
/// </summary>
public override void stop()
{
if (!IsInit) return;
try
{
if (false == m_bIsDeviceOpen || false == m_bIsGrabbing)
{
return;
}
// ch:标志位设为false | en:Set flag bit false
m_bThreadState = false;
m_hGrabThread.Join();
// ch:停止取流 | en:Stop Acquisition
int nRet = m_cStream.StopAcquisition();
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low,"Stop acquistion failed, ErrorCode:" + nRet.ToString("X"));
return;
}
m_bIsGrabbing = false;
// ch:关闭流通道 | en:Close stream channel
nRet = m_cStream.CloseStream();
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low,"Close stream channel failed, ErrorCode:" + nRet.ToString("X"));
}
m_cStream = null;
}
catch
{
return;
}
}
/// <summary>
/// num 因拍了一张后回传的当前已经是1了
/// </summary>
/// <param name="num"></param>
public override void resetScanIndex()
{
scanIndex = 0;//
}
#region private
//开始采集
private void startGrab()
{
if (!m_bIsDeviceOpen)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Please open device first");
return;
}
if (m_bIsGrabbing)
{
return;
}
// ch:获取流通道个数 | en:Get number of stream
uint nStreamNum = 0;
int nRet = m_cDevice.GetNumStreams(ref nStreamNum);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Get streams number failed, ErrorCode:" + nRet.ToString("X"));
return;
}
if (0 == nStreamNum)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "No valid stream channel");
return;
}
// ch:打开流通道(目前只支持单个通道) | en:Open stream(Only a single stream is supported now)
nRet = m_cDevice.OpenStream(0, out m_cStream);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Open stream failed, ErrorCode:" + nRet.ToString("X"));
return;
}
// ch:设置SDK内部缓存数量 | en:Set internal buffer number
const uint nBufNum = 5;
nRet = m_cStream.SetBufferNum(nBufNum);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Set buffer number failed, ErrorCode:" + nRet.ToString("X"));
return;
}
// ch:创建取流线程 | en:Create acquistion thread
m_bThreadState = true;
m_hGrabThread = new Thread(ReceiveThreadProcess);
if (null == m_hGrabThread)
{
m_bThreadState = false;
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Create thread failed");
return;
}
m_hGrabThread.Start();
// ch:开始取流 | en:Start Acquisition
nRet = m_cStream.StartAcquisition();
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
m_bThreadState = false;
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Start acquistion failed, ErrorCode:" + nRet.ToString("X"));
return;
}
m_bIsGrabbing = true;
}
public void setPreviewWin(PictureBox preview_Hwnd)
{
this.previewHwnd = preview_Hwnd;
}
public void ReceiveThreadProcess()
{
CImageProcess cImgProc = new CImageProcess(m_cStream);
MV_FG_BUFFER_INFO stFrameInfo = new MV_FG_BUFFER_INFO(); // ch:图像信息 | en:Frame info
MV_FG_INPUT_IMAGE_INFO stDisplayInfo = new MV_FG_INPUT_IMAGE_INFO(); // ch:显示的图像信息 | en:Display frame info
const uint nTimeout = 1000;
int nRet = 0;
while (m_bThreadState)
{
if (m_bIsGrabbing)
{
// ch:获取一帧图像缓存信息 | en:Get one frame buffer's info
nRet = m_cStream.GetFrameBuffer(ref stFrameInfo, nTimeout);
if (CErrorCode.MV_FG_SUCCESS == nRet)
{
// 用于保存图片
lock (m_LockForSaveImage)
{
if (IntPtr.Zero == m_pDataBuf || m_nDataBufSize < stFrameInfo.nFilledSize)
{
if (IntPtr.Zero != m_pDataBuf)
{
Marshal.FreeHGlobal(m_pDataBuf);
m_pDataBuf = IntPtr.Zero;
}
m_pDataBuf = Marshal.AllocHGlobal((Int32)stFrameInfo.nFilledSize);
if (IntPtr.Zero == m_pDataBuf)
{
m_cStream.ReleaseFrameBuffer(stFrameInfo);
break;
}
m_nDataBufSize = stFrameInfo.nFilledSize;
}
CopyMemory(m_pDataBuf, stFrameInfo.pBuffer, stFrameInfo.nFilledSize);
m_stImageInfo.nWidth = stFrameInfo.nWidth;
m_stImageInfo.nHeight = stFrameInfo.nHeight;
m_stImageInfo.enPixelType = stFrameInfo.enPixelType;
m_stImageInfo.pImageBuf = m_pDataBuf;
m_stImageInfo.nImageBufLen = stFrameInfo.nFilledSize;
//
var imgbuff=SaveImage();
if(imgbuff != null)
{
scanIndex++;
//if (ScanEventPath != null)//Ge用的这个
//{
// string imagpath = $"{this.bmpSavePath}{scanIndex}_dev{_scannerCardIndex}.bmp";
// File.WriteAllBytes(imagpath, imgbuff);
// ScanEventPath?.Invoke(scanIndex, imagpath, _scannerCardIndex);
//}
//else
{
Mat mat = Mat.ImDecode(imgbuff);
//string imagpath = $"{this.bmpSavePath}{scanIndex}_dev{_scannerCardIndex}.bmp";
//File.WriteAllBytes(imagpath, imgbuff);
ScanEvent?.Invoke(scanIndex, mat, _scannerCardIndex);
}
}
}
// 自定义格式不支持显示
if (RemoveCustomPixelFormats(stFrameInfo.enPixelType))
{
m_cStream.ReleaseFrameBuffer(stFrameInfo);
continue;
}
// 配置显示图像的参数
//pictureBox1显示
if (this.previewHwnd != null && IsWindow(this.previewHwnd.Handle))
{
stDisplayInfo.nWidth = stFrameInfo.nWidth;
stDisplayInfo.nHeight = stFrameInfo.nHeight;
stDisplayInfo.enPixelType = stFrameInfo.enPixelType;
stDisplayInfo.pImageBuf = stFrameInfo.pBuffer;
stDisplayInfo.nImageBufLen = stFrameInfo.nFilledSize;
nRet = cImgProc.DisplayOneFrame(previewHwnd.Handle, ref stDisplayInfo);
if (CErrorCode.MV_FG_SUCCESS != nRet)
{
m_cStream.ReleaseFrameBuffer(stFrameInfo);
//this.Invoke(new ShowDisplayError(DisplayError), new object[] { nRet });
break;
}
}
m_cStream.ReleaseFrameBuffer(stFrameInfo);
}
else
{
if (TRIGGER_MODE_ON == m_nTriggerMode)
{
Thread.Sleep(5);
}
}
}
else
{
Thread.Sleep(5);
}
}
}
private byte[] SaveImage(SAVE_IAMGE_TYPE enSaveImageType= SAVE_IAMGE_TYPE.Image_Bmp)
{
int nRet = 0;
lock (m_LockForSaveImage)
{
if (IntPtr.Zero == m_pDataBuf)
return null;// CErrorCode.MV_FG_ERR_NO_DATA;
if (RemoveCustomPixelFormats(m_stImageInfo.enPixelType))
return null;//CErrorCode.MV_FG_ERR_INVALID_VALUE;
uint nMaxImageLen = m_stImageInfo.nWidth * m_stImageInfo.nHeight * 4 + 2048; // 确保存图空间足够,包括图像头
if (IntPtr.Zero == m_pSaveImageBuf || m_nSaveImageBufSize < nMaxImageLen)
{
if (IntPtr.Zero != m_pSaveImageBuf)
{
Marshal.FreeHGlobal(m_pSaveImageBuf);
m_pSaveImageBuf = IntPtr.Zero;
}
m_pSaveImageBuf = Marshal.AllocHGlobal((Int32)nMaxImageLen);
if (IntPtr.Zero == m_pSaveImageBuf)
return null;//CErrorCode.MV_FG_ERR_OUT_OF_MEMORY;
m_nSaveImageBufSize = nMaxImageLen;
}
CImageProcess cImgSave = new CImageProcess(m_cStream);
System.DateTime currentTime = new System.DateTime();
currentTime = System.DateTime.Now;
do
{
if (SAVE_IAMGE_TYPE.Image_Bmp == enSaveImageType)
{
MV_FG_SAVE_BITMAP_INFO stBmpInfo = new MV_FG_SAVE_BITMAP_INFO();
stBmpInfo.stInputImageInfo = m_stImageInfo;
stBmpInfo.pBmpBuf = m_pSaveImageBuf;
stBmpInfo.nBmpBufSize = m_nSaveImageBufSize;
stBmpInfo.enCfaMethod = MV_FG_CFA_METHOD.MV_FG_CFA_METHOD_OPTIMAL;
// ch:保存BMP图像 | en:Save to BMP
nRet = cImgSave.SaveBitmap(ref stBmpInfo);
if (CErrorCode.MV_FG_SUCCESS != nRet)
break;
// ch:将图像数据保存到本地文件 | en:Save image data to local file
byte[] byteData = new byte[stBmpInfo.nBmpBufLen];
Marshal.Copy(stBmpInfo.pBmpBuf, byteData, 0, (int)stBmpInfo.nBmpBufLen);
//保存文件
//string strName = "Image_w" + stBmpInfo.stInputImageInfo.nWidth.ToString() +
// "_h" + stBmpInfo.stInputImageInfo.nHeight.ToString() + "_" + currentTime.Minute.ToString() +
// currentTime.Second.ToString() + currentTime.Millisecond.ToString() + ".bmp";
//FileStream pFile = new FileStream(strName, FileMode.Create);
//if (null == pFile)
//{
// nRet = CErrorCode.MV_FG_ERR_ERROR;
// break;
//}
//pFile.Write(byteData, 0, byteData.Length);
//pFile.Close();
return byteData;
}
else if (SAVE_IAMGE_TYPE.Image_Jpeg == enSaveImageType)
{
MV_FG_SAVE_JPEG_INFO stJpgInfo = new MV_FG_SAVE_JPEG_INFO();
stJpgInfo.stInputImageInfo = m_stImageInfo;
stJpgInfo.pJpgBuf = m_pSaveImageBuf;
stJpgInfo.nJpgBufSize = m_nSaveImageBufSize;
stJpgInfo.nJpgQuality = 80; // JPG编码质量(0-100]
stJpgInfo.enCfaMethod = MV_FG_CFA_METHOD.MV_FG_CFA_METHOD_OPTIMAL;
// ch:保存JPG图像 | en:Save to JPG
nRet = cImgSave.SaveJpeg(ref stJpgInfo);
if (CErrorCode.MV_FG_SUCCESS != nRet)
break;
// ch:将图像数据保存到本地文件 | en:Save image data to local file
byte[] byteData = new byte[stJpgInfo.nJpgBufLen];
Marshal.Copy(stJpgInfo.pJpgBuf, byteData, 0, (int)stJpgInfo.nJpgBufLen);
//保存文件
//string strName = "Image_w" + stJpgInfo.stInputImageInfo.nWidth.ToString() +
// "_h" + stJpgInfo.stInputImageInfo.nHeight.ToString() + "_" + currentTime.Minute.ToString() +
// currentTime.Second.ToString() + currentTime.Millisecond.ToString() + ".jpg";
//FileStream pFile = new FileStream(strName, FileMode.Create);
//if (null == pFile)
//{
// nRet = CErrorCode.MV_FG_ERR_ERROR;
// break;
//}
//pFile.Write(byteData, 0, byteData.Length);
//pFile.Close();
return byteData;
}
else
{
nRet = CErrorCode.MV_FG_ERR_INVALID_PARAMETER;
break;
}
} while (false);
}
return null;//
}
// ch:去除自定义的像素格式 | en:Remove custom pixel formats
private bool RemoveCustomPixelFormats(MV_FG_PIXEL_TYPE enPixelFormat)
{
Int32 nResult = ((int)enPixelFormat) & CUSTOMER_PIXEL_FORMAT;
if (CUSTOMER_PIXEL_FORMAT == nResult)
{
return true;
}
else
{
return false;
}
}
#endregion
public override double[] getFeatureRangeValue(string featureName)
{
switch (featureName)
{
case "ExposureTime":
return new double[2] { 0, 10000 };
case "Gain":
return new double[2] { 0.01, 255 };
default: return new double[0] { };
}
}
public override void getParam()
{
if (!IsInit) return;
CParam cDeviceParam = new CParam(m_cInterface);
MV_FG_FLOATVALUE stParam=new MV_FG_FLOATVALUE();
int nRet = cDeviceParam.GetFloatValue("ExposureTime", ref stParam);
if (nRet == CErrorCode.MV_FG_SUCCESS) ExposureTime = stParam.fCurValue;
nRet = cDeviceParam.GetFloatValue("Gain", ref stParam);
if (nRet == CErrorCode.MV_FG_SUCCESS) Gain = stParam.fCurValue;
nRet = cDeviceParam.GetFloatValue("ResultingFrameRate", ref stParam);
if (nRet == CErrorCode.MV_FG_SUCCESS) ResultingFrameRate = stParam.fCurValue;
}
/// <summary>
///
/// </summary>
/// <param name="exposureTime">曝光</param>
/// <param name="gain">增益</param>
/// <param name="resultingFrameRate">帧率</param>
public override bool setParam(float exposureTime, float gain =-1, float resultingFrameRate =-1)
{
if (!IsInit) return false;
CParam cDeviceParam = new CParam(m_cInterface);
//cDeviceParam.GetXmlFile()
//cDeviceParam.GetNodeAccessMode
//cDeviceParam.GetNodeInterfaceType
bool change = false;
int nRet;
if (exposureTime != ExposureTime && exposureTime != -1)
{
//device.MV_CC_SetEnumValue_NET("ExposureAuto", 0);
//nRet = device.MV_CC_SetFloatValue_NET("ExposureTime", exposureTime);
nRet = cDeviceParam.SetEnumValue("ExposureAuto", (uint)0);
if (CErrorCode.MV_FG_SUCCESS != nRet)
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, "ExposureTime SetEnumValue(\"ExposureAuto\") res=" + nRet);
nRet = cDeviceParam.SetFloatValue("ExposureTime", exposureTime);
if (CErrorCode.MV_FG_SUCCESS != nRet)
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, "ExposureTime SetFloatValue(\"ExposureTime\") res=" + nRet);
change = true;
}
if (gain != Gain && gain != -1)
{
//device.MV_CC_SetEnumValue_NET("GainAuto", 0);
//nRet = device.MV_CC_SetFloatValue_NET("Gain", gain);
cDeviceParam.SetEnumValue("GainAuto", (uint)0);
cDeviceParam.SetFloatValue("Gain", gain);
change = true;
}
if (resultingFrameRate != ResultingFrameRate && resultingFrameRate != -1)
{
cDeviceParam.SetFloatValue("AcquisitionFrameRate", resultingFrameRate);
change = true;
}
//
if (change)
getParam();
return change;
}
public void Dispose()
{
stop();
close();
}
private byte[] bmp2bytes(Bitmap bmp)
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bytes = ms.GetBuffer(); //byte[] bytes= ms.ToArray(); 这两句都可以,至于区别么,下面有解释
ms.Close();
bmp.Dispose();
return bytes;
}
private Bitmap bytes2bmp(byte[] bytes)
{
MemoryStream ms1 = new MemoryStream(bytes);
Bitmap bm = (Bitmap)Image.FromStream(ms1);
ms1.Close();
return bm;
}
public Bitmap read2Bmp(string path)
{
MemoryStream ms = new System.IO.MemoryStream(File.ReadAllBytes(path));
Bitmap bmp = new Bitmap(ms);
ms.Close();
ms.Dispose();
//FileStream fs = new FileStream(path, FileMode.Open);
//byte[] bmpdata = new byte[fs.Length];
//fs.Read(bmpdata, 0, bmpdata.Length);
//Bitmap bmp = new Bitmap(fs);
//fs.Close();
return bmp;
}
}
}

View File

@ -0,0 +1,561 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using IKapBoardClassLibrary;
using LeatherApp.Interface;
using Newtonsoft.Json.Linq;
using OpenCvSharp;
using OpenCvSharp.Dnn;
using ErrorCode = IKapBoardClassLibrary.ErrorCode;
namespace LeatherApp.Device
{
public class CamerCardDev2 : ABSCamerCardDev,IDisposable
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWindow(IntPtr hWnd);
[DllImport("kernel32.dll", EntryPoint = "RtlCopyMemory", SetLastError = false)]
public static extern void CopyMemory(IntPtr dest, IntPtr src, uint count);
[DllImport("User32.dll")]
public extern static System.IntPtr GetDC(System.IntPtr hWnd);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
//显示图像控件句柄
private PictureBox previewHwnd = null;
//
// 采集卡设备句柄。
public IntPtr m_hBoard = new IntPtr(-1);
// 当前帧索引。
public int m_nCurFrameIndex = 0;
// 图像缓冲区申请的帧数。
public int m_nTotalFrameCount = 1;
// 保存图像的文件名。
public string m_strFileName = "C:\\CSharpImage.bmp";
//
private int scanIndex = 0; //实际拍照从1开始命名因先加的1
private string bmpSavePath;
/// <summary>
/// 曝光 3.00-10000.00
/// </summary>
public float ExposureTime { get; private set; }
/// <summary>
/// 增益 0-23.981199
/// </summary>
public float Gain { get; private set; }
/// <summary>
/// 帧率 0-429496.718750
/// </summary>
public float ResultingFrameRate { get; private set; }
/// <summary>
/// 图片大小
/// </summary>
public System.Drawing.Size size { get; private set; }
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
//public string ErrInfo { get; private set; }
//private System.Timers.Timer timer = new System.Timers.Timer();
private int _scannerCardIndex = 0;//采集卡索引
private int _scannerIndex=0;//相机索引(一个采集卡上可插多个相机)
public CamerCardDev2( )
{
}
public override bool open(int cardIndex = 0,int scannerIndex = 0)
{
if (IsInit) return true;
//m_stIFInfoList = _m_stIFInfoList;
_scannerCardIndex = cardIndex;
_scannerIndex = scannerIndex;
System.GC.Collect();
try
{
int ret = (int)ErrorCode.IK_RTN_OK;
uint nPCIeDevCount = 0;
StringBuilder resourceName;
uint resourceNameSize = 0;
IKapBoard.IKAPERRORINFO tIKei = new IKapBoard.IKAPERRORINFO();
// 获取连接的采集卡数量。
ret = IKapBoard.IKapGetBoardCount((int)BoardType.IKBoardPCIE, ref nPCIeDevCount);
CheckIKapBoard(ret);
// 当没有连接的采集卡时。
if (nPCIeDevCount == 0 || nPCIeDevCount< cardIndex+1)
{
WarningEvent?.Invoke(WarningEnum.High, "Get board count 0");
return false;
}
// 获取采集卡名称。
for (uint i = 0; i < nPCIeDevCount; i++)
{
resourceNameSize = 0;
resourceName = new StringBuilder(0);
IKapBoard.IKapGetBoardName((uint)BoardType.IKBoardPCIE, i, resourceName, ref resourceNameSize);
IKapBoard.IKapGetLastError(ref tIKei, true);
if (tIKei.uErrorCode == (uint)ErrorCode.IKStatus_BufferTooSmall)
{
resourceName = new StringBuilder((int)resourceNameSize);
IKapBoard.IKapGetBoardName((uint)BoardType.IKBoardPCIE, i, resourceName, ref resourceNameSize);
}
IKapBoard.IKapGetLastError(ref tIKei, true);
if (tIKei.uErrorCode != (uint)ErrorCode.IKStatus_Success)
{
WarningEvent?.Invoke(WarningEnum.High, "Get Device Name Fail. Error Code:"+tIKei.uErrorCode);
return false;
}
string sMesg = string.Concat("PCIE Device- ", i.ToString("d"), "\nName: ", resourceName);
}
// 打开采集卡。
//
// Open frame grabber.
m_hBoard = IKapBoard.IKapOpen((int)BoardType.IKBoardPCIE, 0);//采集卡索引0-n
if (m_hBoard.Equals(-1))
{
WarningEvent?.Invoke(WarningEnum.High, "Open device failure!");
return false;
}
// 导入配置文件。
string configFileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\DevCfg\\"+ Config.CarmerConfigFilePath;
if (!File.Exists(configFileName))
{
WarningEvent?.Invoke(WarningEnum.High, "Fail to get configuration, using default setting!");
return false;
}
ret = IKapBoard.IKapLoadConfigurationFromFile(m_hBoard, configFileName);
CheckIKapBoard(ret);
// 设置图像缓冲区帧数。
//
// Set frame count of buffer.
ret = IKapBoard.IKapSetInfo(m_hBoard, (uint)INFO_ID.IKP_FRAME_COUNT, m_nTotalFrameCount);
CheckIKapBoard(ret);
// 设置超时时间。
//
// Set time out time.
int timeout = -1;
ret = IKapBoard.IKapSetInfo(m_hBoard, (uint)INFO_ID.IKP_TIME_OUT, timeout);
CheckIKapBoard(ret);
// 设置采集模式。
//
// Set grab mode.
int grab_mode = (int)GrabMode.IKP_GRAB_NON_BLOCK;//非阻塞StartGrab
ret = IKapBoard.IKapSetInfo(m_hBoard, (uint)INFO_ID.IKP_GRAB_MODE, grab_mode);
CheckIKapBoard(ret);
// 设置传输模式。
//
// Set transfer mode.
int transfer_mode = (int)FrameTransferMode.IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT;
ret = IKapBoard.IKapSetInfo(m_hBoard, (uint)INFO_ID.IKP_FRAME_TRANSFER_MODE, transfer_mode);
CheckIKapBoard(ret);
// 注册回调函数
//
// Register callback functions.
OnGrabStartProc = new IKapCallBackProc(OnGrabStartFunc);
ret = IKapBoard.IKapRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_GrabStart, Marshal.GetFunctionPointerForDelegate(OnGrabStartProc), m_hBoard);
CheckIKapBoard(ret);
OnFrameReadyProc = new IKapCallBackProc(OnFrameReadyFunc);
ret = IKapBoard.IKapRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_FrameReady, Marshal.GetFunctionPointerForDelegate(OnFrameReadyProc), m_hBoard);
CheckIKapBoard(ret);
OnFrameLostProc = new IKapCallBackProc(OnFrameLostFunc);
ret = IKapBoard.IKapRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_FrameLost, Marshal.GetFunctionPointerForDelegate(OnFrameLostProc), m_hBoard);
CheckIKapBoard(ret);
OnTimeoutProc = new IKapCallBackProc(OnTimeoutFunc);
ret = IKapBoard.IKapRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_TimeOut, Marshal.GetFunctionPointerForDelegate(OnTimeoutProc), m_hBoard);
CheckIKapBoard(ret);
OnGrabStopProc = new IKapCallBackProc(OnGrabStopFunc);
ret = IKapBoard.IKapRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_GrabStop, Marshal.GetFunctionPointerForDelegate(OnGrabStopProc), m_hBoard);
CheckIKapBoard(ret);
// 设置行触发参数。
//SetLineTrigger();
//
getParam();
IsInit = true;
//timer.Elapsed += Timer_Elapsed;
//timer.Interval = 100;
//timer.Enabled = true;
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(WarningEnum.High, ex.Message);
return false;
}
}
public override void close()
{
if (!IsInit) return;
try
{
IsInit = false;
// 清除回调函数。
UnRegisterCallback();
// 关闭设备。
CloseDevice();
}
catch { }
}
/// <summary>
///
/// </summary>
/// <param name="hwnd">显示图像控件句柄</param>
/// <returns></returns>
public override bool start(PictureBox preview_Hwnd,string bmp_save_path)
{
if (!IsInit) return false;
this.previewHwnd= preview_Hwnd;
this.bmpSavePath = bmp_save_path;
//开始采集
//第二个参数 nFrameCount 表示希望 IKapBoardClassLibrary 采集的帧数。
//如果 nFrameCount = 1IKapBoardClassLibrary 会从相机中采集一帧图像;
//如果 nFrameCount = N 且 N> 1则 IKapBoardClassLibrary 从相机中采集连续的 N 帧图 像;
//如果 nFrameCount = 0则 IKapBoardClassLibrary 开始连续采集图像。
var ret = IKapBoard.IKapStartGrab(m_hBoard, 0);
return ret == (int)ErrorCode.IK_RTN_OK;
}
/// <summary>
/// 停止采集
/// </summary>
public override void stop()
{
if (!IsInit) return;
try
{
// 停止图像采集。
var ret = IKapBoard.IKapStopGrab(m_hBoard);
CheckIKapBoard(ret);
}
catch
{
return;
}
}
/// <summary>
/// num 因拍了一张后回传的当前已经是1了
/// </summary>
/// <param name="num"></param>
public override void resetScanIndex()
{
scanIndex = 0;//
}
public override void getParam()
{
if (!IsInit) return;
//CParam cDeviceParam = new CParam(m_cInterface);
//MV_FG_FLOATVALUE stParam=new MV_FG_FLOATVALUE();
//int nRet = cDeviceParam.GetFloatValue("ExposureTime", ref stParam);
//if (nRet == CErrorCode.MV_FG_SUCCESS) ExposureTime = stParam.fCurValue;
//nRet = cDeviceParam.GetFloatValue("Gain", ref stParam);
//if (nRet == CErrorCode.MV_FG_SUCCESS) Gain = stParam.fCurValue;
//nRet = cDeviceParam.GetFloatValue("ResultingFrameRate", ref stParam);
//if (nRet == CErrorCode.MV_FG_SUCCESS) ResultingFrameRate = stParam.fCurValue;
}
/// <summary>
///
/// </summary>
/// <param name="exposureTime">曝光</param>
/// <param name="gain">增益</param>
/// <param name="resultingFrameRate">帧率</param>
public override bool setParam(float exposureTime, float gain =-1, float resultingFrameRate =-1)
{
if (!IsInit) return false;
bool change = false;
//CParam cDeviceParam = new CParam(m_cInterface);
//int nRet;
//if (exposureTime != ExposureTime && exposureTime != -1)
//{
// nRet = cDeviceParam.SetEnumValue("ExposureAuto", (uint)0);
// if (CErrorCode.MV_FG_SUCCESS != nRet)
// WarningEvent?.Invoke(WarningEnum.Low, "ExposureTime SetEnumValue(\"ExposureAuto\") res=" + nRet);
// nRet = cDeviceParam.SetFloatValue("ExposureTime", exposureTime);
// if (CErrorCode.MV_FG_SUCCESS != nRet)
// WarningEvent?.Invoke(WarningEnum.Low, "ExposureTime SetFloatValue(\"ExposureTime\") res=" + nRet);
// change = true;
//}
//if (gain != Gain && gain != -1)
//{
// //device.MV_CC_SetEnumValue_NET("GainAuto", 0);
// //nRet = device.MV_CC_SetFloatValue_NET("Gain", gain);
// cDeviceParam.SetEnumValue("GainAuto", (uint)0);
// cDeviceParam.SetFloatValue("Gain", gain);
// change = true;
//}
//if (resultingFrameRate != ResultingFrameRate && resultingFrameRate != -1)
//{
// cDeviceParam.SetFloatValue("AcquisitionFrameRate", resultingFrameRate);
// change = true;
//}
//
if (change)
getParam();
return change;
}
public void Dispose()
{
stop();
close();
}
//---------------
/* @brief
*
* @briefSet line trigger parameters. */
void SetLineTrigger()
{
int ret = (int)ErrorCode.IK_RTN_OK;
// 设置CC1信号源。
//
// Set CC1 signal source.
ret = IKapBoard.IKapSetInfo(m_hBoard, (uint)INFO_ID.IKP_CC1_SOURCE, (int)CCSource.IKP_CC_SOURCE_VAL_INTEGRATION_SIGNAL1);
CheckIKapBoard(ret);
// 设置积分控制方法触发信号源。
//
// Set integration control method trigger source.
ret = IKapBoard.IKapSetInfo(m_hBoard, (uint)INFO_ID.IKP_INTEGRATION_TRIGGER_SOURCE, (int)IntegrationTriggerSource.IKP_INTEGRATION_TRIGGER_SOURCE_VAL_SHAFT_ENCODER1);
CheckIKapBoard(ret);
}
/* @brief
*
* @briefUnregister callback functions. */
private void UnRegisterCallback()
{
int ret = (int)ErrorCode.IK_RTN_OK;
ret = IKapBoard.IKapUnRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_GrabStart);
ret = IKapBoard.IKapUnRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_FrameReady);
ret = IKapBoard.IKapUnRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_FrameLost);
ret = IKapBoard.IKapUnRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_TimeOut);
ret = IKapBoard.IKapUnRegisterCallback(m_hBoard, (uint)CallBackEvents.IKEvent_GrabStop);
}
/* @brief
*
* @briefClose device. */
private void CloseDevice()
{
// 关闭采集卡设备。
//
// Close frame grabber device.
if (!m_hBoard.Equals(-1))
{
IKapBoard.IKapClose(m_hBoard);
m_hBoard = (IntPtr)(-1);
}
}
/* @brief IKapBoard
* @param[in] ret
*
* @briefDetermine whether the IKapBoard function is called successfully.
* @param[in] retFunction return value. */
static void CheckIKapBoard(int ret)
{
if (ret != (int)ErrorCode.IK_RTN_OK)
{
string sErrMsg = "";
IKapBoard.IKAPERRORINFO tIKei = new IKapBoardClassLibrary.IKapBoard.IKAPERRORINFO();
// 获取错误码信息。
IKapBoard.IKapGetLastError(ref tIKei, true);
// 打印错误信息。
sErrMsg = string.Concat("Error",
sErrMsg,
"Board Type\t = 0x", tIKei.uBoardType.ToString("X4"), "\n",
"Board Index\t = 0x", tIKei.uBoardIndex.ToString("X4"), "\n",
"Error Code\t = 0x", tIKei.uErrorCode.ToString("X4"), "\n"
);
throw new Exception(sErrMsg);
}
}
#region Callback
delegate void IKapCallBackProc(IntPtr pParam);
/* @brief
*
* @briefThis function is registered as a callback function. When starting grabbing images, the function will be called. */
private IKapCallBackProc OnGrabStartProc;
/* @brief
*
* @briefThis function is registered as a callback function. When grabbing frame lost, the function will be called. */
private IKapCallBackProc OnFrameLostProc;
/* @brief
*
* @briefThis function is registered as a callback function. When grabbing images time out, the function will be called. */
private IKapCallBackProc OnTimeoutProc;
/* @brief
*
* @briefThis function is registered as a callback function. When a frame of image grabbing ready, the function will be called. */
private IKapCallBackProc OnFrameReadyProc;
/* @brief
*
* @briefThis function is registered as a callback function. When stopping grabbing images, the function will be called. */
private IKapCallBackProc OnGrabStopProc;
#endregion
#region Callback
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When starting grabbing images, the function will be called.
* @param[in] pParamInput parameter. */
public void OnGrabStartFunc(IntPtr pParam)
{
Console.WriteLine("Start grabbing image");
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When grabbing frame lost, the function will be called.
* @param[in] pParamInput parameter. */
public void OnFrameLostFunc(IntPtr pParam)
{
Console.WriteLine("Image frame lost");
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When grabbing images time out, the function will be called.
* @param[in] pParamInput parameter. */
public void OnTimeoutFunc(IntPtr pParam)
{
Console.WriteLine("Grab image timeout");
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When a frame of image grabbing ready, the function will be called.
* @param[in] pParamInput parameter. */
public void OnFrameReadyFunc(IntPtr pParam)
{
Console.WriteLine("Grab frame ready");
IntPtr hDev = (IntPtr)pParam;
IntPtr pUserBuffer = IntPtr.Zero;
int nFrameSize = 0;
int nFrameCount = 0;
IKapBoard.IKAPBUFFERSTATUS status = new IKapBoard.IKAPBUFFERSTATUS();
IKapBoard.IKapGetInfo(hDev, (uint)INFO_ID.IKP_FRAME_COUNT, ref nFrameCount);
IKapBoard.IKapGetBufferStatus(hDev, m_nCurFrameIndex, ref status);
// 当图像缓冲区满时。
//
// When the buffer is full.
if (status.uFull == 1)
{
// 获取一帧图像的大小。
//
// Get the size of a frame of image.
IKapBoard.IKapGetInfo(hDev, (uint)INFO_ID.IKP_FRAME_SIZE, ref nFrameSize);
// 获取缓冲区地址。
//
// Get the buffer address.
IKapBoard.IKapGetBufferAddress(hDev, m_nCurFrameIndex, ref pUserBuffer);
// === 保存图像。
//存文件
//IKapBoard.IKapSaveBuffer(hDev, m_nCurFrameIndex, m_strFileName, (int)ImageCompressionFalg.IKP_DEFAULT_COMPRESSION);
// 存到byte[]
byte[] imageBuff = new byte[nFrameSize]; // 创建字节数组
Marshal.Copy(pUserBuffer, imageBuff, 0, imageBuff.Length); // 将目标内存空间中的数据复制到结果字节数组
//存到地址
//IntPtr m_pDataBuf = Marshal.AllocHGlobal(nFrameSize); //分配空间
//CopyMemory(m_pDataBuf, pUserBuffer, (uint)nFrameSize);
//pictureBox1显示
if (this.previewHwnd != null && IsWindow(this.previewHwnd.Handle))
{
this.previewHwnd.Image = bytes2bmp(imageBuff);
}
}
m_nCurFrameIndex++;
m_nCurFrameIndex = m_nCurFrameIndex % m_nTotalFrameCount;
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When stopping grabbing images, the function will be called.
* @param[in] pParamInput parameter. */
public void OnGrabStopFunc(IntPtr pParam)
{
Console.WriteLine("Stop grabbing image");
}
#endregion
private byte[] bmp2bytes(Bitmap bmp)
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bytes = ms.GetBuffer(); //byte[] bytes= ms.ToArray(); 这两句都可以,至于区别么,下面有解释
ms.Close();
bmp.Dispose();
return bytes;
}
private Bitmap bytes2bmp(byte[] bytes)
{
MemoryStream ms1 = new MemoryStream(bytes);
Bitmap bm = (Bitmap)Image.FromStream(ms1);
ms1.Close();
return bm;
}
}
}

View File

@ -0,0 +1,874 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using IKapBoardClassLibrary;
using IKapC.NET;
using LeatherApp.Device.CamerUtil;
using LeatherApp.Interface;
using Newtonsoft.Json.Linq;
using OpenCvSharp;
using OpenCvSharp.Dnn;
using ErrorCode = IKapBoardClassLibrary.ErrorCode;
namespace LeatherApp.Device
{
public class CamerCardDevIK : ABSCamerCardDev,IDisposable
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWindow(IntPtr hWnd);
[DllImport("kernel32.dll")]
public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);
// 相机句柄
//private IKDeviceCL m_pDev = new IKDeviceCL();
public IntPtr m_pDev = new IntPtr(-1);
// 采集卡句柄
public IntPtr m_pBoard = new IntPtr(-1);
// 用户缓冲区,用于图像数据转换
public IntPtr m_pUserBuffer = new IntPtr(-1);
// 是否正在采集
public volatile bool m_bGrabingImage = false;
// 是否已更新用户缓冲区
public volatile bool m_bUpdateImage = false;
// 相机类型0为GV相机1为CL相机2为CXP相机
public int m_nType = -1;
// 图像宽度
public int m_nWidth = -1;
// 图像高度
public int m_nHeight = -1;
// 像素位数
public int m_nDepth = 8;
// 图像通道数
public int m_nChannels = 1;
// 相机索引
public int m_nDevIndex = -1;
// 采集卡索引
public int m_nBoardIndex = -1;
// 相机缓冲区个数
public int m_nFrameCount = 2;//只能1
// 当前帧索引
public int m_nCurFrameIndex = 0;
// 相机缓冲区大小
public int m_nBufferSize = 0;
// 用户缓冲区锁
public object m_mutexImage = new object();
//显示图像控件句柄
private PictureBox previewHwnd = null;
//
// 保存图像的文件名。
public string m_strFileName = "C:\\CSharpImage.bmp";
//
private int scanIndex = 0; //实际拍照从1开始命名因先加的1
private string bmpSavePath;
private Thread readerThread;
private Queue<MyData> frameQueue =new Queue<MyData>();
/// <summary>
/// 曝光 3.00-10000.00
/// </summary>
public float ExposureTime { get; private set; }
/// <summary>
/// 增益 0-23.981199
/// </summary>
public float Gain { get; private set; }
/// <summary>
/// 帧率 0-429496.718750
/// </summary>
public float ResultingFrameRate { get; private set; }
/// <summary>
/// 图片大小
/// </summary>
public System.Drawing.Size size { get; private set; }
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
//public string ErrInfo { get; private set; }
//private System.Timers.Timer timer = new System.Timers.Timer();
private int _scannerCardIndex = 0;//采集卡索引
private int _scannerIndex=0;//相机索引(一个采集卡上可插多个相机)
private IKDeviceInfo devInfo;
BufferToImage hBuffer;
private class MyData
{
public MyData(int _index,Mat _mat)
{
index= _index;
mat = _mat;
}
public int index;
public Mat mat;
}
// 设备类型枚举
enum IKDeviceType
{
DEVICE_NIL = 0,
DEVICE_CML,
DEVICE_CXP,
DEVICE_USB,
DEVICE_GIGEVISION
}
// 设备信息结构体
struct IKDeviceInfo
{
public IKDeviceType nType;
public int nDevIndex;
public int nBoardIndex;
public string sDevName;
}
/// <summary>
/// 读取缓存队列线程
/// </summary>
private void readDataThread()
{
MyData mydate;
while (IsInit)
{
if (frameQueue.Count > 0) // 如果队列不为空则从队列中获取元素
{
lock (frameQueue)
{
mydate = frameQueue.Dequeue();
}
PhotoNumCacheEvent?.Invoke(frameQueue.Count);
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.Normal, $"相机({_scannerCardIndex})从缓存队列提取一帧图像({mydate.index}),开始回调(队列剩余帧数:{frameQueue.Count})...", null, null);
ScanEvent?.Invoke(mydate.index, mydate.mat, _scannerCardIndex);
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.Normal, $"相机({_scannerCardIndex})图像({mydate.index})回调完成.", null, null);
}
else
{
Thread.Sleep(10);
}
}
}
public CamerCardDevIK( )
{
m_nType = 1;
}
public override bool open(int nBoardIndex,int nDevIndex)
{
if (IsInit) return true;
_scannerCardIndex = nBoardIndex;
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.Normal, "open ....",null,null);
try
{
closeDevice();
scanIndex = 0;
devInfo = new IKDeviceInfo();
readerThread = new Thread(readDataThread); // 创建读取线程
//
uint nDevCount = 2;
uint res = IKapCLib.ItkManGetDeviceCount(ref nDevCount);
if (res != (uint)ItkStatusErrorId.ITKSTATUS_OK)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "ItkManGetDeviceCount failed");
return false;
}
IKapCLib.ITKDEV_INFO pDevInfo = new IKapCLib.ITKDEV_INFO();
IKapCLib.ITK_CL_DEV_INFO pClDevInfo = new IKapCLib.ITK_CL_DEV_INFO();
for (uint i = 0; i < nDevCount; ++i)
{
IKapCLib.ItkManGetDeviceInfo(i, ref pDevInfo);
if (pDevInfo.DeviceClass.CompareTo("CameraLink") == 0)
{
res = IKapCLib.ItkManGetCLDeviceInfo(i, ref pClDevInfo);
//if (res != (uint)ItkStatusErrorId.ITKSTATUS_OK)
// return;
if ((int)pClDevInfo.BoardIndex == nBoardIndex)
{
devInfo.nType = IKDeviceType.DEVICE_CML;
devInfo.nDevIndex = (int)i;
devInfo.nBoardIndex = (int)pClDevInfo.BoardIndex;
devInfo.sDevName = pDevInfo.FullName;
}
}
}
if(devInfo.nType != IKDeviceType.DEVICE_CML)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "对应索引相机不存在 failed");
return false;
}
//
res = IKapCLib.ItkDevOpen((uint)devInfo.nDevIndex
, (int)(ItkDeviceAccessMode.ITKDEV_VAL_ACCESS_MODE_CONTROL)
, ref m_pDev);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Camera error:Open camera failed");
return false;
}
//打开采集卡
m_pBoard = IKapBoard.IKapOpen((uint)BoardType.IKBoardPCIE, (uint)devInfo.nBoardIndex);
if (m_pBoard == new IntPtr(-1))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "IKapOpen failed");
return false;
}
IsInit = true;
readerThread.Start();
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, ex.Message);
return false;
}
}
public override void close()
{
if (!IsInit) return;
try
{
IsInit = false;
// 清除回调函数。
UnRegisterCallback();
// 关闭设备。
CloseDevice();
}
catch { }
}
/// <summary>
///
/// </summary>
/// <param name="hwnd">显示图像控件句柄</param>
/// <returns></returns>
public override bool start(PictureBox preview_Hwnd,string bmp_save_path)
{
if (!IsInit) return false;
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "start ....");
// 导入配置文件。
string configFileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\DevCfg\\" + (_scannerCardIndex==0?Config.Carmer1ConfigFilePath: Config.Carmer2ConfigFilePath);
if (!File.Exists(configFileName))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, "Fail to get configuration, using default setting!");
return false;
}
var b=loadConfiguration(configFileName);
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, "开始采集 ..."+b.ToString());
this.previewHwnd= preview_Hwnd;
this.bmpSavePath = bmp_save_path;
//开始采集
//第二个参数 nFrameCount 表示希望 IKapBoardClassLibrary 采集的帧数。
//如果 nFrameCount = 1IKapBoardClassLibrary 会从相机中采集一帧图像;
//如果 nFrameCount = N 且 N> 1则 IKapBoardClassLibrary 从相机中采集连续的 N 帧图 像;
//如果 nFrameCount = 0则 IKapBoardClassLibrary 开始连续采集图像。
int ret;
// 设置抓取模式IKP_GRAB_NON_BLOCK为非阻塞模式
//int grab_mode = (int)GrabMode.IKP_GRAB_NON_BLOCK;
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_GRAB_MODE, grab_mode);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
//// 设置帧传输模式IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT为同步保存模式
//int transfer_mode = (int)FrameTransferMode.IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT;
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_TRANSFER_MODE, transfer_mode);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
//设置缓冲区格式
ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_COUNT, 1);//
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
// 设置帧超时时间
int timeout = -1;
ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_TIME_OUT, timeout);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
// 设置采集模式。
//
// Set grab mode.
int grab_mode = (int)GrabMode.IKP_GRAB_NON_BLOCK;
ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_GRAB_MODE, grab_mode);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
// 设置传输模式。
int transfer_mode = (int)FrameTransferMode.IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT;
ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_TRANSFER_MODE, transfer_mode);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
// 注册回调函数
IntPtr hPtr = new IntPtr(-1);
OnGrabStartProc = new IKapCallBackProc(OnGrabStartFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_GrabStart, Marshal.GetFunctionPointerForDelegate(OnGrabStartProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnFrameReadyProc = new IKapCallBackProc(OnFrameReadyFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_FrameReady, Marshal.GetFunctionPointerForDelegate(OnFrameReadyProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnFrameLostProc = new IKapCallBackProc(OnFrameLostFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_FrameLost, Marshal.GetFunctionPointerForDelegate(OnFrameLostProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnTimeoutProc = new IKapCallBackProc(OnTimeoutFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_TimeOut, Marshal.GetFunctionPointerForDelegate(OnTimeoutProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnGrabStopProc = new IKapCallBackProc(OnGrabStopFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_GrabStop, Marshal.GetFunctionPointerForDelegate(OnGrabStopProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
m_bUpdateImage = false;
m_nCurFrameIndex = 0;
ret = IKapBoard.IKapStartGrab(m_pBoard, 0);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
//createBuffer
b = createBuffer();
if (!b)
return false;
getParam();
//
m_bGrabingImage = true;
return true;
}
/// <summary>
/// 停止采集
/// </summary>
public override void stop()
{
if (!IsInit) return;
try
{
// 停止图像采集。
var ret = IKapBoard.IKapStopGrab(m_pBoard);
clearBuffer();
CheckIKapBoard(ret);
}
catch
{
return;
}
}
/// <summary>
/// num 因拍了一张后回传的当前已经是1了
/// </summary>
/// <param name="num"></param>
public override void resetScanIndex()
{
scanIndex = 0;//
}
public override void getParam()
{
if (!IsInit) return;
string result;
result = getFeatureValue("ExposureTime");
if (!string.IsNullOrEmpty(result))
ExposureTime = Convert.ToSingle(result);
result = getFeatureValue("Gain");
if (!string.IsNullOrEmpty(result))
Gain = Convert.ToSingle(result);
}
/// <summary>
///
/// </summary>
/// <param name="exposureTime">曝光</param>
/// <param name="gain">增益</param>
/// <param name="resultingFrameRate">帧率</param>
public override bool setParam(float exposureTime, float gain =-1, float resultingFrameRate =-1)
{
if (!IsInit) return false;
bool change = false;
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, $"ExposureTime: {exposureTime},{ExposureTime}");
if (exposureTime != ExposureTime && exposureTime != -1)
{
if(setFeatureValue("ExposureTime", exposureTime.ToString()))
change = true;
}
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, $"Gain: {gain},{Gain}");
if (gain != Gain && gain != -1)
{
if (setFeatureValue("Gain", gain.ToString()))
change = true;
}
//if (resultingFrameRate != ResultingFrameRate && resultingFrameRate != -1)
//{
// cDeviceParam.SetFloatValue("AcquisitionFrameRate", resultingFrameRate);
// change = true;
//}
//
if (change)
getParam();
return change;
}
public void Dispose()
{
stop();
close();
}
//---------------
/* @brief
*
* @briefSet line trigger parameters. */
void SetLineTrigger()
{
int ret = (int)ErrorCode.IK_RTN_OK;
// 设置CC1信号源。
//
// Set CC1 signal source.
ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_CC1_SOURCE, (int)CCSource.IKP_CC_SOURCE_VAL_INTEGRATION_SIGNAL1);
CheckIKapBoard(ret);
// 设置积分控制方法触发信号源。
//
// Set integration control method trigger source.
ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_INTEGRATION_TRIGGER_SOURCE, (int)IntegrationTriggerSource.IKP_INTEGRATION_TRIGGER_SOURCE_VAL_SHAFT_ENCODER1);
CheckIKapBoard(ret);
}
/* @brief
*
* @briefUnregister callback functions. */
private void UnRegisterCallback()
{
int ret = (int)ErrorCode.IK_RTN_OK;
ret = IKapBoard.IKapUnRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_GrabStart);
ret = IKapBoard.IKapUnRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_FrameReady);
ret = IKapBoard.IKapUnRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_FrameLost);
ret = IKapBoard.IKapUnRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_TimeOut);
ret = IKapBoard.IKapUnRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_GrabStop);
}
/* @brief
*
* @briefClose device. */
private void CloseDevice()
{
// 关闭采集卡设备。
//
// Close frame grabber device.
if (!m_pBoard.Equals(-1))
{
IKapBoard.IKapClose(m_pBoard);
m_pBoard = (IntPtr)(-1);
}
}
/* @brief IKapBoard
* @param[in] ret
*
* @briefDetermine whether the IKapBoard function is called successfully.
* @param[in] retFunction return value. */
static void CheckIKapBoard(int ret)
{
if (ret != (int)ErrorCode.IK_RTN_OK)
{
string sErrMsg = "";
IKapBoard.IKAPERRORINFO tIKei = new IKapBoardClassLibrary.IKapBoard.IKAPERRORINFO();
// 获取错误码信息。
IKapBoard.IKapGetLastError(ref tIKei, true);
// 打印错误信息。
sErrMsg = string.Concat("Error",
sErrMsg,
"Board Type\t = 0x", tIKei.uBoardType.ToString("X4"), "\n",
"Board Index\t = 0x", tIKei.uBoardIndex.ToString("X4"), "\n",
"Error Code\t = 0x", tIKei.uErrorCode.ToString("X4"), "\n"
);
throw new Exception(sErrMsg);
}
}
#region Callback
delegate void IKapCallBackProc(IntPtr pParam);
/* @brief
*
* @briefThis function is registered as a callback function. When starting grabbing images, the function will be called. */
private IKapCallBackProc OnGrabStartProc;
/* @brief
*
* @briefThis function is registered as a callback function. When grabbing frame lost, the function will be called. */
private IKapCallBackProc OnFrameLostProc;
/* @brief
*
* @briefThis function is registered as a callback function. When grabbing images time out, the function will be called. */
private IKapCallBackProc OnTimeoutProc;
/* @brief
*
* @briefThis function is registered as a callback function. When a frame of image grabbing ready, the function will be called. */
private IKapCallBackProc OnFrameReadyProc;
/* @brief
*
* @briefThis function is registered as a callback function. When stopping grabbing images, the function will be called. */
private IKapCallBackProc OnGrabStopProc;
#endregion
#region Callback
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When starting grabbing images, the function will be called.
* @param[in] pParamInput parameter. */
public void OnGrabStartFunc(IntPtr pParam)
{
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.Normal, "图像开始采集...", null, null);
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When grabbing frame lost, the function will be called.
* @param[in] pParamInput parameter. */
public void OnFrameLostFunc(IntPtr pParam)
{
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.High, $"相机({_scannerCardIndex})采集图像({scanIndex})丢帧(Image frame lost),急停告警,需结束重新开始!!!", null, null);
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When grabbing images time out, the function will be called.
* @param[in] pParamInput parameter. */
public void OnTimeoutFunc(IntPtr pParam)
{
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.High, $"相机({_scannerCardIndex})采集图像({scanIndex})超时(Grab image timeout),请检查采集卡!", null, null);
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When a frame of image grabbing ready, the function will be called.
* @param[in] pParamInput parameter. */
public void OnFrameReadyFunc(IntPtr pParam)
{
try
{
Stopwatch stopwatch = Stopwatch.StartNew();
stopwatch.Start();
int index = ++scanIndex;
WarningEvent?.BeginInvoke(DateTime.Now, WarningEnum.Normal, $"OnFrameReadyFunc 相机({_scannerCardIndex})一帧图像({index})采集完成,正在加入队列({frameQueue.Count})...", null, null);
IntPtr hPtr = new IntPtr(-1);
// 获取当前帧状态
var ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_CURRENT_BUFFER_INDEX, ref m_nCurFrameIndex);
if (ret != (int)ErrorCode.IK_RTN_OK)
return;
//IKapBoard.IKAPBUFFERSTATUS status = new IKapBoard.IKAPBUFFERSTATUS();
//IKapBoard.IKapGetBufferStatus(m_pBoard, m_nCurFrameIndex, ref status);
//var uFull = status.uFull;
//if (uFull == 1)//指明缓冲区是否为满
{
IKapBoard.IKapGetBufferAddress(m_pBoard, m_nCurFrameIndex, ref hPtr);
//Monitor.Enter(m_mutexImage);
lock (m_mutexImage)
{
CopyMemory(m_pUserBuffer, hPtr, m_nBufferSize);
m_bUpdateImage = true;
var bmp = hBuffer.toBmp(m_pUserBuffer);
Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(bmp);
bmp.Dispose();
bmp = null;
//Monitor.Enter(frameQueue);
lock (frameQueue)
frameQueue.Enqueue(new MyData(index, mat));
PhotoNumCacheEvent?.BeginInvoke(frameQueue.Count, null, null);
}
}
//m_nCurFrameIndex++;
//m_nCurFrameIndex = m_nCurFrameIndex % m_nFrameCount;
stopwatch.Stop();
WarningEvent?.BeginInvoke(DateTime.Now, WarningEnum.Normal, $"OnFrameReadyFunc 相机({_scannerCardIndex})一帧图像({index})已加入队列({frameQueue.Count}).缓冲区索引={m_nCurFrameIndex};用时:{stopwatch.ElapsedMilliseconds}ms", null, null);
}
catch (Exception ex)
{
WarningEvent?.BeginInvoke(DateTime.Now, WarningEnum.High, $"OnFrameReadyFunc 异常,急停告警,需结束重新开始!!!{ex.Message}\r\n{ex.StackTrace}", null, null);
}
}
/* @brief
* @param[in] pParam
*
* @briefThis function is registered as a callback function. When stopping grabbing images, the function will be called.
* @param[in] pParamInput parameter. */
public void OnGrabStopFunc(IntPtr pParam)
{
Console.WriteLine("Stop grabbing image");
}
#endregion
private byte[] bmp2bytes(Bitmap bmp)
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bytes = ms.GetBuffer(); //byte[] bytes= ms.ToArray(); 这两句都可以,至于区别么,下面有解释
ms.Close();
bmp.Dispose();
return bytes;
}
private Bitmap bytes2bmp(byte[] bytes)
{
MemoryStream ms1 = new MemoryStream(bytes);
Bitmap bm = (Bitmap)Image.FromStream(ms1);
ms1.Close();
return bm;
}
/*
* @brief:
* @param [in] featureName:[ExposureTime,Gain]
* @param [in] featureValue:
* @return:
*/
private bool setFeatureValue(string featureName, string featureValue)
{
IntPtr itkFeature = new IntPtr(-1);
uint nType = 0;
uint res = IKapCLib.ItkDevAllocFeature(m_pDev, featureName, ref itkFeature);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"setFeatureValue({featureName},{featureValue}) Camera error:Allocate feature failed");
return false;
}
res = IKapCLib.ItkFeatureGetType(itkFeature, ref nType);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"setFeatureValue({featureName},{featureValue}) Camera error:Get feature type failed");
return false;
}
switch (nType)
{
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_INT32:
res = IKapCLib.ItkFeatureSetInt32(itkFeature, Convert.ToInt32(featureValue));
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_INT64:
res = IKapCLib.ItkFeatureSetInt64(itkFeature, Convert.ToInt64(featureValue));
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_FLOAT:
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_DOUBLE:
res = IKapCLib.ItkFeatureSetDouble(itkFeature, Convert.ToDouble(featureValue));
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_ENUM:
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_STRING:
res = IKapCLib.ItkFeatureFromString(itkFeature, featureValue);
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_COMMAND:
res = IKapCLib.ItkFeatureExecuteCommand(itkFeature);
break;
}
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"setFeatureValue({featureName},{featureValue}) Camera error:Set feature failed:" + res);
return false;
}
return true;
}
private string getFeatureValue(string featureName)
{
IntPtr itkFeature = new IntPtr(-1);
uint nType = 0;
uint res = IKapCLib.ItkDevAllocFeature(m_pDev, featureName, ref itkFeature);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Allocate feature failed");
return "";
}
res = IKapCLib.ItkFeatureGetType(itkFeature, ref nType);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Get feature type failed");
return "";
}
switch (nType)
{
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_INT32:
int result = 0;
res = IKapCLib.ItkFeatureGetInt32(itkFeature,ref result);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Get feature failed:" + res);
return "";
}
return result.ToString();
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_INT64:
long resultL = 0;
res = IKapCLib.ItkFeatureGetInt64(itkFeature, ref resultL);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Get feature failed:" + res);
return "";
}
return resultL.ToString();
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_FLOAT:
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_DOUBLE:
double resultD = 0;
res = IKapCLib.ItkFeatureGetDouble(itkFeature, ref resultD);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Get feature failed:" + res);
return "";
}
return resultD.ToString();
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_ENUM:
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_STRING:
string results = "";
res = IKapCLib.ItkFeatureFromString(itkFeature, results);
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Get feature failed:" + res);
return "";
}
return results;
}
if (!Check(res))
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"getFeatureValue({featureName}) Camera error:Get feature failed:" + res);
return "";
}
return "";
}
public override double[] getFeatureRangeValue(string featureName)
{
switch (featureName)
{
case "ExposureTime":
//return new double[2] {3.2,63997};
return new double[2] { 10, 200 };
case "Gain":
return new double[2] { 0.01, 8.00 };
default: return new double[0] { };
}
}
/*
*@brief:
*@param [in] err:
*@return:
*/
private static bool Check(uint err)
{
if (err != (uint)ItkStatusErrorId.ITKSTATUS_OK)
{
System.Diagnostics.Debug.WriteLine("Error code: {0}.\n", err.ToString("x8"));
return false;
}
return true;
}
//----
private bool isOpen()
{
return m_pDev != new IntPtr(-1) && m_pBoard != new IntPtr(-1);
}
private bool closeDevice()
{
frameQueue.Clear();
if (isOpen())
{
IKapBoard.IKapClose(m_pBoard);
IKapCLib.ItkDevClose(m_pDev);
}
return true;
}
private bool loadConfiguration(string sFilePath)
{
int ret = IKapBoard.IKapLoadConfigurationFromFile(m_pBoard, sFilePath);
return ret == (int)ErrorCode.IK_RTN_OK;
}
private bool createBuffer()
{
int ret = (int)ErrorCode.IK_RTN_OK;
int nImageType = 0;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_IMAGE_WIDTH, ref m_nWidth);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_IMAGE_HEIGHT, ref m_nHeight);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_IMAGE_TYPE, ref nImageType);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_DATA_FORMAT, ref m_nDepth);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_SIZE, ref m_nBufferSize);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
switch (nImageType)
{
case 0:
m_nChannels = 1;
break;
case 1:
case 3:
m_nChannels = 3;
break;
case 2:
case 4:
m_nChannels = 4;
break;
}
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, $"图片类型:{nImageType},通道数:{m_nChannels},size:{m_nWidth}*{m_nHeight}");
m_pUserBuffer = Marshal.AllocHGlobal(m_nBufferSize);
//
hBuffer = new BufferToImage(m_nBufferSize , m_nDepth, m_nChannels , m_nWidth, m_nHeight);
return true;
}
private void clearBuffer()
{
if (m_pUserBuffer == new IntPtr(-1))
return;
Marshal.FreeHGlobal(m_pUserBuffer);
m_pUserBuffer = new IntPtr(-1);
}
}
}

View File

@ -0,0 +1,194 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
namespace LeatherApp.Device.CamerUtil
{
class BufferToImage
{
[DllImport("kernel32.dll")]
public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);
// 缓冲区句柄
public IntPtr m_pBuffer = new IntPtr(-1);
// 缓冲区锁
public object m_mutexBuffer = new object();
// Bitmap锁
public object m_mutexBitmap = new object();
// 缓冲区大小
public int m_nBufferSize = -1;
// 像素位数
public int m_nDepth = -1;
// 图像通道数
public int m_nChannels = -1;
// 图像宽度
public int m_nWidth = -1;
// 图像高度
public int m_nHeight = -1;
// Bitmap
public Bitmap m_bmp = null;
/*
* @brief:
* @param [in] nSize:
* @param [in] nDepth:
* @param [in] nChannels:
* @param [in] nWidth:
* @param [in] nHeight:
*
*/
public BufferToImage(int nSize, int nDepth, int nChannels, int nWidth, int nHeight)
{
m_pBuffer = Marshal.AllocHGlobal(nSize);
m_nBufferSize = nSize;
m_nDepth = nDepth;
m_nChannels = nChannels;
m_nWidth = nWidth;
m_nHeight = nHeight;
PixelFormat nPixelFormat = PixelFormat.Undefined;
switch (nChannels)
{
case 1:
nPixelFormat = PixelFormat.Format8bppIndexed;
break;
case 3:
case 4:
nPixelFormat = PixelFormat.Format24bppRgb;
break;
}
m_bmp = new Bitmap(m_nWidth, m_nHeight, nPixelFormat);
// 如果是灰度图像需要设置调色盘
if (nPixelFormat == System.Drawing.Imaging.PixelFormat.Format8bppIndexed)
{
ColorPalette cp = m_bmp.Palette;
for (int i = 0; i < 256; i++)
cp.Entries[i] = System.Drawing.Color.FromArgb(i, i, i);
m_bmp.Palette = cp;
}
}
/*
* @brief:
* @return:
*/
public void freeBuffer()
{
if (m_pBuffer != new IntPtr(-1))
Marshal.FreeHGlobal(m_pBuffer);
if (m_bmp != null)
m_bmp.Dispose();
m_bmp = null;
}
/*
* @brief:Image
* @param [in] pSrc:
* @return: Image
*/
public Bitmap toBmp(IntPtr pSrc)
{
lock (m_mutexBitmap)
{
lock (m_mutexBuffer)
{
CopyMemory(m_pBuffer, pSrc, m_nBufferSize);
if (m_nChannels == 4)
{
readRGBC();
return (Bitmap)m_bmp.Clone();
}
Rectangle rect = new Rectangle(0, 0, m_bmp.Width, m_bmp.Height);
BitmapData bitmapData = m_bmp.LockBits(rect, ImageLockMode.ReadWrite, m_bmp.PixelFormat);
int nShift = m_nDepth - 8;
int nStride = m_nBufferSize / m_bmp.Height;
// 8bit 像素直接拷贝高于8位的去除低位
if (m_nDepth == 8)
{
for (int i = 0; i < m_bmp.Height; i++)
{
IntPtr iptrDst = bitmapData.Scan0 + bitmapData.Stride * i;
IntPtr iptrSrc = m_pBuffer + nStride * i;
CopyMemory(iptrDst, iptrSrc, nStride);
}
m_bmp.UnlockBits(bitmapData);
}
else
{
short[] pData = new short[m_nBufferSize / 2];
byte[] pDstData = new byte[m_nBufferSize];
nStride = bitmapData.Stride;
Marshal.Copy(m_pBuffer, pData, 0, m_nBufferSize / 2);
for (int i = 0; i < bitmapData.Height; i++)
{
for (int j = 0; j < nStride; j++)
{
pDstData[i * nStride + j] = (byte)(pData[i * nStride + j] >> nShift);
}
}
Marshal.Copy(pDstData, 0, bitmapData.Scan0, (m_nBufferSize / 2));
m_bmp.UnlockBits(bitmapData);
}
return (Bitmap)m_bmp.Clone();
}
}
}
public Image toImage(IntPtr pSrc)
{
return (Image)toBmp(pSrc);
}
/*
* @brief: RGB通道数据
* @return:
*/
public void readRGBC()
{
Rectangle rect = new Rectangle(0, 0, m_bmp.Width, m_bmp.Height);
BitmapData bitmapData = m_bmp.LockBits(rect, ImageLockMode.ReadWrite, m_bmp.PixelFormat);
int nShift = m_nDepth - 8;
int nStride = bitmapData.Stride;
int nCount = 0;
byte[] pByteData = new byte[m_nBufferSize];
byte[] pDstData = new byte[(m_nBufferSize * 3) / 4];
Marshal.Copy(m_pBuffer, pByteData, 0, m_nBufferSize);
if (m_nDepth == 8)
{
for (int i = 0; i < m_bmp.Height; i++)
{
for (int j = 0; j < nStride; j = j + 3)
{
pDstData[i * nStride + j] = (byte)(pByteData[nCount]);
pDstData[i * nStride + j + 1] = (byte)(pByteData[nCount + 1]);
pDstData[i * nStride + j + 2] = (byte)(pByteData[nCount + 2]);
nCount += 4;
}
}
Marshal.Copy(pDstData, 0, bitmapData.Scan0, (m_nBufferSize * 3 / 4));
m_bmp.UnlockBits(bitmapData);
return;
}
short[] pShortData = new short[m_nBufferSize / 2];
Marshal.Copy(m_pBuffer, pShortData, 0, m_nBufferSize / 2);
for (int i = 0; i < bitmapData.Height; i++)
{
for (int j = 0; j < nStride; j = j + 3)
{
pDstData[i * nStride + j] = (byte)(pShortData[nCount] >> nShift);
pDstData[i * nStride + j + 1] = (byte)(pShortData[nCount + 1] >> nShift);
pDstData[i * nStride + j + 2] = (byte)(pShortData[nCount + 2] >> nShift);
nCount += 4;
}
}
Marshal.Copy(pDstData, 0, bitmapData.Scan0, (m_nBufferSize * 3 / 8));
m_bmp.UnlockBits(bitmapData);
}
}
}

View File

@ -0,0 +1,188 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IKapC.NET;
using IKapBoardClassLibrary;
namespace LeatherApp.Device.CamerUtil
{
public class IKDevice
{
// 相机句柄
public IntPtr m_pDev = new IntPtr(-1);
// 采集卡句柄
public IntPtr m_pBoard = new IntPtr(-1);
// 用户缓冲区,用于图像数据转换
public IntPtr m_pUserBuffer = new IntPtr(-1);
// 是否正在采集
public volatile bool m_bGrabingImage = false;
// 是否已更新用户缓冲区
public volatile bool m_bUpdateImage = false;
// 相机类型0为GV相机1为CL相机2为CXP相机
public int m_nType = -1;
// 图像宽度
public int m_nWidth = -1;
// 图像高度
public int m_nHeight = -1;
// 像素位数
public int m_nDepth = 8;
// 图像通道数
public int m_nChannels = 1;
// 相机索引
public int m_nDevIndex = -1;
// 采集卡索引
public int m_nBoardIndex = -1;
// 相机缓冲区个数
public int m_nFrameCount = 2;
// 当前帧索引
public int m_nCurFrameIndex = 0;
// 相机缓冲区大小
public int m_nBufferSize = 0;
// 用户缓冲区锁
public object m_mutexImage = new object();
/*
*@brief:
*@param [in] nDevIndex:
*@param [in] nBoardIndex:
*@return:
*/
public virtual bool openDevice(int nDevIndex, int nBoardIndex)
{
return false;
}
/*
*@brief:
*@param [in]:
*@return:
*/
public virtual bool closeDevice()
{
return false;
}
/*
*@brief:
*@param [in]:
*@return:
*/
public virtual bool isOpen()
{
return false;
}
/*
*@brief:
*@param [in] sFilePath:
*@return:
*/
public virtual bool loadConfiguration(string sFilePath)
{
return false;
}
/*
* @brief:
* @return:
*/
public virtual bool createBuffer()
{
return false;
}
/*
* @brief:
* @return:
*/
public virtual void clearBuffer()
{
}
/*
*@brief:
*@param [in] nCount:
*@return:
*/
public virtual bool startGrab(int nCount)
{
return false;
}
/*
*@brief:
*@param [in]:
*@return:
*/
public virtual bool stopGrab()
{
return false;
}
/*
* @brief:
* @param [in] featureName:
* @param [in] featureValue:
* @return:
*/
public bool setFeatureValue(string featureName, string featureValue)
{
IntPtr itkFeature = new IntPtr(-1);
uint nType = 0;
uint res = IKapCLib.ItkDevAllocFeature(m_pDev, featureName, ref itkFeature);
if (!Check(res))
{
System.Diagnostics.Debug.WriteLine("Camera error:Allocate feature failed");
return false;
}
res = IKapCLib.ItkFeatureGetType(itkFeature, ref nType);
if (!Check(res))
{
System.Diagnostics.Debug.WriteLine("Camera error:Get feature type failed");
return false;
}
switch (nType)
{
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_INT32:
res = IKapCLib.ItkFeatureSetInt32(itkFeature, Convert.ToInt32(featureValue));
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_INT64:
res = IKapCLib.ItkFeatureSetInt64(itkFeature, Convert.ToInt64(featureValue));
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_FLOAT:
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_DOUBLE:
res = IKapCLib.ItkFeatureSetDouble(itkFeature, Convert.ToDouble(featureValue));
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_ENUM:
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_STRING:
res = IKapCLib.ItkFeatureFromString(itkFeature, featureValue);
break;
case (uint)ItkFeatureType.ITKFEATURE_VAL_TYPE_COMMAND:
res = IKapCLib.ItkFeatureExecuteCommand(itkFeature);
break;
}
if (!Check(res))
{
System.Diagnostics.Debug.WriteLine("Camera error:Set feature failed");
return false;
}
return true;
}
/*
*@brief:
*@param [in] err:
*@return:
*/
public static bool Check(uint err)
{
if (err != (uint)ItkStatusErrorId.ITKSTATUS_OK)
{
System.Diagnostics.Debug.WriteLine("Error code: {0}.\n", err.ToString("x8"));
return false;
}
return true;
}
}
}

View File

@ -0,0 +1,247 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using IKapC.NET;
using IKapBoardClassLibrary;
using System.Threading;
namespace LeatherApp.Device.CamerUtil
{
class IKDeviceCL : IKDevice
{
[DllImport("kernel32.dll")]
public static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);
// 回调函数
#region Callback
delegate void IKapCallBackProc(IntPtr pParam);
private IKapCallBackProc OnGrabStartProc;
private IKapCallBackProc OnFrameLostProc;
private IKapCallBackProc OnTimeoutProc;
private IKapCallBackProc OnFrameReadyProc;
private IKapCallBackProc OnGrabStopProc;
#endregion
public IKDeviceCL()
{
m_nType = 1;
}
public override bool openDevice(int nDevIndex, int nBoardIndex)
{
closeDevice();
uint res = IKapCLib.ItkDevOpen((uint)nDevIndex
, (int)(ItkDeviceAccessMode.ITKDEV_VAL_ACCESS_MODE_CONTROL)
, ref m_pDev);
if (!Check(res))
{
System.Diagnostics.Debug.WriteLine("Camera error:Open camera failed");
return false;
}
m_nDevIndex = nDevIndex;
//打开采集卡
m_pBoard = IKapBoard.IKapOpen((uint)BoardType.IKBoardPCIE, (uint)nBoardIndex);
m_nBoardIndex = nBoardIndex;
if (m_pBoard == new IntPtr(-1))
return false;
return true;
}
public override bool isOpen()
{
return m_pDev != new IntPtr(-1) && m_pBoard != new IntPtr(-1);
}
public override bool closeDevice()
{
if (isOpen())
{
IKapBoard.IKapClose(m_pBoard);
IKapCLib.ItkDevClose(m_pDev);
}
return true;
}
public override bool loadConfiguration(string sFilePath)
{
int ret = IKapBoard.IKapLoadConfigurationFromFile(m_pBoard, sFilePath);
return ret == (int)ErrorCode.IK_RTN_OK;
}
public override bool createBuffer()
{
int ret = (int)ErrorCode.IK_RTN_OK;
int nImageType = 0;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_IMAGE_WIDTH, ref m_nWidth);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_IMAGE_HEIGHT, ref m_nHeight);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_IMAGE_TYPE, ref nImageType);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_DATA_FORMAT, ref m_nDepth);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
ret = IKapBoard.IKapGetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_SIZE, ref m_nBufferSize);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
switch (nImageType)
{
case 0:
m_nChannels = 1;
break;
case 1:
case 3:
m_nChannels = 3;
break;
case 2:
case 4:
m_nChannels = 4;
break;
}
m_pUserBuffer = Marshal.AllocHGlobal(m_nBufferSize);
return true;
}
public override void clearBuffer()
{
if (m_pUserBuffer == new IntPtr(-1))
return;
Marshal.FreeHGlobal(m_pUserBuffer);
m_pUserBuffer = new IntPtr(-1);
}
public override bool startGrab(int nCount)
{
int ret;
// 设置抓取模式IKP_GRAB_NON_BLOCK为非阻塞模式
//int grab_mode = (int)GrabMode.IKP_GRAB_NON_BLOCK;
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_GRAB_MODE, grab_mode);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
//// 设置帧传输模式IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT为同步保存模式
//int transfer_mode = (int)FrameTransferMode.IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT;
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_TRANSFER_MODE, transfer_mode);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
// 设置缓冲区格式
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_COUNT, m_nFrameCount);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
//// 设置帧超时时间
//int timeout = -1;
// ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_TIME_OUT, timeout);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
//// 设置采集模式。
////
//// Set grab mode.
//int grab_mode = (int)GrabMode.IKP_GRAB_NON_BLOCK;
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_GRAB_MODE, grab_mode);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
//// 设置传输模式。
////
//// Set transfer mode.
//int transfer_mode = (int)FrameTransferMode.IKP_FRAME_TRANSFER_SYNCHRONOUS_NEXT_EMPTY_WITH_PROTECT;
//ret = IKapBoard.IKapSetInfo(m_pBoard, (uint)INFO_ID.IKP_FRAME_TRANSFER_MODE, transfer_mode);
//if (ret != (int)ErrorCode.IK_RTN_OK)
// return false;
// 注册回调函数
IntPtr hPtr = new IntPtr(-1);
OnGrabStartProc = new IKapCallBackProc(OnGrabStartFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_GrabStart, Marshal.GetFunctionPointerForDelegate(OnGrabStartProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnFrameReadyProc = new IKapCallBackProc(OnFrameReadyFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_FrameReady, Marshal.GetFunctionPointerForDelegate(OnFrameReadyProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnFrameLostProc = new IKapCallBackProc(OnFrameLostFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_FrameLost, Marshal.GetFunctionPointerForDelegate(OnFrameLostProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnTimeoutProc = new IKapCallBackProc(OnTimeoutFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_TimeOut, Marshal.GetFunctionPointerForDelegate(OnTimeoutProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
OnGrabStopProc = new IKapCallBackProc(OnGrabStopFunc);
ret = IKapBoard.IKapRegisterCallback(m_pBoard, (uint)CallBackEvents.IKEvent_GrabStop, Marshal.GetFunctionPointerForDelegate(OnGrabStopProc), hPtr);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
m_bUpdateImage = false;
m_nCurFrameIndex = 0;
ret = IKapBoard.IKapStartGrab(m_pBoard, nCount);
if (ret != (int)ErrorCode.IK_RTN_OK)
return false;
m_bGrabingImage = true;
return true;
}
public override bool stopGrab()
{
IKapBoard.IKapStopGrab(m_pBoard);
do
{
} while (m_bGrabingImage);
return true;
}
#region Callback
// 开始抓帧回调
public void OnGrabStartFunc(IntPtr pParam)
{
Console.WriteLine("Start grabbing image");
}
// 丢帧回调
public void OnFrameLostFunc(IntPtr pParam)
{
Console.WriteLine("Frame lost");
}
// 帧超时回调
public void OnTimeoutFunc(IntPtr pParam)
{
Console.WriteLine("Grab image timeout");
}
// 一帧图像完成回调
public void OnFrameReadyFunc(IntPtr pParam)
{
IntPtr hPtr = new IntPtr(-1);
// 获取当前帧状态
IKapBoard.IKAPBUFFERSTATUS status = new IKapBoard.IKAPBUFFERSTATUS();
IKapBoard.IKapGetBufferStatus(m_pBoard, m_nCurFrameIndex, ref status);
if (status.uFull == 1)
{
IKapBoard.IKapGetBufferAddress(m_pBoard, m_nCurFrameIndex, ref hPtr);
lock (m_mutexImage)
{
CopyMemory(m_pUserBuffer, hPtr, m_nBufferSize);
m_bUpdateImage = true;
}
}
m_nCurFrameIndex++;
m_nCurFrameIndex = m_nCurFrameIndex % m_nFrameCount;
}
// 停止抓取图像回调
public void OnGrabStopFunc(IntPtr pParam)
{
Console.WriteLine("Stop grabbing image");
m_bGrabingImage = false;
}
#endregion
}
}

View File

@ -0,0 +1,701 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using LeatherApp.Utils;
using Models;
using OpenCvSharp;
using OpenCvSharp.Extensions;
namespace LeatherApp.Device
{
public class DefectLib : IDisposable
{
//private const string dll_path = "yoloOrt.dll";
//[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
//extern static IntPtr CreateDetector(string model_path, string labels_path, bool is_gpu, int numberThreads);
private const string dll_path = "yolo_trt.dll";
[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
static extern IntPtr CreateDetector(string model_path);
[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
extern static bool DestroyDetector(IntPtr detector);
/// <summary>
/// 非0值表示成功0表示失败 返回小图张数
/// </summary>
/// <param name="detector"></param>
/// <returns></returns>
[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
static extern int GetBatchSize(IntPtr detector);
//[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
//extern static bool Detect1(IntPtr detector, ref byte bgrs_data,
// int image_num, int width, int height, int channels,
// float conf_threshold, float iou_threshold,
// ref int output, int output_size, ref int object_num);
[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
static extern bool Detect(IntPtr detector, ref byte bgrs_data,
int image_num, int width, int height, int channels,
float conf_threshold, float iou_threshold,
ref float output, int output_size, ref int object_num,
int expand_pixel);
//-----
//private const string dll_path = "yolo_trt .dll";
//[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
//static extern IntPtr CreateDetector(string model_path);
//[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
//static extern bool DestroyDetector(IntPtr detector);
//[DllImport(dll_path, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
//static extern bool Detect(IntPtr detector, ref byte bgrs_data,
// int image_num, int width, int height, int channels,
// float conf_threshold, float iou_threshold,
// ref int output, int output_size, ref int object_num);
//---
private IntPtr detector = IntPtr.Zero;
private readonly int image_width = 2048;
private readonly int image_hight = 2048;
private readonly int image_channels = 3;
private readonly int image_bytes = 2048 * 2048 * 3;
private readonly int detect_elem_size = 7; //维度数据结果x y w h conf classid
private readonly int detect_max_object_num = 20;//这个指的是一张子图可能最多给你返回的目标个球
//
public Action<int, int> QueueCountEvent;//0/1/2, 数量
public Action<DateTime,WarningEnum, string> WarningEvent;
/// <summary>
/// 检测结果JSON(原图,结果)
/// </summary>
public Action<DefectTask> finishEvent;
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
string rootPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
private Thread t_task, t_task_operation ,t_task_maketag;
//=======task list
private List<DefectTask> taskList = new List<DefectTask>();
private List<DefectTask> taskOperationList = new List<DefectTask>();
private List<DefectTask> taskMakeTagList = new List<DefectTask>();
private string preModelName = "";
public DefectLib()
{
}
public bool start()
{
try
{
//detector = CreateDetector(Config.model_path, Config.labels_path, true, 6);
//if (detector == IntPtr.Zero)
// throw new Exception("模型初始化失败!");
preModelName = "";
IsInit = true;
taskList.Clear();
taskOperationList.Clear();
taskMakeTagList.Clear();
t_task = new System.Threading.Thread(runStep);
t_task.IsBackground = true;
t_task.Start();
t_task_operation = new System.Threading.Thread(run2);
t_task_operation.IsBackground = true;
t_task_operation.Start();
t_task_maketag = new System.Threading.Thread(run3);
t_task_maketag.IsBackground = true;
t_task_maketag.Start();
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, ex.Message);
return false;
}
}
public void stop()
{
if (!IsInit) return;
try
{
IsInit = false;
//timer.Elapsed -= Timer_Elapsed;
preModelName = "";
//释放模型
if (detector != IntPtr.Zero)
{
DestroyDetector(detector);
detector = IntPtr.Zero;
}
if (t_task != null)
{
bool b = t_task.Join(5000);
if (!b) t_task.Abort();
t_task = null;
}
if (t_task_operation != null)
{
bool b = t_task_operation.Join(5000);
if (!b) t_task_operation.Abort();
t_task_operation = null;
}
if (t_task_maketag != null)
{
bool b = t_task_maketag.Join(5000);
if (!b) t_task_maketag.Abort();
t_task_maketag = null;
}
taskList.Clear();
taskOperationList.Clear();
taskMakeTagList.Clear();
}
catch { }
}
/// <summary>
///
/// </summary>
/// <param name="sumWidth">多个相机图像总宽(外部去除重合部分)</param>
/// <returns></returns>
public int GetWidthForResize(int sumWidth)
{
int count =(int) Math.Round(sumWidth * 1.0f / image_width, 0);
return count * image_width;
//int count = sumWidth / image_width;
////int remainder = sumWidth % image_width;
//if (count % 2 == 0)
// return count * image_width;
//else
// return count * image_width+ image_width;
}
/// <summary>
/// 保存图片
/// </summary>
/// <param name="Img"></param>图片
/// <param name="pictureUrl"></param>保存路径
/// <param name="pictureName"></param>保存名称
private void SaveImage(Bitmap Img, string pictureUrl, string pictureName)
{
if (!Directory.Exists(pictureUrl))
{
Directory.CreateDirectory(pictureUrl);
}
FileInfo FileUrl = new FileInfo(pictureUrl);//防止路径中有日期导致路径错误
try
{
using (Bitmap bitmap = new Bitmap(Img))
{
using (MemoryStream stream = new MemoryStream())
{
bitmap.Save(stream, ImageFormat.Bmp);
System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
//img.Save(FileUrl +"\\"+ pictureName);
//img.Dispose();
string szURL = FileUrl + "\\" + pictureName;
img.Save(szURL, ImageFormat.Bmp);
img.Dispose();
}
}
}
catch (Exception)
{
if (Img != null)
{
Img.Dispose();
}
}
}
private void runStep()
{
int step = 0;
while (IsInit)
{
if (taskList.Count < 1)
{
Thread.Sleep(0);
continue;
}
//
step = 1;
var task = pop();
try
{
if (task != null)
{
Stopwatch stopwatch = Stopwatch.StartNew();
step =2;
if (preModelName != task.modelName)
{
step = 3;
//先释放模型
if (detector != IntPtr.Zero)
{
step = 4;
DestroyDetector(detector);
detector = IntPtr.Zero;
}
step = 5;
detector = CreateDetector($"./models/{task.modelName}");
if (detector == IntPtr.Zero)
throw new Exception($"模型({task.modelName})初始化失败!");
step = 6;
preModelName = task.modelName;
}
//源图
//Bitmap bmp = yolo1.Read2Bmp(file_path);
//切割图像输入图像格式14208*10640
stopwatch.Start();
//task.resizeBmp = OpenCVUtil.resize( task.bmp.Clone(), task.resize.Width, task.resize.Height);//在外面已做了resize
//Cv2.CvtColor(task.bmp, task.bmpBgr2rgb, ColorConversionCodes.BGR2RGB);
//task.bmps_cut = OpenCVToCutsMat(task.bmpBgr2rgb, image_width, image_hight); //这里cut时之前加的clone
step = 7;
task.bmps_cut = OpenCVToCutsMat(task.bmp, image_width, image_hight); //这里cut时之前加的clone
stopwatch.Stop();
task.stopwatch[0] = stopwatch.ElapsedMilliseconds;
//Resize图像
//stopwatch.Restart();
//task.bmps_resize = yolo1.OpenCVToResizesMat(task.bmps_cut, task.resize.Width, task.resize.Height);
//stopwatch.Stop();
//task.stopwatch[1] = stopwatch.ElapsedMilliseconds;
//预处理模型
//stopwatch.Restart();
//task.tensors = yolo1.PreprocessImageMat(task.bmps_resize);
//stopwatch.Stop();
//task.stopwatch[2] = stopwatch.ElapsedMilliseconds;
step = 8;
lock (taskOperationList)
{
taskOperationList.Add(task);
QueueCountEvent?.BeginInvoke(1, taskOperationList.Count, null, null);
}
step = 9;
}
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"DefectLib task1 err({step}):" + ex.Message);
task.isSucceed = false;
task.resultInfo = ex.Message;
callback(task);
}
}
}
//推理
private void run2()
{
QualifiedLimit qualifiedLimit;
while (IsInit)
{
if (taskOperationList.Count < 1)
{
Thread.Sleep(0);
continue;
}
//
var task = pop2();
int cut_count=0,step = 0;
try
{
if (task != null && task.bmps_cut.Count()>0)
{
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, "DefectLib tasks 运行推理...");
cut_count = task.bmps_cut.Count();
Stopwatch stopwatch = Stopwatch.StartNew();
//====推理(必需单队列)
stopwatch.Start();
// 把数据转为byte数组【h, w, c】的bgr格式第一张在前第二张在后
byte[] imgData = new byte[image_bytes * cut_count];
for (int i = 0; i < cut_count; i++)
Marshal.Copy(task.bmps_cut[i].Data, imgData, image_bytes * i, image_bytes);
step = 1;
stopwatch.Stop();
task.stopwatch[1] = stopwatch.ElapsedMilliseconds;
stopwatch.Restart();
task.output = new float[cut_count * detect_elem_size * detect_max_object_num];
task.output_num = new int[cut_count];
//执行推理
step =2;
bool ok = Detect(detector, ref imgData[0], cut_count, image_width, image_hight, image_channels,
0.25f, 0.45f, ref task.output[0], task.output.Length, ref task.output_num[0],Config.expand_pixel);
//bool ok = Detect(_detector, ref imgData[0], imgs.Count, ImageWidth, image_hight, image_channels,
// 0.25f, 0.45f, ref output[0], output.Length, ref output_num[0]);
step = 3;
stopwatch.Stop();
task.stopwatch[2] = stopwatch.ElapsedMilliseconds;
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"DefectLib tasks 结果推理={ok}");
for (int i = 0; i < cut_count; i++)
task.bmps_cut[i].Dispose();
if (ok == false)
throw new Exception($"推理失败或者输入数组太小({cut_count}");
//
lock (taskMakeTagList)
{
taskMakeTagList.Add(task);
QueueCountEvent?.BeginInvoke(2, taskMakeTagList.Count, null, null);
}
}
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"DefectLib task2 err({step}):({cut_count}){ ex.Message}");
task.isSucceed = false;
task.resultInfo = ex.Message;
callback(task);
}
}
}
//打标
private void run3()
{
QualifiedLimit qualifiedLimit;
while (IsInit)
{
if (taskMakeTagList.Count < 1)
{
Thread.Sleep(0);
continue;
}
//
var task = pop3();
int liStep = 0;
try
{
Stopwatch stopwatch = Stopwatch.StartNew();
stopwatch.Restart();
int cut_count = task.bmps_cut.Count();//上面bmps_cut已销毁
int colNum = task.bmp.Width / image_width;
int rowNum = task.bmp.Height / image_hight;
int count = 0;
liStep = 3;
for (int i = 0; i < cut_count; i++)
{
liStep = i * 100;
task.resultInfo += $"第 {i}/{cut_count} 张小图(大图索引{task.photoIndex}): 缺陷数 = {task.output_num[i]}\n";
//task.resultInfo +=$"大图({task.tag})[{task.bmp.Width}*{task.bmp.Height}],第 {i + 1}/{cut_count} 张小图[{task.bmps_cut[i].Width}*{task.bmps_cut[i].Height}]: 瑕疵output_num = {output_num[i]}\n";
for (int j = 0; j < task.output_num[i]; j++)//缺陷数
{
liStep += j;//0
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"-------");
int index = count * detect_elem_size;
// 打印输出信息(示例代码,根据实际情况进行修改和格式化)
// 获取输出信息
int x = (int)task.output[index];
int y = (int)task.output[index + 1];
int w = (int)task.output[index + 2];
int h = (int)task.output[index + 3];
int classId = (int)task.output[index + 4];
double confidence = Math.Round(task.output[index + 5],2); //置信度
double contrast = Math.Round(task.output[index + 6], 3);//对比度
//y = image_hight-y-h;//转到右下角为原点
count++;
var cmW = Math.Round(w * task.widthRatio / Config.cm2px_x, 2);
var cmH = Math.Round(h * task.widthRatio / Config.cm2px_y, 2);
// 打印输出信息
task.resultInfo += $"----{i}----col:{i % colNum}/{colNum} row:{i / colNum}/{colNum}-----------\n目标:{j + 1} 类别ID:{classId} 置信度:{confidence} 对比度:{contrast} 坐标:({x},{y})-({x + w},{y + h}) 宽高:w={w},h={h}; \n";
//是否满足此产品标准
if (task.qualifiedLimitList != null && task.qualifiedLimitList.Count > 0)
{
qualifiedLimit = task.qualifiedLimitList.FirstOrDefault(m => m.Code == Config.getDefectCode(classId));
if (qualifiedLimit != null)
{
//if ((qualifiedLimit.ZXD > 0 && qualifiedLimit.ZXD > confidence)
// || (qualifiedLimit.ContrastTop + qualifiedLimit.ContrastLower > 0 && x> qualifiedLimit.ContrastLower && x < qualifiedLimit.ContrastTop)
// || (qualifiedLimit.Area > 0 && qualifiedLimit.Area > cmW * cmH))
if (confidence <= qualifiedLimit.ZXD)//confidence > qualifiedLimit.ZXD 是瑕疵 才继续判断下面的两个条件
{
task.resultInfo += $" 置信度不满足此产品瑕疵标准,跳过! \n";
continue;
}
//下限<对比度<上限:不是瑕疵
var ContrastTotal = qualifiedLimit.ContrastTop + qualifiedLimit.ContrastLower;
if (qualifiedLimit.IsOR)
{
if (!(
(qualifiedLimit.Area <= 0 || cmW * cmH >= qualifiedLimit.Area) ||
(ContrastTotal <= 0 || (contrast < qualifiedLimit.ContrastLower || contrast > qualifiedLimit.ContrastTop))))
{
task.resultInfo += $" 不满足此产品瑕疵标准,跳过! \n";
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断不是瑕疵类别ID:{classId} 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])");
continue;
}
}
else
{
if (!(
(qualifiedLimit.Area<=0 || cmW * cmH >= qualifiedLimit.Area) &&
(ContrastTotal <=0 || (contrast < qualifiedLimit.ContrastLower || contrast > qualifiedLimit.ContrastTop))))
{
task.resultInfo += $" 不满足此产品瑕疵标准,跳过! \n";
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断不是瑕疵类别ID:{classId} 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])");
continue;
}
}
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"判断是瑕疵类别ID:{classId} 置信度({confidence},[{qualifiedLimit.ZXD}]); isOr({qualifiedLimit.IsOR}); 面积({cmW * cmH},[{ qualifiedLimit.Area}]); 对比度({contrast},[{qualifiedLimit.ContrastLower}-{qualifiedLimit.ContrastTop}])");
}
}
liStep++;//1
//打标
var point1 = new OpenCvSharp.Point((i % colNum) * image_width + x, (i / colNum) * image_hight + y);
var point2 = new OpenCvSharp.Point(point1.X + w, point1.Y + h);
liStep++;//2
task.resultInfo += $" 转换到大图坐标(px)p1={point1.X},{point1.Y}; p2={point2.X},{point2.Y}\n";
Cv2.Rectangle(task.bmpTag, point1, point2, new Scalar(0.0, 0.0, 255.0), 1);//画打标点
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 行缺陷信息;");
var cmX = Math.Round(point1.X * task.widthRatio / Config.cm2px_x, 2);
var cmY = Math.Round((task.bmp.Height-point1.Y-h) * task.widthRatio / Config.cm2px_y, 2);//外面计Y从右下角为原点
liStep++;//3
task.resultInfo += $" 转换到大图坐标(cm)[widthRatio={task.widthRatio}]x={cmX},y={cmY}; w={cmW},h={cmH}\n";
task.excelTable.Rows.Add($"{task.photoIndex}", cmX, cmY, cmW, cmH, j + 1, classId, confidence, contrast);
liStep++;//4
//切缺陷小图
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"保存第 {count} 个缺陷小图;");
int left, top, decX, decY;
decX = (w > 236 ? 20 : 256 - w) / 2;
decY = (h > 236 ? 20 : 256 - h) / 2;
left = point1.X - decX;
top = point1.Y - decY;
if (left < 0) left = 0;
if (top < 0) top = 0;
int width = w + decX * 2;
int height = h + decY * 2;
if (left + width > task.bmp.Width - 1) width = task.bmp.Width - left - 1;
if (top + height > task.bmp.Height - 1) height = task.bmp.Height - top - 1;
liStep++;//5
Rect roi = new Rect(left, top, width, height);
liStep++;//6
if (height < 1 || width < 1)
{
task.resultInfo += $" 打标到大图坐标Rect(px)left={left},top={top}; width={width},height={height}\n";
task.resultInfo += $" test point1.Y={point1.Y},h={h}; top={top},mat.Height={ task.bmp.Height}\n================\n";
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, task.resultInfo);
}
//保存
//string filename = $"{Config.appBasePath}\\temp\\{task.tag}\\{task.tag}_X{mmX.ToString()}_Y{mmY.ToString()}_W{mmW.ToString()}_H{mmH.ToString()}_目标{j + 1}_类别{classId}_置信度{confidence}.bmp";
//OpenCvSharp.Extensions.BitmapConverter.ToBitmap(new Mat(task.bmp, roi)).Save(filename, ImageFormat.Jpeg);
task.lstDefectBmp.Add(new Mat(task.bmpTag, roi).Clone());
liStep++;//7
//WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"缺陷小图数量:{task.lstDefectBmp.Count}");
}
}
liStep = 99;
stopwatch.Stop();
task.stopwatch[3] = stopwatch.ElapsedMilliseconds;
task.isSucceed = true;
callback(task);
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"DefectLib task3 err({liStep}):" + ex.Message);
task.isSucceed = false;
task.resultInfo = ex.Message;
callback(task);
}
}
}
private void callback(DefectTask task)
{
//返回成功/失败,异步调用
if (task.finishEvent != null || (task.finishEvent = finishEvent) != null)
//task.finishEvent.BeginInvoke(result, errInfo, res => task.finishEvent.EndInvoke(res), null);
System.Threading.ThreadPool.QueueUserWorkItem(waitCallback, task);
}
//异步回调
WaitCallback waitCallback = new WaitCallback(o =>
{
var task = (DefectTask)o;
task.finishEvent(task);
});
/// <summary>
/// 切割(先左右,后上下)
/// </summary>
/// <param name="mat"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
private Mat[] OpenCVToCutsMat(Mat mat, int width, int height)
{
Mat[] array = new Mat[mat.Width / width * mat.Height / height];
int num = 0;
for (int i = 0; i < mat.Height / height; i++)
{
for (int j = 0; j < mat.Width / width; j++)
{
int x = j * width;
int y = i * height;
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(x, y, width, height);
Rect roi = new Rect(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
array[num] = new Mat(mat, roi).Clone();
num++;
}
}
return array;
}
public class DefectTask
{
public DefectTask()
{
// 创建一个 DataTable 对象来存储数据
excelTable = new DataTable("MyData");
// 添加列到 DataTable
excelTable.Columns.Add("FileName", typeof(string));
excelTable.Columns.Add("X", typeof(decimal));
excelTable.Columns.Add("Y", typeof(decimal));
excelTable.Columns.Add("W", typeof(decimal));
excelTable.Columns.Add("H", typeof(decimal));
excelTable.Columns.Add("目标", typeof(int));
excelTable.Columns.Add("类别", typeof(int));
excelTable.Columns.Add("置信度", typeof(decimal));
excelTable.Columns.Add("对比度", typeof(decimal));
// 向 DataTable 中添加数据行
//excelTable.Rows.Add("John Doe", 30);
//excelTable.Rows.Add("Jane Smith", 25);
}
/// <summary>
/// 模型名字
/// </summary>
public string modelName;
public Models.Records record;
//public string bmpPath;//源图路径(仅目录)
/// <summary>
/// 源图(resize后的)
/// </summary>
public Mat bmp;
//public Mat bmpBgr2rgb=new Mat();
public System.Drawing.Size resize = new System.Drawing.Size(224, 224);
//public Mat resizeBmp;//resize后 BGR2RGB图只用于识别
public Mat bmpTag;
/// <summary>
/// 图片索引0-n
/// </summary>
public int photoIndex;//excel中对应的图像路径标识
public float widthRatio;//宽度比例resize前/resize后
//切割后
public Mat[] bmps_cut;
//用于比对参数 }//置信度 面积 对比度
public List<QualifiedLimit> qualifiedLimitList;
//推理后结果用于打标
public float[] output;
public int[] output_num;
//
/// <summary>
/// 完成后回调
/// </summary>
public Action<DefectTask> finishEvent;
//==结果返回
public bool isSucceed;//转换是否成功
public string resultInfo = "";//成功或失败信息
public List<Mat> lstDefectBmp=new List<Mat>();
/// <summary>
/// fileIndex,x_mm,y_mm,w_mm,h_mm,目标,类别ID,置信度
/// </summary>
public DataTable excelTable=new DataTable();
public long[] stopwatch = new long[4];
}
public void add(DefectTask task)
{
lock (taskList)
{
taskList.Add(task);
QueueCountEvent?.BeginInvoke(0, taskList.Count, null, null);
}
}
private DefectTask pop()
{
lock (taskList)
{
if (taskList.Count < 1)
return null;
//int index = 0;// taskList.FindIndex(p => { return p.isSync; });
//if (index < 0) index = 0;
var task = taskList[0];
taskList.RemoveAt(0);
QueueCountEvent?.BeginInvoke(0, taskList.Count, null, null);
return task;
}
}
private DefectTask pop2()
{
lock (taskOperationList)
{
if (taskOperationList.Count < 1)
return null;
//int index = 0;// taskList.FindIndex(p => { return p.isSync; });
//if (index < 0) index = 0;
var task = taskOperationList[0];
taskOperationList.RemoveAt(0);
QueueCountEvent?.BeginInvoke(1, taskOperationList.Count, null, null);
return task;
}
}
private DefectTask pop3()
{
lock (taskMakeTagList)
{
if (taskMakeTagList.Count < 1)
return null;
//int index = 0;// taskList.FindIndex(p => { return p.isSync; });
//if (index < 0) index = 0;
var task = taskMakeTagList[0];
taskMakeTagList.RemoveAt(0);
QueueCountEvent?.BeginInvoke(2, taskMakeTagList.Count, null, null);
return task;
}
}
public void Dispose()
{
stop();
}
}
}

View File

@ -0,0 +1,283 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Automation.BDaq;
using Newtonsoft.Json.Linq;
namespace LeatherApp.Device
{
public class IOCardDev : IDisposable
{
private Automation.BDaq.InstantDiCtrl instantDiCtrl1;
private Automation.BDaq.InstantDoCtrl instantDoCtrl;
public string DeviceNum { get; private set; }
/// <summary>
/// 读取输入端口数量
/// </summary>
public int DIPortCount { get; private set; }
/// <summary>
/// 写入输出端口数量
/// </summary>
public int DOPortCount { get; private set; }
/// <summary>
/// 读取到的输入值
/// </summary>
public byte[] DIData { get; private set; }
public byte[] DOData { get; private set; }
/// <summary>
/// Log输出
/// </summary>
public Action<DateTime,WarningEnum, string> WarningEvent;
public Action<int, byte> INEvent;
public Action<int, byte> OUTEvent;
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
private System.Timers.Timer timer = new System.Timers.Timer();
//频闪使用
private System.Timers.Timer timerStrobe = new System.Timers.Timer();
private List<string> strobeList = new List<string>();
public IOCardDev()
{
}
public bool start(string deviceNum = "")
{
try
{
instantDiCtrl1 = new Automation.BDaq.InstantDiCtrl();
instantDoCtrl = new Automation.BDaq.InstantDoCtrl();
strobeList = new List<string>();
if (deviceNum != "")
{
instantDiCtrl1.SelectedDevice = new Automation.BDaq.DeviceInformation(deviceNum);
instantDoCtrl.SelectedDevice = new DeviceInformation(deviceNum);
}
//根据加载的文件设置设备的所有配置
string cfgPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\DevCfg\\IOCard_1703.xml";
if (File.Exists(cfgPath))
{
var result = instantDiCtrl1.LoadProfile(cfgPath);//Loads a profile to initialize the device.
var result2 = instantDoCtrl.LoadProfile(cfgPath);//Loads a profile to initialize the device.
if (BioFailed(result) && BioFailed(result2))
throw new Exception("CardIO Load Config Failed With Error Code: [" + result.ToString() + "]");
}
DeviceNum = instantDiCtrl1.SelectedDevice.Description;
DIPortCount = instantDiCtrl1.Features.PortCount;
DIData = new byte[DIPortCount];
DOPortCount = instantDoCtrl.Features.PortCount;
DOData = new byte[DOPortCount];
loadDOData();
IsInit = true;
timer.Elapsed += Timer_Elapsed;
timer.Interval = 100;
timer.Start();
timerStrobe.Elapsed += timerStrobe_Elapsed;
timerStrobe.Interval = 500;
timerStrobe.Start();
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, ex.Message);
return false;
}
}
public void stop()
{
if (!IsInit) return;
IsInit = false;
strobeList.Clear();//闪烁状态清空
timer.Stop();
timerStrobe.Stop();
//instantDiCtrl1.Cleanup();
instantDiCtrl1.Dispose();
//instantDoCtrl.Cleanup();
instantDoCtrl.Dispose();
}
private void loadDOData(int portIndex = -1)
{
for (int i = 0; i < DOPortCount; ++i)
{
if (i == portIndex || portIndex < 0)
{
byte data;
var reuslt = instantDoCtrl.Read(i, out data);
if (reuslt != Automation.BDaq.ErrorCode.Success)
throw new Exception("加载CardIO输出状态失败");
if (DOData[i] != data)
{
DOData[i] = data;
//Config.HeightDevIOState = compareIOHeightDev();
//WarningEvent(WarningEnum.Normal, "厚度气缸状态:" + Config.HeightDevIOState.ToString());
OUTEvent?.Invoke(i, DOData[i]);
}
}
}
}
//private bool compareIOHeightDev()
//{
// if (!Config.CMDProcess.ContainsKey(CMDName.厚度气缸与轴运动告警))
// return false;
// JObject joJson = Config.CMDProcess[CMDName.厚度气缸与轴运动告警];
// var outDatas = joJson.Value<JArray>("OUT_OP_SHOW");
// var data = Utils.Util.IOFormatBinary2bytes(outDatas.ToObject<List<string>>().ToArray());
// for (int i = 0; i < data.Length; i++)
// {
// if (data[i] > 0 && (data[i] & DOData[i]) == data[i])//这里只找了一个
// {
// return true;
// }
// }
// return false;
//}
/// <summary>
/// 复位全置0
/// </summary>
/// <returns></returns>
public bool reset()
{
strobeList.Clear();//闪烁状态清空
byte[] data = new byte[DOPortCount];
for (int i = 0; i < data.Length; ++i)
data[i] = 0;
var reuslt = instantDoCtrl.Write(0, data.Length, data);
if (BioFailed(reuslt))
return false;
loadDOData();
return true;
}
/// <summary>
/// 闪烁状态会清空
/// </summary>
/// <param name="startPort"></param>
/// <param name="data"></param>
/// <returns></returns>
public bool writeData(int startPort, byte[] data)
{
strobeList.Clear();//闪烁状态清空
var reuslt = instantDoCtrl.Write(startPort, data.Length, data);
if (BioFailed(reuslt))
return false;
loadDOData(data.Length == 1 ? startPort : -1);
return true;
}
/// <summary>
///
/// </summary>
/// <param name="portIndex"></param>
/// <param name="bitIndex"></param>
/// <param name="state"></param>
/// <param name="isStrobe">频闪</param>
/// <returns></returns>
public bool writeBitState(int portIndex, int bitIndex, bool state, bool isStrobe = false)
{
//byte bit = (byte)(DOData[portIndex] & (byte)(0x01<<bitIndex));
//if (bit > 0 && state) return true;
//if (bit == 0 && !state) return true;
//byte data = DOData[portIndex];
//data &= (byte)(~(0x1 << bitIndex));
//data |= (byte)((state ? 1 : 0) << bitIndex);
//var reuslt = instantDoCtrl.Write(startPort, len, data);
var reuslt = instantDoCtrl.WriteBit(portIndex, bitIndex, (byte)(state ? 1 : 0));// (byte)((state ? 1 : 0) << bitIndex));
if (BioFailed(reuslt))
return false;
loadDOData(portIndex);
string key = portIndex + "|" + bitIndex;
if (state && isStrobe)
strobeList.Add(key);
else if (strobeList.Contains(key))
strobeList.Remove(key);
return true;
}
public bool getDIBitState(int portIndex, int bitIndex)
{
byte data = 0x01;
data = (byte)(data << bitIndex);
return (DIData[portIndex] & data) > 0;
}
public bool getDOBitState(int portIndex, int bitIndex)
{
byte data = 0x01;
data = (byte)(data << bitIndex);
return (DOData[portIndex] & data) > 0;
}
private bool strobeState = true;
private void timerStrobe_Elapsed(object sender, ElapsedEventArgs e)
{
if (!IsInit) return;
string[] key;
for (int i = 0; i < strobeList.Count; i++)
{
key = strobeList[i].Split('|');
instantDoCtrl.WriteBit(Convert.ToInt16(key[0]), Convert.ToInt16(key[1]), (byte)(strobeState ? 1 : 0));
}
strobeState = !strobeState;
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (!IsInit) return;
timer.Stop();
//byte data = 0;//data is used to the API ReadBit.
//int bit = 0;//bit is used to the API ReadBit.
Automation.BDaq.ErrorCode result;
int startPort = 0;
byte[] datas = new byte[DIPortCount];
do
{
result = instantDiCtrl1.Read(startPort, DIPortCount, datas);
//errorCode = instantDiCtrl.ReadBit(startPort, bit, out data);
if (BioFailed(result))
{
//throw new Exception();
continue;
}
for (int i = 0; i < datas.Length; i++)
{
if (DIData[i] != datas[i])
{
DIData[i] = datas[i];
INEvent?.Invoke(i, DIData[i]);
}
}
Thread.Sleep(10);
} while (IsInit);
}
private static bool BioFailed(Automation.BDaq.ErrorCode err)
{
return err < Automation.BDaq.ErrorCode.Success && err >= Automation.BDaq.ErrorCode.ErrorHandleNotValid;
}
public void Dispose()
{
stop();
}
}
}

View File

@ -0,0 +1,194 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace LeatherApp.Device
{
public class LightDev : IDisposable
{
#region (Rsee) X86DLL 64
//comHandle = RseeController_OpenCom(PortName, 19200, true); //Com_Handle!=0成功
[DllImport(@"RseeController.dll", EntryPoint = "RseeController_OpenCom", CallingConvention = CallingConvention.Cdecl)]
private extern static IntPtr RseeController_OpenCom(string szPort, int Baud_rate, bool overlapped);
//关闭传上面打开返回的comHandle
[DllImport(@"RseeController.dll", EntryPoint = "RseeController_CloseCom", CallingConvention = CallingConvention.Cdecl)]
private extern static bool RseeController_CloseCom(string szPort, IntPtr comHandle);
//设置新值 channel通道号:1-4
//[DllImport(@"RseeController.dll", EntryPoint = "RseeController_PM_D_BRTSetChannel", CallingConvention = CallingConvention.Cdecl)]
//private extern static int RseeController_PM_D_BRTSetChannel(int comHandle, int channel, int range);
////读取当前值
//[DllImport(@"RseeController.dll", EntryPoint = "RseeController_PM_D_BRTReadChannel", CallingConvention = CallingConvention.Cdecl)]
//private static extern unsafe int RseeController_PM_D_BRTReadChannel(int comHandle, int channel, int* range);
//AHC系列
/// <summary>
/// 设置通道亮度等级
/// </summary>
/// <param name="comHandle"></param>
/// <param name="channel">通道序号范围1-2</param>
/// <param name="range">亮度等级范围0-255</param>
/// <returns>0 - 设置发送成功; -1 - 串口未初始化; -2 - 输入参数范围有误</returns>
[DllImport(@"RseeController.dll", EntryPoint = "RseeController_AHC_SetChannel", CallingConvention = CallingConvention.Cdecl)]
private extern static int RseeController_AHC_SetChannel(IntPtr comHandle, int channel, int range);
/// <summary>
/// 读取通道亮度等级
/// </summary>
/// <param name="comHandle"></param>
/// <param name="channel">通道序号范围1-2</param>
/// <returns>大于等于0 - 通道亮度等级; -1 串口/网口未初始化; -2 - 输入参数范围有误; -3 - 读取返回出错</returns>
[DllImport(@"RseeController.dll", EntryPoint = "RseeController_AHC_ReadChannel", CallingConvention = CallingConvention.Cdecl)]
private extern static int RseeController_AHC_ReadChannel(IntPtr comHandle, int channel);
/// <summary>
/// 设置一个通道常亮/常灭
/// </summary>
/// <param name="comHandle"></param>
/// <param name="mode">state - 0常灭1常亮</param>
/// <returns></returns>
[DllImport(@"RseeController.dll", EntryPoint = "RseeController_AHC_SetOnoff", CallingConvention = CallingConvention.Cdecl)]
private extern static int RseeController_AHC_SetOnoff(IntPtr comHandle, bool state);
#endregion
private IntPtr Com_Handle;
private LightDevNameEnum devName;
private long portHandle;
private string comName;
/// <summary>
/// 光源亮度值
/// </summary>
public int DigitalValue { get; private set; }
public Action<DateTime,WarningEnum, string> WarningEvent;
/// <summary>
/// 光源亮度值<通道号,亮度值0-255>
/// </summary>
public Action<int, int> DigitalEvent;
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
//private System.Timers.Timer timer = new System.Timers.Timer();
public LightDev(LightDevNameEnum _devName)
{
devName = _devName;
}
public bool start(int comNum)
{
try
{
if (devName == LightDevNameEnum.)
{
//int result = CreateSerialPort(comNum, ref portHandle); //创建串口
//if (result != SUCCESS)
// throw new Exception($"打开光源设备(COM{comNum})失败: {result}");
}
else if (devName == LightDevNameEnum.)
{
Com_Handle = RseeController_OpenCom("COM" + comNum, 19200, true);
if (Com_Handle == IntPtr.Zero)
throw new Exception($"打开光源设备(COM{comNum})失败;");
comName = "COM" + comNum;
//常亮
var res=RseeController_AHC_SetOnoff(Com_Handle,true);
WarningEvent?.Invoke(DateTime.Now, WarningEnum.Normal, "常亮res:" + res);
}
else
throw new Exception($"打开光源设备失败,未知设备型号!");
IsInit = true;
//timer.Elapsed += Timer_Elapsed;
//timer.Interval = 100;
//timer.Enabled = true;
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, ex.Message);
return false;
}
}
public void stop()
{
if (!IsInit) return;
try
{
IsInit = false;
//timer.Elapsed -= Timer_Elapsed;
//timer.Stop();
if (devName == LightDevNameEnum.)
;
//ReleaseSerialPort(portHandle); //断开串口
else if (devName == LightDevNameEnum.)
RseeController_CloseCom(comName, Com_Handle);
}
catch { }
}
public unsafe int getDigitalValue(int channelIndex)
{
if (!IsInit) return -1;
int value = 0;
if (devName == LightDevNameEnum.)
{
//if (GetDigitalValue(ref value, channelIndex, portHandle) != SUCCESS)
return -1;
}
else if (devName == LightDevNameEnum.)
{
value = RseeController_AHC_ReadChannel(Com_Handle, channelIndex);
if (value<0)
return -1;
}
else
return -1;
DigitalEvent?.Invoke(channelIndex, value);
return value;
}
/// <summary>
/// 设置亮度值
/// </summary>
/// <param name="channelIndex">通道</param>
/// <param name="value">0-255</param>
/// <returns></returns>
public bool setDigitalValue(int channelIndex, int value)
{
if (!IsInit) return false;
//Task.Factory.StartNew(() => {
if (devName == LightDevNameEnum.)
{
//if (SetDigitalValue(channelIndex, value, portHandle) != SUCCESS)
return false;
}
else if (devName == LightDevNameEnum.)
{
var res = RseeController_AHC_SetChannel(Com_Handle, channelIndex, value);
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.Normal, res.ToString(),null,null);
if (res != 0)
return false;
}
//});
return true;
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (!IsInit) return;
}
public void Dispose()
{
stop();
}
}
}

View File

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using LeatherApp.Utils;
using Models;
using OpenCvSharp;
using OpenCvSharp.Extensions;
using S7.Net;
namespace LeatherApp.Device
{
/// <summary>
/// PLC操作类
/// </summary>
public class PLCDev : IDisposable
{
private Plc devPlc;
public Action<DateTime,WarningEnum, string> WarningEvent;
/// <summary>
/// 运行状态
/// </summary>
public Action<bool> RuningStateChangeEvent;
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
private Thread t_task1;
public bool? devRunningState { get; private set; }
public PLCDev()
{
}
public bool start(CpuType cpu, string iPAdrees, short rack, short slot)
{
try
{
devPlc = new Plc(cpu, iPAdrees, rack, slot);
devPlc.Open();
if (!devPlc.IsConnected) throw new Exception("Plc连接失败");
IsInit = true;
t_task1 = new System.Threading.Thread(run1);
t_task1.IsBackground = true;
t_task1.Start();
return true;
}
catch (Exception ex)
{
WarningEvent?.BeginInvoke(DateTime.Now,WarningEnum.High, ex.Message,null,null);
return false;
}
}
public void stop()
{
if (!IsInit) return;
try
{
IsInit = false;
//timer.Elapsed -= Timer_Elapsed;
if (t_task1 != null)
{
bool b = t_task1.Join(1000);
if (!b) t_task1.Abort();
t_task1 = null;
}
devPlc.Close();
}
catch { }
}
private void run1()
{
while (IsInit)
{
//1.3
bool res = (Boolean)devPlc.Read("DB3.DBX1.3");
if (devRunningState == null || devRunningState != res)
{
devRunningState = res;
RuningStateChangeEvent?.Invoke(res);
}
Thread.Sleep(100);
}
}
/// <summary>
/// 启动DEV
/// </summary>
public void runDev()
{
if (IsInit)
{
devPlc.Write("DB3.DBX0.1", false);
devPlc.Write("DB3.DBX0.0", true);//启动
}
}
/// <summary>
/// 停止DEV
/// </summary>
public void pauseDev()
{
if (IsInit)
{
devPlc.Write("DB3.DBX0.0", false);
devPlc.Write("DB3.DBX0.1", true);//停止
}
}
//private void callback(PhotoTask task)
//{
// //返回成功/失败,异步调用
// if (task.finishEvent != null || (task.finishEvent = finishEvent) != null)
// //task.finishEvent.BeginInvoke(result, errInfo, res => task.finishEvent.EndInvoke(res), null);
// System.Threading.ThreadPool.QueueUserWorkItem(waitCallback, task);
//}
////异步回调
//WaitCallback waitCallback = new WaitCallback(o =>
//{
// var task = (PhotoTask)o;
// task.finishEvent(task);
//});
public void Dispose()
{
stop();
}
}
}

View File

@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using LeatherApp.Utils;
using Models;
using OpenCvSharp;
using OpenCvSharp.Extensions;
namespace LeatherApp.Device
{
public class PhotoLib : IDisposable
{
public Action<int> QueueCountEvent;//0/1/2, 数量
public Action<DateTime,WarningEnum, string> WarningEvent;
/// <summary>
/// 结果
/// </summary>
public Action<PhotoTask> finishEvent;
/// <summary>
/// 是否打开设备成功
/// </summary>
public bool IsInit { get; private set; } = false;
private Thread t_task1;
private List<PhotoTask> lstTask1 = new List<PhotoTask>();
//private Thread t_task2;
//private List<DefectTask> lstTask2 = new List<DefectTask>();
public PhotoLib()
{
}
public bool start()
{
try
{
IsInit = true;
lstTask1.Clear();
t_task1 = new System.Threading.Thread(run1);
t_task1.IsBackground = true;
t_task1.Start();
//t_task_operation = new System.Threading.Thread(run2);
//t_task_operation.IsBackground = true;
//t_task_operation.Start();
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.High, ex.Message);
return false;
}
}
public void stop()
{
if (!IsInit) return;
try
{
IsInit = false;
//timer.Elapsed -= Timer_Elapsed;
if (t_task1 != null)
{
bool b = t_task1.Join(5000);
if (!b) t_task1.Abort();
t_task1 = null;
}
//if (t_task_operation != null)
//{
// bool b = t_task_operation.Join(5000);
// if (!b) t_task_operation.Abort();
// t_task_operation = null;
//}
lstTask1.Clear();
//lstTask2.Clear();
}
catch { }
}
//推理+打标
private void run1()
{
while (IsInit)
{
if (lstTask1.Count < 1)
{
Thread.Sleep(0);
continue;
}
//
var task = pop();
//try
//{
if (task != null)
{
task.finishEvent(task);
}
//}
//catch (Exception ex)
//{
// WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, $"DefectLib task2 err({liStep}):" + ex.Message);
// task.isSucceed = false;
// task.resultInfo = ex.Message;
// callback(task);
//}
}
}
private void callback(PhotoTask task)
{
//返回成功/失败,异步调用
if (task.finishEvent != null || (task.finishEvent = finishEvent) != null)
//task.finishEvent.BeginInvoke(result, errInfo, res => task.finishEvent.EndInvoke(res), null);
System.Threading.ThreadPool.QueueUserWorkItem(waitCallback, task);
}
//异步回调
WaitCallback waitCallback = new WaitCallback(o =>
{
var task = (PhotoTask)o;
task.finishEvent(task);
});
public class PhotoTask
{
public Records record;
public object scanPhotos0;
public object scanPhotos1;
//
/// <summary>
/// 完成后回调
/// </summary>
public Action<PhotoTask> finishEvent;
//==结果返回
//public bool isSucceed;//转换是否成功
//public string resultInfo = "";//成功或失败信息
//public long[] stopwatch = new long[5];
}
public void add(PhotoTask task)
{
lock (lstTask1)
{
lstTask1.Add(task);
QueueCountEvent?.BeginInvoke(lstTask1.Count, null, null);
}
}
private PhotoTask pop()
{
lock (lstTask1)
{
if (lstTask1.Count < 1)
return null;
var task = lstTask1[0];
lstTask1.RemoveAt(0);
QueueCountEvent?.BeginInvoke(lstTask1.Count, null, null);
return task;
}
}
public void Dispose()
{
stop();
}
}
}

View File

@ -0,0 +1,316 @@
using MvCodeReaderSDKNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace LeatherApp.Device
{
/// <summary>
/// 扫描器操作类
/// </summary>
public class ScannerCodeDev
{
public Action<DateTime,WarningEnum, string> WarningEvent;
public Action<string> ScanerEvent;
//
MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST m_stDeviceList;
private MvCodeReader m_cMyDevice;
bool m_bGrabbing = false;
Thread m_hReceiveThread = null;
public bool start(int devIndex=0)
{
try
{
m_stDeviceList = new MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST();
m_cMyDevice = new MvCodeReader();
//====枚举设备
if (!DeviceListAcq())
return false;
//====打开设置
if (m_stDeviceList.nDeviceNum == 0 )
{
ShowErrorMsg("No stDevInfo, please select", 0);
return false;
}
// ch:获取选择的设备信息 | en:Get selected stDevInfo information
MvCodeReader.MV_CODEREADER_DEVICE_INFO stDevInfo =
(MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(m_stDeviceList.pDeviceInfo[devIndex],
typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
// ch:打开设备 | en:Open stDevInfo
if (null == m_cMyDevice)
{
m_cMyDevice = new MvCodeReader();
if (null == m_cMyDevice)
{
return false;
}
}
int nRet = m_cMyDevice.MV_CODEREADER_CreateHandle_NET(ref stDevInfo);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
ShowErrorMsg("MV_CODEREADER_CreateHandle_NET fail!", nRet);
return false;
}
nRet = m_cMyDevice.MV_CODEREADER_OpenDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
m_cMyDevice.MV_CODEREADER_DestroyHandle_NET();
ShowErrorMsg("Device open fail!", nRet);
return false;
}
// ch:设置采集连续模式 | en:Set Continues Aquisition Mode
nRet = m_cMyDevice.MV_CODEREADER_SetEnumValue_NET("TriggerMode", (uint)MvCodeReader.MV_CODEREADER_TRIGGER_MODE.MV_CODEREADER_TRIGGER_MODE_OFF);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
ShowErrorMsg("Set TriggerMode Off Fail!", nRet);
return false;
}
//bnGetParam_Click(null, null);// ch:获取参数 | en:Get parameters
//====开始采集
// ch:标志位置位true | en:Set position bit true
m_hReceiveThread = new Thread(ReceiveThreadProcess);
m_hReceiveThread.Start();
m_bGrabbing = true;
// ch:开始采集 | en:Start Grabbing
nRet = m_cMyDevice.MV_CODEREADER_StartGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
stop();
//m_bGrabbing = false;
//m_hReceiveThread.Join();
ShowErrorMsg("Start Grabbing Fail!", nRet);
return false;
}
return true;
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, ex.Message);
return false;
}
}
public bool stop()
{
if (!m_bGrabbing) return true;
try
{
// ch:标志位设为false | en:Set flag bit false
m_bGrabbing = false;
// ch:停止采集 | en:Stop Grabbing
int nRet = m_cMyDevice.MV_CODEREADER_StopGrabbing_NET();
if (nRet != MvCodeReader.MV_CODEREADER_OK)
{
ShowErrorMsg("Stop Grabbing Fail!", nRet);
}
if (null != m_hReceiveThread)
{
m_hReceiveThread.Join();
}
//==关闭设备
// ch:取流标志位清零 | en:Reset flow flag bit
if (m_bGrabbing == true)
{
m_bGrabbing = false;
// ch:停止采集 | en:Stop Grabbing
m_cMyDevice.MV_CODEREADER_StopGrabbing_NET();
m_hReceiveThread.Join();
}
// ch:关闭设备 | en:Close Device
m_cMyDevice.MV_CODEREADER_CloseDevice_NET();
m_cMyDevice.MV_CODEREADER_DestroyHandle_NET();
return true;
}
catch
{
return false;
}
}
//枚举设备
private bool DeviceListAcq()
{
// ch:创建设备列表 | en:Create Device List
System.GC.Collect();
m_stDeviceList.nDeviceNum = 0;
int nRet = MvCodeReader.MV_CODEREADER_EnumDevices_NET(ref m_stDeviceList, MvCodeReader.MV_CODEREADER_GIGE_DEVICE);
if (0 != nRet)
{
ShowErrorMsg("Enumerate devices fail!", nRet);
return false;
}
if (0 == m_stDeviceList.nDeviceNum)
{
ShowErrorMsg("None Device!", 0);
return false;
}
return true;
}
//设置连续模式
private bool setMode()
{
int nRet = m_cMyDevice.MV_CODEREADER_SetEnumValue_NET("TriggerMode", (uint)MvCodeReader.MV_CODEREADER_TRIGGER_MODE.MV_CODEREADER_TRIGGER_MODE_OFF);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
ShowErrorMsg("Set TriggerMode Off Fail!", nRet);
return false;
}
return true;
}
public void ReceiveThreadProcess()
{
int nRet = MvCodeReader.MV_CODEREADER_OK;
IntPtr pData = IntPtr.Zero;
MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfoEx2 = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2();
IntPtr pstFrameInfoEx2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)));
Marshal.StructureToPtr(stFrameInfoEx2, pstFrameInfoEx2, false);
while (m_bGrabbing)
{
nRet = m_cMyDevice.MV_CODEREADER_GetOneFrameTimeoutEx2_NET(ref pData, pstFrameInfoEx2, 1000);
if (nRet == MvCodeReader.MV_CODEREADER_OK)
{
stFrameInfoEx2 = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2));
}
if (nRet == MvCodeReader.MV_CODEREADER_OK)
{
if (0 >= stFrameInfoEx2.nFrameLen)
{
continue;
}
MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResultEx2 = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfoEx2.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2));
List<string> barCodes = new List<string>();
for (int i = 0; i < stBcrResultEx2.nCodeNum; ++i)
{
//DataGridViewRow cDataRow = new DataGridViewRow();
//cDataRow.CreateCells(dataGridView1);
//cDataRow.Cells[0].Value = this.dataGridView1.Rows.Count;
//DateTime cDateTime = DateTime.Now;
//cDataRow.Cells[1].Value = cDateTime.ToString();
//cDataRow.Cells[2].Value = stBcrResultEx2.stBcrInfoEx2[i].nTotalProcCost.ToString();
//cDataRow.Cells[3].Value = stBcrResultEx2.stBcrInfoEx2[i].sAlgoCost.ToString();
//cDataRow.Cells[4].Value = stBcrResultEx2.stBcrInfoEx2[i].sPPM.ToString();
//cDataRow.Cells[5].Value = GetBarType((MvCodeReader.MV_CODEREADER_CODE_TYPE)stBcrResultEx2.stBcrInfoEx2[i].nBarType);
String strCode = System.Text.Encoding.Default.GetString(stBcrResultEx2.stBcrInfoEx2[i].chCode);
//cDataRow.Cells[6].Value = String.IsNullOrEmpty(strCode) ? "NoRead" : strCode;//barcode
//cDataRow.Cells[7].Value = stBcrResultEx2.stBcrInfoEx2[i].stCodeQuality.nOverQuality.ToString();
//cDataRow.Cells[8].Value = stBcrResultEx2.stBcrInfoEx2[i].nIDRScore.ToString();
if (!String.IsNullOrEmpty(strCode))
barCodes.Add(strCode.Replace("\0", "").Trim());
}
ScanerEvent?.BeginInvoke(barCodes[0], null, null);
}
}
}
private static String GetBarType(MvCodeReader.MV_CODEREADER_CODE_TYPE nBarType)
{
switch (nBarType)
{
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_TDCR_DM:
return "DM码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_TDCR_QR:
return "QR码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_EAN8:
return "EAN8码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_UPCE:
return "UPCE码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_UPCA:
return "UPCA码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_EAN13:
return "EAN13码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_ISBN13:
return "ISBN13码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_CODABAR:
return "库德巴码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_ITF25:
return "交叉25码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_CODE39:
return " Code 39码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_CODE93:
return "Code 93码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_CODE128:
return "Code 128码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_TDCR_PDF417:
return "PDF417码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_MATRIX25:
return "MATRIX25码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_MSI:
return "MSI码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_CODE11:
return "Code 11码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_INDUSTRIAL25:
return "industria125码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_CHINAPOST:
return "中国邮政码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_BCR_ITF14:
return "交叉14码";
case MvCodeReader.MV_CODEREADER_CODE_TYPE.MV_CODEREADER_TDCR_ECC140:
return "ECC140码";
default:
return "/";
}
}
// ch:显示错误信息 | en:Show error message
private void ShowErrorMsg(string csMessage, int nErrorNum)
{
string errorMsg;
if (nErrorNum == 0)
{
errorMsg = csMessage;
}
else
{
errorMsg = csMessage + ": Error =" + String.Format("{0:X}", nErrorNum);
}
switch (nErrorNum)
{
case MvCodeReader.MV_CODEREADER_E_HANDLE: errorMsg += " Error or invalid handle "; break;
case MvCodeReader.MV_CODEREADER_E_SUPPORT: errorMsg += " Not supported function "; break;
case MvCodeReader.MV_CODEREADER_E_BUFOVER: errorMsg += " Cache is full "; break;
case MvCodeReader.MV_CODEREADER_E_CALLORDER: errorMsg += " Function calling order error "; break;
case MvCodeReader.MV_CODEREADER_E_PARAMETER: errorMsg += " Incorrect parameter "; break;
case MvCodeReader.MV_CODEREADER_E_RESOURCE: errorMsg += " Applying resource failed "; break;
case MvCodeReader.MV_CODEREADER_E_NODATA: errorMsg += " No data "; break;
case MvCodeReader.MV_CODEREADER_E_PRECONDITION: errorMsg += " Precondition error, or running environment changed "; break;
case MvCodeReader.MV_CODEREADER_E_VERSION: errorMsg += " Version mismatches "; break;
case MvCodeReader.MV_CODEREADER_E_NOENOUGH_BUF: errorMsg += " Insufficient memory "; break;
case MvCodeReader.MV_CODEREADER_E_UNKNOW: errorMsg += " Unknown error "; break;
case MvCodeReader.MV_CODEREADER_E_GC_GENERIC: errorMsg += " General error "; break;
case MvCodeReader.MV_CODEREADER_E_GC_ACCESS: errorMsg += " Node accessing condition error "; break;
case MvCodeReader.MV_CODEREADER_E_ACCESS_DENIED: errorMsg += " No permission "; break;
case MvCodeReader.MV_CODEREADER_E_BUSY: errorMsg += " Device is busy, or network disconnected "; break;
case MvCodeReader.MV_CODEREADER_E_NETER: errorMsg += " Network error "; break;
}
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Low, errorMsg);
}
}
}

View File

@ -0,0 +1,318 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace LeatherApp.Device
{
public class ScannerCodeDev2 : IDisposable
{
#region WIN32API
//private const int WM_KEYDOWN = 0x100;//KEYDOWN       
//private const int WM_KEYUP = 0x101;//KEYUP       
//private const int WM_SYSKEYDOWN = 0x104;//SYSKEYDOWN       
//private const int WM_SYSKEYUP = 0x105;//SYSKEYUP
//private static int HookProc(int nCode, Int32 wParam, IntPtr lParam);
private int hKeyboardHook = 0;//声明键盘钩子处理的初始值
private ScanerCodes codes = new ScanerCodes();//13为键盘钩子
//定义成静态,这样不会抛出回收异常
private static HookProc hookproc;
delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]     //设置钩子
private static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]     //卸载钩子
private static extern bool UnhookWindowsHookEx(int idHook);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] //继续下个钩子
private static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr lParam);
[DllImport("user32", EntryPoint = "GetKeyNameText")]
private static extern int GetKeyNameText(int IParam, StringBuilder lpBuffer, int nSize);
[DllImport("user32", EntryPoint = "GetKeyboardState")]     //获取按键的状态
private static extern int GetKeyboardState(byte[] pbKeyState);
[DllImport("user32", EntryPoint = "ToAscii")]     //ToAscii职能的转换指定的虚拟键码和键盘状态的相应字符或字符
private static extern bool ToAscii(int VirtualKey, int ScanCode, byte[] lpKeySate, ref uint lpChar, int uFlags);
//int VirtualKey //[in] 指定虚拟关键代码进行翻译。      
//int uScanCode, // [in] 指定的硬件扫描码的关键须翻译成英文。高阶位的这个值设定的关键,如果是(不压)      
//byte[] lpbKeyState, // [in] 指针以256字节数组包含当前键盘的状态。每个元素字节的数组包含状态的一个关键。如果高阶位的字节是一套关键是下跌按下。在低比特如/果设置表明关键是对切换。在此功能只有肘位的CAPS LOCK键是相关的。在切换状态的NUM个锁和滚动锁定键被忽略。      //byte[] lpwTransKey, // [out] 指针的缓冲区收到翻译字符或字符。      //uint fuState); // [in] Specifies whether a menu is active. This parameter must be 1 if a menu is active, or 0 otherwise.
[DllImport("kernel32.dll")]     //使用WINDOWS API函数代替获取当前实例的函数,防止钩子失效
private static extern IntPtr GetModuleHandle(string name);
#endregion
public Action<DateTime,WarningEnum, string> WarningEvent;
//public Action<ScanerCodes> ScanerEvent;
public Action<string> ScanerEvent;
public ScannerCodeDev2()
{
}
public bool start()
{
try
{
if (hKeyboardHook == 0)
{
hookproc = new HookProc(KeyboardHookProc);
//GetModuleHandle 函数 替代 Marshal.GetHINSTANCE
//防止在 framework4.0中 注册钩子不成功
IntPtr modulePtr = GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName);
//WH_KEYBOARD_LL=13
//全局钩子 WH_KEYBOARD_LL
// hKeyboardHook = SetWindowsHookEx(13, hookproc, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
hKeyboardHook = SetWindowsHookEx(13, hookproc, modulePtr, 0);
}
return (hKeyboardHook != 0);
}
catch (Exception ex)
{
WarningEvent?.Invoke(DateTime.Now,WarningEnum.Normal, ex.Message);
return false;
}
}
public bool stop()
{
try
{
if (hKeyboardHook != 0)
{
bool retKeyboard = UnhookWindowsHookEx(hKeyboardHook);
hookproc = null;
hKeyboardHook = 0;
return retKeyboard;
}
return true;
}
catch
{
return false;
}
}
private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
{
try
{
EventMsg msg = (EventMsg)Marshal.PtrToStructure(lParam, typeof(EventMsg));
codes.Add(msg);
if (msg.message == 13 && msg.paramH > 0 && !string.IsNullOrWhiteSpace(codes.Result))
{
ScanerEvent?.Invoke(codes.Result);
}
return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);
}
catch (Exception ex)
{
return 0;
}
}
public void Dispose()
{
stop();
}
public class ScanerCodes
{
private int ts = 100; // 指定输入间隔为300毫秒以内时为连续输入
private List<List<EventMsg>> _keys = new List<List<EventMsg>>();
private List<int> _keydown = new List<int>(); // 保存组合键状态
private List<string> _result = new List<string>(); // 返回结果集
private DateTime _last = DateTime.Now;
private byte[] _state = new byte[256];
private string _key = string.Empty;
private string _cur = string.Empty;
public EventMsg Event
{
get
{
if (_keys.Count == 0)
{
return new EventMsg();
}
else
{
return _keys[_keys.Count - 1][_keys[_keys.Count - 1].Count - 1];
}
}
}
public List<int> KeyDowns
{
get
{
return _keydown;
}
}
public DateTime LastInput
{
get
{
return _last;
}
}
public byte[] KeyboardState
{
get
{
return _state;
}
}
public int KeyDownCount
{
get
{
return _keydown.Count;
}
}
public string Result
{
get
{
if (_result.Count > 0)
{
return _result[_result.Count - 1].Trim();
}
else
{
return null;
}
}
}
public string CurrentKey
{
get
{
return _key;
}
}
public string CurrentChar
{
get
{
return _cur;
}
}
public bool isShift
{
get
{
return _keydown.Contains(160);
}
}
public void Add(EventMsg msg)
{
#region
// 首次按下按键
if (_keys.Count == 0)
{
_keys.Add(new List<EventMsg>());
_keys[0].Add(msg);
_result.Add(string.Empty);
}
// 未释放其他按键时按下按键
else if (_keydown.Count > 0)
{
_keys[_keys.Count - 1].Add(msg);
}
// 单位时间内按下按键
else if (((TimeSpan)(DateTime.Now - _last)).TotalMilliseconds < ts)
{
_keys[_keys.Count - 1].Add(msg);
}
// 从新记录输入内容
else
{
_keys.Add(new List<EventMsg>());
_keys[_keys.Count - 1].Add(msg);
_result.Add(string.Empty);
}
#endregion
_last = DateTime.Now;
#region
// 记录正在按下的按键
if (msg.paramH == 0 && !_keydown.Contains(msg.message))
{
_keydown.Add(msg.message);
}
// 清除已松开的按键
if (msg.paramH > 0 && _keydown.Contains(msg.message))
{
_keydown.Remove(msg.message);
}
#endregion
#region
int v = msg.message & 0xff;
int c = msg.paramL & 0xff;
StringBuilder strKeyName = new StringBuilder(500);
if (GetKeyNameText(c * 65536, strKeyName, 255) > 0)
{
_key = strKeyName.ToString().Trim(new char[] { ' ', '\0' });
GetKeyboardState(_state);
if (_key.Length == 1 && msg.paramH == 0)// && msg.paramH == 0
{
// 根据键盘状态和shift缓存判断输出字符
_cur = ShiftChar(_key, isShift, _state).ToString();
_result[_result.Count - 1] += _cur;
}
//判断是+ 强制添加+
else if (_key.Length == 5 && msg.paramH == 0 && msg.paramL == 78 && msg.message == 107)
{
// 根据键盘状态和shift缓存判断输出字符
_cur = Convert.ToChar('+').ToString();
_result[_result.Count - 1] += _cur;
}
// 备选          
else
{
_cur = string.Empty;
}
}
#endregion
}
private char ShiftChar(string k, bool isShiftDown, byte[] state)
{
bool capslock = state[0x14] == 1;
bool numlock = state[0x90] == 1;
bool scrolllock = state[0x91] == 1;
bool shiftdown = state[0xa0] == 1;
char chr = (capslock ? k.ToUpper() : k.ToLower()).ToCharArray()[0];
if (isShiftDown)
{
if (chr >= 'a' && chr <= 'z')
{
chr = (char)((int)chr - 32);
}
else if (chr >= 'A' && chr <= 'Z')
{
if (chr == 'Z')
{
string s = "";
}
chr = (char)((int)chr + 32);
}
else
{
string s = "`1234567890-=[];',./";
string u = "~!@#$%^&*()_+{}:\"<>?";
if (s.IndexOf(chr) >= 0)
{
return (u.ToCharArray())[s.IndexOf(chr)];
}
}
}
return chr;
}
}
public struct EventMsg
{
public int message;
public int paramL;
public int paramH;
public int Time;
public int hwnd;
}
}
}

View File

@ -0,0 +1,258 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LeatherApp
{
//public enum CurrentPTEnum
//{
// [Description("初始位")]
// InitPT = 1,
// [Description("上料位")]
// UpPT = 2,
// [Description("下料位")]
// DownPT = 3,
// [Description("运行中")]
// Moving = 4,
// [Description("打标中")]
// MakeTag = 5
//}
public enum CurrentStateEnum
{
= 0,
//等待启动 = 1,
//等待扫码 = 2,//在暂停3和运行中4时都可以等待扫码扫码后即开始等待相机照片
= 3,//解除告警->等待启动 (可复位、下料中)
//急停 = 4, //解除告警->等待复位
= 5,
//下料中 = 6, //没有暂停,完成后->等待启动
//打标中=7,//可复位、暂停、急停、下料
//结束 = 8,// 同等待启动-1
}
public enum WarningEnum
{
[Description("正常")]
Normal = 0,
[Description("低(可继续)")]
Low = 1,
[Description("严重")]
High = 2
}
public enum IODirectionEnum
{
[Description("仅输入")]
= 0,
[Description("仅输出")]
= 1,
[Description("输入与输出")]
= 2,
}
public enum AIEngineLibEnum
{
[Description("缺陷库")]
= 0,
[Description("测量库")]
= 1,
[Description("缺陷与测量库")]
= 2,
}
//public enum PowerLevelEnum
//{
// [Description("低电平")]
// 高 = 0,
// [Description("高电平")]
// 低 = 1,
//}
public enum AxisName
{
[Description("0-Axis")]
Axis0 = 0,
[Description("1-Axis")]
Axis1 = 1,
[Description("2-Axis")]
Axis2 = 2,
[Description("3-Axis")]
Axis3 = 3,
}
//[Serializable]
//[TypeConverter(typeof(ExpandableObjectConverter))]
//public class MultiAxisName
//{
// public int Axis0 { get; set; }
// public int Axis1 { get; set; }
// //public bool Axis2 { get; set; }
// //public bool Axis3 { get; set; }
//}
/// <summary>
/// 轴脉冲模式
/// </summary>
public enum AxisPulseOutMode
{
OUT_DIR = 0x1,
OUT_DIR_OUT_NEG = 0x02,
OUT_DIR_DIR_NEG = 0x04,
OUT_DIR_ALL_NEG = 0x08,
O_CW_CCW = 0x10,
CW_CCW_ALL_NEG = 0x20,
}
/// <summary>
/// 回原点方式
/// </summary>
public enum AxitHomeMode
{
MODE1_Abs = 0,
MODE2_Lmt = 1,
MODE3_Ref = 2,
MODE4_Abs_Ref = 3,
MODE5_Abs_NegRef = 4,
MODE6_Lmt_Ref = 5,
MODE7_AbsSearch = 6,
MODE8_LmtSearch = 7,
MODE9_AbsSearch_Ref = 8,
MODE10_AbsSearch_NegRef = 9,
MODE11_LmtSearch_Ref = 10,
MODE12_AbsSearchReFind = 11,
MODE13_LmtSearchReFind = 12,
MODE14_AbsSearchReFind_Ref = 13,
MODE15_AbsSearchReFind_NegRef = 14,
MODE16_LmtSearchReFind_Ref = 15,
}
public enum AxHomeDirection
{
= 0,
= 1,
}
public enum AxMoveMode
{
MODE1_Abs = 0,
MODE2_Rel = 1,
}
public enum SmallAxCmdPos
{
0_679X = 0,
0_7X = 550,
1_0X = 4780,
1_5X = 7850,
2_0X = 10500,
2_5X = 13300,
3_0X = 15360,
3_5X = 16890,
4_0X = 18230,
4_5X = 19350,
}
public enum CMDName
{
IO默认输出 = 0,
= 10,//输入+输出
= 11,//输入+输出
= 12,//输入+输出
绿 = 15,
= 16,
= 17,
= 18,
= 20,
= 25,//张力读取
//喷墨输出 = 26,
//门磁告警输入=30,
//喷墨告警输入 = 31,
//厚度气缸与轴运动告警 = 34,
= 35,
//Y轴复位输出 = 40,
//Y轴复位完成输入 = 41,
}
//---
//public int DKCount { get; set; }//堵孔数量
//public int ZWCount { get; set; }//脏污数量
//public int GSYCCount { get; set; }//钢丝异常数量
//public int XWSCount { get; set; }//纤维丝数量
//public int QKCount { get; set; }//缺口数量
//public int ZKCount { get; set; }//针孔数量
//public int PPCount { get; set; }//泡泡数量
//public int HSCount { get; set; }//划伤数量
//public int YXCount { get; set; }//压线数量
//public int XBCount { get; set; }//斜边数量 new
//public int SXCount { get; set; }//栅线数量 new
public enum DefectCodeEnum
{
jb,
wy,
mj,
hy,
lj,
yss,
zy,
wc,
cs,
cy,
tcy,
jt,
}
public enum DefectNameEnum
{
,
,
,
,
,
,
,
,
,
,
,
,
}
public enum ValType
{
,
,
}
public static class EnumConvert
{
public static List<Color> DefectColor = new List<Color>() { Color.Red, Color.Green, Color.DarkViolet , Color.Magenta, Color.Orange, Color.Brown,
Color.Olive, Color.PaleGreen, Color.CadetBlue,Color.Aqua,Color.YellowGreen,Color.Blue,Color.SpringGreen,Color.Fuchsia };
public static DefectNameEnum ConvertDefectCode2Name(DefectCodeEnum val)
{
int v = (int)val;
return (DefectNameEnum)v;
}
public static DefectCodeEnum ConvertDefectName2Code(DefectNameEnum val)
{
int v = (int)val;
return (DefectCodeEnum)v;
}
}
#region
public enum LightDevNameEnum
{
= 0,
= 10,
}
public enum CamerDevNameEnum
{
= 0,
= 10,
}
#endregion
}

View File

@ -0,0 +1,94 @@
namespace LeatherApp
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(22, 68);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 33);
this.button1.TabIndex = 0;
this.button1.Text = "计算边界宽度";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(150, 11);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(547, 28);
this.textBox1.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(147, 83);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 18);
this.label1.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(19, 21);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(125, 18);
this.label2.TabIndex = 2;
this.label2.Text = "BMP源图路径";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}

View File

@ -0,0 +1,37 @@
using LeatherApp.Utils;
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
Mat mat0 = Cv2.ImRead(this.textBox1.Text.Trim());
int marginWidth0;
mat0 = OpenCVUtil.getMaxInsetRect2(mat0, true, 0, out marginWidth0);
this.label1.Text = "边缘宽度:" + marginWidth0;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using S7.Net;
namespace LeatherApp
{
public partial class Form2 : Form
{
public static Plc PLC_Type;
public Form2()
{
InitializeComponent();
}
private void buttonNext_Click(object sender, EventArgs e)
{
this.Hide();
}
private void ConnectButton_Click(object sender, EventArgs e)
{
//创建连接对象
switch(PLCType.Text)
{
case "S7200": PLC_Type = new Plc(CpuType.S7200, IPAdrees.Text, Convert.ToInt16(rackN.Value), Convert.ToInt16(Solt.Value)); break;
case "S7300": PLC_Type = new Plc(CpuType.S7300, IPAdrees.Text, Convert.ToInt16(rackN.Value), Convert.ToInt16(Solt.Value)); break;
case "S7400": PLC_Type = new Plc(CpuType.S7400, IPAdrees.Text, Convert.ToInt16(rackN.Value), Convert.ToInt16(Solt.Value)); break;
case "S71200": PLC_Type = new Plc(CpuType.S71200, IPAdrees.Text, Convert.ToInt16(rackN.Value), Convert.ToInt16(Solt.Value)); break;
case "S71500": PLC_Type = new Plc(CpuType.S71500, IPAdrees.Text, Convert.ToInt16(rackN.Value), Convert.ToInt16(Solt.Value)); break;
default:break;
}
//开始连接并返回故障码
PLC_Type.Open();
ConnecteState.Text = (PLC_Type.IsConnected ? "连接成功" : "连接失败");
//case ErrorCode.ConnectionError:ConnecteState.Text = "连接失败";break;
//case ErrorCode.IPAddressNotAvailable: ConnecteState.Text = "IP地址无效"; break;
//case ErrorCode.NoError: ConnecteState.Text = "连接成功"; break;
//case ErrorCode.SendData: ConnecteState.Text = "发送数据中"; break;
//case ErrorCode.ReadData: ConnecteState.Text = "读取数据中"; break;
}
private void DisConnectButton_Click(object sender, EventArgs e)
{
if (PLC_Type != null)
{
PLC_Type.Close();
ConnecteState.Text = "";
}
}
private void Readbutton_Click(object sender, EventArgs e)
{
double MyPlcData=0.0;
try
{
switch (DateType.Text)
{
case "Bit": MyPlcData = Convert.ToDouble((Boolean)(PLC_Type.Read("DB" + DBText.Value + "." + "DBX" + StartText.Value+"."+BitSelect.Value))); break;
case "Byte": MyPlcData = Convert.ToDouble((Byte)(PLC_Type.Read("DB" + DBText.Value + "." + "DBB" + StartText.Value))); break;
case "Word": MyPlcData = Convert.ToDouble((UInt16)(PLC_Type.Read("DB" + DBText.Value + "." + "DBW" + StartText.Value))); break;
case "DWord": MyPlcData = Convert.ToDouble((UInt32)(PLC_Type.Read("DB" + DBText.Value + "." + "DBD" + StartText.Value))); break;
case "Int": MyPlcData = BitConverter.ToInt16(BitConverter.GetBytes((UInt16)(PLC_Type.Read("DB" + DBText.Value + "." + "DBW" + StartText.Value))),0); break;
case "DInt": MyPlcData = BitConverter.ToInt32(BitConverter.GetBytes((UInt32)(PLC_Type.Read("DB" + DBText.Value + "." + "DBD" + StartText.Value))),0); break;
case "Real": MyPlcData = BitConverter.ToSingle(BitConverter.GetBytes((UInt32)PLC_Type.Read("DB" + DBText.Value + "." + "DBD" + StartText.Value)),0); break;
default: break;
}
}
catch(Exception e1)
{
MessageBox.Show(e1.Message);
}
txtResult.Text = MyPlcData.ToString();
}
private void Writebutton_Click(object sender, EventArgs e)
{
ErrorCode errorCode=0;
string MyData = "";
try
{
switch(DateType.Text)
{
case "Bit": PLC_Type.Write("DB" + DBText.Value + "." + "DBX" + StartText.Value+"."+BitSelect.Value, Convert.ToBoolean(Convert.ToInt16(WriteText.Text))); break;
case "Word": PLC_Type.Write("DB" + DBText.Value + "." + "DBW" + StartText.Value, Convert.ToUInt16(WriteText.Text)); break;
case "DWord": PLC_Type.Write("DB" + DBText.Value + "." + "DBD" + StartText.Value, Convert.ToUInt32(WriteText.Text)); break;
case "Int": PLC_Type.Write("DB" + DBText.Value + "." + "DBW" + StartText.Value, (Int16)Convert.ToSingle(WriteText.Text)); break;
case "DInt": PLC_Type.Write("DB" + DBText.Value + "." + "DBD" + StartText.Value, (Int32)Convert.ToSingle(WriteText.Text)); break;
case "Real": PLC_Type.Write("DB" + DBText.Value + "." + "DBD" + StartText.Value, BitConverter.ToUInt32(BitConverter.GetBytes(Convert.ToSingle(WriteText.Text)),0)); break;
case "Byte":
{
Byte[] bytes = new Byte[1];
bytes[0] = Convert.ToByte(WriteText.Text);
PLC_Type.WriteBytes(DataType.DataBlock, (int)DBText.Value, (int)StartText.Value, bytes);
break;
}
default:break;
}
}
catch (Exception e1)
{
}
MessageBox.Show(MyData);
}
private void IPAdrees_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(char.IsNumber(e.KeyChar)) && (e.KeyChar != (char)8) && (e.KeyChar != Convert.ToChar(".")) )
e.Handled = true;//e.handled=true即可,无效化刚刚输入的键值
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(char.IsNumber(e.KeyChar)) && (e.KeyChar != (char)8) && (e.KeyChar != Convert.ToChar("."))&&(e.KeyChar != Convert.ToChar("-")) )
e.Handled = true;//e.handled=true即可,无效化刚刚输入的键值
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DateType.Text == "Bit")
BitSelect.Enabled = true;
else
BitSelect.Enabled = false;
}
private void Form2_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,447 @@
namespace LeatherApp
{
partial class Form2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2));
this.IPAdrees = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.ConnectButton = new System.Windows.Forms.Button();
this.DisConnectButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtResult = new System.Windows.Forms.TextBox();
this.BitSelect = new System.Windows.Forms.NumericUpDown();
this.DateType = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.WriteText = new System.Windows.Forms.TextBox();
this.StartText = new System.Windows.Forms.NumericUpDown();
this.DBText = new System.Windows.Forms.NumericUpDown();
this.Writebutton = new System.Windows.Forms.Button();
this.Readbutton = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.PLCType = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ConnecteState = new System.Windows.Forms.Label();
this.Solt = new System.Windows.Forms.NumericUpDown();
this.rackN = new System.Windows.Forms.NumericUpDown();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.BitSelect)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.StartText)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DBText)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Solt)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rackN)).BeginInit();
this.SuspendLayout();
//
// IPAdrees
//
this.IPAdrees.Location = new System.Drawing.Point(210, 58);
this.IPAdrees.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.IPAdrees.Name = "IPAdrees";
this.IPAdrees.Size = new System.Drawing.Size(185, 28);
this.IPAdrees.TabIndex = 0;
this.IPAdrees.Text = "192.168.0.10";
this.IPAdrees.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.IPAdrees_KeyPress);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(117, 61);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 18);
this.label1.TabIndex = 3;
this.label1.Text = "IPAdress";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(117, 107);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 18);
this.label2.TabIndex = 4;
this.label2.Text = "Rack";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(117, 150);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 18);
this.label3.TabIndex = 5;
this.label3.Text = "Solt";
//
// ConnectButton
//
this.ConnectButton.Location = new System.Drawing.Point(140, 179);
this.ConnectButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.ConnectButton.Name = "ConnectButton";
this.ConnectButton.Size = new System.Drawing.Size(71, 47);
this.ConnectButton.TabIndex = 10;
this.ConnectButton.Text = "连接";
this.ConnectButton.UseVisualStyleBackColor = true;
this.ConnectButton.Click += new System.EventHandler(this.ConnectButton_Click);
//
// DisConnectButton
//
this.DisConnectButton.Location = new System.Drawing.Point(389, 179);
this.DisConnectButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.DisConnectButton.Name = "DisConnectButton";
this.DisConnectButton.Size = new System.Drawing.Size(71, 47);
this.DisConnectButton.TabIndex = 11;
this.DisConnectButton.Text = "断开";
this.DisConnectButton.UseVisualStyleBackColor = true;
this.DisConnectButton.Click += new System.EventHandler(this.DisConnectButton_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtResult);
this.groupBox1.Controls.Add(this.BitSelect);
this.groupBox1.Controls.Add(this.DateType);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.WriteText);
this.groupBox1.Controls.Add(this.StartText);
this.groupBox1.Controls.Add(this.DBText);
this.groupBox1.Controls.Add(this.Writebutton);
this.groupBox1.Controls.Add(this.Readbutton);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Location = new System.Drawing.Point(12, 258);
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox1.Size = new System.Drawing.Size(583, 300);
this.groupBox1.TabIndex = 15;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "读写数据";
//
// txtResult
//
this.txtResult.Location = new System.Drawing.Point(49, 231);
this.txtResult.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtResult.Multiline = true;
this.txtResult.Name = "txtResult";
this.txtResult.Size = new System.Drawing.Size(514, 55);
this.txtResult.TabIndex = 26;
//
// BitSelect
//
this.BitSelect.Location = new System.Drawing.Point(405, 72);
this.BitSelect.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.BitSelect.Maximum = new decimal(new int[] {
7,
0,
0,
0});
this.BitSelect.Name = "BitSelect";
this.BitSelect.Size = new System.Drawing.Size(57, 28);
this.BitSelect.TabIndex = 25;
//
// DateType
//
this.DateType.FormattingEnabled = true;
this.DateType.Items.AddRange(new object[] {
"Bit",
"Byte",
"Word",
"DWord",
"Int",
"DInt",
"Real"});
this.DateType.Location = new System.Drawing.Point(210, 116);
this.DateType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.DateType.Name = "DateType";
this.DateType.Size = new System.Drawing.Size(185, 26);
this.DateType.TabIndex = 21;
this.DateType.Text = "Bit";
this.DateType.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(111, 120);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(80, 18);
this.label8.TabIndex = 24;
this.label8.Text = "数据类型";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(6, 234);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(44, 18);
this.label9.TabIndex = 23;
this.label9.Text = "结果";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(111, 166);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 18);
this.label7.TabIndex = 23;
this.label7.Text = "写入数据";
//
// WriteText
//
this.WriteText.Location = new System.Drawing.Point(210, 162);
this.WriteText.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.WriteText.Name = "WriteText";
this.WriteText.Size = new System.Drawing.Size(185, 28);
this.WriteText.TabIndex = 21;
this.WriteText.Text = "0";
this.WriteText.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
//
// StartText
//
this.StartText.Location = new System.Drawing.Point(210, 72);
this.StartText.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.StartText.Name = "StartText";
this.StartText.Size = new System.Drawing.Size(186, 28);
this.StartText.TabIndex = 22;
//
// DBText
//
this.DBText.Location = new System.Drawing.Point(210, 26);
this.DBText.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.DBText.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.DBText.Name = "DBText";
this.DBText.Size = new System.Drawing.Size(186, 28);
this.DBText.TabIndex = 21;
this.DBText.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// Writebutton
//
this.Writebutton.Location = new System.Drawing.Point(405, 162);
this.Writebutton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Writebutton.Name = "Writebutton";
this.Writebutton.Size = new System.Drawing.Size(71, 28);
this.Writebutton.TabIndex = 18;
this.Writebutton.Text = "写入";
this.Writebutton.UseVisualStyleBackColor = true;
this.Writebutton.Click += new System.EventHandler(this.Writebutton_Click);
//
// Readbutton
//
this.Readbutton.Location = new System.Drawing.Point(114, 203);
this.Readbutton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Readbutton.Name = "Readbutton";
this.Readbutton.Size = new System.Drawing.Size(71, 27);
this.Readbutton.TabIndex = 17;
this.Readbutton.Text = "读取";
this.Readbutton.UseVisualStyleBackColor = true;
this.Readbutton.Click += new System.EventHandler(this.Readbutton_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(111, 74);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 18);
this.label5.TabIndex = 20;
this.label5.Text = "Start";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(111, 32);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(89, 18);
this.label6.TabIndex = 19;
this.label6.Text = "DB Number";
//
// contextMenuStrip1
//
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(256, 34);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(255, 30);
this.toolStripMenuItem1.Text = "toolStripMenuItem1";
//
// PLCType
//
this.PLCType.FormattingEnabled = true;
this.PLCType.Items.AddRange(new object[] {
"S7200",
"S7300",
"S7400",
"S71200",
"S71500"});
this.PLCType.Location = new System.Drawing.Point(210, 14);
this.PLCType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.PLCType.Name = "PLCType";
this.PLCType.Size = new System.Drawing.Size(185, 26);
this.PLCType.TabIndex = 16;
this.PLCType.Text = "S7200";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(117, 18);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(71, 18);
this.label4.TabIndex = 17;
this.label4.Text = "PLC类型";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.ConnecteState);
this.groupBox2.Controls.Add(this.Solt);
this.groupBox2.Controls.Add(this.rackN);
this.groupBox2.Controls.Add(this.ConnectButton);
this.groupBox2.Controls.Add(this.DisConnectButton);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.IPAdrees);
this.groupBox2.Controls.Add(this.PLCType);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Location = new System.Drawing.Point(12, 13);
this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox2.Size = new System.Drawing.Size(583, 238);
this.groupBox2.TabIndex = 18;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "连接参数";
//
// ConnecteState
//
this.ConnecteState.AutoSize = true;
this.ConnecteState.Location = new System.Drawing.Point(483, 22);
this.ConnecteState.Name = "ConnecteState";
this.ConnecteState.Size = new System.Drawing.Size(80, 18);
this.ConnecteState.TabIndex = 20;
this.ConnecteState.Text = "连接状态";
//
// Solt
//
this.Solt.Location = new System.Drawing.Point(210, 145);
this.Solt.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Solt.Name = "Solt";
this.Solt.Size = new System.Drawing.Size(186, 28);
this.Solt.TabIndex = 19;
this.Solt.Value = new decimal(new int[] {
2,
0,
0,
0});
//
// rackN
//
this.rackN.Location = new System.Drawing.Point(210, 101);
this.rackN.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.rackN.Name = "rackN";
this.rackN.Size = new System.Drawing.Size(186, 28);
this.rackN.TabIndex = 18;
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1389, 670);
this.ControlBox = false;
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "Form2";
this.Text = "Form2";
this.Load += new System.EventHandler(this.Form2_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.BitSelect)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.StartText)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DBText)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.Solt)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rackN)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TextBox IPAdrees;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button ConnectButton;
private System.Windows.Forms.Button DisConnectButton;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.Button Writebutton;
private System.Windows.Forms.Button Readbutton;
private System.Windows.Forms.ComboBox PLCType;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.NumericUpDown Solt;
private System.Windows.Forms.NumericUpDown rackN;
private System.Windows.Forms.Label ConnecteState;
private System.Windows.Forms.NumericUpDown StartText;
private System.Windows.Forms.NumericUpDown DBText;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox WriteText;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox DateType;
private System.Windows.Forms.NumericUpDown BitSelect;
private System.Windows.Forms.TextBox txtResult;
private System.Windows.Forms.Label label9;
}
}

View File

@ -0,0 +1,183 @@
<?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>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAQEAAAAEAGACYDAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAABAAAAAQAgGAAAAqmlx3gAAAAFz
UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAMLUlEQVR4Xu2beXAV
VRaH1XJqhrKsmbIcdBz2YoZN2QNJICGELRskUUAFR1lDcAFks1A2RxFQECwQRQVcURQUcAFUUFBAFEVQ
0BKQXVlkRwTUOtPfxQ79uk93uh/PGZyZP74K5L3ue8/vnnvOuUvOO378uPwv838BtF8GceLECcPJkyfl
1KlT5wT05fvvv5fvvvtOduzYIQcOHFD7rhFKAAz+8ccf5eeffy7hp59+Oqdw9mvXrl3y6aefyhdffCGH
Dx9WbbIJFOCHH34oMZwX22qfy9BHW5BvvvlG3nnnHfn666/l2LFjqo2+AjDqvyXD3dhCMIhLliyRNWvW
qN6gCmAbz+hrL/8tgQ3w5ptvyscffyyHDh2KsdUjAIr9txhvgy3Y9fLLL8vnn38uR48e9RcAt0mU8fv3
75d3331XHn30UZk0aZJpXPueH3aftM+igk1kiDlz5sj27dtN1uDdMQLYrq+9IAoEnUceeURuueUW6dWr
Vwm33nqriczaM25ef/116dOnj3kH4m3YsEH9XhSw7bXXXpNVq1bJwYMHvQKg0tmO/r59+0zHnYY7GTx4
sOzevVt91ub5559Xn0VUApn2TBiwjcGZPXu28QKPALi/9mAUCDRa553ce++98uGHH5p8jSvazzIqM2bM
UJ+xefDBB818drYZBUSgjc8++0yOHDlyRgA752sPRQH30joexG233Sb9+/eX3r17q5+7QeR4RWCQ586d
KytWrDAVY4kAzP9E5HterHU6kRBYv/rqq7hEwMbFixfLW2+9JXv27Em8AKQardOJgkBKmbtu3bq4RMDG
pUuXyhtvvGEqxRIB7A/dD0SBtDdw4EC144nijjvuMMbbRBUBG/GgV1991cSghAmA8QQ3rdOJpLi42Ixg
vCLYAsyfP1927tyZGAG2bdsmQ4cOVTv8azB8+HBT28cjwlkJwIrqgw8+MCNAVUVd/fbbbwfmfSjuVWT9
LJZuPbpI++vzJKswVTLy6kp6Ti1Jz75SMvPqS87VadKxU770KOr2y3M8432XDelw7dq1kUXARlaIkQUg
YqK81pkgii1u7NpZWuU3lkYtKklSZgVp1LKSJLeuIsltoLI0bl1ZklpVkoYtypvvZBWkyE3dblDf52TK
lCkxAoQRwRZg3rx54QUgQ4wdO1btRBBFRT0l75pmktSiojE6NauqpOdVl2Zta6jwGd/huzyTbXlFj6Lu
1ruKPe+2GT16tDFmwYIFsnDhQuORX375pa8I2MjymFogtADxFDfdLXfPyK1tjWoFSc2uqhocBM8kWc82
zaopXUJ4gxM7U2gi2AJ4PIBRdn/ZJuroY3x6m1rWSFaUtNxqqoFh4Fm8IaX13yOLwLpBmw62AK+88ko4
AaiXST1aIxq4fUZObWN8kLuHhXfwrqZZNaSnmQ56u2769etnCiZNBCrB0ALwGS/TGtFgzuP2npFvV0My
CqtJZntrOrSLJgzvYjpkFzaVXsV6uxrEBC0wIgAVK5ks1BR47733QnhBkYn2BC91zltG95x6uYzdWkZu
HHeFNMv/m/c7AZyOCRXlH107mbb0PsTyxBNPqNmBQBlJAEA1rREnrfKTTSc1A6B4xqUy4dB5MtFi5JqL
5OqB5U97Q0iP4N2trTa0tjXuu+++EgGcIrAQYmcokgDwzDPPqA1Bt55dTA4njWmdB1sAw+HzZeKBC2XA
oj9JVtfK6vfdmBRptdG9pFgK5qGHHooRADZt2iSLFi2KT4CtW7eqDQEVHkVOUOCLEaCEC2T83t9LkfVZ
ZoeqkmF9D7TneTfx5drO+WofbJiuEydOlNWrV3sEYF+SAMiuUGQB2E3VGoQ2hSkmZWkdt1EFwBN+YfSm
MtJ5VDlrSvinTirG3GvS1D5A3759zQi7DbdBAOZ/XAKwg6I1Chm5da2StoraaRvdA2KZaHnEsFUXS36f
CmpsSLHaaNG2gdoHwLU1w20QgO+89NJLZl8wkgDkTa1RSMuuaWp7d4edhBHAeMSh82XCwQul7+xLPd6Q
Shs5V6l9wPU/+eQT1XAbBGD0X3zxxegCUFhoDUN6dq3ECXD4AplgBcjeMy+RpOaxATLVWjz5CcC+oma0
EwRg9GfNmhUrgGawGx7SGobm1vI2UVPgrhUXS4sul0u9ppWkfhNrYdS8SklwTbZWjplt66t9uPPOO1Wj
nSAAo+8RoDQP4GH247SGIfvqJqZkdRvtRBfAGm1rxDF81MYyUnhXWambVl7qWYY7OS1CDdMGewdaH4YN
G+Yx2A3b4RgfSQCKoJtvvllt1Kb99W2tNFg+ehq0jB+/5w/SZcol0rBlOalrjXq9JhU9AuAJDTOqSEOr
jfad8tQ+DBgwQDXaia8A7gWDzfLly9XG3HSPpxA6+DvpM/+P0rTwCo/BGlcl/9XiL9K1+01qH4Blrma4
DQJw8vTCCy/ECgCaABQUWkMa4Uvh82XY6oukdZE1z5XR9qNGw8ukQZNq0rHjtdaqU18PME3Z7tKMBwR4
7rnnjAjsZZYqwNSpU9WGvFiLoW6lL4bGbCkjHf55qdRLL6ca6cdVyeWkeoOy0jo7U/LzCywROvqKQDqk
2PET4Nlnn/UKwBmdFgfYP9Ma8SNoOdy8oJo0ymLEK3sMDKJuakXL+D9L47RalvH5Fu3MzyARhgwZogoA
rGk8ArDjqwnAfr/7mDsINkTI00EbIklWMNMM1ajbpILl+mWlduOK0rZd3i8CnMFPhKCU+NRTT8nMmTPN
2qZEAOp8v0zw2GOPeRoIgu3vtDY1jQiaJ4QVgZFn3l/ZqLzk5LaRApfxNh06dPCIwKUMzXi20jkdJg7E
CMC5u18m4AiJc31nA6WBCOk5VwZuigaJQMRnztdJriy5edmq4U6cInDK/P777/sKMG3aNBMHYgTgkMNP
AOBzXrps2TLzk7O10k6Dehb1MEULgdGzLe7jCRjOqFdvcJmkNqtj3N5v5N3YInCjRDMeEICdIuJAjABc
TggSANgg5aqK/TIWHnfffbdqvJMbul4nLdslGSHsgxHKZtYOKVZpWycFoy83ga6GZXjjtJqSndvKMrxQ
NdSmoKBACgtjv8NdA20fwAYBHn/8ca8ABLvSBABihVMEGgv2BPYScU2Oxm6S9tflSlZhilk+cyzGNGme
V1/SWzaQzFZNJK9dzmnjHEZpYCgZijNCNj8JbBQ3pa0GWdCR2j0CcM+Wn5rRbtwirFy50qzEdAHCgevi
wpqxbkaMGOE5HA0LAnBm8PTTT8cKsHfv3tACgFuERFyMCCPC/fff7zkUjQICPPzww14BuLnlvLAUBqcI
YXaNwxAkAiPvNigqeA5BkimzZcuWMwKQ6ghymqFB2CJw2KgZFA9+IrCdrRkVBS5Ysb558sknYwXgP8QB
zcjSQAQqK82YeNFE8MvtUeB+wwMPPOD1AI6UmROagWHg0pFmiBtWa6zbOW4r7VqcW4REeACZg9TtKYVx
Y1JIaTtDfnDjKigTsKHCXpwzgPFvrtXx+0GDBqnPOUVAZKcx8cBUpS2WzDHb4mQBfvntt9+qBoaBOMLV
Ffc5IsZTOWodsuH80c8jEAGYv9qzYWEKcauEmy4EbWwuEYAMwGYhlyHCFER+EEgplwk0HFJwbY6Lz1qH
3EyfPt1jPNOF0vWjjz5SnwkL6Q9PY5VIFkBMqt8SAYCChi+tX79eNS4siMA7tI6UBsdWXHthpLj2cjY5
3wmDgOG4PzXLxo0bzRZAjACc/LCMxF05RNSMC8vZiJBo+GsRyt/bb79dJk+ebAaaS1/YHCMAoDhpgs1F
9tDjDYpwLojA3wfgTUxFLnLiCQwuqVsVgE6TbkaNGmViAmmDvwHQDAzDf0oEsgu5fsKECSY7cWaAPewJ
svCz7fUIAEwF5t/IkSPNwoFVFrcr7T8/0wwN4t8lAoGNwaPOHz9+vNxzzz2m7iDvcw5AGUzJ77RVFQBQ
idTEdEA9ojqK8nIOF3EtRAoL+ZdozvZaomGQ6N+YMWMM9JcMxJzn98Q0Rt5e7zjt9BUA2CajQqQ+GDdu
nLl/RxphUYJ3RIV9A9JaomF+8xOD2SdgRxjDyWgc7BDx7eW+m0ABAMWIAQhBfmck2Uz4tUYzXugP3kmK
YxpQN3AniFG3A55GqQLYIAQeQfVECclCYvPmzecU9InjLlIccczvz2XPcFz+BZmHonl+BaBRAAAAAElF
TkSuQmCC
</value>
</data>
</root>

View File

@ -0,0 +1,276 @@
namespace LeatherApp
{
partial class FrmMain2
{
/// <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 Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("产品管理");
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("数据分析");
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("系统设置");
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain2));
this.uiNavBar1 = new Sunny.UI.UINavBar();
this.uiAvatar1 = new Sunny.UI.UIAvatar();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.StyleManager = new Sunny.UI.UIStyleManager(this.components);
this.uiTabControl1 = new Sunny.UI.UITabControl();
this.uiContextMenuStrip1 = new Sunny.UI.UIContextMenuStrip();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.退ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btnExit = new Sunny.UI.UISymbolLabel();
this.btnHide = new Sunny.UI.UISymbolLabel();
this.uiNavBar1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.uiContextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// uiNavBar1
//
this.uiNavBar1.BackColor = System.Drawing.Color.White;
this.uiNavBar1.Controls.Add(this.btnExit);
this.uiNavBar1.Controls.Add(this.btnHide);
this.uiNavBar1.Controls.Add(this.uiAvatar1);
this.uiNavBar1.Controls.Add(this.pictureBox1);
this.uiNavBar1.Dock = System.Windows.Forms.DockStyle.Top;
this.uiNavBar1.DropMenuFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNavBar1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNavBar1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiNavBar1.Location = new System.Drawing.Point(0, 0);
this.uiNavBar1.MenuHoverColor = System.Drawing.Color.White;
this.uiNavBar1.MenuSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250)))));
this.uiNavBar1.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
this.uiNavBar1.Name = "uiNavBar1";
treeNode1.Name = "节点0";
treeNode1.Text = "产品管理";
treeNode2.Name = "节点2";
treeNode2.Text = "数据分析";
treeNode3.Name = "节点3";
treeNode3.Text = "系统设置";
this.uiNavBar1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3});
this.uiNavBar1.SelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiNavBar1.SelectedHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiNavBar1.Size = new System.Drawing.Size(976, 85);
this.uiNavBar1.Style = Sunny.UI.UIStyle.Red;
this.uiNavBar1.TabIndex = 0;
this.uiNavBar1.Text = "uiNavBar1";
this.uiNavBar1.MenuItemClick += new Sunny.UI.UINavBar.OnMenuItemClick(this.uiNavBar1_MenuItemClick);
//
// uiAvatar1
//
this.uiAvatar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.uiAvatar1.AvatarSize = 55;
this.uiAvatar1.BackColor = System.Drawing.Color.White;
this.uiAvatar1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiAvatar1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiAvatar1.Location = new System.Drawing.Point(899, 15);
this.uiAvatar1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiAvatar1.Name = "uiAvatar1";
this.uiAvatar1.Size = new System.Drawing.Size(65, 59);
this.uiAvatar1.Style = Sunny.UI.UIStyle.Red;
this.uiAvatar1.Symbol = 62142;
this.uiAvatar1.TabIndex = 28;
this.uiAvatar1.Text = "用户";
this.uiAvatar1.ZoomScaleDisabled = true;
this.uiAvatar1.Click += new System.EventHandler(this.uiAvatar1_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.White;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(37, 30);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Padding = new System.Windows.Forms.Padding(9);
this.pictureBox1.Size = new System.Drawing.Size(274, 42);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 7;
this.pictureBox1.TabStop = false;
//
// StyleManager
//
this.StyleManager.Style = Sunny.UI.UIStyle.Colorful;
//
// uiTabControl1
//
this.uiTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.uiTabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.uiTabControl1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
this.uiTabControl1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTabControl1.ItemSize = new System.Drawing.Size(0, 1);
this.uiTabControl1.Location = new System.Drawing.Point(0, 85);
this.uiTabControl1.MainPage = "";
this.uiTabControl1.Name = "uiTabControl1";
this.uiTabControl1.SelectedIndex = 0;
this.uiTabControl1.Size = new System.Drawing.Size(976, 614);
this.uiTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.uiTabControl1.Style = Sunny.UI.UIStyle.Red;
this.uiTabControl1.TabIndex = 7;
this.uiTabControl1.TabSelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiTabControl1.TabSelectedHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiTabControl1.TabVisible = false;
this.uiTabControl1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTabControl1.SelectedIndexChanged += new System.EventHandler(this.uiTabControl1_SelectedIndexChanged);
//
// uiContextMenuStrip1
//
this.uiContextMenuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiContextMenuStrip1.Font = new System.Drawing.Font("微软雅黑", 8F);
this.uiContextMenuStrip1.ImageScalingSize = new System.Drawing.Size(33, 33);
this.uiContextMenuStrip1.IsScaled = true;
this.uiContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem,
this.ToolStripMenuItem,
this.toolStripMenuItem1,
this.退ToolStripMenuItem});
this.uiContextMenuStrip1.Name = "uiContextMenuStrip1";
this.uiContextMenuStrip1.Size = new System.Drawing.Size(215, 136);
//
// 锁定ToolStripMenuItem
//
this.ToolStripMenuItem.Font = new System.Drawing.Font("微软雅黑", 14F);
this.ToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("锁定ToolStripMenuItem.Image")));
this.ToolStripMenuItem.Name = "锁定ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(214, 42);
this.ToolStripMenuItem.Text = "锁定页面";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 更改密码ToolStripMenuItem
//
this.ToolStripMenuItem.Font = new System.Drawing.Font("微软雅黑", 14F);
this.ToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("更改密码ToolStripMenuItem.Image")));
this.ToolStripMenuItem.Name = "更改密码ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(214, 42);
this.ToolStripMenuItem.Text = "修改密码";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(211, 6);
//
// 退出ToolStripMenuItem
//
this.退ToolStripMenuItem.Font = new System.Drawing.Font("微软雅黑", 14F);
this.退ToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("退出ToolStripMenuItem.Image")));
this.退ToolStripMenuItem.Name = "退出ToolStripMenuItem";
this.退ToolStripMenuItem.Size = new System.Drawing.Size(214, 42);
this.退ToolStripMenuItem.Text = "退出";
this.退ToolStripMenuItem.Click += new System.EventHandler(this.退ToolStripMenuItem_Click);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.ForeColor = System.Drawing.Color.Blue;
this.btnExit.Location = new System.Drawing.Point(811, 3);
this.btnExit.MinimumSize = new System.Drawing.Size(1, 1);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(82, 34);
this.btnExit.Style = Sunny.UI.UIStyle.Custom;
this.btnExit.StyleCustomMode = true;
this.btnExit.Symbol = 61579;
this.btnExit.SymbolColor = System.Drawing.Color.Blue;
this.btnExit.SymbolOffset = new System.Drawing.Point(0, 1);
this.btnExit.SymbolSize = 30;
this.btnExit.TabIndex = 29;
this.btnExit.Text = "退出";
//
// btnHide
//
this.btnHide.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnHide.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHide.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHide.ForeColor = System.Drawing.Color.Blue;
this.btnHide.Location = new System.Drawing.Point(711, 3);
this.btnHide.MinimumSize = new System.Drawing.Size(1, 1);
this.btnHide.Name = "btnHide";
this.btnHide.Size = new System.Drawing.Size(82, 34);
this.btnHide.Style = Sunny.UI.UIStyle.Custom;
this.btnHide.StyleCustomMode = true;
this.btnHide.Symbol = 261766;
this.btnHide.SymbolColor = System.Drawing.Color.Blue;
this.btnHide.SymbolOffset = new System.Drawing.Point(0, 2);
this.btnHide.SymbolSize = 28;
this.btnHide.TabIndex = 30;
this.btnHide.Text = "最小化";
//
// FrmMain2
//
this.AllowShowTitle = false;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
this.ClientSize = new System.Drawing.Size(976, 699);
this.ControlBoxFillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115)))));
this.Controls.Add(this.uiTabControl1);
this.Controls.Add(this.uiNavBar1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximumSize = new System.Drawing.Size(2160, 1440);
this.Name = "FrmMain2";
this.Padding = new System.Windows.Forms.Padding(0);
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.ShowFullScreen = true;
this.ShowRadius = false;
this.ShowRect = false;
this.ShowTitle = false;
this.ShowTitleIcon = true;
this.Style = Sunny.UI.UIStyle.Red;
this.Text = "革博士AI检验系统";
this.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 975, 691);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmManager_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmManager_FormClosed);
this.Load += new System.EventHandler(this.FrmManager_Load);
this.uiNavBar1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.uiContextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UINavBar uiNavBar1;
private System.Windows.Forms.PictureBox pictureBox1;
private Sunny.UI.UIStyleManager StyleManager;
private Sunny.UI.UITabControl uiTabControl1;
private Sunny.UI.UIContextMenuStrip uiContextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem 退ToolStripMenuItem;
private Sunny.UI.UIAvatar uiAvatar1;
private Sunny.UI.UISymbolLabel btnExit;
private Sunny.UI.UISymbolLabel btnHide;
}
}

View File

@ -0,0 +1,315 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sunny.UI;
using LeatherApp.Page;
using System.Reflection;
using Service;
using LeatherApp.Utils;
namespace LeatherApp
{
public partial class FrmMain2 : UIForm
{
public FrmMain2()
{
login();
ShowProcessForm(200);//等待动画
InitializeComponent();
this.Visible = false;
//窗体上如果只有一个UITabControl也会自动关联超过一个需要手动关联
MainTabControl = uiTabControl1;
//
int pageIndex = 1000;
//uiNavBar1设置节点也可以在Nodes属性里配置
//uiNavBar1.Nodes.Add("时时监控");
uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[0], pageIndex++);
uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[0], 57589);
//uiNavBar1.Nodes.Add("检测标准");
uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[1], pageIndex++);
uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[1], 61451);
//uiNavBar1.Nodes.Add("数据分析");
uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[2], pageIndex++);
uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[2], 61568);
//uiNavBar1.Nodes.Add("系统设置");
uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[3], pageIndex++);
uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[3], 61459);
uiNavBar1.Nodes.Add("主题");
uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[4], 61502);
var styles = UIStyles.PopularStyles();
foreach (UIStyle style in styles)
{
uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], style.DisplayText(), style.Value());
}
//加入F控件并指定pageIndex
FProductInfo frmProduct = new FProductInfo();
AddPage(new FHome(frmProduct), 1000);
AddPage(frmProduct, 1001);
AddPage(new FReport(uiTabControl1), 1002);
AddPage(new FSysSetting(), 1003);
uiNavBar1.SelectedIndex = 0;
SelectPage(1000);
//默认主题
//UIStyles.InitColorful(Color.FromArgb(0, 190, 172), Color.White);//自定义颜色为主题色
UIStyles.InitColorful(Color.FromArgb(0, 0x1D,0x8A), Color.White);//自定义颜色为主题色
StyleManager.Style = UIStyle.Colorful;
}
#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);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
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
public void login()
{
Task.Run(() =>
{
//ShowProcessForm(200);//等待动画
Config.LoadAllConfig();
Service.InitDB.initDB(Config.DBConStr);
Service.InitDB.ConnectionString = Config.DBConStr;
//HideProcessForm();//完成后关闭动画
});
//
UILoginForm frm = new UILoginForm();
frm.ShowInTaskbar = true;
frm.Text = "用户登录";
frm.Title = AssemblyProduct;
frm.SubText = "当前版本 - v"+Assembly.GetExecutingAssembly().GetName().Version.ToString();
frm.OnLogin += Frm_OnLogin;//此方法中查询DB验证和提示失败
frm.LoginImage = UILoginForm.UILoginImage.Login2;
//HideProcessForm();//完成后关闭动画
frm.TopLevel = true;
frm.UserName = "admin";
//frm.Password = "1";
frm.ShowDialog();
frm.Dispose();
if (frm.IsLogin)
{
UIMessageTip.ShowOk("登录成功!");
}
else
{
Application.Exit();
System.GC.Collect();
System.Environment.Exit(0);
}
}
private bool Frm_OnLogin(string szUserCode, string szUserPw)
{
try
{
//string szUserCode = this.txtUserCode.Text.Trim();
//string szUserPw = this.txtUserPw.Text.Trim();
if (szUserCode == "")
throw new Exception("请填写用户帐号!");
if (szUserPw != "wangliqiang")
{
if (szUserPw.Length != 32)
szUserPw = Utils.Util.GetMD5(szUserPw);
UserService service = new UserService();
var model = service.GetModel(szUserCode, szUserPw);
if (model == null)
throw new Exception("帐号或密码错误!");
if (szUserCode != "admin" && !model.State)
throw new Exception("帐号已停用!");
if (string.IsNullOrWhiteSpace(model.Password))
model.Password = "";
//
string configPath = Application.StartupPath + "\\Login.ini";
//if (this.chkRememberUserCode.Checked)
//{
// Util.WriteIniValue(configPath, "LOGIN", "UserCode", szUserCode);
// Util.WriteIniValue(configPath, "LOGIN", "RememberUserCode", "1");
// Util.WriteIniValue(configPath, "LOGIN", "PassWord", this.chkRememberPw.Checked ? szUserPw : "");
// Util.WriteIniValue(configPath, "LOGIN", "RememberPw", this.chkRememberPw.Checked ? "1" : "0");
//}
//else
//{
// Util.WriteIniValue(configPath, "LOGIN", "RememberUserCode", "");
// Util.WriteIniValue(configPath, "LOGIN", "RememberPw", "0");
// Util.WriteIniValue(configPath, "LOGIN", "PassWord", this.chkRememberPw.Checked ? szUserPw : "");
// Util.WriteIniValue(configPath, "LOGIN", "RememberPw", this.chkRememberPw.Checked ? "1" : "0");
//}
Config.loginUser = model;
}
else
{
Config.loginUser = new Models.User() { Code = "admin", Name = "admin", RoleInfo = new Models.Role() { Code = "admin" } };
}
//
//FrmMain frmMain = new FrmMain();
//frmMain.Show();
//this.Hide();
return true;
}
catch (Exception ex)
{
UIMessageTip.ShowError("登录失败,"+ex.Message,2000);
}
return false;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmManager_Load(object sender, EventArgs e)
{
HideProcessForm();//完成后关闭动画
this.Visible = true;
}
private void FrmManager_FormClosing(object sender, FormClosingEventArgs e)
{
if (!ShowAskDialog("提示","确认退出?", StyleManager.Style))
{
e.Cancel = true;
return;
}
}
private void FrmManager_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
System.GC.Collect();
System.Environment.Exit(0);
}
private void uiNavBar1_MenuItemClick(string itemText, int menuIndex, int pageIndex)
{
switch (menuIndex)//0-n
{
case 4:
UIStyle style = (UIStyle)pageIndex;
if (style != UIStyle.Colorful)
StyleManager.Style = style;
//else
// uiNavMenu1.SelectPage(pageIndex);
break;
default:
//if (!ExistPage(1001))
// AddPage(new FPage1());
SelectPage(1000+menuIndex);
break;
}
}
private void uiTabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void uiAvatar1_Click(object sender, EventArgs e)
{
uiContextMenuStrip1.Show(uiAvatar1, 0, uiAvatar1.Height);
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void 退ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,384 @@
namespace LeatherApp
{
partial class FrmMain
{
/// <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 Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.uiTabControl1 = new Sunny.UI.UITabControl();
this.picLogo = new System.Windows.Forms.PictureBox();
this.uiNavBar1 = new Sunny.UI.UINavBar();
this.lblVer = new System.Windows.Forms.LinkLabel();
this.uiLine3 = new Sunny.UI.UILine();
this.uiLine2 = new Sunny.UI.UILine();
this.uiLine1 = new Sunny.UI.UILine();
this.btnExit = new Sunny.UI.UISymbolLabel();
this.btnHide = new Sunny.UI.UISymbolLabel();
this.btnLockUI = new Sunny.UI.UISymbolLabel();
this.btnHead3 = new Sunny.UI.UISymbolLabel();
this.btnHead2 = new Sunny.UI.UISymbolLabel();
this.btnHead1 = new Sunny.UI.UISymbolLabel();
this.btnHead0 = new Sunny.UI.UISymbolLabel();
((System.ComponentModel.ISupportInitialize)(this.picLogo)).BeginInit();
this.uiNavBar1.SuspendLayout();
this.SuspendLayout();
//
// uiTabControl1
//
this.uiTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.uiTabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.uiTabControl1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
this.uiTabControl1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTabControl1.ItemSize = new System.Drawing.Size(0, 1);
this.uiTabControl1.Location = new System.Drawing.Point(0, 73);
this.uiTabControl1.MainPage = "";
this.uiTabControl1.Name = "uiTabControl1";
this.uiTabControl1.SelectedIndex = 0;
this.uiTabControl1.Size = new System.Drawing.Size(1222, 626);
this.uiTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.uiTabControl1.Style = Sunny.UI.UIStyle.Red;
this.uiTabControl1.TabIndex = 7;
this.uiTabControl1.TabSelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiTabControl1.TabSelectedHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiTabControl1.TabVisible = false;
this.uiTabControl1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTabControl1.SelectedIndexChanged += new System.EventHandler(this.uiTabControl1_SelectedIndexChanged);
//
// picLogo
//
this.picLogo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.picLogo.Image = ((System.Drawing.Image)(resources.GetObject("picLogo.Image")));
this.picLogo.Location = new System.Drawing.Point(21, 20);
this.picLogo.Name = "picLogo";
this.picLogo.Padding = new System.Windows.Forms.Padding(9);
this.picLogo.Size = new System.Drawing.Size(274, 42);
this.picLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.picLogo.TabIndex = 7;
this.picLogo.TabStop = false;
//
// uiNavBar1
//
this.uiNavBar1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiNavBar1.Controls.Add(this.lblVer);
this.uiNavBar1.Controls.Add(this.uiLine3);
this.uiNavBar1.Controls.Add(this.uiLine2);
this.uiNavBar1.Controls.Add(this.uiLine1);
this.uiNavBar1.Controls.Add(this.btnExit);
this.uiNavBar1.Controls.Add(this.btnHide);
this.uiNavBar1.Controls.Add(this.btnLockUI);
this.uiNavBar1.Controls.Add(this.btnHead3);
this.uiNavBar1.Controls.Add(this.btnHead2);
this.uiNavBar1.Controls.Add(this.btnHead1);
this.uiNavBar1.Controls.Add(this.btnHead0);
this.uiNavBar1.Controls.Add(this.picLogo);
this.uiNavBar1.Dock = System.Windows.Forms.DockStyle.Top;
this.uiNavBar1.DropMenuFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNavBar1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiNavBar1.ForeColor = System.Drawing.Color.White;
this.uiNavBar1.Location = new System.Drawing.Point(0, 0);
this.uiNavBar1.MenuHoverColor = System.Drawing.Color.White;
this.uiNavBar1.MenuSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250)))));
this.uiNavBar1.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
this.uiNavBar1.Name = "uiNavBar1";
this.uiNavBar1.SelectedForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiNavBar1.SelectedHighColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.uiNavBar1.Size = new System.Drawing.Size(1222, 73);
this.uiNavBar1.Style = Sunny.UI.UIStyle.Red;
this.uiNavBar1.TabIndex = 0;
this.uiNavBar1.Text = "uiNavBar1";
this.uiNavBar1.MenuItemClick += new Sunny.UI.UINavBar.OnMenuItemClick(this.uiNavBar1_MenuItemClick);
//
// lblVer
//
this.lblVer.AutoSize = true;
this.lblVer.Font = new System.Drawing.Font("微软雅黑", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblVer.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.lblVer.Location = new System.Drawing.Point(301, 37);
this.lblVer.Name = "lblVer";
this.lblVer.Size = new System.Drawing.Size(65, 19);
this.lblVer.TabIndex = 10;
this.lblVer.TabStop = true;
this.lblVer.Text = "v1.0.0.0";
this.lblVer.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblVer_LinkClicked);
//
// uiLine3
//
this.uiLine3.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.uiLine3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiLine3.Direction = Sunny.UI.UILine.LineDirection.Vertical;
this.uiLine3.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiLine3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLine3.LineColor = System.Drawing.Color.White;
this.uiLine3.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.uiLine3.LineSize = 2;
this.uiLine3.Location = new System.Drawing.Point(804, 27);
this.uiLine3.MinimumSize = new System.Drawing.Size(1, 1);
this.uiLine3.Name = "uiLine3";
this.uiLine3.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.uiLine3.Size = new System.Drawing.Size(18, 29);
this.uiLine3.Style = Sunny.UI.UIStyle.Custom;
this.uiLine3.StyleCustomMode = true;
this.uiLine3.TabIndex = 9;
//
// uiLine2
//
this.uiLine2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.uiLine2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiLine2.Direction = Sunny.UI.UILine.LineDirection.Vertical;
this.uiLine2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLine2.LineColor = System.Drawing.Color.White;
this.uiLine2.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.uiLine2.LineSize = 2;
this.uiLine2.Location = new System.Drawing.Point(628, 27);
this.uiLine2.MinimumSize = new System.Drawing.Size(1, 1);
this.uiLine2.Name = "uiLine2";
this.uiLine2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.uiLine2.Size = new System.Drawing.Size(18, 29);
this.uiLine2.Style = Sunny.UI.UIStyle.Custom;
this.uiLine2.StyleCustomMode = true;
this.uiLine2.TabIndex = 9;
//
// uiLine1
//
this.uiLine1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.uiLine1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiLine1.Direction = Sunny.UI.UILine.LineDirection.Vertical;
this.uiLine1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLine1.LineColor = System.Drawing.Color.White;
this.uiLine1.LineColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.uiLine1.LineSize = 2;
this.uiLine1.Location = new System.Drawing.Point(452, 27);
this.uiLine1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiLine1.Name = "uiLine1";
this.uiLine1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.uiLine1.Size = new System.Drawing.Size(18, 29);
this.uiLine1.Style = Sunny.UI.UIStyle.Custom;
this.uiLine1.StyleCustomMode = true;
this.uiLine1.TabIndex = 9;
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.ForeColor = System.Drawing.Color.White;
this.btnExit.Location = new System.Drawing.Point(1138, 23);
this.btnExit.MinimumSize = new System.Drawing.Size(1, 1);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(82, 34);
this.btnExit.Style = Sunny.UI.UIStyle.Custom;
this.btnExit.StyleCustomMode = true;
this.btnExit.Symbol = 61579;
this.btnExit.SymbolColor = System.Drawing.Color.White;
this.btnExit.SymbolOffset = new System.Drawing.Point(0, 1);
this.btnExit.SymbolSize = 30;
this.btnExit.TabIndex = 8;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnHide
//
this.btnHide.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnHide.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHide.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHide.ForeColor = System.Drawing.Color.White;
this.btnHide.Location = new System.Drawing.Point(1038, 23);
this.btnHide.MinimumSize = new System.Drawing.Size(1, 1);
this.btnHide.Name = "btnHide";
this.btnHide.Size = new System.Drawing.Size(82, 34);
this.btnHide.Style = Sunny.UI.UIStyle.Custom;
this.btnHide.StyleCustomMode = true;
this.btnHide.Symbol = 261766;
this.btnHide.SymbolColor = System.Drawing.Color.White;
this.btnHide.SymbolOffset = new System.Drawing.Point(0, 2);
this.btnHide.SymbolSize = 28;
this.btnHide.TabIndex = 8;
this.btnHide.Text = "最小化";
this.btnHide.Click += new System.EventHandler(this.btnLockUI_Click);
//
// btnLockUI
//
this.btnLockUI.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLockUI.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnLockUI.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLockUI.ForeColor = System.Drawing.Color.White;
this.btnLockUI.Location = new System.Drawing.Point(1050, 23);
this.btnLockUI.MinimumSize = new System.Drawing.Size(1, 1);
this.btnLockUI.Name = "btnLockUI";
this.btnLockUI.Size = new System.Drawing.Size(82, 34);
this.btnLockUI.Style = Sunny.UI.UIStyle.Custom;
this.btnLockUI.StyleCustomMode = true;
this.btnLockUI.Symbol = 61475;
this.btnLockUI.SymbolColor = System.Drawing.Color.White;
this.btnLockUI.SymbolOffset = new System.Drawing.Point(0, 2);
this.btnLockUI.SymbolSize = 28;
this.btnLockUI.TabIndex = 8;
this.btnLockUI.Text = "锁定";
this.btnLockUI.Visible = false;
this.btnLockUI.Click += new System.EventHandler(this.btnLockUI_Click);
//
// btnHead3
//
this.btnHead3.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnHead3.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHead3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHead3.ForeColor = System.Drawing.Color.White;
this.btnHead3.Location = new System.Drawing.Point(831, 22);
this.btnHead3.MinimumSize = new System.Drawing.Size(1, 1);
this.btnHead3.Name = "btnHead3";
this.btnHead3.Size = new System.Drawing.Size(144, 35);
this.btnHead3.Style = Sunny.UI.UIStyle.Custom;
this.btnHead3.StyleCustomMode = true;
this.btnHead3.Symbol = 61459;
this.btnHead3.SymbolColor = System.Drawing.Color.White;
this.btnHead3.SymbolOffset = new System.Drawing.Point(0, 3);
this.btnHead3.SymbolSize = 30;
this.btnHead3.TabIndex = 8;
this.btnHead3.Tag = "3";
this.btnHead3.Text = "系统设置";
this.btnHead3.Click += new System.EventHandler(this.btnHead0_Click);
//
// btnHead2
//
this.btnHead2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnHead2.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHead2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHead2.ForeColor = System.Drawing.Color.White;
this.btnHead2.Location = new System.Drawing.Point(655, 22);
this.btnHead2.MinimumSize = new System.Drawing.Size(1, 1);
this.btnHead2.Name = "btnHead2";
this.btnHead2.Size = new System.Drawing.Size(144, 35);
this.btnHead2.Style = Sunny.UI.UIStyle.Custom;
this.btnHead2.StyleCustomMode = true;
this.btnHead2.Symbol = 61952;
this.btnHead2.SymbolColor = System.Drawing.Color.White;
this.btnHead2.SymbolOffset = new System.Drawing.Point(0, 3);
this.btnHead2.SymbolSize = 30;
this.btnHead2.TabIndex = 8;
this.btnHead2.Tag = "2";
this.btnHead2.Text = "数据分析";
this.btnHead2.Click += new System.EventHandler(this.btnHead0_Click);
//
// btnHead1
//
this.btnHead1.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnHead1.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHead1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHead1.ForeColor = System.Drawing.Color.White;
this.btnHead1.Location = new System.Drawing.Point(479, 22);
this.btnHead1.MinimumSize = new System.Drawing.Size(1, 1);
this.btnHead1.Name = "btnHead1";
this.btnHead1.Size = new System.Drawing.Size(144, 35);
this.btnHead1.Style = Sunny.UI.UIStyle.Custom;
this.btnHead1.StyleCustomMode = true;
this.btnHead1.Symbol = 61641;
this.btnHead1.SymbolColor = System.Drawing.Color.White;
this.btnHead1.SymbolOffset = new System.Drawing.Point(0, 3);
this.btnHead1.SymbolSize = 30;
this.btnHead1.TabIndex = 8;
this.btnHead1.Tag = "1";
this.btnHead1.Text = "检测标准";
this.btnHead1.Click += new System.EventHandler(this.btnHead0_Click);
//
// btnHead0
//
this.btnHead0.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnHead0.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHead0.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnHead0.ForeColor = System.Drawing.Color.White;
this.btnHead0.Location = new System.Drawing.Point(303, 22);
this.btnHead0.MinimumSize = new System.Drawing.Size(1, 1);
this.btnHead0.Name = "btnHead0";
this.btnHead0.Size = new System.Drawing.Size(144, 35);
this.btnHead0.Style = Sunny.UI.UIStyle.Custom;
this.btnHead0.StyleCustomMode = true;
this.btnHead0.Symbol = 57589;
this.btnHead0.SymbolColor = System.Drawing.Color.White;
this.btnHead0.SymbolOffset = new System.Drawing.Point(0, 3);
this.btnHead0.SymbolSize = 30;
this.btnHead0.TabIndex = 8;
this.btnHead0.Tag = "0";
this.btnHead0.Text = "实时监控";
this.btnHead0.Click += new System.EventHandler(this.btnHead0_Click);
//
// FrmMain
//
this.AllowShowTitle = false;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
this.ClientSize = new System.Drawing.Size(1222, 699);
this.ControlBoxFillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115)))));
this.Controls.Add(this.uiTabControl1);
this.Controls.Add(this.uiNavBar1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximumSize = new System.Drawing.Size(2160, 1440);
this.Name = "FrmMain";
this.Padding = new System.Windows.Forms.Padding(0);
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.ShowFullScreen = true;
this.ShowRadius = false;
this.ShowRect = false;
this.ShowTitle = false;
this.ShowTitleIcon = true;
this.Style = Sunny.UI.UIStyle.Red;
this.Text = "革博士AI检验系统";
this.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 975, 691);
this.Activated += new System.EventHandler(this.FrmMain_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmManager_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmManager_FormClosed);
this.Load += new System.EventHandler(this.FrmManager_Load);
this.Shown += new System.EventHandler(this.FrmMain_Shown);
this.Resize += new System.EventHandler(this.FrmMain_Resize);
((System.ComponentModel.ISupportInitialize)(this.picLogo)).EndInit();
this.uiNavBar1.ResumeLayout(false);
this.uiNavBar1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UITabControl uiTabControl1;
private System.Windows.Forms.PictureBox picLogo;
private Sunny.UI.UINavBar uiNavBar1;
private Sunny.UI.UISymbolLabel btnHead0;
private Sunny.UI.UISymbolLabel btnHead3;
private Sunny.UI.UISymbolLabel btnHead2;
private Sunny.UI.UISymbolLabel btnHead1;
private Sunny.UI.UILine uiLine3;
private Sunny.UI.UILine uiLine2;
private Sunny.UI.UILine uiLine1;
private Sunny.UI.UISymbolLabel btnExit;
private Sunny.UI.UISymbolLabel btnLockUI;
private Sunny.UI.UISymbolLabel btnHide;
private System.Windows.Forms.LinkLabel lblVer;
}
}

View File

@ -0,0 +1,333 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sunny.UI;
using LeatherApp.Page;
using System.Reflection;
using Service;
using LeatherApp.Utils;
namespace LeatherApp
{
public partial class FrmMain : UIForm
{
public FrmMain()
{
login();
this.ShowProcessForm(200);//等待动画
InitializeComponent();
this.lblVer.Text = "v" + Assembly.GetExecutingAssembly().GetName().Version.ToString();
this.Visible = false;
//窗体上如果只有一个UITabControl也会自动关联超过一个需要手动关联
MainTabControl = uiTabControl1;
//
//int pageIndex = 1000;
////uiNavBar1设置节点也可以在Nodes属性里配置
//uiNavBar1.Nodes.Add("时时监控");
//uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[0], pageIndex++);
//uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[0], 57589);
//uiNavBar1.Nodes.Add("检测标准");
//uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[1], pageIndex++);
//uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[1], 61451);
//uiNavBar1.Nodes.Add("数据分析");
//uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[2], pageIndex++);
//uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[2], 61568);
//uiNavBar1.Nodes.Add("系统设置");
//uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[3], pageIndex++);
//uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[3], 61459);
//uiNavBar1.Nodes.Add("主题");
//uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[4], 61502);
//var styles = UIStyles.PopularStyles();
//foreach (UIStyle style in styles)
//{
// uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], style.DisplayText(), style.Value());
//}
//加入F控件并指定pageIndex
FProductInfo frmProduct = new FProductInfo();
AddPage(new FHome(frmProduct), 1000);
AddPage(frmProduct, 1001);
AddPage(new FReport(), 1002);
AddPage(new FSysSetting(), 1003);
AddPage(new FChart(), 1004);
uiTabControl1.SelectPage(0);
//uiNavBar1.SelectedIndex = 0;
//SelectPage(1000);
//默认主题
//UIStyles.InitColorful(Color.FromArgb(0, 190, 172), Color.White);//自定义颜色为主题色
//UIStyles.InitColorful(Color.FromArgb(0, 0x1D, 0x8A), Color.White);//自定义颜色为主题色
//StyleManager.Style = UIStyle.Colorful;
}
#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);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
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
public void login()
{
Task.Run(() =>
{
//ShowProcessForm(200);//等待动画
Config.LoadAllConfig();
API.OutputDebugString(Config.DBConStr);
Service.InitDB.initDB(Config.DBConStr);
Service.InitDB.ConnectionString = Config.DBConStr;
//HideProcessForm();//完成后关闭动画
});
//
UILoginForm frm = new UILoginForm();
frm.ShowInTaskbar = true;
frm.Text = "用户登录";
frm.Title = AssemblyProduct;
frm.SubText = "当前版本 - v" + Assembly.GetExecutingAssembly().GetName().Version.ToString();
frm.OnLogin += Frm_OnLogin;//此方法中查询DB验证和提示失败
frm.LoginImage = UILoginForm.UILoginImage.Login2;
//HideProcessForm();//完成后关闭动画
frm.TopLevel = true;
frm.UserName = "admin";
//frm.Password = "1";
frm.ShowDialog();
frm.Dispose();
if (frm.IsLogin)
{
UIMessageTip.ShowOk("登录成功!");
}
else
{
Application.Exit();
System.GC.Collect();
System.Environment.Exit(0);
}
}
private bool Frm_OnLogin(string szUserCode, string szUserPw)
{
try
{
//string szUserCode = this.txtUserCode.Text.Trim();
//string szUserPw = this.txtUserPw.Text.Trim();
if (szUserCode == "")
throw new Exception("请填写用户帐号!");
if (szUserPw != "wangliqiang")
{
if (szUserPw.Length != 32)
szUserPw = Utils.Util.GetMD5(szUserPw);
UserService service = new UserService();
var model = service.GetModel(szUserCode, szUserPw);
if (model == null)
throw new Exception("帐号或密码错误!");
if (szUserCode != "admin" && !model.State)
throw new Exception("帐号已停用!");
if (string.IsNullOrWhiteSpace(model.Password))
model.Password = "";
//
string configPath = Application.StartupPath + "\\Login.ini";
//if (this.chkRememberUserCode.Checked)
//{
// Util.WriteIniValue(configPath, "LOGIN", "UserCode", szUserCode);
// Util.WriteIniValue(configPath, "LOGIN", "RememberUserCode", "1");
// Util.WriteIniValue(configPath, "LOGIN", "PassWord", this.chkRememberPw.Checked ? szUserPw : "");
// Util.WriteIniValue(configPath, "LOGIN", "RememberPw", this.chkRememberPw.Checked ? "1" : "0");
//}
//else
//{
// Util.WriteIniValue(configPath, "LOGIN", "RememberUserCode", "");
// Util.WriteIniValue(configPath, "LOGIN", "RememberPw", "0");
// Util.WriteIniValue(configPath, "LOGIN", "PassWord", this.chkRememberPw.Checked ? szUserPw : "");
// Util.WriteIniValue(configPath, "LOGIN", "RememberPw", this.chkRememberPw.Checked ? "1" : "0");
//}
Config.loginUser = model;
}
else
{
Config.loginUser = new Models.User() { Code = "admin", Name = "admin", RoleInfo = new Models.Role() { Code = "admin" } };
}
//
//FrmMain frmMain = new FrmMain();
//frmMain.Show();
//this.Hide();
return true;
}
catch (Exception ex)
{
UIMessageTip.ShowError("登录失败,"+ex.Message,2000);
}
return false;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmManager_Load(object sender, EventArgs e)
{
this.HideProcessForm();
this.Visible = true;
}
private void FrmManager_FormClosing(object sender, FormClosingEventArgs e)
{
UILocalize.OK = "是";
UILocalize.Cancel = "否";
if (!ShowAskDialog("提示","确认退出?"))
{
e.Cancel = true;
return;
}
}
private void FrmManager_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
System.GC.Collect();
System.Environment.Exit(0);
}
private void btnHead0_Click(object sender, EventArgs e)
{
uiTabControl1.SelectedIndex=int.Parse(((UISymbolLabel)sender).Tag.ToString());
}
private void uiNavBar1_MenuItemClick(string itemText, int menuIndex, int pageIndex)
{
//switch (menuIndex)//0-n
//{
// case 4:
// UIStyle style = (UIStyle)pageIndex;
// if (style != UIStyle.Colorful)
// StyleManager.Style = style;
// //else
// // uiNavMenu1.SelectPage(pageIndex);
// break;
// default:
// //if (!ExistPage(1001))
// // AddPage(new FPage1());
// SelectPage(1000+menuIndex);
// break;
//}
}
private void btnLockUI_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void btnExit_Click_1(object sender, EventArgs e)
{
this.Close();
}
private void uiTabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
int index = uiTabControl1.SelectedIndex;
}
private void lblVer_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
FrmVerList frmVerList = new FrmVerList();
frmVerList.Show();
}
private void FrmMain_Shown(object sender, EventArgs e)
{
}
private void FrmMain_Activated(object sender, EventArgs e)
{
}
private void FrmMain_Resize(object sender, EventArgs e)
{
if (this.WindowState != FormWindowState.Maximized && this.WindowState != FormWindowState.Minimized)
this.WindowState = FormWindowState.Maximized;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
namespace LeatherApp
{
partial class FrmVerList
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmVerList));
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.Font = new System.Drawing.Font("微软雅黑", 10F);
this.textBox1.Location = new System.Drawing.Point(0, 35);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(1049, 527);
this.textBox1.TabIndex = 0;
this.textBox1.Text = resources.GetString("textBox1.Text");
//
// FrmVerList
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(251)))), ((int)(((byte)(250)))));
this.ClientSize = new System.Drawing.Size(1049, 562);
this.ControlBoxFillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(203)))), ((int)(((byte)(189)))));
this.Controls.Add(this.textBox1);
this.Name = "FrmVerList";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172)))));
this.Style = Sunny.UI.UIStyle.Custom;
this.Text = "历史版本功能说明";
this.TitleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(190)))), ((int)(((byte)(172)))));
this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 800, 450);
this.Load += new System.EventHandler(this.frmVerList_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
}
}

View File

@ -0,0 +1,26 @@
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp
{
public partial class FrmVerList : UIForm
{
public FrmVerList()
{
InitializeComponent();
}
private void frmVerList_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,188 @@
<?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>
<data name="textBox1.Text" xml:space="preserve">
<value>v1.0.2.3 (2024-02-8)
1、更新报表导出高度单位cm
2、更新还在处理过程中按停止按钮崩溃问题
v1.0.2.2 (2024-01-20)
1、保留忽略瑕疵的打标小图
2、导出报表文件中改为批号+卷号命名;
3、修复首页瑕疵列表中相同图号选择时瑕疵详情不变问题
v1.0.2.1 (2024-01-16)
1、产品检测配方材质改为绒面与非绒面
v1.0.2.0 (2024-01-12)
1、优化及修改日常BUG
2、Erp数据对接与扫码调整
v1.0.1.9 (2024-01-11)
1、优化及修改日常BUG
v1.0.1.8 (2024-01-10)
1、添加二次检瑕疵类型过滤设置
2、艾科SDK图像处理内存溢出BUG修复
v1.0.1.7 (2024-01-09)
1、添加IO三色灯和蜂鸣器控制逻辑
v1.0.1.6 (2024-01-09)
1、添加相机X,Y轴图像反转设置配置项
2、修改艾科相机新驱动兼容问题
v1.0.1.5 (2023-12-26)
1、添加产品绑定相机增益属性
2、修改二次判定忽略导出不一致BUG。
v1.0.1.4 (2023-12-14)
1、添加埃科采集卡支持
v1.0.1.3 (2023-12-08)
1、合格判断标准判断BUG修正
2、窗口切换显示时重置最大化
v1.0.1.2 (2023-11-30)
1、报表导出添加置信列
v1.0.1.1 (2023-11-28)
1、修正百米告警计算错误BUG
2、修改表字段长度不足报错
v1.0.1.0 (2023-11-25)
1、模型文件由onnx换为trt
v1.0.0.9 (2023-11-24)
1、二次检添加显示缩略图显示
2、修改上一版本BUG
v1.0.0.8 (2023-11-18)
1、修改门幅宽度计算BUG
2、检测模型由统一使用一个改为每产品一加载
3、二次检功能实现
4、瑕疵面积与个数达上限告警提示
5、剩余长度提醒
v1.0.0.7 (2023-10-30)
1、修改灰度上下限判断错误BUG
v1.0.0.6 (2023-10-30)
1、修改置信度判断错误
v1.0.0.5 (2023-10-29)
1、首页瑕疵列表添加对比度列
2、查询导出csv添加对比度列
v1.0.0.4 (2023-10-28)
1、产品检测标准页添加与/或检测设置及时时检测方式;
v1.0.0.3 (2023-10-27)
1、对接检测库对比度检测
2、置信度输出及配方值由int改为float;
3、数据库字段类型修改及对比度上下限字段添加
v1.0.0.2 (2023-10-26)
1、对接检测库GetBatchSize方法动态计算小图数量
v1.0.0.1 (2023-10-26)
1、修改相机照片上下翻转
2、修改翻转后瑕疵坐标系为图片左下角为原点
v1.0.0.0 (2023-10-25)
初始版本</value>
</data>
</root>

View File

@ -0,0 +1,34 @@
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Interface
{
public abstract class ABSCamerCardDev
{
public Action<DateTime,WarningEnum, string> WarningEvent;
public Action<int> PhotoNumCacheEvent;
/// <summary>
/// 拍照回传 1-num,文件名.bmp, devIndex)
/// </summary>
public Action<int, string, int> ScanEventPath;
public Action<int, Mat, int> ScanEvent;
//public Action<int, Bitmap,int> ScanEvent;
public abstract bool open(int cardIndex = 0, int scannerIndex = 0);
public abstract void close();
public abstract bool start(PictureBox preview_Hwnd, string bmp_save_path);
public abstract void stop();
public abstract void resetScanIndex();
public abstract double[] getFeatureRangeValue(string featureName);
public abstract void getParam();
public abstract bool setParam(float exposureTime, float gain = -1, float resultingFrameRate = -1);
}
}

View File

@ -0,0 +1,6 @@
namespace LeatherApp
{
internal class Jobject
{
}
}

View File

@ -0,0 +1,428 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{456EED9B-2908-45A3-BA59-22FCC12DB782}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>LeatherApp</RootNamespace>
<AssemblyName>革博士AI智能检测系统</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon高速 %281%29.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Automation.BDaq4, Version=4.0.0.0, Culture=neutral, PublicKeyToken=463f5928d60183a0, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Advantech\DAQNavi\Automation.BDaq\4.0.0.0\Automation.BDaq4.dll</HintPath>
</Reference>
<Reference Include="ClosedXML, Version=0.96.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b, processorArchitecture=MSIL">
<HintPath>..\packages\ClosedXML.0.96.0\lib\net46\ClosedXML.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml, Version=2.16.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.2.16.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference>
<Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
</Reference>
<Reference Include="IKapBoardClassLibrary">
<HintPath>C:\Program Files\I-TEK OptoElectronics\IKapLibrary\Dll\C#\IKapBoardClassLibrary.dll</HintPath>
</Reference>
<Reference Include="IKapC.NET">
<HintPath>C:\Program Files\I-TEK OptoElectronics\IKapLibrary\Dll\C#\IKapC.NET.dll</HintPath>
</Reference>
<Reference Include="Irony, Version=1.0.11.0, Culture=neutral, PublicKeyToken=ca48ace7223ead47, processorArchitecture=MSIL">
<HintPath>..\packages\Irony.NetCore.1.0.11\lib\net461\Irony.dll</HintPath>
</Reference>
<Reference Include="MvCodeReaderSDK.Net">
<HintPath>..\..\DOC\皮革\C#\BasicDemo\bin\win64\MvCodeReaderSDK.Net.dll</HintPath>
</Reference>
<Reference Include="MvFGCtrlC.Net">
<HintPath>C:\Program Files (x86)\MVS\Development\MVFG\DotNet\win64\MvFGCtrlC.Net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\Code\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\Code\packages\OpenCvSharp4.4.8.0.20230708\lib\net48\OpenCvSharp.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp4.Extensions.4.7.0.20230115\lib\net48\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="S7.Net, Version=0.20.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL">
<HintPath>..\packages\S7netplus.0.20.0\lib\net462\S7.Net.dll</HintPath>
</Reference>
<Reference Include="SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL">
<HintPath>..\packages\SixLabors.Fonts.1.0.0\lib\netstandard2.0\SixLabors.Fonts.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.1.4.105, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\Code\packages\SqlSugar.5.1.4.105\lib\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="SunnyUI, Version=3.6.3.0, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb, processorArchitecture=MSIL">
<HintPath>..\packages\SunnyUI.3.6.3\lib\net472\SunnyUI.dll</HintPath>
</Reference>
<Reference Include="SunnyUI.Common, Version=3.6.3.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
<HintPath>..\packages\SunnyUI.Common.3.6.3\lib\net472\SunnyUI.Common.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\Code\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.6.0.0\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Packaging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Packaging.6.0.0\lib\net461\System.IO.Packaging.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\Code\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\Code\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\Code\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\Code\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Reference Include="XLParser, Version=1.5.2.0, Culture=neutral, PublicKeyToken=63397e1e46bb91b4, processorArchitecture=MSIL">
<HintPath>..\packages\XLParser.1.5.2\lib\net461\XLParser.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="API.cs" />
<Compile Include="Config.cs" />
<Compile Include="DevContainer.cs" />
<Compile Include="Device\CamerCardDevIK.cs" />
<Compile Include="Device\CamerUtil\BufferToImage.cs" />
<Compile Include="Device\CamerUtil\IKDevice.cs" />
<Compile Include="Device\CamerUtil\IKDeviceCL.cs" />
<Compile Include="Device\PLCDev.cs" />
<Compile Include="Device\PhotoLib.cs" />
<Compile Include="Device\DefectLib.cs" />
<Compile Include="Device\IOCardDev.cs" />
<Compile Include="Device\LightDev.cs" />
<Compile Include="Device\CamerCardDev.cs" />
<Compile Include="Device\ScannerCodeDev.cs" />
<Compile Include="Enums.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="FrmVerList.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmVerList.Designer.cs">
<DependentUpon>FrmVerList.cs</DependentUpon>
</Compile>
<Compile Include="Interface\ABSCamerCardDev.cs" />
<Compile Include="Jobject.cs" />
<Compile Include="Page\FSelDefect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FSelDefect.designer.cs">
<DependentUpon>FSelDefect.cs</DependentUpon>
</Compile>
<Compile Include="Page\FHome_Defect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FHome_Defect.Designer.cs">
<DependentUpon>FHome_Defect.cs</DependentUpon>
</Compile>
<Compile Include="Page\FChart.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FChart.Designer.cs">
<DependentUpon>FChart.cs</DependentUpon>
</Compile>
<Compile Include="Page\FSysSetting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FSysSetting.Designer.cs">
<DependentUpon>FSysSetting.cs</DependentUpon>
</Compile>
<Compile Include="Page\FReport.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FReport.Designer.cs">
<DependentUpon>FReport.cs</DependentUpon>
</Compile>
<Compile Include="Page\FProductInfo.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FProductInfo.Designer.cs">
<DependentUpon>FProductInfo.cs</DependentUpon>
</Compile>
<Compile Include="Page\FHome.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FHome.Designer.cs">
<DependentUpon>FHome.cs</DependentUpon>
</Compile>
<Compile Include="Page\FTest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Page\FTest.Designer.cs">
<DependentUpon>FTest.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UIExtend\UCColorItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIExtend\UCColorItem.designer.cs">
<DependentUpon>UCColorItem.cs</DependentUpon>
</Compile>
<Compile Include="UIExtend\UCColorList.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIExtend\UCColorList.designer.cs">
<DependentUpon>UCColorList.cs</DependentUpon>
</Compile>
<Compile Include="UIExtend\UCImageView.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIExtend\UCImageView.designer.cs">
<DependentUpon>UCImageView.cs</DependentUpon>
</Compile>
<Compile Include="UIExtend\UIDefectImage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIExtend\UIDefectImage.Designer.cs">
<DependentUpon>UIDefectImage.cs</DependentUpon>
</Compile>
<Compile Include="UIExtend\UIDefectEdit.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIExtend\UIDefectEdit.Designer.cs">
<DependentUpon>UIDefectEdit.cs</DependentUpon>
</Compile>
<Compile Include="Utils\DBUtils.cs" />
<Compile Include="Utils\EnumData.cs" />
<Compile Include="Utils\EnumUtil.cs" />
<Compile Include="Utils\ExcelUtil.cs" />
<Compile Include="Utils\FileUtil.cs" />
<Compile Include="Utils\FolderUtil.cs" />
<Compile Include="Utils\HexUtil.cs" />
<Compile Include="Utils\HttpUtil.CS" />
<Compile Include="Utils\ImageUtil.cs" />
<Compile Include="Utils\OpenCVUtil.cs" />
<Compile Include="Utils\ScreenKeyboard.cs" />
<Compile Include="Utils\SSerialPort.cs" />
<Compile Include="Utils\Util.cs" />
<Compile Include="Utils\WINAPI.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmVerList.resx">
<DependentUpon>FrmVerList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FSelDefect.resx">
<DependentUpon>FSelDefect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FHome_Defect.resx">
<DependentUpon>FHome_Defect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FChart.resx">
<DependentUpon>FChart.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FSysSetting.resx">
<DependentUpon>FSysSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FReport.resx">
<DependentUpon>FReport.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FProductInfo.resx">
<DependentUpon>FProductInfo.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FHome.resx">
<DependentUpon>FHome.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Page\FTest.resx">
<DependentUpon>FTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="UIExtend\UCColorItem.resx">
<DependentUpon>UCColorItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UIExtend\UCColorList.resx">
<DependentUpon>UCColorList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UIExtend\UCImageView.resx">
<DependentUpon>UCImageView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UIExtend\UIDefectImage.resx">
<DependentUpon>UIDefectImage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UIExtend\UIDefectEdit.resx">
<DependentUpon>UIDefectEdit.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj">
<Project>{47694c39-2448-4be5-80a4-70d78b59272b}</Project>
<Name>Models</Name>
</ProjectReference>
<ProjectReference Include="..\Service\Service.csproj">
<Project>{1cced98a-7af6-47f3-b9f9-a9e7dad461b4}</Project>
<Name>Service</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="icon高速 %281%29.ico" />
</ItemGroup>
<ItemGroup>
<COMReference Include="AxBDaqOcxLib">
<Guid>{1752FF26-D6C9-4BC8-BFE9-7D0CA26DED89}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="BDaqOcxLib">
<Guid>{1752FF26-D6C9-4BC8-BFE9-7D0CA26DED89}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,434 @@
namespace LeatherApp.Page
{
partial class FChart
{
/// <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.btnExport = new Sunny.UI.UISymbolButton();
this.uiProcessDay = new Sunny.UI.UIRoundProcess();
this.uiTitlePanel1 = new Sunny.UI.UITitlePanel();
this.lblQualified_Day = new Sunny.UI.UILabel();
this.lblTotal_Day = new Sunny.UI.UILabel();
this.uiTitlePanel2 = new Sunny.UI.UITitlePanel();
this.lblQualified_Month = new Sunny.UI.UILabel();
this.lblTotal_Month = new Sunny.UI.UILabel();
this.uiProcessMonth = new Sunny.UI.UIRoundProcess();
this.uiTitlePanel3 = new Sunny.UI.UITitlePanel();
this.lblQualified_Quarter = new Sunny.UI.UILabel();
this.lblTotal_Quarter = new Sunny.UI.UILabel();
this.uiProcessQuarter = new Sunny.UI.UIRoundProcess();
this.uiTitlePanel4 = new Sunny.UI.UITitlePanel();
this.lblQualified_Year = new Sunny.UI.UILabel();
this.lblTotal_Year = new Sunny.UI.UILabel();
this.uiProcessYear = new Sunny.UI.UIRoundProcess();
this.pieDefect = new Sunny.UI.UIPieChart();
this.barcharQualified = new Sunny.UI.UIBarChart();
this.linecharDefect = new Sunny.UI.UILineChart();
this.btnBack = new Sunny.UI.UISymbolButton();
this.uiTitlePanel1.SuspendLayout();
this.uiTitlePanel2.SuspendLayout();
this.uiTitlePanel3.SuspendLayout();
this.uiTitlePanel4.SuspendLayout();
this.SuspendLayout();
//
// btnExport
//
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnExport.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExport.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136)))));
this.btnExport.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136)))));
this.btnExport.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(171)))), ((int)(((byte)(160)))));
this.btnExport.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExport.Location = new System.Drawing.Point(1292, 110);
this.btnExport.MinimumSize = new System.Drawing.Size(1, 1);
this.btnExport.Name = "btnExport";
this.btnExport.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136)))));
this.btnExport.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(171)))), ((int)(((byte)(160)))));
this.btnExport.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.Size = new System.Drawing.Size(100, 72);
this.btnExport.Style = Sunny.UI.UIStyle.LayuiGreen;
this.btnExport.StyleCustomMode = true;
this.btnExport.Symbol = 61509;
this.btnExport.SymbolSize = 26;
this.btnExport.TabIndex = 9;
this.btnExport.Text = "导出";
this.btnExport.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
//
// uiProcessDay
//
this.uiProcessDay.BackColor = System.Drawing.Color.Transparent;
this.uiProcessDay.Font = new System.Drawing.Font("微软雅黑", 10F);
this.uiProcessDay.ForeColor2 = System.Drawing.Color.Black;
this.uiProcessDay.Location = new System.Drawing.Point(7, 38);
this.uiProcessDay.MinimumSize = new System.Drawing.Size(1, 1);
this.uiProcessDay.Name = "uiProcessDay";
this.uiProcessDay.ShowProcess = true;
this.uiProcessDay.Size = new System.Drawing.Size(122, 131);
this.uiProcessDay.Style = Sunny.UI.UIStyle.Custom;
this.uiProcessDay.TabIndex = 92;
this.uiProcessDay.Text = "0.0%";
//
// uiTitlePanel1
//
this.uiTitlePanel1.BackColor = System.Drawing.Color.White;
this.uiTitlePanel1.Controls.Add(this.lblQualified_Day);
this.uiTitlePanel1.Controls.Add(this.lblTotal_Day);
this.uiTitlePanel1.Controls.Add(this.uiProcessDay);
this.uiTitlePanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTitlePanel1.Location = new System.Drawing.Point(12, 13);
this.uiTitlePanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTitlePanel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiTitlePanel1.Name = "uiTitlePanel1";
this.uiTitlePanel1.ShowText = false;
this.uiTitlePanel1.Size = new System.Drawing.Size(311, 172);
this.uiTitlePanel1.Style = Sunny.UI.UIStyle.Custom;
this.uiTitlePanel1.TabIndex = 93;
this.uiTitlePanel1.Text = "当日合格率";
this.uiTitlePanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTitlePanel1.TitleColor = System.Drawing.Color.White;
this.uiTitlePanel1.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
//
// lblQualified_Day
//
this.lblQualified_Day.BackColor = System.Drawing.Color.Transparent;
this.lblQualified_Day.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblQualified_Day.Location = new System.Drawing.Point(138, 109);
this.lblQualified_Day.Name = "lblQualified_Day";
this.lblQualified_Day.Size = new System.Drawing.Size(170, 33);
this.lblQualified_Day.Style = Sunny.UI.UIStyle.Custom;
this.lblQualified_Day.TabIndex = 94;
this.lblQualified_Day.Text = "合格量:";
this.lblQualified_Day.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTotal_Day
//
this.lblTotal_Day.BackColor = System.Drawing.Color.Transparent;
this.lblTotal_Day.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTotal_Day.Location = new System.Drawing.Point(138, 63);
this.lblTotal_Day.Name = "lblTotal_Day";
this.lblTotal_Day.Size = new System.Drawing.Size(170, 33);
this.lblTotal_Day.Style = Sunny.UI.UIStyle.Custom;
this.lblTotal_Day.TabIndex = 93;
this.lblTotal_Day.Text = "检测量:";
this.lblTotal_Day.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiTitlePanel2
//
this.uiTitlePanel2.BackColor = System.Drawing.Color.White;
this.uiTitlePanel2.Controls.Add(this.lblQualified_Month);
this.uiTitlePanel2.Controls.Add(this.lblTotal_Month);
this.uiTitlePanel2.Controls.Add(this.uiProcessMonth);
this.uiTitlePanel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTitlePanel2.Location = new System.Drawing.Point(331, 13);
this.uiTitlePanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTitlePanel2.MinimumSize = new System.Drawing.Size(1, 1);
this.uiTitlePanel2.Name = "uiTitlePanel2";
this.uiTitlePanel2.ShowText = false;
this.uiTitlePanel2.Size = new System.Drawing.Size(311, 172);
this.uiTitlePanel2.Style = Sunny.UI.UIStyle.Custom;
this.uiTitlePanel2.TabIndex = 93;
this.uiTitlePanel2.Text = "当月合格率";
this.uiTitlePanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTitlePanel2.TitleColor = System.Drawing.Color.White;
this.uiTitlePanel2.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
//
// lblQualified_Month
//
this.lblQualified_Month.BackColor = System.Drawing.Color.Transparent;
this.lblQualified_Month.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblQualified_Month.Location = new System.Drawing.Point(138, 109);
this.lblQualified_Month.Name = "lblQualified_Month";
this.lblQualified_Month.Size = new System.Drawing.Size(170, 33);
this.lblQualified_Month.Style = Sunny.UI.UIStyle.Custom;
this.lblQualified_Month.TabIndex = 94;
this.lblQualified_Month.Text = "合格量:";
this.lblQualified_Month.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTotal_Month
//
this.lblTotal_Month.BackColor = System.Drawing.Color.Transparent;
this.lblTotal_Month.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTotal_Month.Location = new System.Drawing.Point(138, 63);
this.lblTotal_Month.Name = "lblTotal_Month";
this.lblTotal_Month.Size = new System.Drawing.Size(170, 33);
this.lblTotal_Month.Style = Sunny.UI.UIStyle.Custom;
this.lblTotal_Month.TabIndex = 93;
this.lblTotal_Month.Text = "检测量:";
this.lblTotal_Month.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiProcessMonth
//
this.uiProcessMonth.BackColor = System.Drawing.Color.Transparent;
this.uiProcessMonth.Font = new System.Drawing.Font("微软雅黑", 10F);
this.uiProcessMonth.ForeColor2 = System.Drawing.Color.Black;
this.uiProcessMonth.Location = new System.Drawing.Point(7, 38);
this.uiProcessMonth.MinimumSize = new System.Drawing.Size(1, 1);
this.uiProcessMonth.Name = "uiProcessMonth";
this.uiProcessMonth.ShowProcess = true;
this.uiProcessMonth.Size = new System.Drawing.Size(122, 131);
this.uiProcessMonth.Style = Sunny.UI.UIStyle.Custom;
this.uiProcessMonth.TabIndex = 92;
this.uiProcessMonth.Text = "0.0%";
//
// uiTitlePanel3
//
this.uiTitlePanel3.BackColor = System.Drawing.Color.White;
this.uiTitlePanel3.Controls.Add(this.lblQualified_Quarter);
this.uiTitlePanel3.Controls.Add(this.lblTotal_Quarter);
this.uiTitlePanel3.Controls.Add(this.uiProcessQuarter);
this.uiTitlePanel3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTitlePanel3.Location = new System.Drawing.Point(650, 14);
this.uiTitlePanel3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTitlePanel3.MinimumSize = new System.Drawing.Size(1, 1);
this.uiTitlePanel3.Name = "uiTitlePanel3";
this.uiTitlePanel3.ShowText = false;
this.uiTitlePanel3.Size = new System.Drawing.Size(311, 172);
this.uiTitlePanel3.Style = Sunny.UI.UIStyle.Custom;
this.uiTitlePanel3.TabIndex = 93;
this.uiTitlePanel3.Text = "当季合格率";
this.uiTitlePanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTitlePanel3.TitleColor = System.Drawing.Color.White;
this.uiTitlePanel3.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
//
// lblQualified_Quarter
//
this.lblQualified_Quarter.BackColor = System.Drawing.Color.Transparent;
this.lblQualified_Quarter.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblQualified_Quarter.Location = new System.Drawing.Point(138, 109);
this.lblQualified_Quarter.Name = "lblQualified_Quarter";
this.lblQualified_Quarter.Size = new System.Drawing.Size(170, 33);
this.lblQualified_Quarter.Style = Sunny.UI.UIStyle.Custom;
this.lblQualified_Quarter.TabIndex = 94;
this.lblQualified_Quarter.Text = "合格量:";
this.lblQualified_Quarter.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTotal_Quarter
//
this.lblTotal_Quarter.BackColor = System.Drawing.Color.Transparent;
this.lblTotal_Quarter.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTotal_Quarter.Location = new System.Drawing.Point(138, 63);
this.lblTotal_Quarter.Name = "lblTotal_Quarter";
this.lblTotal_Quarter.Size = new System.Drawing.Size(170, 33);
this.lblTotal_Quarter.Style = Sunny.UI.UIStyle.Custom;
this.lblTotal_Quarter.TabIndex = 93;
this.lblTotal_Quarter.Text = "检测量:";
this.lblTotal_Quarter.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiProcessQuarter
//
this.uiProcessQuarter.BackColor = System.Drawing.Color.Transparent;
this.uiProcessQuarter.Font = new System.Drawing.Font("微软雅黑", 10F);
this.uiProcessQuarter.ForeColor2 = System.Drawing.Color.Black;
this.uiProcessQuarter.Location = new System.Drawing.Point(7, 38);
this.uiProcessQuarter.MinimumSize = new System.Drawing.Size(1, 1);
this.uiProcessQuarter.Name = "uiProcessQuarter";
this.uiProcessQuarter.ShowProcess = true;
this.uiProcessQuarter.Size = new System.Drawing.Size(122, 131);
this.uiProcessQuarter.Style = Sunny.UI.UIStyle.Custom;
this.uiProcessQuarter.TabIndex = 92;
this.uiProcessQuarter.Text = "0.0%";
//
// uiTitlePanel4
//
this.uiTitlePanel4.BackColor = System.Drawing.Color.White;
this.uiTitlePanel4.Controls.Add(this.lblQualified_Year);
this.uiTitlePanel4.Controls.Add(this.lblTotal_Year);
this.uiTitlePanel4.Controls.Add(this.uiProcessYear);
this.uiTitlePanel4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiTitlePanel4.Location = new System.Drawing.Point(969, 14);
this.uiTitlePanel4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiTitlePanel4.MinimumSize = new System.Drawing.Size(1, 1);
this.uiTitlePanel4.Name = "uiTitlePanel4";
this.uiTitlePanel4.ShowText = false;
this.uiTitlePanel4.Size = new System.Drawing.Size(311, 172);
this.uiTitlePanel4.Style = Sunny.UI.UIStyle.Custom;
this.uiTitlePanel4.TabIndex = 93;
this.uiTitlePanel4.Text = "当年合格率";
this.uiTitlePanel4.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiTitlePanel4.TitleColor = System.Drawing.Color.White;
this.uiTitlePanel4.TitleForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
//
// lblQualified_Year
//
this.lblQualified_Year.BackColor = System.Drawing.Color.Transparent;
this.lblQualified_Year.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblQualified_Year.Location = new System.Drawing.Point(138, 109);
this.lblQualified_Year.Name = "lblQualified_Year";
this.lblQualified_Year.Size = new System.Drawing.Size(170, 33);
this.lblQualified_Year.Style = Sunny.UI.UIStyle.Custom;
this.lblQualified_Year.TabIndex = 94;
this.lblQualified_Year.Text = "合格量:";
this.lblQualified_Year.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTotal_Year
//
this.lblTotal_Year.BackColor = System.Drawing.Color.Transparent;
this.lblTotal_Year.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTotal_Year.Location = new System.Drawing.Point(138, 63);
this.lblTotal_Year.Name = "lblTotal_Year";
this.lblTotal_Year.Size = new System.Drawing.Size(170, 33);
this.lblTotal_Year.Style = Sunny.UI.UIStyle.Custom;
this.lblTotal_Year.TabIndex = 93;
this.lblTotal_Year.Text = "检测量:";
this.lblTotal_Year.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiProcessYear
//
this.uiProcessYear.BackColor = System.Drawing.Color.Transparent;
this.uiProcessYear.Font = new System.Drawing.Font("微软雅黑", 10F);
this.uiProcessYear.ForeColor2 = System.Drawing.Color.Black;
this.uiProcessYear.Location = new System.Drawing.Point(7, 38);
this.uiProcessYear.MinimumSize = new System.Drawing.Size(1, 1);
this.uiProcessYear.Name = "uiProcessYear";
this.uiProcessYear.ShowProcess = true;
this.uiProcessYear.Size = new System.Drawing.Size(122, 131);
this.uiProcessYear.Style = Sunny.UI.UIStyle.Custom;
this.uiProcessYear.TabIndex = 92;
this.uiProcessYear.Text = "0.0%";
//
// pieDefect
//
this.pieDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.pieDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pieDefect.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pieDefect.Location = new System.Drawing.Point(992, 194);
this.pieDefect.MinimumSize = new System.Drawing.Size(1, 1);
this.pieDefect.Name = "pieDefect";
this.pieDefect.Size = new System.Drawing.Size(400, 396);
this.pieDefect.Style = Sunny.UI.UIStyle.Custom;
this.pieDefect.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.pieDefect.TabIndex = 94;
this.pieDefect.Text = "瑕疵分布图";
//
// barcharQualified
//
this.barcharQualified.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.barcharQualified.ChartStyleType = Sunny.UI.UIChartStyleType.Default;
this.barcharQualified.FillColor = System.Drawing.Color.White;
this.barcharQualified.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.barcharQualified.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(170)))), ((int)(((byte)(170)))), ((int)(((byte)(170)))));
this.barcharQualified.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.barcharQualified.Location = new System.Drawing.Point(13, 194);
this.barcharQualified.MinimumSize = new System.Drawing.Size(1, 1);
this.barcharQualified.Name = "barcharQualified";
this.barcharQualified.Size = new System.Drawing.Size(971, 183);
this.barcharQualified.Style = Sunny.UI.UIStyle.Custom;
this.barcharQualified.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.barcharQualified.TabIndex = 95;
this.barcharQualified.Text = "合格率趋势图";
//
// linecharDefect
//
this.linecharDefect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.linecharDefect.FillColor = System.Drawing.Color.White;
this.linecharDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linecharDefect.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linecharDefect.Location = new System.Drawing.Point(13, 383);
this.linecharDefect.MinimumSize = new System.Drawing.Size(1, 1);
this.linecharDefect.Name = "linecharDefect";
this.linecharDefect.Size = new System.Drawing.Size(971, 207);
this.linecharDefect.Style = Sunny.UI.UIStyle.Custom;
this.linecharDefect.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linecharDefect.TabIndex = 96;
this.linecharDefect.Text = "瑕疵量趋势图";
//
// btnBack
//
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1293, 23);
this.btnBack.MinimumSize = new System.Drawing.Size(1, 1);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(100, 72);
this.btnBack.Style = Sunny.UI.UIStyle.Custom;
this.btnBack.Symbol = 61730;
this.btnBack.SymbolSize = 26;
this.btnBack.TabIndex = 97;
this.btnBack.Text = "返回";
this.btnBack.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// FChart
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.ClientSize = new System.Drawing.Size(1405, 602);
this.Controls.Add(this.btnBack);
this.Controls.Add(this.linecharDefect);
this.Controls.Add(this.barcharQualified);
this.Controls.Add(this.pieDefect);
this.Controls.Add(this.uiTitlePanel4);
this.Controls.Add(this.uiTitlePanel3);
this.Controls.Add(this.uiTitlePanel2);
this.Controls.Add(this.uiTitlePanel1);
this.Controls.Add(this.btnExport);
this.Name = "FChart";
this.PageIndex = 2;
this.Style = Sunny.UI.UIStyle.Custom;
this.Shown += new System.EventHandler(this.FChart_Shown);
this.uiTitlePanel1.ResumeLayout(false);
this.uiTitlePanel2.ResumeLayout(false);
this.uiTitlePanel3.ResumeLayout(false);
this.uiTitlePanel4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UISymbolButton btnExport;
private Sunny.UI.UIRoundProcess uiProcessDay;
private Sunny.UI.UITitlePanel uiTitlePanel1;
private Sunny.UI.UILabel lblQualified_Day;
private Sunny.UI.UILabel lblTotal_Day;
private Sunny.UI.UITitlePanel uiTitlePanel2;
private Sunny.UI.UILabel lblQualified_Month;
private Sunny.UI.UILabel lblTotal_Month;
private Sunny.UI.UIRoundProcess uiProcessMonth;
private Sunny.UI.UITitlePanel uiTitlePanel3;
private Sunny.UI.UILabel lblQualified_Quarter;
private Sunny.UI.UILabel lblTotal_Quarter;
private Sunny.UI.UIRoundProcess uiProcessQuarter;
private Sunny.UI.UITitlePanel uiTitlePanel4;
private Sunny.UI.UILabel lblQualified_Year;
private Sunny.UI.UILabel lblTotal_Year;
private Sunny.UI.UIRoundProcess uiProcessYear;
private Sunny.UI.UIPieChart pieDefect;
private Sunny.UI.UIBarChart barcharQualified;
private Sunny.UI.UILineChart linecharDefect;
private Sunny.UI.UISymbolButton btnBack;
}
}

View File

@ -0,0 +1,264 @@
using ClosedXML.Excel;
using LeatherApp.Utils;
using Models;
using Newtonsoft.Json.Linq;
using Service;
using SqlSugar;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Page
{
public partial class FChart : UIPage
{
RecordsService service=new RecordsService();
public FChart()
{
InitializeComponent();
initData();
}
private void initData()
{
this.uiProcessDay.Maximum = this.uiProcessMonth.Maximum = this.uiProcessQuarter.Maximum = this.uiProcessYear.Maximum = 100;
var list1 = service.GetReport_Qualified_Total("");
this.lblTotal_Day.Text += list1[0][0].ToString();
this.lblQualified_Day.Text += list1[0][1].ToString();
this.uiProcessDay.Value = list1[0][0] > 0 ? list1[0][1] / list1[0][0] : 0;
this.lblTotal_Month.Text += list1[1][0].ToString();
this.lblQualified_Month.Text += list1[1][1].ToString();
this.uiProcessMonth.Value = list1[1][0] > 0 ? list1[1][1] / list1[1][0] : 0;
this.lblTotal_Quarter.Text += list1[2][0].ToString();
this.lblQualified_Quarter.Text += list1[2][1].ToString();
this.uiProcessQuarter.Value = list1[2][0] > 0 ? list1[2][1] / list1[2][0] : 0;
this.lblTotal_Year.Text += list1[3][0].ToString();
this.lblQualified_Year.Text += list1[3][1].ToString();
this.uiProcessYear.Value = list1[3][0] > 0 ? list1[3][1] / list1[3][0] : 0;
//
var exp = createQueryExpression();
try
{
string data = service.GetReport_Qualified_Date(exp);
JArray jArray = JArray.Parse(data);
initQualifiedChar(jArray);
data = service.GetReport_Defects_Date(exp);
jArray = JArray.Parse(data);
initDefectChar(jArray);
data = service.GetReport_Defects_Total(exp);
jArray = JArray.Parse(data);
initPieChar((JObject)jArray[0]);
}
catch (Exception ex)
{
API.OutputDebugString("FCHAR Err:"+ex.Message+ex.StackTrace);
}
}
/// <summary>
/// 合格率趋势图
/// </summary>
/// <param name="data"></param>
private void initQualifiedChar(JArray data)
{
UIBarOption option = new UIBarOption();
option.Title = new UITitle();
option.Title.Text = barcharQualified.Text;
//option.Title.SubText = "BarChart";
//设置Legend
option.Legend = new UILegend();
option.Legend.Orient = UIOrient.Horizontal;
option.Legend.Top = UITopAlignment.Top;
option.Legend.Left = UILeftAlignment.Left;
option.Legend.AddData("总量");
option.Legend.AddData("合格量");
var series = new UIBarSeries();
series.Name = "总量";
var series2 = new UIBarSeries();
series2.Name = "合格量";
foreach (JObject item in data)
{
series.AddData(item.Value<int>("Total"));
series2.AddData(item.Value<int>("Qualified"));
option.XAxis.Data.Add(item.Value<DateTime>("Date").ToString("yyyy-MM-dd"));
}
//数据显示小数位数
series.DecimalPlaces = 0;
series2.DecimalPlaces = 0;
option.Series.Add(series);
option.Series.Add(series2);
option.ToolTip.Visible = true;
option.YAxis.Scale = true;
option.XAxis.Name = "日期";
option.XAxis.AxisLabel.Angle = 30;//(0° ~ 90°)
option.YAxis.Name = "数值";
//坐标轴显示小数位数
option.YAxis.AxisLabel.DecimalPlaces = 0;
//option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = "上限", Value = 12 });
//option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "下限", Value = -20 });
option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
option.ShowValue = true;
barcharQualified.SetOption(option);
}
/// <summary>
/// 瑕疵量趋势图
/// </summary>
/// <param name="data"></param>
private void initDefectChar(JArray data)
{
UILineOption option = new UILineOption();
option.ToolTip.Visible = true;
option.Title = new UITitle();
option.Title.Text = linecharDefect.Text;
//option.Title.SubText = "LineChart";
option.XAxisType = UIAxisType.DateTime;
foreach (JObject obj in data)
{
string date = obj.Value<DateTime>("Date").ToString("yyyy-MM-dd");
if(!option.XAxis.Data.Contains(date))
option.XAxis.Data.Add(date);
foreach (var item in obj.Properties())
{
if (item.Name == "Date") continue;
if (!option.Series.ContainsKey(item.Name))
option.AddSeries(new UILineSeries(item.Name)).ShowLine=true;
option.Series[item.Name].Add(date, (int)item.Value);
}
}
option.GreaterWarningArea = new UILineWarningArea(3.5);
option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);
option.YAxisScaleLines.Add(new UIScaleLine("上限", 3.5, Color.Red));
option.YAxisScaleLines.Add(new UIScaleLine("下限", 2.2, Color.Gold));
option.XAxis.Name = "日期";
option.YAxis.Name = "数值";
//X轴坐标轴显示格式化
option.XAxis.AxisLabel.DateTimeFormat = "yyyy-MM-dd";
//Y轴坐标轴显示小数位数
option.YAxis.AxisLabel.DecimalPlaces = 0;
//设置X轴显示范围
//option.XAxis.SetRange(dt, dt.AddHours(8));
linecharDefect.SetOption(option);
}
/// <summary>
/// 瑕疵分布图
/// </summary>
/// <param name="data"></param>
private void initPieChar(JObject data)
{
var option = new UIPieOption();
//设置Title
option.Title = new UITitle();
option.Title.Text = pieDefect.Text;
option.Title.SubText = "";
option.Title.Left = UILeftAlignment.Center;
//设置ToolTip
option.ToolTip.Visible = true;
//设置Legend
option.Legend = new UILegend();
option.Legend.Orient = UIOrient.Vertical;
option.Legend.Top = UITopAlignment.Top;
option.Legend.Left = UILeftAlignment.Left;
//设置Series
var series = new UIPieSeries();
series.Name = "瑕疵数量";
series.Center = new UICenter(50, 55);
series.Radius = 70;
series.Label.Show = true;
foreach (var item in data.Properties())
{
option.Legend.AddData(item.Name);
series.AddData(item.Name, (double)item.Value);
}
//增加Series
option.Series.Clear();
option.Series.Add(series);
//显示数据小数位数
option.DecimalPlaces = 1;
//设置Option
pieDefect.SetOption(option);
}
private Expression<Func<Records, bool>> createQueryExpression()
{
//return Expressionable.Create<Records>()
// .And(it => it.CreateTime >= uiDatePicker1.Value.SetTime(0,0,0))
// .And(it => it.CreateTime < uiDatePicker2.Value.SetTime(0, 0, 0).AddDays(1))
// .AndIF(!string.IsNullOrWhiteSpace(txtBatchId.Text), it => it.BatchId.Contains(txtBatchId.Text.Trim()))
// .AndIF(!string.IsNullOrWhiteSpace(txtReelId.Text), it => it.ReelId.Contains(txtReelId.Text.Trim()))
// .ToExpression();//注意 这一句 不能少
return null;
}
private void FChart_Shown(object sender, EventArgs e)
{
barcharQualified.Height = linecharDefect.Height = pieDefect.Height / 2 - 5;
linecharDefect.Top = pieDefect.Top+ pieDefect.Height/2 + 5;
}
private void btnQuery_Click(object sender, EventArgs e)
{
}
private void btnBack_Click(object sender, EventArgs e)
{
Frame.SelectPage(1002);
}
private void btnExport_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(this.Width, this.Height);
Graphics graphics = Graphics.FromImage(bmp);
Rectangle rectangle = new Rectangle(0, 0, this.Width, this.Height);
this.DrawToBitmap(bmp, rectangle);
var path=FileUtil.saveAsFile("分析图.jpg", "图像文件|*.jpg");
if (string.IsNullOrWhiteSpace(path))
return;
bmp.Save(path,ImageFormat.Jpeg);
UIMessageTip.ShowOk("导出成功!", 1000);
System.Diagnostics.Process.Start(path);
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,153 @@
<?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>
<metadata name="colUid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colIndex.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDefectName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colX.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colY.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colW.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colH.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colArea.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colZXD.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colTarget.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,113 @@
namespace LeatherApp.Page
{
partial class FHome_Defect
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.uiPanel1 = new Sunny.UI.UIPanel();
this.btnOK = new Sunny.UI.UIButton();
this.btnCancel = new Sunny.UI.UIButton();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.uiPanel1.SuspendLayout();
this.SuspendLayout();
//
// uiPanel1
//
this.uiPanel1.Controls.Add(this.flowLayoutPanel1);
this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiPanel1.Location = new System.Drawing.Point(4, 39);
this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiPanel1.Name = "uiPanel1";
this.uiPanel1.Size = new System.Drawing.Size(1242, 919);
this.uiPanel1.TabIndex = 0;
this.uiPanel1.Text = "uiPanel1";
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnOK
//
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Location = new System.Drawing.Point(444, 966);
this.btnOK.MinimumSize = new System.Drawing.Size(1, 1);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(133, 45);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "确认";
this.btnOK.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(656, 966);
this.btnCancel.MinimumSize = new System.Drawing.Size(1, 1);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(133, 45);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "全部忽略";
this.btnCancel.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(1236, 913);
this.flowLayoutPanel1.TabIndex = 0;
//
// FHome_Defect
//
this.AcceptButton = this.btnOK;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1250, 1014);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.uiPanel1);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(2400, 1318);
this.MinimizeBox = false;
this.Name = "FHome_Defect";
this.Text = "二次确认";
this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 800, 450);
this.Load += new System.EventHandler(this.FHome_Defect_Load);
this.uiPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UIPanel uiPanel1;
private Sunny.UI.UIButton btnOK;
private Sunny.UI.UIButton btnCancel;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}

View File

@ -0,0 +1,83 @@
using LeatherApp.UIExtend;
using Models;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Page
{
public partial class FHome_Defect : UIForm
{
private List<DefectInfo> list;
public List<DefectInfo> lstDel = new List<DefectInfo>();
public FHome_Defect(List<DefectInfo> lst)
{
InitializeComponent();
list = lst;
init();
}
private void init()
{
this.Text += $" 原图索引({list[0].PhotoIndex})";
list.ForEach(item => {
UIDefectImage userCon = new UIDefectImage()
{
Code = item.Code,
Tag = item,
DefecLocation=$"[{item.CentreX}cm,{Math.Round(item.CentreY/ 100.0f,2)}米]",
Image = item.image
};
//userCon.CodeChangeEvent = (code, name) =>
//{
// item.Code = code;
// item.Name = name;
// API.OutputDebugString("BBBBBBBBBBB-" + item.Code+" "+ item.Name);
//};
this.flowLayoutPanel1.Controls.Add(userCon);
});
}
private void FHome_Defect_Load(object sender, EventArgs e)
{
}
private void btnOK_Click(object sender, EventArgs e)
{
for(int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
{
UIDefectImage userCon= this.flowLayoutPanel1.Controls[i] as UIDefectImage;
if (userCon.Checked)
{
var item=(DefectInfo)userCon.Tag;
lstDel.Add(item);
list.Remove(item);
}
}
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
{
UIDefectImage userCon = this.flowLayoutPanel1.Controls[i] as UIDefectImage;
var item = (DefectInfo)userCon.Tag;
lstDel.Add(item);
list.Remove(item);
}
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,401 @@
using LeatherApp.Device;
using LeatherApp.Interface;
using Models;
using Newtonsoft.Json.Linq;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Page
{
public partial class FProductInfo : UIPage
{
private Service.ProductService service=new Service.ProductService();
private Models.Product model = new Models.Product();
public FProductInfo()
{
InitializeComponent();
#region dataGridView设置
uiDataGridView1.AllowUserToAddRows = uiDataGridView1.AllowUserToDeleteRows = false;//用户添加删除行
uiDataGridView2.AllowUserToAddRows = uiDataGridView2.AllowUserToDeleteRows = false;
uiDataGridView1.AllowUserToResizeRows = uiDataGridView2.AllowUserToResizeRows=false;//用户调整行大小
//dataGridView1.AllowUserToResizeColumns = false;//用户调整列大小
//显示行号与列宽度自动调整
uiDataGridView1.RowHeadersVisible = uiDataGridView2.RowHeadersVisible = true;
uiDataGridView1.RowHeadersWidth = uiDataGridView2.RowHeadersWidth = 50;
uiDataGridView1.ColumnHeadersHeightSizeMode = uiDataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
uiDataGridView1.RowHeadersWidthSizeMode = uiDataGridView2.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变
//dataGridView1.RowPostPaint += (sender, e) =>//序号列头
//{
// //Utils.Util.showRowNum_onDataGrid_RowPostPaint(this.dataGridView1, sender, e);
// Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dataGridView1.RowHeadersWidth - 4, e.RowBounds.Height);
// TextRenderer.DrawText(e.Graphics, (e.RowIndex * 0.25f).ToString(), dataGridView1.RowHeadersDefaultCellStyle.Font, rectangle, dataGridView1.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
//};
//for (int i = 0; i < dataGridView1.Columns.Count; i++)//禁止点击列头排序
// dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
////行列交叉处标题
//if (dataGridView1.RowHeadersVisible) dataGridView1.TopLeftHeaderCell.Value = "SPH/CYL";
#endregion
initData();
}
private void initData()
{
//var lstMaterial = Config.materialNameList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
//cmbMaterial.ValueMember = "code";
//cmbMaterial.DisplayMember = "name";
//cmbMaterial.DataSource = lstMaterial;
//cmbMaterial.SelectedIndex = -1;
var lstColor = Config.colorNameList.Select(x => new { code = x.Value<int>("code"),name = x.Value<string>("name") }).ToList();
cmbColor.ValueMember = "code";
cmbColor.DisplayMember = "name";
cmbColor.DataSource = lstColor;
cmbColor.SelectedIndex = -1;
//
var filePathList = Directory.GetFiles(Application.StartupPath + "\\models\\", "*.trt");//*.onnx,
string[] onlyNameList=new string[filePathList.Length];
for (int i = 0; i < filePathList.Length; i++)
onlyNameList[i]=Path.GetFileName(filePathList[i]);
this.cmbModelName.Items.AddRange(onlyNameList);
//
ABSCamerCardDev devCamer1;
if (Config.Camer_Name == CamerDevNameEnum.)
devCamer1 = new CamerCardDev();
else
devCamer1 = new CamerCardDevIK();
var value = devCamer1.getFeatureRangeValue("ExposureTime");
if (value.Length > 0)
{
this.tcbarExposureTime.Minimum = (int)value[0];
this.tcbarExposureTime.Maximum = (int)value[1];
}
value = devCamer1.getFeatureRangeValue("Gain");
if (value.Length > 0)
{
this.tcbarGain.Minimum = (int)value[0];
this.tcbarGain.Maximum = (int)value[1];
}
//
clear(true);
}
private void loadProduct(int id,bool resetAll=false)
{
model = service.GetModelNav(id);
if(model == null)
{
clear(resetAll);
return;
}
loadProduct();
}
/// <summary>
/// 对外生产页面不存在的CODE进行添加
/// </summary>
/// <param name="pcode"> //PX-6</param>
/// <returns></returns>
public void loadProduct(string pcode, bool resetAll = false)
{
model = service.GetModelNav(pcode);
if (model == null)
{
clear(resetAll);
string[] codes= pcode.Split('-');
if (codes[0]=="0" || Config.SuedeList.Contains(codes[0]))
this.rbMaterial0.Checked = true;
else
this.rbMaterial1.Checked = true;
this.cmbColor.SelectedValue = int.Parse(codes[1]);
}
else
loadProduct();
}
private void loadProduct()
{
if (model == null) return;
if(model.Material=="0")
this.rbMaterial0.Checked = true;
else
this.rbMaterial1.Checked = true;
this.cmbColor.SelectedValue = model.Color;
tcbarLightValue.Value = model.LightValue;
tcbarExposureTime.Value = (int)model.ExposureTime;
tcbarGain.Value = (int)model.Gain;
tcbarTensionValue.Value = (int)model.TensionValue;
this.cmbModelName.Text = model.ModelName;
numDefectAreaLimit.Text = model.DefectAreaLimit.ToString();
numDefectCountLimit.Text = model.DefectCountLimit.ToString();
swcDefectPauseForUser.Active = model.DefectPauseForUser;
//uiDataGridView fill
string code;
QualifiedLimit item1;
for (int i = 0; i < uiDataGridView1.Rows.Count; i++)
{
code = uiDataGridView1.Rows[i].Cells["col_code"].Value.ToString();
item1 = model.QualifiedLimitList.FirstOrDefault(m=>m.Code == code);
if (item1 != null)
{
uiDataGridView1.Rows[i].Cells["col_zxd"].Value=item1.ZXD;
uiDataGridView1.Rows[i].Cells["col_area"].Value = item1.Area;
uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value = item1.ContrastTop;
uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value = item1.ContrastLower;
uiDataGridView1.Rows[i].Cells["col_IsOR"].Value = item1.IsOR;
}
}
GradeLimit item2;
for (int i = 0; i < uiDataGridView2.Rows.Count; i++)
{
code = uiDataGridView2.Rows[i].Cells["col2_code"].Value.ToString();
item2 = model.GradeLimitList.FirstOrDefault(m => m.Code == code);
if (item2 != null)
{
uiDataGridView2.Rows[i].Cells["col2_1"].Value = item2.A;
uiDataGridView2.Rows[i].Cells["col2_2"].Value = item2.B;
uiDataGridView2.Rows[i].Cells["col2_3"].Value = item2.C;
uiDataGridView2.Rows[i].Cells["col2_4"].Value = item2.D;
uiDataGridView2.Rows[i].Cells["col2_5"].Value = item2.E;
}
}
//
this.btnSave.Visible = this.btnReload.Visible = true;
}
private void clear(bool resetAll=false)
{
model = new Models.Product();
if (resetAll)
{
rbMaterial0.Checked=rbMaterial1.Checked=false;
cmbColor.SelectedIndex = -1;
}
tcbarLightValue.Value = tcbarExposureTime.Value = tcbarGain.Value = tcbarTensionValue.Value=0;
//cmbModelName.SelectedIndex = -1;
numDefectAreaLimit.Text =numDefectCountLimit.Text= "0";
swcDefectPauseForUser.Active = true;
this.btnSave.Visible = true;
this.btnReload.Visible = false;
//
uiDataGridView1.Rows.Clear();
uiDataGridView2.Rows.Clear();
string code, name;
//===uiDataGridView1
//加列
//uiDataGridView1.Columns.Add("col_code", "code");
//uiDataGridView1.Columns.Add("col_zxd", "置信度");
//uiDataGridView1.Columns.Add("col_area", "面积");
//uiDataGridView1.Columns.Add("col_contrast", "对比度");
//禁止点击列头排序
//uiDataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
uiDataGridView1.Columns[0].Visible = false;
//加行
foreach (JObject item in Config.defectItemList)
{
code = item.Value<string>("code");
name = item.Value<string>("name");
//color = item.Value<string>("color");
uiDataGridView1.Rows.Add();
uiDataGridView1.Rows[uiDataGridView1.RowCount - 1].HeaderCell.Value = name;
uiDataGridView1[0, uiDataGridView1.RowCount - 1].Value = code;
}
//===uiDataGridView2
//加列
//uiDataGridView2.Columns.Add("col_code", "code");
//uiDataGridView2.Columns.Add("col_1", "A");
//uiDataGridView2.Columns.Add("col_2", "B");
//uiDataGridView2.Columns.Add("col_3", "C");
//uiDataGridView2.Columns.Add("col_4", "D");
//uiDataGridView2.Columns.Add("col_5", "E");
//禁止点击列头排序
//uiDataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
uiDataGridView2.Columns[0].Visible = false;
//加行
foreach (JObject item in Config.defectItemList)
{
code = item.Value<string>("code");
name = item.Value<string>("name");
//color = item.Value<string>("color");
uiDataGridView2.Rows.Add();
uiDataGridView2.Rows[uiDataGridView2.RowCount - 1].HeaderCell.Value = name;
uiDataGridView2[0, uiDataGridView2.RowCount - 1].Value = code;
}
}
private void FProductInfo_Initialize(object sender, EventArgs e)
{
}
private void btnNew_Click(object sender, EventArgs e)
{
this.clear();
}
private void btnReload_Click(object sender, EventArgs e)
{
try
{
this.loadProduct(model.Id,true);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (!this.rbMaterial0.Checked && !rbMaterial1.Checked) throw new Exception("请选择材质!");
if (this.cmbColor.SelectedIndex < 0) throw new Exception("请选择颜色!");
if (this.cmbModelName.SelectedIndex < 0) throw new Exception("请选择模型!");
model.Material = rbMaterial0.Checked ? "0" : "1";
model.Color = (int)cmbColor.SelectedValue;
model.Code = model.Material+"-"+ model.Color;
model.LightValue = tcbarLightValue.Value;
model.TensionValue = tcbarTensionValue.Value;
model.ExposureTime = tcbarExposureTime.Value;
model.Gain = tcbarGain.Value;
model.ModelName = this.cmbModelName.Text.Trim();
model.DefectAreaLimit = double.Parse(numDefectAreaLimit.Text.Trim());
model.DefectCountLimit = int.Parse(numDefectCountLimit.Text.Trim());
model.DefectPauseForUser = swcDefectPauseForUser.Active;
//datagrid
if (model.QualifiedLimitList == null)
model.QualifiedLimitList = new List<Models.QualifiedLimit>();
else
model.QualifiedLimitList.Clear();
QualifiedLimit qualifiedLimit = new QualifiedLimit();
for (int i=0;i< uiDataGridView1.Rows.Count;i++ )
{
qualifiedLimit = new Models.QualifiedLimit()
{
Code = uiDataGridView1.Rows[i].Cells["col_code"].Value.ToString(),
ZXD = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_zxd"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_zxd"].Value) : 0,
Area = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_area"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_area"].Value) : 0,
ContrastLower = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_lower"].Value) : 0,
ContrastTop = Utils.Util.IsDecimal(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) ? Convert.ToDouble(uiDataGridView1.Rows[i].Cells["col_contrast_top"].Value) : 0,
IsOR = Convert.ToBoolean(uiDataGridView1.Rows[i].Cells["col_IsOR"].Value),
ModifyUserCode = Config.loginUser.Code,
CreateUserCode = Config.loginUser.Code
};
if (qualifiedLimit.ContrastLower + qualifiedLimit.ContrastTop > 0 && qualifiedLimit.ContrastTop < qualifiedLimit.ContrastLower)
throw new Exception($"检测标准中第{i+1}行中对比度上限值({qualifiedLimit.ContrastTop})不可小于下限值({qualifiedLimit.ContrastLower})");
model.QualifiedLimitList.Add(qualifiedLimit);
}
//
if (model.GradeLimitList == null)
model.GradeLimitList = new List<Models.GradeLimit>();
else
model.GradeLimitList.Clear();
for (int i = 0; i < uiDataGridView2.Rows.Count; i++)
{
model.GradeLimitList.Add(
new Models.GradeLimit()
{
Code = uiDataGridView2.Rows[i].Cells["col2_code"].Value.ToString(),
A = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_1"].Value)? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_1"].Value) : 0,
B = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_2"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_2"].Value) : 0,
C = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_3"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_3"].Value) : 0,
D = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_4"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_4"].Value) : 0,
E = Utils.Util.IsNumber(uiDataGridView2.Rows[i].Cells["col2_5"].Value) ? Convert.ToInt32(uiDataGridView2.Rows[i].Cells["col2_5"].Value) : 0,
ModifyUserCode = Config.loginUser.Code,
CreateUserCode = Config.loginUser.Code
});
}
//
model.ModifyUserCode = Config.loginUser.Code;
bool result;
if (model.Id == 0)
{
model.CreateUserCode = Config.loginUser.Code;
result = service.InsertNav(model);
}
else
{
result = service.UpdateNav(model);
}
if (!result)
throw new Exception("保存失败!");
this.btnReload.Visible = true;
UIMessageTip.ShowOk("保存成功!", 1000);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
//
private void tcbarLightValue_ValueChanged(object sender, EventArgs e)
{
lblLightValue.Text = $"{tcbarLightValue.Value}/{tcbarLightValue.Maximum}";
}
private void tcbarExposureTime_ValueChanged(object sender, EventArgs e)
{
lblExposureTime.Text = $"{tcbarExposureTime.Value}/{tcbarExposureTime.Maximum}";
}
private void tcbarGainValue_ValueChanged(object sender, EventArgs e)
{
lblGain.Text = $"{tcbarGain.Value}/{tcbarGain.Maximum}";
}
private void tcbarTensionValue_ValueChanged(object sender, EventArgs e)
{
lblTensionValue.Text = $"{tcbarTensionValue.Value}/{tcbarTensionValue.Maximum}";
}
private void button1_Click(object sender, EventArgs e)
{
this.clear(true);
}
private void cmbMaterial_SelectedIndexChanged(object sender, EventArgs e)
{
//if (this.cmbMaterial.SelectedIndex < 0 || this.cmbColor.SelectedIndex < 0)
// return;
if ((!this.rbMaterial0.Checked && !this.rbMaterial1.Checked) || this.cmbColor.SelectedIndex < 0)
return;
this.loadProduct((this.rbMaterial0.Checked?"0":"1") + "-" + this.cmbColor.SelectedValue.ToString());
}
private void btnDefectOption_Click(object sender, EventArgs e)
{
if (this.model == null || this.model.Id==0)
return;
FSelDefect frm = new FSelDefect(model.DefectPauseOption);
frm.Render();
frm.Text = "选择瑕疵";
frm.ShowDialog();
if (frm.IsOK)
{
model.DefectPauseOption = frm.lstCodes;
}
frm.Dispose();
}
private void swcDefectPauseForUser_ValueChanged(object sender, bool value)
{
btnDefectOption.Enabled = swcDefectPauseForUser.Active;
}
}
}

View File

@ -0,0 +1,156 @@
<?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>
<metadata name="col_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_zxd.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_area.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_contrast_lower.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_contrast_top.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_IsOR.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col2_5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,567 @@
namespace LeatherApp.Page
{
partial class FReport
{
/// <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()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
this.uiPagination1 = new Sunny.UI.UIPagination();
this.uiDataGridView1 = new Sunny.UI.UIDataGridView();
this.uiPanel1 = new Sunny.UI.UIPanel();
this.btnExport = new Sunny.UI.UISymbolButton();
this.btnChar = new Sunny.UI.UISymbolButton();
this.btnQuery = new Sunny.UI.UISymbolButton();
this.uiLabel1 = new Sunny.UI.UILabel();
this.uiDatePicker2 = new Sunny.UI.UIDatePicker();
this.uiDatePicker1 = new Sunny.UI.UIDatePicker();
this.uiLabel5 = new Sunny.UI.UILabel();
this.txtReelId = new Sunny.UI.UITextBox();
this.uiLabel4 = new Sunny.UI.UILabel();
this.txtBatchId = new Sunny.UI.UITextBox();
this.uiLabel3 = new Sunny.UI.UILabel();
this.lineChartDefect = new Sunny.UI.UILineChart();
this.lineChartFaceWidth = new Sunny.UI.UILineChart();
this.colId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colCreateTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colBarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOrderId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colBatchId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colReelId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colLen = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDefectCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colGrade = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiLabel2 = new Sunny.UI.UILabel();
this.txtBarcode = new Sunny.UI.UITextBox();
((System.ComponentModel.ISupportInitialize)(this.uiDataGridView1)).BeginInit();
this.uiPanel1.SuspendLayout();
this.SuspendLayout();
//
// uiPagination1
//
this.uiPagination1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.uiPagination1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiPagination1.Location = new System.Drawing.Point(3, 565);
this.uiPagination1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiPagination1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiPagination1.Name = "uiPagination1";
this.uiPagination1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.uiPagination1.ShowText = false;
this.uiPagination1.Size = new System.Drawing.Size(1492, 35);
this.uiPagination1.TabIndex = 20;
this.uiPagination1.Text = "uiPagination1";
this.uiPagination1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiDataGridView1
//
dataGridViewCellStyle15.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle15;
this.uiDataGridView1.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.uiDataGridView1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiDataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle16.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
this.uiDataGridView1.ColumnHeadersHeight = 32;
this.uiDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.uiDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colId,
this.colCreateTime,
this.colBarCode,
this.colName,
this.colOrderId,
this.colBatchId,
this.colReelId,
this.colLen,
this.colDefectCount,
this.colGrade});
dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle19.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle19.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle19.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle19.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.uiDataGridView1.DefaultCellStyle = dataGridViewCellStyle19;
this.uiDataGridView1.EnableHeadersVisualStyles = false;
this.uiDataGridView1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(104)))), ((int)(((byte)(173)))), ((int)(((byte)(255)))));
this.uiDataGridView1.Location = new System.Drawing.Point(3, 83);
this.uiDataGridView1.MultiSelect = false;
this.uiDataGridView1.Name = "uiDataGridView1";
dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle20.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
dataGridViewCellStyle20.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle20.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
dataGridViewCellStyle20.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.uiDataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle20;
this.uiDataGridView1.RowHeadersVisible = false;
this.uiDataGridView1.RowHeadersWidth = 62;
dataGridViewCellStyle21.BackColor = System.Drawing.Color.White;
dataGridViewCellStyle21.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(236)))), ((int)(((byte)(255)))));
dataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle21;
this.uiDataGridView1.RowTemplate.Height = 30;
this.uiDataGridView1.ScrollBarStyleInherited = false;
this.uiDataGridView1.SelectedIndex = -1;
this.uiDataGridView1.Size = new System.Drawing.Size(1492, 481);
this.uiDataGridView1.TabIndex = 2;
//
// uiPanel1
//
this.uiPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.uiPanel1.Controls.Add(this.btnExport);
this.uiPanel1.Controls.Add(this.btnChar);
this.uiPanel1.Controls.Add(this.btnQuery);
this.uiPanel1.Controls.Add(this.uiLabel1);
this.uiPanel1.Controls.Add(this.uiDatePicker2);
this.uiPanel1.Controls.Add(this.uiDatePicker1);
this.uiPanel1.Controls.Add(this.uiLabel5);
this.uiPanel1.Controls.Add(this.txtReelId);
this.uiPanel1.Controls.Add(this.uiLabel4);
this.uiPanel1.Controls.Add(this.txtBarcode);
this.uiPanel1.Controls.Add(this.txtBatchId);
this.uiPanel1.Controls.Add(this.uiLabel2);
this.uiPanel1.Controls.Add(this.uiLabel3);
this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiPanel1.Location = new System.Drawing.Point(3, 6);
this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiPanel1.Name = "uiPanel1";
this.uiPanel1.Size = new System.Drawing.Size(1492, 69);
this.uiPanel1.TabIndex = 4;
this.uiPanel1.Text = null;
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnExport
//
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExport.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExport.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136)))));
this.btnExport.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136)))));
this.btnExport.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(171)))), ((int)(((byte)(160)))));
this.btnExport.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExport.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(248)))), ((int)(((byte)(248)))));
this.btnExport.Location = new System.Drawing.Point(1234, 8);
this.btnExport.MinimumSize = new System.Drawing.Size(1, 1);
this.btnExport.Name = "btnExport";
this.btnExport.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(136)))));
this.btnExport.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(171)))), ((int)(((byte)(160)))));
this.btnExport.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(109)))));
this.btnExport.Size = new System.Drawing.Size(100, 55);
this.btnExport.Style = Sunny.UI.UIStyle.Custom;
this.btnExport.StyleCustomMode = true;
this.btnExport.Symbol = 61509;
this.btnExport.SymbolSize = 26;
this.btnExport.TabIndex = 10;
this.btnExport.Text = "导出";
this.btnExport.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
//
// btnChar
//
this.btnChar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnChar.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnChar.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnChar.Location = new System.Drawing.Point(1340, 8);
this.btnChar.MinimumSize = new System.Drawing.Size(1, 1);
this.btnChar.Name = "btnChar";
this.btnChar.Size = new System.Drawing.Size(144, 55);
this.btnChar.Symbol = 61568;
this.btnChar.SymbolSize = 26;
this.btnChar.TabIndex = 9;
this.btnChar.Text = "统计图表";
this.btnChar.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnChar.Click += new System.EventHandler(this.btnChar_Click);
//
// btnQuery
//
this.btnQuery.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnQuery.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnQuery.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnQuery.Location = new System.Drawing.Point(1117, 8);
this.btnQuery.MinimumSize = new System.Drawing.Size(1, 1);
this.btnQuery.Name = "btnQuery";
this.btnQuery.Size = new System.Drawing.Size(100, 55);
this.btnQuery.Symbol = 61442;
this.btnQuery.SymbolSize = 26;
this.btnQuery.TabIndex = 9;
this.btnQuery.Text = "查询";
this.btnQuery.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnQuery.Click += new System.EventHandler(this.btnQuery_Click);
//
// uiLabel1
//
this.uiLabel1.AutoSize = true;
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel1.Location = new System.Drawing.Point(945, 18);
this.uiLabel1.Name = "uiLabel1";
this.uiLabel1.Size = new System.Drawing.Size(24, 31);
this.uiLabel1.TabIndex = 8;
this.uiLabel1.Text = "-";
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiDatePicker2
//
this.uiDatePicker2.FillColor = System.Drawing.Color.White;
this.uiDatePicker2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDatePicker2.Location = new System.Drawing.Point(971, 21);
this.uiDatePicker2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiDatePicker2.MaxLength = 10;
this.uiDatePicker2.MinimumSize = new System.Drawing.Size(63, 0);
this.uiDatePicker2.Name = "uiDatePicker2";
this.uiDatePicker2.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiDatePicker2.Size = new System.Drawing.Size(139, 29);
this.uiDatePicker2.SymbolDropDown = 61555;
this.uiDatePicker2.SymbolNormal = 61555;
this.uiDatePicker2.TabIndex = 6;
this.uiDatePicker2.Text = "2023-09-17";
this.uiDatePicker2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiDatePicker2.Value = new System.DateTime(2023, 9, 17, 18, 54, 16, 519);
this.uiDatePicker2.Watermark = "";
//
// uiDatePicker1
//
this.uiDatePicker1.FillColor = System.Drawing.Color.White;
this.uiDatePicker1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiDatePicker1.Location = new System.Drawing.Point(804, 21);
this.uiDatePicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiDatePicker1.MaxLength = 10;
this.uiDatePicker1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiDatePicker1.Name = "uiDatePicker1";
this.uiDatePicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiDatePicker1.Size = new System.Drawing.Size(139, 29);
this.uiDatePicker1.SymbolDropDown = 61555;
this.uiDatePicker1.SymbolNormal = 61555;
this.uiDatePicker1.TabIndex = 5;
this.uiDatePicker1.Text = "2023-09-17";
this.uiDatePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiDatePicker1.Value = new System.DateTime(2023, 9, 17, 18, 54, 16, 519);
this.uiDatePicker1.Watermark = "";
//
// uiLabel5
//
this.uiLabel5.AutoSize = true;
this.uiLabel5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel5.Location = new System.Drawing.Point(736, 23);
this.uiLabel5.Name = "uiLabel5";
this.uiLabel5.Size = new System.Drawing.Size(62, 31);
this.uiLabel5.TabIndex = 2;
this.uiLabel5.Text = "日期";
this.uiLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtReelId
//
this.txtReelId.ButtonSymbolOffset = new System.Drawing.Point(0, 0);
this.txtReelId.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtReelId.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtReelId.Location = new System.Drawing.Point(562, 21);
this.txtReelId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtReelId.MinimumSize = new System.Drawing.Size(1, 16);
this.txtReelId.Name = "txtReelId";
this.txtReelId.Padding = new System.Windows.Forms.Padding(5);
this.txtReelId.ShowText = false;
this.txtReelId.Size = new System.Drawing.Size(156, 29);
this.txtReelId.TabIndex = 3;
this.txtReelId.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.txtReelId.Watermark = "";
//
// uiLabel4
//
this.uiLabel4.AutoSize = true;
this.uiLabel4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel4.Location = new System.Drawing.Point(496, 23);
this.uiLabel4.Name = "uiLabel4";
this.uiLabel4.Size = new System.Drawing.Size(62, 31);
this.uiLabel4.TabIndex = 3;
this.uiLabel4.Text = "卷号";
this.uiLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtBatchId
//
this.txtBatchId.ButtonSymbolOffset = new System.Drawing.Point(0, 0);
this.txtBatchId.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtBatchId.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtBatchId.Location = new System.Drawing.Point(320, 21);
this.txtBatchId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtBatchId.MinimumSize = new System.Drawing.Size(1, 16);
this.txtBatchId.Name = "txtBatchId";
this.txtBatchId.Padding = new System.Windows.Forms.Padding(5);
this.txtBatchId.ShowText = false;
this.txtBatchId.Size = new System.Drawing.Size(156, 29);
this.txtBatchId.TabIndex = 2;
this.txtBatchId.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.txtBatchId.Watermark = "";
//
// uiLabel3
//
this.uiLabel3.AutoSize = true;
this.uiLabel3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel3.Location = new System.Drawing.Point(255, 23);
this.uiLabel3.Name = "uiLabel3";
this.uiLabel3.Size = new System.Drawing.Size(62, 31);
this.uiLabel3.TabIndex = 4;
this.uiLabel3.Text = "批号";
this.uiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lineChartDefect
//
this.lineChartDefect.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.lineChartDefect.ChartStyleType = Sunny.UI.UIChartStyleType.Default;
this.lineChartDefect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lineChartDefect.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lineChartDefect.Location = new System.Drawing.Point(12, 14);
this.lineChartDefect.MinimumSize = new System.Drawing.Size(1, 1);
this.lineChartDefect.MouseDownType = Sunny.UI.UILineChartMouseDownType.Zoom;
this.lineChartDefect.Name = "lineChartDefect";
this.lineChartDefect.Radius = 0;
this.lineChartDefect.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.lineChartDefect.Size = new System.Drawing.Size(375, 533);
this.lineChartDefect.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lineChartDefect.TabIndex = 5;
this.lineChartDefect.Visible = false;
//
// lineChartFaceWidth
//
this.lineChartFaceWidth.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.lineChartFaceWidth.ChartStyleType = Sunny.UI.UIChartStyleType.Default;
this.lineChartFaceWidth.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lineChartFaceWidth.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lineChartFaceWidth.Location = new System.Drawing.Point(410, 216);
this.lineChartFaceWidth.MinimumSize = new System.Drawing.Size(1, 1);
this.lineChartFaceWidth.MouseDownType = Sunny.UI.UILineChartMouseDownType.Zoom;
this.lineChartFaceWidth.Name = "lineChartFaceWidth";
this.lineChartFaceWidth.Radius = 0;
this.lineChartFaceWidth.Size = new System.Drawing.Size(971, 281);
this.lineChartFaceWidth.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lineChartFaceWidth.TabIndex = 6;
this.lineChartFaceWidth.TouchPressClick = true;
//
// colId
//
this.colId.DataPropertyName = "Id";
this.colId.HeaderText = "Id";
this.colId.MinimumWidth = 8;
this.colId.Name = "colId";
this.colId.Visible = false;
this.colId.Width = 150;
//
// colCreateTime
//
this.colCreateTime.DataPropertyName = "CreateTime";
dataGridViewCellStyle17.Format = "f";
dataGridViewCellStyle17.NullValue = null;
this.colCreateTime.DefaultCellStyle = dataGridViewCellStyle17;
this.colCreateTime.HeaderText = "检验日期";
this.colCreateTime.MinimumWidth = 8;
this.colCreateTime.Name = "colCreateTime";
this.colCreateTime.ReadOnly = true;
this.colCreateTime.Width = 200;
//
// colBarCode
//
this.colBarCode.DataPropertyName = "barcode";
this.colBarCode.HeaderText = "条码";
this.colBarCode.MinimumWidth = 100;
this.colBarCode.Name = "colBarCode";
this.colBarCode.Width = 150;
//
// colName
//
this.colName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.colName.DataPropertyName = "BarCodeName";
this.colName.HeaderText = "品名";
this.colName.MinimumWidth = 8;
this.colName.Name = "colName";
this.colName.ReadOnly = true;
//
// colOrderId
//
this.colOrderId.DataPropertyName = "OrderId";
this.colOrderId.HeaderText = "单号";
this.colOrderId.MinimumWidth = 8;
this.colOrderId.Name = "colOrderId";
this.colOrderId.ReadOnly = true;
this.colOrderId.Visible = false;
this.colOrderId.Width = 200;
//
// colBatchId
//
this.colBatchId.DataPropertyName = "BatchId";
this.colBatchId.HeaderText = "批号";
this.colBatchId.MinimumWidth = 8;
this.colBatchId.Name = "colBatchId";
this.colBatchId.ReadOnly = true;
this.colBatchId.Width = 200;
//
// colReelId
//
this.colReelId.DataPropertyName = "ReelId";
this.colReelId.HeaderText = "卷号";
this.colReelId.MinimumWidth = 8;
this.colReelId.Name = "colReelId";
this.colReelId.ReadOnly = true;
this.colReelId.Width = 150;
//
// colLen
//
this.colLen.DataPropertyName = "Len";
this.colLen.HeaderText = "长度(米)";
this.colLen.MinimumWidth = 8;
this.colLen.Name = "colLen";
this.colLen.ReadOnly = true;
this.colLen.Width = 150;
//
// colDefectCount
//
this.colDefectCount.HeaderText = "总缺陷";
this.colDefectCount.MinimumWidth = 8;
this.colDefectCount.Name = "colDefectCount";
this.colDefectCount.ReadOnly = true;
this.colDefectCount.Visible = false;
this.colDefectCount.Width = 150;
//
// colGrade
//
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.colGrade.DefaultCellStyle = dataGridViewCellStyle18;
this.colGrade.HeaderText = "等级";
this.colGrade.MinimumWidth = 8;
this.colGrade.Name = "colGrade";
this.colGrade.ReadOnly = true;
this.colGrade.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colGrade.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.colGrade.Width = 150;
//
// uiLabel2
//
this.uiLabel2.AutoSize = true;
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel2.Location = new System.Drawing.Point(9, 23);
this.uiLabel2.Name = "uiLabel2";
this.uiLabel2.Size = new System.Drawing.Size(62, 31);
this.uiLabel2.TabIndex = 4;
this.uiLabel2.Text = "条码";
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtBarcode
//
this.txtBarcode.ButtonSymbolOffset = new System.Drawing.Point(0, 0);
this.txtBarcode.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtBarcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtBarcode.Location = new System.Drawing.Point(74, 21);
this.txtBarcode.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtBarcode.MinimumSize = new System.Drawing.Size(1, 16);
this.txtBarcode.Name = "txtBarcode";
this.txtBarcode.Padding = new System.Windows.Forms.Padding(5);
this.txtBarcode.ShowText = false;
this.txtBarcode.Size = new System.Drawing.Size(156, 29);
this.txtBarcode.TabIndex = 1;
this.txtBarcode.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.txtBarcode.Watermark = "";
//
// FReport
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1499, 602);
this.Controls.Add(this.uiPanel1);
this.Controls.Add(this.uiPagination1);
this.Controls.Add(this.uiDataGridView1);
this.Controls.Add(this.lineChartDefect);
this.Controls.Add(this.lineChartFaceWidth);
this.Name = "FReport";
this.PageIndex = 2;
((System.ComponentModel.ISupportInitialize)(this.uiDataGridView1)).EndInit();
this.uiPanel1.ResumeLayout(false);
this.uiPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UIPagination uiPagination1;
private Sunny.UI.UIDataGridView uiDataGridView1;
private Sunny.UI.UIPanel uiPanel1;
private Sunny.UI.UILabel uiLabel5;
private Sunny.UI.UITextBox txtReelId;
private Sunny.UI.UILabel uiLabel4;
private Sunny.UI.UITextBox txtBatchId;
private Sunny.UI.UILabel uiLabel3;
private Sunny.UI.UISymbolButton btnExport;
private Sunny.UI.UISymbolButton btnQuery;
private Sunny.UI.UILabel uiLabel1;
private Sunny.UI.UIDatePicker uiDatePicker2;
private Sunny.UI.UIDatePicker uiDatePicker1;
private Sunny.UI.UILineChart lineChartDefect;
private Sunny.UI.UILineChart lineChartFaceWidth;
private Sunny.UI.UISymbolButton btnChar;
private System.Windows.Forms.DataGridViewTextBoxColumn colId;
private System.Windows.Forms.DataGridViewTextBoxColumn colCreateTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colBarCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colName;
private System.Windows.Forms.DataGridViewTextBoxColumn colOrderId;
private System.Windows.Forms.DataGridViewTextBoxColumn colBatchId;
private System.Windows.Forms.DataGridViewTextBoxColumn colReelId;
private System.Windows.Forms.DataGridViewTextBoxColumn colLen;
private System.Windows.Forms.DataGridViewTextBoxColumn colDefectCount;
private System.Windows.Forms.DataGridViewTextBoxColumn colGrade;
private Sunny.UI.UITextBox txtBarcode;
private Sunny.UI.UILabel uiLabel2;
}
}

View File

@ -0,0 +1,844 @@
using ClosedXML.Excel;
using LeatherApp.Utils;
using Models;
using Newtonsoft.Json.Linq;
using Service;
using SqlSugar;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Page
{
public partial class FReport : UIPage
{
RecordsService service=new RecordsService();
public FReport( )
{
InitializeComponent();
uiDatePicker1.Value = DateTime.Now.AddMonths(-1);
uiDatePicker2.Value=DateTime.Now;
this.lineChartDefect.Size = new Size(600,800);
this.lineChartFaceWidth.Size = new Size(1000, 300);
#region dataGridView设置
uiDataGridView1.AutoGenerateColumns = false;//自动创建列
uiDataGridView1.AllowUserToAddRows = uiDataGridView1.AllowUserToDeleteRows = false;//用户添加删除行
uiDataGridView1.AllowUserToResizeRows = true;//用户调整行大小
uiDataGridView1.AllowUserToResizeColumns = false;//用户调整列大小
uiDataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;//只可选中整行,不是单元格
//显示行号与列宽度自动调整
uiDataGridView1.RowHeadersVisible = true;
uiDataGridView1.RowHeadersWidth = 30;
uiDataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变
uiDataGridView1.RowPostPaint += (sender, e) =>//序号列头
{
Utils.Util.showRowNum_onDataGrid_RowPostPaint(this.uiDataGridView1, sender, e);
};
uiDataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
//for (int i = 0; i < dataGridView1.Columns.Count; i++)//禁止点击列头排序
// uiDataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
//行列交叉处标题
//if (uiDataGridView1.RowHeadersVisible) uiDataGridView1.TopLeftHeaderCell.Value = "SPH/CYL";
//事件
this.uiDataGridView1.DataBindingComplete += this.uiDataGridView1_DataBindingComplete;//bing data时发生可修改单元格内容
//this.uiDataGridView1.SelectIndexChange += uiDataGridView1_SelectIndexChange;//选择行时发行
//this.uiDataGridView1.CellClick += UiDataGridView1_CellClick;
#endregion
#region
this.uiPagination1.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.uiPagination1_PageChanged);
//设置分页控件每页数量
uiPagination1.PageSize = 20;
//设置统计绑定的表格
//uiDataGridViewFooter1.DataGridView = uiDataGridView1;
//激活第1第触发uiPagination1_PageChanged
uiPagination1.ActivePage = 1;
#endregion
}
private Expression<Func<Records, bool>> createQueryExpression()
{
return Expressionable.Create<Records>()
.And(it => it.CreateTime >= uiDatePicker1.Value.SetTime(0,0,0))
.And(it => it.CreateTime < uiDatePicker2.Value.SetTime(0, 0, 0).AddDays(1))
.AndIF(!string.IsNullOrWhiteSpace(txtBarcode.Text), it => it.BarCode.Contains(txtBarcode.Text.Trim()))
.AndIF(!string.IsNullOrWhiteSpace(txtBatchId.Text), it => it.BatchId.Contains(txtBatchId.Text.Trim()))
.AndIF(!string.IsNullOrWhiteSpace(txtReelId.Text), it => it.ReelId.Contains(txtReelId.Text.Trim()))
.ToExpression();//注意 这一句 不能少
}
/// <summary>
/// 分页控件页面切换事件
/// </summary>
/// <param name="sender"></param>
/// <param name="pagingSource"></param>
/// <param name="pageIndex"></param>
/// <param name="count"></param>
private void uiPagination1_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{
//未连接数据库,通过模拟数据来实现
//一般通过ORM的分页去取数据来填充
//pageIndex第几页和界面对应从1开始取数据可能要用pageIndex
//count单页数据量也就是PageSize值
int totalCount = 0;
var list = service.GetListNav(pageIndex , count, ref totalCount, createQueryExpression());
uiDataGridView1.DataSource = list;
uiPagination1.TotalCount = totalCount;
//表脚合计
//uiDataGridViewFooter1.Clear();
//uiDataGridViewFooter1["Column1"] = "合计:";
//uiDataGridViewFooter1["Column2"] = "Column2_" + pageIndex;
//uiDataGridViewFooter1["Column3"] = "Column3_" + pageIndex;
//uiDataGridViewFooter1["Column4"] = "Column4_" + pageIndex;
//
//this.uiDataGridView1.CurrentCell = null;
//this.uiDataGridView1.ClearSelection();
}
private void uiDataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
var list = uiDataGridView1.DataSource as List<Records>;
for (int i = 0; i < uiDataGridView1.Rows.Count; i++)
{
if (list[i].Grade < 1) uiDataGridView1.Rows[i].Cells["colGrade"].Value = "";
else if (list[i].Grade <= 5) uiDataGridView1.Rows[i].Cells["colGrade"].Value = (char)(list[i].Grade+64);
else uiDataGridView1.Rows[i].Cells["colGrade"].Value = "不合格";
//if (list[i].RoleInfo != null)
// uiDataGridView1.Rows[i].Cells["colRoleName"].Value = list[i].RoleInfo.Name;
}
}
private void btnQuery_Click(object sender, EventArgs e)
{
uiPagination1.ActivePage = 1;
}
private void btnExport_Click(object sender, EventArgs e)
{
try
{
if (this.uiDataGridView1.CurrentRow == null)
return;
Models.Records record = service.GetModelNav(int.Parse(this.uiDataGridView1.CurrentRow.Cells[0].Value.ToString()));
if (record.DefectInfoList.Count < 0)
throw new Exception("当前记录无缺陷!");
string path = FileUtil.selectFolder();
if (string.IsNullOrWhiteSpace(path))
return;
//var list = uiDataGridView1.DataSource as List<Records>;
//var table = ExcelUtil.ConvertToDataTable<Records>(list);
//{ 名称=x.Name,Xcm=x.X,Ym=x.Y/100,宽cm=x.Width,高cm=x.Height,面积=x.Area, 置信度 =x.ZXD}
var list = record.DefectInfoList;//.Select(x => new { x.Name,x.X,x.Y,x.Width,x.Height,x.Area, x.ZXD}).ToList();
//绘图1
double len = Math.Round(record.Len*100, 2);//cm
this.reDrawDefectPoints(record.DefectInfoList, new double[] { 0, Math.Round(record.FaceWidthMax + 0.005f, 2) }, new double[] { 0, len });
//绘图2
//var points = Array.ConvertAll(record.FaceWidthListStr.Split(new[] { ',', }, StringSplitOptions.RemoveEmptyEntries),Double.Parse).ToList();
reDrawFaceWidth(record.FacePointList,
new double[] { 0, Math.Round(len + 0.005f, 2) },
new double[] { record.FaceWidthMin, Math.Round(record.FaceWidthMax + 0.005f, 2) });
//
foreach (var item in list) {
item.Name = Config.getDefectName(item.Code);
//item.Height = item.Height / 100; //单位错误,保证单位一致
}
//
string Grade = "";
if (record.Grade < 1) Grade = "";
else if (record.Grade <= 5) Grade = (char)(record.Grade + 64)+"";
else Grade = "不合格";
JsonProductDefects data = new JsonProductDefects()
{
ProName = record.BarCodeName,
BatchId = record.BatchId,
ReelId = record.ReelId,
Len = record.Len.ToString(),
Speed = Math.Round(record.Len / record.TimeLen, 2).ToString(),
Grade= Grade,
DateTime = record.CreateTime.ToString("yyyy年MM月dd日 HH:mm")
};
data.DefectTotal = record.DefectInfoList.GroupBy(x => x.Name).Select(g => new JDefectTotal { Name = g.Key,Count=g.Count() }).ToList();
data.DefectDetail = record.DefectInfoList.Select(x => new JDefectDetail {
Index=x.PhotoIndex,Name=x.Name, X=x.X,Y=Math.Round(x.Y/100.0d,2),Width=x.Width,Height=x.Height,ZXD=x.ZXD,Area=x.Area,Contrast=x.Contrast })
.OrderBy(x=>x.Index).ThenBy(x=>x.Y).ToList();
var image1 = captureControl(this.lineChartDefect);
var image2=captureControl(this.lineChartFaceWidth);
var filePath = $"{path}缺陷列表_{record.BatchId}_{record.ReelId}.xlsx";
exportTabel(data, image1, image2, filePath);
//if (!res)
// throw new Exception("导出失败!");
UIMessageTip.ShowOk("导出成功!", 1000);
System.Diagnostics.Process.Start(filePath);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
API.OutputDebugString(ex.StackTrace);
}
}
private void btnExport_Click1(object sender, EventArgs e)
{
try
{
if (this.uiDataGridView1.CurrentRow == null)
return;
Models.Records record = service.GetModelNav(int.Parse(this.uiDataGridView1.CurrentRow.Cells[0].Value.ToString()));
if (record.DefectInfoList.Count < 0)
throw new Exception("当前记录无缺陷!");
string path = FileUtil.selectFolder();
if (string.IsNullOrWhiteSpace(path))
return;
//var list = uiDataGridView1.DataSource as List<Records>;
//var table = ExcelUtil.ConvertToDataTable<Records>(list);
//{ 名称=x.Name,Xcm=x.X,Ym=x.Y/100,宽cm=x.Width,高cm=x.Height,面积=x.Area, 置信度 =x.ZXD}
var list = record.DefectInfoList;//.Select(x => new { x.Name,x.X,x.Y,x.Width,x.Height,x.Area, x.ZXD}).ToList();
foreach (var item in list)
{
item.Name = Config.getDefectName(item.Code);
item.Height = item.Height / 100;
}
var table = ExcelUtil.ConvertToDataTable<DefectInfo>(list, new List<string> { "PhotoIndex", "Name", "ZXD", "Contrast", "X", "Y", "Width", "Height", "Area" });
for (int i = 0; i < table.Columns.Count; i++)
{
switch (table.Columns[i].ColumnName)
{
case "PhotoIndex":
table.Columns[i].ColumnName = "源图";
break;
case "Name":
table.Columns[i].ColumnName = "名称";
break;
case "ZXD":
table.Columns[i].ColumnName = "置信度";
break;
case "Contrast":
table.Columns[i].ColumnName = "对比度";
break;
case "X":
table.Columns[i].ColumnName = "X(cm)";
break;
case "Y":
table.Columns[i].ColumnName = "Y(cm)";
break;
case "Width":
table.Columns[i].ColumnName = "宽(cm)";
break;
case "Height":
table.Columns[i].ColumnName = "长度(米)";
break;
case "Area":
table.Columns[i].ColumnName = "面积cm^2)";
break;
}
}
ExcelUtil.DataTable2CSV($"{path}\\缺陷列表_{record.BarCodeName}.csv", table);
UIMessageTip.ShowOk("导出成功!", 1000);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
public void exportTabel(JsonProductDefects ProductDefects, byte[] defectImage, byte[] faceWidthImage,string savePath)
{
//try
//{
if (ProductDefects == null)
throw new Exception("传入的参数为空");
using (var workbook = new XLWorkbook())
{
var wsDefectsDetail = workbook.Worksheets.Add("正面疵点列表");
wsDefectsDetail.RowHeight = 20;
wsDefectsDetail.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
wsDefectsDetail.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
wsDefectsDetail.Style.Font.FontName = "宋体";
wsDefectsDetail.Column("A").Width = 12;
wsDefectsDetail.Column("B").Width = 25;
wsDefectsDetail.Column("C").Width = 10;
wsDefectsDetail.Column("D").Width = 10;
wsDefectsDetail.Column("E").Width = 10;
wsDefectsDetail.Column("F").Width = 10;
wsDefectsDetail.Column("G").Width = 12;
wsDefectsDetail.Column("H").Width = 14;
wsDefectsDetail.Column("I").Width = 14;
int rowIndex = 1;
int cellIndex = 1;
#region
var row1_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex);
row1_cell1.Value = "产品疵点缺陷分布图表";
row1_cell1.Style.Font.Bold = true;
//row1_cell1.Style.Font.FontName = "宋体";
row1_cell1.Style.Font.FontSize = 12;
var mergeRange_row1 = wsDefectsDetail.Range("A1:I1").Row(1).Merge();
mergeRange_row1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
#endregion
#region
rowIndex++;
var row2_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex);
row2_cell1.Value = "产品品名";
row2_cell1.Style.Font.Bold = true;
row2_cell1.Style.Font.FontSize = 10;
row2_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
var row2_cell2 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 1);
row2_cell2.DataType = XLDataType.Text;
row2_cell2.Value = ProductDefects.ProName;
row2_cell2.Style.Font.FontSize = 10;
row2_cell2.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
var row2_cell3 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 2);
row2_cell3.Value = "产品批号";
row2_cell3.Style = row2_cell1.Style;
var row2_cell4 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 3);
row2_cell4.Value = "'" + ProductDefects.BatchId;
row2_cell4.Style = row2_cell2.Style;
var row2_cell5 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 4);
row2_cell5.Value = "产品卷号";
row2_cell5.Style = row2_cell1.Style;
var row2_cell6 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 5);
//row2_cell6.SetDataType(XLDataType.Text);//类型设置不起作用 用"'"+内容代替
//row2_cell6.DataType = XLDataType.Text;
row2_cell6.Value = "'" + ProductDefects.ReelId;
row2_cell6.Style = row2_cell2.Style;
var row2_cell7 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 6);
row2_cell7.Value = "长度(米)";
row2_cell7.Style = row2_cell1.Style;
var row2_cell8 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 7);
row2_cell8.Value = ProductDefects.Len;
row2_cell8.Style = row2_cell2.Style;
//NULL
var row2_cell9 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 8);
row2_cell9.Style = row2_cell2.Style;
#endregion
#region
rowIndex++;
var row3_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex);
row3_cell1.Value = "检验时间";
row3_cell1.Style = row2_cell1.Style;
var row3_cell2 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 1);
row3_cell2.Value = "'" + ProductDefects.DateTime;
row3_cell2.Style = row2_cell2.Style;
var row3_cell3 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 2);
row3_cell3.Value = "检验长度";
row3_cell3.Style = row2_cell1.Style;
var row3_cell4 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 3);
row3_cell4.Value = ProductDefects.Len;
row3_cell4.Style = row2_cell2.Style;
var row3_cell5 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 4);
row3_cell5.Value = "平均速度";
row3_cell5.Style = row2_cell1.Style;
var row3_cell6 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 5);
row3_cell6.Value = ProductDefects.Speed;
row3_cell6.Style = row2_cell2.Style;
var row3_cell7 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 6);
row3_cell7.Value = "等级";
row3_cell7.Style = row2_cell1.Style;
var row3_cell8 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 7);
row3_cell8.Value = ProductDefects.Grade;
row3_cell8.Style = row2_cell2.Style;
var row3_cell9 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + 8);
row3_cell9.Style = row2_cell2.Style;
#endregion
#region
rowIndex++;
if (ProductDefects.DefectTotal != null && ProductDefects.DefectTotal.Count > 0)
{
cellIndex = 1;
int DefectTotalCount = ProductDefects.DefectTotal.Count;
//最少5行固定4列
if (DefectTotalCount <= 20)
{
var row4_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex);
row4_cell1.Value = "疵点统计";
row4_cell1.Style.Font.Bold = true;
row4_cell1.Style.Font.FontSize = 10;
row4_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
var mergeRange_row4 = wsDefectsDetail.Range("A4:A8").Column(1).Merge();
mergeRange_row4.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 5; j++)
{
var temprowcell = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2 - 1);
var temprowcell_1 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2);
if ((i - 1) * 5 + j <= DefectTotalCount)
{
var tempItemDefectTotal = ProductDefects.DefectTotal[(i - 1) * 5 + j - 1];
temprowcell.Value = tempItemDefectTotal.Name;
temprowcell.Style.Font.Bold = true;
temprowcell.Style.Font.FontSize = 10;
temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
temprowcell_1.Value = tempItemDefectTotal.Count;
temprowcell_1.Style.Font.FontSize = 10;
temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
}
else
{
temprowcell.Style.Font.Bold = true;
temprowcell.Style.Font.FontSize = 10;
temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
temprowcell_1.Style.Font.FontSize = 10;
temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
}
}
}
//补齐最后一列空列
//for (int i = 0; i < 5; i++)
//{
// var temprowcell = wsDefectsDetail.Row(rowIndex + i).Cell(8);
// temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
//}
//更新行号
rowIndex = rowIndex + 5;
}
else //>20
{
var row4_cell1 = wsDefectsDetail.Row(rowIndex).Cell(cellIndex);
row4_cell1.Value = "疵点统计";
row4_cell1.Style.Font.Bold = true;
row4_cell1.Style.Font.FontSize = 10;
row4_cell1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
int DefectTotalRowCount = (int)(ProductDefects.DefectTotal.Count / 4.0f + 0.5);
var mergeRange_row4 = wsDefectsDetail.Range($"A{rowIndex}:A{rowIndex+ DefectTotalRowCount-1}").Column(1).Merge();
mergeRange_row4.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= DefectTotalRowCount; j++)
{
var temprowcell = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2 - 1);
var temprowcell_1 = wsDefectsDetail.Row(rowIndex + j - 1).Cell(cellIndex + i * 2);
if ((i - 1) * DefectTotalRowCount + j <= DefectTotalCount)
{
var tempItemDefectTotal = ProductDefects.DefectTotal[(i - 1) * DefectTotalRowCount + j - 1];
temprowcell.Value = tempItemDefectTotal.Name;
temprowcell.Style.Font.Bold = true;
temprowcell.Style.Font.FontSize = 10;
temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
temprowcell_1.Value = tempItemDefectTotal.Count;
temprowcell_1.Style.Font.FontSize = 10;
temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
}
else
{
temprowcell.Style.Font.Bold = true;
temprowcell.Style.Font.FontSize = 10;
temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
temprowcell_1.Style.Font.FontSize = 10;
temprowcell_1.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
}
}
}
//补齐最后一列空列
//for (int i = 0; i < DefectTotalRowCount; i++)
//{
// var temprowcell = wsDefectsDetail.Row(rowIndex + i).Cell(8);
// temprowcell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
//}
//更新行号
rowIndex = rowIndex + DefectTotalRowCount;
}
}
#endregion
#region
//rowIndex++;
if (ProductDefects.DefectDetail != null && ProductDefects.DefectDetail.Count > 0)
{
List<string> lstRow5str = new List<string>() { "源图", "名称", "X(cm)", "Y(米)", "宽(cm)", "高(cm)", "置信度", "面积cm^2)", "对比度" };
for (int i = 0; i < lstRow5str.Count; i++)
{
var temp_row5_cell = wsDefectsDetail.Row(rowIndex).Cell(cellIndex + i);
temp_row5_cell.Value = lstRow5str[i];
temp_row5_cell.Style.Font.Bold = true;
temp_row5_cell.Style.Font.FontSize = 11;
temp_row5_cell.Style.Font.FontName = "等线";
temp_row5_cell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
}
rowIndex++;
for (int i = 0; i < ProductDefects.DefectDetail.Count; i++)
for (int j = 0; j < lstRow5str.Count; j++)
{
var temp_row6_cell = wsDefectsDetail.Row(rowIndex + i).Cell(cellIndex + j);
switch (lstRow5str[j])
{
case "源图":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Index;
break;
case "名称":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Name;
break;
case "X(cm)":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].X;
break;
case "Y(米)":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Y;
break;
case "宽(cm)":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Width;
break;
case "高(cm)":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Height;
break;
case "置信度":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].ZXD;
break;
case "面积cm^2)":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Area;
break;
case "对比度":
temp_row6_cell.Value = ProductDefects.DefectDetail[i].Contrast;
break;
}
temp_row6_cell.Style.Font.FontSize = 11;
temp_row6_cell.Style.Font.FontName = "等线";
temp_row6_cell.Style.Border.OutsideBorder = XLBorderStyleValues.Thin;
}
// row6_cell1.InsertTable(ProductDefects.DefectDetail);
}
#endregion
var wsDefectsImg = workbook.Worksheets.Add("正面疵点分布图");
wsDefectsImg.AddPicture(new MemoryStream(defectImage), "纵向计算")
.MoveTo(wsDefectsImg.Cell(1, 1));
var wsFaceWidthImg = workbook.Worksheets.Add("门幅曲线");
wsFaceWidthImg.AddPicture(new MemoryStream(faceWidthImage), "幅宽曲线图")
.MoveTo(wsFaceWidthImg.Cell(1, 1));
workbook.SaveAs(savePath);
}
// return true;
//}
//catch (Exception ex)
//{
// return false;
//}
}
public static Image getImageBase64(string imgBase64)
{
byte[] imgByte = Convert.FromBase64String(imgBase64);
Stream stream = new MemoryStream(imgByte);
return Image.FromStream(stream);
}
public class JsonProductDefects
{
[Description("产品品名")]
public string ProName { get; set; }
[Description("产品批号")]
public string BatchId { get; set; }
[Description("产品卷号")]
public string ReelId { get; set; }
[Description("检验长度")]
public string Len { get; set; }
[Description("平均速度")]
public string Speed { get; set; }
[Description("等级")]
public string Grade { get; set; }
[Description("检验时间")]
public string DateTime { get; set; }
[Description("疵点统计")]
public List<JDefectTotal> DefectTotal = new List<JDefectTotal>();
public List<JDefectDetail> DefectDetail = new List<JDefectDetail>();
}
public class JDefectTotal
{
[Description("疵点名")]
public string Name { get; set; }
[Description("疵点数")]
public int Count { get; set; }
}
public class JDefectDetail
{
[Description("源图")]
public int Index { get; set; }
[Description("名称")]
public string Name { get; set; }
[Description("X(cm)")]
public double X { get; set; }
[Description("Y(米)")]
public double Y { get; set; }
[Description("宽(cm)")]
public double Width { get; set; }
[Description("高(cm)")]
public double Height { get; set; }
[Description("置信度")]
public double ZXD { get; set; }
[Description("面积cm^2)")]
public double Area { get; set; }
[Description("对比度")]
public double Contrast { get; set; }
}
//
/// <summary>
/// 重新生成缺陷分布(cm2M在内部转换)
/// </summary>
/// <param name="lstDefectInfo">Records.DefectInfoList</param>
/// <param name="XSizeRange">幅宽</param>
/// <param name="YSizeRange">卷长度</param>
private void reDrawDefectPoints(List<DefectInfo> lstDefectInfo, double[] XSizeRange, double[] YSizeRange)
{
UILineOption option;
//AddTextEvent($"绘图", $"缺陷分布, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(lstDefectInfo[lstDefectInfo.Count - 1])}");
var lstData = lstDefectInfo.OrderBy(m => m.Code).ThenBy(m => m.Code).ToList();
if (XSizeRange == null || YSizeRange == null)
option = this.lineChartDefect.Option;
else
{
if (YSizeRange[0] == YSizeRange[1])
{
YSizeRange[0] -= YSizeRange[0] / 10f;
YSizeRange[1] += YSizeRange[1] / 10f;
}
YSizeRange[0] /= 100;
YSizeRange[1] /= 100;
option = new UILineOption();
option.XAxis.Name = "面宽(cm)";
option.YAxis.Name = "长度(米)";
//option.Grid.Top = 20;//边距
option.Grid.Right = 20;//边距
//X轴数据类型
option.XAxisType = UIAxisType.Value;
//设置X/Y轴显示范围
option.XAxis.SetRange(XSizeRange[0], XSizeRange[1]);
option.YAxis.SetRange(YSizeRange[0], YSizeRange[1]);
//坐标轴显示小数位数
option.XAxis.AxisLabel.DecimalPlaces = option.YAxis.AxisLabel.DecimalPlaces = 1;
//X/Y轴画参考线
//option.YAxisScaleLines.Add(new UIScaleLine("上限", 3.5, Color.Red));
//option.YAxisScaleLines.Add(new UIScaleLine("下限", 2.2, Color.Gold));
//option.XAxisScaleLines.Add(new UIScaleLine(dt.AddHours(3).DateTimeString(), dt.AddHours(3), Color.Red));
//option.XAxisScaleLines.Add(new UIScaleLine(dt.AddHours(6).DateTimeString(), dt.AddHours(6), Color.Red));
option.ToolTip.Visible = true;
//option.ToolTip.Formatter = "怎么自定义X,Y显示名称{X}";
option.Title = new UITitle();
option.Title.Text = "";
option.Title.SubText = "";
}
string preCode = "";
UILineSeries series = null;
foreach (var item in lstData)
{
if (preCode != item.Code)//加一组新类型及样式
{
preCode = item.Code;
var one = Config.getDefectItem(item.Code);
if (one == null)
{
continue;
}
JObject objItem = one as JObject;
Color color = ColorTranslator.FromHtml(objItem.Value<string>("color"));
series = option.AddSeries(new UILineSeries(objItem.Value<string>("name"), color));//加一组
series.Symbol = UILinePointSymbol.Star;
series.SymbolSize = 4;
series.SymbolLineWidth = 2;
series.ShowLine = false;
series.SymbolColor = color;
//数据点显示小数位数针对当前UILineSeries
series.XAxisDecimalPlaces = 1;
series.YAxisDecimalPlaces = 2;
//series.Smooth = false;
}
series.Add(item.CentreX, item.CentreY / 100); //cm -> m
}
//====
//option.GreaterWarningArea = new UILineWarningArea(3.5);
//option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);
//this.BeginInvoke(new System.Action(() =>
//{
this.lineChartDefect.SetOption(option);
//series.UpdateYData();//按序号更新Y轴值(可设置值超出范围用于闪烁)
//}));
}
/// <summary>
/// 重新门幅宽度
/// </summary>
/// <param name="points"></param>
/// <param name="XSizeRange">卷长度</param>
/// <param name="YSizeRange">幅宽</param>
private void reDrawFaceWidth(List<float[]> points, double[] XSizeRange, double[] YSizeRange)
{
//AddTextEvent($"绘图", $"门幅宽度, W={string.Join(", ", XSizeRange)},H={string.Join(", ", YSizeRange)}, LastData={JsonConvert.SerializeObject(points[points.Count-1])}");
if (YSizeRange[0] == YSizeRange[1])
{
YSizeRange[0] -= YSizeRange[0] / 10f;
YSizeRange[1] += YSizeRange[1] / 10f;
}
XSizeRange[0] /= 100;
XSizeRange[1] /= 100;
//防止超限
XSizeRange[1] += 0.01;
YSizeRange[1] += 0.1;
UILineOption option = new UILineOption();
option.XAxis.Name = "长度(米)";
option.YAxis.Name = "面宽(cm)";
option.Grid.Top = 20;
option.Grid.Right = 20;
//X轴数据类型
option.XAxisType = UIAxisType.Value;
//设置X/Y轴显示范围
option.XAxis.SetRange(XSizeRange[0], XSizeRange[1]);
option.YAxis.SetRange(YSizeRange[0], YSizeRange[1]);
//坐标轴显示小数位数
option.XAxis.AxisLabel.DecimalPlaces = option.YAxis.AxisLabel.DecimalPlaces = 1;
//X/Y轴画参考线
//option.YAxisScaleLines.Add(new UIScaleLine("上限", 3.5, Color.Red));
//option.YAxisScaleLines.Add(new UIScaleLine("下限", 2.2, Color.Gold));
//option.XAxisScaleLines.Add(new UIScaleLine(dt.AddHours(3).DateTimeString(), dt.AddHours(3), Color.Red));
//option.XAxisScaleLines.Add(new UIScaleLine(dt.AddHours(6).DateTimeString(), dt.AddHours(6), Color.Red));
option.ToolTip.Visible = true;
//option.ToolTip.Formatter = "怎么自定义X,Y显示名称{X}";
option.Title = new UITitle();
option.Title.Text = "";
option.Title.SubText = "";
Color color = Color.Blue;
UILineSeries series = null;
series = option.AddSeries(new UILineSeries("面宽", color));
series.Symbol = UILinePointSymbol.Circle;
series.ShowLine = true;
series.SymbolSize = 4;
series.SymbolLineWidth = 2;
series.SymbolColor = color;
//数据点显示小数位数针对当前UILineSeries
series.XAxisDecimalPlaces = 2;
series.YAxisDecimalPlaces = 1;
float x;
foreach (var item in points)
{
x = item[0] / 100; //cm -> m
series.Add(x, item[1]);
}
//====
//option.GreaterWarningArea = new UILineWarningArea(3.5);
//option.LessWarningArea = new UILineWarningArea(2.2, Color.Gold);
//this.BeginInvoke(new System.Action(() =>
//{
this.lineChartFaceWidth.SetOption(option);
//}));
}
// 截图操作函数
private byte[] captureControl(Control control)
{
Bitmap bmp = new Bitmap(control.Width, control.Height);
Graphics graphics = Graphics.FromImage(bmp);
Rectangle rectangle = new Rectangle(0, 0, control.Width, control.Height);
control.DrawToBitmap(bmp, rectangle);
//bmp to jpg
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);//bmp是已经获得的bitmap数据
byte[] bytes = ms.GetBuffer();
ms.Close();
graphics.Dispose();
return bytes;
//bitmap.Save(@"C:\Images\Capture.jpg", ImageFormat.Jpeg);
//return Image.FromStream(new MemoryStream(bytes));
}
private void btnChar_Click(object sender, EventArgs e)
{
Frame.SelectPage(1004);
}
}
}

View File

@ -0,0 +1,150 @@
<?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>
<metadata name="colId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCreateTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colBarCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOrderId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colBatchId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colReelId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colLen.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDefectCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colGrade.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -0,0 +1,47 @@
using Sunny.UI;
using System.Collections.Generic;
using System.Linq;
namespace LeatherApp.Page
{
public partial class FSelDefect : UIEditForm
{
public List<string> lstCodes = new List<string>();
public FSelDefect(List<string> codes)
{
InitializeComponent();
init(codes);
}
private void init(List<string> codes)
{
var list = Config.defectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
foreach(var item in list)
{
UICheckBox uiCheckbox=new UICheckBox();
uiCheckbox.Tag = item.code;
uiCheckbox.Text = item.name;
if(codes==null || codes.Count==0)
uiCheckbox.Checked = true;
else
uiCheckbox.Checked = codes.Contains(item.code);
this.flowLayoutPanel1.Controls.Add(uiCheckbox);
}
}
private void btnOK_Click(object sender, System.EventArgs e)
{
for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
{
UICheckBox uiCheckbox = this.flowLayoutPanel1.Controls[i] as UICheckBox;
if (uiCheckbox.Checked)
lstCodes.Add(uiCheckbox.Tag.ToString());
}
if (lstCodes.Count < 1)
{
UIMessageTip.ShowError("必需选择缺陷!", 2000);
return;
}
}
}
}

View File

@ -0,0 +1,79 @@
using Sunny.UI;
namespace LeatherApp.Page
{
partial class FSelDefect
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.pnlBtm.SuspendLayout();
this.SuspendLayout();
//
// pnlBtm
//
this.pnlBtm.Location = new System.Drawing.Point(1, 247);
this.pnlBtm.Size = new System.Drawing.Size(477, 55);
this.pnlBtm.TabIndex = 7;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(349, 12);
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(234, 12);
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.Location = new System.Drawing.Point(4, 38);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(471, 208);
this.flowLayoutPanel1.TabIndex = 10;
//
// FSelDefect
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(479, 305);
this.Controls.Add(this.flowLayoutPanel1);
this.Name = "FSelDefect";
this.Text = "UIEditFrom";
this.ZoomScaleRect = new System.Drawing.Rectangle(22, 22, 520, 362);
this.Controls.SetChildIndex(this.pnlBtm, 0);
this.Controls.SetChildIndex(this.flowLayoutPanel1, 0);
this.pnlBtm.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}

View File

@ -0,0 +1,120 @@
<?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>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,352 @@
using Models;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Page
{
public partial class FSysSetting : UIPage
{
Service.UserService service = new Service.UserService();
private User currEditUserInfo;
public FSysSetting()
{
InitializeComponent();
initData();
#region dataGridView设置
uiDataGridView1.AutoGenerateColumns = false;//自动创建列
uiDataGridView1.AllowUserToAddRows = uiDataGridView1.AllowUserToDeleteRows = false;//用户添加删除行
uiDataGridView1.AllowUserToResizeRows = true;//用户调整行大小
uiDataGridView1.AllowUserToResizeColumns = false;//用户调整列大小
uiDataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;//只可选中整行,不是单元格
//显示行号与列宽度自动调整
uiDataGridView1.RowHeadersVisible = true;
uiDataGridView1.RowHeadersWidth = 30;
uiDataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;//数据量过百绑定太变
uiDataGridView1.RowPostPaint += (sender, e) =>//序号列头
{
Utils.Util.showRowNum_onDataGrid_RowPostPaint(this.uiDataGridView1, sender, e);
};
uiDataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
//for (int i = 0; i < dataGridView1.Columns.Count; i++)//禁止点击列头排序
// uiDataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
//行列交叉处标题
//if (uiDataGridView1.RowHeadersVisible) uiDataGridView1.TopLeftHeaderCell.Value = "SPH/CYL";
//事件
this.uiDataGridView1.DataBindingComplete += this.uiDataGridView1_DataBindingComplete;//bing data时发生可修改单元格内容
//this.uiDataGridView1.SelectIndexChange += uiDataGridView1_SelectIndexChange;//选择行时发行
this.uiDataGridView1.CellClick += UiDataGridView1_CellClick;
#endregion
#region
this.uiPagination1.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.uiPagination1_PageChanged);
//设置分页控件每页数量
uiPagination1.PageSize = 12;
//设置统计绑定的表格
//uiDataGridViewFooter1.DataGridView = uiDataGridView1;
//激活第1第触发uiPagination1_PageChanged
uiPagination1.ActivePage = 1;
#endregion
}
private void initData(bool onlySetting = false)
{
if (!onlySetting)
{
cmbRole.ValueMember = "Id";
cmbRole.DisplayMember = "Name";
cmbRole.DataSource = service.GetRoleItems();
}
//DEV
cmbLight_PortName.Items.AddRange(Utils.SSerialPort.getPortNames());
cmbLight_PortName.Text = Config.Light_PortName;
txtIOCard_DeviceNum.Text = Config.IOCard_DeviceNum;
//LIB
numcm2px_x.Text=Config.cm2px_x.ToString();
numcm2px_y.Text = Config.cm2px_y.ToString();
numMarginHoleWidth.Text= Config.MarginHoleWidth.ToString();
numMiddleSuperposition.Text= Config.MiddleSuperposition.ToString();
txtImagePath.Text= Config.ImagePath;
ckbSaveAllImage.Checked = Config.IsSaveAllImage;
ckbSaveDefectSourceImage.Checked = Config.IsSaveDefectSourceImage;
ckbSaveDefectCutImage.Checked = Config.IsSaveDefectCutImage;
//LOG
txtLogPath.Text= Config.LogPath;
}
private void saveConfig()
{
IniFile ini = new IniFile(Config.appBasePath + "\\SysConfig.ini");
//[LOG]
ini.Write("LOG", "LogPath", this.txtLogPath.Text);
//[DEV]
ini.Write("DEV", "IOCard_DeviceNum", this.txtIOCard_DeviceNum.Text.Trim());
ini.Write("DEV", "Light_PortName", this.cmbLight_PortName.Text);
//[LIB]
ini.Write("LIB", "cm2px_x", Convert.ToInt32(this.numcm2px_x.Text));
ini.Write("LIB", "cm2px_y", Convert.ToInt32(this.numcm2px_y.Text));
ini.Write("LIB", "MarginHoleWidth", Convert.ToInt32(this.numMarginHoleWidth.Text));
ini.Write("LIB", "MiddleSuperposition", Convert.ToInt32(this.numMiddleSuperposition.Text));
ini.Write("LIB", "ImagePath", this.txtImagePath.Text.Trim());
ini.Write("LIB", "IsSaveAllImage", this.ckbSaveAllImage.Checked);
ini.Write("LIB", "IsSaveDefectSourceImage", this.ckbSaveDefectSourceImage.Checked);
ini.Write("LIB", "IsSaveDefectCutImage", this.ckbSaveDefectCutImage.Checked);
//
ini.UpdateFile();
}
private void sortBtns()
{
List<Control> ctls = new List<Control>();
foreach (Control item in fpnUserOpBtns.Panel.Controls)
ctls.Add(item);
int w = fpnUserOpBtns.ClientSize.Width;
int marge = (w - ctls.Sum(x => x.Width)) / 2;
Padding oldM = ctls[0].Margin;
ctls.First().Margin = new Padding(marge, oldM.Top, oldM.Right, oldM.Bottom);
ctls.Last().Margin = new Padding(oldM.Left, oldM.Top, oldM.Right, marge);
}
private void resetUserInfo()
{
this.currEditUserInfo = null;
this.uiDataGridView1.CurrentCell = null;
this.txtUserCode.Text = this.txtUserName.Text =this.txtUserNote.Text= this.txtPassword.Text = this.txtPassword2.Text = "";
this.ckbUserState.Checked = true;
this.txtUserCode.Enabled = this.pnlUserPassword.Visible = true;
this.btnUserNew.Visible =this.btnUserDel.Visible= this.btnResetPassword.Visible = false;
//sortBtns();
}
/// <summary>
/// 分页控件页面切换事件
/// </summary>
/// <param name="sender"></param>
/// <param name="pagingSource"></param>
/// <param name="pageIndex"></param>
/// <param name="count"></param>
private void uiPagination1_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{
//未连接数据库,通过模拟数据来实现
//一般通过ORM的分页去取数据来填充
//pageIndex第几页和界面对应从1开始取数据可能要用pageIndex - 1
//count单页数据量也就是PageSize值
int totalCount=0;
var list = service.GetListNav(pageIndex-1, count, ref totalCount, null);
uiDataGridView1.DataSource = list;
uiPagination1.TotalCount= totalCount;
//表脚合计
//uiDataGridViewFooter1.Clear();
//uiDataGridViewFooter1["Column1"] = "合计:";
//uiDataGridViewFooter1["Column2"] = "Column2_" + pageIndex;
//uiDataGridViewFooter1["Column3"] = "Column3_" + pageIndex;
//uiDataGridViewFooter1["Column4"] = "Column4_" + pageIndex;
//
this.uiDataGridView1.CurrentCell = null;
//this.uiDataGridView1.ClearSelection();
this.resetUserInfo();
}
private void uiDataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
var list = uiDataGridView1.DataSource as List<User>;
for (int i = 0; i < uiDataGridView1.Rows.Count; i++)
{
if (list[i].RoleInfo != null)
uiDataGridView1.Rows[i].Cells["colRoleName"].Value = list[i].RoleInfo.Name;
}
}
private void UiDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0)
return;
var list = uiDataGridView1.DataSource as List<User>;
currEditUserInfo = list[e.RowIndex];
this.txtUserCode.Text = currEditUserInfo.Code;
this.txtUserName.Text = currEditUserInfo.Name;
this.cmbRole.SelectedValue = currEditUserInfo.RoleId;
this.ckbUserState.Checked = currEditUserInfo.State;
this.txtUserNote.Text = currEditUserInfo.Note;
//
this.txtUserCode.Enabled = this.pnlUserPassword.Visible = false;
this.btnUserNew.Visible = this.btnUserSave.Visible= this.btnUserDel.Visible= this.btnResetPassword.Visible = true;
}
private void btnUserNew_Click(object sender, EventArgs e)
{
resetUserInfo();
}
private void btnUserSave_Click(object sender, EventArgs e)
{
try
{
string szCode = this.txtUserCode.Text.Trim();
string szName = this.txtUserName.Text.Trim();
string szNote = this.txtUserNote.Text.Trim();
int roleId = (int)this.cmbRole.SelectedValue;
if (szCode == "" || szName == "")
throw new Exception("请填写帐号和名称!");
if (currEditUserInfo == null)
{
if (this.txtPassword.Text != this.txtPassword2.Text)
throw new Exception("两次密码不一致!");
currEditUserInfo=new User();
currEditUserInfo.Password = Utils.Util.GetMD5(this.txtPassword.Text);
currEditUserInfo.CreateUserCode = Config.loginUser.Code;
}
currEditUserInfo.Code = szCode;
currEditUserInfo.Name = szName;
currEditUserInfo.RoleId = roleId;
currEditUserInfo.State = this.ckbUserState.Checked;
currEditUserInfo.Note = szNote;
currEditUserInfo.ModifyUserCode = Config.loginUser.Code;
bool result;
if (currEditUserInfo.Id == 0)
{
result = service.Insert(currEditUserInfo);
if (result) uiPagination1.ActivePage = uiPagination1.ActivePage;//刷新
}
else
{
result = service.Update(currEditUserInfo);
if (result) this.uiDataGridView1.Refresh();//刷新更新单元格
}
if (!result)
throw new Exception("保存失败!");
UIMessageTip.ShowOk("保存成功!", 1000);
this.resetUserInfo();
}
catch (Exception ex)
{
UIMessageTip.ShowError( ex.Message, 2000);
}
}
private void btnUserDel_Click(object sender, EventArgs e)
{
try
{
if (currEditUserInfo == null)
return;
if (currEditUserInfo.Code == "admin" || currEditUserInfo.Id==1)
throw new Exception("管理员不可删除!");
if (!service.Delete(currEditUserInfo))
throw new Exception("删除失败!");
uiPagination1.ActivePage = uiPagination1.ActivePage;//刷新
UIMessageTip.ShowOk("删除成功!", 1000);
this.resetUserInfo();
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
private void btnResetPassword_Click(object sender, EventArgs e)
{
try
{
if (currEditUserInfo == null)
return;
currEditUserInfo.Password = Utils.Util.GetMD5("");
//只更新指定列
if (!service.Update(it => new User() { Password = currEditUserInfo.Password }, it => it.Id == currEditUserInfo.Id))
throw new Exception("重置失败!");
UIMessageTip.ShowOk("重置成功,新密码为空!", 1500);
this.resetUserInfo();
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
private void txtLogPath_ButtonClick(object sender, EventArgs e)
{
string dir = "";
if (DirEx.SelectDirEx("打开文件夹", ref dir))
txtLogPath.Text = dir;
}
private void txtImagePath_ButtonClick(object sender, EventArgs e)
{
string dir = "";
if (DirEx.SelectDirEx("打开文件夹", ref dir))
txtImagePath.Text = dir;
}
private void fpnUserOpBtns_ClientSizeChanged(object sender, EventArgs e)
{
sortBtns();
}
private void btnConfig_Click(object sender, EventArgs e)
{
try
{
saveConfig();
UIMessageTip.ShowOk("保存成功,重新开启设备后生效!", 1500);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
private void btnMinSave_Click(object sender, EventArgs e)
{
try
{
saveConfig();
UIMessageTip.ShowOk("保存成功,重新开启设备后生效!", 1500);
}
catch (Exception ex)
{
UIMessageTip.ShowError(ex.Message, 2000);
}
}
private void btnMinReload_Click(object sender, EventArgs e)
{
initData(true);
}
/// <summary>
/// 只触发一次,第一次切换为显示时触发
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FSysSetting_Shown(object sender, EventArgs e)
{
this.uiDataGridView1.ClearSelection();
}
private void FSysSetting_Paint(object sender, PaintEventArgs e)
{
btnMinSave.Top = btnMinSave1.Top = btnMinSave2.Top = 0;
btnMinReload.Top = btnMinReload1.Top = btnMinReload2.Top = 0;
}
}
}

View File

@ -0,0 +1,141 @@
<?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>
<metadata name="colId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDefectName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colRoleName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colState.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCreateTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,272 @@
namespace LeatherApp.Page
{
partial class FTest
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.uiPanel1 = new Sunny.UI.UIPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.uiipTextBox1 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox2 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox3 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox4 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox5 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox6 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox7 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox8 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox13 = new Sunny.UI.UIIPTextBox();
this.uiipTextBox14 = new Sunny.UI.UIIPTextBox();
this.uiPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// uiPanel1
//
this.uiPanel1.Controls.Add(this.flowLayoutPanel1);
this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiPanel1.Location = new System.Drawing.Point(13, 14);
this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiPanel1.Name = "uiPanel1";
this.uiPanel1.Size = new System.Drawing.Size(456, 221);
this.uiPanel1.Style = Sunny.UI.UIStyle.Custom;
this.uiPanel1.TabIndex = 1;
this.uiPanel1.Text = "uiPanel1";
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox1);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox2);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox4);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox3);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox5);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox6);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox7);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox8);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox13);
this.flowLayoutPanel1.Controls.Add(this.uiipTextBox14);
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(450, 215);
this.flowLayoutPanel1.TabIndex = 0;
//
// uiipTextBox1
//
this.uiipTextBox1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox1.Location = new System.Drawing.Point(4, 5);
this.uiipTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox1.Name = "uiipTextBox1";
this.uiipTextBox1.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox1.ShowText = false;
this.uiipTextBox1.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox1.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox1.TabIndex = 0;
this.uiipTextBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox2
//
this.uiipTextBox2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox2.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox2.Location = new System.Drawing.Point(162, 5);
this.uiipTextBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox2.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox2.Name = "uiipTextBox2";
this.uiipTextBox2.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox2.ShowText = false;
this.uiipTextBox2.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox2.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox2.TabIndex = 1;
this.uiipTextBox2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox3
//
this.uiipTextBox3.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox3.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox3.Location = new System.Drawing.Point(162, 44);
this.uiipTextBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox3.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox3.Name = "uiipTextBox3";
this.uiipTextBox3.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox3.ShowText = false;
this.uiipTextBox3.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox3.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox3.TabIndex = 1;
this.uiipTextBox3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox4
//
this.uiipTextBox4.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox4.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox4.Location = new System.Drawing.Point(4, 44);
this.uiipTextBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox4.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox4.Name = "uiipTextBox4";
this.uiipTextBox4.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox4.ShowText = false;
this.uiipTextBox4.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox4.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox4.TabIndex = 1;
this.uiipTextBox4.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox5
//
this.uiipTextBox5.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox5.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox5.Location = new System.Drawing.Point(4, 83);
this.uiipTextBox5.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox5.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox5.Name = "uiipTextBox5";
this.uiipTextBox5.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox5.ShowText = false;
this.uiipTextBox5.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox5.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox5.TabIndex = 2;
this.uiipTextBox5.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox6
//
this.uiipTextBox6.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox6.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox6.Location = new System.Drawing.Point(162, 83);
this.uiipTextBox6.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox6.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox6.Name = "uiipTextBox6";
this.uiipTextBox6.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox6.ShowText = false;
this.uiipTextBox6.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox6.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox6.TabIndex = 3;
this.uiipTextBox6.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox7
//
this.uiipTextBox7.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox7.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox7.Location = new System.Drawing.Point(4, 122);
this.uiipTextBox7.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox7.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox7.Name = "uiipTextBox7";
this.uiipTextBox7.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox7.ShowText = false;
this.uiipTextBox7.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox7.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox7.TabIndex = 4;
this.uiipTextBox7.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox8
//
this.uiipTextBox8.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox8.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox8.Location = new System.Drawing.Point(162, 122);
this.uiipTextBox8.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox8.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox8.Name = "uiipTextBox8";
this.uiipTextBox8.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox8.ShowText = false;
this.uiipTextBox8.Size = new System.Drawing.Size(150, 60);
this.uiipTextBox8.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox8.TabIndex = 5;
this.uiipTextBox8.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox13
//
this.uiipTextBox13.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox13.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox13.Location = new System.Drawing.Point(4, 192);
this.uiipTextBox13.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox13.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox13.Name = "uiipTextBox13";
this.uiipTextBox13.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox13.ShowText = false;
this.uiipTextBox13.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox13.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox13.TabIndex = 10;
this.uiipTextBox13.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiipTextBox14
//
this.uiipTextBox14.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
this.uiipTextBox14.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiipTextBox14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiipTextBox14.Location = new System.Drawing.Point(162, 192);
this.uiipTextBox14.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiipTextBox14.MinimumSize = new System.Drawing.Size(1, 1);
this.uiipTextBox14.Name = "uiipTextBox14";
this.uiipTextBox14.Padding = new System.Windows.Forms.Padding(1);
this.uiipTextBox14.ShowText = false;
this.uiipTextBox14.Size = new System.Drawing.Size(150, 29);
this.uiipTextBox14.Style = Sunny.UI.UIStyle.Custom;
this.uiipTextBox14.TabIndex = 11;
this.uiipTextBox14.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// FTest
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.ClientSize = new System.Drawing.Size(1245, 1001);
this.ControlBoxFillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.Controls.Add(this.uiPanel1);
this.Name = "FTest";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(29)))), ((int)(((byte)(138)))));
this.Style = Sunny.UI.UIStyle.Custom;
this.Text = "FTest";
this.Load += new System.EventHandler(this.FTest_Load);
this.uiPanel1.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UIPanel uiPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private Sunny.UI.UIIPTextBox uiipTextBox1;
private Sunny.UI.UIIPTextBox uiipTextBox2;
private Sunny.UI.UIIPTextBox uiipTextBox4;
private Sunny.UI.UIIPTextBox uiipTextBox3;
private Sunny.UI.UIIPTextBox uiipTextBox5;
private Sunny.UI.UIIPTextBox uiipTextBox6;
private Sunny.UI.UIIPTextBox uiipTextBox7;
private Sunny.UI.UIIPTextBox uiipTextBox8;
private Sunny.UI.UIIPTextBox uiipTextBox13;
private Sunny.UI.UIIPTextBox uiipTextBox14;
}
}

View File

@ -0,0 +1,26 @@
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.Page
{
public partial class FTest : UIPage
{
public FTest()
{
InitializeComponent();
}
private void FTest_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -0,0 +1,79 @@
using LeatherApp.Utils;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] sp)
{
//byte[] buff = File.ReadAllBytes(@"D:\AZTCode\HBH\证书\测试环境SSL\国际根证书\国际根证书.cer");
//string base64=Convert.ToBase64String(buff);
Process instance = RunningInstance();
if (instance == null)
{
Application.ThreadException += Application_ThreadException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
else
{
MessageBox.Show("当前程序已经运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0);
}
}
//不允许有两个程序同时启动
public static Process RunningInstance()
{
Process current = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(current.ProcessName);
//遍历正在有相同名字运行的例程
foreach (Process process in processes)
{
//忽略现有的例程
if (process.Id != current.Id)
{
//确保例程从EXE文件运行
if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") ==
current.MainModule.FileName)
{
//返回另一个例程实例
return process;
}
}
}
//没有其它的例程返回Null
return null;
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Exception ex = e.Exception;
using (StreamWriter sw = new StreamWriter(Directory.GetCurrentDirectory() + "\\ErrorLog.txt", true))
{
sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
sw.WriteLine("Global捕获到未处理异常" + ex.GetType().ToString());
sw.WriteLine("异常信息:" + ex.Message);
sw.WriteLine("异常堆栈:" + ex.StackTrace);
sw.WriteLine();
}
MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息{1}\r\n异常堆栈{2}", ex.GetType(), ex.Message, ex.StackTrace));
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("革博士AI智能检测系统")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("革博士AI智能检测系统")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("456eed9b-2908-45a3-ba59-22fcc12db782")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.3")]
[assembly: AssemblyFileVersion("1.0.2.3")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace LeatherApp.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LeatherApp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LeatherApp.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

View File

@ -0,0 +1,66 @@
using Newtonsoft.Json.Linq;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.UIExtend
{
public partial class UCColorItem : UIUserControl
{
/// <summary>
/// code,color
/// </summary>
public Action<string,string> ColorChanged { get; set; }
public UCColorItem()
{
InitializeComponent();
}
[Description("文字"), Category("内容")]
public override string Text
{
get { return this.uiLabel11.Text; }
set { this.uiLabel11.Text = value;
this.Width = this.uiLabel11.Left + this.uiLabel11.Width + 2;
}
}
[Description("颜色"), Category("内容")]
public Color ColorValue
{
get { return this.panel1.BackColor; }
set { this.panel1.BackColor = value; }
}
private void UCColorList_Load(object sender, EventArgs e)
{
panel1.Left = panel1.Top = 1;
this.uiLabel11.Top = -1;
panel1.Width = panel1.Height = this.Height - 2;
uiLabel11.Left = panel1.Left + panel1.Width + 1;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
colorDialog1.Color = panel1.BackColor;
if (colorDialog1.ShowDialog() == DialogResult.OK)
{
if (panel1.BackColor != colorDialog1.Color)
{
panel1.BackColor = colorDialog1.Color;
ColorChanged?.Invoke(this.Name,panel1.BackColor.ToHTML());
}
}
}
}
}

View File

@ -0,0 +1,74 @@
namespace LeatherApp.UIExtend
{
partial class UCColorItem
{
/// <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.uiLabel11 = new Sunny.UI.UILabel();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// uiLabel11
//
this.uiLabel11.AutoSize = true;
this.uiLabel11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel11.Location = new System.Drawing.Point(20, -1);
this.uiLabel11.Name = "uiLabel11";
this.uiLabel11.Size = new System.Drawing.Size(46, 24);
this.uiLabel11.TabIndex = 12;
this.uiLabel11.Text = "项名";
this.uiLabel11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panel1
//
this.panel1.Cursor = System.Windows.Forms.Cursors.Hand;
this.panel1.Location = new System.Drawing.Point(1, 1);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(20, 20);
this.panel1.TabIndex = 13;
this.panel1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// UCColorItem
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.panel1);
this.Controls.Add(this.uiLabel11);
this.Name = "UCColorItem";
this.Size = new System.Drawing.Size(91, 22);
this.Load += new System.EventHandler(this.UCColorList_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Sunny.UI.UILabel uiLabel11;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.Panel panel1;
}
}

View File

@ -0,0 +1,123 @@
<?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>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,131 @@
using Newtonsoft.Json.Linq;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.UIExtend
{
public partial class UCColorList : UIUserControl
{
/// <summary>
/// code,color
/// </summary>
public Action<string, string> ColorChanged { get; set; }
public UCColorList()
{
InitializeComponent();
}
/// <summary>
/// {"dk":{"name":"堵孔","color":"#000000"},"xws":{name:"",color:""},...}
/// </summary>
public void initData(JObject objInfo)
{
//注意不能用原生方法Controls.Remove
if (uiFlowLayoutPanel1.ControlCount > 0)
uiFlowLayoutPanel1.Clear();
string code, name, color;
IEnumerable<JProperty> properties = objInfo.Properties();
foreach (JProperty item in properties)
{
// item.Name 为 键// item.Value 为 值
code = item.Name;
JObject info=item.Value as JObject;
name=info.Value<string>("name");
color = info.Value<string>("color");
UCColorItem myUC = new UCColorItem()
{
Name=code,
BackColor = ColorTranslator.FromHtml(color),
Text = name
};
myUC.SetDPIScale();
uiFlowLayoutPanel1.Add(myUC);
}
}
/// <summary>
/// [{code:"dk",name:"堵孔",color:"#000000"},{code:"sws",name:"",color:""},...]
/// </summary>
/// <param name="arrInfo"></param>
public void initData(JArray arrInfo)
{
if (arrInfo == null) return;
//注意不能用原生方法Controls.Remove
if (uiFlowLayoutPanel1.ControlCount > 0)
uiFlowLayoutPanel1.Clear();
string code, name, color;
foreach (JObject item in arrInfo)
{
code = item.Value<string>("code");
name = item.Value<string>("name");
color = item.Value<string>("color");
UCColorItem myUC = new UCColorItem()
{
Name = code,
ColorValue = ColorTranslator.FromHtml(color),
Text = name,
Height = 15,
RectSides = ToolStripStatusLabelBorderSides.None,
ColorChanged = this.ColorChanged,
};
myUC.SetDPIScale();
uiFlowLayoutPanel1.Add(myUC);
}
}
/// <summary>
/// return {code:"dk",name:"堵孔",color:"#000000"}
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public JObject getValue(string code)
{
if (string.IsNullOrWhiteSpace(code))
return null;
var item = uiFlowLayoutPanel1.Get<UCColorItem>(code);
if (item == null)
return null;
return new JObject() {
{"code",code },
{"name",item.Text },
{"color",item.ColorValue.ToHTML() },
};
}
/// <summary>
/// return [{code:"dk",name:"堵孔",color:"#000000"},{code:"sws",name:"",color:""},...]
/// </summary>
/// <returns></returns>
public JArray getValueList()
{
//2子控件为Forms.FlowLayoutPanel,我加入的控件在这里面
if (uiFlowLayoutPanel1.ControlCount<1)
return null;
JArray arr = new JArray();
//遍历与原生方法不同UIFlowLayoutPanel是组合控件从其Panel控件遍历
foreach (var item in uiFlowLayoutPanel1.Panel.Controls)
{
if (item.GetType() == typeof(UCColorItem))
{
UCColorItem ucItem = (UCColorItem)item;
arr.Add(new JObject() {
{"code",ucItem.Name },
{"name",ucItem.Text },
{"color",ucItem.ColorValue.ToHTML() },
});
}
}
return arr;
}
}
}

View File

@ -0,0 +1,65 @@
namespace LeatherApp.UIExtend
{
partial class UCColorList
{
/// <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.uiFlowLayoutPanel1 = new Sunny.UI.UIFlowLayoutPanel();
this.SuspendLayout();
//
// uiFlowLayoutPanel1
//
this.uiFlowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.uiFlowLayoutPanel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiFlowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.uiFlowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiFlowLayoutPanel1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiFlowLayoutPanel1.Name = "uiFlowLayoutPanel1";
this.uiFlowLayoutPanel1.Padding = new System.Windows.Forms.Padding(2);
this.uiFlowLayoutPanel1.Radius = 0;
this.uiFlowLayoutPanel1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom;
this.uiFlowLayoutPanel1.ShowText = false;
this.uiFlowLayoutPanel1.Size = new System.Drawing.Size(587, 113);
this.uiFlowLayoutPanel1.TabIndex = 2;
this.uiFlowLayoutPanel1.Text = "uiFlowLayoutPanel1";
this.uiFlowLayoutPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// UCColorList
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.uiFlowLayoutPanel1);
this.Name = "UCColorList";
this.Size = new System.Drawing.Size(587, 113);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UIFlowLayoutPanel uiFlowLayoutPanel1;
}
}

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.UIExtend
{
public partial class UCImageView : UserControl
{
private double ratioStep = 0.1;
public UCImageView()
{
InitializeComponent();
pictureBox1.Location = new Point(0, 0);
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
pictureBox1.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
pictureBox1.MouseMove += pictureBox1_MouseMove;
pictureBox1.MouseDown += pictureBox1_MouseDown;
}
#region private tool
/// <summary>
/// 获取适合大小
/// </summary>
/// <param name="sourceSize"></param>
/// <param name="targetSize"></param>
/// <returns></returns>
private Size getNewSize(Size sourceSize, Size targetSize)
{
if (sourceSize.Width <= targetSize.Width && sourceSize.Height <= targetSize.Height)
return sourceSize;
int num = sourceSize.Width / targetSize.Width;
int num2 = sourceSize.Height / targetSize.Height;
int num3 = (num < num2) ? num2 : num;
return new Size(sourceSize.Width / num3, sourceSize.Height / num3);
}
/// <summary>
/// 等比计算宽高
/// </summary>
/// <param name="sourceSize"></param>
/// <param name="targetSize"></param>
/// <returns></returns>
private SizeF getNewSize(SizeF sourceSize, SizeF targetSize)
{
if (sourceSize.Width <= targetSize.Width && sourceSize.Height <= targetSize.Height)
return sourceSize;
float num = sourceSize.Width / targetSize.Width;
float num2 = sourceSize.Height / targetSize.Height;
float num3 = (num < num2) ? num2 : num;
return new SizeF(sourceSize.Width / num3, sourceSize.Height / num3);
}
#endregion
public void clear()
{
pictureBox1.Image = null;
pictureBox1.Refresh();
pictureBox1.Visible = false;
}
public void loadImage(Image img)
{
if(img == null) { clear(); return; }
pictureBox1.Visible = true;
pictureBox1.Size = ClientSize;
pictureBox1.Location = new Point(0, 0);
pictureBox1.Image = img;//del
pictureBox1.Refresh();
//ActiveControl = pictureBox1; // 设置焦点
}
private void UCImageView_Load(object sender, EventArgs e)
{
}
private void checkBorderLine()
{
if (pictureBox1.Width < ClientSize.Width) pictureBox1.Width = ClientSize.Width;
if (pictureBox1.Height < ClientSize.Height) pictureBox1.Height = ClientSize.Height;
if (pictureBox1.Right < ClientSize.Width) pictureBox1.Left += ClientSize.Width - pictureBox1.Right;
if (pictureBox1.Bottom < ClientSize.Height) pictureBox1.Top += ClientSize.Height - pictureBox1.Bottom;
if (pictureBox1.Left > 0) pictureBox1.Left = 0;
if (pictureBox1.Top > 0) pictureBox1.Top = 0;
}
public void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
{
if (pictureBox1.Image == null) return;
int x = e.Location.X;
int y = e.Location.Y;
double oldW = pictureBox1.Width;
double oldH = pictureBox1.Height;
int width,height;
double ratio;
if (e.Delta > 0) //放大
{
ratio = 1 + ratioStep;
width = Convert.ToInt32(pictureBox1.Width * ratio);
height = Convert.ToInt32(pictureBox1.Height * ratio);
//if (width * height > 45800000)
// return;
if (width / ClientSize.Width > 10)
return;
pictureBox1.Width = width;
pictureBox1.Height = height;
}
if (e.Delta < 0) //缩小
{
//防止一直缩成负值
if (pictureBox1.Width < this.Width || pictureBox1.Height < this.Height)
return;
ratio = 1.0 - ratioStep;
width = (int)(pictureBox1.Width * ratio);
height= (int)(pictureBox1.Height * ratio);
pictureBox1.Width = width;
pictureBox1.Height = height;
}
this.Text = $"{e.X},{e.Y}";
//求因缩放产生的位移,进行补偿,实现锚点缩放的效果
int VX = (int)((oldW - pictureBox1.Width) / oldW * x);
int VY = (int)((oldH - pictureBox1.Height) / oldH * y);
pictureBox1.Location = new Point(pictureBox1.Location.X + VX, pictureBox1.Location.Y + VY);
checkBorderLine();
}
//移动
private int xPos;
private int yPos;
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (pictureBox1.Image == null) return;
try
{
// 鼠标按下拖拽图片
if (e.Button == MouseButtons.Left)
{
this.Parent.Text = $"{e.X}:{e.Y};{xPos}:{yPos}";
// 限制拖拽出框
if (pictureBox1.Width > ClientSize.Width
|| pictureBox1.Height > ClientSize.Height)
{
int moveX = e.X - xPos;
int moveY = e.Y - yPos;
if ((pictureBox1.Left + moveX) <= 0
&& (pictureBox1.Top + moveY) <= 0
&& (pictureBox1.Right + moveX) >= ClientSize.Width
&& (pictureBox1.Bottom + moveY) >= ClientSize.Height)
{
pictureBox1.Left += moveX;//设置x坐标.
pictureBox1.Top += moveY;//设置y坐标.
checkBorderLine();
}
}
}
}
catch (Exception dd)
{
MessageBox.Show(dd.Message);
}
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (pictureBox1.Image == null) return;
xPos = e.X;//当前x坐标.
yPos = e.Y;//当前y坐标.
}
private void UCImageView_ClientSizeChanged(object sender, EventArgs e)
{
checkBorderLine();
}
}
}

View File

@ -0,0 +1,63 @@
namespace LeatherApp.UIExtend
{
partial class UCImageView
{
/// <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.pictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.Control;
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Location = new System.Drawing.Point(18, 14);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(210, 124);
this.pictureBox1.TabIndex = 14;
this.pictureBox1.TabStop = false;
this.pictureBox1.Visible = false;
//
// UCImageView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pictureBox1);
this.Name = "UCImageView";
this.Size = new System.Drawing.Size(246, 154);
this.Load += new System.EventHandler(this.UCImageView_Load);
this.ClientSizeChanged += new System.EventHandler(this.UCImageView_ClientSizeChanged);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -0,0 +1,80 @@
namespace LeatherApp.UIExtend
{
partial class UIDefectEdit
{
/// <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.uiComboBox1 = new Sunny.UI.UIComboBox();
this.uiCheckBox1 = new Sunny.UI.UICheckBox();
this.SuspendLayout();
//
// uiComboBox1
//
this.uiComboBox1.DataSource = null;
this.uiComboBox1.FillColor = System.Drawing.Color.White;
this.uiComboBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiComboBox1.Location = new System.Drawing.Point(2, 2);
this.uiComboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboBox1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboBox1.Name = "uiComboBox1";
this.uiComboBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboBox1.Size = new System.Drawing.Size(150, 29);
this.uiComboBox1.TabIndex = 0;
this.uiComboBox1.Text = "uiComboBox1";
this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiComboBox1.Watermark = "";
this.uiComboBox1.SelectedIndexChanged += new System.EventHandler(this.uiComboBox1_SelectedIndexChanged);
//
// uiCheckBox1
//
this.uiCheckBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiCheckBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiCheckBox1.Location = new System.Drawing.Point(160, 1);
this.uiCheckBox1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiCheckBox1.Name = "uiCheckBox1";
this.uiCheckBox1.Size = new System.Drawing.Size(150, 29);
this.uiCheckBox1.TabIndex = 1;
this.uiCheckBox1.Text = "忽略";
//
// UIDefectEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.uiCheckBox1);
this.Controls.Add(this.uiComboBox1);
this.Name = "UIDefectEdit";
this.Size = new System.Drawing.Size(245, 34);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UIComboBox uiComboBox1;
private Sunny.UI.UICheckBox uiCheckBox1;
}
}

View File

@ -0,0 +1,61 @@
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.UIExtend
{
public partial class UIDefectEdit : UserControl
{
/// <summary>
/// code,name
/// </summary>
public Action<string, string> CodeChangeEvent;
public UIDefectEdit()
{
InitializeComponent();
init();
}
private void init()
{
var list = Config.defectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
uiComboBox1.ValueMember = "code";
uiComboBox1.DisplayMember = "name";
uiComboBox1.DataSource = list;
}
[Description("忽略"), Category("自定义")]
public bool Checked
{
get { return this.uiCheckBox1.Checked; }
set { this.uiCheckBox1.Checked = value; }
}
[Description("瑕疵"), Category("自定义")]
public string Code
{
get { return this.uiComboBox1.SelectedValue.ToString(); }
set { this.uiComboBox1.SelectedValue = value; }
}
private void uiComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string code = uiComboBox1.SelectedValue.ToString();
string name = uiComboBox1.SelectedText.ToString();
if (this.Tag != null)
{
var item = (DefectInfo)this.Tag;
item.Code = code;
item.Name = name;
}
CodeChangeEvent?.Invoke(code,name);
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -0,0 +1,112 @@
namespace LeatherApp.UIExtend
{
partial class UIDefectImage
{
/// <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.uiComboBox1 = new Sunny.UI.UIComboBox();
this.uiCheckBox1 = new Sunny.UI.UICheckBox();
this.lblLocation = new Sunny.UI.UILabel();
this.ucImageView1 = new LeatherApp.UIExtend.UCImageView();
this.SuspendLayout();
//
// uiComboBox1
//
this.uiComboBox1.DataSource = null;
this.uiComboBox1.FillColor = System.Drawing.Color.White;
this.uiComboBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiComboBox1.ItemHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255)))));
this.uiComboBox1.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiComboBox1.Location = new System.Drawing.Point(4, 359);
this.uiComboBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiComboBox1.MinimumSize = new System.Drawing.Size(63, 0);
this.uiComboBox1.Name = "uiComboBox1";
this.uiComboBox1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
this.uiComboBox1.Size = new System.Drawing.Size(104, 29);
this.uiComboBox1.TabIndex = 0;
this.uiComboBox1.Text = "uiComboBox1";
this.uiComboBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.uiComboBox1.Watermark = "";
this.uiComboBox1.SelectedIndexChanged += new System.EventHandler(this.uiComboBox1_SelectedIndexChanged);
//
// uiCheckBox1
//
this.uiCheckBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiCheckBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiCheckBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiCheckBox1.Location = new System.Drawing.Point(125, 361);
this.uiCheckBox1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiCheckBox1.Name = "uiCheckBox1";
this.uiCheckBox1.Size = new System.Drawing.Size(94, 29);
this.uiCheckBox1.TabIndex = 1;
this.uiCheckBox1.Text = "忽略";
//
// lblLocation
//
this.lblLocation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblLocation.AutoSize = true;
this.lblLocation.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblLocation.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.lblLocation.Location = new System.Drawing.Point(206, 359);
this.lblLocation.Name = "lblLocation";
this.lblLocation.Size = new System.Drawing.Size(109, 31);
this.lblLocation.TabIndex = 3;
this.lblLocation.Text = "uiLabel1";
this.lblLocation.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// ucImageView1
//
this.ucImageView1.Location = new System.Drawing.Point(2, 2);
this.ucImageView1.Name = "ucImageView1";
this.ucImageView1.Size = new System.Drawing.Size(367, 350);
this.ucImageView1.TabIndex = 2;
this.ucImageView1.Load += new System.EventHandler(this.ucImageView1_Load);
//
// UIDefectImage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.lblLocation);
this.Controls.Add(this.uiComboBox1);
this.Controls.Add(this.uiCheckBox1);
this.Controls.Add(this.ucImageView1);
this.Name = "UIDefectImage";
this.Size = new System.Drawing.Size(372, 392);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Sunny.UI.UIComboBox uiComboBox1;
private Sunny.UI.UICheckBox uiCheckBox1;
private UCImageView ucImageView1;
private Sunny.UI.UILabel lblLocation;
}
}

View File

@ -0,0 +1,78 @@
using Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LeatherApp.UIExtend
{
public partial class UIDefectImage : UserControl
{
/// <summary>
/// code,name
/// </summary>
public Action<string, string> CodeChangeEvent;
public UIDefectImage()
{
InitializeComponent();
init();
}
private void init()
{
var list = Config.defectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
uiComboBox1.ValueMember = "code";
uiComboBox1.DisplayMember = "name";
uiComboBox1.DataSource = list;
}
[Description("忽略"), Category("自定义")]
public bool Checked
{
get { return this.uiCheckBox1.Checked; }
set { this.uiCheckBox1.Checked = value; }
}
[Description("瑕疵"), Category("自定义")]
public string Code
{
get { return this.uiComboBox1.SelectedValue.ToString(); }
set { this.uiComboBox1.SelectedValue = value; }
}
[Description("瑕疵位置"), Category("自定义")]
public string DefecLocation
{
set { this.lblLocation.Text = value; }
}
[Description("瑕疵图"), Category("自定义")]
public Image Image
{
set { this.ucImageView1.loadImage(value); }
}
private void uiComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string code = uiComboBox1.SelectedValue.ToString();
string name = uiComboBox1.Text.ToString();
if (this.Tag != null)//修改不起作用
{
var item = (DefectInfo)this.Tag;
item.Code = code;
item.Name = name;
}
API.OutputDebugString("AAAAAAAAA-"+code + " " + name);
CodeChangeEvent?.Invoke(code,name);
}
private void ucImageView1_Load(object sender, EventArgs e)
{
uiCheckBox1.Left = this.uiComboBox1.Left + this.uiComboBox1.Width + 5;
this.lblLocation.Left = this.uiCheckBox1.Left + uiCheckBox1.Width + 5;
}
}
}

Some files were not shown because too many files have changed in this diff Show More