| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors.Controls; |
| | | using DevExpress.XtraGrid; |
| | | using DevExpress.XtraGrid.Columns; |
| | | using DevExpress.XtraGrid.Views.Base; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.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.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm.QC |
| | | { |
| | | public partial class WeightIqc : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public SerialPort Sp = new SerialPort(); |
| | | private WeightIqc.HandleInterfaceUpdataDelegate interfaceUpdataHandle; |
| | | private string strLine = ""; |
| | | private string sqlWOMQAB = ""; |
| | | private Dictionary<string, Thread> dicThread = new Dictionary<string, Thread>(); |
| | | private StringBuilder sb = new StringBuilder(); |
| | | private IContainer components = (IContainer)null; |
| | | private SplitContainerControl splitContainerControl1; |
| | | private ImageComboBoxEdit cmbBaudRate; |
| | | private LabelControl labelControl1; |
| | | private TextEdit txtNum; |
| | | private LabelControl labelControl3; |
| | | private SimpleButton button2; |
| | | private SimpleButton button1; |
| | | private SimpleButton btnRefashC; |
| | | private ImageComboBoxEdit cmbSerialPortNum; |
| | | private LabelControl labelControl2; |
| | | private GridControl gridWOMQAB; |
| | | private GridView viewWOMQAB; |
| | | private GridColumn colQAB001; |
| | | private GridColumn colQAB002; |
| | | private GridColumn colQAB003; |
| | | private GridColumn colQAB005; |
| | | private GridColumn colQAB006; |
| | | private GridColumn colQAB007; |
| | | private GridColumn colQAB009; |
| | | private GridColumn colQAB010; |
| | | private GridColumn colMIH004; |
| | | private GridColumn colPAA002; |
| | | private GridColumn colQAB015; |
| | | private GridColumn colQAB025; |
| | | private GridColumn colMCA022; |
| | | private GridColumn colZT; |
| | | private GridColumn colMCA023; |
| | | private NotifyIcon notifyIcon1; |
| | | private ContextMenuStrip contextMenuStrip1; |
| | | private System.Windows.Forms.Timer timer1; |
| | | private ToolStripMenuItem showInTaskbar; |
| | | private ToolStripMenuItem exitWindow; |
| | | |
| | | public WeightIqc() |
| | | { |
| | | this.InitializeComponent(); |
| | | this.timer1.Tick += new EventHandler(this.timer1_Tick); |
| | | this.notifyIcon1.DoubleClick += new EventHandler(this.notifyIcon1_DoubleClick); |
| | | this.SizeChanged += new EventHandler(this.frmMain_SizeChanged); |
| | | this.contextMenuStrip1.ItemClicked += new ToolStripItemClickedEventHandler(this.contextMenuStrip1_ItemClicked); |
| | | this.Initialize(); |
| | | |
| | | } |
| | | |
| | | private void Initialize() |
| | | { |
| | | try |
| | | { |
| | | int int32 = 10000; |
| | | string _vanishingSeconds = ConfigurationManager.AppSettings["TimingMailInterval"]; |
| | | if (!string.IsNullOrEmpty(_vanishingSeconds)) |
| | | int32 = int.Parse(_vanishingSeconds); |
| | | string appSetting = ConfigurationManager.AppSettings["ProductName"]+"æå¡"; |
| | | this.Text = appSetting; |
| | | this.notifyIcon1.Text = appSetting; |
| | | this.timer1.Interval = int32; |
| | | this.button1.Enabled = true; |
| | | this.button2.Enabled = false; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | int num = (int)MessageBox.Show(ex.Message); |
| | | Application.Exit(); |
| | | } |
| | | } |
| | | |
| | | private void GetComList() |
| | | { |
| | | this.cmbSerialPortNum.Properties.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.Properties.Items.Add(new ImageComboBoxItem(description, (object)description)); |
| | | } |
| | | if (this.cmbSerialPortNum.Properties.Items.Count > 0) |
| | | this.cmbSerialPortNum.SelectedIndex = 0; |
| | | } |
| | | |
| | | public void RefreshData() |
| | | { |
| | | while (true) |
| | | { |
| | | try |
| | | { |
| | | Thread.Sleep(10000); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Thread.Sleep(10000); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void GetWeight() |
| | | { |
| | | ModbusFactory factory = new ModbusFactory(); |
| | | LoggerHelper.WriteInfoLog("GetWeightå建modbus对象"); |
| | | IModbusMaster rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); |
| | | bool flag = true; |
| | | while (true) |
| | | { |
| | | try |
| | | { |
| | | if (!this.Sp.IsOpen) |
| | | { |
| | | LoggerHelper.WriteInfoLog("GetWeight éæ°æå¼ä¸²å£è¿æ¥"); |
| | | this.Sp.Open(); |
| | | rtuMaster = (IModbusMaster)factory.CreateRtuMaster(this.Sp); |
| | | } |
| | | if (rtuMaster == null) |
| | | { |
| | | LoggerHelper.WriteInfoLog("GetWeight éæ°å建modbus对象"); |
| | | 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()); |
| | | LoggerHelper.WriteInfoLog("single:" + single.ToString() + ",flag:" + flag.ToString() + ",int32:" + int32.ToString()); |
| | | Thread.Sleep(2000); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Thread.Sleep(2000); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void UpdateTextBox(string text) |
| | | { |
| | | try |
| | | { |
| | | if (this.txtNum.Text == text) |
| | | return; |
| | | this.txtNum.Text = text; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LoggerHelper.WriteErrorLog($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:{ex.Message}"); |
| | | int num = (int)MessageBox.Show(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public ushort[] stringToUshort2(string inString) |
| | | { |
| | | byte[] bytes = BitConverter.GetBytes(float.Parse(inString)); |
| | | ushort uint16 = BitConverter.ToUInt16(bytes, 0); |
| | | return new ushort[2] |
| | | { |
| | | BitConverter.ToUInt16(bytes, 2), |
| | | uint16 |
| | | }; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | private void button1_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | DateTime now = DateTime.Now; |
| | | LoggerHelper.WriteInfoLog(now.ToString("yyyy-MM-dd HH:mm:ss") + ":å¼å§éé"); |
| | | if (this.cmbBaudRate.Text.Trim() != "" && this.cmbSerialPortNum.Text != "") |
| | | { |
| | | now = DateTime.Now; |
| | | LoggerHelper.WriteInfoLog(now.ToString("yyyy-MM-dd HH:mm:ss") + ":é
置串å£éä¿¡"); |
| | | this.interfaceUpdataHandle = new WeightIqc.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; |
| | | now = DateTime.Now; |
| | | LoggerHelper.WriteInfoLog(now.ToString("yyyy-MM-dd HH:mm:ss") + ":æå¼ä¸²å£åéä¿¡"); |
| | | this.Sp.Open(); |
| | | this.button1.Enabled = false; |
| | | this.button2.Enabled = true; |
| | | this.timer1.Enabled = false; |
| | | now = DateTime.Now; |
| | | LoggerHelper.WriteInfoLog(now.ToString("yyyy-MM-dd HH:mm:ss") + ":å¯å¨å·æ°æ°æ®å®æ¶å¨"); |
| | | this.timer1.Start(); |
| | | } |
| | | else |
| | | { |
| | | now = DateTime.Now; |
| | | LoggerHelper.WriteErrorLog(now.ToString("yyyy-MM-dd HH:mm:ss") + ":请è¾å
¥æ£ç¡®ç端å£å·åæ³¢ç¹ç"); |
| | | int num = (int)MessageBox.Show("请è¾å
¥æ£ç¡®ç端å£å·åæ³¢ç¹çï¼"); |
| | | this.cmbSerialPortNum.Focus(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LoggerHelper.WriteErrorLog($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}:{ex.Message}"); |
| | | int num = (int)MessageBox.Show($"端å£{this.cmbSerialPortNum.Text.Trim()}æå¼å¤±è´¥ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | private void button2_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | if (this.dicThread.Keys.Contains<string>("RefreshData")) |
| | | { |
| | | Thread thread = this.dicThread["RefreshData"]; |
| | | if (thread.IsAlive) |
| | | thread.Abort(); |
| | | this.dicThread.Remove("RefreshData"); |
| | | } |
| | | 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.timer1.Stop(); |
| | | this.Sp.Close(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | int num = (int)MessageBox.Show(ex.Message); |
| | | Application.Exit(); |
| | | } |
| | | } |
| | | |
| | | private void timer1_Tick(object sender, EventArgs e) |
| | | { |
| | | if (!this.dicThread.Keys.Contains<string>("RefreshData")) |
| | | { |
| | | Thread thread = new Thread(new ThreadStart(this.RefreshData)); |
| | | thread.Start(); |
| | | this.dicThread.Add("RefreshData", thread); |
| | | } |
| | | if (this.dicThread.Keys.Contains<string>("GetWeight")) |
| | | return; |
| | | Thread thread1 = new Thread(new ThreadStart(this.GetWeight)); |
| | | thread1.Start(); |
| | | this.dicThread.Add("GetWeight", thread1); |
| | | } |
| | | |
| | | private void Form1_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | if (Sp.IsOpen) |
| | | Sp.Close(); |
| | | if (timer1 != null) |
| | | { |
| | | timer1.Stop(); |
| | | timer1.Dispose(); |
| | | } |
| | | try |
| | | { |
| | | if (this.dicThread.Keys.Contains<string>("RefreshData")) |
| | | { |
| | | Thread thread = this.dicThread["RefreshData"]; |
| | | if (thread.IsAlive) |
| | | thread.Abort(); |
| | | this.dicThread.Remove("RefreshData"); |
| | | } |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | private void Form1_Load(object sender, EventArgs e) => this.GetComList(); |
| | | |
| | | private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) |
| | | { |
| | | if (e.ClickedItem == this.showInTaskbar) |
| | | { |
| | | if (this.WindowState != FormWindowState.Minimized) |
| | | return; |
| | | this.WindowState = FormWindowState.Normal; |
| | | this.Activate(); |
| | | this.ShowInTaskbar = true; |
| | | this.notifyIcon1.Visible = false; |
| | | } |
| | | else |
| | | { |
| | | if (e.ClickedItem != this.exitWindow) |
| | | return; |
| | | this.button2_Click((object)null, (EventArgs)null); |
| | | Environment.Exit(0); |
| | | } |
| | | } |
| | | |
| | | private void frmMain_SizeChanged(object sender, EventArgs e) |
| | | { |
| | | //if (this.WindowState != FormWindowState.Minimized) |
| | | // return; |
| | | //this.ShowInTaskbar = false; |
| | | //this.notifyIcon1.Visible = true; |
| | | } |
| | | |
| | | private void notifyIcon1_DoubleClick(object sender, EventArgs e) |
| | | { |
| | | if (this.WindowState != FormWindowState.Minimized) |
| | | return; |
| | | this.WindowState = FormWindowState.Normal; |
| | | this.Activate(); |
| | | this.ShowInTaskbar = true; |
| | | this.notifyIcon1.Visible = false; |
| | | } |
| | | |
| | | protected override void Dispose(bool disposing) |
| | | { |
| | | if (disposing && this.components != null) |
| | | this.components.Dispose(); |
| | | base.Dispose(disposing); |
| | | } |
| | | |
| | | private void InitializeComponent() |
| | | { |
| | | this.components = (IContainer)new System.ComponentModel.Container(); |
| | | GridFormatRule gridFormatRule1 = new GridFormatRule(); |
| | | FormatConditionRuleExpression conditionRuleExpression1 = new FormatConditionRuleExpression(); |
| | | GridFormatRule gridFormatRule2 = new GridFormatRule(); |
| | | FormatConditionRuleExpression conditionRuleExpression2 = new FormatConditionRuleExpression(); |
| | | ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(WeightIqc)); |
| | | this.colZT = new GridColumn(); |
| | | this.splitContainerControl1 = new SplitContainerControl(); |
| | | this.txtNum = new TextEdit(); |
| | | this.labelControl3 = new LabelControl(); |
| | | this.button2 = new SimpleButton(); |
| | | this.button1 = new SimpleButton(); |
| | | this.btnRefashC = new SimpleButton(); |
| | | this.cmbSerialPortNum = new ImageComboBoxEdit(); |
| | | this.labelControl2 = new LabelControl(); |
| | | this.cmbBaudRate = new ImageComboBoxEdit(); |
| | | this.labelControl1 = new LabelControl(); |
| | | this.gridWOMQAB = new GridControl(); |
| | | this.viewWOMQAB = new GridView(); |
| | | this.colQAB001 = new GridColumn(); |
| | | this.colQAB002 = new GridColumn(); |
| | | this.colQAB003 = new GridColumn(); |
| | | this.colQAB005 = new GridColumn(); |
| | | this.colQAB006 = new GridColumn(); |
| | | this.colQAB007 = new GridColumn(); |
| | | this.colQAB009 = new GridColumn(); |
| | | this.colQAB010 = new GridColumn(); |
| | | this.colMIH004 = new GridColumn(); |
| | | this.colPAA002 = new GridColumn(); |
| | | this.colQAB015 = new GridColumn(); |
| | | this.colQAB025 = new GridColumn(); |
| | | this.colMCA022 = new GridColumn(); |
| | | this.colMCA023 = new GridColumn(); |
| | | this.notifyIcon1 = new NotifyIcon(this.components); |
| | | this.contextMenuStrip1 = new ContextMenuStrip(this.components); |
| | | this.showInTaskbar = new ToolStripMenuItem(); |
| | | this.exitWindow = new ToolStripMenuItem(); |
| | | this.timer1 = new System.Windows.Forms.Timer(this.components); |
| | | this.splitContainerControl1.BeginInit(); |
| | | this.splitContainerControl1.SuspendLayout(); |
| | | this.txtNum.Properties.BeginInit(); |
| | | this.cmbSerialPortNum.Properties.BeginInit(); |
| | | this.cmbBaudRate.Properties.BeginInit(); |
| | | this.gridWOMQAB.BeginInit(); |
| | | this.viewWOMQAB.BeginInit(); |
| | | this.contextMenuStrip1.SuspendLayout(); |
| | | this.SuspendLayout(); |
| | | this.colZT.Caption = "ç¶æ"; |
| | | this.colZT.FieldName = "ZT"; |
| | | this.colZT.Name = "colZT"; |
| | | this.splitContainerControl1.Dock = DockStyle.Fill; |
| | | this.splitContainerControl1.Horizontal = false; |
| | | this.splitContainerControl1.Location = new Point(0, 0); |
| | | this.splitContainerControl1.Margin = new Padding(4, 4, 4, 4); |
| | | this.splitContainerControl1.Name = "splitContainerControl1"; |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.txtNum); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.labelControl3); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.button2); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.button1); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.btnRefashC); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.cmbSerialPortNum); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.labelControl2); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.cmbBaudRate); |
| | | this.splitContainerControl1.Panel1.Controls.Add((Control)this.labelControl1); |
| | | this.splitContainerControl1.Panel1.Text = "Panel1"; |
| | | this.splitContainerControl1.Panel2.Controls.Add((Control)this.gridWOMQAB); |
| | | this.splitContainerControl1.Panel2.Text = "Panel2"; |
| | | this.splitContainerControl1.Size = new Size(859, 391); |
| | | this.splitContainerControl1.SplitterPosition = 139; |
| | | this.splitContainerControl1.TabIndex = 0; |
| | | this.splitContainerControl1.Text = "splitContainerControl1"; |
| | | this.txtNum.Location = new Point(588, 19); |
| | | this.txtNum.Margin = new Padding(4, 4, 4, 4); |
| | | this.txtNum.Name = "txtNum"; |
| | | this.txtNum.Properties.Appearance.Font = new Font("Tahoma", 24f, FontStyle.Regular, GraphicsUnit.Point, (byte)0); |
| | | this.txtNum.Properties.Appearance.Options.UseFont = true; |
| | | this.txtNum.Size = new Size(187, 54); |
| | | this.txtNum.TabIndex = 8; |
| | | this.labelControl3.Appearance.Font = new Font("Tahoma", 24f, FontStyle.Regular, GraphicsUnit.Point, (byte)0); |
| | | this.labelControl3.Appearance.Options.UseFont = true; |
| | | this.labelControl3.Location = new Point(468, 28); |
| | | this.labelControl3.Margin = new Padding(4, 4, 4, 4); |
| | | this.labelControl3.Name = "labelControl3"; |
| | | this.labelControl3.Size = new Size(120, 48 /*0x30*/); |
| | | this.labelControl3.TabIndex = 7; |
| | | this.labelControl3.Text = "ééï¼"; |
| | | this.button2.Location = new Point(315, 48 /*0x30*/); |
| | | this.button2.Margin = new Padding(4, 4, 4, 4); |
| | | this.button2.Name = "button2"; |
| | | this.button2.Size = new Size(100, 29); |
| | | this.button2.TabIndex = 6; |
| | | this.button2.Text = "忢"; |
| | | this.button2.Click += new EventHandler(this.button2_Click); |
| | | this.button1.Location = new Point(315, 8); |
| | | this.button1.Margin = new Padding(4, 4, 4, 4); |
| | | this.button1.Name = "button1"; |
| | | this.button1.Size = new Size(100, 29); |
| | | this.button1.TabIndex = 5; |
| | | this.button1.Text = "ç¡®å®"; |
| | | this.button1.Click += new EventHandler(this.button1_Click); |
| | | this.btnRefashC.Location = new Point(213, 48 /*0x30*/); |
| | | this.btnRefashC.Margin = new Padding(4, 4, 4, 4); |
| | | this.btnRefashC.Name = "btnRefashC"; |
| | | this.btnRefashC.Size = new Size(33, 29); |
| | | this.btnRefashC.TabIndex = 4; |
| | | this.btnRefashC.Text = "R"; |
| | | this.cmbSerialPortNum.Location = new Point(72, 49); |
| | | this.cmbSerialPortNum.Margin = new Padding(4, 4, 4, 4); |
| | | this.cmbSerialPortNum.Name = "cmbSerialPortNum"; |
| | | this.cmbSerialPortNum.Properties.Buttons.AddRange(new EditorButton[1] |
| | | { |
| | | new EditorButton(ButtonPredefines.Combo) |
| | | }); |
| | | this.cmbSerialPortNum.Size = new Size(133, 24); |
| | | this.cmbSerialPortNum.TabIndex = 3; |
| | | this.labelControl2.Location = new Point(16 /*0x10*/, 52); |
| | | this.labelControl2.Margin = new Padding(4, 4, 4, 4); |
| | | this.labelControl2.Name = "labelControl2"; |
| | | this.labelControl2.Size = new Size(45, 18); |
| | | this.labelControl2.TabIndex = 2; |
| | | this.labelControl2.Text = "串å£å·"; |
| | | this.cmbBaudRate.EditValue = (object)"9600"; |
| | | this.cmbBaudRate.Location = new Point(72, 11); |
| | | this.cmbBaudRate.Margin = new Padding(4, 4, 4, 4); |
| | | this.cmbBaudRate.Name = "cmbBaudRate"; |
| | | this.cmbBaudRate.Properties.Buttons.AddRange(new EditorButton[1] |
| | | { |
| | | new EditorButton(ButtonPredefines.Combo) |
| | | }); |
| | | this.cmbBaudRate.Properties.Items.AddRange(new ImageComboBoxItem[5] |
| | | { |
| | | new ImageComboBoxItem("14400", (object) "14400", -1), |
| | | new ImageComboBoxItem("9600", (object) "9600", -1), |
| | | new ImageComboBoxItem("4800", (object) "4800", -1), |
| | | new ImageComboBoxItem("2400", (object) "2400", -1), |
| | | new ImageComboBoxItem("1200", (object) "1200", -1) |
| | | }); |
| | | this.cmbBaudRate.Size = new Size(175, 24); |
| | | this.cmbBaudRate.TabIndex = 1; |
| | | this.labelControl1.Location = new Point(16 /*0x10*/, 15); |
| | | this.labelControl1.Margin = new Padding(4, 4, 4, 4); |
| | | this.labelControl1.Name = "labelControl1"; |
| | | this.labelControl1.Size = new Size(45, 18); |
| | | this.labelControl1.TabIndex = 0; |
| | | this.labelControl1.Text = "æ³¢ç¹ç"; |
| | | this.gridWOMQAB.Dock = DockStyle.Fill; |
| | | this.gridWOMQAB.EmbeddedNavigator.Margin = new Padding(4, 4, 4, 4); |
| | | this.gridWOMQAB.Location = new Point(0, 0); |
| | | this.gridWOMQAB.MainView = (BaseView)this.viewWOMQAB; |
| | | this.gridWOMQAB.Margin = new Padding(4, 4, 4, 4); |
| | | this.gridWOMQAB.Name = "gridWOMQAB"; |
| | | this.gridWOMQAB.Size = new Size(859, 246); |
| | | this.gridWOMQAB.TabIndex = 1; |
| | | this.gridWOMQAB.ViewCollection.AddRange(new BaseView[1] |
| | | { |
| | | (BaseView) this.viewWOMQAB |
| | | }); |
| | | this.viewWOMQAB.Columns.AddRange(new GridColumn[15] |
| | | { |
| | | this.colQAB001, |
| | | this.colQAB002, |
| | | this.colQAB003, |
| | | this.colQAB005, |
| | | this.colQAB006, |
| | | this.colQAB007, |
| | | this.colQAB009, |
| | | this.colQAB010, |
| | | this.colMIH004, |
| | | this.colPAA002, |
| | | this.colQAB015, |
| | | this.colQAB025, |
| | | this.colMCA022, |
| | | this.colZT, |
| | | this.colMCA023 |
| | | }); |
| | | gridFormatRule1.ApplyToRow = true; |
| | | gridFormatRule1.Column = this.colZT; |
| | | gridFormatRule1.Name = "ZTRule1"; |
| | | conditionRuleExpression1.Appearance.BackColor = System.Drawing.Color.Red; |
| | | conditionRuleExpression1.Appearance.Options.UseBackColor = true; |
| | | conditionRuleExpression1.Expression = "ZT='N'"; |
| | | gridFormatRule1.Rule = (FormatConditionRuleBase)conditionRuleExpression1; |
| | | gridFormatRule2.ApplyToRow = true; |
| | | gridFormatRule2.Column = this.colZT; |
| | | gridFormatRule2.Name = "ZTRule2"; |
| | | conditionRuleExpression2.Appearance.BackColor = System.Drawing.Color.FromArgb(128 /*0x80*/, (int)byte.MaxValue, 128 /*0x80*/); |
| | | conditionRuleExpression2.Appearance.Options.UseBackColor = true; |
| | | conditionRuleExpression2.Expression = "ZT='Y'"; |
| | | gridFormatRule2.Rule = (FormatConditionRuleBase)conditionRuleExpression2; |
| | | this.viewWOMQAB.FormatRules.Add(gridFormatRule1); |
| | | this.viewWOMQAB.FormatRules.Add(gridFormatRule2); |
| | | this.viewWOMQAB.GridControl = this.gridWOMQAB; |
| | | this.viewWOMQAB.Name = "viewWOMQAB"; |
| | | this.viewWOMQAB.OptionsView.ColumnAutoWidth = false; |
| | | this.viewWOMQAB.OptionsView.ShowGroupPanel = false; |
| | | this.colQAB001.Caption = "ID"; |
| | | this.colQAB001.FieldName = "QAB001"; |
| | | this.colQAB001.Name = "colQAB001"; |
| | | this.colQAB002.Caption = "æ¡ç "; |
| | | this.colQAB002.FieldName = "QAB002"; |
| | | this.colQAB002.MinWidth = 150; |
| | | this.colQAB002.Name = "colQAB002"; |
| | | this.colQAB002.Visible = true; |
| | | this.colQAB002.VisibleIndex = 0; |
| | | this.colQAB002.Width = 150; |
| | | this.colQAB003.Caption = "å·¥å"; |
| | | this.colQAB003.FieldName = "QAB003"; |
| | | this.colQAB003.MinWidth = 100; |
| | | this.colQAB003.Name = "colQAB003"; |
| | | this.colQAB003.Visible = true; |
| | | this.colQAB003.VisibleIndex = 1; |
| | | this.colQAB003.Width = 100; |
| | | this.colQAB005.Caption = "ç©æç¼ç "; |
| | | this.colQAB005.FieldName = "QAB005"; |
| | | this.colQAB005.MinWidth = 100; |
| | | this.colQAB005.Name = "colQAB005"; |
| | | this.colQAB005.Visible = true; |
| | | this.colQAB005.VisibleIndex = 2; |
| | | this.colQAB005.Width = 100; |
| | | this.colQAB006.Caption = "ç©æåç§°"; |
| | | this.colQAB006.FieldName = "QAB006"; |
| | | this.colQAB006.Name = "colQAB006"; |
| | | this.colQAB006.Visible = true; |
| | | this.colQAB006.VisibleIndex = 3; |
| | | this.colQAB007.Caption = "ç©æè§æ ¼"; |
| | | this.colQAB007.FieldName = "QAB007"; |
| | | this.colQAB007.MinWidth = 200; |
| | | this.colQAB007.Name = "colQAB007"; |
| | | this.colQAB007.Visible = true; |
| | | this.colQAB007.VisibleIndex = 4; |
| | | this.colQAB007.Width = 200; |
| | | this.colQAB009.Caption = "å·¥åºç¼å·"; |
| | | this.colQAB009.FieldName = "QAB009"; |
| | | this.colQAB009.Name = "colQAB009"; |
| | | this.colQAB009.Visible = true; |
| | | this.colQAB009.VisibleIndex = 5; |
| | | this.colQAB010.Caption = "å·¥åºåç§°"; |
| | | this.colQAB010.FieldName = "QAB010"; |
| | | this.colQAB010.Name = "colQAB010"; |
| | | this.colQAB010.Visible = true; |
| | | this.colQAB010.VisibleIndex = 6; |
| | | this.colMIH004.Caption = "线å«"; |
| | | this.colMIH004.FieldName = "MIH004"; |
| | | this.colMIH004.Name = "colMIH004"; |
| | | this.colMIH004.Visible = true; |
| | | this.colMIH004.VisibleIndex = 7; |
| | | this.colPAA002.Caption = "ä½ä¸äººå"; |
| | | this.colPAA002.FieldName = "PAA002"; |
| | | this.colPAA002.Name = "colPAA002"; |
| | | this.colPAA002.Visible = true; |
| | | this.colPAA002.VisibleIndex = 8; |
| | | this.colQAB015.Caption = "ä½ä¸æ¶é´"; |
| | | this.colQAB015.FieldName = "QAB015"; |
| | | this.colQAB015.MinWidth = 150; |
| | | this.colQAB015.Name = "colQAB015"; |
| | | this.colQAB015.Visible = true; |
| | | this.colQAB015.VisibleIndex = 9; |
| | | this.colQAB015.Width = 150; |
| | | this.colQAB025.Caption = "å®é
éé"; |
| | | this.colQAB025.FieldName = "QAB025"; |
| | | this.colQAB025.Name = "colQAB025"; |
| | | this.colQAB025.Visible = true; |
| | | this.colQAB025.VisibleIndex = 10; |
| | | this.colMCA022.Caption = "ééä¸é"; |
| | | this.colMCA022.FieldName = "MCA022"; |
| | | this.colMCA022.Name = "colMCA022"; |
| | | this.colMCA022.Visible = true; |
| | | this.colMCA022.VisibleIndex = 11; |
| | | this.colMCA023.Caption = "ééä¸é"; |
| | | this.colMCA023.FieldName = "MCA023"; |
| | | this.colMCA023.Name = "colMCA023"; |
| | | this.colMCA023.Visible = true; |
| | | this.colMCA023.VisibleIndex = 12; |
| | | this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; |
| | | // this.notifyIcon1.Icon = (Icon)componentResourceManager.GetObject("notifyIcon1.Icon"); |
| | | this.notifyIcon1.Text = "æç æ°é³æ°æçµåæéå
¬å¸"; |
| | | this.notifyIcon1.Visible = true; |
| | | this.contextMenuStrip1.ImageScalingSize = new Size(20, 20); |
| | | this.contextMenuStrip1.Items.AddRange(new ToolStripItem[2] |
| | | { |
| | | (ToolStripItem) this.showInTaskbar, |
| | | (ToolStripItem) this.exitWindow |
| | | }); |
| | | this.contextMenuStrip1.Name = "contextMenuStrip1"; |
| | | this.contextMenuStrip1.Size = new Size(109, 52); |
| | | this.showInTaskbar.Name = "showInTaskbar"; |
| | | this.showInTaskbar.Size = new Size(108, 24); |
| | | this.showInTaskbar.Text = "æ¾ç¤º"; |
| | | this.exitWindow.Name = "exitWindow"; |
| | | this.exitWindow.Size = new Size(108, 24); |
| | | this.exitWindow.Text = "éåº"; |
| | | this.timer1.Interval = 10000; |
| | | this.AutoScaleDimensions = new SizeF(8f, 15f); |
| | | this.AutoScaleMode = AutoScaleMode.Font; |
| | | this.ClientSize = new Size(859, 391); |
| | | this.Controls.Add((Control)this.splitContainerControl1); |
| | | this.Margin = new Padding(4, 4, 4, 4); |
| | | this.Name = nameof(WeightIqc); |
| | | this.Text = "ç§°éåæ°"; |
| | | this.FormClosing += new FormClosingEventHandler(this.Form1_FormClosing); |
| | | this.Load += new EventHandler(this.Form1_Load); |
| | | this.splitContainerControl1.EndInit(); |
| | | this.splitContainerControl1.ResumeLayout(false); |
| | | this.txtNum.Properties.EndInit(); |
| | | this.cmbSerialPortNum.Properties.EndInit(); |
| | | this.cmbBaudRate.Properties.EndInit(); |
| | | this.gridWOMQAB.EndInit(); |
| | | this.viewWOMQAB.EndInit(); |
| | | this.contextMenuStrip1.ResumeLayout(false); |
| | | this.ResumeLayout(false); |
| | | } |
| | | |
| | | public delegate void HandleInterfaceUpdataDelegate(string text); |
| | | |
| | | /// <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) |
| | | { |
| | | LoggerHelper.WriteInfoLog("WorkWeight/EditModel:" + strJson); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LoggerHelper.WriteInfoLog(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |