Explorar el Código

添加计划数据上传

callm hace 1 semana
padre
commit
c4305975ab

+ 3 - 2
FileWatcher/AutoAnalysisXmlByStep.cs

@@ -104,7 +104,7 @@ namespace FileWatcher
             FormBorderStyle = FormBorderStyle.FixedSingle;
             InitDB = new Thread(ConnectDB);
             //添加监控事件
-            XmlWatcher.Created += new FileSystemEventHandler(XmlWatcher_Created);
+            //XmlWatcher.Created += new FileSystemEventHandler(XmlWatcher_Created);
             SetLoadingWindow stw = new SetLoadingWindow(InitDB, "正在启动程序");
             stw.StartPosition = FormStartPosition.CenterScreen;
             stw.ShowDialog();
@@ -227,6 +227,7 @@ namespace FileWatcher
                 string SN = FileName.Substring(FileName.LastIndexOf(@"\") + 1);
                 string filetype = FileName.Substring(FileName.LastIndexOf(".") + 1);
                 {
+                    Console.WriteLine(FileName);
                     try
                     {
                         string sn1 = SN.Split('.')[0];
@@ -464,7 +465,7 @@ namespace FileWatcher
         {
             if (deleteFile.Checked)
             {
-                var AllXmls = Directory.GetFiles(FolderPath.Text, "*.*", SearchOption.AllDirectories).Where(s => s.EndsWith(".txt") || s.EndsWith(".ini"));
+                var AllXmls = Directory.GetFiles(FolderPath.Text, "*.*", SearchOption.AllDirectories).Where(s => s.ToUpper().EndsWith(".TXT") || s.ToUpper().EndsWith(".INI"));
                 foreach (var Xml in AllXmls)
                 {
                     try

+ 2 - 1
FileWatcher/AutoMakeQTYRZ.cs

@@ -175,7 +175,6 @@ namespace FileWatcher
         {
             try
             {
-
                 int len = serialPort1.BytesToRead;
                 Byte[] readBuffer = new Byte[len];
                 serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
@@ -200,6 +199,7 @@ namespace FileWatcher
                             writedata = true;
                         }
                     }
+                    //如果电流不为0,则获取数据,本次获取的数据判断有效
                     if (writedata)
                     {
                         if (电流数据 != 0)
@@ -212,6 +212,7 @@ namespace FileWatcher
                             serialPort1.Write(data, 0, data.Length);
                         }
                     }
+                    //写入获取电流数据2秒后的数据
                     if (realwritedata)
                     {
                         if (电流数据 > 0)

+ 20 - 6
FileWatcher/DataHelper.cs

@@ -9,13 +9,13 @@ 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=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=N_MES;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=YD_CYZZ;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.85)(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=YD_CYZZ;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.85)(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)));";
+
+        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.3.7)(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.3.7)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
 
         public static OracleConnection connection = null;
         OracleCommand command = null;
@@ -40,6 +40,20 @@ namespace FileWatcher
             }
         }
 
+        public DataHelper(string str)
+        {
+            try
+            {
+                //如果选择的是默认数据则直接用配置文件的信息连接,否则选择数据库的账套信息
+                    connection = new OracleConnection(str);
+                connection.Open();
+            }
+            catch (Exception e)
+            {
+
+            }
+        }
+
         /// <summary>
         /// 根据表名获取该表字段数据类型
         /// </summary>

+ 9 - 0
FileWatcher/FileWatcher.csproj

@@ -102,6 +102,12 @@
     <Compile Include="AutoAnalysisXLSJC.Designer.cs">
       <DependentUpon>AutoAnalysisXLSJC.cs</DependentUpon>
     </Compile>
+    <Compile Include="UploadMakePlan.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="UploadMakePlan.Designer.cs">
+      <DependentUpon>UploadMakePlan.cs</DependentUpon>
+    </Compile>
     <Compile Include="AutoMakeQTYRZ.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -281,6 +287,9 @@
     <EmbeddedResource Include="AutoAnalysisXLSJC.resx">
       <DependentUpon>AutoAnalysisXLSJC.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="UploadMakePlan.resx">
+      <DependentUpon>UploadMakePlan.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="AutoMakeQTYRZ.resx">
       <DependentUpon>AutoMakeQTYRZ.cs</DependentUpon>
     </EmbeddedResource>

+ 28 - 5
FileWatcher/Form4.Designer.cs

@@ -43,6 +43,8 @@
             this.button1 = new System.Windows.Forms.Button();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.label7 = new System.Windows.Forms.Label();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
+            this.label8 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.SuspendLayout();
             // 
@@ -54,7 +56,7 @@
             this.StartWatch.Name = "StartWatch";
             this.StartWatch.Size = new System.Drawing.Size(128, 52);
             this.StartWatch.TabIndex = 17;
-            this.StartWatch.Text = "播放";
+            this.StartWatch.Text = "取消";
             this.StartWatch.UseVisualStyleBackColor = true;
             // 
             // textBox1
@@ -135,9 +137,9 @@
             this.label6.AutoSize = true;
             this.label6.Location = new System.Drawing.Point(61, 154);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(94, 24);
+            this.label6.Size = new System.Drawing.Size(58, 24);
             this.label6.TabIndex = 32;
-            this.label6.Text = "选择SOP";
+            this.label6.Text = "备注";
             // 
             // textBox5
             // 
@@ -154,7 +156,7 @@
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(128, 52);
             this.button1.TabIndex = 33;
-            this.button1.Text = "搜索";
+            this.button1.Text = "确定";
             this.button1.UseVisualStyleBackColor = true;
             // 
             // pictureBox1
@@ -174,11 +176,30 @@
             this.label7.TabIndex = 35;
             this.label7.Text = "图片表格";
             // 
+            // comboBox1
+            // 
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Location = new System.Drawing.Point(185, 62);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(121, 32);
+            this.comboBox1.TabIndex = 36;
+            // 
+            // label8
+            // 
+            this.label8.AutoSize = true;
+            this.label8.Location = new System.Drawing.Point(61, 65);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(58, 24);
+            this.label8.TabIndex = 37;
+            this.label8.Text = "原因";
+            // 
             // Form4
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1419, 820);
+            this.Controls.Add(this.label8);
+            this.Controls.Add(this.comboBox1);
             this.Controls.Add(this.label7);
             this.Controls.Add(this.pictureBox1);
             this.Controls.Add(this.button1);
@@ -198,7 +219,7 @@
             this.Text = "Form4";
             this.Load += new System.EventHandler(this.Form4_Load);
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -219,5 +240,7 @@
         private System.Windows.Forms.Button button1;
         private System.Windows.Forms.PictureBox pictureBox1;
         private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.ComboBox comboBox1;
+        private System.Windows.Forms.Label label8;
     }
 }

+ 1 - 1
FileWatcher/Program.cs

@@ -45,7 +45,7 @@ namespace FileWatcher
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
-                    Application.Run(new AutoAnalysisXmlByStep());
+                    Application.Run(new UploadMakePlan());
                 else
                 {
                     //创建启动对象