Bläddra i källkod

修改华冠测试日志抓取

callm 4 veckor sedan
förälder
incheckning
82afc08278

+ 2 - 2
FileWatcher/AutoAnalysisXml.Designer.cs

@@ -36,7 +36,7 @@
             this.label1 = new System.Windows.Forms.Label();
             this.FolderPath = new System.Windows.Forms.TextBox();
             this.ChooseFolder = new System.Windows.Forms.Button();
-            this.OperateResult = new System.Windows.Forms.RichTextBox();
+            this.OperateResult = new RichTextAutoBottom();
             this.Clean = new System.Windows.Forms.Button();
             this.MakeCode_lable = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
@@ -387,7 +387,7 @@
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.TextBox FolderPath;
         private System.Windows.Forms.Button ChooseFolder;
-        private System.Windows.Forms.RichTextBox OperateResult;
+        private RichTextAutoBottom OperateResult;
         private System.Windows.Forms.Button Clean;
         private System.Windows.Forms.Label MakeCode_lable;
         private System.Windows.Forms.ComboBox Master;

+ 75 - 58
FileWatcher/AutoAnalysisXml.cs

@@ -310,99 +310,116 @@ namespace FileWatcher
                         {
                             string Result = "";
                             string makecode = ma_code.Text;
-
-                            string ms_sncode = dh.getFieldDataByCondition("steppassed", "sp_sncode", "substr(sp_sncode,0,12)='" + SN + "' order by sp_id").ToString();
-                            if (ms_sncode == "")
+                            string oErrMessage = "";
+                            string oMSID = "";
+                            string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "substr(ms_sncode,0,12)='" + SN + "' order by ms_id").ToString();
+                            isource = sc_code.Text;
+                            iusercode = em_code.Text;
+                            DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
+                            if (dt.Rows.Count > 0)
                             {
-                                OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
+                                ilinecode = dt.Rows[0]["sc_linecode"].ToString();
+                                istepcode = dt.Rows[0]["sc_stepcode"].ToString();
+                                ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
                             }
-                            else
+                            if (LogicHandler.CheckStepSNAndMacode("", isource, ms_sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                             {
-                                isource = sc_code.Text;
-                                iusercode = em_code.Text;
-                                DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
-                                if (dt.Rows.Count > 0)
-                                {
-                                    ilinecode = dt.Rows[0]["sc_linecode"].ToString();
-                                    istepcode = dt.Rows[0]["sc_stepcode"].ToString();
-                                    ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
-                                }
                                 ma_code.Text = makecode;
-                                try
+                                if (LogicHandler.SetStepResult(makecode, isource, ms_sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
                                 {
-                                    string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
-                                    OperateResult.AppendText("开始上传日志:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
-                                    ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
-                                    OperateResult.AppendText("上传日志结束:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
-                                    int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where substr(ms_sncode,0,12)='" + SN + "'", "insert").ToString());
-                                    if (num > 0)
+                                    try
                                     {
-                                        OperateResult.AppendText("序列号:" + SN + "上传成功\n");
-                                        if (BackUpFolderPath.Text != "")
-                                            File.Move(filename, BackUpFolderPath.Text+"/"+ SN+".txt");
-                                        //SafeDeleteFile(FileName);
+                                        string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
+                                        ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
+                                        int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where substr(ms_sncode,0,12)='" + SN + "'", "insert").ToString());
+                                        if (num > 0)
+                                        {
+                                            OperateResult.AppendText("序列号:" + SN + "上传成功\n");
+                                            if (BackUpFolderPath.Text != "")
+                                                File.Move(filename, BackUpFolderPath.Text + "/" + SN + ".txt");
+                                        }
+                                        else
+                                        {
+                                            OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
+                                            MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
+                                        }
                                     }
-                                    else
+                                    catch (Exception ex)
                                     {
-                                        OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
-                                        MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
+                                        Console.WriteLine(ex.Message);
                                     }
                                 }
-                                catch (Exception ex)
+                                else
                                 {
-                                    Console.WriteLine(ex.Message);
+                                    OperateResult.AppendText(oErrMessage + "\n");
+                                    tipform.startthread(oErrMessage, Result);
+
                                 }
                                 tipform.startthread("序列号 " + ms_sncode + "通过检测", Result);
                             }
+                            else
+                            {
+                                OperateResult.AppendText(oErrMessage + "\n");
+                                tipform.startthread(oErrMessage, Result);
+                            }
                         }
                         else
                         {
                             string Result = "";
                             string makecode = ma_code.Text;
-                            string ms_sncode = dh.getFieldDataByCondition("steppassed", "sp_sncode", "sp_sncode='" + SN + "' order by sp_id").ToString();
+                            string oErrMessage = "";
+                            string oMSID = "";
+                            string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_sncode='" + SN + "' order by ms_id").ToString();
                             isource = sc_code.Text;
                             iusercode = em_code.Text;
-                            if (ms_sncode == "")
+                            DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
+                            if (dt.Rows.Count > 0)
                             {
-                                OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
+                                ilinecode = dt.Rows[0]["sc_linecode"].ToString();
+                                istepcode = dt.Rows[0]["sc_stepcode"].ToString();
+                                ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
                             }
-                            else
+                            if (LogicHandler.CheckStepSNAndMacode("", isource, ms_sncode, iusercode, out makecode, out oMSID, out oErrMessage))
                             {
-                                DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
-                                if (dt.Rows.Count > 0)
-                                {
-                                    ilinecode = dt.Rows[0]["sc_linecode"].ToString();
-                                    istepcode = dt.Rows[0]["sc_stepcode"].ToString();
-                                    ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
-                                }
                                 ma_code.Text = makecode;
-                                try
+                                if (LogicHandler.SetStepResult(makecode, isource, ms_sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
                                 {
-                                    string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
-                                    OperateResult.AppendText("开始上传日志:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
-                                    ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
-                                    OperateResult.AppendText("上传日志结束:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
-                                    int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where ms_sncode='" + SN + "'", "insert").ToString());
-                                    if (num > 0)
+                                    try
                                     {
-                                        OperateResult.AppendText("序列号:" + SN + "上传成功\n");
-                                        if (BackUpFolderPath.Text != "")
-                                            File.Move(filename, BackUpFolderPath.Text + "/" + SN + ".txt");
-                                        //SafeDeleteFile(FileName);
+                                        string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
+                                        OperateResult.AppendText("开始上传日志:"+DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
+                                        ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
+                                        OperateResult.AppendText("结束上传日志"+DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
+                                        int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where ms_sncode='" + SN + "'", "insert").ToString());
+                                        if (num > 0)
+                                        {
+                                            OperateResult.AppendText("序列号:" + SN + "上传成功\n");
+                                            if (BackUpFolderPath.Text != "")
+                                                File.Move(filename, BackUpFolderPath.Text + "/" + SN + ".txt");
+                                        }
+                                        else
+                                        {
+                                            OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
+                                            MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
+                                        }
                                     }
-                                    else
+                                    catch (Exception ex)
                                     {
-                                        OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
-                                        MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
+                                        Console.WriteLine(ex.Message);
                                     }
                                 }
-                                catch (Exception ex)
+                                else
                                 {
-                                    Console.WriteLine(ex.Message);
+                                    OperateResult.AppendText(oErrMessage + "\n");
+                                    tipform.startthread(oErrMessage, Result);
                                 }
-
                                 tipform.startthread("序列号 " + ms_sncode + "通过检测", Result);
                             }
+                            else
+                            {
+                                OperateResult.AppendText(oErrMessage + "\n");
+                                tipform.startthread(oErrMessage, Result);
+                            }
                         }
                         OperateResult.AppendText("解析成功:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + FileName + "\n");
                     }

+ 7 - 7
FileWatcher/DataHelper.cs

@@ -20,10 +20,10 @@ namespace FileWatcher
         //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.6.28)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
-        //RXY
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        //用户选择的数据库的连接字符串
-        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////RXY
+        //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        ////用户选择的数据库的连接字符串
+        //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
         ////HY
@@ -41,9 +41,9 @@ namespace FileWatcher
         ////用户选择的数据库的连接字符串
         //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.100.2)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
-        //private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=GHKJ;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////用户选择的数据库的连接字符串
-        //public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=GHKJ;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //用户选择的数据库的连接字符串
+        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
 
         public static OracleConnection connection = null;

+ 20 - 1
FileWatcher/FileWatcher.csproj

@@ -10,7 +10,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>FileWatcher</RootNamespace>
     <AssemblyName>FileWatcher</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <PublishUrl>publish\</PublishUrl>
     <Install>true</Install>
@@ -52,6 +52,18 @@
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="Aspose.Cells">
       <HintPath>tool\Aspose.Cells.dll</HintPath>
@@ -158,6 +170,13 @@
     <Compile Include="AutoSMTRXY.Designer.cs">
       <DependentUpon>AutoSMTRXY.cs</DependentUpon>
     </Compile>
+    <Compile Include="LogManager.cs" />
+    <Compile Include="RichTextAutoBottom.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="RichTextAutoBottom.Designer.cs">
+      <DependentUpon>RichTextAutoBottom.cs</DependentUpon>
+    </Compile>
     <Compile Include="SOP_PNE.cs">
       <SubType>Form</SubType>
     </Compile>

+ 2 - 32
FileWatcher/Form1.cs

@@ -1,4 +1,4 @@
-using HslCommunication;
+
 using Microsoft.Win32;
 using System;
 using System.Collections.Generic;
@@ -20,37 +20,7 @@ namespace FileWatcher
 
         private void Form1_Load(object sender, EventArgs e)
         {
-            HslCommunication.Profinet.Panasonic.PanasonicMewtocol plc = new HslCommunication.Profinet.Panasonic.PanasonicMewtocol();
-            plc.Station = 238;
-            HslCommunication.Core.Pipe.PipeSerialPort pipe = new HslCommunication.Core.Pipe.PipeSerialPort();
-            pipe.SerialPortInni("COM12-9600-8-O-1");
-            pipe.RtsEnable = false;
-            pipe.DtrEnable = false;
-            pipe.SleepTime = 20;
-            pipe.ReceiveTimeOut = 5000;
-            plc.CommunicationPipe = pipe;
-
-            // 当前读取操作的代码 The code for the current read operation
-            OperateResult<short> read = plc.ReadInt16("D60");
-            if (read.IsSuccess)
-            {
-                Console.WriteLine("Read [D60] Success, Value: " + read.Content);
-            }
-            else
-            {
-                Console.WriteLine("Read [D60] failed: " + read.Message);
-            }
-
-            // 当前写入操作的代码 The code for the current write operation
-            OperateResult write = plc.Write("D60", short.Parse("2"));
-            if (write.IsSuccess)
-            {
-                Console.WriteLine("Write [D60] success");
-            }
-            else
-            {
-                Console.WriteLine("Write [D60] failed: " + write.Message);
-            }
+          
 
         }
 

+ 62 - 0
FileWatcher/LogManager.cs

@@ -0,0 +1,62 @@
+using System;
+using System.IO;
+
+namespace FileWatcher
+{
+    class LogManager
+    {
+        public static string LogAddress = SystemInf.LogFolder;
+        /// <summary>
+        /// 记录操作
+        /// </summary>
+        /// <param name="Message"></param>
+        public static void DoLog(string Message)
+        {
+            try
+            {
+                StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
+                sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
+                sw.WriteLine("【消息】" + Message + "\n");
+                sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
+                sw.Close();
+            }
+            catch (Exception) { }
+        }
+
+        /// <summary>
+        /// 记录操作和SQL
+        /// </summary>
+        /// <param name="Message"></param>
+        /// <param name="SQL"></param>
+        public static void DoLog(string Message, string SQL)
+        {
+            try
+            {
+                StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
+                sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
+                sw.WriteLine("【消息】" + Message + "\n");
+                sw.WriteLine("【SQL】" + SQL + "\n");
+                sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
+                sw.Close();
+            }
+            catch (Exception) { }
+        }
+
+        /// <summary>
+        /// 记录SQL
+        /// </summary>
+        /// <param name="SQL"></param>
+        public static void DoSQLLog(string SQL)
+        {
+            try
+            {
+                StreamWriter sw = File.AppendText(LogAddress + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
+                sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n");
+                sw.WriteLine("【SQL】" + SQL + "\n");
+                sw.WriteLine("---------------------------------------------------------------------------------------------------------------");
+                sw.Close();
+            }
+            catch (Exception) { }
+        }
+    }
+}

+ 1 - 2
FileWatcher/Program.cs

@@ -46,9 +46,8 @@ namespace FileWatcher
                 Application.SetCompatibleTextRenderingDefault(false);
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 {
-                    //Application.Run(new UploadMakePlan());
                     //Application.Run(new AutoAnalysisXmlByStep());
-                    Application.Run(new AutoAnalysisDevice());
+                    Application.Run(new AutoAnalysisXml());
                 }
                 else
                 {

+ 36 - 0
FileWatcher/RichTextAutoBottom.Designer.cs

@@ -0,0 +1,36 @@
+namespace FileWatcher
+{
+    partial class RichTextAutoBottom
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            components = new System.ComponentModel.Container();
+        }
+
+        #endregion
+    }
+}

+ 75 - 0
FileWatcher/RichTextAutoBottom.cs

@@ -0,0 +1,75 @@
+using FileWatcher;
+using System;
+using System.Drawing;
+using System.Media;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace FileWatcher
+{
+    public partial class RichTextAutoBottom : RichTextBox
+    {
+        Thread thread;
+        string FileName = "";
+        public RichTextAutoBottom()
+        {
+            InitializeComponent();
+            thread = new Thread(PlaySound);
+            TextChanged += RichTextBox_TextChange;
+        }
+
+        private void RichTextBox_TextChange(object sender, EventArgs e)
+        {
+            SelectionStart = Text.Length;
+            ScrollToCaret();
+        }
+
+        /// <summary>
+        /// color设置AppendText的颜色
+        /// </summary>
+        /// <param name="str"></param>
+        /// <param name="color"></param>
+        public void AppendText(string str, Color color)
+        {
+            SelectionColor = color;
+            base.AppendText(str);
+            //如果颜色是红色则进行提示音
+            LogManager.DoLog(FindForm().Tag + str);
+        }
+
+        /// <summary>
+        /// 提示错误信息清楚指定控件的值
+        /// </summary>
+        /// <param name="str"></param>
+        /// <param name="color"></param>
+        /// <param name="ctl"></param>
+        public void AppendText(string str, Color color, Control ctl)
+        {
+            SelectionColor = color;
+            base.AppendText(str);
+            ctl.Text = "";
+            //如果颜色是红色则进行提示音
+            LogManager.DoLog(FindForm().Tag + str);
+        }
+
+        private void PlaySound()
+        {
+            //要加载COM组件:Microsoft speech object Library    
+            if (!System.IO.File.Exists(FileName))
+            {
+                return;
+            }
+            try
+            {
+                SoundPlayer player = new SoundPlayer();
+                player.SoundLocation = FileName;
+                player.Load();
+                player.Play();
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show(e.Message);
+            }
+        }
+    }
+}

+ 10 - 10
FileWatcher/app.config

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

+ 14 - 14
FileWatcher/packages.config

@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Aspose.Cells" version="23.10.0" targetFramework="net40" />
-  <package id="ClosedXML" version="0.105.0" targetFramework="net48" requireReinstallation="true" />
-  <package id="ClosedXML.Parser" version="2.0.0" targetFramework="net48" requireReinstallation="true" />
-  <package id="DocumentFormat.OpenXml" version="3.1.1" targetFramework="net48" requireReinstallation="true" />
-  <package id="DocumentFormat.OpenXml.Framework" version="3.1.1" targetFramework="net48" requireReinstallation="true" />
-  <package id="EPPlus" version="8.0.5" targetFramework="net40" />
-  <package id="EPPlus.Interfaces" version="8.0.0" targetFramework="net40" />
+  <package id="ClosedXML" version="0.105.0" targetFramework="net48" />
+  <package id="ClosedXML.Parser" version="2.0.0" targetFramework="net48" />
+  <package id="DocumentFormat.OpenXml" version="3.1.1" targetFramework="net48" />
+  <package id="DocumentFormat.OpenXml.Framework" version="3.1.1" targetFramework="net48" />
+  <package id="EPPlus" version="8.0.5" targetFramework="net40" requireReinstallation="true" />
+  <package id="EPPlus.Interfaces" version="8.0.0" targetFramework="net40" requireReinstallation="true" />
   <package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" />
-  <package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net48" requireReinstallation="true" />
-  <package id="Microsoft.CognitiveServices.Speech" version="1.47.0" targetFramework="net40" />
-  <package id="RBush.Signed" version="4.0.0" targetFramework="net48" requireReinstallation="true" />
-  <package id="SixLabors.Fonts" version="1.0.0" targetFramework="net48" requireReinstallation="true" />
-  <package id="System.Buffers" version="4.5.1" targetFramework="net48" requireReinstallation="true" />
-  <package id="System.Memory" version="4.5.5" targetFramework="net48" requireReinstallation="true" />
-  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" requireReinstallation="true" />
-  <package id="System.Runtime.CompilerServices.Unsafe" version="4.7.0" targetFramework="net48" requireReinstallation="true" />
+  <package id="Microsoft.Bcl.HashCode" version="1.1.1" targetFramework="net48" />
+  <package id="Microsoft.CognitiveServices.Speech" version="1.47.0" targetFramework="net40" requireReinstallation="true" />
+  <package id="RBush.Signed" version="4.0.0" targetFramework="net48" />
+  <package id="SixLabors.Fonts" version="1.0.0" targetFramework="net48" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
+  <package id="System.Memory" version="4.5.5" targetFramework="net48" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.7.0" targetFramework="net48" />
 </packages>

BIN
FileWatcher/tool/HslCommunication.dll