소스 검색

增加开机自启动

callm 10 달 전
부모
커밋
131204917d
4개의 변경된 파일55개의 추가작업 그리고 14개의 파일을 삭제
  1. 40 8
      FileWatcher/AutoAnalysisXmlByStep.Designer.cs
  2. 13 4
      FileWatcher/AutoAnalysisXmlByStep.cs
  3. 2 2
      FileWatcher/DataHelper.cs
  4. BIN
      FileWatcher/tool/UMESDLLService.dll

+ 40 - 8
FileWatcher/AutoAnalysisXmlByStep.Designer.cs

@@ -51,6 +51,8 @@
             this.label3 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
             this.MachineType = new System.Windows.Forms.TextBox();
+            this.CleanFolderPath = new System.Windows.Forms.Button();
+            this.CleanBackUpFolderPath = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -58,6 +60,7 @@
             // 
             this.XmlWatcher.EnableRaisingEvents = true;
             this.XmlWatcher.Filter = "*.xml";
+            this.XmlWatcher.IncludeSubdirectories = true;
             this.XmlWatcher.SynchronizingObject = this;
             // 
             // StartWatch
@@ -108,7 +111,7 @@
             // ChooseFolder
             // 
             this.ChooseFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ChooseFolder.Location = new System.Drawing.Point(686, 344);
+            this.ChooseFolder.Location = new System.Drawing.Point(662, 340);
             this.ChooseFolder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ChooseFolder.Name = "ChooseFolder";
             this.ChooseFolder.Size = new System.Drawing.Size(156, 48);
@@ -119,17 +122,17 @@
             // 
             // OperateResult
             // 
-            this.OperateResult.Location = new System.Drawing.Point(892, 22);
+            this.OperateResult.Location = new System.Drawing.Point(979, 12);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(517, 535);
+            this.OperateResult.Size = new System.Drawing.Size(506, 535);
             this.OperateResult.TabIndex = 7;
             this.OperateResult.Text = "";
             // 
             // Clean
             // 
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Clean.Location = new System.Drawing.Point(1096, 580);
+            this.Clean.Location = new System.Drawing.Point(1169, 580);
             this.Clean.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Clean.Name = "Clean";
             this.Clean.Size = new System.Drawing.Size(112, 48);
@@ -164,6 +167,8 @@
             // AutoStart
             // 
             this.AutoStart.AutoSize = true;
+            this.AutoStart.Checked = true;
+            this.AutoStart.CheckState = System.Windows.Forms.CheckState.Checked;
             this.AutoStart.Location = new System.Drawing.Point(686, 51);
             this.AutoStart.Margin = new System.Windows.Forms.Padding(6);
             this.AutoStart.Name = "AutoStart";
@@ -171,7 +176,6 @@
             this.AutoStart.TabIndex = 16;
             this.AutoStart.Text = "开机自动启动";
             this.AutoStart.UseVisualStyleBackColor = true;
-            this.AutoStart.Visible = false;
             this.AutoStart.CheckedChanged += new System.EventHandler(this.AutoStart_CheckedChanged);
             // 
             // Timer
@@ -202,7 +206,7 @@
             // button1
             // 
             this.button1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button1.Location = new System.Drawing.Point(686, 432);
+            this.button1.Location = new System.Drawing.Point(662, 428);
             this.button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(156, 48);
@@ -275,11 +279,37 @@
             this.MachineType.Size = new System.Drawing.Size(436, 35);
             this.MachineType.TabIndex = 18;
             // 
+            // CleanFolderPath
+            // 
+            this.CleanFolderPath.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CleanFolderPath.Location = new System.Drawing.Point(839, 340);
+            this.CleanFolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.CleanFolderPath.Name = "CleanFolderPath";
+            this.CleanFolderPath.Size = new System.Drawing.Size(112, 48);
+            this.CleanFolderPath.TabIndex = 28;
+            this.CleanFolderPath.Text = "清除";
+            this.CleanFolderPath.UseVisualStyleBackColor = true;
+            this.CleanFolderPath.Click += new System.EventHandler(this.CleanFolderPath_Click);
+            // 
+            // CleanBackUpFolderPath
+            // 
+            this.CleanBackUpFolderPath.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.CleanBackUpFolderPath.Location = new System.Drawing.Point(839, 428);
+            this.CleanBackUpFolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.CleanBackUpFolderPath.Name = "CleanBackUpFolderPath";
+            this.CleanBackUpFolderPath.Size = new System.Drawing.Size(112, 48);
+            this.CleanBackUpFolderPath.TabIndex = 29;
+            this.CleanBackUpFolderPath.Text = "清除";
+            this.CleanBackUpFolderPath.UseVisualStyleBackColor = true;
+            this.CleanBackUpFolderPath.Click += new System.EventHandler(this.CleanBackUpFolderPath_Click);
+            // 
             // AutoAnalysisXmlByStep
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1443, 640);
+            this.ClientSize = new System.Drawing.Size(1498, 640);
+            this.Controls.Add(this.CleanBackUpFolderPath);
+            this.Controls.Add(this.CleanFolderPath);
             this.Controls.Add(this.li_code);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.Device);
@@ -302,7 +332,7 @@
             this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.MaximizeBox = false;
             this.Name = "AutoAnalysisXmlByStep";
-            this.Text = "UAS自动过站解析器 2024-04-18 09:19";
+            this.Text = "UAS自动过站解析器 2024-04-23 14:15";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
             this.Load += new System.EventHandler(this.Form1_Load);
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).EndInit();
@@ -335,6 +365,8 @@
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.TextBox MachineType;
         private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Button CleanBackUpFolderPath;
+        private System.Windows.Forms.Button CleanFolderPath;
     }
 }
 

+ 13 - 4
FileWatcher/AutoAnalysisXmlByStep.cs

@@ -122,6 +122,7 @@ namespace FileWatcher
                 Device.Text = BaseUtil.GetCacheData("Device").ToString();
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
+            StartWatch.PerformClick();
         }
 
         private void ConnectDB()
@@ -208,9 +209,7 @@ namespace FileWatcher
                         //MachineType.Text = makecode;
                         string ftppath = "/" + MachineType.Text + "/";
                         //string ErrMessage = ftp.UpLoadFile(folderpath, SN, ftppath, "");
-
                         DirectoryInfo info = new DirectoryInfo(folderpath);
-                        String path = info.Parent.Parent.FullName;
                         MachineType.Text = info.Name;//获取当前路径最后一级文件夹名称
                         if (Device.Text == "炉后AOI")
                         {
@@ -295,7 +294,7 @@ namespace FileWatcher
                             }
                             sR.Close();
                             Thread.Sleep(500);
-                            int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,STD_RESCODE,std_stepcode,std_linecode,std_machinetype)select STEPTESTDETAIL_seq.nextval,'" + SN + "','',sysdate,'" + ftpulr.Split('#')[0] + imaster + "/" + ftppath + SN + "','" + isource + "','" + Device.Text + "','" + li_code.Text + "','" + MachineType.Text + "' from dual", "insert").ToString());
+                            int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,STD_RESCODE,std_stepcode,std_linecode,std_machinetype, STD_TESTRESULT)select STEPTESTDETAIL_seq.nextval,'" + SN + "','',sysdate,'" + ftpulr.Split('#')[0] + imaster + "/" + ftppath + SN + "','" + isource + "','" + Device.Text + "','" + li_code.Text + "','" + MachineType.Text + "','" + Result + "' from dual", "insert").ToString());
                             if (Result.ToUpper() == "FAIL")
                             {
                                 sql.Clear();
@@ -335,7 +334,7 @@ namespace FileWatcher
                     }
                     catch (Exception ex)
                     {
-                        Console.WriteLine(ex.Message);
+                        OperateResult.AppendText(ex.Message + ex.StackTrace + "\n");
                     }
                 }
             }
@@ -437,5 +436,15 @@ namespace FileWatcher
             //    TxtHandleProcess(Xml);
             //}
         }
+
+        private void CleanFolderPath_Click(object sender, EventArgs e)
+        {
+            FolderPath.Text = "";
+        }
+
+        private void CleanBackUpFolderPath_Click(object sender, EventArgs e)
+        {
+            BackUpFolderPath.Text = "";
+        }
     }
 }

+ 2 - 2
FileWatcher/DataHelper.cs

@@ -9,9 +9,9 @@ namespace FileWatcher
    public class DataHelper
     {
         //系统默认的的连接字符串
-        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=10.11.28.21)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        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=172.22.100.2)(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=10.11.28.21)(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=172.22.100.2)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         public static OracleConnection connection = null;
         OracleCommand command = null;
         int ReconnectTime = 0;

BIN
FileWatcher/tool/UMESDLLService.dll