Pārlūkot izejas kodu

优化日志抓取功能

callm 1 nedēļu atpakaļ
vecāks
revīzija
422f75955b

+ 5 - 4
FileWatcher/AutoSMTRXY.Designer.cs

@@ -282,17 +282,18 @@
             // 
             // BaudRate
             // 
-            this.BaudRate.Location = new System.Drawing.Point(578, 35);
+            this.BaudRate.Location = new System.Drawing.Point(550, 35);
             this.BaudRate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.BaudRate.Name = "BaudRate";
             this.BaudRate.Size = new System.Drawing.Size(146, 35);
             this.BaudRate.TabIndex = 43;
+            this.BaudRate.Text = "9600";
             // 
             // 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(440, 35);
+            this.label3.Location = new System.Drawing.Point(426, 35);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(104, 38);
@@ -325,7 +326,7 @@
             // 
             // pr_pcbacount
             // 
-            this.pr_pcbacount.Location = new System.Drawing.Point(596, 349);
+            this.pr_pcbacount.Location = new System.Drawing.Point(537, 346);
             this.pr_pcbacount.Name = "pr_pcbacount";
             this.pr_pcbacount.Size = new System.Drawing.Size(120, 35);
             this.pr_pcbacount.TabIndex = 45;
@@ -339,7 +340,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(426, 346);
+            this.label7.Location = new System.Drawing.Point(409, 343);
             this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(104, 38);

+ 13 - 1
FileWatcher/AutoSMTRXY.cs

@@ -329,6 +329,18 @@ namespace FileWatcher
                     {
                         lastqty = 0;
                     }
+                    else
+                    {
+                        OperateResult write = plc.Write("D50", 1);
+                        if (write.IsSuccess)
+                        {
+                            OperateResult.AppendText("通过,发送指令D50写入1\n");
+                        }
+                        else
+                        {
+                            OperateResult.AppendText("写入失败\n");
+                        }
+                    }
                     NowQTY.Text = qty.ToString();
                     if (Type.Text == "投入")
                     {
@@ -344,7 +356,7 @@ namespace FileWatcher
                         dh.ExecuteSql("insert into makehourcount(mhc_id,mhc_macode,mhc_indate,mhc_type,mhc_qty,mhc_linecode,mhc_pcbcount)" +
                                  "values(makehourcount_seq.nextval,'" + ma_code.Text + "',sysdate,'" + Type.Text + "','" + (qty - lastqty) + "','" + li_code.Text + "','" + pr_pcbacount.Value + "')", "insert");
                     }
-                    LogicHandler.CS_SetResult(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
+                    LogicHandler.CS_SetResultRXY(ma_code.Text, li_code.Text, "", qty.ToString(), li_code.Text, "OK", out error);
                     lastqty = qty;
                 }
             }

+ 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=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)));";
+        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;

+ 17 - 0
FileWatcher/LogicHandler.cs

@@ -227,7 +227,24 @@ namespace FileWatcher
             return CS_SetResult(iMakeCode, iSourceCode, iSN, passqty, iUserCode, iResult, out oErrorMessage);
         }
 
+        public static bool SetStepResultRXY(string iMakeCode, string iSourceCode, string iSN, string passqty, string iResult, string iUserCode, out string oErrorMessage)
+        {
+            return CS_SetResultRXY(iMakeCode, iSourceCode, iSN, passqty, iUserCode, iResult, out oErrorMessage);
+        }
+
         public static bool CS_SetResult(string iMakeCode, string iSourceCode, string iSN,string passqty, string iUserCode, string iResult, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            string[] param = new string[] { iMakeCode, iSourceCode, iSN, passqty, iUserCode, iResult, oErrorMessage };
+            dh.CallProcedure("CS_SETSTEPRESULT", ref param);
+            oErrorMessage = param[6];
+            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        public static bool CS_SetResultRXY(string iMakeCode, string iSourceCode, string iSN, string passqty, string iUserCode, string iResult, out string oErrorMessage)
         {
             oErrorMessage = "";
             string[] param = new string[] { iMakeCode, iSourceCode, iSN, passqty, iUserCode, iResult, oErrorMessage };

+ 1 - 1
FileWatcher/Program.cs

@@ -47,7 +47,7 @@ namespace FileWatcher
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 {
                     //Application.Run(new AutoAnalysisXmlByStep());
-                    Application.Run(new AutoSMTRXY());
+                    Application.Run(new AutoAnalysisXml());
                 }
                 else
                 {