diff --git a/.vs/C-Windows-LL18/FileContentIndex/ae558d18-5550-44ac-b4d2-d179e70a583f.vsidx b/.vs/C-Windows-LL18/FileContentIndex/0e8f1873-800f-4906-9f91-ace5e4d4ccf3.vsidx similarity index 98% rename from .vs/C-Windows-LL18/FileContentIndex/ae558d18-5550-44ac-b4d2-d179e70a583f.vsidx rename to .vs/C-Windows-LL18/FileContentIndex/0e8f1873-800f-4906-9f91-ace5e4d4ccf3.vsidx index 3540a41..b383612 100644 Binary files a/.vs/C-Windows-LL18/FileContentIndex/ae558d18-5550-44ac-b4d2-d179e70a583f.vsidx and b/.vs/C-Windows-LL18/FileContentIndex/0e8f1873-800f-4906-9f91-ace5e4d4ccf3.vsidx differ diff --git a/.vs/C-Windows-LL18/v17/.suo b/.vs/C-Windows-LL18/v17/.suo index 6648883..c4fee3d 100644 Binary files a/.vs/C-Windows-LL18/v17/.suo and b/.vs/C-Windows-LL18/v17/.suo differ diff --git a/.vs/C-Windows-LL18/v17/DocumentLayout.json b/.vs/C-Windows-LL18/v17/DocumentLayout.json index e98c415..287d766 100644 --- a/.vs/C-Windows-LL18/v17/DocumentLayout.json +++ b/.vs/C-Windows-LL18/v17/DocumentLayout.json @@ -10,14 +10,17 @@ "AbsoluteMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\c-windows-1\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form", "RelativeMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|solutionrelative:c-windows-1\\form1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form" }, - { - "AbsoluteMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\c-windows-1\\form2.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form", - "RelativeMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|solutionrelative:c-windows-1\\form2.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form" - }, { "AbsoluteMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\c-windows-1\\form1.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|solutionrelative:c-windows-1\\form1.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, + { + "AbsoluteMoniker": "D:0:0:{00000000-0000-0000-0000-000000000000}|\u003CSolution\u003E|C-Windows-LL18||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|" + }, + { + "AbsoluteMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\c-windows-1\\form2.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form", + "RelativeMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|solutionrelative:c-windows-1\\form2.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form" + }, { "AbsoluteMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\c-windows-1\\portsetting.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0}|C-Windows-1\\C-Windows-LL18.csproj|solutionrelative:c-windows-1\\portsetting.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -94,7 +97,7 @@ }, { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 5, "Title": "PortSetting.cs", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\PortSetting.cs", "RelativeDocumentMoniker": "C-Windows-1\\PortSetting.cs", @@ -106,7 +109,7 @@ }, { "$type": "Document", - "DocumentIndex": 6, + "DocumentIndex": 7, "Title": "TestPara.cs", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\TestPara.cs", "RelativeDocumentMoniker": "C-Windows-1\\TestPara.cs", @@ -118,7 +121,7 @@ }, { "$type": "Document", - "DocumentIndex": 5, + "DocumentIndex": 6, "Title": "TestPara.cs [\u8BBE\u8BA1]", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\TestPara.cs", "RelativeDocumentMoniker": "C-Windows-1\\TestPara.cs", @@ -135,14 +138,14 @@ "RelativeDocumentMoniker": "C-Windows-1\\Form1.cs", "ToolTip": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\Form1.cs", "RelativeToolTip": "C-Windows-1\\Form1.cs", - "ViewState": "AQIAAL4CAAAAAAAAAAAAAN8CAABFAAAA", + "ViewState": "AQIAAHYJAAAAAAAAAAAAAH0JAAAJAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2025-08-25T06:50:09.212Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 10, + "DocumentIndex": 11, "Title": "Form4.cs [\u8BBE\u8BA1]", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\Form4.cs", "RelativeDocumentMoniker": "C-Windows-1\\Form4.cs", @@ -153,7 +156,7 @@ }, { "$type": "Document", - "DocumentIndex": 11, + "DocumentIndex": 12, "Title": "Form3.cs [\u8BBE\u8BA1]", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\Form3.cs", "RelativeDocumentMoniker": "C-Windows-1\\Form3.cs", @@ -164,7 +167,7 @@ }, { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 4, "Title": "Form2.cs [\u8BBE\u8BA1]", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\Form2.cs", "RelativeDocumentMoniker": "C-Windows-1\\Form2.cs", @@ -187,20 +190,31 @@ }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 2, "Title": "Form1.Designer.cs", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\Form1.Designer.cs", "RelativeDocumentMoniker": "C-Windows-1\\Form1.Designer.cs", "ToolTip": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\Form1.Designer.cs", "RelativeToolTip": "C-Windows-1\\Form1.Designer.cs", - "ViewState": "AQIAAN0HAAAAAAAAAAAnwAoIAAAAAAAA", + "ViewState": "AQIAAOQEAAAAAAAAAAAswPcEAAAAAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2025-08-26T01:40:53.942Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 3, + "Title": "C-Windows-LL18", + "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\C-Windows-LL18.csproj", + "RelativeDocumentMoniker": "C-Windows-1\\C-Windows-LL18.csproj", + "ToolTip": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\C-Windows-LL18.csproj", + "RelativeToolTip": "C-Windows-1\\C-Windows-LL18.csproj", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|", + "WhenOpened": "2025-11-20T02:50:48.456Z" + }, + { + "$type": "Document", + "DocumentIndex": 8, "Title": "PortSetting.cs [\u8BBE\u8BA1]", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\PortSetting.cs", "RelativeDocumentMoniker": "C-Windows-1\\PortSetting.cs", @@ -211,7 +225,7 @@ }, { "$type": "Document", - "DocumentIndex": 9, + "DocumentIndex": 10, "Title": "JsonConfig.cs", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\JsonConfig.cs", "RelativeDocumentMoniker": "C-Windows-1\\JsonConfig.cs", @@ -223,7 +237,7 @@ }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 9, "Title": "TestPara.Designer.cs", "DocumentMoniker": "D:\\\u684C\u9762\\\u83AB\u79A7\u4EAE\\\u9E3F\u6D77\\LL-18\\C-Windows-1\\TestPara.Designer.cs", "RelativeDocumentMoniker": "C-Windows-1\\TestPara.Designer.cs", diff --git a/C-Windows-1/C-Windows-LL18.csproj b/C-Windows-1/C-Windows-LL18.csproj index 5107f82..026388f 100644 --- a/C-Windows-1/C-Windows-LL18.csproj +++ b/C-Windows-1/C-Windows-LL18.csproj @@ -7,7 +7,7 @@ {A74FBD1F-1F9C-45CE-B3E2-6E80278C02B0} WinExe C_Windows_1 - LL18-Control + LL18-V25112001 v4.7.2 512 true diff --git a/C-Windows-1/Form1.Designer.cs b/C-Windows-1/Form1.Designer.cs index 988b79b..b141154 100644 --- a/C-Windows-1/Form1.Designer.cs +++ b/C-Windows-1/Form1.Designer.cs @@ -34,9 +34,6 @@ this.ReceiveText = new System.Windows.Forms.TextBox(); this.SendText = new System.Windows.Forms.TextBox(); this.Timer1 = new System.Windows.Forms.Timer(this.components); - this.Timer2 = new System.Windows.Forms.Timer(this.components); - this.Timer3 = new System.Windows.Forms.Timer(this.components); - this.Timer4 = new System.Windows.Forms.Timer(this.components); this.DataGridView1 = new System.Windows.Forms.DataGridView(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -58,10 +55,6 @@ this.pb_CH1progressBar = new System.Windows.Forms.ProgressBar(); this.label36 = new System.Windows.Forms.Label(); this.Manual = new System.Windows.Forms.LinkLabel(); - this.Timer8 = new System.Windows.Forms.Timer(this.components); - this.Timer9 = new System.Windows.Forms.Timer(this.components); - this.Timer10 = new System.Windows.Forms.Timer(this.components); - this.Timer16 = new System.Windows.Forms.Timer(this.components); this.lb_CH1yiqiStatus = new System.Windows.Forms.Label(); this.lb_CH1Result = new System.Windows.Forms.Label(); this.label31 = new System.Windows.Forms.Label(); @@ -96,7 +89,6 @@ this.lb_CH1LeakPressure = new System.Windows.Forms.Label(); this.lb_CH1Leak = new System.Windows.Forms.Label(); this.ChkCSV = new System.Windows.Forms.CheckBox(); - this.Timer11 = new System.Windows.Forms.Timer(this.components); this.chk_CodeLengthSwitch = new System.Windows.Forms.CheckBox(); this.tb_CodeLength = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); @@ -260,18 +252,6 @@ // this.Timer1.Tick += new System.EventHandler(this.Timer1_Tick); // - // Timer2 - // - this.Timer2.Tick += new System.EventHandler(this.Timer2_Tick); - // - // Timer3 - // - this.Timer3.Tick += new System.EventHandler(this.Timer3_Tick); - // - // Timer4 - // - this.Timer4.Tick += new System.EventHandler(this.Timer4_Tick); - // // DataGridView1 // this.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; @@ -417,22 +397,6 @@ this.Manual.Visible = false; this.Manual.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.Manual_LinkClicked); // - // Timer8 - // - this.Timer8.Tick += new System.EventHandler(this.timer8_Tick); - // - // Timer9 - // - this.Timer9.Tick += new System.EventHandler(this.Timer9_Tick); - // - // Timer10 - // - this.Timer10.Tick += new System.EventHandler(this.Timer10_Tick); - // - // Timer16 - // - this.Timer16.Tick += new System.EventHandler(this.Timer16_Tick); - // // lb_CH1yiqiStatus // this.lb_CH1yiqiStatus.AutoSize = true; @@ -615,7 +579,6 @@ this.menuStrip1.Size = new System.Drawing.Size(1028, 25); this.menuStrip1.TabIndex = 126; this.menuStrip1.Text = "menuStrip1"; - this.menuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuStrip1_ItemClicked); // // 登录ToolStripMenuItem // @@ -763,10 +726,6 @@ this.ChkCSV.Text = "导出到csv"; this.ChkCSV.UseVisualStyleBackColor = true; // - // Timer11 - // - this.Timer11.Tick += new System.EventHandler(this.Timer11_Tick); - // // chk_CodeLengthSwitch // this.chk_CodeLengthSwitch.AutoSize = true; @@ -809,7 +768,6 @@ this.Scancode.Text = "扫码启动"; this.Scancode.UseVisualStyleBackColor = true; this.Scancode.Visible = false; - this.Scancode.CheckedChanged += new System.EventHandler(this.Scancode_CheckedChanged); // // groupBox1 // @@ -865,7 +823,6 @@ this.Sunzong.Size = new System.Drawing.Size(23, 16); this.Sunzong.TabIndex = 1; this.Sunzong.Text = "10"; - this.Sunzong.Click += new System.EventHandler(this.label29_Click); // // label28 // @@ -991,7 +948,6 @@ this.button1.TabIndex = 175; this.button1.Text = "充气"; this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click_1); // // groupBox2 // @@ -2118,7 +2074,7 @@ this.Controls.Add(this.groupBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; - this.Text = "LL18-V25092403"; + this.Text = "LL18-V25112001"; this.Activated += new System.EventHandler(this.Form1_Activated); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); @@ -2150,9 +2106,6 @@ private System.Windows.Forms.TextBox SendText; private System.Windows.Forms.Button bt_CH1yiqiStart; private System.Windows.Forms.Label label8; - private System.Windows.Forms.Timer Timer2; - private System.Windows.Forms.Timer Timer3; - private System.Windows.Forms.Timer Timer4; private System.Windows.Forms.Label lb_CH1Result; private System.Windows.Forms.Button bt_CH1yiqiReset; private System.Windows.Forms.DataGridView DataGridView1; @@ -2182,7 +2135,6 @@ private System.Windows.Forms.Label label4; private System.Windows.Forms.LinkLabel Manual; private System.Windows.Forms.Label label36; - private System.Windows.Forms.Timer Timer8; private System.Windows.Forms.ProgressBar pb_CH1progressBar; private System.Windows.Forms.TextBox BypassTIme; private System.Windows.Forms.Label label38; @@ -2196,7 +2148,6 @@ private System.Windows.Forms.Label label45; private System.Windows.Forms.TextBox Evolume; private System.Windows.Forms.Label label14; - private System.Windows.Forms.Timer Timer9; private System.Windows.Forms.Label lb_CH1PressureUnit; private System.Windows.Forms.Label lb_CH1LeakUnit; private MyGroupBox GroupBox_CH1; @@ -2208,8 +2159,6 @@ private System.Windows.Forms.Label label52; private System.Windows.Forms.TextBox SBalanTime; private System.Windows.Forms.TextBox BBalanTime; - private System.Windows.Forms.Timer Timer10; - private System.Windows.Forms.Timer Timer16; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem 登录ToolStripMenuItem; public System.Windows.Forms.ToolStripMenuItem 修改密码ToolStripMenuItem; @@ -2260,7 +2209,6 @@ private System.Windows.Forms.Label label27; public System.Windows.Forms.TextBox URL; public System.Windows.Forms.CheckBox ChkCSV; - private System.Windows.Forms.Timer Timer11; public System.Windows.Forms.TextBox Baudrate; private System.Windows.Forms.Label label9; private System.Windows.Forms.CheckBox Scancode; diff --git a/C-Windows-1/Form1.cs b/C-Windows-1/Form1.cs index ad054bb..413c188 100644 --- a/C-Windows-1/Form1.cs +++ b/C-Windows-1/Form1.cs @@ -20,6 +20,7 @@ using NPOI.SS.UserModel; using NPOI.HSSF.UserModel; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; using System.Runtime.InteropServices; +using System.Collections.Generic; namespace C_Windows_1 { @@ -33,7 +34,6 @@ namespace C_Windows_1 [DllImport("ATS_Station_Managment.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int ATS_InsertDataRow_JIG_V2(string strlinename, string strbatch, string strlocation, string strstation, string strsn, int iresult, string errorinfo, string JIG_Number, string strswversion, string strremark, string strkeys, string strvalues); - public int stage = 10; private int write = 0; private string timestamp; @@ -66,7 +66,6 @@ namespace C_Windows_1 public static string tablename; string CODE; - public Form1() { f1 = this; @@ -75,7 +74,6 @@ namespace C_Windows_1 } //窗口自适应分辨率 - private void setTag(Control cons) { foreach (Control con in cons.Controls) @@ -134,143 +132,22 @@ namespace C_Windows_1 finish,//完成(导出数据)4 writedate,//写入数据 5 standby,//待机 6 - }; - private void CodePort1_DataReceived(object sender, SerialDataReceivedEventArgs e) + + //UInt16转float + public static float TwoUInt16ToFloat(UInt16 high, UInt16 low) { - try - { - System.Threading.Thread.Sleep(50); - if (!CodePort1.IsOpen) return; - int len = CodePort1.BytesToRead;//获取可以读取的字节数 - if (lb_CH1yiqiStatus.Text == "测试中") - { - CodePort1.DiscardInBuffer(); - } - else if (len > 1) - { - byte[] buff = new byte[len];//创建缓存数据数组 - CodePort1.Read(buff, 0, len);//把数据读取到buff数组 - Invoke((new System.Action(() => //接收计数 - { - string code = Encoding.Default.GetString(buff); - if (!code.Contains("ERROR")) - { - tb_CH1Code.Text = string.Empty; - CodeJudge(code, 1); - } - - - //CodePort1.DiscardInBuffer(); - }))); - } - else - { - return; - } - } - catch (Exception ex) - { - //MessageBox.Show("Code:" + ex.Message); - MessageBox.Show(ex.StackTrace); - } - } - - private void CodeJudge(string code, int ch) - { - if (ch == 1) - { - tb_CH1Code.Text = code.Replace("/r", "").Replace("/n", "").Replace("/r/n", "").Replace("\r", "").Replace("\n", "").Replace("\r\n", ""); - } - } - - - //UInt16转float - public static float TwoUInt16ToFloat(UInt16 high, UInt16 low) - { - Int32 sum = (high << 16) + (low & 0XFFFF); byte[] bs = BitConverter.GetBytes(sum); float f1 = BitConverter.ToSingle(BitConverter.GetBytes(sum), 0); return f1; - } - - //Int16转float - public static float TwoInt16ToFloat(Int16 high, Int16 low) - { - - Int32 sum = (high << 16) + (low & 0XFFFF); - byte[] bs = BitConverter.GetBytes(sum); - float f2 = BitConverter.ToSingle(BitConverter.GetBytes(sum), 0); - return f2; - - } - - - - - public static float ByteToFloat(byte[] bytes) - { - if (bytes.Length != 4) - return float.MinValue; - return BitConverter.ToSingle(bytes, 0); - } public int workstation; public int workstation2; - //public void Booltomath(int sta, UInt16[] shangweiji) - //{ - // try - // { - // OperateResult reslutget; - // reslutget = CH1.ReadBool(Convert.ToString(sta)); - // if (reslutget.IsSuccess == true) - // { - // if (reslutget.Content == true) - // { - // shangweiji[sta] = 1; - // } - // else - // { - // shangweiji[sta] = 0; - // } - // } - // } - // catch (Exception) - // { - // throw; - // } - //} - - //public void Booltomath2(int sta, UInt16[] shangweiji) - //{ - // try - // { - // OperateResult reslutget; - // reslutget = CH2.ReadBool(Convert.ToString(sta)); - // if (reslutget.IsSuccess == true) - // { - // if (reslutget.Content == true) - // { - // shangweiji[sta] = 1; - // } - // else - // { - // shangweiji[sta] = 0; - // } - // } - // } - // catch (Exception) - // { - // throw; - // } - //} - - //sta 起始寄存器 //number 读取数量 //shangweiji 存入数组 @@ -336,7 +213,6 @@ namespace C_Windows_1 } } - public void ModbusRtuint(int CH, ModbusRtu X, byte station, string COM, int Bund, int numberbit, StopBits stopbit, Parity parity) { try @@ -346,7 +222,6 @@ namespace C_Windows_1 X.SerialPortInni(COM, Bund, numberbit, stopbit, parity); X.Open(); X.ReceiveTimeout = 300; - } catch (Exception ex) { @@ -362,96 +237,62 @@ namespace C_Windows_1 lb_CH2ConnectionStatus.ForeColor = Color.Red; } } - } - /* - public void machine()//主要负责测试数据读取,写入 + + public void CH1machine()//主要负责测试数据读取,写入 { switch (workstation) { case (int)yiqi.start: - - operateResult22 = CH1.WriteCoil("208", true); + operateResult22 = CH1.WriteCoil("540", true); if (operateResult22.IsSuccess) { - workstation = (int)yiqi.prepare; + workstation = (int)yiqi.prepare; } - break; case (int)yiqi.rst: - //byte[] data2 = new byte[] { 0xff, 0x00 }; operateResult21 = CH1.WriteCoil("86", true); - //Console.WriteLine("当前是复位状态"); - ////点击复位进度条置为0 - pb_CH1progressBar.Value = 0; - //MachineStatus.Text = "复位"; - //LeakPressure.Text = ""; - //Leak.Text = ""; - //label2.Text = ""; - //Tlight.Text = ""; + + pb_CH1progressBar.Value = 0; if (operateResult21.IsSuccess) { - workstation = (int)yiqi.standby; + workstation = (int)yiqi.standby; } - - break; - //return workstation; - - case (int)yiqi.prepare://读取检测时间,充气,平衡检测 //扫码枪处理 上传 - tb_CH1Code.Enabled = false; + case (int)yiqi.prepare: ReadData[9] = 0; operateResult21 = Modbusread(25, 6, ReadData); lb_CH1Result.Text = ""; - CODE= tb_CH1Code.Text = PreCode1.Text; - PreCode1.Text=""; if (operateResult21.IsSuccess == true) { int aaa; aaa = ReadData[25] + ReadData[26] + ReadData[27] + ReadData[28] + ReadData[30]; pb_CH1progressBar.Value = 0; pb_CH1progressBar.Maximum = aaa; - Modbusread(8, 1, ReadData); - if (operateResult21.IsSuccess == true) - { - if(ReadData[8]!=0) - { - workstation = (int)yiqi.test; - } - else - { - workstation = (int)yiqi.standby; - } - } + workstation = (int)yiqi.test; } break; - case (int)yiqi.test://读取检测数据以及判断仪器是否结束 - //operateResult21=Modbusread(170, 23, ReadData); + case (int)yiqi.test: Modbusread(8, 2, ReadData); Modbusread(16, 4, ReadData); - - Modbusread(25, 12, ReadData); - Modbusread(37, 1, ReadData); - Modbusread(38, 12, ReadData); - //test(ReadData); + Modbusread(25, 24, ReadData); int ba = pb_CH1progressBar.Value + 2; if (ba >= pb_CH1progressBar.Maximum) ba = pb_CH1progressBar.Maximum; pb_CH1progressBar.Value = ba; - lb_CH1yiqiStatus.Text = "测试中"; - - //if (ReadData[8] != 0 && (ReadData[9] == 1 || ReadData[9] == 2))//当仪器状态位不为0且有结果时 - //{ - // workstation = (int)yiqi.finish; - // //return workstation; - //} + + if (ReadData[8] != 0 && (ReadData[9] == 1 || ReadData[9] == 2))//当仪器状态位不为0且有结果时 + { + workstation = (int)yiqi.finish; + } + if (ReadData[8] == 0) { - System.Threading.Thread.Sleep(200); + System.Threading.Thread.Sleep(300); Modbusread(8, 2, ReadData); if (ReadData[9] == 1 || ReadData[9] == 2) { @@ -463,293 +304,10 @@ namespace C_Windows_1 workstation = (int)yiqi.standby; } } - break; - - - case (int)yiqi.standby://读取仪器是否启动 - + case (int)yiqi.standby: Modbusread(8, 2, ReadData); - lb_CH1yiqiStatus.Text = "待机中"; - if (ReadData[8] != 0 && ReadData[9] == 0) - { - workstation = (int)yiqi.prepare; - } - - break; - - - - case (int)yiqi.finish: - Modbusread(16, 4, ReadData); - pb_CH1progressBar.Value = pb_CH1progressBar.Maximum; - - DataGridView1.Invoke(new System.Action(Display)); - //Display(); - CreateFile(); - //UpMES(1); - - - tb_CH1Code.Clear(); - CODE = ""; - tb_CH1Code.Enabled = true; - tb_CH1Code.Focus(); - workstation = (int)yiqi.standby; - - - - break; - - default: - break; - //return 0;break; - - - } - //} - // ))); - } - - public void MachineDisplay2()//UI层,吧相应的文本赋值.17.58 - { - switch (workstation) - { - case (int)yiqi.start: - - lb_CH1yiqiStatus.Text = "开始测试"; - - break; - case (int)yiqi.rst: - lb_CH1yiqiStatus.Text = "复位"; - lb_CH1LeakPressure.Text = ""; - lb_CH1Leak.Text = ""; - label2.Text = ""; - lb_CH1Result.Text = ""; - - break; - case (int)yiqi.standby://把状态文本改成文本 - lb_CH1yiqiStatus.Text = "待机中"; - - // Tlight.Text = ""; - break; - - case (int)yiqi.prepare://把状态文本改成文本 - lb_CH1Result.Text = ""; - break; - - case (int)yiqi.test: - lb_CH1yiqiStatus.Text = "测试中"; - - //判断单位 - switch (ReadData[41])// - { - case 1: - lb_CH1PressureUnit.Text = "KPa"; - - break; - case 2: - - lb_CH1PressureUnit.Text = "bar"; - - - break; - case 0: - lb_CH1PressureUnit.Text = "Pa"; - - break; - case 3: - - lb_CH1PressureUnit.Text = "atm"; - - - break; - case 4: - - lb_CH1PressureUnit.Text = "psi"; - - - break; - case 5: - - lb_CH1PressureUnit.Text = "mmHg"; - - - - break; - } - - switch (ReadData[40]) - { - case 0: - - lb_CH1LeakUnit.Text = "Pa"; - break; - - case 1: - - lb_CH1LeakUnit.Text = "Kpa"; - break; - - case 2: - - - lb_CH1LeakUnit.Text = "mbar"; - break; - - case 3: - - lb_CH1LeakUnit.Text = "atm"; - break; - - case 4: - - lb_CH1LeakUnit.Text = "sccm"; - break; - - case 5: - - lb_CH1LeakUnit.Text = "Pa·m3/s"; - - break; - - case 6: - - lb_CH1LeakUnit.Text = "Pa/s"; - break; - } - if (ReadData[9] == 2) - { - - lb_CH1Result.Text = "NG"; - lb_CH1Result.ForeColor = Color.Red; - } - if (ReadData[9] == 1) - { - lb_CH1Result.Text = "OK"; - lb_CH1Result.ForeColor = Color.Green; - } - //CH1文本框读取的压力和泄漏量 - lb_CH1LeakPressure.Text = TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString(); - lb_CH1Leak.Text = TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"); - - break; - - case (int)yiqi.finish: - pb_CH1progressBar.Value = pb_CH1progressBar.Maximum; - if (ReadData[9] == 2) - { - lb_CH1Result.Enabled = true; - lb_CH1Result.Visible = true; - lb_CH1Result.Text = "NG"; - lb_CH1Result.ForeColor = Color.Red; - } - // if(ReadData[60] == 1 && ReadData[61] == 1) - //{ - // Tlight.Text = "OK"; - // Tlight.ForeColor = Color.Green; - // Tlight2.Text = "OK"; - // Tlight2.ForeColor = Color.Green; - //} - if (ReadData[9] == 1) - { - lb_CH1Result.Text = "OK"; - lb_CH1Result.ForeColor = Color.Green; - } - lb_CH1LeakPressure.Text = TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString(); - lb_CH1Leak.Text = TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"); - lb_CH1yiqiStatus.Text = "测试结束"; - - - break; - default: break; - - } - } - */ - - public void CH1machine()//主要负责测试数据读取,写入 - { - switch (workstation) - { - case (int)yiqi.start: - operateResult22 = CH1.WriteCoil("540", true); - //MachineStatus.Text = "开始测试"; - ////Console.WriteLine("当前是启动状态"); - if (operateResult22.IsSuccess) - { - // operateResult22 = CH1.WriteCoil("85", false); - workstation = (int)yiqi.prepare; - } - break; - - case (int)yiqi.rst: - operateResult21 = CH1.WriteCoil("86", true); - - //点击复位进度条置为0 - pb_CH1progressBar.Value = 0; - if (operateResult21.IsSuccess) - { - workstation = (int)yiqi.standby; - } - break; - - case (int)yiqi.prepare://读取检测时间,充气,平衡检测 //扫码枪处理 上传 - ReadData[9] = 0; - operateResult21 = Modbusread(25, 6, ReadData); - lb_CH1Result.Text = ""; - if (operateResult21.IsSuccess == true) - { - int aaa; - aaa = ReadData[25] + ReadData[26] + ReadData[27] + ReadData[28] + ReadData[30]; - pb_CH1progressBar.Value = 0; - pb_CH1progressBar.Maximum = aaa; - //进度条开始,满值是a,一秒进10; - // - workstation = (int)yiqi.test; - } - break; - - case (int)yiqi.test://读取检测数据以及判断仪器是否结束 - //operateResult21=Modbusread(170, 23, ReadData); - Modbusread(8, 2, ReadData); - Modbusread(16, 4, ReadData); - Modbusread(25, 24, ReadData); - //Booltomath(8, ReadData); - //Booltomath(9, ReadData); - int ba = pb_CH1progressBar.Value + 2; - if (ba >= pb_CH1progressBar.Maximum) - ba = pb_CH1progressBar.Maximum; - pb_CH1progressBar.Value = ba; - - - if (ReadData[8] != 0 && (ReadData[9] == 1 || ReadData[9] == 2))//当仪器状态位不为0且有结果时 - { - workstation = (int)yiqi.finish; - - } - if (ReadData[8] == 0) - { - System.Threading.Thread.Sleep(300); - Modbusread(8, 2, ReadData); - //Booltomath(9, ReadData); - if (ReadData[9] == 1 || ReadData[9] == 2) - { - workstation = (int)yiqi.finish; - } - else - { - pb_CH1progressBar.Value = 0; - workstation = (int)yiqi.standby; - } - } - break; - - case (int)yiqi.standby://读取仪器是否启动 - Modbusread(8, 2, ReadData); - //Booltomath(8, ReadData); - //Booltomath(9, ReadData); - //MachineStatus.Text = "待机中"; if (ReadData[8] != 0 && ReadData[9] == 0) { workstation = (int)yiqi.prepare; @@ -758,21 +316,12 @@ namespace C_Windows_1 case (int)yiqi.finish: Modbusread(8, 2, ReadData); - //Booltomath(8, ReadData); - //Booltomath(9, ReadData); Modbusread(16, 4, ReadData); pb_CH1progressBar.Value = pb_CH1progressBar.Maximum; Display(1, tb_CH1Code.Text); CreateFile(1, tb_CH1Code.Text); - //Passzong.Text = ChanPass.ToString(); - //Sunzong.Text = ChanSum.ToString(); - //string path = System.Environment.CurrentDirectory + "\\Config\\Config.ini"; - //ConfigINI config = new ConfigINI(path); - //config.IniWriteValue("Config", "Passzong", Passzong.Text); - //config.IniWriteValue("Config", "Sunzong", Sunzong.Text); tb_CH1Code.Clear(); workstation = (int)yiqi.standby; - break; default: @@ -780,7 +329,7 @@ namespace C_Windows_1 } } - public void CH1MachineDisplay()//UI层,吧相应的文本赋值.17.58 + public void CH1MachineDisplay() { switch (workstation) { @@ -798,13 +347,12 @@ namespace C_Windows_1 lb_CH1Result.Text = ""; break; - case (int)yiqi.standby://把状态文本改成文本 + case (int)yiqi.standby: lb_CH1yiqiStatus.Text = "待机中"; tb_CH1Code.Enabled = true; - // Tlight.Text = ""; break; - case (int)yiqi.prepare://把状态文本改成文本 + case (int)yiqi.prepare: lb_CH1Result.Text = ""; textBox3.Text = ""; textBox3.BackColor = Color.White; @@ -813,9 +361,7 @@ namespace C_Windows_1 case (int)yiqi.test: lb_CH1yiqiStatus.Text = "测试中"; - - //判断单位 - switch (ReadData[41])// + switch (ReadData[41]) { case 1: lb_CH1PressureUnit.Text = "KPa"; break; case 2: lb_CH1PressureUnit.Text = "bar"; break; @@ -847,14 +393,13 @@ namespace C_Windows_1 lb_CH1Result.ForeColor = Color.Green; } - //CH1文本框读取的压力和泄漏量 + // CH1文本框读取的压力和泄漏量 lb_CH1LeakPressure.Text = TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString("f3"); lb_CH1Leak.Text = TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"); break; case (int)yiqi.finish: - //progressBar2.Value = progressBar2.Maximum; if (ReadData[9] == 2) { lb_CH1Result.Text = "NG"; @@ -872,19 +417,18 @@ namespace C_Windows_1 lb_CH1yiqiStatus.Text = "测试结束"; break; + default: break; } } - public void CH2machine()//主要负责测试数据读取,写入 + public void CH2machine() { switch (workstation2) { case (int)yiqi.start: OperateResult operateResult = CH2.WriteCoil("540", true); - //MachineStatus.Text = "开始测试"; - ////Console.WriteLine("当前是启动状态"); if (operateResult.IsSuccess) { workstation2 = (int)yiqi.prepare; @@ -894,7 +438,6 @@ namespace C_Windows_1 case (int)yiqi.rst: OperateResult operateResult86 = CH2.WriteCoil("86", true); - //点击复位进度条置为0 pb_CH2progressBar.Value = 0; if (operateResult86.IsSuccess) { @@ -902,7 +445,7 @@ namespace C_Windows_1 } break; - case (int)yiqi.prepare://读取检测时间,充气,平衡检测 //扫码枪处理 上传 + case (int)yiqi.prepare: ReadData2[9] = 0; OperateResult operateResult25 = Modbusread2(25, 6, ReadData2); lb_CH2Result.Text = ""; @@ -912,24 +455,21 @@ namespace C_Windows_1 aaa = ReadData2[25] + ReadData2[26] + ReadData2[27] + ReadData2[28] + ReadData2[30]; pb_CH2progressBar.Value = 0; pb_CH2progressBar.Maximum = aaa; - //进度条开始,满值是a,一秒进10; workstation2 = (int)yiqi.test; } break; - case (int)yiqi.test://读取检测数据以及判断仪器是否结束 - //operateResult21=Modbusread2(170, 23, ReadData2); + case (int)yiqi.test: Modbusread2(8, 2, ReadData2); Modbusread2(16, 4, ReadData2); Modbusread2(25, 24, ReadData2); - //Booltomath2(8, ReadData2); - //Booltomath2(9, ReadData2); + int ba = pb_CH2progressBar.Value + 2; if (ba >= pb_CH2progressBar.Maximum) ba = pb_CH2progressBar.Maximum; pb_CH2progressBar.Value = ba; - if (ReadData2[8] != 0 && (ReadData2[9] == 1 || ReadData2[9] == 2))//当仪器状态位不为0且有结果时 + if (ReadData2[8] != 0 && (ReadData2[9] == 1 || ReadData2[9] == 2)) // 当仪器状态位不为0且有结果时 { workstation2 = (int)yiqi.finish; } @@ -937,7 +477,6 @@ namespace C_Windows_1 { System.Threading.Thread.Sleep(300); Modbusread2(8, 2, ReadData2); - //Booltomath2(9, ReadData2); if (ReadData2[9] == 1 || ReadData2[9] == 2) { workstation2 = (int)yiqi.finish; @@ -950,11 +489,8 @@ namespace C_Windows_1 } break; - case (int)yiqi.standby://读取仪器是否启动 + case (int)yiqi.standby: Modbusread2(8, 2, ReadData2); - //Booltomath2(8, ReadData2); - //Booltomath2(9, ReadData2); - //MachineStatus.Text = "待机中"; if (ReadData2[8] != 0 && ReadData2[9] == 0) { workstation2 = (int)yiqi.prepare; @@ -963,15 +499,12 @@ namespace C_Windows_1 case (int)yiqi.finish: Modbusread2(8, 2, ReadData2); - //Booltomath2(8, ReadData2); - //Booltomath2(9, ReadData2); Modbusread2(16, 4, ReadData2); pb_CH2progressBar.Value = pb_CH2progressBar.Maximum; Display(2, tb_CH2Code.Text); CreateFile(2, tb_CH2Code.Text); tb_CH2Code.Clear(); workstation2 = (int)yiqi.standby; - break; default: @@ -979,7 +512,7 @@ namespace C_Windows_1 } } - public void CH2MachineDisplay()//UI层,吧相应的文本赋值.17.58 + public void CH2MachineDisplay() { switch (workstation2) { @@ -1011,7 +544,7 @@ namespace C_Windows_1 case (int)yiqi.test: lb_CH2yiqiStatus.Text = "测试中"; - //判断单位 + // 判断单位 switch (ReadData2[41]) { case 0: lb_CH2PressureUnit.Text = "Pa"; break; @@ -1044,14 +577,12 @@ namespace C_Windows_1 lb_CH2Result.ForeColor = Color.Green; } - //CH2文本框读取的压力和泄漏量 + // CH2文本框读取的压力和泄漏量 lb_CH2LeakPressure.Text = TwoUInt16ToFloat(ReadData2[17], ReadData2[16]).ToString("f3"); lb_CH2Leak.Text = TwoUInt16ToFloat(ReadData2[19], ReadData2[18]).ToString("f1"); - break; case (int)yiqi.finish: - //progressBar2.Value = progressBar2.Maximum; if (ReadData2[9] == 2) { lb_CH2Result.Text = "NG"; @@ -1069,6 +600,7 @@ namespace C_Windows_1 lb_CH2yiqiStatus.Text = "测试结束"; break; + default: break; } } @@ -1089,7 +621,6 @@ namespace C_Windows_1 { ConfigINI config = new ConfigINI(path); - this.JIG_Number1.Text = config.IniReadValue("Mes", "JIG_Number1"); this.strlinename.Text = config.IniReadValue("Mes", "strlinename"); this.strbatch.Text = config.IniReadValue("Mes", "strbatch"); @@ -1099,45 +630,20 @@ namespace C_Windows_1 } } - private void setcodeport() - { - try - { - - //设置端口的参数,包括波特率等 - SerialPort1.BaudRate = 9600; - SerialPort1.PortName = codeport; - SerialPort1.DataBits = 8; - SerialPort1.StopBits = System.IO.Ports.StopBits.One; - SerialPort1.Parity = System.IO.Ports.Parity.None; - SerialPort1.Open(); - - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - MessageBox.Show(ex.StackTrace); - } - } - - - - - //窗口初始化 private void Form1_Load(object sender, EventArgs e) { Control.CheckForIllegalCrossThreadCalls = false; - //窗口自适应分辨率 + // 窗口自适应分辨率 this.Resize += new EventHandler(Form1_Resize); X = this.Width; Y = this.Height; // y = this.statusStrip1.Height; setTag(this); - //界面初始化 + // 界面初始化 lb_CH1ConnectionStatus.Text = "未连接"; lb_CH1ConnectionStatus.ForeColor = Color.Red; @@ -1211,8 +717,8 @@ namespace C_Windows_1 workstation = (int)yiqi.standby; while (true) { - CH1machine();//仪器读取线程 - CH1MachineDisplay();//仪器显示线程 + CH1machine(); // 仪器读取线程 + CH1MachineDisplay(); // 仪器显示线程 } }); @@ -1248,40 +754,14 @@ namespace C_Windows_1 workstation2 = (int)yiqi.standby; while (true) { - CH2machine();//仪器读取线程 - CH2MachineDisplay();//仪器显示线程 + CH2machine(); // 仪器读取线程 + CH2MachineDisplay(); // 仪器显示线程 } }); } - public void ReadTIME() - { - RegistryKey regName; - regName = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\PMD\\1.0\\User-LL18-Set", true); - - if (regName is null) - { - regName = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\PMD\\1.0\\User-LL18-Set"); - } - - regName.OpenSubKey("User"); - - if (regName.GetValue("使用天数") is null) - { - Stipulatetime = 144;//三天的时间 - } - else - { - Stipulatetime = Convert.ToInt32(regName.GetValue("使用天数")); - } - - TIME = Convert.ToInt32(regName.GetValue("time")); - timeflag = Convert.ToInt32(regName.GetValue("timeflag")); - regName.Close(); - } - - //点击“连接串口”按钮,连接串口 + // 点击“连接串口”按钮,连接串口 private void BtnCon1_Click(object sender, EventArgs e) { try @@ -1307,12 +787,12 @@ namespace C_Windows_1 } } - //CH1关闭串口 + // CH1关闭串口 private void BtnBreak_Click(object sender, EventArgs e) { try { - if(CH1.IsOpen()) + if(CH1.IsOpen()) { CH1.Close(); } @@ -1372,631 +852,8 @@ namespace C_Windows_1 //} } - //十六进制接收 - public static string ByteToHexStr(byte[] bytes) - { - string returnStr = ""; - try - { - if (bytes != null) - { - for (int i = 0; i < bytes.Length; i++) - { - returnStr += bytes[i].ToString("X2");//每个字节转换成两位十六进制 - // returnStr += " ";//两个16进制用空格隔开,方便看数据 - } - } - return returnStr; - } - catch (Exception) - { - return returnStr; - } - } Log log = new Log(); - //根据变量判断仪器过程,对读取的数据进行不同的转换 - private void Stagenum() - { - //try - //{ - // switch (stage) - // { - // case 0://利用定时器进入状态位读取 - // Timer1.Interval = 100; - // Timer1.Start(); - // // Timer2.Interval = 10; - // // Timer2.Start(); - // stage = 1; - // break; - - // case 1://此时为状态位读取 - // string str1; - // str1 = ReceiveText.Text; - - // if (str1.Length >= 8 && str1.Substring(6, 2) == "01") - // { - // Timer1.Stop(); - // Timer2.Interval = 300; - // Timer2.Start(); - // MachineStatus.ForeColor = Color.Green; - // MachineStatus.Text = "启动中"; - // log.Logmsg(DateTime.Now.ToString("yyy-MM-dd HH:mm:ss")+"启动"); - // Tlight.Text = " "; - // BtnStart.Enabled = false; - // Code.Enabled = false; - // Leak.Text = ""; - // LeakPressure.Text = ""; - // MESStatus.Text = ""; - // progressBar2.Value = 0; - // 测试参数ToolStripMenuItem.Enabled = false; - // write = 0; - // // sum = 0; - // } - // break; - - // case 2://此时为读取参数并数据转换 - - // Timer2.Stop(); - // string str2; - // str2 = ReceiveText.Text; - // // str2 = str2.Replace(" ", ""); - - // if (str2.Length > 122) - // { - // string hexstring_full = str2.Substring(26, 4); - // string hexstring_balan = str2.Substring(30, 4); - // string hexstring_test = str2.Substring(34, 4); - // string hexstring_exhasut = str2.Substring(38, 4); - // string hexstring_bypass = str2.Substring(42, 4); - // string hexstring_delay1 = str2.Substring(46, 4); - // string hexstring_delay2 = str2.Substring(50, 4); - - // string hexstring_bleakbalan = str2.Substring(62, 4); - // string hexstring_sleakbalan = str2.Substring(66, 4); - // string hexstring_bleaktoppre = str2.Substring(70, 4); - // string hexstring_bleaklowpre = str2.Substring(74, 4); - - // // string hexstring_bleaktest = str2.Substring(124, 4); - - // string hexstring_lunit = str2.Substring(86, 4); - // string hexstring_punit = str2.Substring(90, 4); - - // //十六进制转十进制 - // int full = Int32.Parse(hexstring_full, System.Globalization.NumberStyles.HexNumber) / 10; - // int balan = Int32.Parse(hexstring_balan, System.Globalization.NumberStyles.HexNumber) / 10; - // int test = Int32.Parse(hexstring_test, System.Globalization.NumberStyles.HexNumber) / 10; - - // double exhaust = Convert.ToDouble(Convert.ToInt32(hexstring_exhasut, 16)) / 10; - - // int bypass = Int32.Parse(hexstring_bypass, System.Globalization.NumberStyles.HexNumber) / 10; - - // double delay1 = Int32.Parse(hexstring_delay1, System.Globalization.NumberStyles.HexNumber); - // double delay2 = Int32.Parse(hexstring_delay2, System.Globalization.NumberStyles.HexNumber); - // double delay11 = delay1 / 10; - // double delay22 = delay2 / 10; - - // int bleakbalan = Int32.Parse(hexstring_bleakbalan, System.Globalization.NumberStyles.HexNumber) / 10; - // int sleakbalan = Int32.Parse(hexstring_sleakbalan, System.Globalization.NumberStyles.HexNumber) / 10; - // int bleaktoppre = Int32.Parse(hexstring_bleaktoppre, System.Globalization.NumberStyles.HexNumber); - // int bleaklowpre = Int32.Parse(hexstring_bleaklowpre, System.Globalization.NumberStyles.HexNumber); - - // // int bleaktest = Int32.Parse(hexstring_bleaktest, System.Globalization.NumberStyles.HexNumber) / 10; - - // int lunit = Int32.Parse(hexstring_lunit, System.Globalization.NumberStyles.HexNumber); - // int punit = Int32.Parse(hexstring_punit, System.Globalization.NumberStyles.HexNumber); - - // delaytime = delay11 + delay22; - - // FullTime.Text = full.ToString(); - // BalanTime.Text = balan.ToString(); - // TestTime1.Text = test.ToString(); - // ExhaustTime.Text = exhaust.ToString(); - // BypassTIme.Text = bypass.ToString(); - // DelayTime1.Text = delay11.ToString(); - // DelayTime2.Text = delay22.ToString(); - - // BBalanTime.Text = bleakbalan.ToString(); - // SBalanTime.Text = sleakbalan.ToString(); - // // TestTime2 .Text = bleaktest.ToString(); - // BLeakTPre.Text = bleaktoppre.ToString(); - // if (bleaklowpre > 32767) - // { - // string bleaklowpre2 = "FFFFFFFFFFFF" + hexstring_bleaklowpre; - // long bleaklowpre3 = Convert.ToInt64(bleaklowpre2, 16); - // BLeakLPre.Text = bleaklowpre3.ToString(); - // } - // else - // { - // BLeakLPre.Text = bleaklowpre.ToString(); - // } - - // if (lunit < 6 && punit < 8) - // { - // LUnit.SelectedIndex = lunit; - // PUnit.SelectedIndex = punit; - // } - // else - // { - // Timer2.Interval = 300; - // Timer2.Start(); - // } - - // PressureUnit.Text = PUnit.Text; - - // LeakUnit.Text = LUnit.Text; - - // string hexstring_fptop1 = str2.Substring(54, 4); - // string hexstring_fptop2 = str2.Substring(58, 4); - // string hexstring_fptop = hexstring_fptop2 + hexstring_fptop1; - - // string hexstring_ltop1 = str2.Substring(78, 4); - // string hexstring_ltop2 = str2.Substring(82, 4); - // string hexstring_ltop = hexstring_ltop2 + hexstring_ltop1; - - // string hexstring_evol1 = str2.Substring(94, 4); - // string hexstringg_evol2 = str2.Substring(98, 4); - // string hexstringg_evol = hexstringg_evol2 + hexstring_evol1; - - // string hexstring_llow1 = str2.Substring(102, 4); - // string hexstring_llow2 = str2.Substring(106, 4); - // string hexstring_llow = hexstring_llow2 + hexstring_llow1; - - // string hexstring_fplow1 = str2.Substring(110, 4); - // string hexstring_fplow2 = str2.Substring(114, 4); - // string hexstring_fplow = hexstring_fplow2 + hexstring_fplow1; - - // string bleaktesttime = str2.Substring(118, 4); - // int testtime2 = Convert.ToInt32(bleaktesttime, 16) / 10; - // TestTime2.Text = testtime2.ToString(); - - // UInt32 x1 = Convert.ToUInt32(hexstring_fptop, 16);//字符串转16进制32位无符号整数 - // FPtoplimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x1), 0).ToString();//IEEE754 字节转换float - // UInt32 x2 = Convert.ToUInt32(hexstring_ltop, 16);//字符串转16进制32位无符号整数 - // Leaktoplimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x2), 0).ToString();//IEEE754 字节转换float - // UInt32 x3 = Convert.ToUInt32(hexstringg_evol, 16);//字符串转16进制32位无符号整数 - // Evolume.Text = BitConverter.ToSingle(BitConverter.GetBytes(x3), 0).ToString();//IEEE754 字节转换float - // UInt32 x4 = Convert.ToUInt32(hexstring_llow, 16);//字符串转16进制32位无符号整数 - // Leaklowlimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x4), 0).ToString();//IEEE754 字节转换float - // UInt32 x5 = Convert.ToUInt32(hexstring_fplow, 16);//字符串转16进制32位无符号整数 - // FPlowlimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x5), 0).ToString();//IEEE754 字节转换float - // // UInt32 x6 = Convert.ToUInt32(hexstring21, 16);//字符串转16进制32位无符号整数 - // // Leaktoplimit.Text = BitConverter.ToSingle(BitConverter.GetBytes(x6), 0).ToString();//IEEE754 字节转换float - - // int exhausttime = Convert.ToInt32(exhaust); - // int a = full + balan + test + testtime2 + exhausttime; - // if (a > 50) - // { - // progressBar2.Maximum = (full + balan + test + testtime2 + exhausttime - 2) * 10; - // } - // else - // { - // progressBar2.Maximum = (full + balan + test + testtime2 + exhausttime - 1) * 10; - // } - // Timer4.Interval = Convert.ToInt32((full + balan + test + testtime2 + exhaust) * 1000); - // Timer4.Start(); - // Timer8.Interval = Convert.ToInt32(delaytime * 1000 + 1); - // Timer8.Start(); - - // Timer3.Interval = 300; - // Timer3.Start(); - // } - // else - // { - // Timer2.Interval = 300; - // Timer2.Start(); - // } - - // break; - - // case 3://循环读取测试结果 - // string str4; - // str4 = ReceiveText.Text; - // // str4 = str4.Replace(" ", ""); - // Timer3.Stop(); - // if (str4.Length > 54 && str4.Substring(2, 2) == "03") - // { - // string status1 = str4.Substring(6, 4); - // int status = Convert.ToInt32(status1, 16); - // switch (status) - // { - // case 1: - // TestStatus.Text = "准备"; - // break; - - // case 2: - // TestStatus.Text = "充气"; - // fullpressure = LeakPressure.Text; - // break; - - // case 3: - // TestStatus.Text = "平衡"; - // balanpressure = LeakPressure.Text; - // break; - - // case 4: - // TestStatus.Text = "检测"; - // break; - - // case 5: - // TestStatus.Text = "排气"; - // break; - // } - - // string lp1 = str4.Substring(42, 4); - // string lp2 = str4.Substring(38, 4); - // string lp5 = lp1 + lp2; - // string lp3 = str4.Substring(50, 4); - // string lp4 = str4.Substring(46, 4); - // string lp6 = lp3 + lp4; - - // UInt32 b1 = Convert.ToUInt32(lp5, 16);//字符串转16进制32位无符号整数 - // LeakPressure.Text = BitConverter.ToSingle(BitConverter.GetBytes(b1), 0).ToString("F3");//IEEE754 字节转换float - // Debug.WriteLine("LeakPressure: " + LeakPressure.Text); - // UInt32 b2 = Convert.ToUInt32(lp6, 16);//字符串转16进制32位无符号整数 - // Leak.Text = BitConverter.ToSingle(BitConverter.GetBytes(b2), 0).ToString("F3");//IEEE754 字节转换float - // Debug.WriteLine("Leak: " + Leak.Text); - // string result1 = str4.Substring(10, 4); - // int result = Convert.ToInt32(result1, 16); - // if (result == 1) - // { - // DLeakPressure = LeakPressure.Text; - // DLeak = Leak.Text; - // Tlight.Text = "OK"; - // Tlight.ForeColor = Color.Green; - // Timer11.Start(); - // //SendText.Text = Station.Text + "05 02 1D FF 00"; - // //Send(); - // } - // else if (result == 2) - // { - // DLeakPressure = LeakPressure.Text; - // DLeak = Leak.Text; - // Tlight.Text = "NG"; - // SendText.Text = Station.Text + "05 02 1D FF 00"; - // Send(); - // Tlight.ForeColor = Color.Red; - - // if (delaytime > 0) - // { - // Timer9.Interval = Convert.ToInt32(Convert.ToDouble(ExhaustTime.Text) * 2000); - // Timer9.Start(); - // } - // else - // { - // Timer9.Interval = Convert.ToInt32(Convert.ToDouble(ExhaustTime.Text) * 1000); - // Timer9.Start(); - // } - - // Timer11.Start(); - // } - // else - // { - // Timer3.Interval = 150; - // Timer3.Start(); - // } - // } - // else - // { - // Timer3.Interval = 150; - // Timer3.Start(); - // } - - // break; - - // case 4: - // Timer1.Interval = 100; - // Timer1.Start(); - // stage = 5; - // break; - - // case 5: - - // //对仪器是否结束的判断 - // /* string str5; - // str5 = ReceiveText.Text; - // if (str5.Substring(6, 2) == "00") - // { - // Timer1.Stop(); - - // BtnStart.Enabled = true; - // Code.Enabled = true; - - // if (write == 0) - // { - // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - - // CreateFile(); - // Display(); - // stage = 10; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // else - // { - // stage = 10; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // Code.ResetText(); - // Code.ScrollToCaret(); - // Code.Focus(); - // Timer1.Interval = 800; - // Timer1.Start(); - // stage = 1; - - // if (串口设置ToolStripMenuItem.Enabled is true) - // { - // 测试参数ToolStripMenuItem.Enabled = true; - // } - // } - // */ - - // string str5; - // str5 = ReceiveText.Text; - // //if (str5.Substring(6, 2) == "00") - // log.Logmsg("进入Case:5" +str5); - // if (str5.Length >= 78 && str5.StartsWith("020328")) - // { - // log.Logmsg("进入Case:5判断" + str5); - // Timer11.Stop(); - // string hex = str5.Substring(6, 74); - // string hexString = string.Join(" ", Regex.Matches(hex, @"..").Cast().ToList()); - // StringBuilder sbBuffer = new StringBuilder(); - // string strArr1; - // string strArr2; - - // for (int i = 0; i < hexString.Split(' ').Length - 1; i = i + 2) - // { - // strArr1 = hexString.Split(' ')[i]; - // strArr2 = hexString.Split(' ')[i + 1]; - // sbBuffer.Append(strArr2).Append(" ").Append(strArr1).Append(" "); - // } - // string hexStringNew = sbBuffer.ToString().TrimEnd(); - // string tempBarCode = (ToStringFromHexString(hexStringNew, Encoding.UTF8)); - // string stringNew = string.Empty; - - // if (tempBarCode.Contains("\0")) - // { - // stringNew = Regex.Unescape(tempBarCode); - // int index = stringNew.IndexOf("\0"); - // stringNew = stringNew.Remove(index); - // } - // else - // { - // stringNew = tempBarCode; - // } - // Debug.WriteLine("str:" + str5 + Environment.NewLine); - // Debug.WriteLine("hex:" + hex + Environment.NewLine); - // Debug.WriteLine("tempBarCode:" + tempBarCode + Environment.NewLine); - // Debug.WriteLine("stringNew:" + stringNew + Environment.NewLine); - // string barCode = stringNew.Replace("\0", "").Replace("\r", "").Replace("\n", "").Replace("\r\n", ""); - // Debug.WriteLine("barCode:" + barCode + Environment.NewLine); - // if (string.IsNullOrEmpty(barCode)) - // { - // //MessageBox.Show("录入条码为空"); - // } - // if (!string.IsNullOrEmpty(barCode)) - // { - // if (barCode.Length > Convert.ToInt32(CodeLength.Text)) - // { - // // MessageBox.Show("录入条码长度大于设置条码长度"); - // } - // } - // Code.Text = barCode; - // //BtnStart.Enabled = true; - // //Code.Enabled = true; - // //if (write == 0) - // //{ - // // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - // // CreateFile(); - // // Display(); - // // stage = 10; - // // MachineStatus.ForeColor = Color.Red; - // // MachineStatus.Text = "待机中"; - // //} - // //else - // //{ - // // stage = 10; - // // MachineStatus.ForeColor = Color.Red; - // // MachineStatus.Text = "待机中"; - // //} - // //Code.ResetText(); - // //Code.ScrollToCaret(); - // //Code.Focus(); - // stage = 6; - - // //if (串口设置ToolStripMenuItem.Enabled is true) - // //{ - // // 测试参数ToolStripMenuItem.Enabled = true; - // //} - // } - // break; - - // case 6://读取条码 - // string str6; - // str6 = ReceiveText.Text; - // log.Logmsg("进入Case6:" + str6); - // if (str6.Length >= 8 && str6.Substring(6, 2) == "00") - // { - // Timer1.Stop(); - - // BtnStart.Enabled = true; - // Code.Enabled = true; - // log.Logmsg("设备待机"); - // if (write == 0) - // { - // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - // CreateFile(); - // Display(); - // State(); - // stage = 1; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // else - // { - // State(); - // stage = 1; - // MachineStatus.ForeColor = Color.Red; - // MachineStatus.Text = "待机中"; - // } - // Code.ResetText(); - // Code.ScrollToCaret(); - // Code.Focus(); - // Timer1.Interval = 800; - // Timer1.Start(); - // stage = 1; - - // if (串口设置ToolStripMenuItem.Enabled is true) - // { - // 测试参数ToolStripMenuItem.Enabled = true; - // } - // } - // else - // { - // State(); - // stage = 6; - // MachineStatus.Text = "未复位"; - // MachineStatus.ForeColor = Color.Red; - - // } - // break; - // } - //} - //catch (Exception ex) - //{ - // MessageBox.Show(ex.Message); - //} - - } - - //发送过程 - private void Send() - { - //try - //{ - // //将CRC冗余码添加进指令中 - // String str = SendText.Text; - // byte[] byt = StrtoHexbyte(str); - // int str2; - // str2 = Crc16_Modbus(byt, byt.Length); - // //byte byte1 =(byte)((str2 >> 8)&0xff); - // string str3; - // // str3=(( str2 >> 8) & 0xff).ToString (); - // str3 = Convert.ToString((str2 >> 8) & 0xff, 16); - // string str4; - // str4 = Convert.ToString(str2 & 0xff, 16); - // // string str4; - // // str4 = (str2 & 0xff).ToString(); - // // string str3; - // if (str3.Length == 1) - // { - // str3 = "0" + str3; - // // textBox2.Text = textBox2.Text + str4 + str3; - // } - // if (str4.Length == 1) - // { - // str4 = "0" + str4; - // // textBox2.Text = textBox2.Text + str4 + str3; - // } - // SendText.Text = SendText.Text + str4 + str3; - // String str5 = SendText.Text; - // if (str5.Length > 0) - // { - // byte[] byt2 = StrtoHexbyte(str5); - // SerialPort1.Write(byt2, 0, byt2.Length);//发送数据 - // } - //} - //catch (Exception ex) - //{ - // Timer1.Stop(); - // Timer2.Stop(); - // Timer3.Stop(); - // Timer4.Stop(); - - // Timer8.Stop(); - // Timer9.Stop(); - // Timer10.Stop(); - // Timer11.Stop(); - // Timer16.Stop(); - // MessageBox.Show(ex.Message); - //} - } - - - //计算CRC冗余码 - private int Crc16_Modbus(byte[] modbusdata, int length) - { - int i, j; - int crc = 0xffff;//0xffff or 0 - for (i = 0; i < length; i++) - { - crc ^= modbusdata[i] & 0xff; - for (j = 0; j < 8; j++) - { - if ((crc & 0x01) == 1) - { - crc = (crc >> 1) ^ 0xa001; - } - else - { - crc >>= 1; - } - } - } - - return crc; - } - - //将发送数据转为十六进制数据 - private static byte[] StrtoHexbyte(String hexstring) - { - int i; - hexstring = hexstring.Replace(" ", ""); - - byte[] returnBytes = new byte[(hexstring.Length) / 2]; - try - { - for (i = 0; i < returnBytes.Length; i++) - { - returnBytes[i] = Convert.ToByte(hexstring.Substring(i * 2, 2), 16); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - return null; - } - return returnBytes; - } - - - //将线圈置为0 - private void Timer10_Tick(object sender, EventArgs e) - { - ////try - ////{ - //// Timer10.Stop(); - //// SendText.Text = Station.Text + "05 02 1C 00 00"; - //// Send(); - //// stage = 0; - //// write = 0; - //} - //catch (Exception ex) - //{ - // MessageBox.Show(ex.Message); - //} - } - - //读状态位 - private void State() - { - //SendText.Text = Station.Text + " 01 02 1E 00 01"; - - //Send(); - } - //一百毫秒读状态位的定时器 private void Timer1_Tick(object sender, EventArgs e) { @@ -2011,87 +868,6 @@ namespace C_Windows_1 } } - //读参数 - private void Parameters() - { - SendText.Text = Station.Text + " 03 00 14 00 1D"; - // CrcNum(); - Send(); - stage = 2; - } - - //读参数的定时器 - private void Timer2_Tick(object sender, EventArgs e) - { - //try - //{ - // Parameters(); - // // Timer2.Stop(); - //} - //catch //(Exception ex) - //{ - // Timer2.Stop(); - //} - } - - //读泄漏量的定时器 - private void Timer3_Tick(object sender, EventArgs e) - { - //try - //{ - // Timer3.Stop(); - // if (checkBox1.Checked == true) - // { - // if (Code.Text != "" && Code.Text.Length != Convert.ToInt32(codecheck.Text)) - // { - // MessageBox.Show("条形码长度不正确"); - // Code.Clear(); - // Code.Focus(); - // } - - // } - - //} - //catch (Exception ex) - //{ - - // MessageBox.Show(ex.Message); - //} - - } - - //控制timer3何时关闭的定时器,并读状态位 - private void Timer4_Tick(object sender, EventArgs e) - { - //try - //{ - // if (Tlight.Text.Contains("OK") || Tlight.Text.Contains("NG")) - // { - // Timer4.Stop(); - // Timer9.Stop(); - // Timer3.Stop(); - - // Timer1.Interval = 200; - // Timer1.Start(); - // stage = 5; - - // // stage = 5; - // progressBar2.Value = progressBar2.Maximum; - // Timer8.Stop(); - // } - // else - // { - // Timer4.Interval = 100; - // Timer4.Start(); - // } - //} - //catch - //{ - // Timer4.Stop(); - //} - } - - //启动仪器 private void BtnStart_Click(object sender, EventArgs e) { @@ -2161,6 +937,200 @@ namespace C_Windows_1 } + // 客户需求表格 + private void AddExcel_xlsx(int CH, string code) + { + try + { + string fileName; + string date = DateTime.Now.ToString("yyyyMMdd"); + string nowDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"); + + if (string.IsNullOrEmpty(path.Text)) + { + fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + date + ".xlsx"; + } + else + { + fileName = path.Text + "\\leaktest_" + date + ".xlsx"; + } + + // 准备当前工位数据 + string[] chxData = PrepareCHxData(CH, code, nowDateTime); + + List rowData = new List(); + rowData.Add(nowDateTime); + rowData.Add(code); + rowData.Add(CH.ToString()); + rowData.AddRange(chxData); + + if (File.Exists(fileName)) + { + // 文件存在则追加数据 + using (FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite)) + { + XSSFWorkbook workbook = new XSSFWorkbook(file); + ISheet sheet = workbook.GetSheet("Sheet1"); + + // 检查唯一 + if (!IsTimeUnique(sheet, nowDateTime)) + { + // 毫秒加1 + DateTime originalTime = DateTime.ParseExact(nowDateTime, "yyyy/MM/dd HH:mm:ss.fff", null); + DateTime newTime = originalTime.AddMilliseconds(1); + nowDateTime = newTime.ToString("yyyy/MM/dd HH:mm:ss.fff"); + + rowData[0] = nowDateTime; + } + + // 尾行添加数据 + int lastRowNum = sheet.LastRowNum + 1; + IRow newRow = sheet.CreateRow(lastRowNum); + + for (int i = 0; i < rowData.Count; i++) + { + newRow.CreateCell(i).SetCellValue(rowData[i]); + } + + using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) + { + workbook.Write(fs); + } + } + } + else + { + // 文件不存在则创建新文件 + XSSFWorkbook workbook = new XSSFWorkbook(); + ISheet sheet = workbook.CreateSheet("Sheet1"); + + // 设置列宽 + SetColumnWidths(sheet); + + // 创建表头 + string[] headers = CreateHeaders(); + IRow headerRow = sheet.CreateRow(0); + for (int i = 0; i < headers.Length; i++) + { + headerRow.CreateCell(i).SetCellValue(headers[i]); + } + + // 添加数据行 + IRow dataRow = sheet.CreateRow(1); + for (int i = 0; i < rowData.Count; i++) + { + dataRow.CreateCell(i).SetCellValue(rowData[i]); + } + + using (FileStream file = new FileStream(fileName, FileMode.Create, FileAccess.Write)) + { + workbook.Write(file); + } + } + } + catch (Exception ex) + { + MessageBox.Show($"保存Excel文件异常:{ex.Message}"); + } + } + + // 准备数据 + private string[] PrepareCHxData(int channel, string code, string testTime) + { + if (channel == 1) + { + return new string[] { + (ReadData[25] / 10.0).ToString("f1") + "s", + (ReadData[26] / 10.0).ToString("f1") + "s", + (ReadData[27] / 10.0).ToString("f1") + "s", + (ReadData[28] / 10.0).ToString("f1") + "s", + TwoUInt16ToFloat(ReadData[33], ReadData[32]).ToString("f3"), + TwoUInt16ToFloat(ReadData[47], ReadData[46]).ToString("f3"), + ReadData[36].ToString(), + Digitalconversion(ReadData[37]).ToString(), + TwoUInt16ToFloat(ReadData[39], ReadData[38]).ToString("f3"), + TwoUInt16ToFloat(ReadData[45], ReadData[44]).ToString("f3"), + lb_CH1Result.Text, + TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString("f3"), + lb_CH1PressureUnit.Text, + TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"), + lb_CH1LeakUnit.Text + }; + } + else if (channel == 2) + { + return new string[] { + (ReadData2[25] / 10.0).ToString("f1") + "s", + (ReadData2[26] / 10.0).ToString("f1") + "s", + (ReadData2[27] / 10.0).ToString("f1") + "s", + (ReadData2[28] / 10.0).ToString("f1") + "s", + TwoUInt16ToFloat(ReadData2[33], ReadData2[32]).ToString("f3"), + TwoUInt16ToFloat(ReadData2[47], ReadData2[46]).ToString("f3"), + ReadData2[36].ToString(), + Digitalconversion(ReadData2[37]).ToString(), + TwoUInt16ToFloat(ReadData2[39], ReadData2[38]).ToString("f3"), + TwoUInt16ToFloat(ReadData2[45], ReadData2[44]).ToString("f3"), + lb_CH2Result.Text, + TwoUInt16ToFloat(ReadData2[17], ReadData2[16]).ToString("f3"), + lb_CH2PressureUnit.Text, + TwoUInt16ToFloat(ReadData2[19], ReadData2[18]).ToString("f1"), + lb_CH2LeakUnit.Text + }; + } + return Array.Empty(); + } + + // 设置列宽 + private void SetColumnWidths(ISheet sheet) + { + sheet.SetColumnWidth(0, 24 * 256); + sheet.SetColumnWidth(1, 20 * 256); + } + + // 创建表头 + private string[] CreateHeaders() + { + return new string[] { + "测试时间", + "条形码", + "工位", + "充气时间", + "平衡时间", + "检测时间", + "排气时间", + "充气压力上限", + "充气压力下限", + "大漏压差上限", + "大漏压差下限", + "泄漏量上限", + "泄漏量下限", + "测试结果", + "测试压力", + "压力单位", + "泄漏量", + "泄漏量单位" + }; + } + + // 检查时间是否唯一 + private bool IsTimeUnique(ISheet sheet, string testTime) + { + for (int i = 1; i <= sheet.LastRowNum; i++) // 从第1行开始(跳过表头) + { + IRow row = sheet.GetRow(i); + if (row != null && row.GetCell(0) != null) + { + string existingTime = row.GetCell(0).ToString(); + if (existingTime == testTime) + { + return false; + } + } + } + return true; + } + + private void AddExcel2(int CH, string code) { try @@ -2168,7 +1138,8 @@ namespace C_Windows_1 string FileName; string Date = DateTime.Now.ToString("yyyyMMdd"); string nowdate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); - if (path.Text == "")//若路径处不输入则获取桌面路径 + + if (path.Text == "") // 若路径处不输入则获取桌面路径 { FileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + DateTime.Now.ToString("yyyyMMdd") + ".xls"; } @@ -2178,7 +1149,6 @@ namespace C_Windows_1 } if (File.Exists(FileName)) { - FileStream file = new FileStream(FileName, FileMode.Open, FileAccess.ReadWrite); HSSFWorkbook workbook = new HSSFWorkbook(file); ISheet sheet = workbook.GetSheet("Sheet1"); @@ -2240,11 +1210,28 @@ namespace C_Windows_1 else { // 如果文件不存在,则创建文件并添加数据 - HSSFWorkbook workbook = new HSSFWorkbook(); ISheet sheet = workbook.CreateSheet("Sheet1"); - string[] headers = new string[] { "时间", "条形码", "充气时间", "平衡时间", "检测时间", "排气时间", "充气压力上限", "充气压力下限", "大漏压差上限", "大漏压差下限", "泄漏量上限", "泄漏量下限", "测试结果", "测试压力", "压力单位", "泄漏量", "泄漏量单位" };//列名; + string[] headers = new string[] { + "时间", + "条形码", + "充气时间", + "平衡时间", + "检测时间", + "排气时间", + "充气压力上限", + "充气压力下限", + "大漏压差上限", + "大漏压差下限", + "泄漏量上限", + "泄漏量下限", + "测试结果", + "测试压力", + "压力单位", + "泄漏量", + "泄漏量单位" };//列名; + IRow headerRow = sheet.CreateRow(0); for (int i = 0; i < headers.Length; i++) { @@ -2270,7 +1257,7 @@ namespace C_Windows_1 TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString(), lb_CH1PressureUnit.Text, TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString("f1"), - lb_CH1LeakUnit.Text }; //行名 + lb_CH1LeakUnit.Text }; // 行名 } else if (CH == 2) { @@ -2290,10 +1277,9 @@ namespace C_Windows_1 TwoUInt16ToFloat(ReadData2[17], ReadData2[16]).ToString(), lb_CH2PressureUnit.Text, TwoUInt16ToFloat(ReadData2[19], ReadData2[18]).ToString("f1"), - lb_CH2LeakUnit.Text }; //行名 + lb_CH2LeakUnit.Text }; // 行名 } - IRow dataRow = sheet.CreateRow(1); for (int i = 0; i < data.Length; i++) { @@ -2311,8 +1297,8 @@ namespace C_Windows_1 { MessageBox.Show(ex.Message); } - } + private void AddExcel() { if (path.Text.Length == 0) @@ -2511,12 +1497,12 @@ namespace C_Windows_1 //往表格插入数据 cmd2.CommandText = $"INSERT INTO {tablename} (时间, 条形码, 充气时间, 平衡时间, 检测时间," + - " 排气时间, 充气压力上限, 充气压力下限, 大漏压差上限, 大漏压差下限, 泄漏量上限, 泄漏量下限, 测试结果, 测试压力, 压力单位, 泄漏量, 泄漏量单位) VALUES(" + - "'" + DateTime.Now + "', '" + tb_CH1Code.Text + "', '" + ReadData[25] / 10.0 + "', '" + ReadData[26] / 10.0 + "', '" + ReadData[27] / 10.0 + - "', '" + ReadData[28] / 10.0 + "', '" + TwoUInt16ToFloat(ReadData[33], ReadData[32]).ToString() + "', '" + TwoUInt16ToFloat(ReadData[47], ReadData[46]).ToString() - + "', '" + ReadData[36].ToString() + "', '" + (Digitalconversion(ReadData[37])).ToString() + "', '" + TwoUInt16ToFloat(ReadData[39], ReadData[38]).ToString() - + "', '" + TwoUInt16ToFloat(ReadData[45], ReadData[44]).ToString() + "', '" + lb_CH1Result.Text + "', '" + TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString() - + "', '" + lb_CH1PressureUnit.Text + "', '" + TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString() + "', '" + lb_CH1LeakUnit.Text + "')"; + " 排气时间, 充气压力上限, 充气压力下限, 大漏压差上限, 大漏压差下限, 泄漏量上限, 泄漏量下限, 测试结果, 测试压力, 压力单位, 泄漏量, 泄漏量单位) VALUES(" + + "'" + DateTime.Now + "', '" + tb_CH1Code.Text + "', '" + ReadData[25] / 10.0 + "', '" + ReadData[26] / 10.0 + "', '" + ReadData[27] / 10.0 + + "', '" + ReadData[28] / 10.0 + "', '" + TwoUInt16ToFloat(ReadData[33], ReadData[32]).ToString() + "', '" + TwoUInt16ToFloat(ReadData[47], ReadData[46]).ToString() + + "', '" + ReadData[36].ToString() + "', '" + (Digitalconversion(ReadData[37])).ToString() + "', '" + TwoUInt16ToFloat(ReadData[39], ReadData[38]).ToString() + + "', '" + TwoUInt16ToFloat(ReadData[45], ReadData[44]).ToString() + "', '" + lb_CH1Result.Text + "', '" + TwoUInt16ToFloat(ReadData[17], ReadData[16]).ToString() + + "', '" + lb_CH1PressureUnit.Text + "', '" + TwoUInt16ToFloat(ReadData[19], ReadData[18]).ToString() + "', '" + lb_CH1LeakUnit.Text + "')"; cmd2.ExecuteNonQuery(); con2.Close(); @@ -2594,9 +1580,10 @@ namespace C_Windows_1 } string mesresult = MESInfo.MESInformation(URL.Text, appid.Text, appkey.Text, method.Text, Dept.Text, - Type.Text, Machinemodel.Text, MESStation.Text, timestamp, tb_CH1Code.Text, result, FPtoplimit.Text + lb_CH1PressureUnit.Text, FPlowlimit.Text + lb_CH1PressureUnit.Text, - fullpressure + lb_CH1PressureUnit.Text, BLeakTPre.Text + "Pa", BLeakLPre.Text + "Pa", balanpressure + "Pa", - Leaktoplimit.Text + LUnit.Text, Leaklowlimit.Text + LUnit.Text, DLeak + LUnit.Text); + Type.Text, Machinemodel.Text, MESStation.Text, timestamp, tb_CH1Code.Text, result, FPtoplimit.Text + lb_CH1PressureUnit.Text, FPlowlimit.Text + lb_CH1PressureUnit.Text, + fullpressure + lb_CH1PressureUnit.Text, BLeakTPre.Text + "Pa", BLeakLPre.Text + "Pa", balanpressure + "Pa", + Leaktoplimit.Text + LUnit.Text, Leaklowlimit.Text + LUnit.Text, DLeak + LUnit.Text); + if (mesresult.Contains("\"code\":200")) { MESStatus.Text = "PASS"; @@ -2696,7 +1683,8 @@ namespace C_Windows_1 // 将新行插入到第一行位置 DataGridView1.Rows.Insert(0, row); } - //条形码 + + // 条形码 private void Code_TextChanged(object sender, EventArgs e) { if (tb_CH1Code.Text.Length > 0) @@ -2808,26 +1796,6 @@ namespace C_Windows_1 } } - //条形码长度验证 - private void Timer16_Tick(object sender, EventArgs e) - { - //Timer16.Stop(); - //if (Code.Text.Length <= Convert.ToInt32(CodeLength.Text)) - //{ - // //TextBox2.Text = Station.Text + "05 00 D0 FF 00"; - // //// CrcNum(); - // //Send(); - // //stage = 0; - // //readpara = 0; - // //write = 0; - //} - //else if (Code.Text.Length > 0) - //{ - // MessageBox.Show("条形码长度不正确"); - // Code.ResetText(); - // Code.Focus(); - //} - } private void 登录ToolStripMenuItem_Click(object sender, EventArgs e) { @@ -2889,30 +1857,6 @@ namespace C_Windows_1 OpenForm(form3); } - private void timer8_Tick(object sender, EventArgs e) - { - //progressBar2.PerformStep(); - //Timer8.Interval = 200; - } - - //若NG控制所有定时器停止 - private void Timer9_Tick(object sender, EventArgs e) - { - //Timer1.Stop(); - //Timer2.Stop(); - //Timer3.Stop(); - //Timer4.Stop(); - - //Timer8.Stop(); - - //Timer1.Interval = 200; - //Timer1.Start(); - //stage = 5; - - //progressBar2.Value = progressBar2.Maximum; - //Timer9.Stop(); - } - //防止打开多个相同的窗口 public void OpenForm(System.Windows.Forms.Form frm) { @@ -2970,15 +1914,7 @@ namespace C_Windows_1 regName.SetValue("timeflag", 1); regName.Close(); Timer1.Stop(); - Timer2.Stop(); - Timer3.Stop(); - Timer4.Stop(); - Timer8.Stop(); - Timer9.Stop(); - Timer10.Stop(); - - Timer16.Stop(); this.Hide(); SerialPort1.Dispose(); @@ -2986,19 +1922,6 @@ namespace C_Windows_1 System.Environment.Exit(0); } - private void Timer11_Tick(object sender, EventArgs e) - { - //try - //{ - // SendText.Text = Station.Text + " 03 01 38 00 14"; - // Send(); - // write = 0; - //} - //catch - //{ - // Timer11.Stop(); - //} - } //public static void domain2ip() //{ @@ -3245,7 +2168,6 @@ namespace C_Windows_1 return encode.GetString(_bytes); } - private void SetcheckBox1(bool check) { RegistryKey regName; @@ -3280,6 +2202,7 @@ namespace C_Windows_1 SetcheckBox1(false); } } + private void Setcodecheck() { RegistryKey regName; @@ -3294,12 +2217,12 @@ namespace C_Windows_1 regName.SetValue("codelength", tb_CodeLength.Text); regName.Close(); } + private void codecheck_TextChanged(object sender, EventArgs e) { Setcodecheck(); } - private void SetScancode() { RegistryKey regName; @@ -3315,19 +2238,6 @@ namespace C_Windows_1 regName.Close(); } - - - - private void Scancode_CheckedChanged(object sender, EventArgs e) - { - - } - - private void label29_Click(object sender, EventArgs e) - { - - } - private void button1_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("确定要清空计数吗?", "确认", MessageBoxButtons.YesNo); @@ -3424,21 +2334,11 @@ namespace C_Windows_1 } } - private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) - { - - } - private void label32_Click(object sender, EventArgs e) { AddDatebase(); } - private void button1_Click_1(object sender, EventArgs e) - { - - } - private void checkBox2_CheckedChanged(object sender, EventArgs e) { if (chk_MESswitch.Checked) @@ -3487,148 +2387,6 @@ namespace C_Windows_1 config.IniWriteValue("Mes", "JIG_Number1", this.JIG_Number1.Text); } - - - public async Task InMes(int CH) - { - //测试上传 - try - { - bool flag = CH == 1; - string text; - string text2; - string text3; - string text4; - string text5; - - text = this.PreCode1.Text; - text2 = this.strstation.Text; - text3 = this.strlocation.Text; - text4 = this.strbatch.Text; - text5 = this.strlinename.Text; - - - char c; - /*int obj =*/ - return await Task.Run(() => ATS_SelectTestYorN_Batch_LineName(text, text2, text3, text4, text5, "NA", "NA", out c)); - - - - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - return 0; - } - } - - public void UpMES(int CH) - { - try - { - bool flag = CH == 1; - string text; - string text2; - string text3; - string text4; - string text5; - string text6; - string text7; - string text8; - string text9; - int iresult; - string text10; - string text11; - - text = this.strlinename.Text; - text2 = this.strbatch.Text; - text3 = this.strlocation.Text; - text4 = this.strstation.Text; - text5 = CODE; - text6 = "LL18"; - text7 = "result"; - text8 = string.Concat(new string[] - { - "'", - CODE, - "','", - this.lb_CH1LeakPressure.Text, - this.lb_CH1PressureUnit.Text, - "''", - this.lb_CH1Leak.Text, - this.lb_CH1LeakUnit.Text, - "'" - }); - text9 = "ONE,H0H,H1H"; - bool flag2 = this.lb_CH1Result.Text == "OK"; - if (flag2) - { - iresult = 1; - text10 = "NA"; - text11 = this.JIG_Number1.Text; - } - else - { - iresult = 0; - text10 = "泄漏量"; - text11 = this.JIG_Number1.Text; - } - - - //bool @checked = this.checkBox1.Checked; - if (chk_MESswitch.Checked) - { - object obj = ATS_InsertDataRow_JIG_V2(text, text2, text3, text4, text5, iresult, text10, text11, text6, text7, text9, text8); - - - bool flag5 = obj.ToString() == "0"; - if (flag5) - { - this.textBox3.Text = "OK " + obj.ToString(); - this.textBox3.BackColor = Color.Green; - } - else - { - this.textBox3.Text = "NG -1"; - this.textBox3.BackColor = Color.Red; - } - - - this.log.Logmsg(string.Concat(new string[] - { - DateTime.Now.ToString(), - " ", - text, - ",", - text2, - ",", - text3, - ",", - text4, - ",", - text5, - ",", - iresult.ToString(), - ",", - text10, - ",", - text11, - ",", - text6, - ",", - text7, - ",", - text9, - ",", - text8 - })); - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - } private void Form1_Activated(object sender, EventArgs e) { @@ -3670,7 +2428,8 @@ namespace C_Windows_1 MessageBox.Show(ex.Message); } } - //CH2 断开串口 + + // CH2 断开串口 private void bt_CH2Break_Click(object sender, EventArgs e) { try @@ -3694,9 +2453,6 @@ namespace C_Windows_1 } } - - - /// /// 16进制格式字符串转字节数组 diff --git a/C-Windows-1/Form1.resx b/C-Windows-1/Form1.resx index 8853d03..d37ca64 100644 --- a/C-Windows-1/Form1.resx +++ b/C-Windows-1/Form1.resx @@ -123,15 +123,6 @@ 127, 9 - - 201, 6 - - - 291, 6 - - - 381, 6 - True @@ -183,29 +174,14 @@ True - - 670, 5 - - - 760, 6 - - - 852, 6 - - - 476, 8 - - 566, 7 - - - 942, 6 + 242, 14 - 1042, 6 + 380, 17 - 1159, 6 + 497, 17 56 diff --git a/C-Windows-1/bin/Debug/LL18-Control.pdb b/C-Windows-1/bin/Debug/LL18-Control.pdb deleted file mode 100644 index cfa1101..0000000 Binary files a/C-Windows-1/bin/Debug/LL18-Control.pdb and /dev/null differ diff --git a/C-Windows-1/bin/Debug/LL18-Control.exe b/C-Windows-1/bin/Debug/LL18-V25112001.exe similarity index 82% rename from C-Windows-1/bin/Debug/LL18-Control.exe rename to C-Windows-1/bin/Debug/LL18-V25112001.exe index 22da523..02ab811 100644 Binary files a/C-Windows-1/bin/Debug/LL18-Control.exe and b/C-Windows-1/bin/Debug/LL18-V25112001.exe differ diff --git a/C-Windows-1/bin/Debug/LL18-Control.exe.config b/C-Windows-1/bin/Debug/LL18-V25112001.exe.config similarity index 100% rename from C-Windows-1/bin/Debug/LL18-Control.exe.config rename to C-Windows-1/bin/Debug/LL18-V25112001.exe.config diff --git a/C-Windows-1/bin/Debug/LL18-V25112001.pdb b/C-Windows-1/bin/Debug/LL18-V25112001.pdb new file mode 100644 index 0000000..480e618 Binary files /dev/null and b/C-Windows-1/bin/Debug/LL18-V25112001.pdb differ diff --git a/C-Windows-1/bin/Debug/sscomV5131.exe b/C-Windows-1/bin/Debug/sscomV5131.exe index 9fca309..1fe2df0 100644 Binary files a/C-Windows-1/bin/Debug/sscomV5131.exe and b/C-Windows-1/bin/Debug/sscomV5131.exe differ diff --git a/C-Windows-1/bin/扫码加数据库/LL18-Control.exe b/C-Windows-1/bin/扫码加数据库/LL18-Control.exe index 409ba71..75e24aa 100644 Binary files a/C-Windows-1/bin/扫码加数据库/LL18-Control.exe and b/C-Windows-1/bin/扫码加数据库/LL18-Control.exe differ diff --git a/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt b/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt index f40cc22..894b678 100644 --- a/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt +++ b/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.FileListAbsolute.txt @@ -919,9 +919,9 @@ D:\ll-18\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.CoreCompileInputs.cache D:\ll-18\C-Windows-1\obj\Debug\C-Window.5B87B986.Up2Date D:\ll-18\C-Windows-1\obj\Debug\LL18-Control.exe D:\ll-18\C-Windows-1\obj\Debug\LL18-Control.pdb -D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\LL18-Control.exe.config -D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\LL18-Control.exe -D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\LL18-Control.pdb +D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\LL18-V25112001.exe.config +D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\LL18-V25112001.exe +D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\LL18-V25112001.pdb D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\BouncyCastle.Cryptography.dll D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\Enums.NET.dll D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\ICSharpCode.SharpZipLib.dll @@ -973,7 +973,7 @@ D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\System.Security.Principal D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\bin\Debug\System.Text.Encoding.CodePages.xml D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.AssemblyReference.cache D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.SuggestedBindingRedirects.cache -D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\LL18-Control.exe.config +D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\LL18-V25112001.exe.config D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C_Windows_1.Activationcode.resources D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C_Windows_1.Config.resources D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C_Windows_1.Form1.resources @@ -991,5 +991,5 @@ D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C_Windows_1.UserPassword. D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.GenerateResource.cache D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.CoreCompileInputs.cache D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\C-Window.5B87B986.Up2Date -D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\LL18-Control.exe -D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\LL18-Control.pdb +D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\LL18-V25112001.exe +D:\桌面\莫禧亮\鸿海\LL-18\C-Windows-1\obj\Debug\LL18-V25112001.pdb diff --git a/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.GenerateResource.cache b/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.GenerateResource.cache index 985a672..a7aeb1b 100644 Binary files a/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.GenerateResource.cache and b/C-Windows-1/obj/Debug/C-Windows-LL18.csproj.GenerateResource.cache differ diff --git a/C-Windows-1/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/C-Windows-1/obj/Debug/DesignTimeResolveAssemblyReferences.cache index c02b629..d45792a 100644 Binary files a/C-Windows-1/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/C-Windows-1/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/C-Windows-1/obj/Debug/LL18-Control.pdb b/C-Windows-1/obj/Debug/LL18-Control.pdb deleted file mode 100644 index cfa1101..0000000 Binary files a/C-Windows-1/obj/Debug/LL18-Control.pdb and /dev/null differ diff --git a/C-Windows-1/obj/Debug/LL18-Control.exe b/C-Windows-1/obj/Debug/LL18-V25112001.exe similarity index 82% rename from C-Windows-1/obj/Debug/LL18-Control.exe rename to C-Windows-1/obj/Debug/LL18-V25112001.exe index 22da523..02ab811 100644 Binary files a/C-Windows-1/obj/Debug/LL18-Control.exe and b/C-Windows-1/obj/Debug/LL18-V25112001.exe differ diff --git a/C-Windows-1/obj/Debug/LL18-Control.exe.config b/C-Windows-1/obj/Debug/LL18-V25112001.exe.config similarity index 100% rename from C-Windows-1/obj/Debug/LL18-Control.exe.config rename to C-Windows-1/obj/Debug/LL18-V25112001.exe.config diff --git a/C-Windows-1/obj/Debug/LL18-V25112001.pdb b/C-Windows-1/obj/Debug/LL18-V25112001.pdb new file mode 100644 index 0000000..480e618 Binary files /dev/null and b/C-Windows-1/obj/Debug/LL18-V25112001.pdb differ