Browse Source

修改测试工具Log抓取

callm 2 years ago
parent
commit
59d4058065

+ 1 - 2
FileWatcher/AutoAnalysisXml.Designer.cs

@@ -166,7 +166,6 @@
             this.Master.Name = "Master";
             this.Master.Size = new System.Drawing.Size(436, 32);
             this.Master.TabIndex = 15;
-            this.Master.Visible = false;
             // 
             // AutoStart
             // 
@@ -253,7 +252,7 @@
             this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.MaximizeBox = false;
             this.Name = "AutoAnalysisXml";
-            this.Text = "UAS自动过站解析器 2022-04-27";
+            this.Text = "UAS自动过站解析器 2022-05-20  15:05";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
             this.Load += new System.EventHandler(this.Form1_Load);
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).EndInit();

+ 43 - 31
FileWatcher/AutoAnalysisXml.cs

@@ -162,6 +162,8 @@ namespace FileWatcher
             //BaseUtil.SetCacheData("BackUpFolderPath", BackUpFolderPath.Text);
             //BaseUtil.SetCacheData("Master", Master.Text);
             //BaseUtil.SetCacheData("AutoStart", AutoStart.Checked);
+            Timer.Interval = 1000 * 10;
+            Timer.Start();
             //设置按钮不可点击
             StartWatch.Enabled = false;
             ChooseFolder.Enabled = false;
@@ -180,32 +182,32 @@ namespace FileWatcher
 
         private void XmlWatcher_Created(object sender, FileSystemEventArgs e)
         {
-            while (true)
-            {
-                try
-                {
-                    using (Stream stream = File.Open(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
-                    {
-                        if (stream != null)
-                            break;
-                    }
-                }
-                catch (Exception ex)
-                {
-                    Console.WriteLine(ex.Message);
-                }
-            }
-            switch (e.Name.Substring(e.Name.LastIndexOf(".") + 1).ToUpper())
-            {
-                case "TXT":
-                    TxtHandleProcess(e.FullPath);
-                    break;
-                case "XML":
-                    XmlHandleProcess(e.FullPath);
-                    break;
-                default:
-                    break;
-            }
+            //while (true)
+            //{
+            //    try
+            //    {
+            //        using (Stream stream = File.Open(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
+            //        {
+            //            if (stream != null)
+            //                break;
+            //        }
+            //    }
+            //    catch (Exception ex)
+            //    {
+            //        Console.WriteLine(ex.Message);
+            //    }
+            //}
+            //switch (e.Name.Substring(e.Name.LastIndexOf(".") + 1).ToUpper())
+            //{
+            //    case "TXT":
+            //        TxtHandleProcess(e.FullPath);
+            //        break;
+            //    case "XML":
+            //        XmlHandleProcess(e.FullPath);
+            //        break;
+            //    default:
+            //        break;
+            //}
         }
         string nextLine;
         private void TxtHandleProcess(string FileName)
@@ -319,7 +321,7 @@ namespace FileWatcher
                 {
                     OperateResult.AppendText(oErrMessage + "\n");
                     tipform.startthread(oErrMessage, Result);
-                    File.Delete(FileName);
+                    //File.Delete(FileName);
                 }
             }
             else if (Device.Text == "测试设备")
@@ -338,6 +340,11 @@ namespace FileWatcher
                             string oErrMessage = "";
                             string oMSID = "";
                             string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "substr(ms_sncode,0,12)='" + SN + "' order by ms_id").ToString();
+                            if (ms_sncode == "")
+                            {
+                                OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
+                                return;
+                            }
                             isource = "SMT_01_TEST01";
                             iusercode = "SMT_01_TEST01";
                             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");
@@ -360,6 +367,7 @@ namespace FileWatcher
                                         if (num > 0)
                                         {
                                             OperateResult.AppendText("序列号:" + SN + "上传成功\n");
+                                            File.Delete(FileName);
                                         }
                                         else
                                         {
@@ -371,7 +379,6 @@ namespace FileWatcher
                                     {
                                         Console.WriteLine(ex.Message);
                                     }
-                                    File.Delete(FileName);
                                 }
                                 else
                                 {
@@ -380,16 +387,17 @@ namespace FileWatcher
 
                                 }
                                 tipform.startthread("序列号 " + ms_sncode + "通过检测", Result);
+                                OperateResult.AppendText("序列号 " + ms_sncode + "通过检测" + "\n");
                             }
                             else
                             {
-                                File.Delete(FileName);
+                                //File.Delete(FileName);
                                 OperateResult.AppendText(oErrMessage + "\n");
                                 tipform.startthread(oErrMessage, Result);
                             }
                         }
                     }
-                    OperateResult.AppendText("解析成功:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + FileName + "\n");
+                    //OperateResult.AppendText("解析成功:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + FileName + "\n");
                 }
                 catch (Exception e)
                 {
@@ -699,7 +707,11 @@ namespace FileWatcher
 
         private void Timer_Tick(object sender, EventArgs e)
         {
-            dh.ExecuteSql("select sysdate from dual", "select");
+            var AllXmls = Directory.GetFiles(FolderPath.Text, "*.txt");
+            foreach (var Xml in AllXmls)
+            {
+                TxtHandleProcess(Xml);
+            }
         }
     }
 }

+ 2 - 2
FileWatcher/DataHelper.cs

@@ -9,9 +9,9 @@ namespace FileWatcher
     class DataHelper
     {
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DGW;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=JWXH;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
-        public static string DBConnectionString= "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DGW;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        public static string DBConnectionString= "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=JWXH;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         public static OracleConnection connection = null;
         OracleCommand command = null;
         int ReconnectTime = 0;

+ 83 - 0
FileWatcher/DateWeek.Designer.cs

@@ -0,0 +1,83 @@
+namespace FileWatcher
+{
+    partial class DateWeek
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.button1 = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(102, 53);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(226, 35);
+            this.textBox1.TabIndex = 0;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(98, 130);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(0, 24);
+            this.label1.TabIndex = 1;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(363, 53);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(105, 40);
+            this.button1.TabIndex = 2;
+            this.button1.Text = "计算";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // DateWeek
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(718, 229);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.textBox1);
+            this.Name = "DateWeek";
+            this.Text = "DateWeek";
+            this.Load += new System.EventHandler(this.DateWeek_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Button button1;
+    }
+}

+ 140 - 0
FileWatcher/DateWeek.cs

@@ -0,0 +1,140 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace FileWatcher
+{
+    public partial class DateWeek : Form
+    {
+        public DateWeek()
+        {
+            InitializeComponent();
+        }
+
+        private void DateWeek_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            int year, year1, year2, month1, month2, day1, day2, week, sum = 0;
+
+            int[] days = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+            int i;
+            if (textBox1.Text.Length != 4)
+            {
+                MessageBox.Show("请输入格式如2040,年2位,周数2位");
+                return;
+            }
+            Console.Write("年:");
+            year = int.Parse(textBox1.Text.Substring(0, 2));
+            Console.Write("周次:");
+            week = int.Parse(textBox1.Text.Substring(2, 2));
+
+            if (year < 0)
+            {
+                Console.WriteLine("年份错误,必须大于等于0");
+                return;
+            }
+
+            if (week < 1 || week > 54)
+            {
+                Console.WriteLine("周次错误,必须位于 1 .. 53 之间");
+                return;
+            }
+            sum += 7 * (week - 1);
+            //修正总天数
+            switch (DateTime.Parse(year + "-1-1").DayOfWeek)
+            {
+                case DayOfWeek.Tuesday:
+                    {
+                        sum -= 1;
+                        break;
+                    }
+                case DayOfWeek.Wednesday:
+                    {
+                        sum -= 2;
+                        break;
+                    }
+                case DayOfWeek.Thursday:
+                    {
+                        sum -= 3;
+                        break;
+                    }
+                case DayOfWeek.Friday:
+                    {
+                        sum -= 4;
+                        break;
+                    }
+                case DayOfWeek.Saturday:
+                    {
+                        sum -= 5;
+                        break;
+                    }
+                case DayOfWeek.Sunday:
+                    {
+                        sum -= 6;
+                        break;
+                    }
+                default:
+                    break;
+            }
+
+            if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0))
+            {
+                days[1] = 29;
+            }
+
+            for (i = 0; i < days.Length; i++)
+            {
+                if (sum >= days[i])
+                {
+                    sum -= days[i];
+                }
+                else
+                {
+                    break;
+                }
+            }
+
+            year1 = year;
+
+            month1 = i + 1;
+
+            day1 = sum + 1;
+
+            //修改开始日期
+
+            if (day1 < 1)
+            {
+                day1 += days[11];
+                month1 = 12;
+                year1--;
+            }
+
+            year2 = year1;
+            month2 = month1;
+            day2 = day1 + 6;
+
+            if (day2 > days[month1 - 1])
+
+            {
+                day2 -= days[month1 - 1];
+                month2++;
+                if (month2 > 12)
+                {
+                    month2 = 1;
+                    year2++;
+                }
+            }
+            label1.Text = year + "年第" + week + "周 : " + year1 + "年" + month1 + "月" + day1 + "日 ~ " + year2 + "年" + month2 + "月" + day2 + "日";
+        }
+    }
+}

+ 120 - 0
FileWatcher/DateWeek.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 18 - 0
FileWatcher/FileWatcher.csproj

@@ -59,12 +59,24 @@
     </Compile>
     <Compile Include="BaseUtil.cs" />
     <Compile Include="DataHelper.cs" />
+    <Compile Include="DateWeek.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="DateWeek.Designer.cs">
+      <DependentUpon>DateWeek.cs</DependentUpon>
+    </Compile>
     <Compile Include="Form2.cs">
       <SubType>Form</SubType>
     </Compile>
     <Compile Include="Form2.Designer.cs">
       <DependentUpon>Form2.cs</DependentUpon>
     </Compile>
+    <Compile Include="Form3.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form3.Designer.cs">
+      <DependentUpon>Form3.cs</DependentUpon>
+    </Compile>
     <Compile Include="ftpOperater.cs" />
     <Compile Include="LoadingCircle.cs">
       <SubType>Component</SubType>
@@ -102,9 +114,15 @@
     <EmbeddedResource Include="AutoAnalysisXml.resx">
       <DependentUpon>AutoAnalysisXml.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="DateWeek.resx">
+      <DependentUpon>DateWeek.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Form2.resx">
       <DependentUpon>Form2.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Form3.resx">
+      <DependentUpon>Form3.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="SetLoadingWindow.resx">
       <DependentUpon>SetLoadingWindow.cs</DependentUpon>
     </EmbeddedResource>

+ 95 - 0
FileWatcher/Form3.Designer.cs

@@ -0,0 +1,95 @@
+namespace FileWatcher
+{
+    partial class Form3
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.button1 = new System.Windows.Forms.Button();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+            this.richTextBox2 = new System.Windows.Forms.RichTextBox();
+            this.SuspendLayout();
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(487, 60);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(105, 40);
+            this.button1.TabIndex = 4;
+            this.button1.Text = "获取";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(53, 60);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(392, 35);
+            this.textBox1.TabIndex = 3;
+            this.textBox1.Text = "C:\\Users\\callm\\Desktop\\";
+            // 
+            // richTextBox1
+            // 
+            this.richTextBox1.Location = new System.Drawing.Point(-43, -88);
+            this.richTextBox1.Name = "richTextBox1";
+            this.richTextBox1.Size = new System.Drawing.Size(100, 96);
+            this.richTextBox1.TabIndex = 5;
+            this.richTextBox1.Text = "";
+            // 
+            // richTextBox2
+            // 
+            this.richTextBox2.Location = new System.Drawing.Point(53, 160);
+            this.richTextBox2.Name = "richTextBox2";
+            this.richTextBox2.Size = new System.Drawing.Size(379, 372);
+            this.richTextBox2.TabIndex = 6;
+            this.richTextBox2.Text = "";
+            // 
+            // Form3
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(686, 624);
+            this.Controls.Add(this.richTextBox2);
+            this.Controls.Add(this.richTextBox1);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.textBox1);
+            this.Name = "Form3";
+            this.Text = "Form3";
+            this.Load += new System.EventHandler(this.Form3_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.RichTextBox richTextBox1;
+        private System.Windows.Forms.RichTextBox richTextBox2;
+    }
+}

+ 39 - 0
FileWatcher/Form3.cs

@@ -0,0 +1,39 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace FileWatcher
+{
+    public partial class Form3 : Form
+    {
+
+        public Form3()
+        {
+            InitializeComponent();
+        }
+
+        private void Form3_Load(object sender, EventArgs e)
+        {
+         
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            GetFile(textBox1.Text);
+        }
+
+        void GetFile(string FilePath) {
+
+            DirectoryInfo root = new DirectoryInfo(FilePath);
+            DirectoryInfo[] dics = root.GetDirectories();
+            for (int i = 0; i < dics.Length; i++)
+            {
+                GetFile(dics[i].FullName);
+                richTextBox2.AppendText(dics[i].Name+"\n");
+            }
+        }
+    }
+}

+ 120 - 0
FileWatcher/Form3.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 1 - 1
FileWatcher/Program.cs

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

+ 28 - 1
FileWatcher/测试记录解析DCW.Designer.cs

@@ -35,6 +35,8 @@
             this.ChooseFolder = new System.Windows.Forms.Button();
             this.FolderPath = new System.Windows.Forms.TextBox();
             this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.ma_code = new System.Windows.Forms.TextBox();
             this.SuspendLayout();
             // 
             // OperateResult
@@ -45,7 +47,7 @@
             this.OperateResult.Location = new System.Drawing.Point(38, 15);
             this.OperateResult.Margin = new System.Windows.Forms.Padding(6);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(1336, 677);
+            this.OperateResult.Size = new System.Drawing.Size(1336, 600);
             this.OperateResult.TabIndex = 0;
             this.OperateResult.Text = "";
             // 
@@ -99,11 +101,34 @@
             this.label1.TabIndex = 12;
             this.label1.Text = "监控文件夹";
             // 
+            // label2
+            // 
+            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            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(80, 654);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(104, 38);
+            this.label2.TabIndex = 15;
+            this.label2.Text = "工单号";
+            // 
+            // ma_code
+            // 
+            this.ma_code.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.ma_code.Location = new System.Drawing.Point(201, 660);
+            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 = 16;
+            // 
             // 测试记录解析DCW
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1402, 845);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.label2);
             this.Controls.Add(this.ChooseFolder);
             this.Controls.Add(this.FolderPath);
             this.Controls.Add(this.label1);
@@ -126,6 +151,8 @@
         private System.Windows.Forms.Button ChooseFolder;
         private System.Windows.Forms.TextBox FolderPath;
         private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox ma_code;
     }
 }
 

+ 26 - 21
FileWatcher/测试记录解析DCW.cs

@@ -78,33 +78,33 @@ namespace FileWatcher
                     foreach (FileInfo f in file) //显示当前目录所有文件   
                     {
                         string filename = f.FullName;
-                        if (filename.Substring(filename.LastIndexOf(".") + 1).ToUpper() == "TXT")
+                        if (filename.Substring(filename.LastIndexOf(".") + 1).ToUpper() == "INI")
                         {
                             folderpath = f.FullName.Substring(0, f.FullName.LastIndexOf(@"\"));
-                            SN = f.Name.Split('.')[0].ToUpper();
-                            if (SN.Length == 12)
+                            SN = f.Name.Split('.')[0].ToUpper().Split('_')[0];
+                            //if (SN.Length == 12)
+                            //{
+                            try
                             {
-                                try
+                                string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
+                                ftp.UpLoadFile(folderpath, f.Name, ftppath, "");
+                                int dt = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)values( STEPTESTDETAIL_seq.nextval,'" + SN + "','" + ma_code.Text + "',sysdate,'http://81.71.42.91:8099/ftp" + ftppath + f.Name + "')", "insert").ToString());
+                                if (dt > 0)
                                 {
-                                    string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
-                                    ftp.UpLoadFile(folderpath, f.Name, ftppath, "");
-                                    int dt = 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://81.71.42.91:8099/ftp" + ftppath + f.Name + "' from makeserial where substr(ms_sncode,0,12)='" + SN + "'", "insert").ToString());
-                                    if (dt > 0)
-                                    {
-                                        OperateResult.AppendText("序列号:" + SN + "上传成功\n");
-                                    }
-                                    else
-                                    {
-                                        OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
-                                        MessageBox.Show("序列号: " + SN + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
-                                    }
+                                    OperateResult.AppendText("序列号:" + SN + "上传成功\n");
                                 }
-                                catch (Exception ex)
-                                {
-                                    Console.WriteLine(ex.Message);
-                                }
-                                File.Delete(f.FullName);
+                                //else
+                                //{
+                                //    OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
+                                //    MessageBox.Show("序列号: " + SN + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
+                                //}
+                            }
+                            catch (Exception ex)
+                            {
+                                Console.WriteLine(ex.Message);
                             }
+                            File.Delete(f.FullName);
+                            //}
                         }
                     }
                 }
@@ -187,6 +187,11 @@ namespace FileWatcher
 
         private void Start_Click(object sender, EventArgs e)
         {
+            if (!dh.CheckExist("make", "ma_code='" + ma_code.Text + "'"))
+            {
+                OperateResult.AppendText("工单" + ma_code.Text + "不存在\n");
+                return;
+            }
             timer1.Start();
         }
     }

+ 27 - 0
UAS_MES_MAXMADE/DataOperate/DataHelper.cs

@@ -1128,5 +1128,32 @@ namespace UAS_MES_NEW.DataOperate
                 LogManager.DoLog("超时重连");
             }
         }
+
+        public void CallProcedure(string ProcedureName, string[] ParamName, ref string[] param)
+        {
+            command = new OracleCommand(ProcedureName);
+            command.Connection = connection;
+            Reconnect(command);
+            command.CommandText = ProcedureName;
+            command.CommandType = CommandType.StoredProcedure;
+            for (int i = 0; i < param.Length; i++)
+            {
+                command.Parameters.Add(new OracleParameter(ParamName[i], OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
+                //command.Parameters.Add(new OracleParameter(ParamName[i], OracleType.VarChar, 200, ParameterDirection.InputOutput, "", DataRowVersion.Default, true, param[i]));
+            }
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            for (int i = 0; i < command.Parameters.Count; i++)
+                param[i] = command.Parameters[i].Value.ToString();
+            command.Dispose();
+        }
     }
 }

+ 132 - 0
UAS_MES_MAXMADE/PublicMethod/LogicHandler.cs

@@ -1329,5 +1329,137 @@ namespace UAS_MES_NEW.PublicMethod
             sql.Append(":SourceCode,:stepcode,:ifreprint,sysdate,:inman)");
             dh.ExecuteSql(sql.ToString(), "insert", printValue, printType, MakeCode, prodCode, sourceCode, stepcode, ifRePrint, userCode);
         }
+
+        /// <summary>
+        /// 分配Mac地址和BT地址
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="oWIFI"></param>
+        /// <param name="oBT"></param>
+        /// <param name="oCode1"></param>
+        /// <param name="oCode2"></param>
+        /// <param name="oCdoe3"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        public static bool GetAddressRangeByMO(string iSN, out Dictionary<string, string> oInfo, out string oErrMessage)
+        {
+            oInfo = new Dictionary<string, string>();
+            string oWIFI = "";
+            string oBT = "";
+            string oCode1 = "";
+            string oCode2 = "";
+            string oCdoe3 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string omakeCode = "";
+            GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
+            string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_o_mac", "v_o_bt", "v_o_code1", "v_o_code2", "v_o_code3", "v_o_errmsg" };
+            dh.CallProcedure("CS_GETADDRESSBYMAKECODE", ParamName, ref param);
+            oInfo.Add("MAC", param[2]);
+            oInfo.Add("BT", param[3]);
+            oInfo.Add("Code1", param[4]);
+            oInfo.Add("Code2", param[5]);
+            oInfo.Add("Code3", param[6]);
+            oErrMessage = param[7];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 获取工单的最近一条执行记录
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="oMoCode"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        public static bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage)
+        {
+            //取MakeProcess表中的执行记录ID最大的一个工单的号码
+            oMoCode = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            sql.Clear();
+            sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select sn from ");
+            sql.Append("makesnrelation where beforesn='" + iSN + "' and sn<>' '  union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            string ms_id = dt.Rows[0][0].ToString();
+            oMoCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
+            if (oMoCode != "")
+                return true;
+            else
+            {
+                oErrMessage = "序列号:" + iSN + " 未归属工单";
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 保存Mac地址和BT地址
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="iMac"></param>
+        /// <param name="iBT"></param>
+        /// <param name="iCode1"></param>
+        /// <param name="iCode2"></param>
+        /// <param name="iCode3"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        public static bool SetAddressInfo(string iSN, string iMac, string iBT, string iCode1, string iCode2, string iCode3, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, iMac, iBT, iCode1, iCode2, iCode3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_mac", "v_i_bt", "v_i_code1", "v_i_code2", "v_i_code3", "v_o_errmsg" };
+            dh.CallProcedure("CS_SETADDRESSINFO", ParamName, ref param);
+            oErrMessage = param[6];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        public static bool GetMobileAllInfo(string iSN, out string oJson, out string oErrMessage)
+        {
+            Dictionary<string, string> oInfo = new Dictionary<string, string>();
+            oErrMessage = "";
+            oJson = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            Dictionary<string, string> MacInfo = new Dictionary<string, string>();
+            if (!GetAddressRangeByMO(iSN, out MacInfo, out oErrMessage))
+            {
+                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                    return true;
+                else
+                    return false;
+            }
+            oJson = MacInfo["Code1"];
+            if (!SetAddressInfo(iSN, MacInfo["MAC"] == "null" ? "" : MacInfo["MAC"], MacInfo["BT"] == "null" ? "" : MacInfo["BT"], MacInfo["Code1"] == "null" ? "" : MacInfo["Code1"], MacInfo["Code2"] == "null" ? "" : MacInfo["Code2"], MacInfo["Code3"] == "null" ? "" : MacInfo["Code3"], out oErrMessage))
+            {
+                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                    return true;
+                else
+                    return false;
+            }
+            return true;
+        }
     }
 }

+ 9 - 0
UAS_MES_MAXMADE/UAS_MES_MAXMADE.csproj

@@ -548,6 +548,12 @@
     <Compile Include="FunctionCode\Make\Make_SeqTransformLabelPrint.Designer.cs">
       <DependentUpon>Make_SeqTransformLabelPrint.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Make\Make_SeqTransformPrint.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Make\Make_SeqTransformPrint.Designer.cs">
+      <DependentUpon>Make_SeqTransformPrint.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\Make\Make_SMTStencil.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1268,6 +1274,9 @@
     <EmbeddedResource Include="FunctionCode\Make\Make_SeqTransformLabelPrint.resx">
       <DependentUpon>Make_SeqTransformLabelPrint.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Make\Make_SeqTransformPrint.resx">
+      <DependentUpon>Make_SeqTransformPrint.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Make\Make_SMTStencil.resx">
       <DependentUpon>Make_SMTStencil.cs</DependentUpon>
     </EmbeddedResource>

+ 1221 - 0
UMES/MESHelper.cs

@@ -0,0 +1,1221 @@
+using Oracle.ManagedDataAccess.Client;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Web.Script.Serialization;
+
+namespace UMES
+{
+
+    [Guid("974DEAD2-9D4C-4728-87EA-2407752E300F")]
+    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
+    public interface IMESHelper
+    {
+        [DispId(12)]
+        bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
+        bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage);
+        bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord, out string oErrMessage);
+        bool GetAddressRangeByMO(string iSN, out Dictionary<string, string> oInfo, out string oErrMessage);
+        bool SetAddressInfo(string iSN, string iMac, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage);
+        bool SetTestDetail(string iSN, string iTestResult, string iResCode, string[,] iTestDetail, out string oErrMessage);
+        bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out Dictionary<string, string> oInfo, out string oErrMessage);
+        bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
+        bool GetMobileAllInfo(string iSnCode, out string oInfo, out string oErrorMessage);
+        bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iOperator, string iResult, string iErrCode, string flag, out string oErrorMessage);
+        bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage);
+        bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage);
+        bool GetSninfo(string iSN, out string oMoCode, out int oMaQty, out string oPrDetail, out DateTime oDate, out string oErrMessage);
+    }
+
+
+    [Guid("5379A8F6-EB38-4A2B-9050-52AD9757E12D")]
+    [ComSourceInterfaces(typeof(IMESHelper))]
+    [ClassInterface(ClassInterfaceType.None)]
+    [ProgId("UMES.MESHelper")]
+    public class MESHelper : IMESHelper
+    {
+        //用于拼接SQL 
+        StringBuilder sql = new StringBuilder();
+        //用于存放批量执行的SQL
+        List<string> sqls = new List<string>();
+        //系统默认的的连接字符串
+        private string ConnectionStrings = "Data Source=192.168.10.10/orcl;User ID=MES;PassWord=select!#%*(;";
+        //用户选择的数据库的连接字符串
+        private OracleConnection connection;
+        //用户选择的数据库的连接字符串
+        private OracleCommand command = null;
+
+        public MESHelper()
+        {
+            connection = new OracleConnection(ConnectionStrings);
+        }
+
+        public MESHelper(string IP)
+        {
+            connection = new OracleConnection("Data Source=" + IP + "/orcl;User ID=MES;PassWord=select!#%*(;");
+        }
+
+        /// <summary>
+        /// 检测当前的岗位资源对应的工序
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="iResCode"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("序列号对应工序检测")]
+        public bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
+            string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
+            CallProcedure("CS_CHECKSTEPSNANDMACODE", ParamName, ref param);
+            oErrMessage = param[6];
+            DataTable dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id=(  select max(ms_id) from makeserial where ms_sncode  in ( select '" + iSN + "' from dual union select sn from makesnrelation where beforesn='" + iSN + "' and sn<>' '  union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' '))", "select");
+            string ms_status = "";
+            string ms_stepcode = "";
+            string ms_nextstepcode = "";
+            if (dt.Rows.Count > 0)
+            {
+                ms_status = dt.Rows[0]["ms_status"].ToString();
+                ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
+                ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
+            }
+            string stepcode = GetStepCodeBySource(iResCode);
+            if (ms_nextstepcode != "" && ms_nextstepcode != stepcode)
+            {
+                oErrMessage = "当前序列号下一工序" + ms_nextstepcode;
+                return false;
+            }
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
+            {
+                if (ms_status == "3")
+                {
+                    oErrMessage = "";
+                }
+                DataTable dt1 = (DataTable)ExecuteSql("select 1 from makebadcount where mbc_sncode='" + iSN + "' and mbc_stepcode='" + stepcode + "' and mbc_status=0", "select");
+                int BadCount = dt1.Rows.Count;
+                //测试不良3次不允许再测试,必须先维修
+                if (BadCount == 3)
+                {
+                    oErrMessage = stepcode + "连续三次测试不良,请进行维修";
+                    return false;
+                }
+                return true;
+            }
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 验证用户身份信息
+        /// </summary>
+        /// <param name="iUserCode"></param>
+        /// <param name="oErrorMessage"></param>
+        /// <returns></returns>
+        private bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            string SQL = "select em_code from employee where em_code=:UserName and em_password =:PassWord";
+            DataTable dt;
+            dt = (DataTable)ExecuteSql(SQL, "select", iUserCode, iPassWord);
+            if (dt.Rows.Count > 0)
+                return true;
+            else
+            {
+                oErrorMessage = "用户名或者密码不正确!";
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 验证用户身份信息和岗位资源
+        /// </summary>
+        /// <param name="iUserCode"></param>
+        /// <param name="iResCode"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("验证身份信息")]
+        public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord, out string oErrMessage)
+        {
+            oErrMessage = "";
+            if (iUserCode == "" || iPassWord == "" || iResCode == "")
+            {
+                oErrMessage = "用户名,密码,岗位资源必须填写";
+                return false;
+            }
+            if (CheckUserLogin(iUserCode, iPassWord, out oErrMessage))
+            {
+                string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
+                DataTable dt;
+                dt = (DataTable)ExecuteSql(SQL, "select", iUserCode);
+                if (dt.Rows.Count > 0)
+                {
+                    string em_name = dt.Rows[0]["em_name"].ToString();
+                    string em_type = dt.Rows[0]["em_type"].ToString();
+                    if (iResCode == "")
+                    {
+                        oErrMessage = "岗位资源不允许为空";
+                        return false;
+                    }
+                    if (em_type == "admin")
+                    {
+                        if (CheckExist("Source", "sc_code='" + iResCode + "' and sc_statuscode='AUDITED'"))
+                        {
+                            return true;
+                        }
+                        else
+                        {
+                            oErrMessage = "岗位资源编号错误或者未审核!";
+                            return false;
+                        }
+                    }
+                    else
+                    {
+                        dt = getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "ur_resourcecode" }, "eg_emcode = '" + iUserCode + "' and sc_statuscode='AUDITED'");
+                        //如果存在该编号
+                        if (dt.Rows.Count > 0)
+                        {
+                            //判断如果多个岗位资源存在,用户输入的只要在其中就行
+                            for (int i = 0; i < dt.Rows.Count; i++)
+                            {
+                                if (dt.Rows[i]["ur_resourcecode"].ToString() == iResCode)
+                                    return true;
+                            }
+                            oErrMessage = "用户不处于当前资源所属分组!";
+                        }
+                        else
+                            oErrMessage = "岗位资源编号错误或者未审核!";
+                    }
+                }
+                else
+                    oErrMessage = "用户不存在!";
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 分配Mac地址和BT地址
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="oWIFI"></param>
+        /// <param name="oBT"></param>
+        /// <param name="oCode1"></param>
+        /// <param name="oCode2"></param>
+        /// <param name="oCdoe3"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("分配MAC和BT信息")]
+        public bool GetAddressRangeByMO(string iSN, out Dictionary<string, string> oInfo, out string oErrMessage)
+        {
+            oInfo = new Dictionary<string, string>();
+            string oWIFI = "";
+            string oBT = "";
+            string oCode1 = "";
+            string oCode2 = "";
+            string oCdoe3 = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string omakeCode = "";
+            GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
+            string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_o_mac", "v_o_bt", "v_o_code1", "v_o_code2", "v_o_code3", "v_o_errmsg" };
+            CallProcedure("CS_GETADDRESSBYMAKECODE", ParamName, ref param);
+            oInfo.Add("MAC", param[2]);
+            oInfo.Add("BT", param[3]);
+            oInfo.Add("Code1", param[4]);
+            oInfo.Add("Code2", param[5]);
+            oInfo.Add("Code3", param[6]);
+            oErrMessage = param[7];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 输入的 SN 号查找在制品是否有 IMEI 信息存在,如果存在则将 IMEI 信息传出,如果没有则在该工单下未使用的 IMEI 中随机分配一组
+        /// 如果iIMEI1、iNetCode不为空,则分别作为获取的附件加条件。
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="iIMEI1"></param>
+        /// <param name="iNetCode"></param>
+        /// <param name="oIMEI1"></param>
+        /// <param name="oIMEI2"></param>
+        /// <param name="oIMEI3"></param>
+        /// <param name="oMEID"></param>
+        /// <param name="oNetCode"></param>
+        /// <param name="oPSN"></param>
+        /// <param name="oID1"></param>
+        /// <param name="oID2"></param>
+        /// <param name="oID3"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("分配IMEI和NetCode信息")]
+        public bool GetMEIOrNetCodeRange(string iSN, string iIMEI1, string iNetCode, out Dictionary<string, string> oInfo, out string oErrMessage)
+        {
+            oInfo = new Dictionary<string, string>();
+            string oIMEI1 = "";
+            string oIMEI2 = "";
+            string oMEID = "";
+            string oNetCode = "";
+            string oPSN = "";
+            string oID1 = "";
+            string oID2 = "";
+            string oID3 = "";
+
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_i_imei", "v_i_netcode", "v_o_imei1", "v_o_imei2", "v_o_imei3", "v_o_meid", "v_o_netcode", "v_o_psn", "v_o_id1", "v_o_id2", "v_o_id3", "v_o_errmsg" };
+            CallProcedure("CS_GETIMEIORNETCODERANGE", ParamName, ref param);
+            oInfo.Add("IMEI1", param[4]);
+            oInfo.Add("IMEI2", param[5]);
+            oInfo.Add("MEID", param[7]);
+            oInfo.Add("NETCODE", param[8]);
+            oInfo.Add("PSN", param[9]);
+            oInfo.Add("ID1", param[10]);
+            oInfo.Add("ID2", param[11]);
+            oInfo.Add("ID3", param[12]);
+            oErrMessage = param[13];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 获取工单的最近一条执行记录
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="oMoCode"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("获取序列号对应工单信息")]
+        public bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage)
+        {
+            //取MakeProcess表中的执行记录ID最大的一个工单的号码
+            oMoCode = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            sql.Clear();
+            sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select sn from ");
+            sql.Append("makesnrelation where beforesn='" + iSN + "' and sn<>' '  union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
+            DataTable dt = (DataTable)ExecuteSql(sql.ToString(), "select");
+            string ms_id = dt.Rows[0][0].ToString();
+            oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
+            if (oMoCode != "")
+                return true;
+            else
+            {
+                oErrMessage = "序列号:" + iSN + " 未归属工单";
+                return false;
+            }
+        }
+
+        [Description("获取序列号对应工单信息")]
+        public bool GetSninfo(string iSN, out string oMoCode, out int oMaQty, out string oPrSpec, out DateTime oDate, out string oErrMessage)
+        {
+            //取MakeProcess表中的执行记录ID最大的一个工单的号码
+            oMoCode = "";
+            oMaQty = 0;
+            oPrSpec = "";
+            oDate = DateTime.Now;
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            sql.Clear();
+            sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select sn from ");
+            sql.Append("makesnrelation where beforesn='" + iSN + "' and sn<>' '  union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
+            DataTable dt = (DataTable)ExecuteSql(sql.ToString(), "select");
+            string ms_id = dt.Rows[0][0].ToString();
+            oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
+            if (oMoCode != "")
+            {
+                dt = (DataTable)ExecuteSql("select ms_makecode,REGEXP_SUBSTR(pr_spec,'[a-zA-Z]{2}-[A-Z0-9]{1,5}-[A-Z0-9]{2,3}')pr_spec,ma_qty,to_char(ms_indate,'yyyy-mm-dd hh24:mi:ss')ms_indate from makeserial left join product on pr_code=ms_prodcode left join make on ma_code=ms_makecode where ms_id='" + ms_id + "' order by ms_id desc", "select");
+                oMaQty = int.Parse(dt.Rows[0]["ma_qty"].ToString());
+                oPrSpec = dt.Rows[0]["pr_spec"].ToString();
+                oDate = DateTime.Parse(dt.Rows[0]["ms_indate"].ToString());
+                return true;
+            }
+            else
+            {
+                oErrMessage = "序列号:" + iSN + " 未归属工单";
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 获取序列号的所有串号信息
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="oWIFI"></param>
+        /// <param name="oBT"></param>
+        /// <param name="oCode1"></param>
+        /// <param name="oCode2"></param>
+        /// <param name="oCode3"></param>
+        /// <param name="oIMEI1"></param>
+        /// <param name="oIMEI2"></param>
+        /// <param name="oIMEI3"></param>
+        /// <param name="oMEID"></param>
+        /// <param name="oNetCode"></param>
+        /// <param name="oPSN"></param>
+        /// <param name="oID1"></param>
+        /// <param name="oID2"></param>
+        /// <param name="oID3"></param>
+        /// <param name="oID4"></param>
+        /// <param name="oID5"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("查询已分配的信息")]
+        public bool GetMobileAllInfo(string iSN, out string oJson, out string oErrMessage)
+        {
+            JavaScriptSerializer jss = new JavaScriptSerializer();
+            Dictionary<string, string> oInfo = new Dictionary<string, string>();
+            oErrMessage = "";
+            oJson = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            Dictionary<string, string> MacInfo = new Dictionary<string, string>();
+            if (!GetAddressRangeByMO(iSN, out MacInfo, out oErrMessage))
+            {
+                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                    return true;
+                else
+                    return false;
+            }
+            if (!SetAddressInfo(iSN, MacInfo["MAC"] == "null" ? "" : MacInfo["MAC"], MacInfo["BT"] == "null" ? "" : MacInfo["BT"], MacInfo["Code1"] == "null" ? "" : MacInfo["Code1"], MacInfo["Code2"] == "null" ? "" : MacInfo["Code2"], MacInfo["Code3"] == "null" ? "" : MacInfo["Code3"], out oErrMessage))
+            {
+                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                    return true;
+                else
+                    return false;
+            }
+            //通过序列号获取最近操作的工单号
+            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
+            if (ms_id != "")
+            {
+                DataTable dt = getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
+                if (dt.Rows.Count > 0)
+                {
+                    string Code1 = "";
+                    string Code2 = "";
+                    string Code3 = "";
+                    string Code4 = "";
+                    string Code5 = "";
+                    string Code6 = "";
+                    string Code7 = "";
+                    string Code8 = "";
+                    string Code9 = "";
+                    string Code10 = "";
+                    string Code11 = "";
+                    string Code12 = "";
+                    string Code13 = "";
+                    string Code14 = "";
+                    string Code15 = "";
+                    string Code16 = "";
+                    string Code17 = "";
+                    string Code18 = "";
+                    string Code19 = "";
+                    string Code20 = "";
+                    string Code21 = "";
+                    string Code22 = "";
+                    string Code23 = "";
+                    string Code24 = "";
+                    string Code25 = "";
+                    string[] param = new string[] { ms_id, Code1, Code2, Code3, Code4, Code5, Code6, Code7, Code8, Code9, Code10, Code11, Code12, Code13, Code14, Code15, Code16, Code17, Code18, Code19, Code20, Code21, Code22, Code23, Code24, Code25 };
+                    string[] ParamName = new string[] { "v_ms_id", "v_i_code1", "v_i_code2", "v_i_code3", "v_i_code4", "v_i_code5", "v_i_code6", "v_i_code7", "v_i_code8", "v_i_code9", "v_i_code10", "v_i_code11", "v_i_code12", "v_i_code13", "v_i_code14", "v_i_code15", "v_i_code16", "v_i_code17", "v_i_code18", "v_i_code19", "v_i_code20", "v_i_code21", "v_i_code22", "v_i_code23", "v_i_code24", "v_i_code25" };
+                    CallProcedure("GetMobileAllInfo_NEW", ParamName, ref param);
+                    for (int i = 1; i < param.Length; i++)
+                    {
+                        //获取出来的参数使用^分割
+                        if (param[i] != "" && param[i] != "null" && param[i] != null)
+                        {
+                            oInfo.Add(param[i].Split('^')[0], param[i].Split('^')[1]);
+                        }
+                    }
+                    oJson = jss.Serialize(oInfo);
+                    oErrMessage = "";
+                    return true;
+                }
+                else
+                {
+                    oErrMessage = "序列号" + iSN + "不存在";
+                    return false;
+                }
+            }
+            else
+            {
+                oErrMessage = "序列号" + iSN + "不存在";
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 记录操作日志
+        /// </summary>
+        /// <param name="iSnCode"></param>
+        /// <param name="iMakeCode"></param>
+        /// <param name="iMPKind"></param>
+        /// <param name="result"></param>
+        /// <param name="iUserCode"></param>
+        private void InsertMakeProcess(string iSnCode, string iMakeCode, string iSourceCode, string iMPKind, string result, string iUserCode)
+        {
+            string CurrentStep = "";
+            string LineCode = "";
+            string CurrentStepName = "";
+            GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
+            sql.Length = 0;
+            sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
+            sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
+            sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,'" + CurrentStep + "','" + CurrentStepName + "',");
+            sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
+            sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makeserial on ms_makecode=ma_code left join step on st_code=ms_stepcode ");
+            sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and st_code='" + CurrentStep + "'");
+            ExecuteSql(sql.ToString(), "insert");
+        }
+
+        /// <summary>
+        /// 保存Mac地址和BT地址
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="iMac"></param>
+        /// <param name="iBT"></param>
+        /// <param name="iCode1"></param>
+        /// <param name="iCode2"></param>
+        /// <param name="iCode3"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("写入SN的Wifi,BT信息")]
+        public bool SetAddressInfo(string iSN, string iMac, string iBT, string iCode1, string iCode2, string iCode3, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, iMac, iBT, iCode1, iCode2, iCode3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_mac", "v_i_bt", "v_i_code1", "v_i_code2", "v_i_code3", "v_o_errmsg" };
+            CallProcedure("CS_SETADDRESSINFO", ParamName, ref param);
+            oErrMessage = param[6];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        [Description("序列号跳到下一 步")]
+        private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").ToString();
+            string CurrentStep = GetStepCodeBySource(iSourceCode);
+            string BgCode = getFieldDataByCondition("step", "st_badgroupcode", "st_code='" + CurrentStep + "'").ToString();
+            switch (iResult)
+            {
+                case "OK":
+                    break;
+                case "NG":
+                    if (iErrCode == "")
+                    {
+                        oErrMessage = "测试结果为NG时必须传递不良代码";
+                        return false;
+                    }
+                    else
+                    {
+                        UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='" + iMakeCode + "' and mb_stepcode='" + CurrentStep + "' and mb_status=0");
+                        string[] BadCode = iErrCode.Split(',');
+                        sql.Length = 0;
+                        sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
+                        sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_bgcode,mb_soncode,mb_status) select makebad_seq.nextval");
+                        sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + CurrentStep + "','" + iSourceCode + "',:bc_code,'',");
+                        sql.Append("'" + BgCode + "',sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
+                        sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
+                        List<string> InsertSQL = new List<string>();
+                        for (int i = 0; i < BadCode.Length; i++)
+                        {
+                            InsertSQL.Add(sql.ToString().Replace(":bc_code", "'" + BadCode[i] + "'"));
+                        }
+                        ExecuteSQLTran(InsertSQL.ToArray());
+                        //将不良的序列号的状态码设为3
+                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'", "update");
+                    }
+                    break;
+                default:
+                    oErrMessage = "测试结果必须为NG或者OK";
+                    return false;
+            }
+            //不良采集为良品是更新
+            if (StepCode == CurrentStep && iResult == "OK")
+            {
+                DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
+                if (dt.Rows.Count > 0)
+                {
+                    string ms_status = dt.Rows[0]["ms_status"].ToString();
+                    string ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
+                    string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                    if (ms_status == "3")
+                    {
+                        string nextstepcode = getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
+                        UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
+                        UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='" + iMakeCode + "'");
+                    }
+                }
+            }
+            return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrMessage);
+        }
+
+        /// <summary>
+        /// 设置测试结果
+        /// </summary>
+        /// <param name="iMakeCode"></param>
+        /// <param name="iSourceCode"></param>
+        /// <param name="iSN"></param>
+        /// <param name="iOperater"></param>
+        /// <param name="iResult"></param>
+        /// <param name="iUserCode"></param>
+        /// <param name="oErrorMessage"></param>
+        /// <returns></returns>
+        [Description("设置测试结果,结果必须为NG或者OK")]
+        public bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iOperater, string iResult, string iErrCode, string flag, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            if (iTSN == "") { oErrorMessage = "TSN不能为空"; return false; }
+            if (iSN == "") { oErrorMessage = "SN不能为空"; return false; }
+            string[] param = new string[] { iTSN, iSN, iSourceCode, iOperater, iResult, iErrCode, oErrorMessage };
+            string[] ParamName = new string[] { "v_i_tsn", "v_i_sncode", "v_i_sourcecode", "v_i_usercode", "v_i_result", "v_i_errcode", "v_o_errmsg" };
+            CallProcedure("CS_DLLSNCHANGE", ParamName, ref param);
+            oErrorMessage = param[6];
+            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, string iResult, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrMessage };
+            string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_i_result", "v_o_errmsg" };
+            CallProcedure("CS_SETSTEPRESULT", ParamName, ref param);
+            oErrMessage = param[5];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 方法说明:测试详细信息录入系统,针对一个SN多个测试项目结果可循环调用
+        /// </summary>
+        /// <param name="iSN">序列号</param>
+        /// <param name="iClass"></param>
+        /// <param name="iSubClass1"></param>
+        /// <param name="iSubClass2"></param>
+        /// <param name="iSubClass3"></param>
+        /// <param name="iMaxValue"></param>
+        /// <param name="iMinValue"></param>
+        /// <param name="iActualValue"></param>
+        /// <param name="iValue1"></param>
+        /// <param name="iValue2"></param>
+        /// <param name="iValue3"></param>
+        /// <param name="iTestResult"></param>
+        /// <param name="oErrMessage"></param>                                                      
+        /// <returns></returns>
+        [Description("设置测试结果")]
+        public bool SetTestDetail(string iSN, string iClass, string iResCode, string[,] iTestDetail, out string oErrMessage)
+        {
+            if (iSN == "" || iSN == null)
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string omakeCode = "";
+            GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
+            sql.Clear();
+            sql.Append("begin ");
+            bool needBreak = false;
+            for (int i = 0; i < iTestDetail.Length / 200; i++)
+            {
+                string DataField = "Insert into MES_TEST(STD_ID,STD_SN,STD_MAKECODE,STD_CLASS,STD_TESTDATE,";
+                string ValueField = ")values(MES_TEST_SEQ.nextval,'" + iSN + "','" + omakeCode + "','" + iClass + "',sysdate,";
+                for (int j = 0; j < 200; j++)
+                {
+                    if (j == 0)
+                    {
+                        DataField += "STD_ITEMNAME,";
+                        //如果传递的参数没有测试名称则中断插入
+                        if (iTestDetail[i, j] == "" || iTestDetail[i, j] == null)
+                        {
+                            //外层循环也需要中断
+                            needBreak = true;
+                            break;
+                        }
+                    }
+                    else
+                    {
+                        DataField += "STD_ITEM" + j + " ,";
+                    }
+                    ValueField += "'" + iTestDetail[i, j] + "',";
+                }
+                if (needBreak)
+                    break;
+                sql.Append(DataField.Substring(0, DataField.Length - 1) + ValueField.Substring(0, ValueField.Length - 1) + ");");
+            }
+            sql.Append("end;");
+            ExecuteSql(sql.ToString(), "insert");
+            return true;
+        }
+
+        /// <summary>
+        /// 作业调用该方法将确认接收SN对应的IMEI及附属信息。
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="iMO"></param>
+        /// <param name="iIMEI1"></param>
+        /// <param name="iIMEI2"></param>
+        /// <param name="iIMEI3"></param>
+        /// <param name="iMEID"></param>
+        /// <param name="iNetCode"></param>
+        /// <param name="iPSN"></param>
+        /// <param name="iID1"></param>
+        /// <param name="iBT"></param>
+        /// <param name="iID1"></param>
+        /// <param name="iID2"></param>
+        /// <param name="iID3"></param>
+        /// <param name="oErrorMessage"></param>
+        /// <returns></returns>
+        [Description("设置IMEI信息")]
+        public bool SetIMEIInfo(string iSN, string iIMEI1, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iSN, iIMEI1, "", "", "", "", "", "", "", "", oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_imei1", "v_i_imei2", "v_i_imei3", "v_i_meid", "v_i_netcode", "v_i_psn", "v_i_id1", "v_i_id2", "v_i_id3", "v_o_errmsg" };
+            CallProcedure("CS_SETIMEIINFO", ParamName, ref param);
+            oErrMessage = param[10];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="iSN"></param>
+        /// <param name="iResCode"></param>
+        /// <param name="iOperator"></param>
+        /// <param name="iResult"></param>
+        /// <param name="iErrCode"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("设置测试结果")]
+        public bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string oMakeCode = "";
+            GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return SetStepFinish(oMakeCode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 序列号归属工单
+        /// </summary>
+        /// <param name="iMO"></param>
+        /// <param name="iSN"></param>
+        /// <param name="iResCode"></param>
+        /// <param name="oErrMessage"></param>
+        /// <returns></returns>
+        [Description("序列号归属工单")]
+        public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
+        {
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            oErrMessage = "";
+            string[] param = new string[] { iMO, iResCode, iSN, "", "", "", oErrMessage };
+            string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
+            CallProcedure("CS_CHECKSTEPSNANDMACODE", ParamName, ref param);
+            oErrMessage = param[6];
+            DataTable dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')", "select");
+            string ms_status = "";
+            string ms_stepcode = "";
+            string ms_nextstepcode = "";
+            if (dt.Rows.Count > 0)
+            {
+                ms_status = dt.Rows[0]["ms_status"].ToString();
+                ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
+                ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
+            }
+            string stepcode = GetStepCodeBySource(iResCode);
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && ms_stepcode == stepcode))
+            {
+                if (ms_status == "3")
+                {
+                    oErrMessage = "";
+                }
+                return true;
+            }
+            else
+                return false;
+        }
+
+        /// <summary>
+        /// 获取执行步骤代码,名称和线别
+        /// </summary>
+        /// <param name="Source"></param>
+        /// <param name="StepCode"></param>
+        /// <param name="StepName"></param>
+        /// <param name="LineCode"></param>
+        private void GetStepCodeAndNameAndLineBySource(string Source, ref string StepCode, ref string StepName, ref string LineCode)
+        {
+            DataTable dt = getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
+            if (dt.Rows.Count > 0)
+            {
+                StepCode = dt.Rows[0]["sc_stepcode"].ToString();
+                StepName = dt.Rows[0]["sc_stepname"].ToString();
+                LineCode = dt.Rows[0]["sc_linecode"].ToString();
+            }
+        }
+
+        /// <summary>
+        /// 获取步骤代码和名称
+        /// </summary>
+        /// <param name="Source"></param>
+        /// <param name="StepCode"></param>
+        /// <param name="StepName"></param>
+        private void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
+        {
+            DataTable dt = getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
+            if (dt.Rows.Count > 0)
+            {
+                StepCode = dt.Rows[0]["sc_stepcode"].ToString();
+                StepName = dt.Rows[0]["sc_stepname"].ToString();
+            }
+        }
+
+        /// <summary>
+        /// 获取步骤代码
+        /// </summary>
+        /// <param name="Source"></param>
+        /// <returns></returns>
+        private string GetStepCodeBySource(string Source)
+        {
+            return getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
+        }
+
+        /// <summary>
+        /// 获取步骤代码
+        /// </summary>
+        /// <param name="Source"></param>
+        /// <returns></returns>
+        private string GetStepName(string st_code)
+        {
+            return getFieldDataByCondition("step", "st_name", "st_code='" + st_code + "'").ToString();
+        }
+
+        /// <summary>
+        /// 获取第一行第一列的信息
+        /// </summary>
+        private object getFieldDataByCondition(string TableName, string Field, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select " + Field + " from " + TableName + " where " + Condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter();
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            if (dt.Rows.Count > 0)
+            {
+                return dt.Rows[0][0];
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        /// <summary>
+        /// 通过表名和获取单行的记录
+        /// </summary>
+        private DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += AddField(Fields);
+            sql += " from " + TableName + " where " + Condition + " and rownum=1";
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 通过表名,字段和条件获取DataTable类型的数据
+        /// </summary>
+        private DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += AddField(Fields);
+            sql += " from " + TableName + " where " + Condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 通过表名,字段获取DataTable类型的数据
+        /// </summary>
+        private DataTable getFieldsDatas(string TableName, string Fields)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += Fields;
+            sql += " from " + TableName;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(ConnectionStrings);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            command.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 检测内容是否存在
+        /// </summary>
+        /// <param name="TableName"></param>
+        /// <param name="Condition"></param>
+        /// <returns></returns>
+        private bool CheckExist(string TableName, string Condition)
+        {
+            string sql = "select count(1) from " + TableName + " where " + Condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter(command);
+            DataTable dt = new DataTable();
+            ad.Fill(dt);
+            ad.Dispose();
+            command.Dispose();
+            return int.Parse(dt.Rows[0][0].ToString()) > 0;
+        }
+
+        /// <summary>
+        /// 直接执行SQL,同时传入SQL的类型
+        /// </summary>
+        /// <param name="SQL"></param>
+        /// <param name="Type"></param>
+        /// <returns></returns>
+        private object ExecuteSql(string SQL, string Type, params object[] names)
+        {
+            object result = null;
+            command = new OracleCommand(SQL, connection);
+            Reconnect(command);
+            //用来拼接参数的
+            if (names.Length > 0)
+            {
+                string[] par = SQL.Split(':');
+                //用来存参数的数组
+                StringBuilder[] addpar = new StringBuilder[par.Length - 1];
+                for (int i = 0; i < par.Length - 1; i++)
+                {
+                    //新建一个char类型的数组用来存储每个字节的变量
+                    char[] c = par[i + 1].ToCharArray();
+                    addpar[i] = new StringBuilder();
+                    for (int j = 0; j < c.Length; j++)
+                    {
+                        if (c[j] != ' ' && c[j] != ',' && c[j] != ')')
+                        {
+                            addpar[i].Append(c[j]);
+                        }
+                        else
+                        {
+                            break;
+                        }
+                    }
+                }
+                for (int i = 0; i < addpar.Length; i++)
+                {
+                    command.Parameters.Add(new OracleParameter(addpar[i].ToString(), names[i]));
+                }
+            }
+            switch (Type.ToUpper())
+            {
+                case "SELECT":
+                    OracleDataAdapter ad = new OracleDataAdapter(command);
+                    result = new DataTable();
+                    try
+                    {
+                        ad.Fill((DataTable)result);
+                    }
+                    catch (Exception)
+                    {
+                        connection = new OracleConnection(ConnectionStrings);
+                        connection.Open();
+                        command = new OracleCommand(SQL, connection);
+                        ad = new OracleDataAdapter();
+                        ad.SelectCommand = command;
+                        ad.Fill((DataTable)result);
+                    }
+                    break;
+                case "DELETE":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new OracleConnection(ConnectionStrings);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+                case "UPDATE":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new OracleConnection(ConnectionStrings);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+                case "INSERT":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new OracleConnection(ConnectionStrings);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+            }
+            command.Dispose();
+            return result;
+        }
+
+        /// <summary>
+        /// 出现异常进行回滚的执行方法
+        /// </summary>
+        /// <param name="SQL"></param>
+        private void ExecuteSQLTran(params string[] SQL)
+        {
+            command = new OracleCommand();
+            command.Connection = new OracleConnection(ConnectionStrings);
+            command.Connection.Open();
+            Reconnect(command);
+            OracleTransaction tx = command.Connection.BeginTransaction(IsolationLevel.ReadCommitted);
+            command.Transaction = tx;
+            try
+            {
+                foreach (string sql in SQL)
+                {
+                    if (!string.IsNullOrEmpty(sql))
+                    {
+                        command.CommandText = sql;
+                        command.ExecuteNonQuery();
+                    }
+                }
+                tx.Commit();
+            }
+            catch (OracleException E)
+            {
+                tx.Rollback();
+                throw new Exception(E.Message);
+            }
+            command.Dispose();
+        }
+
+        private string UpdateByCondition(string TableName, string update, string condition)
+        {
+            string sql = "update " + TableName + " set " + update + " where " + condition;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            command.Dispose();
+            return sql;
+        }
+
+        private void CallProcedure(string ProcedureName, string[] ParamName, ref string[] param)
+        {
+            command = new OracleCommand(ProcedureName);
+            command.Connection = connection;
+            Reconnect(command);
+            command.CommandText = ProcedureName;
+            command.CommandType = CommandType.StoredProcedure;
+            for (int i = 0; i < param.Length; i++)
+            {
+                command.Parameters.Add(new OracleParameter(ParamName[i], OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
+                //command.Parameters.Add(new OracleParameter(ParamName[i], OracleType.VarChar, 200, ParameterDirection.InputOutput, "", DataRowVersion.Default, true, param[i]));
+            }
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new OracleConnection(ConnectionStrings);
+                command.Connection.Open();
+                command.ExecuteNonQuery();
+            }
+            for (int i = 0; i < command.Parameters.Count; i++)
+                param[i] = command.Parameters[i].Value.ToString();
+            command.Dispose();
+        }
+
+        private string AddField(string[] Fields)
+        {
+            string sql = " ";
+            foreach (string field in Fields)
+            {
+                sql += field + ",";
+            }
+            return sql.Substring(0, sql.Length - 1);
+        }
+
+        private string[] GetField(string field)
+        {
+            string[] fields = field.Split(',');
+            for (int i = 0; i < fields.Length; i++)
+            {
+                fields[i] = fields[i].Substring(fields[i].LastIndexOf("as") + 2, fields[i].Length - fields[i].LastIndexOf("as") - 2).Trim();
+            }
+            return fields;
+        }
+
+        private void Reconnect(OracleCommand cmd)
+        {
+            if (cmd.Connection.State == ConnectionState.Closed)
+            {
+                cmd.Connection.Open();
+            }
+        }
+    }
+}

+ 36 - 0
UMES/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("UMES")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UMES")]
+[assembly: AssemblyCopyright("Copyright ©  2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(true)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("cecaaeb1-15c3-4458-845a-975b57a35f57")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 61 - 0
UMES/UMES.csproj

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{CECAAEB1-15C3-4458-845A-975B57A35F57}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>UMES</RootNamespace>
+    <AssemblyName>UMES</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <RegisterForComInterop>true</RegisterForComInterop>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>bin\Debug\Oracle.ManagedDataAccess.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MESHelper.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>