DevApp/Gs.WeightIqc/App.config
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> </startup> <appSettings> <add key="WebApiUrl" value="http://192.168.1.145:81/" /> <add key="TimingMailInterval" value="10000" /> <add key="LogPath" value="logs" /> </appSettings> </configuration> DevApp/Gs.WeightIqc/Form1.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,199 @@ using System.Drawing; using System.Windows.Forms; namespace Gs.WeightIqc { 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.cmbBaudRate = new System.Windows.Forms.ComboBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.txtDt = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.txtNum = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.cmbSerialPortNum = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // cmbBaudRate // this.cmbBaudRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbBaudRate.FormattingEnabled = true; this.cmbBaudRate.Items.AddRange(new object[] { "14400", "9600", "4800", "2400", "1200"}); this.cmbBaudRate.Location = new System.Drawing.Point(98, 39); this.cmbBaudRate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.cmbBaudRate.Name = "cmbBaudRate"; this.cmbBaudRate.Size = new System.Drawing.Size(135, 23); this.cmbBaudRate.TabIndex = 0; // // groupBox1 // this.groupBox1.Controls.Add(this.txtDt); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.txtNum); this.groupBox1.Controls.Add(this.button2); this.groupBox1.Controls.Add(this.button1); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.cmbSerialPortNum); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.cmbBaudRate); this.groupBox1.Location = new System.Drawing.Point(24, 32); this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); this.groupBox1.Size = new System.Drawing.Size(510, 180); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // // txtDt // this.txtDt.Location = new System.Drawing.Point(361, 70); this.txtDt.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txtDt.Name = "txtDt"; this.txtDt.ReadOnly = true; this.txtDt.Size = new System.Drawing.Size(128, 25); this.txtDt.TabIndex = 9; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(288, 75); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(67, 15); this.label4.TabIndex = 8; this.label4.Text = "è·åæ¶é´"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(288, 43); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(67, 15); this.label3.TabIndex = 7; this.label3.Text = "å½åéé"; // // txtNum // this.txtNum.Location = new System.Drawing.Point(361, 38); this.txtNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txtNum.Name = "txtNum"; this.txtNum.ReadOnly = true; this.txtNum.Size = new System.Drawing.Size(128, 25); this.txtNum.TabIndex = 6; // // button2 // this.button2.Location = new System.Drawing.Point(139, 120); this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(84, 37); this.button2.TabIndex = 5; this.button2.Text = "忢"; this.button2.UseVisualStyleBackColor = true; // // button1 // this.button1.Location = new System.Drawing.Point(34, 120); this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(84, 37); this.button1.TabIndex = 4; this.button1.Text = "å¯å¨"; this.button1.UseVisualStyleBackColor = true; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(22, 75); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(52, 15); this.label2.TabIndex = 3; this.label2.Text = "串å£å·"; // // cmbSerialPortNum // this.cmbSerialPortNum.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbSerialPortNum.FormattingEnabled = true; this.cmbSerialPortNum.Location = new System.Drawing.Point(98, 71); this.cmbSerialPortNum.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.cmbSerialPortNum.Name = "cmbSerialPortNum"; this.cmbSerialPortNum.Size = new System.Drawing.Size(135, 23); this.cmbSerialPortNum.TabIndex = 2; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(22, 43); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(52, 15); this.label1.TabIndex = 1; this.label1.Text = "æ³¢ç¹ç"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(569, 238); this.Controls.Add(this.groupBox1); this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MaximizeBox = false; this.Name = "Form1"; this.Text = "广深--IQCç§°éæå¡"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); } #endregion private ComboBox cmbBaudRate; private GroupBox groupBox1; private Label label1; private Label label2; private ComboBox cmbSerialPortNum; private Button button1; private Label label3; private TextBox txtNum; private Button button2; private TextBox txtDt; private Label label4; } } DevApp/Gs.WeightIqc/Form1.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,275 @@ using Gs.WeightIqc.ToolBox; using Microsoft.Win32; using Newtonsoft.Json; using NModbus; using NModbus.Serial; using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.IO.Ports; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Gs.WeightIqc { public partial class Form1 : Form { public System.IO.Ports.SerialPort Sp = new System.IO.Ports.SerialPort(); public delegate void HandleInterfaceUpdataDelegate(string text); private Form1.HandleInterfaceUpdataDelegate interfaceUpdataHandle; private Dictionary<string, Thread> dicThread = new Dictionary<string, Thread>(); private System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer(); public Form1() { InitializeComponent(); GetComList(); #region MyRegion int int32 = 10000; string _vanishingSeconds = ConfigurationManager.AppSettings["TimingMailInterval"]; if (!string.IsNullOrEmpty(_vanishingSeconds)) int32 = int.Parse(_vanishingSeconds); this.timer1.Interval = int32; this.button1.Enabled = true; this.button2.Enabled = false; this.cmbBaudRate.SelectedIndex = 1; #endregion this.timer1.Tick += (s, e) => { if (this.dicThread.Keys.Contains<string>("GetWeight")) return; Thread thread1 = new Thread(new ThreadStart(this.GetWeight)); thread1.Start(); this.dicThread.Add("GetWeight", thread1); }; this.button1.Click += (s, e) => { try { ToolBox.LogHelper.Debug(this.ToString(), " å¼å§éé"); if (this.cmbBaudRate.Text.Trim() != "" && this.cmbSerialPortNum.Text != "") { ToolBox.LogHelper.Debug(this.ToString(), "é 置串å£éä¿¡"); this.interfaceUpdataHandle = new Form1.HandleInterfaceUpdataDelegate(this.UpdateTextBox); this.Sp.PortName = this.cmbSerialPortNum.Text.Trim(); this.Sp.BaudRate = Convert.ToInt32(this.cmbBaudRate.Text.Trim()); this.Sp.Parity = Parity.None; this.Sp.StopBits = StopBits.One; ToolBox.LogHelper.Debug(this.ToString(), "æå¼ä¸²å£åéä¿¡"); this.Sp.Open(); this.button1.Enabled = false; this.button2.Enabled = true; this.timer1.Enabled = false; this.cmbBaudRate.Enabled = false; this.cmbSerialPortNum.Enabled = false; ToolBox.LogHelper.Debug(this.ToString(), "å¯å¨å·æ°æ°æ®å®æ¶å¨"); this.timer1.Start(); } else { ToolBox.LogHelper.Debug(this.ToString(), "请è¾å ¥æ£ç¡®ç串å£å·åæ³¢ç¹ç"); int num = (int)MessageBox.Show("请è¾å ¥æ£ç¡®ç串å£å·åæ³¢ç¹çï¼"); this.cmbSerialPortNum.Focus(); } } catch (Exception ex) { ToolBox.LogHelper.Debug(this.ToString(), ex.Message); int num = (int)MessageBox.Show($"串å£{this.cmbSerialPortNum.Text.Trim()}æå¼å¤±è´¥ï¼{ex.Message}"); } }; this.button2.Click += (s, e) => { try { if (this.dicThread.Keys.Contains<string>("GetWeight")) { Thread thread = this.dicThread["GetWeight"]; if (thread.IsAlive) thread.Abort(); this.dicThread.Remove("GetWeight"); } this.button1.Enabled = true; this.button2.Enabled = false; this.cmbBaudRate.Enabled = true; this.cmbSerialPortNum.Enabled = true; this.timer1.Stop(); this.Sp.Close(); } catch (Exception ex) { //int num = (int)MessageBox.Show(ex.Message); //Application.Exit(); MessageBox.Show(ex.Message); ToolBox.LogHelper.Debug(this.ToString(), ex.Message); } }; this.FormClosing += (s, e) => { if (Sp.IsOpen) Sp.Close(); if (timer1 != null) { timer1.Stop(); timer1.Dispose(); } try { if (this.dicThread.Keys.Contains<string>("GetWeight")) { Thread thread = this.dicThread["GetWeight"]; if (thread.IsAlive) thread.Abort(); this.dicThread.Remove("GetWeight"); } this.timer1.Stop(); this.Sp.Close(); } catch (Exception ex) { //int num = (int)MessageBox.Show(ex.Message); //Application.Exit(); MessageBox.Show(ex.Message); } }; } /// <summary> /// è·åéé /// </summary> public void GetWeight() { ModbusFactory factory = new ModbusFactory(); ToolBox.LogHelper.Debug(this.ToString(), "GetWeightå建modbus对象"); IModbusMaster rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); bool flag = true; while (true) { // addModel("1", "2"); //ToolBox.LogHelper.Debug(this.ToString(), "GetWeightå建modbus对象"); try { if (!this.Sp.IsOpen) { ToolBox.LogHelper.Debug(this.ToString(), "GetWeight éæ°æå¼ä¸²å£è¿æ¥"); this.Sp.Open(); rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); } if (rtuMaster == null) { ToolBox.LogHelper.Debug(this.ToString(), "GetWeight éæ°å建modbus对象2"); rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); } byte slaveAddress3 = byte.Parse("1"); ushort startAddress3 = ushort.Parse("0002"); ushort numberOfPoints1 = ushort.Parse("2"); ushort[] numArray = rtuMaster.ReadHoldingRegisters(slaveAddress3, startAddress3, numberOfPoints1); float single = BitConverter.ToSingle(this.CombomBinaryArray(BitConverter.GetBytes(numArray[1]), BitConverter.GetBytes(numArray[0])), 0); this.Invoke((Delegate)this.interfaceUpdataHandle, (object)single.ToString()); byte slaveAddress4 = byte.Parse("1"); ushort startAddress4 = ushort.Parse("0001"); ushort numberOfPoints2 = ushort.Parse("1"); int int32 = Convert.ToInt32(rtuMaster.ReadHoldingRegisters(slaveAddress4, startAddress4, numberOfPoints2)[0].ToString()); string str = Convert.ToString(int32, 2).PadLeft(16 /*0x10*/, '0'); char ch1 = str[1]; char ch2 = str[6]; if (ch1 == '0' && ch2 == '0') { flag = true; } else if (flag) { flag = false; } addModel(single.ToString(), int32.ToString()); ToolBox.LogHelper.Debug(this.ToString(), "single:" + single.ToString() + ",flag:" + flag.ToString() + ",int32:" + int32.ToString()); Thread.Sleep(2000); } catch (Exception ex) { Thread.Sleep(2000); } } } /// <summary> /// ä¸ä¼ ç§°éæ°æ® /// </summary> /// <param name="_realWeight">æªååçæ°é</param> /// <param name="_realWeightTxt">åå串</param> private void addModel(string _realWeight, string _realWeightTxt) { string _lineId = "0"; var _obj = new { lineId = _lineId, realWeight = _realWeight.Trim(), realWeightTxt = _realWeightTxt.Trim(), }; try { string strJson = UtilityHelper.HttpPost("", "WorkWeight/EditModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode <= 0) { ToolBox.LogHelper.Debug(this.ToString(), "WorkWeight/EditModel:" + strJson); } } catch (Exception ex) { ToolBox.LogHelper.Debug(this.ToString(), ex.Message); } } /// <summary> /// æ´æ°UI /// </summary> /// <param name="text"></param> private void UpdateTextBox(string text) { try { this.txtDt.Text = DateTime.Now.ToString(); if (this.txtNum.Text == text) return; this.txtNum.Text = text; } catch (Exception ex) { ToolBox.LogHelper.Debug(this.ToString(), ex.Message); } } private void GetComList() { this.cmbSerialPortNum.Items.Clear(); RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Hardware\\DeviceMap\\SerialComm"); if (registryKey == null) return; foreach (string valueName in registryKey.GetValueNames()) { string description = (string)registryKey.GetValue(valueName); this.cmbSerialPortNum.Items.Add(description); } if (this.cmbSerialPortNum.Items.Count > 0) this.cmbSerialPortNum.SelectedIndex = 0; } private byte[] CombomBinaryArray(byte[] srcArray1, byte[] srcArray2) { byte[] destinationArray = new byte[srcArray1.Length + srcArray2.Length]; Array.Copy((Array)srcArray1, 0, (Array)destinationArray, 0, srcArray1.Length); Array.Copy((Array)srcArray2, 0, (Array)destinationArray, srcArray1.Length, srcArray2.Length); return destinationArray; } } } DevApp/Gs.WeightIqc/Form1.resx
¶Ô±ÈÐÂÎļþ @@ -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> DevApp/Gs.WeightIqc/Gs.WeightIqc.csproj
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,97 @@ <?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>{31ED2821-04C4-4A4A-B794-E4972BBB4810}</ProjectGuid> <OutputType>WinExe</OutputType> <RootNamespace>Gs.WeightIqc</RootNamespace> <AssemblyName>Gs.WeightIqc</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="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="NModbus, Version=3.0.81.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\NModbus.3.0.81\lib\net46\NModbus.dll</HintPath> </Reference> <Reference Include="NModbus.Serial, Version=3.0.81.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\NModbus.Serial.3.0.81\lib\net46\NModbus.Serial.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Configuration" /> <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="Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="ToolBox\LogHelper.cs" /> <Compile Include="ToolBox\ReturnModel.cs" /> <Compile Include="ToolBox\UtilityHelper.cs" /> <EmbeddedResource Include="Form1.resx"> <DependentUpon>Form1.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="packages.config" /> <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> DevApp/Gs.WeightIqc/Program.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Gs.WeightIqc { internal static class Program { /// <summary> /// åºç¨ç¨åºçä¸»å ¥å£ç¹ã /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } DevApp/Gs.WeightIqc/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,33 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // æå ³ç¨åºéçä¸è¬ä¿¡æ¯ç±ä»¥ä¸ // æ§å¶ãæ´æ¹è¿äºç¹æ§å¼å¯ä¿®æ¹ // ä¸ç¨åºéå ³èçä¿¡æ¯ã [assembly: AssemblyTitle("Gs.WeightIqc")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Gs.WeightIqc")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // å° ComVisible 设置为 false ä¼ä½¿æ¤ç¨åºéä¸çç±»å //对 COM ç»ä»¶ä¸å¯è§ã妿éè¦ä» COM è®¿é®æ¤ç¨åºéä¸çç±»å //è¯·å°æ¤ç±»åç ComVisible ç¹æ§è®¾ç½®ä¸º trueã [assembly: ComVisible(false)] // 妿æ¤é¡¹ç®å COM å ¬å¼ï¼åä¸å GUID ç¨äºç±»ååºç ID [assembly: Guid("31ed2821-04c4-4a4a-b794-e4972bbb4810")] // ç¨åºéççæ¬ä¿¡æ¯ç±ä¸åå个å¼ç»æ: // // ä¸»çæ¬ // æ¬¡çæ¬ // çæå· // ä¿®è®¢å· // [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] DevApp/Gs.WeightIqc/Properties/Resources.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,71 @@ //------------------------------------------------------------------------------ // <auto-generated> // æ¤ä»£ç ç±å·¥å ·çæã // è¿è¡æ¶çæ¬: 4.0.30319.42000 // // å¯¹æ¤æä»¶çæ´æ¹å¯è½å¯¼è´ä¸æ£ç¡®çè¡ä¸ºï¼å¦æ // éæ°çæä»£ç ï¼åæåæ´æ¹å°ä¸¢å¤±ã // </auto-generated> //------------------------------------------------------------------------------ namespace Gs.WeightIqc.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("Gs.WeightIqc.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; } } } } DevApp/Gs.WeightIqc/Properties/Resources.resx
¶Ô±ÈÐÂÎļþ @@ -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> DevApp/Gs.WeightIqc/Properties/Settings.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -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 Gs.WeightIqc.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; } } } } DevApp/Gs.WeightIqc/Properties/Settings.settings
¶Ô±ÈÐÂÎļþ @@ -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> DevApp/Gs.WeightIqc/ToolBox/LogHelper.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,53 @@ using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Gs.WeightIqc.ToolBox { public class LogHelper { //å建æ¥å¿ç®å½ private static readonly string path = AppContext.BaseDirectory + ConfigurationManager.AppSettings[ "LogPath"]; /** * åæ¥å¿æä»¶åå ¥è°è¯ä¿¡æ¯ * @param className ç±»å * @param content åå ¥å 容 */ public static void Debug(string className, string content) { WriteLog("DEBUG", className, content); } /** * å®é çåæ¥å¿æä½ * @param type æ¥å¿è®°å½ç±»å * @param className ç±»å * @param content åå ¥å 容 */ protected static void WriteLog(string type, string className, string content) { if (!Directory.Exists(path)) //妿æ¥å¿ç®å½ä¸åå¨å°±å建 Directory.CreateDirectory(path); var time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); //è·åå½åç³»ç»æ¶é´ var filename = path + "/" + DateTime.Now.ToString("yyyy-MM-dd") + ".log"; //ç¨æ¥æå¯¹æ¥å¿æä»¶å½å //å建ææå¼æ¥å¿æä»¶ï¼åæ¥å¿æä»¶æ«å°¾è¿½å è®°å½ var mySw = File.AppendText(filename); //åæ¥å¿æä»¶åå ¥å 容 var write_content = time + " " + type + " " + className + ": " + content; mySw.WriteLine(write_content); //å ³éæ¥å¿æä»¶ mySw.Close(); } } } DevApp/Gs.WeightIqc/ToolBox/ReturnModel.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,61 @@ using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Gs.WeightIqc.ToolBox { /// <summary> /// è¿åçå¤å´ç»æ /// </summary> /// <typeparam name="T"></typeparam> public class ReturnModel<T> { /// <summary> /// Default = -100é»è®¤, Unauthorized = -101éæ³è°ç¨, Exception = -102ç³»ç»ä»£ç å¼å¸¸, Success /// = 1æå /// </summary> public int rtnCode { set; get; } public T rtnData { set; get; } public string rtnMsg { get; set; } } /// <summary> /// è¿åçå页èç¹ /// </summary> public class PageListModel { /// <summary> /// æ¯é¡µå¤§å° /// </summary> public int everyPageSize; /// <summary> /// æ©å±ç¨ï¼å表 /// </summary> public List<dynamic> extendList; /// <summary> /// æ©å±ç¨ï¼åææ¬ï¼æ¯å¦éé¢å计çå ¶å®é¡¹ç® /// </summary> public string extendText; /// <summary> /// æ»é¡µæ° /// </summary> public int pages; /// <summary> /// æ»è®°å½æ° /// </summary> public int total; /// <summary> /// å表 /// </summary> public DataTable list { get; set; } } } DevApp/Gs.WeightIqc/ToolBox/UtilityHelper.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,104 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Net; using System.Net.Cache; using System.Text; using System.Threading.Tasks; namespace Gs.WeightIqc.ToolBox { public class UtilityHelper { private static readonly string WebApiUrl = ConfigurationManager.AppSettings["WebApiUrl"]; /// <summary> /// httpè¯·æ± /// </summary> /// <param name="url">apiæ ¹å°å</param> /// <param name="meth">æ¹æ³åç§°</param> /// <param name="param">jsonåæ°</param> /// <param name="isLoading">æ¯å¦loading</param> /// <returns></returns> public static string HttpPost(string url, string meth, string param, bool isLoading = true) { HttpWebRequest request = null; StreamWriter requestStream = null; WebResponse response = null; string responseStr = null; try { if (string.IsNullOrEmpty(url)) url = WebApiUrl; url += meth; request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/json"; request.Headers.Add("token", GetBasicAuthTicket()); request.Accept = "*/*"; request.Timeout = 150000; request.AllowAutoRedirect = false; request.ServicePoint.Expect100Continue = false; HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); request.CachePolicy = noCachePolicy; requestStream = new StreamWriter(request.GetRequestStream()); requestStream.Write(param); requestStream.Close(); response = request.GetResponse(); if (response != null) { var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); responseStr = reader.ReadToEnd(); //File.WriteAllText(Server.MapPath("~/") + @"\test.txt", responseStr); reader.Close(); } } catch (Exception ex) { LogHelper.Debug(url, param + ":" + ex.Message); throw ex; } finally { request = null; requestStream = null; response = null; } return responseStr; } /// <summary> /// çæè®¿é®æå¡çtoken /// </summary> /// <returns></returns> public static string GetBasicAuthTicket() { var userGuid = "11111111-1111-1111-1111-111111111111"; var token = userGuid; return token; } /// <summary> /// æå¡è¿åçjsonè¿åReturnModelï¼ /// </summary> /// <param name="strReturn"></param> /// <returns></returns> public static ReturnModel<dynamic> ReturnToDynamic(string strReturn) { var rto = new ReturnModel<dynamic>(); var json = JObject.Parse(strReturn); rto.rtnCode = int.Parse(json["rtnCode"].ToString()); rto.rtnMsg = json["rtnMsg"].ToString(); rto.rtnData = json["rtnData"]; return rto; } } } DevApp/Gs.WeightIqc/packages.config
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" /> <package id="NModbus" version="3.0.81" targetFramework="net48" /> <package id="NModbus.Serial" version="3.0.81" targetFramework="net48" /> </packages> DevApp/Gs.WeightLine/App.config
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,26 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System"> <section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <appSettings> <add key="WebApiUrl" value="http://192.168.1.145:81/" /> <add key="TimingMailInterval" value="10000" /> <add key="LogPath" value="logs" /> </appSettings> <applicationSettings> <DevExpress.LookAndFeel.Design.AppSettings> <setting name="DPIAwarenessMode" serializeAs="String"> <value>System</value> </setting> <setting name="RegisterBonusSkins" serializeAs="String"> <value>True</value> </setting> </DevExpress.LookAndFeel.Design.AppSettings> </applicationSettings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> </startup> </configuration> DevApp/Gs.WeightLine/Form1.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,563 @@ using System.Windows.Forms; namespace Gs.WeightLine { 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() { DevExpress.XtraLayout.ColumnDefinition columnDefinition1 = new DevExpress.XtraLayout.ColumnDefinition(); DevExpress.XtraLayout.ColumnDefinition columnDefinition2 = new DevExpress.XtraLayout.ColumnDefinition(); DevExpress.XtraLayout.ColumnDefinition columnDefinition3 = new DevExpress.XtraLayout.ColumnDefinition(); DevExpress.XtraLayout.RowDefinition rowDefinition1 = new DevExpress.XtraLayout.RowDefinition(); DevExpress.XtraLayout.RowDefinition rowDefinition2 = new DevExpress.XtraLayout.RowDefinition(); DevExpress.XtraLayout.RowDefinition rowDefinition3 = new DevExpress.XtraLayout.RowDefinition(); this.split1 = new DevExpress.XtraEditors.SplitContainerControl(); this.layoutMx1 = new DevExpress.XtraDataLayout.DataLayoutControl(); this.comLine = new Gs.DevApp.UserControl.UcLookWorkline(); this.button1 = new DevExpress.XtraEditors.SimpleButton(); this.cmbSerialPortNum = new DevExpress.XtraEditors.ComboBoxEdit(); this.cmbBaudRate = new DevExpress.XtraEditors.ComboBoxEdit(); this.txtNum = new DevExpress.XtraEditors.TextEdit(); this.txtMsg = new DevExpress.XtraEditors.MemoEdit(); this.button2 = new DevExpress.XtraEditors.SimpleButton(); this.Root = new DevExpress.XtraLayout.LayoutControlGroup(); this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); this.cmbBaudRate1111 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); this.gcMx1 = new DevExpress.XtraGrid.GridControl(); this.gvMx1 = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn5 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn6 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn8 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn9 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn10 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn11 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn12 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn13 = new DevExpress.XtraGrid.Columns.GridColumn(); ((System.ComponentModel.ISupportInitialize)(this.split1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.split1.Panel1)).BeginInit(); this.split1.Panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.split1.Panel2)).BeginInit(); this.split1.Panel2.SuspendLayout(); this.split1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.layoutMx1)).BeginInit(); this.layoutMx1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cmbSerialPortNum.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txtNum.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.txtMsg.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).BeginInit(); this.SuspendLayout(); // // split1 // this.split1.Dock = System.Windows.Forms.DockStyle.Fill; this.split1.Horizontal = false; this.split1.Location = new System.Drawing.Point(0, 0); this.split1.Name = "split1"; // // split1.Panel1 // this.split1.Panel1.Controls.Add(this.layoutMx1); this.split1.Panel1.Text = "Panel1"; // // split1.Panel2 // this.split1.Panel2.Controls.Add(this.gcMx1); this.split1.Panel2.Text = "Panel2"; this.split1.ShowSplitGlyph = DevExpress.Utils.DefaultBoolean.True; this.split1.Size = new System.Drawing.Size(1040, 511); this.split1.SplitterPosition = 113; this.split1.TabIndex = 1; // // layoutMx1 // this.layoutMx1.Controls.Add(this.comLine); this.layoutMx1.Controls.Add(this.button1); this.layoutMx1.Controls.Add(this.cmbSerialPortNum); this.layoutMx1.Controls.Add(this.cmbBaudRate); this.layoutMx1.Controls.Add(this.txtNum); this.layoutMx1.Controls.Add(this.txtMsg); this.layoutMx1.Controls.Add(this.button2); this.layoutMx1.Dock = System.Windows.Forms.DockStyle.Fill; this.layoutMx1.Location = new System.Drawing.Point(0, 0); this.layoutMx1.Name = "layoutMx1"; this.layoutMx1.OptionsCustomizationForm.DesignTimeCustomizationFormPositionAndSize = new System.Drawing.Rectangle(310, 455, 812, 500); this.layoutMx1.Root = this.Root; this.layoutMx1.Size = new System.Drawing.Size(1040, 113); this.layoutMx1.TabIndex = 0; this.layoutMx1.Text = "dataLayoutControl1"; // // comLine // this.comLine.IsReadly = false; this.comLine.Location = new System.Drawing.Point(94, 12); this.comLine.Name = "comLine"; this.comLine.Size = new System.Drawing.Size(164, 24); this.comLine.TabIndex = 14; // // button1 // this.button1.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Question; this.button1.Appearance.Options.UseBackColor = true; this.button1.Appearance.Options.UseFont = true; this.button1.Location = new System.Drawing.Point(262, 12); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(246, 27); this.button1.StyleController = this.layoutMx1; this.button1.TabIndex = 5; this.button1.Text = "å¯å¨"; // // cmbSerialPortNum // this.cmbSerialPortNum.Location = new System.Drawing.Point(94, 43); this.cmbSerialPortNum.Name = "cmbSerialPortNum"; this.cmbSerialPortNum.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.cmbSerialPortNum.Properties.NullText = "-è¯·éæ©-"; this.cmbSerialPortNum.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cmbSerialPortNum.Size = new System.Drawing.Size(164, 24); this.cmbSerialPortNum.StyleController = this.layoutMx1; this.cmbSerialPortNum.TabIndex = 4; // // cmbBaudRate // this.cmbBaudRate.EditValue = "9600"; this.cmbBaudRate.Location = new System.Drawing.Point(94, 74); this.cmbBaudRate.Name = "cmbBaudRate"; this.cmbBaudRate.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.cmbBaudRate.Properties.Items.AddRange(new object[] { "14400", "9600", "4800", "2400", "1200"}); this.cmbBaudRate.Properties.NullText = "-è¯·éæ©-"; this.cmbBaudRate.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.cmbBaudRate.Size = new System.Drawing.Size(164, 24); this.cmbBaudRate.StyleController = this.layoutMx1; this.cmbBaudRate.TabIndex = 5; // // txtNum // this.txtNum.Location = new System.Drawing.Point(594, 22); this.txtNum.Name = "txtNum"; this.txtNum.Properties.Appearance.Font = new System.Drawing.Font("Tahoma", 15F); this.txtNum.Properties.Appearance.Options.UseFont = true; this.txtNum.Properties.ReadOnly = true; this.txtNum.Size = new System.Drawing.Size(434, 36); this.txtNum.StyleController = this.layoutMx1; this.txtNum.TabIndex = 8; // // txtMsg // this.txtMsg.Location = new System.Drawing.Point(512, 74); this.txtMsg.Name = "txtMsg"; this.txtMsg.Properties.ReadOnly = true; this.txtMsg.Size = new System.Drawing.Size(516, 27); this.txtMsg.StyleController = this.layoutMx1; this.txtMsg.TabIndex = 15; // // button2 // this.button2.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Danger; this.button2.Appearance.Options.UseBackColor = true; this.button2.Location = new System.Drawing.Point(262, 43); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(246, 27); this.button2.StyleController = this.layoutMx1; this.button2.TabIndex = 16; this.button2.Text = "忢"; // // Root // this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; this.Root.GroupBordersVisible = false; this.Root.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { this.layoutControlItem3, this.layoutControlItem1, this.cmbBaudRate1111, this.layoutControlItem2, this.layoutControlItem6, this.layoutControlItem4, this.layoutControlItem5}); this.Root.LayoutMode = DevExpress.XtraLayout.Utils.LayoutMode.Table; this.Root.Name = "Root"; columnDefinition1.SizeType = System.Windows.Forms.SizeType.Absolute; columnDefinition1.Width = 250D; columnDefinition2.SizeType = System.Windows.Forms.SizeType.Absolute; columnDefinition2.Width = 250D; columnDefinition3.SizeType = System.Windows.Forms.SizeType.Percent; columnDefinition3.Width = 100D; this.Root.OptionsTableLayoutGroup.ColumnDefinitions.AddRange(new DevExpress.XtraLayout.ColumnDefinition[] { columnDefinition1, columnDefinition2, columnDefinition3}); rowDefinition1.Height = 100D; rowDefinition1.SizeType = System.Windows.Forms.SizeType.Percent; rowDefinition2.Height = 100D; rowDefinition2.SizeType = System.Windows.Forms.SizeType.Percent; rowDefinition3.Height = 100D; rowDefinition3.SizeType = System.Windows.Forms.SizeType.Percent; this.Root.OptionsTableLayoutGroup.RowDefinitions.AddRange(new DevExpress.XtraLayout.RowDefinition[] { rowDefinition1, rowDefinition2, rowDefinition3}); this.Root.Size = new System.Drawing.Size(1040, 113); this.Root.TextVisible = false; // // layoutControlItem3 // this.layoutControlItem3.Control = this.comLine; this.layoutControlItem3.Location = new System.Drawing.Point(0, 0); this.layoutControlItem3.Name = "layoutControlItem3"; this.layoutControlItem3.Size = new System.Drawing.Size(250, 31); this.layoutControlItem3.Text = "é线ä½"; this.layoutControlItem3.TextSize = new System.Drawing.Size(70, 18); // // layoutControlItem1 // this.layoutControlItem1.Control = this.cmbSerialPortNum; this.layoutControlItem1.Location = new System.Drawing.Point(0, 31); this.layoutControlItem1.Name = "layoutControlItem1"; this.layoutControlItem1.OptionsTableLayoutItem.RowIndex = 1; this.layoutControlItem1.Size = new System.Drawing.Size(250, 31); this.layoutControlItem1.Text = "串å£å·"; this.layoutControlItem1.TextSize = new System.Drawing.Size(70, 18); // // cmbBaudRate1111 // this.cmbBaudRate1111.Control = this.cmbBaudRate; this.cmbBaudRate1111.Location = new System.Drawing.Point(0, 62); this.cmbBaudRate1111.Name = "cmbBaudRate1111"; this.cmbBaudRate1111.OptionsTableLayoutItem.RowIndex = 2; this.cmbBaudRate1111.Size = new System.Drawing.Size(250, 31); this.cmbBaudRate1111.Text = "æ³¢ç¹ç"; this.cmbBaudRate1111.TextSize = new System.Drawing.Size(70, 18); // // layoutControlItem2 // this.layoutControlItem2.Control = this.button1; this.layoutControlItem2.Location = new System.Drawing.Point(250, 0); this.layoutControlItem2.MaxSize = new System.Drawing.Size(250, 31); this.layoutControlItem2.MinSize = new System.Drawing.Size(41, 31); this.layoutControlItem2.Name = "layoutControlItem2"; this.layoutControlItem2.OptionsTableLayoutItem.ColumnIndex = 1; this.layoutControlItem2.Size = new System.Drawing.Size(250, 31); this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem2.Text = "å¯å¨"; this.layoutControlItem2.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem2.TextVisible = false; // // layoutControlItem6 // this.layoutControlItem6.Control = this.button2; this.layoutControlItem6.Location = new System.Drawing.Point(250, 31); this.layoutControlItem6.Name = "layoutControlItem6"; this.layoutControlItem6.OptionsTableLayoutItem.ColumnIndex = 1; this.layoutControlItem6.OptionsTableLayoutItem.RowIndex = 1; this.layoutControlItem6.Size = new System.Drawing.Size(250, 31); this.layoutControlItem6.Text = "忢"; this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem6.TextVisible = false; // // layoutControlItem4 // this.layoutControlItem4.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 20F, System.Drawing.FontStyle.Bold); this.layoutControlItem4.AppearanceItemCaption.Options.UseFont = true; this.layoutControlItem4.ContentVertAlignment = DevExpress.Utils.VertAlignment.Center; this.layoutControlItem4.Control = this.txtNum; this.layoutControlItem4.Location = new System.Drawing.Point(500, 0); this.layoutControlItem4.Name = "layoutControlItem4"; this.layoutControlItem4.OptionsTableLayoutItem.ColumnIndex = 2; this.layoutControlItem4.OptionsTableLayoutItem.RowSpan = 2; this.layoutControlItem4.Size = new System.Drawing.Size(520, 62); this.layoutControlItem4.Text = "éé"; this.layoutControlItem4.TextSize = new System.Drawing.Size(70, 41); // // layoutControlItem5 // this.layoutControlItem5.Control = this.txtMsg; this.layoutControlItem5.Location = new System.Drawing.Point(500, 62); this.layoutControlItem5.Name = "layoutControlItem5"; this.layoutControlItem5.OptionsTableLayoutItem.ColumnIndex = 2; this.layoutControlItem5.OptionsTableLayoutItem.RowIndex = 2; this.layoutControlItem5.Size = new System.Drawing.Size(520, 31); this.layoutControlItem5.Text = "æ¶å表"; this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0); this.layoutControlItem5.TextVisible = false; // // gcMx1 // this.gcMx1.Dock = System.Windows.Forms.DockStyle.Fill; this.gcMx1.Location = new System.Drawing.Point(0, 0); this.gcMx1.MainView = this.gvMx1; this.gcMx1.Name = "gcMx1"; this.gcMx1.Size = new System.Drawing.Size(1040, 386); this.gcMx1.TabIndex = 0; this.gcMx1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gvMx1}); // // gvMx1 // this.gvMx1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gridColumn1, this.gridColumn2, this.gridColumn3, this.gridColumn4, this.gridColumn5, this.gridColumn6, this.gridColumn8, this.gridColumn9, this.gridColumn10, this.gridColumn11, this.gridColumn12, this.gridColumn13}); this.gvMx1.GridControl = this.gcMx1; this.gvMx1.Name = "gvMx1"; // // gridColumn1 // this.gridColumn1.Caption = "æ¡ç "; this.gridColumn1.FieldName = "flowCode"; this.gridColumn1.MinWidth = 25; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.OptionsColumn.ReadOnly = true; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; this.gridColumn1.Width = 94; // // gridColumn2 // this.gridColumn2.Caption = "å·¥å"; this.gridColumn2.FieldName = "gdbh"; this.gridColumn2.MinWidth = 25; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.OptionsColumn.ReadOnly = true; this.gridColumn2.Visible = true; this.gridColumn2.VisibleIndex = 1; this.gridColumn2.Width = 94; // // gridColumn3 // this.gridColumn3.Caption = "ç©æç¼ç "; this.gridColumn3.FieldName = "itemNo"; this.gridColumn3.MinWidth = 25; this.gridColumn3.Name = "gridColumn3"; this.gridColumn3.OptionsColumn.ReadOnly = true; this.gridColumn3.Visible = true; this.gridColumn3.VisibleIndex = 2; this.gridColumn3.Width = 94; // // gridColumn4 // this.gridColumn4.Caption = "ç©æåç§°"; this.gridColumn4.FieldName = "itemName"; this.gridColumn4.MinWidth = 25; this.gridColumn4.Name = "gridColumn4"; this.gridColumn4.OptionsColumn.ReadOnly = true; this.gridColumn4.Visible = true; this.gridColumn4.VisibleIndex = 3; this.gridColumn4.Width = 94; // // gridColumn5 // this.gridColumn5.Caption = "ç©æè§æ ¼"; this.gridColumn5.FieldName = "itemModel"; this.gridColumn5.MinWidth = 25; this.gridColumn5.Name = "gridColumn5"; this.gridColumn5.OptionsColumn.ReadOnly = true; this.gridColumn5.Visible = true; this.gridColumn5.VisibleIndex = 4; this.gridColumn5.Width = 94; // // gridColumn6 // this.gridColumn6.Caption = "å·¥åº"; this.gridColumn6.FieldName = "processNo"; this.gridColumn6.MinWidth = 25; this.gridColumn6.Name = "gridColumn6"; this.gridColumn6.OptionsColumn.ReadOnly = true; this.gridColumn6.Visible = true; this.gridColumn6.VisibleIndex = 5; this.gridColumn6.Width = 94; // // gridColumn8 // this.gridColumn8.Caption = "线å«"; this.gridColumn8.FieldName = "lineName"; this.gridColumn8.MinWidth = 25; this.gridColumn8.Name = "gridColumn8"; this.gridColumn8.OptionsColumn.ReadOnly = true; this.gridColumn8.Visible = true; this.gridColumn8.VisibleIndex = 6; this.gridColumn8.Width = 94; // // gridColumn9 // this.gridColumn9.Caption = "ä½ä¸äººå"; this.gridColumn9.FieldName = "createBy"; this.gridColumn9.MinWidth = 25; this.gridColumn9.Name = "gridColumn9"; this.gridColumn9.OptionsColumn.ReadOnly = true; this.gridColumn9.Visible = true; this.gridColumn9.VisibleIndex = 7; this.gridColumn9.Width = 94; // // gridColumn10 // this.gridColumn10.Caption = "ä½ä¸æ¶é´"; this.gridColumn10.FieldName = "createDate"; this.gridColumn10.MinWidth = 25; this.gridColumn10.Name = "gridColumn10"; this.gridColumn10.OptionsColumn.ReadOnly = true; this.gridColumn10.Visible = true; this.gridColumn10.VisibleIndex = 8; this.gridColumn10.Width = 94; // // gridColumn11 // this.gridColumn11.Caption = "å®é éé"; this.gridColumn11.FieldName = "sjWeight"; this.gridColumn11.MinWidth = 25; this.gridColumn11.Name = "gridColumn11"; this.gridColumn11.OptionsColumn.ReadOnly = true; this.gridColumn11.Visible = true; this.gridColumn11.VisibleIndex = 9; this.gridColumn11.Width = 94; // // gridColumn12 // this.gridColumn12.Caption = "ééä¸é"; this.gridColumn12.FieldName = "maxWeight"; this.gridColumn12.MinWidth = 25; this.gridColumn12.Name = "gridColumn12"; this.gridColumn12.OptionsColumn.ReadOnly = true; this.gridColumn12.Visible = true; this.gridColumn12.VisibleIndex = 10; this.gridColumn12.Width = 94; // // gridColumn13 // this.gridColumn13.Caption = "ééä¸é"; this.gridColumn13.FieldName = "minWeight"; this.gridColumn13.MinWidth = 25; this.gridColumn13.Name = "gridColumn13"; this.gridColumn13.OptionsColumn.ReadOnly = true; this.gridColumn13.Visible = true; this.gridColumn13.VisibleIndex = 11; this.gridColumn13.Width = 94; // // Frm_Work09 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1040, 511); this.Controls.Add(this.split1); this.Name = "Frm_Work09"; this.Text = "ç§°ééé"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; ((System.ComponentModel.ISupportInitialize)(this.split1.Panel1)).EndInit(); this.split1.Panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.split1.Panel2)).EndInit(); this.split1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.split1)).EndInit(); this.split1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.layoutMx1)).EndInit(); this.layoutMx1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.cmbSerialPortNum.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txtNum.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.txtMsg.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cmbBaudRate1111)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gcMx1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gvMx1)).EndInit(); this.ResumeLayout(false); } #endregion private DevExpress.XtraEditors.SplitContainerControl split1; private DevExpress.XtraDataLayout.DataLayoutControl layoutMx1; private DevExpress.XtraLayout.LayoutControlGroup Root; private DevExpress.XtraEditors.ComboBoxEdit cmbSerialPortNum; private DevExpress.XtraEditors.ComboBoxEdit cmbBaudRate; private DevExpress.XtraEditors.TextEdit txtNum; private DevExpress.XtraEditors.SimpleButton button1; private DevExpress.XtraGrid.GridControl gcMx1; private DevExpress.XtraGrid.Views.Grid.GridView gvMx1; private DevExpress.XtraGrid.Columns.GridColumn gridColumn1; private DevExpress.XtraGrid.Columns.GridColumn gridColumn2; private DevExpress.XtraGrid.Columns.GridColumn gridColumn3; private DevExpress.XtraGrid.Columns.GridColumn gridColumn4; private DevExpress.XtraGrid.Columns.GridColumn gridColumn5; private DevExpress.XtraGrid.Columns.GridColumn gridColumn6; private DevExpress.XtraGrid.Columns.GridColumn gridColumn8; private DevExpress.XtraGrid.Columns.GridColumn gridColumn9; private DevExpress.XtraGrid.Columns.GridColumn gridColumn10; private DevExpress.XtraGrid.Columns.GridColumn gridColumn11; private DevExpress.XtraGrid.Columns.GridColumn gridColumn12; private DevExpress.XtraGrid.Columns.GridColumn gridColumn13; private DevApp.UserControl.UcLookWorkline comLine; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; private DevExpress.XtraEditors.MemoEdit txtMsg; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; private DevExpress.XtraLayout.LayoutControlItem cmbBaudRate1111; private DevExpress.XtraEditors.SimpleButton button2; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5; } } DevApp/Gs.WeightLine/Form1.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,356 @@ using Gs.WeightIqc.ToolBox; using Microsoft.Win32; using Newtonsoft.Json; using NModbus; using NModbus.Serial; using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.IO.Ports; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Gs.WeightLine { public partial class Form1 : DevExpress.XtraEditors.XtraForm { string _webServiceName = "WorkWeight/"; public System.IO.Ports.SerialPort Sp = new System.IO.Ports.SerialPort(); public delegate void HandleInterfaceUpdataDelegate(string text); private Form1.HandleInterfaceUpdataDelegate interfaceUpdataHandle; private Dictionary<string, Thread> dicThread = new Dictionary<string, Thread>(); private System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer(); System.Timers.Timer timerGridview = new System.Timers.Timer(10000); public Form1() { InitializeComponent(); GetComList(); comLine.getSuppler(""); #region MyRegion int int32 = 10000; string _vanishingSeconds = ConfigurationManager.AppSettings["TimingMailInterval"]; if (!string.IsNullOrEmpty(_vanishingSeconds)) int32 = int.Parse(_vanishingSeconds); this.timer1.Interval = int32; this.button1.Enabled = true; this.button2.Enabled = false; this.comLine.IsReadly = false; this.cmbSerialPortNum.Enabled = true; this.cmbBaudRate.Enabled = true; this.cmbBaudRate.SelectedIndex = 1; #endregion this.timer1.Tick += (s, e) => { if (this.dicThread.Keys.Contains<string>("GetWeight")) return; Thread thread1 = new Thread(new ThreadStart(this.GetWeight)); thread1.Start(); this.dicThread.Add("GetWeight", thread1); }; this.button1.Click += (s, e) => { string _comLine = comLine.GetId(); if (string.IsNullOrEmpty(_comLine)) { MessageBox.Show("è¯·éæ©çº¿ä½"); this.comLine.Focus(); return; } try { LogHelper.Debug(this.ToString(), " å¼å§éé"); if (this.cmbBaudRate.Text.Trim() != "" && this.cmbSerialPortNum.Text != "") { LogHelper.Debug(this.ToString(), "é 置串å£éä¿¡"); this.interfaceUpdataHandle = new Form1.HandleInterfaceUpdataDelegate(this.UpdateTextBox); this.Sp.PortName = this.cmbSerialPortNum.Text.Trim(); this.Sp.BaudRate = Convert.ToInt32(this.cmbBaudRate.Text.Trim()); this.Sp.Parity = Parity.None; this.Sp.StopBits = StopBits.One; LogHelper.Debug(this.ToString(), "æå¼ä¸²å£åéä¿¡"); this.Sp.Open(); this.button1.Enabled = false; this.button2.Enabled = true; this.timer1.Enabled = false; this.comLine.IsReadly = true; this.cmbSerialPortNum.Enabled = false; this.cmbBaudRate.Enabled = false; LogHelper.Debug(this.ToString(), "å¯å¨å·æ°æ°æ®å®æ¶å¨"); this.timer1.Start(); } else { LogHelper.Debug(this.ToString(), "请è¾å ¥æ£ç¡®ç串å£å·åæ³¢ç¹ç"); int num = (int)MessageBox.Show("请è¾å ¥æ£ç¡®ç串å£å·åæ³¢ç¹çï¼"); this.cmbSerialPortNum.Focus(); } } catch (Exception ex) { LogHelper.Debug(this.ToString(), ex.Message); int num = (int)MessageBox.Show($"串å£{this.cmbSerialPortNum.Text.Trim()}æå¼å¤±è´¥ï¼{ex.Message}"); } }; this.button2.Click += (s, e) => { try { if (this.dicThread.Keys.Contains<string>("GetWeight")) { Thread thread = this.dicThread["GetWeight"]; if (thread.IsAlive) thread.Abort(); this.dicThread.Remove("GetWeight"); } this.button1.Enabled = true; this.button2.Enabled = false; this.comLine.IsReadly = false; this.cmbSerialPortNum.Enabled = true; this.cmbBaudRate.Enabled = true; this.timer1.Stop(); this.Sp.Close(); } catch (Exception ex) { //int num = (int)MessageBox.Show(ex.Message); //Application.Exit(); MessageBox.Show(ex.Message); LogHelper.Debug(this.ToString(), ex.Message); } }; this.FormClosing += (s, e) => { if (Sp.IsOpen) Sp.Close(); if (timer1 != null) { timer1.Stop(); timer1.Dispose(); } if (timerGridview != null) { timerGridview.Stop(); timerGridview.Dispose(); } try { if (this.dicThread.Keys.Contains<string>("GetWeight")) { Thread thread = this.dicThread["GetWeight"]; if (thread.IsAlive) thread.Abort(); this.dicThread.Remove("GetWeight"); } this.timer1.Stop(); this.Sp.Close(); } catch (Exception ex) { //int num = (int)MessageBox.Show(ex.Message); //Application.Exit(); MessageBox.Show(ex.Message); } }; #region gridview设置 timerGridview.Elapsed += (s, e) => { string _lineId = comLine.GetId(); if (string.IsNullOrEmpty(_lineId)) return; var _obj = new { lineId = _lineId, }; try { var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModelList", JsonConvert.SerializeObject(_obj), false); var dd = UtilityHelper.ReturnToList(strReturn); var dt = dd.rtnData; BeginInvoke(new Action(() => { gcMx1.BindingContext = new BindingContext(); gcMx1.DataSource = dt; gcMx1.ForceInitialize(); gvMx1.BestFitColumns(); })); BeginInvoke(new Action(() => { this.txtMsg.Text = "æè¿å·æ°å表æ¶é´:" + DateTime.Now.ToString(); })); } catch (Exception ex) { MessageBox.Show("gvMx1:" + ex.Message); } }; timerGridview.AutoReset = true; // 设置为true表示é夿§è¡ï¼false表示æ§è¡ä¸æ¬¡å忢 timerGridview.Enabled = true; // å¼å§è®¡æ¶ gvMx1.OptionsFind.ShowSearchNavButtons = false; gvMx1.OptionsView.ShowAutoFilterRow = false; gvMx1.OptionsView.ShowGroupPanel = false; gvMx1.RowStyle += (s, e) => { //é»è®¤éä¸è¡ä¸åè² gvMx1.OptionsSelection.EnableAppearanceFocusedRow = false; //é»è®¤éä¸åå æ ¼ä¸åè² gvMx1.OptionsSelection.EnableAppearanceFocusedCell = false; if (e.RowHandle >= 0) { DataRow row = gvMx1.GetDataRow(e.RowHandle); if (row == null) return; string colorString = row["bgColor"].ToString(); // 使ç¨åå è¿å¶è¡¨ç¤ºé¢è²çARGBå¼ Color color = ColorTranslator.FromHtml(colorString); e.Appearance.BackColor = color; } }; gvMx1.IndicatorWidth = 60; gvMx1.CustomDrawRowIndicator += (s, e) => { if (e.Info.IsRowIndicator && e.RowHandle >= 0) e.Info.DisplayText = (e.RowHandle + 1).ToString(); }; #endregion } /// <summary> /// è·åéé /// </summary> public void GetWeight() { ModbusFactory factory = new ModbusFactory(); LogHelper.Debug(this.ToString(), "GetWeightå建modbus对象"); IModbusMaster rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); bool flag = true; while (true) { //addModel("1", "2"); //ToolBox.LogHelper.Debug(this.ToString(), "GetWeightå建modbus对象"); try { if (!this.Sp.IsOpen) { LogHelper.Debug(this.ToString(), "GetWeight éæ°æå¼ä¸²å£è¿æ¥"); this.Sp.Open(); rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); } if (rtuMaster == null) { LogHelper.Debug(this.ToString(), "GetWeight éæ°å建modbus对象2"); rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); } byte slaveAddress3 = byte.Parse("1"); ushort startAddress3 = ushort.Parse("0002"); ushort numberOfPoints1 = ushort.Parse("2"); ushort[] numArray = rtuMaster.ReadHoldingRegisters(slaveAddress3, startAddress3, numberOfPoints1); float single = BitConverter.ToSingle(this.CombomBinaryArray(BitConverter.GetBytes(numArray[1]), BitConverter.GetBytes(numArray[0])), 0); this.Invoke((Delegate)this.interfaceUpdataHandle, (object)single.ToString()); byte slaveAddress4 = byte.Parse("1"); ushort startAddress4 = ushort.Parse("0001"); ushort numberOfPoints2 = ushort.Parse("1"); int int32 = Convert.ToInt32(rtuMaster.ReadHoldingRegisters(slaveAddress4, startAddress4, numberOfPoints2)[0].ToString()); string str = Convert.ToString(int32, 2).PadLeft(16 /*0x10*/, '0'); char ch1 = str[1]; char ch2 = str[6]; if (ch1 == '0' && ch2 == '0') { flag = true; } else if (flag) { flag = false; } addModel(single.ToString(), int32.ToString()); LogHelper.Debug(this.ToString(), "single:" + single.ToString() + ",flag:" + flag.ToString() + ",int32:" + int32.ToString()); Thread.Sleep(2000); } catch (Exception ex) { Thread.Sleep(2000); } } } /// <summary> /// ä¸ä¼ ç§°éæ°æ® /// </summary> /// <param name="_realWeight">æªååçæ°é</param> /// <param name="_realWeightTxt">åå串</param> private void addModel(string _realWeight, string _realWeightTxt) { string _lineId = comLine.GetId(); var _obj = new { lineId = _lineId, realWeight = _realWeight.Trim(), realWeightTxt = _realWeightTxt.Trim(), }; try { string strJson = UtilityHelper.HttpPost("", "WorkWeight/EditModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = UtilityHelper.ReturnToDynamic(strJson); if (_rtn.rtnCode <= 0) { LogHelper.Debug(this.ToString(), "WorkWeight/EditModel:" + strJson); } } catch (Exception ex) { LogHelper.Debug(this.ToString(), ex.Message); } } /// <summary> /// æ´æ°UI /// </summary> /// <param name="text"></param> private void UpdateTextBox(string text) { try { this.txtMsg.Text = "æè¿è·åç§°éæ¶é´:" + DateTime.Now.ToString(); if (this.txtNum.Text == text) return; this.txtNum.Text = text; } catch (Exception ex) { LogHelper.Debug(this.ToString(), ex.Message); } } private void GetComList() { this.cmbSerialPortNum.Clear(); RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("Hardware\\DeviceMap\\SerialComm"); if (registryKey == null) return; foreach (string valueName in registryKey.GetValueNames()) { string description = (string)registryKey.GetValue(valueName); cmbSerialPortNum.Properties.Items.Add(description); } if (this.cmbSerialPortNum.Properties.Items.Count > 0) this.cmbSerialPortNum.SelectedIndex = 0; } private byte[] CombomBinaryArray(byte[] srcArray1, byte[] srcArray2) { byte[] destinationArray = new byte[srcArray1.Length + srcArray2.Length]; Array.Copy((Array)srcArray1, 0, (Array)destinationArray, 0, srcArray1.Length); Array.Copy((Array)srcArray2, 0, (Array)destinationArray, srcArray1.Length, srcArray2.Length); return destinationArray; } } } DevApp/Gs.WeightLine/Form1.resx
¶Ô±ÈÐÂÎļþ @@ -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:import> <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:element> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string"></xsd:attribute> <xsd:attribute name="type" type="xsd:string"></xsd:attribute> <xsd:attribute name="mimetype" type="xsd:string"></xsd:attribute> <xsd:attribute ref="xml:space"></xsd:attribute> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string"></xsd:attribute> <xsd:attribute name="name" type="xsd:string"></xsd:attribute> </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> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"></xsd:element> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"></xsd:attribute> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"></xsd:attribute> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"></xsd:attribute> <xsd:attribute ref="xml:space"></xsd:attribute> </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:element> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute> </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> DevApp/Gs.WeightLine/Gs.WeightLine.csproj
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,122 @@ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <ProductVersion>8.0.30703</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{9B6D4E64-C711-4856-BFA7-C746CEC2B0F8}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Gs.WeightLine</RootNamespace> <AssemblyName>Gs.WeightLine</AssemblyName> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </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="DevExpress.BonusSkins.v22.2" /> <Reference Include="DevExpress.Data.Desktop.v22.2" /> <Reference Include="DevExpress.Data.v22.2" /> <Reference Include="DevExpress.Utils.v22.2" /> <Reference Include="DevExpress.Sparkline.v22.2.Core" /> <Reference Include="DevExpress.XtraEditors.v22.2" /> <Reference Include="DevExpress.Printing.v22.2.Core" /> <Reference Include="DevExpress.Drawing.v22.2" /> <Reference Include="DevExpress.XtraGrid.v22.2, Version=22.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.XtraLayout.v22.2, Version=22.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <Reference Include="DevExpress.XtraPrinting.v22.2, Version=22.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="NModbus, Version=3.0.81.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\NModbus.3.0.81\lib\net46\NModbus.dll</HintPath> </Reference> <Reference Include="NModbus.Serial, Version=3.0.81.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\NModbus.Serial.3.0.81\lib\net46\NModbus.Serial.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Configuration" /> <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.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="ToolBox\LogHelper.cs" /> <Compile Include="ToolBox\PageQueryModel.cs" /> <Compile Include="ToolBox\ReturnModel.cs" /> <Compile Include="ToolBox\UtilityHelper.cs" /> <Compile Include="UcLookWorkline.cs"> <SubType>UserControl</SubType> </Compile> <Compile Include="UcLookWorkline.Designer.cs"> <DependentUpon>UcLookWorkline.cs</DependentUpon> </Compile> <EmbeddedResource Include="Form1.resx"> <DependentUpon>Form1.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Properties\licenses.licx" /> <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="UcLookWorkline.resx"> <DependentUpon>UcLookWorkline.cs</DependentUpon> </EmbeddedResource> <None Include="App.config" /> <None Include="packages.config" /> <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> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> DevApp/Gs.WeightLine/Program.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,24 @@ using DevExpress.LookAndFeel; using DevExpress.Skins; using DevExpress.UserSkins; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Gs.WeightLine { internal static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } DevApp/Gs.WeightLine/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Gs.WeightLine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Gs.WeightLine")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9006f149-aa49-4b8e-ba69-386d945fa738")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] DevApp/Gs.WeightLine/Properties/Resources.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,71 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18034 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Gs.WeightLine.Properties { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [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> /// Returns the cached ResourceManager instance used by this class. /// </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("Gs.WeightLine.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } DevApp/Gs.WeightLine/Properties/Resources.resx
¶Ô±ÈÐÂÎļþ @@ -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:element> </xsd:sequence> <xsd:attribute name="name" type="xsd:string"></xsd:attribute> <xsd:attribute name="type" type="xsd:string"></xsd:attribute> <xsd:attribute name="mimetype" type="xsd:string"></xsd:attribute> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string"></xsd:attribute> <xsd:attribute name="name" type="xsd:string"></xsd:attribute> </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> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"></xsd:element> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1"></xsd:attribute> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"></xsd:attribute> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"></xsd:attribute> </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:element> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute> </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> DevApp/Gs.WeightLine/Properties/Settings.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,30 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18034 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Gs.WeightLine.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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; } } } } DevApp/Gs.WeightLine/Properties/Settings.settings
¶Ô±ÈÐÂÎļþ @@ -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> DevApp/Gs.WeightLine/Properties/licenses.licx
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,2 @@ DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v22.2, Version=22.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraEditors.SearchLookUpEdit, DevExpress.XtraGrid.v22.2, Version=22.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevApp/Gs.WeightLine/ToolBox/LogHelper.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,53 @@ using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Gs.WeightIqc.ToolBox { public class LogHelper { //å建æ¥å¿ç®å½ private static readonly string path = AppContext.BaseDirectory + ConfigurationManager.AppSettings[ "LogPath"]; /** * åæ¥å¿æä»¶åå ¥è°è¯ä¿¡æ¯ * @param className ç±»å * @param content åå ¥å 容 */ public static void Debug(string className, string content) { WriteLog("DEBUG", className, content); } /** * å®é çåæ¥å¿æä½ * @param type æ¥å¿è®°å½ç±»å * @param className ç±»å * @param content åå ¥å 容 */ protected static void WriteLog(string type, string className, string content) { if (!Directory.Exists(path)) //妿æ¥å¿ç®å½ä¸åå¨å°±å建 Directory.CreateDirectory(path); var time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); //è·åå½åç³»ç»æ¶é´ var filename = path + "/" + DateTime.Now.ToString("yyyy-MM-dd") + ".log"; //ç¨æ¥æå¯¹æ¥å¿æä»¶å½å //å建ææå¼æ¥å¿æä»¶ï¼åæ¥å¿æä»¶æ«å°¾è¿½å è®°å½ var mySw = File.AppendText(filename); //åæ¥å¿æä»¶åå ¥å 容 var write_content = time + " " + type + " " + className + ": " + content; mySw.WriteLine(write_content); //å ³éæ¥å¿æä»¶ mySw.Close(); } } } DevApp/Gs.WeightLine/ToolBox/PageQueryModel.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,73 @@ namespace Gs.WeightIqc.ToolBox { /// <summary> /// æ¥è¯¢å®ä½ /// </summary> public class PageQueryModel { /// <summary> /// /// </summary> /// <param name="_currentPage">å½å页</param> /// <param name="_everyPageSize">æ¯é¡µå¤§å°</param> /// <param name="_sortName">æåºå</param> /// <param name="_sortOrder">æåºæ¹å¼</param> /// <param name="_keyWord">æ¥è¯¢å ³é®å</param> /// <param name="_keyWhere">æ¥è¯¢è¡¨è¾¾å¼ and å¼å¤´</param> /// <param name="_keyType">ä¸ä¸ªè¾ å©ç¨çå ³é®å</param> public PageQueryModel(int _currentPage, int _everyPageSize, string _sortName = "create_date", string _sortOrder = "asc", string _keyWord = "", string _keyWhere = "", string _keyType = "") { currentPage = _currentPage; everyPageSize = _everyPageSize; sortName = _sortName; sortOrder = _sortOrder; keyWord = _keyWord; keyWhere = _keyWhere; keyType = _keyType; } public PageQueryModel() { } /// <summary> /// å½å页 /// </summary> public int currentPage { get; set; } /// <summary> /// æ¯é¡µå¤§å° /// </summary> public int everyPageSize { get; set; } /// <summary> /// æåºå /// </summary> public string sortName { get; set; } /// <summary> /// æåºæ¹å¼ /// </summary> public string sortOrder { get; set; } /// <summary> /// æ¥è¯¢å ³é®å /// </summary> public string keyWord { get; set; } /// <summary> /// æ¥è¯¢è¡¨è¾¾å¼ /// </summary> public string keyWhere { get; set; } /// <summary> /// ä¸å¡ç±»å« /// </summary> public string keyType { get; set; } } } DevApp/Gs.WeightLine/ToolBox/ReturnModel.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,64 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Gs.WeightIqc.ToolBox { /// <summary> /// è¿åçå¤å´ç»æ /// </summary> /// <typeparam name="T"></typeparam> public class ReturnModel<T> { /// <summary> /// Default = -100é»è®¤, Unauthorized = -101éæ³è°ç¨, Exception = -102ç³»ç»ä»£ç å¼å¸¸, Success /// = 1æå /// </summary> public int rtnCode { set; get; } public T rtnData { set; get; } public string rtnMsg { get; set; } } /// <summary> /// è¿åçå页èç¹ /// </summary> public class PageListModel { /// <summary> /// æ¯é¡µå¤§å° /// </summary> public int everyPageSize; /// <summary> /// æ©å±ç¨ï¼å表 /// </summary> public List<dynamic> extendList; /// <summary> /// æ©å±ç¨ï¼åææ¬ï¼æ¯å¦éé¢å计çå ¶å®é¡¹ç® /// </summary> public string extendText; /// <summary> /// æ»é¡µæ° /// </summary> public int pages; /// <summary> /// æ»è®°å½æ° /// </summary> public int total; /// <summary> /// å表 /// </summary> public DataTable list { get; set; } } } DevApp/Gs.WeightLine/ToolBox/UtilityHelper.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,151 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.IO; using System.Linq; using System.Net; using System.Net.Cache; using System.Text; using System.Threading.Tasks; namespace Gs.WeightIqc.ToolBox { public class UtilityHelper { private static readonly string WebApiUrl = ConfigurationManager.AppSettings["WebApiUrl"]; /// <summary> /// httpè¯·æ± /// </summary> /// <param name="url">apiæ ¹å°å</param> /// <param name="meth">æ¹æ³åç§°</param> /// <param name="param">jsonåæ°</param> /// <param name="isLoading">æ¯å¦loading</param> /// <returns></returns> public static string HttpPost(string url, string meth, string param, bool isLoading = true) { HttpWebRequest request = null; StreamWriter requestStream = null; WebResponse response = null; string responseStr = null; try { if (string.IsNullOrEmpty(url)) url = WebApiUrl; url += meth; request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/json"; request.Headers.Add("token", GetBasicAuthTicket()); request.Accept = "*/*"; request.Timeout = 150000; request.AllowAutoRedirect = false; request.ServicePoint.Expect100Continue = false; HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); request.CachePolicy = noCachePolicy; requestStream = new StreamWriter(request.GetRequestStream()); requestStream.Write(param); requestStream.Close(); response = request.GetResponse(); if (response != null) { var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); responseStr = reader.ReadToEnd(); //File.WriteAllText(Server.MapPath("~/") + @"\test.txt", responseStr); reader.Close(); } } catch (Exception ex) { LogHelper.Debug(url, param + ":" + ex.Message); throw ex; } finally { request = null; requestStream = null; response = null; } return responseStr; } /// <summary> /// çæè®¿é®æå¡çtoken /// </summary> /// <returns></returns> public static string GetBasicAuthTicket() { var userGuid = "11111111-1111-1111-1111-111111111111"; var token = userGuid; return token; } /// <summary> /// æå¡è¿åçjsonè¿åReturnModelï¼ /// </summary> /// <param name="strReturn"></param> /// <returns></returns> public static ReturnModel<dynamic> ReturnToDynamic(string strReturn) { var rto = new ReturnModel<dynamic>(); var json = JObject.Parse(strReturn); rto.rtnCode = int.Parse(json["rtnCode"].ToString()); rto.rtnMsg = json["rtnMsg"].ToString(); rto.rtnData = json["rtnData"]; return rto; } /// <summary> /// æå¡è¿åçjson串è¿åReturnModel-->ä» ä» ælist,ä¸åé¡µï¼ /// </summary> /// <param name="strReturn"></param> /// <returns></returns> public static ReturnModel<DataTable> ReturnToList(string strReturn) { var rto = new ReturnModel<DataTable>(); var json = JObject.Parse(strReturn); rto.rtnCode = int.Parse(json["rtnCode"].ToString()); rto.rtnMsg = json["rtnMsg"].ToString(); rto.rtnData = new DataTable(); var array = new JArray(); var d = json["rtnData"]; foreach (var a in d) array.Add(a); //if (array.Count <=0) // return null; var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); rto.rtnData = dt; return rto; } /// <summary> /// æå¡è¿åçjson转为ReturnModel-->å å«TablePageåé¡µï¼ /// </summary> /// <param name="strReturn"></param> /// <returns></returns> public static ReturnModel<PageListModel> ReturnToTablePage( string strReturn) { var rto = new ReturnModel<PageListModel>(); var json = JObject.Parse(strReturn); rto.rtnCode = int.Parse(json["rtnCode"].ToString()); rto.rtnMsg = json["rtnMsg"].ToString(); rto.rtnData = new PageListModel(); rto.rtnData.pages = int.Parse(json["rtnData"]["pages"].ToString()); rto.rtnData.total = int.Parse(json["rtnData"]["total"].ToString()); rto.rtnData.everyPageSize = int.Parse(json["rtnData"]["everyPageSize"].ToString()); var array = new JArray(); var d = json["rtnData"]["list"]; foreach (var a in d) array.Add(a); var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); rto.rtnData.list = dt; return rto; } } } DevApp/Gs.WeightLine/UcLookWorkline.Designer.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,121 @@ namespace Gs.DevApp.UserControl { partial class UcLookWorkline { /// <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 Component 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.lookSearchSupplier = new DevExpress.XtraEditors.SearchLookUpEdit(); this.searchLookUpEdit1View = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn(); ((System.ComponentModel.ISupportInitialize)(this.lookSearchSupplier.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.searchLookUpEdit1View)).BeginInit(); this.SuspendLayout(); // // lookSearchSupplier // this.lookSearchSupplier.Dock = System.Windows.Forms.DockStyle.Fill; this.lookSearchSupplier.Location = new System.Drawing.Point(0, 0); this.lookSearchSupplier.Name = "lookSearchSupplier"; this.lookSearchSupplier.Properties.Appearance.Options.UseFont = true; this.lookSearchSupplier.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.lookSearchSupplier.Properties.PopupView = this.searchLookUpEdit1View; this.lookSearchSupplier.Size = new System.Drawing.Size(278, 24); this.lookSearchSupplier.TabIndex = 8; // // searchLookUpEdit1View // this.searchLookUpEdit1View.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gridColumn1, this.gridColumn2, this.gridColumn3, this.gridColumn4}); this.searchLookUpEdit1View.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; this.searchLookUpEdit1View.Name = "searchLookUpEdit1View"; this.searchLookUpEdit1View.OptionsSelection.EnableAppearanceFocusedCell = false; this.searchLookUpEdit1View.OptionsView.ShowGroupPanel = false; // // gridColumn1 // this.gridColumn1.Caption = "产线ID"; this.gridColumn1.FieldName = "id"; this.gridColumn1.Name = "gridColumn1"; this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; // // gridColumn2 // this.gridColumn2.Caption = "产线ç¼å·"; this.gridColumn2.FieldName = "lineNo"; this.gridColumn2.MinWidth = 80; this.gridColumn2.Name = "gridColumn2"; this.gridColumn2.Visible = true; this.gridColumn2.VisibleIndex = 1; this.gridColumn2.Width = 80; // // gridColumn3 // this.gridColumn3.Caption = "产线åç§°"; this.gridColumn3.FieldName = "name"; this.gridColumn3.MinWidth = 100; this.gridColumn3.Name = "gridColumn3"; this.gridColumn3.Visible = true; this.gridColumn3.VisibleIndex = 2; this.gridColumn3.Width = 100; // // gridColumn4 // this.gridColumn4.Caption = "guid"; this.gridColumn4.FieldName = "guid"; this.gridColumn4.Name = "gridColumn4"; // // UcLookWorkline // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.lookSearchSupplier); this.Name = "UcLookWorkline"; this.Size = new System.Drawing.Size(278, 27); ((System.ComponentModel.ISupportInitialize)(this.lookSearchSupplier.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.searchLookUpEdit1View)).EndInit(); this.ResumeLayout(false); } #endregion private DevExpress.XtraEditors.SearchLookUpEdit lookSearchSupplier; private DevExpress.XtraGrid.Views.Grid.GridView searchLookUpEdit1View; private DevExpress.XtraGrid.Columns.GridColumn gridColumn2; private DevExpress.XtraGrid.Columns.GridColumn gridColumn3; private DevExpress.XtraGrid.Columns.GridColumn gridColumn4; private DevExpress.XtraGrid.Columns.GridColumn gridColumn1; } } DevApp/Gs.WeightLine/UcLookWorkline.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,99 @@  using Gs.WeightIqc.ToolBox; using Newtonsoft.Json; using System; using System.Data; namespace Gs.DevApp.UserControl { public partial class UcLookWorkline : DevExpress.XtraEditors.XtraUserControl { public UcLookWorkline() { InitializeComponent(); lookSearchSupplier.Properties.NullText = "è¯·éæ©"; lookSearchSupplier.EditValueChanged += LookSearchSupplier_EditValueChanged; } private bool _rdy; public bool IsReadly { set { _rdy = value; this.lookSearchSupplier.ReadOnly = _rdy; } get { return _rdy; } } /// <summary> /// æ¹åäºä»¶ /// </summary> public event EventHandler EditChanged; private void LookSearchSupplier_EditValueChanged(object sender, EventArgs e) { if (EditChanged != null) EditChanged(this, e); } /// <summary> /// 读åçº¿ä½ /// </summary> /// <param name="shopGuid"></param> public void getSuppler(string shopGuid, string _dftVale = "") { lookSearchSupplier.EditValue = null; string _sbSqlWhere = ""; if (!string.IsNullOrEmpty(shopGuid)) _sbSqlWhere = " and a.dpt_id=" + shopGuid; var pgq = new PageQueryModel(1, 999999, "org.FNumber asc ,c.departmentcode asc,a.line_no", "asc", "", _sbSqlWhere.ToString()); var json = JsonConvert.SerializeObject(pgq); try { var strReturn = UtilityHelper.HttpPost("", "MesWorkshopLineManager/GetListPage", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); DataTable dt = dd.rtnData.list; lookSearchSupplier.Properties.DataSource = dt; lookSearchSupplier.Properties.DisplayMember = "name"; lookSearchSupplier.Properties.ValueMember = "id"; lookSearchSupplier.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; if (!string.IsNullOrEmpty(_dftVale)) SetIdOrCode(_dftVale); } catch (Exception ex) { // MsgHelper.Warning("æç¤ºï¼" + ex.Message); } } public string GetId() { var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView; if (row != null) { string id = row["id"].ToString(); return id; } return ""; } public string GetCode() { var row = lookSearchSupplier.GetSelectedDataRow() as DataRowView; if (row != null) { string id = row["lineNo"].ToString(); return id; } return ""; } public string GetName() { var name = lookSearchSupplier.Text.Trim(); return name; } public void SetIdOrCode(string Code) { if (Code == "-1") { lookSearchSupplier.EditValue = null; return; } if (!string.IsNullOrEmpty(Code)) lookSearchSupplier.EditValue = Int64.Parse(((Code.ToString().Trim()))); } } } DevApp/Gs.WeightLine/UcLookWorkline.resx
¶Ô±ÈÐÂÎļþ @@ -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> DevApp/Gs.WeightLine/packages.config
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" /> <package id="NModbus" version="3.0.81" targetFramework="net48" /> <package id="NModbus.Serial" version="3.0.81" targetFramework="net48" /> </packages>