Browse Source

新增设备数据获取解析,本地配置路径和解析文件

callm 10 months ago
parent
commit
01207ebb2f
2 changed files with 139 additions and 9 deletions
  1. 122 0
      FileWatcher/AutoAnalysisXmlByStep.Designer.cs
  2. 17 9
      FileWatcher/AutoAnalysisXmlByStep.cs

+ 122 - 0
FileWatcher/AutoAnalysisXmlByStep.Designer.cs

@@ -42,6 +42,15 @@
             this.Master = new System.Windows.Forms.ComboBox();
             this.AutoStart = new System.Windows.Forms.CheckBox();
             this.Timer = new System.Windows.Forms.Timer(this.components);
+            this.BackUpFolderPath = new System.Windows.Forms.TextBox();
+            this.bei = new System.Windows.Forms.Label();
+            this.button1 = new System.Windows.Forms.Button();
+            this.Device = new System.Windows.Forms.ComboBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.li_code = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.ma_code = new System.Windows.Forms.TextBox();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -170,11 +179,115 @@
             this.Timer.Interval = 10000;
             this.Timer.Tick += new System.EventHandler(this.Timer_Tick);
             // 
+            // BackUpFolderPath
+            // 
+            this.BackUpFolderPath.Enabled = false;
+            this.BackUpFolderPath.Location = new System.Drawing.Point(218, 432);
+            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.BackUpFolderPath.Name = "BackUpFolderPath";
+            this.BackUpFolderPath.Size = new System.Drawing.Size(436, 35);
+            this.BackUpFolderPath.TabIndex = 20;
+            // 
+            // bei
+            // 
+            this.bei.AutoSize = true;
+            this.bei.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.bei.Location = new System.Drawing.Point(48, 432);
+            this.bei.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.bei.Name = "bei";
+            this.bei.Size = new System.Drawing.Size(162, 38);
+            this.bei.TabIndex = 19;
+            this.bei.Text = "备份文件夹";
+            // 
+            // 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.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(156, 48);
+            this.button1.TabIndex = 21;
+            this.button1.Text = "选择文件夹";
+            this.button1.UseVisualStyleBackColor = true;
+            // 
+            // Device
+            // 
+            this.Device.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.Device.FormattingEnabled = true;
+            this.Device.Items.AddRange(new object[] {
+            "SPI",
+            "镭雕机",
+            "炉前AOI",
+            "炉后AOI"});
+            this.Device.Location = new System.Drawing.Point(218, 189);
+            this.Device.Margin = new System.Windows.Forms.Padding(6);
+            this.Device.Name = "Device";
+            this.Device.Size = new System.Drawing.Size(436, 32);
+            this.Device.TabIndex = 25;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(48, 189);
+            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(133, 38);
+            this.label5.TabIndex = 24;
+            this.label5.Text = "设备选择";
+            // 
+            // li_code
+            // 
+            this.li_code.Location = new System.Drawing.Point(218, 114);
+            this.li_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.li_code.Name = "li_code";
+            this.li_code.Size = new System.Drawing.Size(436, 35);
+            this.li_code.TabIndex = 27;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label3.Location = new System.Drawing.Point(48, 114);
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(75, 38);
+            this.label3.TabIndex = 26;
+            this.label3.Text = "线别";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(48, 262);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(75, 38);
+            this.label2.TabIndex = 17;
+            this.label2.Text = "机型";
+            // 
+            // ma_code
+            // 
+            this.ma_code.Location = new System.Drawing.Point(218, 262);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Size = new System.Drawing.Size(436, 35);
+            this.ma_code.TabIndex = 18;
+            // 
             // 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.Controls.Add(this.li_code);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.Device);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.BackUpFolderPath);
+            this.Controls.Add(this.bei);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.label2);
             this.Controls.Add(this.AutoStart);
             this.Controls.Add(this.Master);
             this.Controls.Add(this.label4);
@@ -212,6 +325,15 @@
         private System.Windows.Forms.Label label4;
         private System.Windows.Forms.CheckBox AutoStart;
         private System.Windows.Forms.Timer Timer;
+        private System.Windows.Forms.TextBox BackUpFolderPath;
+        private System.Windows.Forms.Label bei;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.ComboBox Device;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.TextBox li_code;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox ma_code;
+        private System.Windows.Forms.Label label2;
     }
 }
 

+ 17 - 9
FileWatcher/AutoAnalysisXmlByStep.cs

@@ -100,9 +100,9 @@ namespace FileWatcher
             //获取缓存信息
             try
             {
-                //FolderPath.Text = BaseUtil.GetCacheData("FolderPath").ToString();
-                //BackUpFolderPath.Text = BaseUtil.GetCacheData("BackUpFolderPath").ToString();
-                //Master.Text = BaseUtil.GetCacheData("Master").ToString();
+                FolderPath.Text = BaseUtil.GetCacheData("FolderPath").ToString();
+                BackUpFolderPath.Text = BaseUtil.GetCacheData("BackUpFolderPath").ToString();
+                Master.Text = BaseUtil.GetCacheData("Master").ToString();
                 //AutoStart.Checked = (bool)BaseUtil.GetCacheData("AutoStart");
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
@@ -128,14 +128,18 @@ namespace FileWatcher
                     return;
                 }
             }
-
+            //if (!dh.CheckExist("make", "ma_code='" + ma_code.Text + "'"))
+            //{
+            //    OperateResult.AppendText("工单号不存在\n");
+            //    return;
+            //}
             XmlWatcher.Path = FolderPath.Text;
             XmlWatcher.Filter = "*.*";
             XmlWatcher.EnableRaisingEvents = true;
             //设置缓存数据
-            //BaseUtil.SetCacheData("FolderPath", FolderPath.Text);
-            //BaseUtil.SetCacheData("BackUpFolderPath", BackUpFolderPath.Text);
-            //BaseUtil.SetCacheData("Master", Master.Text);
+            BaseUtil.SetCacheData("FolderPath", FolderPath.Text);
+            BaseUtil.SetCacheData("BackUpFolderPath", BackUpFolderPath.Text);
+            BaseUtil.SetCacheData("Master", Master.Text);
             //BaseUtil.SetCacheData("AutoStart", AutoStart.Checked);
             Timer.Interval = 1000 * 10;
             Timer.Start();
@@ -176,12 +180,16 @@ namespace FileWatcher
                 string filename = FileName;
                 string folderpath = FileName.Substring(0, FileName.LastIndexOf(@"\"));
                 string SN = FileName.Substring(FileName.LastIndexOf(@"\") + 1);
+                string filetype = FileName.Substring(FileName.LastIndexOf(".") + 1);
                 {
                     try
                     {
-                        string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
+                        string sn1 = SN.Split('.')[0];
+                        string makecode = dh.getFieldDataByCondition("makeserial","ms_makecode","ms_sncode='"+sn1+"'").ToString();
+                        ma_code.Text = makecode;
+                        string ftppath = "/" + ma_code.Text + "/";
                         ftp.UpLoadFile(folderpath, SN, ftppath, "");
-                        int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,STD_RESCODE,std_stepcode)select STEPTESTDETAIL_seq.nextval,'" + SN + "','',sysdate,'" + ftpulr.Split('#')[0] + imaster + "/" + ftppath + SN + ".txt" + "','" + isource + "','' 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)select STEPTESTDETAIL_seq.nextval,'" + SN + "','',sysdate,'" + ftpulr.Split('#')[0] + imaster + "/" + ftppath + SN + "','" + isource + "','' from dual", "insert").ToString());
                         if (num > 0)
                         {
                             OperateResult.AppendText("序列号:" + SN + "上传成功\n");