From 1e76977ab2014432923d0a1ea5f11dc89f2db853 Mon Sep 17 00:00:00 2001 From: xiaoguo Date: Fri, 26 May 2023 21:32:10 +0800 Subject: [PATCH] =?UTF-8?q?20230526=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PLCCommunication/PLCCommunicationFactory.cs | 2 +- ZWGXPICK_SYS.SerialPort/SerialPortUtils.cs | 19 +- ZWGXPICK_SYS.SerialPort/WeightEquipment.cs | 71 +- ZWGXPICK_SYS.SerialPort/WeightEquipment.old | 107 --- .../WeightEquipmentAggregation.cs | 186 ---- ZWGXPICK_SYS.SerialPort/WeightModel.cs | 7 - .../ZWGXPICK_SYS.SerialPort.csproj | 2 - ZWGXPICK_SYS/Point_Data_Form.Designer.cs | 70 +- ZWGXPICK_SYS/ZWGXPICK_SYS.csproj | 7 + ZWGXPICK_SYS/ZWGXPICK_SYS.ini | 9 +- ZWGXPICK_SYS/frmMain.Designer.cs | 865 +++++++++--------- ZWGXPICK_SYS/frmMain.cs | 269 +++--- ZWGXPICK_SYS/frmMain.resx | 12 - ZWGXPICK_SYS/frmWeightPort.Designer.cs | 202 ++-- ZWGXPICK_SYS/frmWeightPort.cs | 103 +-- ZWGXPICK_SYS/packages.config | 5 + 16 files changed, 814 insertions(+), 1122 deletions(-) delete mode 100644 ZWGXPICK_SYS.SerialPort/WeightEquipment.old delete mode 100644 ZWGXPICK_SYS.SerialPort/WeightEquipmentAggregation.cs create mode 100644 ZWGXPICK_SYS/packages.config diff --git a/PLCCommunication/PLCCommunicationFactory.cs b/PLCCommunication/PLCCommunicationFactory.cs index acc5590..377a43d 100644 --- a/PLCCommunication/PLCCommunicationFactory.cs +++ b/PLCCommunication/PLCCommunicationFactory.cs @@ -15,7 +15,7 @@ namespace PLCCommunication { get { - if (pLCCommunicationService == null) + if (pLCCommunicationService == null|| !pLCCommunicationService.isConnected) { pLCCommunicationService = new DeltaCommunicationService(); pLCCommunicationService.Connection("192.168.0.50",502); diff --git a/ZWGXPICK_SYS.SerialPort/SerialPortUtils.cs b/ZWGXPICK_SYS.SerialPort/SerialPortUtils.cs index 4bc4fa3..39854e0 100644 --- a/ZWGXPICK_SYS.SerialPort/SerialPortUtils.cs +++ b/ZWGXPICK_SYS.SerialPort/SerialPortUtils.cs @@ -22,11 +22,11 @@ namespace ZWGXPICK_SYS.SerialPort /// /// 串口名称 /// - public string ComName { get; private set; } + public string ComName { get; set; } /// /// 波特率 /// - public int ComBaud { get; private set; } + public int ComBaud { get; set; } /// /// 数据位 /// @@ -62,7 +62,6 @@ namespace ZWGXPICK_SYS.SerialPort public static SerialPortUtilsBuilder Builder(string comName) { - return new SerialPortUtilsBuilder(comName); } public class SerialPortUtilsBuilder @@ -132,9 +131,14 @@ namespace ZWGXPICK_SYS.SerialPort { try { - if (SerialPort == null || !SerialPort.IsOpen) + if (SerialPort == null) { SerialPort = new System.IO.Ports.SerialPort(); + //串口数据接收事件实现 + SerialPort.DataReceived += new SerialDataReceivedEventHandler(ReceiveData); + } + if (!SerialPort.IsOpen) + { SerialPort.PortName = ComName; SerialPort.BaudRate = ComBaud; SerialPort.DataBits = DataBits; @@ -142,9 +146,6 @@ namespace ZWGXPICK_SYS.SerialPort SerialPort.Parity = Parity; SerialPort.ReceivedBytesThreshold = ReceivedBytesThreshold; SerialPort.Open(); - //串口数据接收事件实现 - SerialPort.DataReceived += new SerialDataReceivedEventHandler(ReceiveData); - } return true; } @@ -179,6 +180,10 @@ namespace ZWGXPICK_SYS.SerialPort { get { + if (SerialPort == null) + { + return false; + } return SerialPort.IsOpen; } } diff --git a/ZWGXPICK_SYS.SerialPort/WeightEquipment.cs b/ZWGXPICK_SYS.SerialPort/WeightEquipment.cs index af3f5f8..0cddc5a 100644 --- a/ZWGXPICK_SYS.SerialPort/WeightEquipment.cs +++ b/ZWGXPICK_SYS.SerialPort/WeightEquipment.cs @@ -17,15 +17,15 @@ namespace ZWGXPICK_SYS.SerialPort private SerialPortUtils serialPortUtils; //发送请求 - private byte[] sendCode = new byte[] { 0xFF, 0x03, 0x00, 0x00, 0x00, 0x02, 0xD1, 0xD5 }; + // private byte[] sendCode = new byte[] { 0xFF, 0x03, 0x00, 0x00, 0x00, 0x02, 0xD1, 0xD5 }; //置零 - private byte[] restZero = new byte[] { 0xFF, 0x06, 0x00, 0x07, 0x00, 0x02, 0xAC, 0x14 }; + // private byte[] restZero = new byte[] { 0xFF, 0x06, 0x00, 0x07, 0x00, 0x02, 0xAC, 0x14 }; public event EventHandler MessageSend = null; public event EventHandler WeightSend = null; - public WeightEquipment(string comName, int comBaud, int ReceivedBytesThreshold = 9) + public WeightEquipment(string comName, int comBaud, int ReceivedBytesThreshold = 18) : base() { serialPortUtils = SerialPortUtils.Builder(comName).ComBaud(comBaud).ReceivedBytesThreshold(ReceivedBytesThreshold).Build(); serialPortUtils.SerialDataReceived += SerialPortUtils_SerialDataReceived; @@ -35,8 +35,16 @@ namespace ZWGXPICK_SYS.SerialPort /// 打开连接 /// /// - public bool Open() + public bool Open(string comName = "", int comBaud = 0) { + if (!string.IsNullOrEmpty(comName)) + { + serialPortUtils.ComName = comName; + } + if (comBaud != 0) + { + serialPortUtils.ComBaud = comBaud; + } var val = serialPortUtils.Open(); return val; } @@ -56,35 +64,42 @@ namespace ZWGXPICK_SYS.SerialPort /// 置零 /// /// - public bool Rset() - { - return serialPortUtils.SendData(restZero); - } + //public bool Rset() + //{ + // return serialPortUtils.SendData(restZero); + //} - public bool Send() - { - return serialPortUtils.SendData(sendCode); - } + //public bool Send() + //{ + // return serialPortUtils.SendData(sendCode); + //} //接收数据 private void SerialPortUtils_SerialDataReceived(object sender, byte[] e) { - if (e.Length != 9) + if (e.Length != 18) { MessageSend?.Invoke(this, new MessageEventArgs(true, $"接收数据长度不正确,长度为{e.Length}字节 ")); return; } - //是否为重量数据 - //var value = Convert.ToInt32(e[2].ToString("x2") + e[3].ToString("x2"), 16); - - var weight = Math.Round((e[3] * 16 * 16 + e[4]) / 100m, 2); - WeightSend?.Invoke(this, new WeightModel + //转换为ASCII字符串 + var str = ASCIIEncoding.ASCII.GetString(e); + var weightStr = str.Substring(9, 5); + if (!decimal.TryParse(weightStr, out var weight)) { - COMName = serialPortUtils.ComName, - Weight = weight, - Nuit = "克", - }); - + MessageSend?.Invoke(this, new MessageEventArgs(true, $"数据解析不正确,数据为:{str},重量解析为:{weightStr}")); + return; + } + if (weight > 0) + { + Math.Round(weight, 2); + WeightSend?.Invoke(this, new WeightModel + { + COMName = serialPortUtils.ComName, + Weight = weight, + Nuit = "克", + }); + } } // 消息提醒 @@ -92,15 +107,5 @@ namespace ZWGXPICK_SYS.SerialPort { MessageSend?.Invoke(this, e); } - - //触发错误消息事件 - /*private void PrintMessage(bool isError, string title, byte[] value = null) - { - string error = $"端口{serialPortUtils.ComName},波特率{serialPortUtils.ComBaud},{title}{(value != null ? ":" + BitConverter.ToString(value) : "")}"; - - MessageSend?.Invoke(this, new MessageEventArgs(isError: isError, message: error)); - - }*/ - } } diff --git a/ZWGXPICK_SYS.SerialPort/WeightEquipment.old b/ZWGXPICK_SYS.SerialPort/WeightEquipment.old deleted file mode 100644 index 53b30b8..0000000 --- a/ZWGXPICK_SYS.SerialPort/WeightEquipment.old +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Remoting.Messaging; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading.Tasks; - -namespace ZWGXPICK_SYS.SerialPort -{ - /// - /// 称重设备 - /// - public class WeightEquipment - { - private SerialPortUtils serialPortUtils; - //控制指令格式 D+(字符)+0x0D+0x0A - private byte[] controlFormat = new byte[] { Convert.ToByte('D'), 0, 0x0D, 0x0A }; - - public event EventHandler MessageSend = null; - - public event EventHandler WeightSend = null; - - public WeightEquipment(string comName, int comBaud) - { - serialPortUtils = SerialPortUtils.Builder(comName).ComBaud(comBaud).Build(); - serialPortUtils.SerialDataReceived += SerialPortUtils_SerialDataReceived; - serialPortUtils.SerialMessage += SerialPortUtils_SerialMessage; - } - /// - /// 打开连接 - /// - /// - public bool Open() - { - var val = serialPortUtils.Open(); - return val; - } - /// - /// 关闭连接 - /// - public void Close() - { - serialPortUtils.Close(); - } - /// - /// 置零 - /// - /// - public bool Rset() - { - controlFormat[1] = Convert.ToByte('Z'); - return serialPortUtils.SendData(controlFormat); - } - - //接收数据 - private void SerialPortUtils_SerialDataReceived(object sender, byte[] e) - { - if (e.Length != 20) - { - PrintMessage(true, "接收数据长度不正确", e); - } - //是否为重量数据 - //获取head1 OL--超载 ST--稳定 US--不稳定 - var head1 = new byte[2]; - Array.Copy(e, head1, 2); - //获取head2 NT--净重模式 GS--毛重模式 - var head2 = new byte[2]; - Array.Copy(e, 4, head2, 0, 2); - var head1Str = Encoding.ASCII.GetString(head1); - if (head1Str.Equals("OL") || head1Str.Equals("ST") || head1Str.Equals("US")) - { - //data - var data = new byte[8]; - Array.Copy(e, 7, data, 0, 7); - decimal.TryParse(Encoding.ASCII.GetString(data), out var weight); - //unit - var unit = new byte[4]; - Array.Copy(e, 15, unit, 0, 4); - WeightSend?.Invoke(this, new WeightModel - { - COMName = serialPortUtils.ComName, - Weight = weight, - Nuit = Encoding.ASCII.GetString(unit), - Head1 = head1Str, - Head2 = Encoding.ASCII.GetString(head2), - }); - } - PrintMessage(true, "接收数据", e); - } - - // 错误数据 - private void SerialPortUtils_SerialMessage(object sender, MessageEventArgs e) - { - MessageSend?.Invoke(this, e); - } - - //触发错误消息事件 - private void PrintMessage(bool isError, string title, byte[] value = null) - { - string error = $"端口{serialPortUtils.ComName},波特率{serialPortUtils.ComBaud},{title}{(value != null ? ":" + Encoding.ASCII.GetString(value) : "")}"; - - MessageSend?.Invoke(this, new MessageEventArgs(isError: isError, message: error)); - } - - } -} diff --git a/ZWGXPICK_SYS.SerialPort/WeightEquipmentAggregation.cs b/ZWGXPICK_SYS.SerialPort/WeightEquipmentAggregation.cs deleted file mode 100644 index 7265867..0000000 --- a/ZWGXPICK_SYS.SerialPort/WeightEquipmentAggregation.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ZWGXPICK_SYS.SerialPort -{ - /// - /// 重量设备聚合类 - /// - public class WeightEquipmentAggregation - { - private int comBaud; - private string[] comNames; - private decimal standard; - private decimal tolerance; - private decimal range; - private List weightEquipments; - private List WeightModels; - public event EventHandler MessageSend; - public event EventHandler> WeightSend; - public event EventHandler SuccessSend; - - - public void Init(int comBaud, string[] comNames, decimal standard, decimal tolerance, decimal range) - { - this.comBaud = comBaud; - this.comNames = comNames; - this.standard = standard; - this.tolerance = tolerance; - this.range = range; - int id = 0; - //如果重复初始化,就先关闭连接 - if (weightEquipments != null && weightEquipments.Count > 0) - { - Close(); - } - weightEquipments = new List(); - WeightModels = new List(); - foreach (var comName in comNames) - { - var weightEquipment = new WeightEquipment(comName, comBaud, 9); - weightEquipment.WeightSend += WeightEquipment_WeightSend; - weightEquipment.MessageSend += WeightEquipment_MessageSend; - weightEquipments.Add(weightEquipment); - - WeightModels.Add(new WeightModel - { - ID = ++id, - COMName = comName - }); - } - WeightSend?.Invoke(this, WeightModels); - } - - /// - /// 打开称重设备连接 - /// - public bool Open() - { - var result = new List(); - weightEquipments?.ForEach(item => result.Add(item.Open())); - return result.Where(f => f).Count() == weightEquipments.Count; - } - - /// - /// 称重设备置零 - /// - public bool Rest() - { - var result = new List(); - weightEquipments?.ForEach(item => result.Add(item.Rset())); - return result.Where(f => f).Count() == weightEquipments.Count; - } - - /// - /// 发送获取重量命令 - /// - /// - public bool Send() - { - var result = new List(); - weightEquipments?.ForEach(item => result.Add(item.Send())); - return result.Where(f => f).Count() == weightEquipments.Count; - } - - /// - /// 关闭称重设备 - /// - public void Close() - { - weightEquipments?.ForEach(item => item.Close()); - } - - public bool IsOpen() - { - if (weightEquipments == null || weightEquipments.Count == 0) - { - return false; - } - var result = new List(); - weightEquipments?.ForEach(item => result.Add(item.IsOpen())); - return result.Where(f => f).Count() == weightEquipments.Count; - } - - //获取错误信息 - private void WeightEquipment_MessageSend(object sender, MessageEventArgs e) - { - MessageSend?.Invoke(this, e); - saveLog(e.Message); - } - - //获取重量信息 - private void WeightEquipment_WeightSend(object sender, WeightModel e) - { - - var weight = WeightModels.Where(f => f.COMName == e.COMName).FirstOrDefault(); - if (weight != null) - { - weight.Weight = e.Weight; - weight.Nuit = e.Nuit; - //weight.Head1 = e.Head1; - //weight.Head2 = e.Head2; - } - //如果数据稳定 则进行计算 - if (WeightModels.Where(f =>!string.IsNullOrEmpty(f.Nuit)).Count() == WeightModels.Count) - { - var val = Calculation(); - //发送重量计算结果 - SuccessSend?.Invoke(this, val); - } - - WeightSend?.Invoke(this, WeightModels); - } - - //根据重量计算是否合格 - public bool Calculation() - { - var res = Calculation(WeightModels, standard, tolerance, range); - - MessageSend?.Invoke(this, new MessageEventArgs(message: "称重计算结果为:" + res)); - - return res; - } - - public bool Calculation(List WeightModels, decimal standard, decimal tolerance, decimal range) - { - if (standard > 0 && tolerance >= 0 && range >= 0) - { - //过滤小于0.5的重量数据 - var actualWeightModels = WeightModels.Where(f => f.Weight > 0.5m); - //是否均在公差范围之内 - if (actualWeightModels.Where(f => f.Weight <= standard + tolerance && f.Weight >= standard - tolerance).Count() == actualWeightModels.Count()) - { - //是否在极差范围之内 - var maxOne = actualWeightModels.Select(f => f.Weight).Max(); - var minOne = actualWeightModels.Select(f => f.Weight).Min(); - if (maxOne - minOne <= range) - { - return true; - } - } - } - return false; - } - - //记录日志 - private void saveLog(string str) - { - string logDir = Environment.CurrentDirectory + "\\Logs\\"; - if (Directory.Exists(logDir)) - { - Directory.CreateDirectory(logDir); - } - string logFile = $"{logDir}weightEquipments_{DateTime.Today.ToString("yyyy-MM-dd")}.log"; - string text = $"【{DateTime.Now.ToLongTimeString()}】{str}{Environment.NewLine}" ; - try - { - File.AppendAllText(logFile, text); - } - catch (Exception ex) { } - } - } -} diff --git a/ZWGXPICK_SYS.SerialPort/WeightModel.cs b/ZWGXPICK_SYS.SerialPort/WeightModel.cs index 15509d7..2b1f10d 100644 --- a/ZWGXPICK_SYS.SerialPort/WeightModel.cs +++ b/ZWGXPICK_SYS.SerialPort/WeightModel.cs @@ -30,14 +30,7 @@ namespace ZWGXPICK_SYS.SerialPort /// public string Nuit { get; set; } - //public string Head1 { get; set; } - - //public string Head2 { get; set; } - public string Message { get; set; } - - //public bool IsGetValue { get; set; } - } } diff --git a/ZWGXPICK_SYS.SerialPort/ZWGXPICK_SYS.SerialPort.csproj b/ZWGXPICK_SYS.SerialPort/ZWGXPICK_SYS.SerialPort.csproj index 80231db..0f66569 100644 --- a/ZWGXPICK_SYS.SerialPort/ZWGXPICK_SYS.SerialPort.csproj +++ b/ZWGXPICK_SYS.SerialPort/ZWGXPICK_SYS.SerialPort.csproj @@ -49,9 +49,7 @@ - - diff --git a/ZWGXPICK_SYS/Point_Data_Form.Designer.cs b/ZWGXPICK_SYS/Point_Data_Form.Designer.cs index 3e09bff..f3ace35 100644 --- a/ZWGXPICK_SYS/Point_Data_Form.Designer.cs +++ b/ZWGXPICK_SYS/Point_Data_Form.Designer.cs @@ -38,8 +38,8 @@ this.btnYsub = new System.Windows.Forms.Button(); this.btnYplus = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); - this.RO606 = new System.Windows.Forms.CheckBox(); - this.RO605 = new System.Windows.Forms.CheckBox(); + this.RO004 = new System.Windows.Forms.CheckBox(); + this.RO003 = new System.Windows.Forms.CheckBox(); this.btnMotoOff = new System.Windows.Forms.Button(); this.btnMotoOn = new System.Windows.Forms.Button(); this.btnSetSpeed = new System.Windows.Forms.Button(); @@ -215,8 +215,8 @@ // panel3 // this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel3.Controls.Add(this.RO606); - this.panel3.Controls.Add(this.RO605); + this.panel3.Controls.Add(this.RO004); + this.panel3.Controls.Add(this.RO003); this.panel3.Controls.Add(this.btnMotoOff); this.panel3.Controls.Add(this.btnMotoOn); this.panel3.Controls.Add(this.btnSetSpeed); @@ -225,35 +225,35 @@ this.panel3.Size = new System.Drawing.Size(199, 308); this.panel3.TabIndex = 233; // - // RO606 - // - this.RO606.Appearance = System.Windows.Forms.Appearance.Button; - this.RO606.FlatAppearance.CheckedBackColor = System.Drawing.Color.Red; - this.RO606.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.RO606.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.RO606.Location = new System.Drawing.Point(3, 228); - this.RO606.Name = "RO606"; - this.RO606.Size = new System.Drawing.Size(191, 52); - this.RO606.TabIndex = 240; - this.RO606.Text = "RO606气爪"; - this.RO606.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.RO606.UseVisualStyleBackColor = true; - this.RO606.Click += new System.EventHandler(this.RO0_Click); - // - // RO605 - // - this.RO605.Appearance = System.Windows.Forms.Appearance.Button; - this.RO605.FlatAppearance.CheckedBackColor = System.Drawing.Color.Red; - this.RO605.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.RO605.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.RO605.Location = new System.Drawing.Point(3, 171); - this.RO605.Name = "RO605"; - this.RO605.Size = new System.Drawing.Size(191, 52); - this.RO605.TabIndex = 241; - this.RO605.Text = "RO605真空"; - this.RO605.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.RO605.UseVisualStyleBackColor = true; - this.RO605.Click += new System.EventHandler(this.RO0_Click); + // RO004 + // + this.RO004.Appearance = System.Windows.Forms.Appearance.Button; + this.RO004.FlatAppearance.CheckedBackColor = System.Drawing.Color.Red; + this.RO004.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.RO004.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.RO004.Location = new System.Drawing.Point(3, 228); + this.RO004.Name = "RO004"; + this.RO004.Size = new System.Drawing.Size(191, 52); + this.RO004.TabIndex = 240; + this.RO004.Text = "RO004气爪"; + this.RO004.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.RO004.UseVisualStyleBackColor = true; + this.RO004.Click += new System.EventHandler(this.RO0_Click); + // + // RO003 + // + this.RO003.Appearance = System.Windows.Forms.Appearance.Button; + this.RO003.FlatAppearance.CheckedBackColor = System.Drawing.Color.Red; + this.RO003.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.RO003.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.RO003.Location = new System.Drawing.Point(3, 171); + this.RO003.Name = "RO003"; + this.RO003.Size = new System.Drawing.Size(191, 52); + this.RO003.TabIndex = 241; + this.RO003.Text = "RO003真空"; + this.RO003.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.RO003.UseVisualStyleBackColor = true; + this.RO003.Click += new System.EventHandler(this.RO0_Click); // // btnMotoOff // @@ -714,7 +714,7 @@ private System.Windows.Forms.Button btnUplus; private System.Windows.Forms.Button btnSetSpeed; private System.Windows.Forms.Button btnRealtimePoint; - private System.Windows.Forms.CheckBox RO606; - private System.Windows.Forms.CheckBox RO605; + private System.Windows.Forms.CheckBox RO004; + private System.Windows.Forms.CheckBox RO003; } } \ No newline at end of file diff --git a/ZWGXPICK_SYS/ZWGXPICK_SYS.csproj b/ZWGXPICK_SYS/ZWGXPICK_SYS.csproj index c70ea07..902fe51 100644 --- a/ZWGXPICK_SYS/ZWGXPICK_SYS.csproj +++ b/ZWGXPICK_SYS/ZWGXPICK_SYS.csproj @@ -37,6 +37,12 @@ ..\..\thirdparts\PCHMI.dll + + ..\packages\RICADO.MettlerToledo.1.1.0\lib\netstandard2.0\RICADO.MettlerToledo.dll + + + ..\packages\RICADO.Sockets.1.3.0\lib\netstandard2.0\RICADO.Sockets.dll + @@ -164,6 +170,7 @@ Resources.resx True + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/ZWGXPICK_SYS/ZWGXPICK_SYS.ini b/ZWGXPICK_SYS/ZWGXPICK_SYS.ini index 8836ff5..d97a5ee 100644 --- a/ZWGXPICK_SYS/ZWGXPICK_SYS.ini +++ b/ZWGXPICK_SYS/ZWGXPICK_SYS.ini @@ -59,11 +59,4 @@ txtPointU=0 [weight_RS232] baud=9600 -comEnable0=true -comEnable1=true -comEnable2=true -comEnable3=true -comName0=COM1 -comName1=COM2 -comName2=COM3 -comName3=COM4 +comName=COM1 diff --git a/ZWGXPICK_SYS/frmMain.Designer.cs b/ZWGXPICK_SYS/frmMain.Designer.cs index 2cfcdbd..e711e58 100644 --- a/ZWGXPICK_SYS/frmMain.Designer.cs +++ b/ZWGXPICK_SYS/frmMain.Designer.cs @@ -42,21 +42,26 @@ PCHMI.ST_SW_IF sT_SW_IF3 = new PCHMI.ST_SW_IF(); PCHMI.ST_SW_IF sT_SW_IF4 = new PCHMI.ST_SW_IF(); PCHMI.GLINT glint2 = new PCHMI.GLINT(); - PCHMI.InterLock interLock6 = new PCHMI.InterLock(); - PCHMI.DrawStyle drawStyle3 = new PCHMI.DrawStyle(); - PCHMI.ST_SW_IF sT_SW_IF5 = new PCHMI.ST_SW_IF(); - PCHMI.ST_SW_IF sT_SW_IF6 = new PCHMI.ST_SW_IF(); - PCHMI.GLINT glint3 = new PCHMI.GLINT(); PCHMI.InterLock interLock7 = new PCHMI.InterLock(); + PCHMI.DrawStyle drawStyle4 = new PCHMI.DrawStyle(); PCHMI.ST_SW_IF sT_SW_IF7 = new PCHMI.ST_SW_IF(); PCHMI.ST_SW_IF sT_SW_IF8 = new PCHMI.ST_SW_IF(); + PCHMI.GLINT glint4 = new PCHMI.GLINT(); PCHMI.InterLock interLock8 = new PCHMI.InterLock(); + PCHMI.ST_SW_IF sT_SW_IF9 = new PCHMI.ST_SW_IF(); + PCHMI.ST_SW_IF sT_SW_IF10 = new PCHMI.ST_SW_IF(); PCHMI.InterLock interLock9 = new PCHMI.InterLock(); PCHMI.InterLock interLock10 = new PCHMI.InterLock(); PCHMI.InterLock interLock11 = new PCHMI.InterLock(); + PCHMI.InterLock interLock12 = new PCHMI.InterLock(); PCHMI.STARTGIF startgif1 = new PCHMI.STARTGIF(); PCHMI.KEYBEEP keybeep1 = new PCHMI.KEYBEEP(); PCHMI.limits limits1 = new PCHMI.limits(); + PCHMI.InterLock interLock6 = new PCHMI.InterLock(); + PCHMI.DrawStyle drawStyle3 = new PCHMI.DrawStyle(); + PCHMI.ST_SW_IF sT_SW_IF5 = new PCHMI.ST_SW_IF(); + PCHMI.ST_SW_IF sT_SW_IF6 = new PCHMI.ST_SW_IF(); + PCHMI.GLINT glint3 = new PCHMI.GLINT(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.panel3 = new System.Windows.Forms.Panel(); this.panel6 = new System.Windows.Forms.Panel(); @@ -121,11 +126,6 @@ this.btnGetWeight = new System.Windows.Forms.Button(); this.btnWeightCalculate = new System.Windows.Forms.Button(); this.btnWeightRest = new System.Windows.Forms.Button(); - this.dgvWeight = new System.Windows.Forms.DataGridView(); - this.colID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colComName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colUnit = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.一号库位 = new PCHMI.按钮(this.components); this.气缸复位 = new PCHMI.按钮(this.components); this.报警复位 = new PCHMI.按钮(this.components); @@ -148,6 +148,8 @@ this.Timer_EnumationProduct = new System.Windows.Forms.Timer(this.components); this.Timer_PLCTick = new System.Windows.Forms.Timer(this.components); this.PLC_Communication = new PCHMI.CONFIG(); + this.label19 = new System.Windows.Forms.Label(); + this.标签4 = new PCHMI.标签(this.components); this.panel3.SuspendLayout(); this.panel6.SuspendLayout(); this.panel1.SuspendLayout(); @@ -156,7 +158,6 @@ this.panel5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.panel7.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dgvWeight)).BeginInit(); this.panel10.SuspendLayout(); this.SuspendLayout(); // @@ -164,10 +165,9 @@ // this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel3.Controls.Add(this.panel6); - this.panel3.Location = new System.Drawing.Point(1, 4); - this.panel3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel3.Location = new System.Drawing.Point(1, 3); this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(1334, 594); + this.panel3.Size = new System.Drawing.Size(1001, 476); this.panel3.TabIndex = 40; // // panel6 @@ -181,22 +181,20 @@ this.panel6.Controls.Add(this.btnPoint); this.panel6.Controls.Add(this.btnPLC); this.panel6.Controls.Add(this.btnProduct); - this.panel6.Location = new System.Drawing.Point(1164, 2); - this.panel6.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel6.Location = new System.Drawing.Point(873, 2); this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(164, 591); + this.panel6.Size = new System.Drawing.Size(123, 473); this.panel6.TabIndex = 44; // // btnlogin // this.btnlogin.Font = new System.Drawing.Font("微软雅黑", 12F); this.btnlogin.HDADDR = ""; - this.btnlogin.Location = new System.Drawing.Point(5, 458); + this.btnlogin.Location = new System.Drawing.Point(4, 366); this.btnlogin.LockValue = ((uint)(0u)); - this.btnlogin.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnlogin.Name = "btnlogin"; this.btnlogin.PLC = ((uint)(0u)); - this.btnlogin.Size = new System.Drawing.Size(156, 61); + this.btnlogin.Size = new System.Drawing.Size(117, 49); this.btnlogin.TabIndex = 40; this.btnlogin.Text = "管理员登录"; this.btnlogin.UseVisualStyleBackColor = true; @@ -242,10 +240,9 @@ // btnChangeDashParam // this.btnChangeDashParam.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnChangeDashParam.Location = new System.Drawing.Point(4, 139); - this.btnChangeDashParam.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnChangeDashParam.Location = new System.Drawing.Point(3, 111); this.btnChangeDashParam.Name = "btnChangeDashParam"; - this.btnChangeDashParam.Size = new System.Drawing.Size(156, 61); + this.btnChangeDashParam.Size = new System.Drawing.Size(117, 49); this.btnChangeDashParam.TabIndex = 15; this.btnChangeDashParam.Text = "换舟参数"; this.btnChangeDashParam.UseVisualStyleBackColor = true; @@ -254,10 +251,9 @@ // btnExit // this.btnExit.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnExit.Location = new System.Drawing.Point(5, 521); - this.btnExit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnExit.Location = new System.Drawing.Point(4, 417); this.btnExit.Name = "btnExit"; - this.btnExit.Size = new System.Drawing.Size(156, 61); + this.btnExit.Size = new System.Drawing.Size(117, 49); this.btnExit.TabIndex = 13; this.btnExit.Text = "退出程序"; this.btnExit.UseVisualStyleBackColor = true; @@ -266,10 +262,9 @@ // btnWarning // this.btnWarning.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnWarning.Location = new System.Drawing.Point(4, 394); - this.btnWarning.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnWarning.Location = new System.Drawing.Point(3, 315); this.btnWarning.Name = "btnWarning"; - this.btnWarning.Size = new System.Drawing.Size(156, 61); + this.btnWarning.Size = new System.Drawing.Size(117, 49); this.btnWarning.TabIndex = 14; this.btnWarning.Text = "报警查询"; this.btnWarning.UseVisualStyleBackColor = true; @@ -278,10 +273,9 @@ // button1 // this.button1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.button1.Location = new System.Drawing.Point(4, 266); - this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.button1.Location = new System.Drawing.Point(3, 213); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(156, 61); + this.button1.Size = new System.Drawing.Size(117, 49); this.button1.TabIndex = 12; this.button1.Text = "称重查询"; this.button1.UseVisualStyleBackColor = true; @@ -290,10 +284,9 @@ // btnAndroidIO // this.btnAndroidIO.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnAndroidIO.Location = new System.Drawing.Point(4, 330); - this.btnAndroidIO.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnAndroidIO.Location = new System.Drawing.Point(3, 264); this.btnAndroidIO.Name = "btnAndroidIO"; - this.btnAndroidIO.Size = new System.Drawing.Size(156, 61); + this.btnAndroidIO.Size = new System.Drawing.Size(117, 49); this.btnAndroidIO.TabIndex = 12; this.btnAndroidIO.Text = "机器人IO监控"; this.btnAndroidIO.UseVisualStyleBackColor = true; @@ -302,10 +295,9 @@ // btnPoint // this.btnPoint.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnPoint.Location = new System.Drawing.Point(4, 75); - this.btnPoint.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnPoint.Location = new System.Drawing.Point(3, 60); this.btnPoint.Name = "btnPoint"; - this.btnPoint.Size = new System.Drawing.Size(156, 61); + this.btnPoint.Size = new System.Drawing.Size(117, 49); this.btnPoint.TabIndex = 11; this.btnPoint.Text = "点位参数"; this.btnPoint.UseVisualStyleBackColor = true; @@ -314,10 +306,9 @@ // btnPLC // this.btnPLC.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnPLC.Location = new System.Drawing.Point(4, 202); - this.btnPLC.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnPLC.Location = new System.Drawing.Point(3, 162); this.btnPLC.Name = "btnPLC"; - this.btnPLC.Size = new System.Drawing.Size(156, 61); + this.btnPLC.Size = new System.Drawing.Size(117, 49); this.btnPLC.TabIndex = 10; this.btnPLC.Text = "PLC IO监控"; this.btnPLC.UseVisualStyleBackColor = true; @@ -326,10 +317,9 @@ // btnProduct // this.btnProduct.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnProduct.Location = new System.Drawing.Point(4, 11); - this.btnProduct.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnProduct.Location = new System.Drawing.Point(3, 9); this.btnProduct.Name = "btnProduct"; - this.btnProduct.Size = new System.Drawing.Size(156, 61); + this.btnProduct.Size = new System.Drawing.Size(117, 49); this.btnProduct.TabIndex = 9; this.btnProduct.Text = "产品参数"; this.btnProduct.UseVisualStyleBackColor = true; @@ -343,11 +333,10 @@ this.标签2.ForeColor = System.Drawing.Color.Black; this.标签2.HDADDR = "M408"; this.标签2.Image = null; - this.标签2.Location = new System.Drawing.Point(253, 9); - this.标签2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.标签2.Location = new System.Drawing.Point(190, 7); this.标签2.Name = "标签2"; this.标签2.PLC = ((uint)(0u)); - this.标签2.Size = new System.Drawing.Size(119, 32); + this.标签2.Size = new System.Drawing.Size(102, 27); this.标签2.TabIndex = 39; this.标签2.Text = " "; this.标签2.Value = ((ulong)(0ul)); @@ -473,19 +462,17 @@ this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); - this.panel1.Location = new System.Drawing.Point(685, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel1.Location = new System.Drawing.Point(514, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(470, 554); + this.panel1.Size = new System.Drawing.Size(353, 444); this.panel1.TabIndex = 43; // // btnSelectProduct // this.btnSelectProduct.Font = new System.Drawing.Font("微软雅黑", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSelectProduct.Location = new System.Drawing.Point(335, 1); - this.btnSelectProduct.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnSelectProduct.Location = new System.Drawing.Point(251, 1); this.btnSelectProduct.Name = "btnSelectProduct"; - this.btnSelectProduct.Size = new System.Drawing.Size(129, 36); + this.btnSelectProduct.Size = new System.Drawing.Size(97, 29); this.btnSelectProduct.TabIndex = 49; this.btnSelectProduct.Text = "选择产品"; this.btnSelectProduct.UseVisualStyleBackColor = true; @@ -495,12 +482,11 @@ // this.按钮6.Font = new System.Drawing.Font("微软雅黑", 12F); this.按钮6.HDADDR = ""; - this.按钮6.Location = new System.Drawing.Point(315, 511); + this.按钮6.Location = new System.Drawing.Point(236, 409); this.按钮6.LockValue = ((uint)(0u)); - this.按钮6.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.按钮6.Name = "按钮6"; this.按钮6.PLC = ((uint)(0u)); - this.按钮6.Size = new System.Drawing.Size(143, 38); + this.按钮6.Size = new System.Drawing.Size(107, 30); this.按钮6.TabIndex = 268; this.按钮6.Text = "库号+1"; this.按钮6.UseVisualStyleBackColor = true; @@ -518,7 +504,7 @@ this.按钮6.开关功能.PLC = new uint[] { ((uint)(0u))}; this.按钮6.开关功能.地址 = new string[] { - ""}; + "M409"}; this.按钮6.开关功能.开关 = new PCHMI.FTYPE.ButtonType[] { PCHMI.FTYPE.ButtonType.半秒瞬动}; this.按钮6.开关功能.扩展 = new string[] { @@ -547,11 +533,10 @@ // this.数据显示器1.Font = new System.Drawing.Font("微软雅黑", 12F); this.数据显示器1.HDADDR = "D208"; - this.数据显示器1.Location = new System.Drawing.Point(215, 512); - this.数据显示器1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.数据显示器1.Location = new System.Drawing.Point(161, 410); this.数据显示器1.Name = "数据显示器1"; this.数据显示器1.PLC = ((uint)(0u)); - this.数据显示器1.Size = new System.Drawing.Size(91, 35); + this.数据显示器1.Size = new System.Drawing.Size(69, 29); this.数据显示器1.TabIndex = 267; this.数据显示器1.Text = "0"; this.数据显示器1.Value = ((ulong)(0ul)); @@ -583,10 +568,9 @@ // this.label9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(5, 514); - this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Location = new System.Drawing.Point(4, 411); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(207, 34); + this.label9.Size = new System.Drawing.Size(155, 27); this.label9.TabIndex = 266; this.label9.Text = "当位库号:"; // @@ -594,10 +578,9 @@ // this.txt_plan_placed_num.BackColor = System.Drawing.SystemColors.InactiveBorder; this.txt_plan_placed_num.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_plan_placed_num.Location = new System.Drawing.Point(215, 474); - this.txt_plan_placed_num.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_plan_placed_num.Location = new System.Drawing.Point(161, 379); this.txt_plan_placed_num.Name = "txt_plan_placed_num"; - this.txt_plan_placed_num.Size = new System.Drawing.Size(91, 34); + this.txt_plan_placed_num.Size = new System.Drawing.Size(69, 29); this.txt_plan_placed_num.TabIndex = 265; this.txt_plan_placed_num.TextChanged += new System.EventHandler(this.txt_last_placed_times_TextChanged); // @@ -605,10 +588,9 @@ // this.txt_single_weight_allow_error.BackColor = System.Drawing.SystemColors.InactiveBorder; this.txt_single_weight_allow_error.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_single_weight_allow_error.Location = new System.Drawing.Point(213, 434); - this.txt_single_weight_allow_error.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_single_weight_allow_error.Location = new System.Drawing.Point(160, 347); this.txt_single_weight_allow_error.Name = "txt_single_weight_allow_error"; - this.txt_single_weight_allow_error.Size = new System.Drawing.Size(249, 34); + this.txt_single_weight_allow_error.Size = new System.Drawing.Size(188, 29); this.txt_single_weight_allow_error.TabIndex = 265; this.txt_single_weight_allow_error.TextChanged += new System.EventHandler(this.txt_single_weight_allow_error_TextChanged); // @@ -616,10 +598,9 @@ // this.label18.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label18.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label18.Location = new System.Drawing.Point(4, 474); - this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Location = new System.Drawing.Point(3, 379); this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(207, 34); + this.label18.Size = new System.Drawing.Size(155, 27); this.label18.TabIndex = 264; this.label18.Text = "下一摆放位置:"; // @@ -627,10 +608,9 @@ // this.label17.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label17.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label17.Location = new System.Drawing.Point(4, 434); - this.label17.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label17.Location = new System.Drawing.Point(3, 347); this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(207, 34); + this.label17.Size = new System.Drawing.Size(155, 27); this.label17.TabIndex = 264; this.label17.Text = "合格允许极差:"; // @@ -638,10 +618,9 @@ // this.txt_qualified_allow_error.BackColor = System.Drawing.SystemColors.Window; this.txt_qualified_allow_error.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_qualified_allow_error.Location = new System.Drawing.Point(213, 394); - this.txt_qualified_allow_error.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_qualified_allow_error.Location = new System.Drawing.Point(160, 315); this.txt_qualified_allow_error.Name = "txt_qualified_allow_error"; - this.txt_qualified_allow_error.Size = new System.Drawing.Size(249, 34); + this.txt_qualified_allow_error.Size = new System.Drawing.Size(188, 29); this.txt_qualified_allow_error.TabIndex = 263; this.txt_qualified_allow_error.TextChanged += new System.EventHandler(this.txt_qualified_allow_error_TextChanged); // @@ -649,20 +628,18 @@ // this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label16.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label16.Location = new System.Drawing.Point(4, 394); - this.label16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label16.Location = new System.Drawing.Point(3, 315); this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(207, 34); + this.label16.Size = new System.Drawing.Size(155, 27); this.label16.TabIndex = 262; this.label16.Text = "合格允许公差:"; // // btn_resetPlaceTimes // this.btn_resetPlaceTimes.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btn_resetPlaceTimes.Location = new System.Drawing.Point(315, 472); - this.btn_resetPlaceTimes.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btn_resetPlaceTimes.Location = new System.Drawing.Point(236, 378); this.btn_resetPlaceTimes.Name = "btn_resetPlaceTimes"; - this.btn_resetPlaceTimes.Size = new System.Drawing.Size(141, 36); + this.btn_resetPlaceTimes.Size = new System.Drawing.Size(106, 29); this.btn_resetPlaceTimes.TabIndex = 31; this.btn_resetPlaceTimes.Text = "重置"; this.btn_resetPlaceTimes.UseVisualStyleBackColor = true; @@ -672,10 +649,9 @@ // this.txt_standard_weight.BackColor = System.Drawing.SystemColors.InactiveBorder; this.txt_standard_weight.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_standard_weight.Location = new System.Drawing.Point(213, 352); - this.txt_standard_weight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_standard_weight.Location = new System.Drawing.Point(160, 282); this.txt_standard_weight.Name = "txt_standard_weight"; - this.txt_standard_weight.Size = new System.Drawing.Size(249, 34); + this.txt_standard_weight.Size = new System.Drawing.Size(188, 29); this.txt_standard_weight.TabIndex = 250; this.txt_standard_weight.TextChanged += new System.EventHandler(this.txt_standard_weight_TextChanged); // @@ -683,10 +659,9 @@ // this.label12.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label12.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label12.Location = new System.Drawing.Point(4, 352); - this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label12.Location = new System.Drawing.Point(3, 282); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(207, 34); + this.label12.Size = new System.Drawing.Size(155, 27); this.label12.TabIndex = 249; this.label12.Text = "标准重量:"; // @@ -697,10 +672,9 @@ this.cb_flush_wild.Items.AddRange(new object[] { "关闭", "开启"}); - this.cb_flush_wild.Location = new System.Drawing.Point(213, 119); - this.cb_flush_wild.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cb_flush_wild.Location = new System.Drawing.Point(160, 95); this.cb_flush_wild.Name = "cb_flush_wild"; - this.cb_flush_wild.Size = new System.Drawing.Size(249, 35); + this.cb_flush_wild.Size = new System.Drawing.Size(188, 29); this.cb_flush_wild.TabIndex = 48; this.cb_flush_wild.Text = "开启"; this.cb_flush_wild.SelectedIndexChanged += new System.EventHandler(this.cb_flush_wild_SelectedIndexChanged); @@ -709,20 +683,18 @@ // this.label14.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label14.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label14.Location = new System.Drawing.Point(4, 119); - this.label14.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label14.Location = new System.Drawing.Point(3, 95); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(207, 34); + this.label14.Size = new System.Drawing.Size(155, 27); this.label14.TabIndex = 47; this.label14.Text = "吹气"; // // txt_continuity_unqualified // this.txt_continuity_unqualified.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_continuity_unqualified.Location = new System.Drawing.Point(213, 312); - this.txt_continuity_unqualified.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_continuity_unqualified.Location = new System.Drawing.Point(160, 250); this.txt_continuity_unqualified.Name = "txt_continuity_unqualified"; - this.txt_continuity_unqualified.Size = new System.Drawing.Size(249, 34); + this.txt_continuity_unqualified.Size = new System.Drawing.Size(188, 29); this.txt_continuity_unqualified.TabIndex = 46; this.txt_continuity_unqualified.TextChanged += new System.EventHandler(this.txt_continuity_unqualified_TextChanged); this.txt_continuity_unqualified.Leave += new System.EventHandler(this.txt_continuity_unqualified_Leave); @@ -731,10 +703,9 @@ // this.label13.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label13.Location = new System.Drawing.Point(4, 312); - this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label13.Location = new System.Drawing.Point(3, 250); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(207, 34); + this.label13.Size = new System.Drawing.Size(155, 27); this.label13.TabIndex = 45; this.label13.Text = "称重连续不合格:"; // @@ -742,30 +713,27 @@ // this.txt_product_name.BackColor = System.Drawing.Color.White; this.txt_product_name.Font = new System.Drawing.Font("微软雅黑", 10F); - this.txt_product_name.Location = new System.Drawing.Point(128, 2); - this.txt_product_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_product_name.Location = new System.Drawing.Point(96, 2); this.txt_product_name.Name = "txt_product_name"; - this.txt_product_name.Size = new System.Drawing.Size(204, 29); + this.txt_product_name.Size = new System.Drawing.Size(154, 25); this.txt_product_name.TabIndex = 44; // // label8 // this.label8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label8.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label8.Location = new System.Drawing.Point(4, 2); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label8.Location = new System.Drawing.Point(3, 2); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(116, 34); + this.label8.Size = new System.Drawing.Size(87, 27); this.label8.TabIndex = 43; this.label8.Text = "产品型号: "; // // txt_cleanmode_interval // this.txt_cleanmode_interval.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_cleanmode_interval.Location = new System.Drawing.Point(213, 274); - this.txt_cleanmode_interval.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_cleanmode_interval.Location = new System.Drawing.Point(160, 219); this.txt_cleanmode_interval.Name = "txt_cleanmode_interval"; - this.txt_cleanmode_interval.Size = new System.Drawing.Size(249, 34); + this.txt_cleanmode_interval.Size = new System.Drawing.Size(188, 29); this.txt_cleanmode_interval.TabIndex = 42; this.txt_cleanmode_interval.TextChanged += new System.EventHandler(this.txt_cleanmode_interval_TextChanged); this.txt_cleanmode_interval.Leave += new System.EventHandler(this.txt_cleanmode_interval_Leave); @@ -773,10 +741,9 @@ // txt_weight_interval // this.txt_weight_interval.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_weight_interval.Location = new System.Drawing.Point(213, 235); - this.txt_weight_interval.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_weight_interval.Location = new System.Drawing.Point(160, 188); this.txt_weight_interval.Name = "txt_weight_interval"; - this.txt_weight_interval.Size = new System.Drawing.Size(249, 34); + this.txt_weight_interval.Size = new System.Drawing.Size(188, 29); this.txt_weight_interval.TabIndex = 41; this.txt_weight_interval.TextChanged += new System.EventHandler(this.txt_weight_interval_TextChanged); this.txt_weight_interval.Leave += new System.EventHandler(this.txt_weight_interval_Leave); @@ -788,10 +755,9 @@ this.cb_get_tool.Items.AddRange(new object[] { "真空", "气爪"}); - this.cb_get_tool.Location = new System.Drawing.Point(213, 196); - this.cb_get_tool.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cb_get_tool.Location = new System.Drawing.Point(160, 157); this.cb_get_tool.Name = "cb_get_tool"; - this.cb_get_tool.Size = new System.Drawing.Size(249, 35); + this.cb_get_tool.Size = new System.Drawing.Size(188, 29); this.cb_get_tool.TabIndex = 40; this.cb_get_tool.Text = "真空"; this.cb_get_tool.SelectedIndexChanged += new System.EventHandler(this.cb_get_tool_SelectedIndexChanged); @@ -801,12 +767,14 @@ this.cb_get_mode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cb_get_mode.FormattingEnabled = true; this.cb_get_mode.Items.AddRange(new object[] { - "顶取", - "侧取"}); - this.cb_get_mode.Location = new System.Drawing.Point(213, 158); - this.cb_get_mode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + "顶吸", + "侧吸时旋转", + "侧吸时不转", + "夹取时旋转", + "夹取时不转"}); + this.cb_get_mode.Location = new System.Drawing.Point(160, 126); this.cb_get_mode.Name = "cb_get_mode"; - this.cb_get_mode.Size = new System.Drawing.Size(249, 35); + this.cb_get_mode.Size = new System.Drawing.Size(188, 29); this.cb_get_mode.TabIndex = 39; this.cb_get_mode.Text = "顶取"; this.cb_get_mode.SelectedIndexChanged += new System.EventHandler(this.cb_get_mode_SelectedIndexChanged); @@ -818,10 +786,9 @@ this.cb_clear_burr.Items.AddRange(new object[] { "关闭", "开启"}); - this.cb_clear_burr.Location = new System.Drawing.Point(213, 80); - this.cb_clear_burr.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cb_clear_burr.Location = new System.Drawing.Point(160, 64); this.cb_clear_burr.Name = "cb_clear_burr"; - this.cb_clear_burr.Size = new System.Drawing.Size(249, 35); + this.cb_clear_burr.Size = new System.Drawing.Size(188, 29); this.cb_clear_burr.TabIndex = 38; this.cb_clear_burr.Text = "开启"; this.cb_clear_burr.SelectedIndexChanged += new System.EventHandler(this.cb_clear_burr_SelectedIndexChanged); @@ -833,10 +800,9 @@ this.cb_weight_mode.Items.AddRange(new object[] { "不称", "抽检"}); - this.cb_weight_mode.Location = new System.Drawing.Point(213, 41); - this.cb_weight_mode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cb_weight_mode.Location = new System.Drawing.Point(160, 33); this.cb_weight_mode.Name = "cb_weight_mode"; - this.cb_weight_mode.Size = new System.Drawing.Size(249, 35); + this.cb_weight_mode.Size = new System.Drawing.Size(188, 29); this.cb_weight_mode.TabIndex = 37; this.cb_weight_mode.Text = "不称"; this.cb_weight_mode.SelectedIndexChanged += new System.EventHandler(this.cb_weight_mode_SelectedIndexChanged); @@ -845,10 +811,9 @@ // this.label6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label6.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label6.Location = new System.Drawing.Point(4, 196); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label6.Location = new System.Drawing.Point(3, 157); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(207, 34); + this.label6.Size = new System.Drawing.Size(155, 27); this.label6.TabIndex = 36; this.label6.Text = "取件工具"; // @@ -856,10 +821,9 @@ // this.label5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label5.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label5.Location = new System.Drawing.Point(4, 158); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Location = new System.Drawing.Point(3, 126); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(207, 34); + this.label5.Size = new System.Drawing.Size(155, 27); this.label5.TabIndex = 35; this.label5.Text = "取件方式"; // @@ -867,10 +831,9 @@ // this.label4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label4.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label4.Location = new System.Drawing.Point(4, 80); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Location = new System.Drawing.Point(3, 64); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(207, 34); + this.label4.Size = new System.Drawing.Size(155, 27); this.label4.TabIndex = 34; this.label4.Text = "去毛刺"; // @@ -878,10 +841,9 @@ // this.label3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label3.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label3.Location = new System.Drawing.Point(4, 274); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(3, 219); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(207, 34); + this.label3.Size = new System.Drawing.Size(155, 27); this.label3.TabIndex = 33; this.label3.Text = "清模频率"; // @@ -889,10 +851,9 @@ // this.label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label2.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label2.Location = new System.Drawing.Point(4, 41); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(3, 33); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(207, 34); + this.label2.Size = new System.Drawing.Size(155, 27); this.label2.TabIndex = 32; this.label2.Text = "称重模式"; // @@ -900,10 +861,9 @@ // this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label1.Font = new System.Drawing.Font("微软雅黑", 12F); - this.label1.Location = new System.Drawing.Point(4, 235); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(3, 188); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(207, 34); + this.label1.Size = new System.Drawing.Size(155, 27); this.label1.TabIndex = 31; this.label1.Text = "称重频率"; // @@ -917,10 +877,9 @@ this.panel4.Controls.Add(this.picMatirxMain); this.panel4.Controls.Add(this.txt_run_speed); this.panel4.Controls.Add(this.label7); - this.panel4.Location = new System.Drawing.Point(3, 4); - this.panel4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel4.Location = new System.Drawing.Point(2, 3); this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(1156, 595); + this.panel4.Size = new System.Drawing.Size(867, 476); this.panel4.TabIndex = 41; // // 标签3 @@ -931,11 +890,10 @@ this.标签3.ForeColor = System.Drawing.Color.Black; this.标签3.HDADDR = "M410"; this.标签3.Image = null; - this.标签3.Location = new System.Drawing.Point(95, 9); - this.标签3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.标签3.Location = new System.Drawing.Point(71, 7); this.标签3.Name = "标签3"; this.标签3.PLC = ((uint)(0u)); - this.标签3.Size = new System.Drawing.Size(139, 32); + this.标签3.Size = new System.Drawing.Size(112, 27); this.标签3.TabIndex = 41; this.标签3.Text = "摆舟未就绪"; this.标签3.Value = ((ulong)(0ul)); @@ -1032,10 +990,9 @@ this.报警窗口1.AutoScroll = true; this.报警窗口1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.报警窗口1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); - this.报警窗口1.Location = new System.Drawing.Point(21, 214); - this.报警窗口1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.报警窗口1.Location = new System.Drawing.Point(16, 171); this.报警窗口1.Name = "报警窗口1"; - this.报警窗口1.Size = new System.Drawing.Size(636, 134); + this.报警窗口1.Size = new System.Drawing.Size(477, 107); this.报警窗口1.TabIndex = 44; this.报警窗口1.允许拖动 = true; this.报警窗口1.关闭隐藏 = false; @@ -1051,20 +1008,18 @@ // this.lbl_android_startpos.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lbl_android_startpos.ForeColor = System.Drawing.Color.Black; - this.lbl_android_startpos.Location = new System.Drawing.Point(1099, 9); - this.lbl_android_startpos.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbl_android_startpos.Location = new System.Drawing.Point(824, 7); this.lbl_android_startpos.Name = "lbl_android_startpos"; - this.lbl_android_startpos.Size = new System.Drawing.Size(91, 24); + this.lbl_android_startpos.Size = new System.Drawing.Size(68, 19); this.lbl_android_startpos.TabIndex = 31; // // picMatirxMain // this.picMatirxMain.BackColor = System.Drawing.Color.White; this.picMatirxMain.Image = global::ZWGXPICK_SYS.Properties.Resources.zhuobiao; - this.picMatirxMain.Location = new System.Drawing.Point(4, 4); - this.picMatirxMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.picMatirxMain.Location = new System.Drawing.Point(3, 3); this.picMatirxMain.Name = "picMatirxMain"; - this.picMatirxMain.Size = new System.Drawing.Size(680, 589); + this.picMatirxMain.Size = new System.Drawing.Size(510, 471); this.picMatirxMain.TabIndex = 29; this.picMatirxMain.TabStop = false; this.picMatirxMain.Paint += new System.Windows.Forms.PaintEventHandler(this.picMatirxMain_Paint); @@ -1073,10 +1028,9 @@ // this.txt_run_speed.BackColor = System.Drawing.SystemColors.InactiveBorder; this.txt_run_speed.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txt_run_speed.Location = new System.Drawing.Point(901, 555); - this.txt_run_speed.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txt_run_speed.Location = new System.Drawing.Point(676, 444); this.txt_run_speed.Name = "txt_run_speed"; - this.txt_run_speed.Size = new System.Drawing.Size(249, 34); + this.txt_run_speed.Size = new System.Drawing.Size(188, 29); this.txt_run_speed.TabIndex = 265; this.txt_run_speed.Text = "1"; this.txt_run_speed.Leave += new System.EventHandler(this.txt_run_speed_Leave); @@ -1085,45 +1039,43 @@ // this.label7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label7.Location = new System.Drawing.Point(692, 555); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label7.Location = new System.Drawing.Point(519, 444); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(207, 34); + this.label7.Size = new System.Drawing.Size(155, 27); this.label7.TabIndex = 264; this.label7.Text = "运行速度:"; // // panel5 // this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel5.Controls.Add(this.label19); + this.panel5.Controls.Add(this.标签4); this.panel5.Controls.Add(this.lblAndroidStatus); this.panel5.Controls.Add(this.lblAndroidErrorCode); this.panel5.Controls.Add(this.label15); this.panel5.Controls.Add(this.label11); this.panel5.Controls.Add(this.label10); this.panel5.Controls.Add(this.标签1); - this.panel5.Location = new System.Drawing.Point(4, 161); - this.panel5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel5.Location = new System.Drawing.Point(3, 129); this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(681, 33); + this.panel5.Size = new System.Drawing.Size(511, 27); this.panel5.TabIndex = 44; // // lblAndroidStatus // this.lblAndroidStatus.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblAndroidStatus.Location = new System.Drawing.Point(291, 4); - this.lblAndroidStatus.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblAndroidStatus.Location = new System.Drawing.Point(311, 3); this.lblAndroidStatus.Name = "lblAndroidStatus"; - this.lblAndroidStatus.Size = new System.Drawing.Size(211, 26); + this.lblAndroidStatus.Size = new System.Drawing.Size(101, 21); this.lblAndroidStatus.TabIndex = 38; // // lblAndroidErrorCode // this.lblAndroidErrorCode.AutoSize = true; this.lblAndroidErrorCode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblAndroidErrorCode.Location = new System.Drawing.Point(605, 4); - this.lblAndroidErrorCode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblAndroidErrorCode.Location = new System.Drawing.Point(465, 3); this.lblAndroidErrorCode.Name = "lblAndroidErrorCode"; - this.lblAndroidErrorCode.Size = new System.Drawing.Size(60, 27); + this.lblAndroidErrorCode.Size = new System.Drawing.Size(46, 21); this.lblAndroidErrorCode.TabIndex = 38; this.lblAndroidErrorCode.Text = "0000"; // @@ -1131,10 +1083,9 @@ // this.label15.AutoSize = true; this.label15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label15.Location = new System.Drawing.Point(527, 4); - this.label15.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label15.Location = new System.Drawing.Point(409, 3); this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(77, 27); + this.label15.Size = new System.Drawing.Size(62, 21); this.label15.TabIndex = 38; this.label15.Text = "错误码:"; // @@ -1142,10 +1093,9 @@ // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label11.Location = new System.Drawing.Point(164, 4); - this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label11.Location = new System.Drawing.Point(220, 3); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(117, 27); + this.label11.Size = new System.Drawing.Size(94, 21); this.label11.TabIndex = 38; this.label11.Text = "机器人状态:"; // @@ -1153,10 +1103,9 @@ // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label10.Location = new System.Drawing.Point(9, 4); - this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label10.Location = new System.Drawing.Point(-3, 3); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(92, 27); + this.label10.Size = new System.Drawing.Size(75, 21); this.label10.TabIndex = 37; this.label10.Text = "PLC状态:"; // @@ -1168,34 +1117,33 @@ this.标签1.ForeColor = System.Drawing.Color.Black; this.标签1.HDADDR = "M0"; this.标签1.Image = null; - this.标签1.Location = new System.Drawing.Point(117, 4); - this.标签1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.标签1.Location = new System.Drawing.Point(64, 3); this.标签1.Name = "标签1"; this.标签1.PLC = ((uint)(0u)); - this.标签1.Size = new System.Drawing.Size(36, 27); + this.标签1.Size = new System.Drawing.Size(30, 21); this.标签1.TabIndex = 36; this.标签1.Text = " "; this.标签1.Value = ((ulong)(0ul)); - interLock6.HDADDR = ""; - interLock6.PLC = ((uint)(0u)); - interLock6.互锁启用值 = ((uint)(1u)); - interLock6.互锁地址 = ""; - interLock6.互锁显示图标 = null; - interLock6.互锁显示文本 = "LOCK"; - interLock6.互锁类型 = PCHMI.InterLock.DatType.BIT; - this.标签1.互锁 = interLock6; + interLock7.HDADDR = ""; + interLock7.PLC = ((uint)(0u)); + interLock7.互锁启用值 = ((uint)(1u)); + interLock7.互锁地址 = ""; + interLock7.互锁显示图标 = null; + interLock7.互锁显示文本 = "LOCK"; + interLock7.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.标签1.互锁 = interLock7; this.标签1.值限制 = false; this.标签1.允许输入 = false; this.标签1.前缀 = ""; this.标签1.功能 = PCHMI.标签.TypeEnum.指示; this.标签1.后缀 = ""; this.标签1.图片显示偏移量 = new System.Drawing.Point(0, 0); - drawStyle3.圆角半径 = 15; - drawStyle3.填充颜色 = System.Drawing.Color.Empty; - drawStyle3.按下颜色 = System.Drawing.Color.Empty; - drawStyle3.样式 = PCHMI.DrawStyle.STYPE.常规; - drawStyle3.边框颜色 = System.Drawing.Color.LightGray; - this.标签1.外观样式 = drawStyle3; + drawStyle4.圆角半径 = 15; + drawStyle4.填充颜色 = System.Drawing.Color.Empty; + drawStyle4.按下颜色 = System.Drawing.Color.Empty; + drawStyle4.样式 = PCHMI.DrawStyle.STYPE.常规; + drawStyle4.边框颜色 = System.Drawing.Color.LightGray; + this.标签1.外观样式 = drawStyle4; this.标签1.字符串长度 = ((uint)(10u)); this.标签1.安全级别 = ((uint)(0u)); this.标签1.小数位数 = ((uint)(0u)); @@ -1219,49 +1167,49 @@ this.标签1.日期时间格式化 = "yyyy-MM-dd"; this.标签1.显示内容.BkImg = null; this.标签1.显示内容.状态切换条件 = PCHMI.Employee.STSW.按序号值切换状态; - sT_SW_IF5.BkColor = System.Drawing.Color.Red; - sT_SW_IF5.Img = null; - sT_SW_IF5.MaxVal = ((ulong)(0ul)); - sT_SW_IF5.MinVal = ((ulong)(0ul)); - sT_SW_IF5.Txt0 = " "; - sT_SW_IF5.Txt1 = ""; - sT_SW_IF5.Txt2 = ""; - sT_SW_IF5.Txt3 = ""; - sT_SW_IF5.Txt4 = ""; - sT_SW_IF5.Txt5 = ""; - sT_SW_IF5.Txt6 = ""; - sT_SW_IF5.Txt7 = ""; - sT_SW_IF5.TxtColor = System.Drawing.Color.Black; - sT_SW_IF5.TxtNumber = ""; - sT_SW_IF6.BkColor = System.Drawing.Color.Lime; - sT_SW_IF6.Img = null; - sT_SW_IF6.MaxVal = ((ulong)(0ul)); - sT_SW_IF6.MinVal = ((ulong)(0ul)); - sT_SW_IF6.Txt0 = " "; - sT_SW_IF6.Txt1 = ""; - sT_SW_IF6.Txt2 = ""; - sT_SW_IF6.Txt3 = ""; - sT_SW_IF6.Txt4 = ""; - sT_SW_IF6.Txt5 = ""; - sT_SW_IF6.Txt6 = ""; - sT_SW_IF6.Txt7 = ""; - sT_SW_IF6.TxtColor = System.Drawing.Color.Black; - sT_SW_IF6.TxtNumber = ""; + sT_SW_IF7.BkColor = System.Drawing.Color.Red; + sT_SW_IF7.Img = null; + sT_SW_IF7.MaxVal = ((ulong)(0ul)); + sT_SW_IF7.MinVal = ((ulong)(0ul)); + sT_SW_IF7.Txt0 = " "; + sT_SW_IF7.Txt1 = ""; + sT_SW_IF7.Txt2 = ""; + sT_SW_IF7.Txt3 = ""; + sT_SW_IF7.Txt4 = ""; + sT_SW_IF7.Txt5 = ""; + sT_SW_IF7.Txt6 = ""; + sT_SW_IF7.Txt7 = ""; + sT_SW_IF7.TxtColor = System.Drawing.Color.Black; + sT_SW_IF7.TxtNumber = ""; + sT_SW_IF8.BkColor = System.Drawing.Color.Lime; + sT_SW_IF8.Img = null; + sT_SW_IF8.MaxVal = ((ulong)(0ul)); + sT_SW_IF8.MinVal = ((ulong)(0ul)); + sT_SW_IF8.Txt0 = " "; + sT_SW_IF8.Txt1 = ""; + sT_SW_IF8.Txt2 = ""; + sT_SW_IF8.Txt3 = ""; + sT_SW_IF8.Txt4 = ""; + sT_SW_IF8.Txt5 = ""; + sT_SW_IF8.Txt6 = ""; + sT_SW_IF8.Txt7 = ""; + sT_SW_IF8.TxtColor = System.Drawing.Color.Black; + sT_SW_IF8.TxtNumber = ""; this.标签1.显示内容.状态文本 = new PCHMI.ST_SW_IF[] { - sT_SW_IF5, - sT_SW_IF6}; + sT_SW_IF7, + sT_SW_IF8}; this.标签1.显示内容.默认状态文本ID = ((uint)(0u)); this.标签1.最大值 = "100"; this.标签1.最小值 = "0"; this.标签1.权限提示文本 = ""; this.标签1.空字符显示 = "null"; this.标签1.语言 = ((uint)(0u)); - glint3.HDADDR = ""; - glint3.PLC = ((uint)(0u)); - glint3.位地址 = ""; - glint3.字体颜色 = System.Drawing.Color.Red; - glint3.间隔时间 = ((ushort)(1000)); - this.标签1.闪烁 = glint3; + glint4.HDADDR = ""; + glint4.PLC = ((uint)(0u)); + glint4.位地址 = ""; + glint4.字体颜色 = System.Drawing.Color.Red; + glint4.间隔时间 = ((ushort)(1000)); + this.标签1.闪烁 = glint4; this.标签1.默认字体颜色 = System.Drawing.Color.Black; // // dataGridView1 @@ -1270,14 +1218,13 @@ this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Location = new System.Drawing.Point(979, 5); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dataGridView1.Location = new System.Drawing.Point(522, 4); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersWidth = 51; this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridView1.Size = new System.Drawing.Size(353, 189); + this.dataGridView1.Size = new System.Drawing.Size(477, 151); this.dataGridView1.TabIndex = 32; // // panel7 @@ -1286,7 +1233,6 @@ this.panel7.Controls.Add(this.btnGetWeight); this.panel7.Controls.Add(this.btnWeightCalculate); this.panel7.Controls.Add(this.btnWeightRest); - this.panel7.Controls.Add(this.dgvWeight); this.panel7.Controls.Add(this.一号库位); this.panel7.Controls.Add(this.气缸复位); this.panel7.Controls.Add(this.报警复位); @@ -1301,19 +1247,17 @@ this.panel7.Controls.Add(this.btnStartProduct); this.panel7.Controls.Add(this.btnCloseAndroid); this.panel7.Controls.Add(this.btnOpenAndroid); - this.panel7.Location = new System.Drawing.Point(1, 600); - this.panel7.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel7.Location = new System.Drawing.Point(1, 480); this.panel7.Name = "panel7"; - this.panel7.Size = new System.Drawing.Size(1346, 206); + this.panel7.Size = new System.Drawing.Size(1010, 165); this.panel7.TabIndex = 42; // // btnGetWeight // this.btnGetWeight.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnGetWeight.Location = new System.Drawing.Point(555, 58); - this.btnGetWeight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnGetWeight.Location = new System.Drawing.Point(416, 46); this.btnGetWeight.Name = "btnGetWeight"; - this.btnGetWeight.Size = new System.Drawing.Size(133, 45); + this.btnGetWeight.Size = new System.Drawing.Size(100, 36); this.btnGetWeight.TabIndex = 53; this.btnGetWeight.Text = "获取重量"; this.btnGetWeight.UseVisualStyleBackColor = true; @@ -1322,10 +1266,9 @@ // btnWeightCalculate // this.btnWeightCalculate.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnWeightCalculate.Location = new System.Drawing.Point(555, 110); - this.btnWeightCalculate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnWeightCalculate.Location = new System.Drawing.Point(416, 88); this.btnWeightCalculate.Name = "btnWeightCalculate"; - this.btnWeightCalculate.Size = new System.Drawing.Size(133, 45); + this.btnWeightCalculate.Size = new System.Drawing.Size(100, 36); this.btnWeightCalculate.TabIndex = 52; this.btnWeightCalculate.Text = "称重计算"; this.btnWeightCalculate.UseVisualStyleBackColor = true; @@ -1334,95 +1277,36 @@ // btnWeightRest // this.btnWeightRest.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnWeightRest.Location = new System.Drawing.Point(555, 5); - this.btnWeightRest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnWeightRest.Location = new System.Drawing.Point(416, 4); this.btnWeightRest.Name = "btnWeightRest"; - this.btnWeightRest.Size = new System.Drawing.Size(133, 45); + this.btnWeightRest.Size = new System.Drawing.Size(100, 36); this.btnWeightRest.TabIndex = 51; this.btnWeightRest.Text = "称重置零"; this.btnWeightRest.UseVisualStyleBackColor = true; this.btnWeightRest.Click += new System.EventHandler(this.btnWeightRest_Click); // - // dgvWeight - // - this.dgvWeight.AllowUserToAddRows = false; - this.dgvWeight.AllowUserToDeleteRows = false; - this.dgvWeight.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; - this.dgvWeight.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvWeight.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.colID, - this.colComName, - this.colWeight, - this.colUnit}); - this.dgvWeight.Location = new System.Drawing.Point(704, 5); - this.dgvWeight.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.dgvWeight.Name = "dgvWeight"; - this.dgvWeight.ReadOnly = true; - this.dgvWeight.RowHeadersWidth = 51; - this.dgvWeight.RowTemplate.Height = 23; - this.dgvWeight.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvWeight.Size = new System.Drawing.Size(267, 189); - this.dgvWeight.TabIndex = 50; - // - // colID - // - this.colID.DataPropertyName = "ID"; - this.colID.HeaderText = "设备编号"; - this.colID.MinimumWidth = 6; - this.colID.Name = "colID"; - this.colID.ReadOnly = true; - this.colID.Width = 96; - // - // colComName - // - this.colComName.DataPropertyName = "ComName"; - this.colComName.HeaderText = "设备名称"; - this.colComName.MinimumWidth = 6; - this.colComName.Name = "colComName"; - this.colComName.ReadOnly = true; - this.colComName.Width = 96; - // - // colWeight - // - this.colWeight.DataPropertyName = "Weight"; - this.colWeight.HeaderText = "重量"; - this.colWeight.MinimumWidth = 6; - this.colWeight.Name = "colWeight"; - this.colWeight.ReadOnly = true; - this.colWeight.Width = 66; - // - // colUnit - // - this.colUnit.DataPropertyName = "Nuit"; - this.colUnit.HeaderText = "单位"; - this.colUnit.MinimumWidth = 6; - this.colUnit.Name = "colUnit"; - this.colUnit.ReadOnly = true; - this.colUnit.Width = 66; - // // 一号库位 // this.一号库位.BackColor = System.Drawing.Color.White; this.一号库位.Font = new System.Drawing.Font("微软雅黑", 12F); this.一号库位.HDADDR = "M406"; - this.一号库位.Location = new System.Drawing.Point(139, 110); + this.一号库位.Location = new System.Drawing.Point(104, 88); this.一号库位.LockValue = ((uint)(0u)); - this.一号库位.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.一号库位.Name = "一号库位"; this.一号库位.PLC = ((uint)(0u)); - this.一号库位.Size = new System.Drawing.Size(133, 45); + this.一号库位.Size = new System.Drawing.Size(100, 36); this.一号库位.TabIndex = 49; this.一号库位.Text = "一号库位"; this.一号库位.UseVisualStyleBackColor = false; this.一号库位.Value = ((ulong)(0ul)); - interLock7.HDADDR = ""; - interLock7.PLC = ((uint)(0u)); - interLock7.互锁启用值 = ((uint)(1u)); - interLock7.互锁地址 = ""; - interLock7.互锁显示图标 = null; - interLock7.互锁显示文本 = "LOCK"; - interLock7.互锁类型 = PCHMI.InterLock.DatType.BIT; - this.一号库位.互锁 = interLock7; + interLock8.HDADDR = ""; + interLock8.PLC = ((uint)(0u)); + interLock8.互锁启用值 = ((uint)(1u)); + interLock8.互锁地址 = ""; + interLock8.互锁显示图标 = null; + interLock8.互锁显示文本 = "LOCK"; + interLock8.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.一号库位.互锁 = interLock8; this.一号库位.单击事件参数 = "NULL"; this.一号库位.安全级别 = ((uint)(0u)); this.一号库位.开关功能.PLC = new uint[] { @@ -1448,37 +1332,37 @@ this.一号库位.数值改变事件参数 = "NULL"; this.一号库位.显示内容.BkImg = null; this.一号库位.显示内容.状态切换条件 = PCHMI.Employee.STSW.按序号值切换状态; - sT_SW_IF7.BkColor = System.Drawing.Color.White; - sT_SW_IF7.Img = null; - sT_SW_IF7.MaxVal = ((ulong)(0ul)); - sT_SW_IF7.MinVal = ((ulong)(0ul)); - sT_SW_IF7.Txt0 = "1#库位"; - sT_SW_IF7.Txt1 = ""; - sT_SW_IF7.Txt2 = ""; - sT_SW_IF7.Txt3 = ""; - sT_SW_IF7.Txt4 = ""; - sT_SW_IF7.Txt5 = ""; - sT_SW_IF7.Txt6 = ""; - sT_SW_IF7.Txt7 = ""; - sT_SW_IF7.TxtColor = System.Drawing.Color.Black; - sT_SW_IF7.TxtNumber = ""; - sT_SW_IF8.BkColor = System.Drawing.Color.Red; - sT_SW_IF8.Img = null; - sT_SW_IF8.MaxVal = ((ulong)(0ul)); - sT_SW_IF8.MinVal = ((ulong)(0ul)); - sT_SW_IF8.Txt0 = "1#库位"; - sT_SW_IF8.Txt1 = ""; - sT_SW_IF8.Txt2 = ""; - sT_SW_IF8.Txt3 = ""; - sT_SW_IF8.Txt4 = ""; - sT_SW_IF8.Txt5 = ""; - sT_SW_IF8.Txt6 = ""; - sT_SW_IF8.Txt7 = ""; - sT_SW_IF8.TxtColor = System.Drawing.Color.Black; - sT_SW_IF8.TxtNumber = ""; + sT_SW_IF9.BkColor = System.Drawing.Color.White; + sT_SW_IF9.Img = null; + sT_SW_IF9.MaxVal = ((ulong)(0ul)); + sT_SW_IF9.MinVal = ((ulong)(0ul)); + sT_SW_IF9.Txt0 = "1#库位"; + sT_SW_IF9.Txt1 = ""; + sT_SW_IF9.Txt2 = ""; + sT_SW_IF9.Txt3 = ""; + sT_SW_IF9.Txt4 = ""; + sT_SW_IF9.Txt5 = ""; + sT_SW_IF9.Txt6 = ""; + sT_SW_IF9.Txt7 = ""; + sT_SW_IF9.TxtColor = System.Drawing.Color.Black; + sT_SW_IF9.TxtNumber = ""; + sT_SW_IF10.BkColor = System.Drawing.Color.Red; + sT_SW_IF10.Img = null; + sT_SW_IF10.MaxVal = ((ulong)(0ul)); + sT_SW_IF10.MinVal = ((ulong)(0ul)); + sT_SW_IF10.Txt0 = "1#库位"; + sT_SW_IF10.Txt1 = ""; + sT_SW_IF10.Txt2 = ""; + sT_SW_IF10.Txt3 = ""; + sT_SW_IF10.Txt4 = ""; + sT_SW_IF10.Txt5 = ""; + sT_SW_IF10.Txt6 = ""; + sT_SW_IF10.Txt7 = ""; + sT_SW_IF10.TxtColor = System.Drawing.Color.Black; + sT_SW_IF10.TxtNumber = ""; this.一号库位.显示内容.状态文本 = new PCHMI.ST_SW_IF[] { - sT_SW_IF7, - sT_SW_IF8}; + sT_SW_IF9, + sT_SW_IF10}; this.一号库位.显示内容.默认状态文本ID = ((uint)(0u)); this.一号库位.权限提示文本 = ""; this.一号库位.语言 = ((uint)(0u)); @@ -1487,24 +1371,23 @@ // this.气缸复位.Font = new System.Drawing.Font("微软雅黑", 12F); this.气缸复位.HDADDR = ""; - this.气缸复位.Location = new System.Drawing.Point(277, 110); + this.气缸复位.Location = new System.Drawing.Point(208, 88); this.气缸复位.LockValue = ((uint)(0u)); - this.气缸复位.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.气缸复位.Name = "气缸复位"; this.气缸复位.PLC = ((uint)(0u)); - this.气缸复位.Size = new System.Drawing.Size(133, 45); + this.气缸复位.Size = new System.Drawing.Size(100, 36); this.气缸复位.TabIndex = 48; this.气缸复位.Text = "气缸复位"; this.气缸复位.UseVisualStyleBackColor = true; this.气缸复位.Value = ((ulong)(0ul)); - interLock8.HDADDR = ""; - interLock8.PLC = ((uint)(0u)); - interLock8.互锁启用值 = ((uint)(1u)); - interLock8.互锁地址 = ""; - interLock8.互锁显示图标 = null; - interLock8.互锁显示文本 = "LOCK"; - interLock8.互锁类型 = PCHMI.InterLock.DatType.BIT; - this.气缸复位.互锁 = interLock8; + interLock9.HDADDR = ""; + interLock9.PLC = ((uint)(0u)); + interLock9.互锁启用值 = ((uint)(1u)); + interLock9.互锁地址 = ""; + interLock9.互锁显示图标 = null; + interLock9.互锁显示文本 = "LOCK"; + interLock9.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.气缸复位.互锁 = interLock9; this.气缸复位.单击事件参数 = "NULL"; this.气缸复位.安全级别 = ((uint)(3u)); this.气缸复位.开关功能.PLC = new uint[] { @@ -1539,24 +1422,23 @@ // this.报警复位.Font = new System.Drawing.Font("微软雅黑", 12F); this.报警复位.HDADDR = ""; - this.报警复位.Location = new System.Drawing.Point(415, 110); + this.报警复位.Location = new System.Drawing.Point(311, 88); this.报警复位.LockValue = ((uint)(0u)); - this.报警复位.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.报警复位.Name = "报警复位"; this.报警复位.PLC = ((uint)(0u)); - this.报警复位.Size = new System.Drawing.Size(133, 45); + this.报警复位.Size = new System.Drawing.Size(100, 36); this.报警复位.TabIndex = 47; this.报警复位.Text = "报警复位"; this.报警复位.UseVisualStyleBackColor = true; this.报警复位.Value = ((ulong)(0ul)); - interLock9.HDADDR = ""; - interLock9.PLC = ((uint)(0u)); - interLock9.互锁启用值 = ((uint)(1u)); - interLock9.互锁地址 = ""; - interLock9.互锁显示图标 = null; - interLock9.互锁显示文本 = "LOCK"; - interLock9.互锁类型 = PCHMI.InterLock.DatType.BIT; - this.报警复位.互锁 = interLock9; + interLock10.HDADDR = ""; + interLock10.PLC = ((uint)(0u)); + interLock10.互锁启用值 = ((uint)(1u)); + interLock10.互锁地址 = ""; + interLock10.互锁显示图标 = null; + interLock10.互锁显示文本 = "LOCK"; + interLock10.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.报警复位.互锁 = interLock10; this.报警复位.单击事件参数 = "NULL"; this.报警复位.安全级别 = ((uint)(0u)); this.报警复位.开关功能.PLC = new uint[] { @@ -1591,24 +1473,23 @@ // this.库号清零.Font = new System.Drawing.Font("微软雅黑", 12F); this.库号清零.HDADDR = ""; - this.库号清零.Location = new System.Drawing.Point(4, 110); + this.库号清零.Location = new System.Drawing.Point(3, 88); this.库号清零.LockValue = ((uint)(0u)); - this.库号清零.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.库号清零.Name = "库号清零"; this.库号清零.PLC = ((uint)(0u)); - this.库号清零.Size = new System.Drawing.Size(133, 45); + this.库号清零.Size = new System.Drawing.Size(100, 36); this.库号清零.TabIndex = 46; this.库号清零.Text = "库号清零"; this.库号清零.UseVisualStyleBackColor = true; this.库号清零.Value = ((ulong)(0ul)); - interLock10.HDADDR = ""; - interLock10.PLC = ((uint)(0u)); - interLock10.互锁启用值 = ((uint)(1u)); - interLock10.互锁地址 = ""; - interLock10.互锁显示图标 = null; - interLock10.互锁显示文本 = "LOCK"; - interLock10.互锁类型 = PCHMI.InterLock.DatType.BIT; - this.库号清零.互锁 = interLock10; + interLock11.HDADDR = ""; + interLock11.PLC = ((uint)(0u)); + interLock11.互锁启用值 = ((uint)(1u)); + interLock11.互锁地址 = ""; + interLock11.互锁显示图标 = null; + interLock11.互锁显示文本 = "LOCK"; + interLock11.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.库号清零.互锁 = interLock11; this.库号清零.单击事件参数 = "NULL"; this.库号清零.安全级别 = ((uint)(3u)); this.库号清零.开关功能.PLC = new uint[] { @@ -1643,24 +1524,23 @@ // this.手动换舟.Font = new System.Drawing.Font("微软雅黑", 12F); this.手动换舟.HDADDR = ""; - this.手动换舟.Location = new System.Drawing.Point(277, 58); + this.手动换舟.Location = new System.Drawing.Point(208, 46); this.手动换舟.LockValue = ((uint)(0u)); - this.手动换舟.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.手动换舟.Name = "手动换舟"; this.手动换舟.PLC = ((uint)(0u)); - this.手动换舟.Size = new System.Drawing.Size(133, 45); + this.手动换舟.Size = new System.Drawing.Size(100, 36); this.手动换舟.TabIndex = 45; this.手动换舟.Text = "手动换舟"; this.手动换舟.UseVisualStyleBackColor = true; this.手动换舟.Value = ((ulong)(0ul)); - interLock11.HDADDR = ""; - interLock11.PLC = ((uint)(0u)); - interLock11.互锁启用值 = ((uint)(1u)); - interLock11.互锁地址 = ""; - interLock11.互锁显示图标 = null; - interLock11.互锁显示文本 = "LOCK"; - interLock11.互锁类型 = PCHMI.InterLock.DatType.BIT; - this.手动换舟.互锁 = interLock11; + interLock12.HDADDR = ""; + interLock12.PLC = ((uint)(0u)); + interLock12.互锁启用值 = ((uint)(1u)); + interLock12.互锁地址 = ""; + interLock12.互锁显示图标 = null; + interLock12.互锁显示文本 = "LOCK"; + interLock12.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.手动换舟.互锁 = interLock12; this.手动换舟.单击事件参数 = "NULL"; this.手动换舟.安全级别 = ((uint)(0u)); this.手动换舟.开关功能.PLC = new uint[] { @@ -1694,10 +1574,9 @@ // btnEmulation // this.btnEmulation.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnEmulation.Location = new System.Drawing.Point(415, 58); - this.btnEmulation.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnEmulation.Location = new System.Drawing.Point(311, 46); this.btnEmulation.Name = "btnEmulation"; - this.btnEmulation.Size = new System.Drawing.Size(133, 45); + this.btnEmulation.Size = new System.Drawing.Size(100, 36); this.btnEmulation.TabIndex = 33; this.btnEmulation.Text = "模拟仿真(&P)"; this.btnEmulation.UseVisualStyleBackColor = true; @@ -1706,10 +1585,9 @@ // btnErrorReset // this.btnErrorReset.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnErrorReset.Location = new System.Drawing.Point(415, 6); - this.btnErrorReset.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnErrorReset.Location = new System.Drawing.Point(311, 5); this.btnErrorReset.Name = "btnErrorReset"; - this.btnErrorReset.Size = new System.Drawing.Size(133, 45); + this.btnErrorReset.Size = new System.Drawing.Size(100, 36); this.btnErrorReset.TabIndex = 33; this.btnErrorReset.Text = "故障复位"; this.btnErrorReset.UseVisualStyleBackColor = true; @@ -1718,10 +1596,9 @@ // btnStopNow // this.btnStopNow.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnStopNow.Location = new System.Drawing.Point(277, 6); - this.btnStopNow.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnStopNow.Location = new System.Drawing.Point(208, 5); this.btnStopNow.Name = "btnStopNow"; - this.btnStopNow.Size = new System.Drawing.Size(133, 45); + this.btnStopNow.Size = new System.Drawing.Size(100, 36); this.btnStopNow.TabIndex = 31; this.btnStopNow.Text = "紧急停止"; this.btnStopNow.UseVisualStyleBackColor = true; @@ -1730,10 +1607,9 @@ // btnStopProduct // this.btnStopProduct.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnStopProduct.Location = new System.Drawing.Point(139, 58); - this.btnStopProduct.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnStopProduct.Location = new System.Drawing.Point(104, 46); this.btnStopProduct.Name = "btnStopProduct"; - this.btnStopProduct.Size = new System.Drawing.Size(133, 45); + this.btnStopProduct.Size = new System.Drawing.Size(100, 36); this.btnStopProduct.TabIndex = 31; this.btnStopProduct.Text = "停止"; this.btnStopProduct.UseVisualStyleBackColor = true; @@ -1742,10 +1618,9 @@ // btnStartProduct // this.btnStartProduct.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnStartProduct.Location = new System.Drawing.Point(139, 6); - this.btnStartProduct.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnStartProduct.Location = new System.Drawing.Point(104, 5); this.btnStartProduct.Name = "btnStartProduct"; - this.btnStartProduct.Size = new System.Drawing.Size(133, 45); + this.btnStartProduct.Size = new System.Drawing.Size(100, 36); this.btnStartProduct.TabIndex = 30; this.btnStartProduct.Text = "启动"; this.btnStartProduct.UseVisualStyleBackColor = true; @@ -1754,10 +1629,9 @@ // btnCloseAndroid // this.btnCloseAndroid.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnCloseAndroid.Location = new System.Drawing.Point(4, 56); - this.btnCloseAndroid.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnCloseAndroid.Location = new System.Drawing.Point(3, 45); this.btnCloseAndroid.Name = "btnCloseAndroid"; - this.btnCloseAndroid.Size = new System.Drawing.Size(133, 45); + this.btnCloseAndroid.Size = new System.Drawing.Size(100, 36); this.btnCloseAndroid.TabIndex = 29; this.btnCloseAndroid.Text = "关闭机器人"; this.btnCloseAndroid.UseVisualStyleBackColor = true; @@ -1766,10 +1640,9 @@ // btnOpenAndroid // this.btnOpenAndroid.Font = new System.Drawing.Font("微软雅黑", 12F); - this.btnOpenAndroid.Location = new System.Drawing.Point(4, 6); - this.btnOpenAndroid.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnOpenAndroid.Location = new System.Drawing.Point(3, 5); this.btnOpenAndroid.Name = "btnOpenAndroid"; - this.btnOpenAndroid.Size = new System.Drawing.Size(133, 45); + this.btnOpenAndroid.Size = new System.Drawing.Size(100, 36); this.btnOpenAndroid.TabIndex = 28; this.btnOpenAndroid.Text = "打开机器人"; this.btnOpenAndroid.UseVisualStyleBackColor = true; @@ -1783,31 +1656,28 @@ this.panel10.Controls.Add(this.btnIpConfig); this.panel10.Controls.Add(this.epsonSocket2); this.panel10.Controls.Add(this.epsonSocket1); - this.panel10.Location = new System.Drawing.Point(3, 814); - this.panel10.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel10.Location = new System.Drawing.Point(2, 651); this.panel10.Name = "panel10"; - this.panel10.Size = new System.Drawing.Size(1346, 96); + this.panel10.Size = new System.Drawing.Size(1010, 77); this.panel10.TabIndex = 49; // // txtWeightMessage // this.txtWeightMessage.BackColor = System.Drawing.SystemColors.Menu; - this.txtWeightMessage.Location = new System.Drawing.Point(799, 2); - this.txtWeightMessage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtWeightMessage.Location = new System.Drawing.Point(599, 2); this.txtWeightMessage.Multiline = true; this.txtWeightMessage.Name = "txtWeightMessage"; this.txtWeightMessage.ReadOnly = true; this.txtWeightMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtWeightMessage.Size = new System.Drawing.Size(341, 86); + this.txtWeightMessage.Size = new System.Drawing.Size(257, 70); this.txtWeightMessage.TabIndex = 52; // // btnWeightConfig // this.btnWeightConfig.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnWeightConfig.Location = new System.Drawing.Point(1149, 46); - this.btnWeightConfig.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnWeightConfig.Location = new System.Drawing.Point(862, 37); this.btnWeightConfig.Name = "btnWeightConfig"; - this.btnWeightConfig.Size = new System.Drawing.Size(183, 44); + this.btnWeightConfig.Size = new System.Drawing.Size(137, 35); this.btnWeightConfig.TabIndex = 51; this.btnWeightConfig.Text = "称重配置"; this.btnWeightConfig.UseVisualStyleBackColor = true; @@ -1816,10 +1686,9 @@ // btnIpConfig // this.btnIpConfig.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnIpConfig.Location = new System.Drawing.Point(1149, 1); - this.btnIpConfig.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnIpConfig.Location = new System.Drawing.Point(862, 1); this.btnIpConfig.Name = "btnIpConfig"; - this.btnIpConfig.Size = new System.Drawing.Size(183, 44); + this.btnIpConfig.Size = new System.Drawing.Size(137, 35); this.btnIpConfig.TabIndex = 50; this.btnIpConfig.Text = "机器人配置"; this.btnIpConfig.UseVisualStyleBackColor = true; @@ -1843,8 +1712,8 @@ this.epsonSocket2.Ip_addr = "127.0.0.1"; this.epsonSocket2.Is_admin = false; this.epsonSocket2.Is_Reconnect = false; - this.epsonSocket2.Location = new System.Drawing.Point(396, 4); - this.epsonSocket2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.epsonSocket2.Location = new System.Drawing.Point(297, 3); + this.epsonSocket2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.epsonSocket2.Name = "epsonSocket2"; this.epsonSocket2.Node_time = "KFC"; this.epsonSocket2.Port_value = 5002; @@ -1852,7 +1721,7 @@ this.epsonSocket2.Resend_weight_value = 0D; this.epsonSocket2.Select_num = 0; this.epsonSocket2.Send_data = ""; - this.epsonSocket2.Size = new System.Drawing.Size(395, 86); + this.epsonSocket2.Size = new System.Drawing.Size(296, 69); this.epsonSocket2.StatusMsg = ""; this.epsonSocket2.TabIndex = 49; this.epsonSocket2.TimerStart = false; @@ -1881,8 +1750,8 @@ this.epsonSocket1.Ip_addr = "127.0.0.1"; this.epsonSocket1.Is_admin = true; this.epsonSocket1.Is_Reconnect = false; - this.epsonSocket1.Location = new System.Drawing.Point(5, 2); - this.epsonSocket1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.epsonSocket1.Location = new System.Drawing.Point(4, 2); + this.epsonSocket1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.epsonSocket1.Name = "epsonSocket1"; this.epsonSocket1.Node_time = "KFC"; this.epsonSocket1.Port_value = 5002; @@ -1890,7 +1759,7 @@ this.epsonSocket1.Resend_weight_value = 0D; this.epsonSocket1.Select_num = 0; this.epsonSocket1.Send_data = ""; - this.epsonSocket1.Size = new System.Drawing.Size(383, 88); + this.epsonSocket1.Size = new System.Drawing.Size(287, 70); this.epsonSocket1.StatusMsg = ""; this.epsonSocket1.TabIndex = 49; this.epsonSocket1.TimerStart = false; @@ -1946,18 +1815,130 @@ this.PLC_Communication.通讯配置文件名 = ""; this.PLC_Communication.随机数保存地址 = null; // + // label19 + // + this.label19.AutoSize = true; + this.label19.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label19.Location = new System.Drawing.Point(100, 3); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(94, 21); + this.label19.TabIndex = 40; + this.label19.Text = "机械手状态:"; + // + // 标签4 + // + this.标签4.AutoSize = true; + this.标签4.BackColor = System.Drawing.Color.Red; + this.标签4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.标签4.ForeColor = System.Drawing.Color.Black; + this.标签4.HDADDR = "M5597"; + this.标签4.Image = null; + this.标签4.Location = new System.Drawing.Point(187, 3); + this.标签4.Name = "标签4"; + this.标签4.PLC = ((uint)(0u)); + this.标签4.Size = new System.Drawing.Size(30, 21); + this.标签4.TabIndex = 39; + this.标签4.Text = " "; + this.标签4.Value = ((ulong)(0ul)); + interLock6.HDADDR = ""; + interLock6.PLC = ((uint)(0u)); + interLock6.互锁启用值 = ((uint)(1u)); + interLock6.互锁地址 = ""; + interLock6.互锁显示图标 = null; + interLock6.互锁显示文本 = "LOCK"; + interLock6.互锁类型 = PCHMI.InterLock.DatType.BIT; + this.标签4.互锁 = interLock6; + this.标签4.值限制 = false; + this.标签4.允许输入 = false; + this.标签4.前缀 = ""; + this.标签4.功能 = PCHMI.标签.TypeEnum.指示; + this.标签4.后缀 = ""; + this.标签4.图片显示偏移量 = new System.Drawing.Point(0, 0); + drawStyle3.圆角半径 = 15; + drawStyle3.填充颜色 = System.Drawing.Color.Empty; + drawStyle3.按下颜色 = System.Drawing.Color.Empty; + drawStyle3.样式 = PCHMI.DrawStyle.STYPE.常规; + drawStyle3.边框颜色 = System.Drawing.Color.LightGray; + this.标签4.外观样式 = drawStyle3; + this.标签4.字符串长度 = ((uint)(10u)); + this.标签4.安全级别 = ((uint)(0u)); + this.标签4.小数位数 = ((uint)(0u)); + this.标签4.开关功能.PLC = null; + this.标签4.开关功能.地址 = null; + this.标签4.开关功能.开关 = null; + this.标签4.开关功能.扩展 = null; + this.标签4.快捷键 = ""; + this.标签4.总显示位数 = ((uint)(8u)); + this.标签4.操作确认 = false; + this.标签4.操作确认提示 = new string[] { + null, + null, + null, + null, + null, + null, + null, + null}; + this.标签4.数据类型 = PCHMI.标签.DatType.BIT; + this.标签4.日期时间格式化 = "yyyy-MM-dd"; + this.标签4.显示内容.BkImg = null; + this.标签4.显示内容.状态切换条件 = PCHMI.Employee.STSW.按序号值切换状态; + sT_SW_IF5.BkColor = System.Drawing.Color.Red; + sT_SW_IF5.Img = null; + sT_SW_IF5.MaxVal = ((ulong)(0ul)); + sT_SW_IF5.MinVal = ((ulong)(0ul)); + sT_SW_IF5.Txt0 = " "; + sT_SW_IF5.Txt1 = ""; + sT_SW_IF5.Txt2 = ""; + sT_SW_IF5.Txt3 = ""; + sT_SW_IF5.Txt4 = ""; + sT_SW_IF5.Txt5 = ""; + sT_SW_IF5.Txt6 = ""; + sT_SW_IF5.Txt7 = ""; + sT_SW_IF5.TxtColor = System.Drawing.Color.Black; + sT_SW_IF5.TxtNumber = ""; + sT_SW_IF6.BkColor = System.Drawing.Color.Lime; + sT_SW_IF6.Img = null; + sT_SW_IF6.MaxVal = ((ulong)(0ul)); + sT_SW_IF6.MinVal = ((ulong)(0ul)); + sT_SW_IF6.Txt0 = " "; + sT_SW_IF6.Txt1 = ""; + sT_SW_IF6.Txt2 = ""; + sT_SW_IF6.Txt3 = ""; + sT_SW_IF6.Txt4 = ""; + sT_SW_IF6.Txt5 = ""; + sT_SW_IF6.Txt6 = ""; + sT_SW_IF6.Txt7 = ""; + sT_SW_IF6.TxtColor = System.Drawing.Color.Black; + sT_SW_IF6.TxtNumber = ""; + this.标签4.显示内容.状态文本 = new PCHMI.ST_SW_IF[] { + sT_SW_IF5, + sT_SW_IF6}; + this.标签4.显示内容.默认状态文本ID = ((uint)(0u)); + this.标签4.最大值 = "100"; + this.标签4.最小值 = "0"; + this.标签4.权限提示文本 = ""; + this.标签4.空字符显示 = "null"; + this.标签4.语言 = ((uint)(0u)); + glint3.HDADDR = ""; + glint3.PLC = ((uint)(0u)); + glint3.位地址 = ""; + glint3.字体颜色 = System.Drawing.Color.Red; + glint3.间隔时间 = ((ushort)(1000)); + this.标签4.闪烁 = glint3; + this.标签4.默认字体颜色 = System.Drawing.Color.Black; + // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); - this.ClientSize = new System.Drawing.Size(1344, 911); + this.ClientSize = new System.Drawing.Size(1008, 729); this.Controls.Add(this.panel10); this.Controls.Add(this.panel7); this.Controls.Add(this.panel4); this.Controls.Add(this.panel3); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "MainForm"; this.Text = "中钨高新长城装备硬质合金压机机械手"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); @@ -1973,7 +1954,6 @@ this.panel5.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.panel7.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dgvWeight)).EndInit(); this.panel10.ResumeLayout(false); this.panel10.PerformLayout(); this.ResumeLayout(false); @@ -2061,16 +2041,13 @@ private System.Windows.Forms.Label label7; private PCHMI.标签 标签3; private System.Windows.Forms.Button btnWeightConfig; - private System.Windows.Forms.DataGridView dgvWeight; private System.Windows.Forms.Button btnWeightRest; private System.Windows.Forms.Button btnWeightCalculate; private System.Windows.Forms.TextBox txtWeightMessage; - private System.Windows.Forms.DataGridViewTextBoxColumn colID; - private System.Windows.Forms.DataGridViewTextBoxColumn colComName; - private System.Windows.Forms.DataGridViewTextBoxColumn colWeight; - private System.Windows.Forms.DataGridViewTextBoxColumn colUnit; private System.Windows.Forms.Button btnGetWeight; private PCHMI.CONFIG PLC_Communication; + private System.Windows.Forms.Label label19; + private PCHMI.标签 标签4; } } diff --git a/ZWGXPICK_SYS/frmMain.cs b/ZWGXPICK_SYS/frmMain.cs index 02711b4..adebc53 100644 --- a/ZWGXPICK_SYS/frmMain.cs +++ b/ZWGXPICK_SYS/frmMain.cs @@ -2,6 +2,7 @@ using Maticsoft.DBUtility; using PCHMI; using PLCCommunication; +using PLCCommunication.Common; using System; using System.Collections.Generic; @@ -72,10 +73,30 @@ namespace ZWGXPICK_SYS private float Y; private ZWGXPICK_SYS.Model.PRODUCT_ITEM_CONFIG product = null; //当前选中的产品信息. - //重量设备聚合类 - private WeightEquipmentAggregation weightEquipmentAggregation = null; - - private DataTable dtWeight = new DataTable(); + /// + /// 重量设类 + /// + private WeightEquipment weightEquipment = null; + /// + /// 设置单重上限 + /// + private decimal setSingleUpperLimit = 0; + /// + /// 设置调整上限 + /// + private decimal setAdjustmentUpperLimit = 0; + /// + /// 设置一个标准重量 + /// + private decimal setStandardWeight = 0; + /// + /// 设置调整下限 + /// + private decimal setAdjustmentLowerLimit = 0; + /// + /// 设置单重下限 + /// + private decimal setSingleLowerLimit = 0; public MainForm() { @@ -90,7 +111,7 @@ namespace ZWGXPICK_SYS this.mlbMatrix[row, col] = new GraphicsPath(); } } - + //RICADO.MettlerToledo.MettlerToledoDevice mettlerToledoDevice = new RICADO.MettlerToledo.MettlerToledoDevice(RICADO.MettlerToledo.ConnectionMethod.Ethernet,RICADO.MettlerToledo.ProtocolType.SICS,"111",10); } private void setTag(Control cons) @@ -192,16 +213,7 @@ namespace ZWGXPICK_SYS initTriggerList(); this.createLogDir(); - dtWeight.Columns.Add("ID"); - dtWeight.Columns.Add("COMName"); - dtWeight.Columns.Add("Weight"); - dtWeight.Columns.Add("Nuit"); - dtWeight.Columns.Add("Message"); - dgvWeight.DataSource = dtWeight; - //this.dgvWeight.DefaultCellStyle.ForeColor = Color.Red; - this.dgvWeight.DefaultCellStyle.Font = new Font("Microsoft YaHei", 8, FontStyle.Bold); - this.dgvWeight.ColumnHeadersDefaultCellStyle.Font = new Font("Microsoft YaHei", 10, FontStyle.Bold); - this.dgvWeight.AutoGenerateColumns = false; + } // 绘制函数. @@ -263,9 +275,9 @@ namespace ZWGXPICK_SYS this.txt_cleanmode_interval.Text = ini.ReadString("global", "txt_cleanmode_interval", ""); this.txt_continuity_unqualified.Text = ini.ReadString("global", "txt_continuity_unqualified", ""); - this.txt_standard_weight.Text = ini.ReadString("global", "txt_standard_weight", ""); - this.txt_qualified_allow_error.Text = ini.ReadString("global", "txt_qualified_allow_error", ""); - this.txt_single_weight_allow_error.Text = ini.ReadString("global", "txt_single_weight_allow_error", ""); + //this.txt_standard_weight.Text = ini.ReadString("global", "txt_standard_weight", ""); + //this.txt_qualified_allow_error.Text = ini.ReadString("global", "txt_qualified_allow_error", ""); + //this.txt_single_weight_allow_error.Text = ini.ReadString("global", "txt_single_weight_allow_error", ""); this.txt_plan_placed_num.Text = ini.ReadString("global", "txt_plan_placed_num", "1"); if (this.txt_plan_placed_num.Text == "") this.txt_plan_placed_num.Text = "1"; @@ -273,11 +285,19 @@ namespace ZWGXPICK_SYS if ((nSpeed < 5) || (nSpeed > 100)) nSpeed = 5; this.txt_run_speed.Text = nSpeed.ToString(); - //重量设备聚合类 初始化 - weightEquipmentAggregation = new WeightEquipmentAggregation(); - weightEquipmentAggregation.MessageSend += WeightEquipmentAggregation_MessageSend; - weightEquipmentAggregation.WeightSend += WeightEquipmentAggregation_WeightSend; - weightEquipmentAggregation.SuccessSend += WeightEquipmentAggregation_SuccessSend; + //重量计算参数 + setSingleUpperLimit = decimal.Parse(ini.ReadString("weight_RS232", "setSingleUpperLimit", "0")); + setAdjustmentUpperLimit = decimal.Parse(ini.ReadString("weight_RS232", "setAdjustmentUpperLimit", "0")); + setStandardWeight = decimal.Parse(ini.ReadString("weight_RS232", "setStandardWeight", "0")); + setAdjustmentLowerLimit = decimal.Parse(ini.ReadString("weight_RS232", "setAdjustmentLowerLimit", "0")); + setSingleLowerLimit = decimal.Parse(ini.ReadString("weight_RS232", "setSingleLowerLimit", "0")); + + //重量设备 初始化 + var baud = ini.ReadString("weight_RS232", "baud"); + var comName = ini.ReadString("weight_RS232", "comName"); + weightEquipment = new WeightEquipment(comName,int.Parse(baud)); + weightEquipment.MessageSend += WeightEquipment_MessageSend; + weightEquipment.WeightSend += WeightEquipment_WeightSend; } // 写ini配置信息. @@ -2001,90 +2021,49 @@ namespace ZWGXPICK_SYS form.ShowDialog(this); } - public void InitWeightEquipmentAggregation() + public void InitWeightEquipment() { IniFile ini = new IniFile(PubConstant.config_file); - var txt_standard_weight = ini.ReadString("global", "txt_standard_weight", ""); - var txt_qualified_allow_error = ini.ReadString("global", "txt_qualified_allow_error", ""); - var txt_single_weight_allow_error = ini.ReadString("global", "txt_single_weight_allow_error", ""); - int baud = ini.ReadInteger("weight_RS232", "baud", 9600); - bool comEnable0 = ini.ReadBool("weight_RS232", "comEnable0", true); - bool comEnable1 = ini.ReadBool("weight_RS232", "comEnable1", true); - bool comEnable2 = ini.ReadBool("weight_RS232", "comEnable2", true); - bool comEnable3 = ini.ReadBool("weight_RS232", "comEnable3", true); - string comName0 = ini.ReadString("weight_RS232", "comName0"); - string comName1 = ini.ReadString("weight_RS232", "comName1"); - string comName2 = ini.ReadString("weight_RS232", "comName2"); - string comName3 = ini.ReadString("weight_RS232", "comName3"); - List comNames = new List(); - if (comEnable0) - { - comNames.Add(comName0); - } - if (comEnable1) + //重量计算参数 + setSingleUpperLimit = decimal.Parse(ini.ReadString("weight_RS232", "setSingleUpperLimit", "0")); + setAdjustmentUpperLimit = decimal.Parse(ini.ReadString("weight_RS232", "setAdjustmentUpperLimit", "0")); + setStandardWeight = decimal.Parse(ini.ReadString("weight_RS232", "setStandardWeight" )); + setAdjustmentLowerLimit = decimal.Parse(ini.ReadString("weight_RS232", "setAdjustmentLowerLimit", "0")); + setSingleLowerLimit = decimal.Parse(ini.ReadString("weight_RS232", "setSingleLowerLimit", "0")); + if (!weightEquipment.IsOpen()) { - comNames.Add(comName1); + var baud = ini.ReadInteger("weight_RS232", "baud", 0); + var comName = ini.ReadString("weight_RS232", "comName"); + weightEquipment.Open(comName, baud); } - if (comEnable2) - { - comNames.Add(comName2); - } - if (comEnable3) - { - comNames.Add(comName3); - } - - decimal standard_weight = 0, qualified_allow_error = 0, single_weight_allow_error = 0; - decimal.TryParse(txt_standard_weight, out standard_weight); - decimal.TryParse(txt_qualified_allow_error, out qualified_allow_error); - decimal.TryParse(txt_single_weight_allow_error, out single_weight_allow_error); - weightEquipmentAggregation.Init(baud, comNames.ToArray(), standard_weight, qualified_allow_error, single_weight_allow_error); + } //称重置零 private void WeightRest() { - InitWeightEquipmentAggregation(); - var res = weightEquipmentAggregation.Open(); - if (!res) + var result = false; + if (!weightEquipment.IsOpen()) { - return; + InitWeightEquipment(); + result = weightEquipment.Open(); } - res = weightEquipmentAggregation.Rest(); if (this.epsonSocket2.IsConnection) { - string cmd = $"$weightreset;{(res ? 1 : 0)}"; + string cmd = $"$weightreset;{(result ? 1 : 0)}"; this.epsonSocket2.tcp_send(cmd); + + WeightPrintMessage($"发送【称重置零】命令:{cmd} 【{(result ? "成功" : "失败")}】"); - WeightPrintMessage($"发送【称重置零】命令:{cmd} 【{(res ? "成功" : "失败")}】"); + PLCWriteBool("M215", false); + PLCWriteBool("M216", false); } } //获取称重 private void WeightSend() { - if (!weightEquipmentAggregation.IsOpen()) - { - InitWeightEquipmentAggregation(); - var res = weightEquipmentAggregation.Open(); - if (!res) - { - return; - } - } - var result = weightEquipmentAggregation.Send(); - //if (this.epsonSocket2.IsConnection) - //{ - // string cmd = "weightsend;" + (result ? 1 : 0).ToString(); - // this.epsonSocket2.tcp_send(cmd); - - // WeightPrintMessage($"发送【获取重量】命令:{cmd} 成功!"); - //} - } - - //称重结果返回 - private void WeightResult(bool result) - { + var result = CalculatingWeighingResult(); if (this.epsonSocket2.IsConnection) { string cmd = $"$weightsend;{(result ? 1 : 0)}"; @@ -2092,12 +2071,61 @@ namespace ZWGXPICK_SYS WeightPrintMessage($"发送【称重结果】命令:{cmd} 【{(result ? "合格" : "不合格")}】"); //关闭连接 - weightEquipmentAggregation.Close(); + weightEquipment.Close(); WeightAddToDB(result); } } + //计算称重结果 + private bool CalculatingWeighingResult() + { + var result = false; + var txtSetStandardWeight = 0m; + this.Invoke(new MethodInvoker(() => + { + decimal.TryParse(txt_standard_weight.Text.Trim(), out txtSetStandardWeight); + })); + if (txtSetStandardWeight <= 0) + { + return false; + } + //调整下限<实时重量<标准重量,返回称重OK给机械手 + if (setAdjustmentLowerLimit <= txtSetStandardWeight && txtSetStandardWeight <= setStandardWeight) + { + result = true; + } + //标准重量 < 实时重量 < 调整上限,返回称重OK给机械手 + else if (setStandardWeight <= txtSetStandardWeight && txtSetStandardWeight <= setAdjustmentUpperLimit) + { + result = true; + } + //单重下限<实时重量<调整下限,返回称重OK给机械手,同时将PLC M216写TRUE + else if (setSingleLowerLimit <= txtSetStandardWeight && txtSetStandardWeight <= setAdjustmentLowerLimit) + { + result = true; + PLCWriteBool("M216", true); + } + // 调整上限<实时重量<单重上限,返回称重OK给机械手,同时将PLC M215写TRUE + else if (setAdjustmentUpperLimit <= txtSetStandardWeight && txtSetStandardWeight <= setSingleUpperLimit) + { + result = true; + PLCWriteBool("M215",true); + } + //调实时重量<调整下限,返回称重NG给机械手 + else if (txtSetStandardWeight <= setAdjustmentLowerLimit) + { + result = false; + } + //调实时重量>调整上限,返回称重NG给机械手 + else if (txtSetStandardWeight >= setAdjustmentUpperLimit) + { + result = false; + } + + return result; + } + //将重量信息添加到数据库 private void WeightAddToDB(bool result) { @@ -2119,48 +2147,21 @@ namespace ZWGXPICK_SYS } - //称重设备结果计算是否成功 - private void WeightEquipmentAggregation_SuccessSend(object sender, bool e) - { - WeightResult(e); - } - //称重设备返回重量信息 - private void WeightEquipmentAggregation_WeightSend(object sender, List e) + private void WeightEquipment_WeightSend(object sender, WeightModel e) { - this.Invoke(new Action(() => + this.Invoke(new MethodInvoker(() => { - dtWeight.Rows.Clear(); - foreach (var item in e) - { - var dr = dtWeight.NewRow(); - dr[nameof(item.ID)] = item.ID; - dr[nameof(item.COMName)] = item.COMName; - dr[nameof(item.Nuit)] = item.Nuit; - dr[nameof(item.Weight)] = item.Weight; - dr[nameof(item.Message)] = item.Message; - dtWeight.Rows.Add(dr); - } + txt_standard_weight.Text = e.Weight.ToString(); })); - } //称重设备错误信息 - private void WeightEquipmentAggregation_MessageSend(object sender, MessageEventArgs e) + private void WeightEquipment_MessageSend(object sender, MessageEventArgs e) { WeightPrintMessage(e.Message); } - //输出称重消息 - private void WeightPrintMessage(string message) - { - if (txtWeightMessage.Lines.Length >= 500) - { - txtWeightMessage.Clear(); - } - txtWeightMessage.AppendText($"【{DateTime.Now.ToString("HH:mm:ss")}】:{message}{Environment.NewLine}"); - } - //称重重置 private void btnWeightRest_Click(object sender, EventArgs e) { @@ -2175,12 +2176,38 @@ namespace ZWGXPICK_SYS //称重计算 private void btnWeightCalculate_Click(object sender, EventArgs e) { - var res = weightEquipmentAggregation.Calculation(); + var result = CalculatingWeighingResult(); + WeightPrintMessage($"手动称重【称重结果】:【{(result ? "合格" : "不合格")}】"); + } + + private void PLCWriteBool(string pointName,bool value) + { + var res = PLCCommunicationFactory.Instance.Write(pointName, value); + var msg = ""; + if (res.IsSuccess) + { + msg = $"{pointName} 写入值 {value} 成功!"; + } + else + { + msg = $"{pointName} 写入值 {value} 失败!{res.Message}"; + } + WeightPrintMessage(msg); + } + + //输出称重消息 + private void WeightPrintMessage(string message) + { - WeightResult(res); + if (txtWeightMessage.Lines.Length >= 500) + { + txtWeightMessage.Clear(); + } + txtWeightMessage.AppendText($"【{DateTime.Now.ToString("HH:mm:ss")}】:{message}{Environment.NewLine}"); } + #endregion - + } } diff --git a/ZWGXPICK_SYS/frmMain.resx b/ZWGXPICK_SYS/frmMain.resx index 0bdfde4..3d25c3e 100644 --- a/ZWGXPICK_SYS/frmMain.resx +++ b/ZWGXPICK_SYS/frmMain.resx @@ -117,18 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - True - - - True - - - True - 181, 17 diff --git a/ZWGXPICK_SYS/frmWeightPort.Designer.cs b/ZWGXPICK_SYS/frmWeightPort.Designer.cs index 5731beb..83edeb4 100644 --- a/ZWGXPICK_SYS/frmWeightPort.Designer.cs +++ b/ZWGXPICK_SYS/frmWeightPort.Designer.cs @@ -29,21 +29,21 @@ private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); - this.txtWeightComName0 = new System.Windows.Forms.TextBox(); + this.txtWeightComName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.btnOk = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.cbbps = new System.Windows.Forms.ComboBox(); - this.txtWeightComName1 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); - this.txtWeightComName2 = new System.Windows.Forms.TextBox(); + this.txtSetSingleUpperLimit = new System.Windows.Forms.TextBox(); + this.txtSetAdjustmentUpperLimit = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); - this.txtWeightComName3 = new System.Windows.Forms.TextBox(); + this.txtSetStandardWeight = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); - this.chbEnable0 = new System.Windows.Forms.CheckBox(); - this.chbEnable1 = new System.Windows.Forms.CheckBox(); - this.chbEnable2 = new System.Windows.Forms.CheckBox(); - this.chbEnable3 = new System.Windows.Forms.CheckBox(); + this.txtSetAdjustmentLowerLimit = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.txtSetSingleLowerLimit = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 @@ -55,25 +55,25 @@ this.label1.TabIndex = 0; this.label1.Text = "波特率: "; // - // txtWeightComName0 + // txtWeightComName // - this.txtWeightComName0.Location = new System.Drawing.Point(126, 53); - this.txtWeightComName0.Name = "txtWeightComName0"; - this.txtWeightComName0.Size = new System.Drawing.Size(235, 34); - this.txtWeightComName0.TabIndex = 1; + this.txtWeightComName.Location = new System.Drawing.Point(157, 50); + this.txtWeightComName.Name = "txtWeightComName"; + this.txtWeightComName.Size = new System.Drawing.Size(235, 34); + this.txtWeightComName.TabIndex = 1; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 56); + this.label2.Location = new System.Drawing.Point(12, 53); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(115, 27); + this.label2.Size = new System.Drawing.Size(103, 27); this.label2.TabIndex = 2; - this.label2.Text = "设备1端口: "; + this.label2.Text = "设备端口: "; // // btnOk // - this.btnOk.Location = new System.Drawing.Point(199, 223); + this.btnOk.Location = new System.Drawing.Point(157, 307); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(102, 42); this.btnOk.TabIndex = 5; @@ -83,7 +83,7 @@ // // btnCancel // - this.btnCancel.Location = new System.Drawing.Point(332, 223); + this.btnCancel.Location = new System.Drawing.Point(290, 307); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(102, 42); this.btnCancel.TabIndex = 6; @@ -100,119 +100,111 @@ "19200", "38400", "115200"}); - this.cbbps.Location = new System.Drawing.Point(126, 14); + this.cbbps.Location = new System.Drawing.Point(157, 14); this.cbbps.Name = "cbbps"; this.cbbps.Size = new System.Drawing.Size(235, 29); this.cbbps.TabIndex = 0; // - // txtWeightComName1 - // - this.txtWeightComName1.Location = new System.Drawing.Point(126, 93); - this.txtWeightComName1.Name = "txtWeightComName1"; - this.txtWeightComName1.Size = new System.Drawing.Size(235, 34); - this.txtWeightComName1.TabIndex = 2; - // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 96); + this.label3.Location = new System.Drawing.Point(12, 90); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(115, 27); - this.label3.TabIndex = 6; - this.label3.Text = "设备2端口: "; + this.label3.Size = new System.Drawing.Size(137, 27); + this.label3.TabIndex = 7; + this.label3.Text = "设置单重上限:"; + // + // txtSetSingleUpperLimit // - // txtWeightComName2 + this.txtSetSingleUpperLimit.Location = new System.Drawing.Point(157, 90); + this.txtSetSingleUpperLimit.Name = "txtSetSingleUpperLimit"; + this.txtSetSingleUpperLimit.Size = new System.Drawing.Size(235, 34); + this.txtSetSingleUpperLimit.TabIndex = 8; // - this.txtWeightComName2.Location = new System.Drawing.Point(126, 133); - this.txtWeightComName2.Name = "txtWeightComName2"; - this.txtWeightComName2.Size = new System.Drawing.Size(235, 34); - this.txtWeightComName2.TabIndex = 3; + // txtSetAdjustmentUpperLimit + // + this.txtSetAdjustmentUpperLimit.Location = new System.Drawing.Point(157, 128); + this.txtSetAdjustmentUpperLimit.Name = "txtSetAdjustmentUpperLimit"; + this.txtSetAdjustmentUpperLimit.Size = new System.Drawing.Size(235, 34); + this.txtSetAdjustmentUpperLimit.TabIndex = 10; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(12, 136); + this.label4.Location = new System.Drawing.Point(12, 128); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(115, 27); - this.label4.TabIndex = 8; - this.label4.Text = "设备3端口: "; + this.label4.Size = new System.Drawing.Size(152, 27); + this.label4.TabIndex = 9; + this.label4.Text = "设置调整上限:"; // - // txtWeightComName3 + // txtSetStandardWeight // - this.txtWeightComName3.Location = new System.Drawing.Point(126, 173); - this.txtWeightComName3.Name = "txtWeightComName3"; - this.txtWeightComName3.Size = new System.Drawing.Size(235, 34); - this.txtWeightComName3.TabIndex = 4; + this.txtSetStandardWeight.Location = new System.Drawing.Point(157, 167); + this.txtSetStandardWeight.Name = "txtSetStandardWeight"; + this.txtSetStandardWeight.Size = new System.Drawing.Size(235, 34); + this.txtSetStandardWeight.TabIndex = 12; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 176); + this.label5.Location = new System.Drawing.Point(12, 167); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(115, 27); - this.label5.TabIndex = 10; - this.label5.Text = "设备4端口: "; - // - // chbEnable0 - // - this.chbEnable0.AutoSize = true; - this.chbEnable0.Location = new System.Drawing.Point(367, 56); - this.chbEnable0.Name = "chbEnable0"; - this.chbEnable0.Size = new System.Drawing.Size(71, 31); - this.chbEnable0.TabIndex = 11; - this.chbEnable0.Text = "启用"; - this.chbEnable0.UseVisualStyleBackColor = true; - // - // chbEnable1 - // - this.chbEnable1.AutoSize = true; - this.chbEnable1.Location = new System.Drawing.Point(367, 96); - this.chbEnable1.Name = "chbEnable1"; - this.chbEnable1.Size = new System.Drawing.Size(71, 31); - this.chbEnable1.TabIndex = 12; - this.chbEnable1.Text = "启用"; - this.chbEnable1.UseVisualStyleBackColor = true; - // - // chbEnable2 - // - this.chbEnable2.AutoSize = true; - this.chbEnable2.Location = new System.Drawing.Point(367, 136); - this.chbEnable2.Name = "chbEnable2"; - this.chbEnable2.Size = new System.Drawing.Size(71, 31); - this.chbEnable2.TabIndex = 13; - this.chbEnable2.Text = "启用"; - this.chbEnable2.UseVisualStyleBackColor = true; - // - // chbEnable3 - // - this.chbEnable3.AutoSize = true; - this.chbEnable3.Location = new System.Drawing.Point(367, 176); - this.chbEnable3.Name = "chbEnable3"; - this.chbEnable3.Size = new System.Drawing.Size(71, 31); - this.chbEnable3.TabIndex = 14; - this.chbEnable3.Text = "启用"; - this.chbEnable3.UseVisualStyleBackColor = true; + this.label5.Size = new System.Drawing.Size(137, 27); + this.label5.TabIndex = 11; + this.label5.Text = "设置标准重量:"; + // + // txtSetAdjustmentLowerLimit + // + this.txtSetAdjustmentLowerLimit.Location = new System.Drawing.Point(157, 207); + this.txtSetAdjustmentLowerLimit.Name = "txtSetAdjustmentLowerLimit"; + this.txtSetAdjustmentLowerLimit.Size = new System.Drawing.Size(235, 34); + this.txtSetAdjustmentLowerLimit.TabIndex = 14; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(12, 207); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(137, 27); + this.label6.TabIndex = 13; + this.label6.Text = "设置调整下限:"; + // + // txtSetSingleLowerLimit + // + this.txtSetSingleLowerLimit.Location = new System.Drawing.Point(157, 247); + this.txtSetSingleLowerLimit.Name = "txtSetSingleLowerLimit"; + this.txtSetSingleLowerLimit.Size = new System.Drawing.Size(235, 34); + this.txtSetSingleLowerLimit.TabIndex = 16; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(12, 247); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(137, 27); + this.label7.TabIndex = 15; + this.label7.Text = "设置单重下限:"; // // frmWeightPort // this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 27F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))); - this.ClientSize = new System.Drawing.Size(447, 287); - this.Controls.Add(this.chbEnable3); - this.Controls.Add(this.chbEnable2); - this.Controls.Add(this.chbEnable1); - this.Controls.Add(this.chbEnable0); - this.Controls.Add(this.txtWeightComName3); + this.ClientSize = new System.Drawing.Size(428, 367); + this.Controls.Add(this.txtSetSingleLowerLimit); + this.Controls.Add(this.label7); + this.Controls.Add(this.txtSetAdjustmentLowerLimit); + this.Controls.Add(this.label6); + this.Controls.Add(this.txtSetStandardWeight); this.Controls.Add(this.label5); - this.Controls.Add(this.txtWeightComName2); + this.Controls.Add(this.txtSetAdjustmentUpperLimit); this.Controls.Add(this.label4); - this.Controls.Add(this.txtWeightComName1); + this.Controls.Add(this.txtSetSingleUpperLimit); this.Controls.Add(this.label3); this.Controls.Add(this.cbbps); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOk); - this.Controls.Add(this.txtWeightComName0); + this.Controls.Add(this.txtWeightComName); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -230,20 +222,20 @@ #endregion private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtWeightComName0; + private System.Windows.Forms.TextBox txtWeightComName; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button btnOk; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.ComboBox cbbps; - private System.Windows.Forms.TextBox txtWeightComName1; private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtWeightComName2; + private System.Windows.Forms.TextBox txtSetSingleUpperLimit; + private System.Windows.Forms.TextBox txtSetAdjustmentUpperLimit; private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtWeightComName3; + private System.Windows.Forms.TextBox txtSetStandardWeight; private System.Windows.Forms.Label label5; - private System.Windows.Forms.CheckBox chbEnable0; - private System.Windows.Forms.CheckBox chbEnable1; - private System.Windows.Forms.CheckBox chbEnable2; - private System.Windows.Forms.CheckBox chbEnable3; + private System.Windows.Forms.TextBox txtSetAdjustmentLowerLimit; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox txtSetSingleLowerLimit; + private System.Windows.Forms.Label label7; } } \ No newline at end of file diff --git a/ZWGXPICK_SYS/frmWeightPort.cs b/ZWGXPICK_SYS/frmWeightPort.cs index aea3522..241c26b 100644 --- a/ZWGXPICK_SYS/frmWeightPort.cs +++ b/ZWGXPICK_SYS/frmWeightPort.cs @@ -16,10 +16,6 @@ namespace ZWGXPICK_SYS public frmWeightPort() { InitializeComponent(); - chbEnable0.CheckedChanged += ChbEnable_CheckedChanged; - chbEnable1.CheckedChanged += ChbEnable_CheckedChanged; - chbEnable2.CheckedChanged += ChbEnable_CheckedChanged; - chbEnable3.CheckedChanged += ChbEnable_CheckedChanged; } private void FrmAndroidIP_Load(object sender, EventArgs e) @@ -27,35 +23,20 @@ namespace ZWGXPICK_SYS ChbEnable_CheckedChanged(); IniFile ini = new IniFile(PubConstant.config_file); - string bps = ini.ReadString("weight_RS232", "baud"); - bool comEnable0 = ini.ReadBool("weight_RS232", "comEnable0", true); - bool comEnable1 = ini.ReadBool("weight_RS232", "comEnable1", true); - bool comEnable2 = ini.ReadBool("weight_RS232", "comEnable2", true); - bool comEnable3 = ini.ReadBool("weight_RS232", "comEnable3", true); - string comName0 = ini.ReadString("weight_RS232", "comName0"); - string comName1 = ini.ReadString("weight_RS232", "comName1"); - string comName2 = ini.ReadString("weight_RS232", "comName2"); - string comName3 = ini.ReadString("weight_RS232", "comName3"); - - this.cbbps.Text = bps; - chbEnable0.Checked = comEnable0; - chbEnable1.Checked = comEnable1; - chbEnable2.Checked = comEnable2; - chbEnable3.Checked = comEnable3; - this.txtWeightComName0.Text = comName0; - this.txtWeightComName1.Text = comName1; - this.txtWeightComName2.Text = comName2; - this.txtWeightComName3.Text = comName3; - + this.cbbps.Text = ini.ReadString("weight_RS232", "baud"); + this.txtWeightComName.Text = ini.ReadString("weight_RS232", "comName"); + this.txtSetSingleUpperLimit.Text = ini.ReadString("weight_RS232", "setSingleUpperLimit"); + this.txtSetAdjustmentUpperLimit.Text = ini.ReadString("weight_RS232", "setAdjustmentUpperLimit"); + this.txtSetStandardWeight.Text = ini.ReadString("weight_RS232", "setStandardWeight"); + this.txtSetAdjustmentLowerLimit.Text = ini.ReadString("weight_RS232", "setAdjustmentLowerLimit"); + this.txtSetSingleLowerLimit.Text = ini.ReadString("weight_RS232", "setSingleLowerLimit"); + this.CenterToParent(); } private void ChbEnable_CheckedChanged(object sender = null, EventArgs e = null) { - txtWeightComName0.Enabled = chbEnable0.Checked; - txtWeightComName1.Enabled = chbEnable1.Checked; - txtWeightComName2.Enabled = chbEnable2.Checked; - txtWeightComName3.Enabled = chbEnable3.Checked; + } private void btnCancel_Click(object sender, EventArgs e) @@ -65,38 +46,52 @@ namespace ZWGXPICK_SYS private void btnOK_Click(object sender, EventArgs e) { - - string bps = cbbps.Text; - bool comEnable0 = chbEnable0.Checked; - bool comEnable1 = chbEnable1.Checked; - bool comEnable2 = chbEnable2.Checked; - bool comEnable3 = chbEnable3.Checked; - string comName0 = txtWeightComName0.Text; - string comName1 = txtWeightComName1.Text; - string comName2 = txtWeightComName2.Text; - string comName3 = txtWeightComName3.Text; - - if (string.IsNullOrEmpty(bps) || - (comEnable0 && string.IsNullOrEmpty(comName0)) || - (comEnable1 && string.IsNullOrEmpty(comName1)) || - (comEnable2 && string.IsNullOrEmpty(comName2)) || - (comEnable3 && string.IsNullOrEmpty(comName3))) + if (string.IsNullOrEmpty(this.cbbps.Text.Trim()) || !int.TryParse(this.cbbps.Text.Trim(),out var cbbps) && cbbps>0) + { + MessageBox.Show("【波特率】配置不正确,请输入正确的配置信息!"); + return; + } + if (string.IsNullOrEmpty(this.txtWeightComName.Text.Trim())) + { + MessageBox.Show("【设备端口】配置不正确,请输入正确的配置信息!"); + return; + } + if (string.IsNullOrEmpty(this.txtSetSingleUpperLimit.Text.Trim()) || !decimal.TryParse(this.txtSetSingleUpperLimit.Text.Trim(), out var setSingleUpperLimit)) { - MessageBox.Show("对不起,称重设备配置不正确,请输入正确的配置信息!"); + MessageBox.Show("【设置单重上限】配置不正确,请输入正确的配置信息!"); + return; + } + if (string.IsNullOrEmpty(this.txtSetAdjustmentUpperLimit.Text.Trim()) || !decimal.TryParse(this.txtSetAdjustmentUpperLimit.Text.Trim(), out var setAdjustmentUpperLimit)) + { + MessageBox.Show("【设置调整上限】配置不正确,请输入正确的配置信息!"); + return; + } + if (string.IsNullOrEmpty(this.txtSetStandardWeight.Text.Trim()) || !decimal.TryParse(this.txtSetStandardWeight.Text.Trim(), out var setStandardWeight)) + { + MessageBox.Show("【设置标准重量】配置不正确,请输入正确的配置信息!"); + return; + } + if (string.IsNullOrEmpty(this.txtSetAdjustmentLowerLimit.Text.Trim()) || !decimal.TryParse(this.txtSetAdjustmentLowerLimit.Text.Trim(), out var setAdjustmentLowerLimit)) + { + MessageBox.Show("【设置调整下限】配置不正确,请输入正确的配置信息!"); + return; + } + if (string.IsNullOrEmpty(this.txtSetSingleLowerLimit.Text.Trim()) || !decimal.TryParse(this.txtSetSingleLowerLimit.Text.Trim(), out var setSingleLowerLimit)) + { + MessageBox.Show("【设置单重下限】配置不正确,请输入正确的配置信息!"); return; } // try to initialize the content value item data. IniFile ini = new IniFile(PubConstant.config_file); - ini.WriteString("weight_RS232", "baud", bps); - ini.WriteBool("weight_RS232", "comEnable0", comEnable0); - ini.WriteBool("weight_RS232", "comEnable1", comEnable1); - ini.WriteBool("weight_RS232", "comEnable2", comEnable2); - ini.WriteBool("weight_RS232", "comEnable3", comEnable3); - ini.WriteString("weight_RS232", "comName0", comName0); - ini.WriteString("weight_RS232", "comName1", comName1); - ini.WriteString("weight_RS232", "comName2", comName2); - ini.WriteString("weight_RS232", "comName3", comName3); + ini.WriteString("weight_RS232", "baud", this.cbbps.Text.Trim()); + ini.WriteString("weight_RS232", "comName", this.txtWeightComName.Text.Trim()); + ini.WriteString("weight_RS232", "setSingleUpperLimit", this.txtSetSingleUpperLimit.Text.Trim()); + ini.WriteString("weight_RS232", "setAdjustmentUpperLimit", this.txtSetAdjustmentUpperLimit.Text.Trim()); + ini.WriteString("weight_RS232", "setStandardWeight", this.txtSetStandardWeight.Text.Trim()); + ini.WriteString("weight_RS232", "setAdjustmentLowerLimit", this.txtSetAdjustmentLowerLimit.Text.Trim()); + ini.WriteString("weight_RS232", "setSingleLowerLimit", this.txtSetSingleLowerLimit.Text.Trim()); + this.Close(); } } diff --git a/ZWGXPICK_SYS/packages.config b/ZWGXPICK_SYS/packages.config new file mode 100644 index 0000000..719f5e4 --- /dev/null +++ b/ZWGXPICK_SYS/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file