Browse Source

添加日志记录

章政 7 years ago
parent
commit
78154f0a14
3 changed files with 137 additions and 1141 deletions
  1. 11 13
      UAS_AutoPass/AutoAnalysisXml.cs
  2. 120 0
      UAS_AutoPass/Login.resx
  3. 6 1128
      UAS_AutoPass/ToolClass/LogicHandler.cs

+ 11 - 13
UAS_AutoPass/AutoAnalysisXml.cs

@@ -235,15 +235,12 @@ namespace UAS_AutoPass
                     sncode = dt.Rows[0]["ms_sncode"].ToString();
                 }
                 string combinecode = e.Name.Substring(1, 1);
-                sql.Clear();
-                sql.Append("insert into AUTOSCANLOG(as_id,as_indate,as_testdate,as_sourcecode,as_stepcode,");
-                sql.Append("as_linecode,as_makecode,as_sncode,as_filename,");
-
-                sql.Clear();
-                sql.Append("insert into AUTOSCAN_REJUDGE(asr_id,asr_indate,asr_filename,asr_combinecode,asr_sourcecode,");
-                sql.Append("asr_linecode,asr_makecode,asr_sncode) values(AUTOSCAN_REJUDGE_seq.nextval,sysdate,'" + e.Name + "'");
-                sql.Append(",'" + combinecode + "','" + isource + "','" + ilinecode + "','" + makecode + "','" + sncode + "')");
-                dh.ExecuteSql(sql.ToString(), "insert");
+                LogicHandler.AutoPassLog(sncode,isource,makecode,test_date,istepcode,ilinecode,"0");
+                //sql.Clear();
+                //sql.Append("insert into AUTOSCAN_REJUDGE(asr_id,asr_indate,asr_filename,asr_combinecode,asr_sourcecode,");
+                //sql.Append("asr_linecode,asr_makecode,asr_sncode) values(AUTOSCAN_REJUDGE_seq.nextval,sysdate,'" + e.Name + "'");
+                //sql.Append(",'" + combinecode + "','" + isource + "','" + ilinecode + "','" + makecode + "','" + sncode + "')");
+                //dh.ExecuteSql(sql.ToString(), "insert");
                 if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out ErrMessage))
                 {
                     OperateResult.AppendText(ErrMessage + "\n");
@@ -255,10 +252,11 @@ namespace UAS_AutoPass
             {
                 //-2-NG2017/10/2514:46:29.xml取第二位版号
                 string combinecode = e.Name.Substring(1, 1);
-                sql.Clear();
-                sql.Append("insert into AUTOSCAN_REJUDGE(asr_id,asr_indate,asr_filename,asr_combinecode,asr_sourcecode,");
-                sql.Append("asr_linecode) values(AUTOSCAN_REJUDGE_seq.nextval,sysdate,'" + e.Name + "','" + combinecode + "','" + isource + "','" + ilinecode + "')");
-                dh.ExecuteSql(sql.ToString(), "insert");
+                LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, "0");
+                //sql.Clear();
+                //sql.Append("insert into AUTOSCAN_REJUDGE(asr_id,asr_indate,asr_filename,asr_combinecode,asr_sourcecode,");
+                //sql.Append("asr_linecode) values(AUTOSCAN_REJUDGE_seq.nextval,sysdate,'" + e.Name + "','" + combinecode + "','" + isource + "','" + ilinecode + "')");
+                //dh.ExecuteSql(sql.ToString(), "insert");
             }
             else if (sncode != "")
             {

+ 120 - 0
UAS_AutoPass/Login.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>

+ 6 - 1128
UAS_AutoPass/ToolClass/LogicHandler.cs

@@ -1,5 +1,4 @@
 using System.Collections.Generic;
-using System.Data;
 using System.Text;
 
 namespace UAS_AutoPass.ToolClass
@@ -14,161 +13,6 @@ namespace UAS_AutoPass.ToolClass
         //用于存放批量执行的SQL
         static List<string> sqls = new List<string>();
 
-        /// <summary>
-        /// 检测当前的岗位资源对应的工序
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="oErrMessage"></param>
-        /// <returns></returns>
-        public static bool CheckCurrentStep(string iSnCode, string iMakeCode, string iSourceCode, string iUserCode, out string oMSID, out string oMacode, out string oErrMessage)
-        {
-            oErrMessage = "";
-            oMSID = "";
-            oMacode = "";
-            string[] param = new string[] { iMakeCode, iSourceCode, iSnCode, iUserCode, oMSID, oMacode, oErrMessage };
-            dh.CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
-            oMSID = param[4];
-            oMacode = param[5];
-            oErrMessage = param[6];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 判断工单是否已经下放
-        /// </summary>
-        /// <param name="iMaCode"></param>
-        /// <returns></returns>
-        public static bool CheckMakeStatus(string iMaCode, out string ErrorMessage)
-        {
-            string ma_statuscode = dh.getFieldDataByCondition(" make ", "ma_statuscode", "Lower(ma_code)='" + iMaCode.ToLower() + "' ").ToString();
-            ErrorMessage = "";
-            if (ma_statuscode == "")
-            {
-                ErrorMessage = "工单号" + iMaCode + "不存在";
-                return false;
-            }
-            if (ma_statuscode == "STARTED")
-                return true;
-            else
-            {
-                ErrorMessage = "工单必须是已下放状态";
-                return false;
-            }
-        }
-
-        public static void GetSerialNumByCaller(string iCaller, out string SerialNum)
-        {
-            SerialNum = "";
-            string[] param = new string[] { iCaller, "2", SerialNum };
-            dh.CallProcedure("SP_GETMAXNUMBER", ref param);
-            SerialNum = param[2];
-        }
-
-
-        /// <summary>
-        /// 验证用户身份信息
-        /// </summary>
-        /// <param name="iUserCode"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string SQL = "select em_code from employee where upper(em_code)=:UserName and em_password =:PassWord";
-            DataTable dt;
-            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode.ToUpper(), iPassWord);
-            if (dt.Rows.Count > 0)
-                return true;
-            else
-            {
-                oErrorMessage = "用户名或者密码不正确!";
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// 记录登陆信息
-        /// </summary>
-        public static void RecordLogInfo(string iUserCode, string iUserName, string iVersion, string iType, string iIP)
-        {
-            dh.ExecuteSql("insert into LogInfo(id,sip,usname,indate,uscode,versioncode,terminaltype) values (LogInfo_seq.nextval,'" + iIP + "','" + iUserName + "',sysdate,'" + iUserCode + "','" + iVersion + "','" + iType + "')", "insert");
-        }
-
-        /// <summary>
-        /// 验证用户身份信息和岗位资源
-        /// </summary>
-        /// <param name="iUserCode"></param>
-        /// <param name="iPassWord"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool CheckUserAndResourcePassed(string iUserCode, string iSourceCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            iUserCode = iUserCode.ToUpper();
-            iSourceCode = iSourceCode.ToUpper();
-            string SQL = "select em_code,em_type from employee where upper(em_code)=:UserName ";
-            DataTable dt;
-            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode);
-            if (dt.Rows.Count > 0)
-            {
-                string em_type = dt.Rows[0]["em_type"].ToString();
-                if (iSourceCode == "")
-                {
-                    oErrorMessage = "岗位资源不允许为空";
-                    return false;
-                }
-                if (em_type == "admin")
-                {
-                    if (dh.CheckExist("Source", "upper(sc_code)='" + iSourceCode + "' and sc_statuscode='AUDITED'"))
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        oErrorMessage = "岗位资源编号错误或者未审核!";
-                        return false;
-                    }
-                }
-                else
-                {
-                    dt = dh.getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "upper(ur_resourcecode) ur_resourcecode" }, "upper(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() == iSourceCode)
-                                return true;
-                        }
-                        oErrorMessage = "用户不处于当前资源所属分组!";
-                    }
-                    else
-                        oErrorMessage = "岗位资源编号错误或者未审核!";
-                }
-            }
-            else
-                oErrorMessage = "用户不存在!";
-            return false;
-        }
-
-        public static bool CheckStepAttribute(string iCaller, string iSourceCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string[] param = new string[] { iCaller, iSourceCode, oErrorMessage };
-            dh.CallProcedure("CS_CHECKSTEPATTRIBUTE", ref param);
-            oErrorMessage = param[2];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
         public static bool CheckStepSNAndMacode(string iMakeCode, string iSourceCode, string iSN, string iUserCode, out string oMakeCode, out string oMsID, out string oErrorMessage)
         {
             oErrorMessage = "";
@@ -185,524 +29,14 @@ namespace UAS_AutoPass.ToolClass
                 return false;
         }
 
-        public static void DoCommandLog(string iCaller, string iUserCode, string iMakeCode, string iLineCode, string iSourceCode, string iOperate, string iResult, string iSncode, string iCheckno)
-        {
-            sql.Clear();
-            sql.Append("insert into commandlog(cl_id,cl_caller,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
-            sql.Append("cl_result,cl_sncode,cl_code) values( commandlog_seq.nextval,:cl_caller,:iUserCode,sysdate,:iLineCode ,");
-            sql.Append(":iSourceCode ,:iMakeCode,:iOperate,:iResult,:iSncode,:iCheckno)");
-            dh.ExecuteSql(sql.ToString(), "insert", iCaller, iUserCode, iLineCode, iSourceCode, iMakeCode, iOperate, iResult, iSncode, iCheckno);
-        }
-
-        /// <summary>
-        /// 分配Mac地址和BT地址
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="oMac"></param>
-        /// <param name="oBT"></param>
-        /// <param name="oCode1"></param>
-        /// <param name="oCode2"></param>
-        /// <param name="oCdoe3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool GetAddressRangeByMakeCode(string iSnCode, string iMakeCode, out string oMac, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrorMessage)
-        {
-            oMac = "";
-            oBT = "";
-            oCode1 = "";
-            oCode2 = "";
-            oCdoe3 = "";
-            oErrorMessage = "";
-            string[] param = new string[] { iSnCode, iMakeCode, oMac, oBT, oCode1, oCode2, oCdoe3, oErrorMessage };
-            dh.CallProcedure("CS_GETADDRESSBYMAKECODE", ref param);
-            oMac = param[2];
-            oBT = param[3];
-            oCode1 = param[4];
-            oCode2 = param[5];
-            oCdoe3 = param[6];
-            oErrorMessage = param[7];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 输入的 SN 号查找在制品是否有 IMEI 信息存在,如果存在则将 IMEI 信息传出,如果没有则在该工单下未使用的 IMEI 中随机分配一组
-        /// 如果iIMEI1、iNetCode不为空,则分别作为获取的附件加条件。
-        /// </summary>
-        /// <param name="iSN"></param>
-        /// <param name="iMO"></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="oMac"></param>
-        /// <param name="oBT"></param>
-        /// <param name="oID1"></param>
-        /// <param name="oID2"></param>
-        /// <param name="oID3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool GetIMEIOrNetCodeRange(string iSnCode, string iMakeCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oErrorMessage)
-        {
-            oIMEI1 = "";
-            oIMEI2 = "";
-            oIMEI3 = "";
-            oMEID = "";
-            oNetCode = "";
-            oPSN = "";
-            oID1 = "";
-            oID2 = "";
-            oID3 = "";
-            oErrorMessage = "";
-            string[] param = new string[] { iSnCode, iMakeCode, iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrorMessage };
-            dh.CallProcedure("CS_GETIMEIORNETCODERANGE", ref param);
-            oIMEI1 = param[4];
-            oIMEI2 = param[5];
-            oIMEI3 = param[6];
-            oMEID = param[7];
-            oNetCode = param[8];
-            oPSN = param[9];
-            oID1 = param[10];
-            oID2 = param[11];
-            oID3 = param[12];
-            oErrorMessage = param[13];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 获取工单的最近一条执行记录
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="oMakeCode"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool GetMakeInfo(string iSnCode, out string oMakeCode, out string oErrorMessage)
-        {
-            //取MakeProcess表中的执行记录ID最大的一个工单的号码
-            oMakeCode = "";
-            oErrorMessage = "";
-            string ms_id = dh.getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "upper(ms_sncode)='" + iSnCode.ToUpper() + "' or ms_firstsn in (select firstsn from makesnrelation where upper(sn)='" + iSnCode.ToUpper() + "')").ToString();
-            oMakeCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
-            if (oMakeCode != "")
-                return true;
-            else
-            {
-                oErrorMessage = "序列号:" + iSnCode + " 未归属工单";
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// 获取送检批次,根据不同的iOQCStep执行不同的操作,查询到有具体的信息时返回Form和Detail的两个DataTable
-        ///  iOQCStep 有四个固定参数
-        ///  OQCSENDCHECK 生成送检批
-        ///  OQCPLANMAINTAIN 抽样计划维护
-        ///  OQCDATACOLLECTION 抽样数据采集
-        ///  OQCRESULTDETERMINE 批结果判定
-        /// </summary>
-        /// <returns></returns>
-        public static DataTable[] GetOQCBatch(string iSnCode, string iOutBoxCode, string iCheckNo, string iOQCStep, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string SQL = "";
-            string ms_checkno = "";
-            DataTable dt = new DataTable();
-            if (iCheckNo != "")
-                return GetBatch(iCheckNo, iOQCStep, out oErrorMessage);
-            else if (iSnCode != "")
-            {
-                SQL = "select ms_checkno from makeserial where ms_id=(select max(ms_id) from makeserial where  ms_sncode='" + iSnCode + "' or ms_psn='" + iSnCode + "')";
-                dt = (DataTable)dh.ExecuteSql(SQL, "select");
-                if (dt.Rows.Count == 0)
-                {
-                    oErrorMessage = "序列号" + iSnCode + "不存在";
-                    return null;
-                }
-                else
-                {
-                    if (dt.Rows[0]["ms_checkno"].ToString() == "")
-                    {
-                        oErrorMessage = "该序列号没有送检批次号";
-                        return null;
-                    }
-                    else
-                        ms_checkno = dt.Rows[0]["ms_checkno"].ToString();
-                }
-            }
-            else if (iOutBoxCode != "")
-            {
-                SQL = "select ms_checkno from MES_PACKAGE_VIEW left join makeserial on v_barcode=ms_sncode where  v_outboxcode='" + iOutBoxCode + "' ";
-                dt = (DataTable)dh.ExecuteSql(SQL, "select");
-                if (dt.Rows.Count == 0)
-                {
-                    oErrorMessage = "该箱号不存在";
-                    return null;
-                }
-                else
-                {
-                    if (dt.Rows[0]["ms_checkno"].ToString() == "")
-                    {
-                        oErrorMessage = "该箱号没有送检批次号";
-                        return null;
-                    }
-                    else
-                        ms_checkno = dt.Rows[0]["ms_checkno"].ToString();
-                }
-            }
-            if (ms_checkno != "")
-            {
-                return GetBatch(ms_checkno, iOQCStep, out oErrorMessage);
-            }
-            else
-            {
-                oErrorMessage = "送检批次不存在";
-                return null;
-            }
-        }
-
-        /// <summary>
-        /// 第一个是Form的主表信息,第二个是Grid的信息
-        /// </summary>
-        /// <param name="iCheckNo"></param>
-        /// <returns></returns>
-        private static DataTable[] GetBatch(string iCheckNo, string iOQCStep, out string oErrorMessage)
-        {
-            DataTable Form = new DataTable();
-            DataTable Grid = new DataTable();
-            oErrorMessage = "";
-            switch (iOQCStep.ToUpper())
-            {
-                case "OQCSENDCHECK":
-                    sql.Clear();
-                    sql.Append("select count(1) ob_batchqty,obd_outboxcode,obd_id,obd_makecode from OQCBatchdetail ");
-                    sql.Append("where obd_checkno = '" + iCheckNo + "' group by obd_outboxcode,obd_makecode,obd_id");
-                    Grid = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    Form = (DataTable)dh.ExecuteSql("select ob_id,ob_status,ob_prodcode,ob_batchqty,ob_source,ob_checkno from OQCBatch where ob_checkno='" + iCheckNo + "'", "select");
-                    if (Form.Rows.Count > 0)
-                    {
-                        if (Form.Rows[0]["ob_source"].ToString() == "新增" && Form.Rows[0]["ob_status"].ToString() == "ENTERING")
-                        {
-                            sql.Clear();
-                            sql.Append("select ob_id,ob_status,ob_prodcode ma_prodcode,ob_batchqty,ob_source,ob_checkno,obd_id,obd_outboxcode,obd_makecode ma_code,count(1) cn from OQCBatch left join OQCBatchdetail ");
-                            sql.Append("on obd_obid = ob_id  where ob_checkno ='" + iCheckNo + "' group by ob_id,ob_status,ob_prodcode,ob_batchqty,ob_source,ob_checkno,obd_outboxcode,obd_makecode,obd_id");
-                            Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                        }
-                        else oErrorMessage = "自动生成的抽检批次号不允许在该页面操作,或者该抽检批次号不是在录入状态";
-                    }
-                    else oErrorMessage = "抽检批次" + iCheckNo + "不存在";
-                    break;
-                case "OQCPLANMAINTAIN":
-                    sql.Clear();
-                    sql.Append("select ob_prodcode,ob_maxngacceptqty,ob_id,ob_checkno,ob_projectcode,ob_nowcheckqty,ob_source,ob_remark,");
-                    sql.Append("ob_status,pr_id,pr_detail,pr_kind,pr_manutype,pr_qualmethod,nvl(ob_aqlcode,pr_aql)ob_aqlcode from OQCBatch left join product on ");
-                    sql.Append("pr_code=ob_prodcode where ob_checkno='" + iCheckNo + "'");
-                    Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    sql.Clear();
-                    if (Form.Rows.Count > 0)
-                    {
-                        string pr_id;
-                        //判断状态是否是待检验
-                        if (Form.Rows[0]["ob_status"].ToString() == "UNCHECK")
-                        {
-                            //判断送检方案是否为空
-                            string qualmethod = "";
-                            //第一原则送检方案为空
-                            if (Form.Rows[0]["pr_qualmethod"].ToString() == "")
-                            {
-                                //判读第二原则送检方案为空
-                                qualmethod = dh.getFieldDataByCondition("product left join productkind on pr_kind=pk_name", "pk_qualmethod", "pr_code='" + Form.Rows[0]["ob_prodcode"] + "'").ToString();
-                            }
-                            //第一原则送检方案不为空
-                            else
-                            {
-                                qualmethod = Form.Rows[0]["pr_qualmethod"].ToString();
-                            }
-                            Form.Rows[0]["ob_projectcode"] = qualmethod;
-                            pr_id = dh.getFieldDataByCondition("QUA_Project", "pr_id", "pr_code = '" + qualmethod + "'").ToString();
-                            sql.Clear();
-                            sql.Append("select  1 choose,nvl(max(oi_id),0)oi_id, ci_kind,nvl(max(oi_sampleqty),0) oi_sampleqty from QUA_PROJECT left join ");
-                            sql.Append(" QUA_ProjectDetail on pd_prid=pr_id  left join QUA_CheckItem on pd_ciid=ci_id ");
-                            sql.Append("left join OQCITEMS on oi_checkno ='" + iCheckNo + "' and oi_projectcode='" + qualmethod + "' ");
-                            sql.Append("and oi_projectcode = pr_code and oi_checkkind = ci_kind where  pr_code='" + qualmethod + "'  group by ci_kind");
-                            Grid = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                        }
-                        else
-                            oErrorMessage = "只有待检验的批次才允许维护抽样计划";
-                    }
-                    else
-                        oErrorMessage = "抽检批次" + iCheckNo + "不存在";
-                    break;
-                case "OQCDATACOLLECTION":
-                    sql.Clear();
-                    sql.Append("select ob_checkno,ob_makecode,ob_prodcode,ob_nowcheckqty,pr_detail,ob_ngqty,ob_okqty,");
-                    sql.Append("ob_remark,ob_makecode,ob_status,ob_projectcode,ob_aqlcode,ob_maxngacceptqty from OQCBatch left join product on ");
-                    sql.Append("pr_code=ob_prodcode left join oqcitems on oi_checkno =ob_checkno and oi_projectcode =ob_projectcode where ob_checkno='" + iCheckNo + "'");
-                    Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    //状态为UNCHECK或者CHECKING并且有抽样计划的才能操作
-                    if (Form.Rows.Count > 0)
-                    {
-                        if (Form.Rows[0]["ob_projectcode"].ToString() == "" || !(Form.Rows[0]["ob_status"].ToString() != "UNCHECK" || Form.Rows[0]["ob_status"].ToString() != "CHECKING"))
-                            oErrorMessage = "状态为未检验或者送检中并且有抽样计划的才能操作";
-                    }
-                    else
-                    {
-                        oErrorMessage = "抽检批次" + iCheckNo + "不存在";
-                    }
-                    break;
-                case "OQCRESULTDETERMINE":
-                    sql.Clear();
-                    sql.Append("select ob_id,ob_aqlcode,ob_makecode,ob_status,ob_prodcode,(select max(oi_checkqty)from OQCItems where oi_checkno='" + iCheckNo + "') oi_checkqty,");
-                    sql.Append("ob_nowcheckqty,nvl(ob_okqty,0) ob_okqty,nvl(ob_ngqty,0) ob_ngqty,ob_maxngacceptqty,ob_source,ob_checkno,ob_result from OQCBatch where ob_checkno='" + iCheckNo + "'");
-                    Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    if (Form.Rows.Count == 0)
-                    {
-                        oErrorMessage = "抽检批次" + iCheckNo + "不存在";
-                    }
-                    break;
-                case "OQCCHECKNOSPLIT":
-                    sql.Clear();
-                    sql.Append("select ob_checkno,ob_makecode,ob_prodcode,ob_nowcheckqty,pr_spec||'|'||pr_detail pr_spec,ob_ngqty,ob_okqty,");
-                    sql.Append("ob_remark,ob_makecode,ob_status,ob_projectcode,ob_aqlcode,ob_maxngacceptqty from OQCBatch left join product on ");
-                    sql.Append("pr_code=ob_prodcode left join oqcitems on oi_checkno =ob_checkno and oi_projectcode =ob_projectcode where ob_checkno='" + iCheckNo + "' and ob_status='UNCHECK'");
-                    Form = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    //状态为UNCHECK或者CHECKING并且有抽样计划的才能操作
-                    if (Form.Rows.Count > 0)
-                    {
-                        sql.Clear();
-                        sql.Append("select obd_outboxcode,obd_builddate,obd_makecode,obd_sncode from oqcbatchdetail where obd_checkno='" + Form.Rows[0]["ob_checkno"].ToString() + "'");
-                        Grid = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    }
-                    else oErrorMessage = "抽检批次" + iCheckNo + "不存在或者状态不处于待检验";
-                    break;
-                default:
-                    break;
-            }
-            return new DataTable[] { Form, Grid };
-        }
-
-        /// <summary>
-        /// 箱号过站的公用方法
-        /// </summary>
-        /// <param name="iOutBoxCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="iUserCode"></param>
-        /// <param name="iResult"></param>
-        /// <param name="iBoxType"></param>
-        public static void OutBoxStepPass(string iOutBoxCode, string iMakeCode, string iSourceCode, string iUserCode, string iResult, string iBoxType)
-        {
-            string CurrentStep = "";
-            string LineCode = "";
-            string CurrentStepName = "";
-            List<string> ExeSQL = new List<string>();
-            GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
-            sql.Clear();
-            sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,mp_craftcode");
-            sql.Append(",mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno");
-            sql.Append(",mp_snoutboxcode) select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,'" + CurrentStep + "','" + CurrentStepName + "',");
-            sql.Append("ms_craftcode,ms_craftname,'" + iBoxType + "','" + iResult + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
-            sql.Append("ms_status,ms_checkno,ms_outboxcode from makeserial left join mes_package_view on ms_makecode=v_makecode ");
-            sql.Append("and ms_sncode=v_barcode left join make on ma_code=ms_makecode where v_outboxcode='" + iOutBoxCode + "'");
-            ExeSQL.Add(sql.ToString());
-            //获取子箱的总数
-            string totalcount = dh.getFieldDataByCondition("package", "nvl(pa_totalqty,0) pa_totalqty", "pa_outboxcode='" + iOutBoxCode + "'").ToString();
-            //更新过站数量
-            sql.Clear();
-            sql.Append("update makecraftdetail set mcd_inqty=mcd_inqty+" + totalcount + ",mcd_outqty = mcd_outqty + " + totalcount + ", ");
-            sql.Append("mcd_okqty = mcd_okqty + " + totalcount + " where mcd_macode='" + iMakeCode + "' and mcd_stepcode='" + CurrentStep + "'");
-            ExeSQL.Add(sql.ToString());
-            dh.ExecuteSQLTran(ExeSQL.ToArray());
-            ExeSQL.Clear();
-            //获取途程和产品信息
-            sql.Clear();
-            sql.Append("select ms_craftcode,ms_prodcode,ms_makecode,ms_stepcode,ms_stepname,ms_paststep  from mes_package_view left join makeserial ");
-            sql.Append("on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + iOutBoxCode + "' and rownum=1");
-            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-            string prodcode = "";
-            string craftcode = "";
-            string paststep = "";
-            if (dt.Rows.Count > 0)
-            {
-                prodcode = dt.Rows[0]["ms_prodcode"].ToString();
-                craftcode = dt.Rows[0]["ms_craftcode"].ToString();
-                paststep = dt.Rows[0]["ms_paststep"].ToString();
-            }
-            sql.Clear();
-            sql.Append("select cd_nextstepcode,nvl(cd_ifmidinput,0)cd_ifmidinput,nvl(cd_ifmidfinish,0)cd_ifmidfinish from craft left join craftdetail ");
-            sql.Append("on cr_id=cd_crid where cr_code='" + craftcode + "' and cr_prodcode='" + prodcode + "' and cd_stepcode='" + CurrentStep + "'");
-            dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-            if (dt.Rows.Count > 0)
-            {
-                string nextstepcode = dt.Rows[0]["cd_nextstepcode"].ToString();
-                string cd_ifmidinput = dt.Rows[0]["cd_ifmidinput"].ToString();
-                string cd_ifmidfinish = dt.Rows[0]["cd_ifmidfinish"].ToString();
-                string ifpast = paststep.Contains(CurrentStep) ? "0" : "1";
-                //下一工序不为空的时候更新序列号的下一工序
-                if (nextstepcode != "")
-                {
-                    sql.Clear();
-                    sql.Append("update makeserial set ms_stepcode='" + CurrentStep + "',ms_stepname='" + CurrentStepName + "',ms_nextstepcode=");
-                    sql.Append("'" + nextstepcode + "',ms_sccode='" + iSourceCode + "',ms_paststep=ms_paststep|| case when " + ifpast + ">0 then ','||'" + CurrentStep + "' end ");
-                    sql.Append("where exists (select 1 from mes_package_view where ms_sncode=v_barcode and ");
-                    sql.Append("ms_makecode=v_makecode and v_outboxcode='" + iOutBoxCode + "')");
-                    ExeSQL.Add(sql.ToString());
-                }
-                else
-                {
-                    //更新下一执行步骤
-                    sql.Clear();
-                    sql.Append("update makeserial set ms_stepcode='" + CurrentStep + "',ms_stepname='" + CurrentStepName + "',ms_nextstepcode='',MS_STATUS=2,");
-                    sql.Append("ms_sccode='" + iSourceCode + "',ms_paststep=ms_paststep|| case when " + ifpast + ">0 then ','||'" + CurrentStep + "' end ");
-                    sql.Append("where exists (select 1 from mes_package_view where ms_sncode=v_barcode and ms_makecode=v_makecode and v_outboxcode='" + iOutBoxCode + "')");
-                    ExeSQL.Add(sql.ToString());
-                    //更新完工数量
-                    ExeSQL.Add("update make set ma_madeqty=nvl(ma_madeqty,0)+" + totalcount + " where ma_code='" + iMakeCode + "'");
-                }
-                //插入StepPass
-                sql.Clear();
-                sql.Append("insert into STEPPASSED(SP_ID,SP_IFTURNIN,SP_IFTURNOUT,SP_IFREWORK,SP_IFBACKFLOW,SP_CHECKNO,SP_RESULT");
-                sql.Append(",SP_SCCODE,SP_STEPCODE,SP_LINECODE,SP_WCCODE,SP_MAKECODE,SP_SNCODE,SP_YMD,SP_HM,SP_IFNG,SP_PRODCODE");
-                sql.Append(",SP_DATE,SP_CRAFTCODE,sp_inman)  select STEPPASSED_SEq.NEXTVAL,'" + cd_ifmidinput + "','" + cd_ifmidfinish + "',");
-                sql.Append("ms_ifrework,case when ms_ifrework=-1 then 0 when ms_stepcode='" + CurrentStep + "' then 0 when " + ifpast + ">0 ");
-                sql.Append("then -1 else 0 end,0,ms_checkno,'良品','" + iSourceCode + "','" + CurrentStep + "','" + LineCode + "',ms_makecode,ms_sncode,");
-                sql.Append("to_char(sysdate,'yyyymmdd'),to_char(sysdate,'hh24miss'),0,ms_prodcode,SYSDATE,ms_craftcode,'" + iUserCode + "' ");
-                sql.Append("from mes_package_view left join makeserial on ms_sncode=v_barcode and ms_makecode=v_makecode where v_outboxcode='" + iOutBoxCode + "'");
-                ExeSQL.Add(sql.ToString());
-                dh.ExecuteSQLTran(ExeSQL.ToArray());
-            }
-        }
-
-        /// <summary>
-        /// 大箱栈板解除装箱
-        /// </summary>
-        public static void OutBoxDrawStepPass(string iOutBoxCode, string iMakeCode, string iSourceCode)
-        {
-            string CurrentStep = "";
-            string LineCode = "";
-            string CurrentStepName = "";
-            List<string> ExeSQL = new List<string>();
-            GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
-            //更新工序会上一执行步骤
-            sql.Clear();
-            sql.Append("update makeserial set ms_nextstepcode=ms_stepcode,MS_STATUS=1,ms_sccode='" + iSourceCode + "' ");
-            sql.Append("where ms_sncode in (select v_barcode from  mes_package_view where v_outboxcode='" + iOutBoxCode + "')");
-            ExeSQL.Add(sql.ToString());
-            //更新完工数量
-            ExeSQL.Add("update make set ma_madeqty=(select count(1) from makeserial where ms_makecode='" + iMakeCode + "' and ms_status=2) where ma_code='" + iMakeCode + "'");
-            //删除StepPassed数据
-            sql.Clear();
-            sql.Append("delete from steppassed where sp_sncode in (select v_barcode from mes_package_view where v_outboxcode='" + iOutBoxCode + "') ");
-            sql.Append("and sp_makecode='" + iMakeCode + "' and sp_stepcode='" + CurrentStep + "'");
-            ExeSQL.Add(sql.ToString());
-            //更新大箱或栈板的母箱编号为空
-            ExeSQL.Add("update package set pa_mothercode='' where pa_outboxcode in(select PD_INNERBOXCODE from package left join packagedetail on pa_id=pd_paid where pa_outboxcode='" + iOutBoxCode + "')");
-            //删除从表明细
-            ExeSQL.Add("delete from packagedetail where pd_paid=(select pa_id from package where pa_outboxcode='" + iOutBoxCode + "')");
-            //设置大箱或栈板的已装数量为0
-            ExeSQL.Add("update package set pa_totalqty=0,pa_currentqty=0,pa_packageqty=0 where pa_outboxcode='" + iOutBoxCode + "'");
-            dh.ExecuteSQLTran(ExeSQL.ToArray());
-        }
-
-        /// <summary>
-        /// 记录操作日志
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iMPKind"></param>
-        /// <param name="result"></param>
-        /// <param name="iUserCode"></param>
-        public static 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.Clear();
-            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("ms_craftcode,cr_name,'" + 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 left join craft on ms_craftcode=cr_code and cr_prodcode=ma_prodcode ");
-            sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and st_code='" + CurrentStep + "'");
-            dh.ExecuteSql(sql.ToString(), "insert");
-        }
-
-        /// <summary>
-        /// 记录一般操作日志
-        /// </summary>
-        /// <param name="inMan"></param>
-        /// <param name="Content"></param>
-        /// <param name="Result"></param>
-        /// <param name="Search"></param>
-        /// <param name="Code"></param>
-        public static void InsertMessageLog(string inMan, string Content, string Result, string Search, string Code)
+        public static void AutoPassLog(string iSN,string iSource,string iMakeCode,string iDate,string iStepCode,string iLineCode,string iIFNG)
         {
             sql.Clear();
-            sql.Append("insert into messagelog (ml_id,ml_date,ml_man,ml_content,ml_result,ml_search,code) ");
-            sql.Append("values (messagelog_seq.nextval,sysdate,'" + inMan + "','" + Content + "','" + Result + "','" + Search + "','" + Code + "')");
-            dh.ExecuteSql(sql.ToString(), "insert");
-        }
-
-        public static bool OQCBatchJudge(string iCheckno, string iSourceCode, string iResult, string iRework, string iUserCode, string iRemark, out string oReworkCode, out string oErrorMessage)
-        {
-            oReworkCode = "";
-            oErrorMessage = "";
-            string[] param = new string[] { iCheckno, iSourceCode, iResult, iRework, iUserCode, iRemark, oReworkCode, oErrorMessage };
-            dh.CallProcedure("CS_OQCRESULTJUDGE", ref param);
-            oReworkCode = param[6];
-            oErrorMessage = param[7];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                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="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool SetAddressInfo(string iSN, string iMac, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string[] param = new string[] { iSN, iMac, iBT, iCode1, iCode2, iCode3, oErrorMessage };
-            dh.CallProcedure("CS_SETADDRESSINFO", ref param);
-            oErrorMessage = param[6];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        public static bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").ToString();
-            string CurrentStep = GetStepCodeBySource(iSourceCode);
-            if (StepCode == CurrentStep)
-            {
-                InsertMakeProcess(iSN, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);
-                return true;
-            }
-            else
-            {
-                return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, out oErrorMessage);
-            }
+            sql.Append("insert into AUTOSCANLOG(as_id,as_indate,as_testdate,as_sourcecode,as_stepcode,");
+            sql.Append("as_linecode,as_makecode,as_sncode,as_filename,as_ifng)values(AUTOSCANLOG_seq.nextval,");
+            sql.Append("sysdate,'"+ iDate + "','"+iSource+"','"+iStepCode+"','"+iLineCode+"','"+iMakeCode+"',");
+            sql.Append("'"+iSN+"','"+ iIFNG + "'");
+            dh.ExecuteSql(sql.ToString(), "select");
         }
 
         public static bool SetStepResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
@@ -721,461 +55,5 @@ namespace UAS_AutoPass.ToolClass
             else
                 return false;
         }
-        /// <summary>
-        /// 设置测试结果
-        /// </summary>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="iSN"></param>
-        /// <param name="iMPKind"></param>
-        /// <param name="iResult"></param>
-        /// <param name="iUserCode"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool SetTestResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
-        {
-            return SetStepFinish(iMakeCode, iSourceCode, iSN, iMPKind, iResult, iUserCode, out oErrorMessage);
-        }
-
-        public static bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, oErrorMessage };
-            dh.CallProcedure("CS_SETSTEPFINISH", ref param);
-            oErrorMessage = param[4];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 方法说明:测试详细信息录入系统,针对一个SN多个测试项目结果可循环调用
-        /// </summary>
-        /// <param name="iSnCode">序列号</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>
-        public static bool SetTestDetail(string iSnCode, string iMakeCode, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iSourceCode, out string oErrMessage)
-        {
-            oErrMessage = "";
-            sql.Clear();
-            sql.Append("Insert into STEPTESTDETAIL (STD_ID,STD_SN,STD_MAKECODE,STD_CLASS,STD_SUBCLASS1,STD_SUBCLASS2,");
-            sql.Append("STD_SUBCLASS3,STD_MAXVALUE,STD_MINVALUE,STD_ACTUALVALUE,STD_VALUE1,STD_VALUE2,STD_VALUE3,STD_TESTRESULT,");
-            sql.Append("STD_DATE,STD_RESCODE) values (STEPTESTDETAIL_SEQ.nextval,:std_sn,:std_makecode,");
-            sql.Append(":std_class,:std_subclass1,:std_subclass2,:std_subclass3,:std_maxvalue,:std_minvalue,:std_actualvalue,:std_value1,");
-            sql.Append(":std_value2,:std_value3,:std_testresult,sysdate,:std_record)");
-            dh.ExecuteSql(sql.ToString(), "select", iSnCode, iMakeCode, iClass, iSubClass1, iSubClass2, iSubClass3, iMaxValue, iMinValue, iActualValue, iValue1, iValue2, iValue3, iTestResult, iSourceCode);
-            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>
-        public static bool SetIMEIInfo(string iSnCode, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iNetCode, string iPSN, string iID1, string iID2, string iID3, out string oErrMessage)
-        {
-            oErrMessage = "";
-            string[] param = new string[] { iSnCode, iIMEI1, iIMEI2, iIMEI3, iMEID, iNetCode, iPSN, iID1, iID2, iID3, oErrMessage };
-            dh.CallProcedure("CS_SETIMEIINFO", ref param);
-            oErrMessage = param[10];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <returns></returns>
-        public static string GetPiInoutCode(string iCaller, string iType)
-        {
-            string Code = "";
-            string[] param = new string[] { iCaller, iType, Code };
-            dh.CallProcedure("SP_GETMAXNUMBER", ref param);
-            return param[2];
-        }
-
-        /// <summary>
-        /// 执行不良信息采集
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iUserCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="iBadCode"></param>
-        /// <param name="iBadRemark"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool SetTestNGDetail(string iSnCode, string iMakeCode, string iUserCode, string iSourceCode, string iResult, string[] iBadGroupCode, string[] iBadCode, string[] iBadGroupName, string[] iBadName, string[] iBadRemark, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string StepCode = "";
-            string StepName = "";
-            if (iResult == "" || iResult == null)
-                iResult = "检查未通过";
-            GetStepCodeAndNameBySource(iSourceCode, ref StepCode, ref StepName);
-            sql.Clear();
-            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_bgcode,mb_badtable,mb_soncode,mb_status,mb_badremark,mb_bgname,mb_badname)");
-            sql.Append("select makebad_seq.nextval,ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + StepCode + "',ms_sourcecode,:bc_code,:bg_code,'',");
-            sql.Append("sp_soncode,'0',:bc_remark,:bg_name,:bc_name 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='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
-            dh.BatchInsert(sql.ToString(), new string[] { "bc_code", "bg_code", "bc_remark", "bg_name", "bc_name" }, iBadCode, iBadGroupCode, iBadRemark, iBadGroupName, iBadName);
-            //更新序列号已经采集的工序 ms_paststep 已采集数据,更新下一工序
-            //如果存在送检批号则进行删除
-            if (dh.CheckExist("oqcbatchdetail", "obd_sncode='" + iSnCode + "'"))
-            {
-                string checkno = dh.getFieldDataByCondition("oqcbatchdetail", "obd_checkno", "obd_sncode='" + iSnCode + "'").ToString();
-                dh.ExecuteSql("delete from oqcbatchdetail where obd_sncode='" + iSnCode + "'", "delete");
-                dh.ExecuteSql("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + checkno + "'", "update");
-            }
-            //之前保存的不良就不再调用
-            DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_stepcode", "nvl(ms_ifrework,0)ms_ifrework" }, "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
-            if (dt.Rows.Count > 0)
-            {
-                string ifrework = dt.Rows[0]["ms_ifrework"].ToString();
-                string ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
-                if (ms_stepcode == StepCode)
-                {
-                    if (ifrework == "0")
-                        dh.UpdateByCondition("makeserial", "ms_status=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
-                    else
-                        dh.UpdateByCondition("makeserial", "ms_reworkstatus=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
-                }
-                else
-                {
-                    if (ifrework == "0")
-                        dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_paststep = ms_paststep ||'," + StepCode + "',ms_status=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "' ");
-                    else
-                        dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_paststep = ms_paststep ||'," + StepCode + "',ms_reworkstatus=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
-                    SetTestResult(iMakeCode, iSourceCode, iSnCode, "不良采集", iResult, iUserCode, out oErrorMessage);
-                }
-            }
-            return true;
-        }
-
-        /// <summary>
-        /// 判断是否扣料工序,执行扣料,执行上料表记录
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iUserName"></param>
-        /// <param name="iSourceCode"></param>
-        public static bool SetCollectionFinish(string iSnCode, string iMakeCode, string iUserName, string iSourceCode, out string oErrorMessage)
-        {
-            string StepCode = "";
-            string StepName = "";
-            string LineCode = "";
-            oErrorMessage = "";
-            GetStepCodeAndNameAndLineBySource(iSourceCode, ref StepCode, ref StepName, ref LineCode);
-            if (StepCode == "" && StepName == "")
-            {
-                oErrorMessage = "当前岗位资源找不到对应工序,请先进行维护";
-                return false;
-            }
-            sql.Clear();
-            sql.Append("select nvl(cd_ifreduce,0) cd_ifreduce from craft left join craftdetail on cd_crid=cr_id ");
-            sql.Append("where cr_code=(select ma_craftcode  from makeserial left join make on ma_code = ms_makecode ");
-            sql.Append("where ms_sncode = '" + iSnCode + "' and ms_makecode='" + iMakeCode + "') and cd_stepcode='" + StepCode + "'");
-            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-            sql.Clear();
-            if (dt.Rows.Count > 0)
-            {
-                string cd_ifreduce = dt.Rows[0][0].ToString();
-                if (cd_ifreduce == "-1")
-                {
-                    sql.Clear();
-                    sql.Append("select dsl_location,dsl_table,max(dsl_baseqty) baseqty from devsmtlocation where dsl_makecode='" + iMakeCode + "' and ");
-                    sql.Append("dsl_linecode='" + LineCode + "' and dsl_status=0 and dsl_remainqty>0 and dsl_invalidtime is null group by dsl_location,dsl_table");
-                    dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        sql.Clear();
-                        sql.Append("select dsl_id,dsl_remainqty from devsmtlocation where dsl_makecode='" + iMakeCode + "' and dsl_linecode='" + LineCode + "' ");
-                        sql.Append("and dsl_status=0 and dsl_remainqty>0 and dsl_invalidtime is null and rownum<3 order by dsl_id asc ");
-                        DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
-                        for (int j = 0; j < dt1.Rows.Count; j++)
-                        {
-                            //外层循环的值dt
-                            double baseqty = (double)dt.Rows[i]["baseqty"];
-                            //内层循环的值dt1
-                            double dsl_remainqty = (double)dt1.Rows[j]["dsl_remainqty"];
-                            string dsl_id = dt1.Rows[j]["dsl_id"].ToString();
-                            if (baseqty > 0)
-                            {
-                                if (dsl_remainqty <= baseqty)
-                                {
-                                    sql.Clear();
-                                    sql.Append("update devsmtlocation set dsl_remainqty=0,dsl_invalidtime =sysdate, dsl_validtime =(case when dsl_validtime ");
-                                    sql.Append("is null then sysdate else  dsl_validtime end),dsl_status=-1 where dsl_id=" + dsl_id);
-                                    dh.ExecuteSql(sql.ToString(), "update");
-                                    baseqty -= dsl_remainqty;
-                                }
-                                else
-                                {
-                                    sql.Clear();
-                                    sql.Append("update devsmtlocation set dsl_remainqty=dsl_remainqty-NVL(dsl_baseqty,0),DSL_INVALIDTIME=(case when");
-                                    sql.Append("dsl_validtime is null then sysdate else dsl_validtime end) where dsl_id=" + dsl_id);
-                                    dh.ExecuteSql(sql.ToString(), "update");
-                                    baseqty = 0;
-                                }
-                            }
-                            else
-                                dh.ExecuteSql("update devsmtlocation set DSL_INVALIDTIME=sysdate where dsl_id=" + dsl_id, "update");
-                        }
-                    }
-                    sql.Clear();
-                    sql.Append("insert into ReduceStepRecord (rsd_id,rsd_macode,rsd_maprodcode,rsd_table,rsd_sncode,rsd_linecode,rsd_sourcecode) select ");
-                    sql.Append("ReduceStepRecord_SEQ.nextval,'" + iMakeCode + "',ma_prodcode,'','" + iSnCode + "','" + LineCode + "','" + iSourceCode + "' ");
-                    sql.Append("from make where ma_code='" + iMakeCode + "'");
-                    dh.ExecuteSql(sql.ToString(), "insert");
-                }
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// 执行下料操作
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iBarCode"></param>
-        /// <param name="iCurrentStep"></param>
-        /// <param name="iUserName"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool SetMaterialDown(string iSnCode, string iBarCode, string iSourceCode, string iCurrentStep, string iUserName, out string oErrorMessage)
-        {
-            //序列号不为空的时候
-            oErrorMessage = "";
-            DataTable dt;
-            //对序列号进行验证
-            dt = (DataTable)dh.ExecuteSql("select  ms_status,ms_stepcode,ms_nextstepcode  from  makeserial  where  ms_sncode='" + iBarCode + "'", "select");
-            if (dt.Rows.Count > 0)
-            {
-                string ms_status = dt.Rows[0]["ms_status"].ToString();
-                string ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
-                string ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
-                if (ms_status == "1" && ms_stepcode != iCurrentStep)
-                    oErrorMessage = "当前工序不是" + iCurrentStep + "";
-                else if (ms_status == "0" && ms_stepcode != iCurrentStep)
-                    oErrorMessage = "当前工序不是" + iCurrentStep + "";
-                else if (ms_status == "2" && ms_nextstepcode != iCurrentStep)
-                    oErrorMessage = "该序列号已经包装";
-                else
-                {
-                    dt = (DataTable)dh.ExecuteSql("select * from craftmaterial where cm_sncode='" + iSnCode + "'", "select");
-                    if (dt.Rows.Count > 0)
-                        oErrorMessage = "请采集需要下料的序列号";
-                    else
-                        oErrorMessage = "该序列号未上料,无需下料";
-                }
-            }
-
-            if (oErrorMessage == "")
-            {
-                dt = (DataTable)dh.ExecuteSql("select cm_id,cm_stepcode,ms_makecode,cm_mccode from craftmaterial left join makeserial on cm_makecode=ms_makecode and cm_sncode=ms_sncode where ms_sncode='" + iSnCode + "' and cm_barcode='" + iBarCode + "'", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    string cm_id = dt.Rows[0]["cm_id"].ToString();
-                    string ms_macode = dt.Rows[0]["ms_makecode"].ToString();
-                    string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
-                    string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
-                    dh.ExecuteSql("delete from Craftmaterial where cm_id=" + cm_id, "delete");
-                    InsertMakeProcess(ms_macode, iSnCode, iSourceCode, "下料操作", "下料成功", iUserName);
-                    int count = dh.getRowCount("craftMaterial", "cm_mccode='" + cm_mccode + "' and cm_stepcode='" + cm_stepcode + "' and cm_sncode='" + iSnCode + "'");
-                    if (count == 0)
-                        dh.UpdateByCondition("makecraftdetail ", "mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty = mcd_okqty - 1", "mcd_mccode='" + cm_mccode + "' and mcd_stepcode='" + cm_stepcode + "'");
-                }
-                return true;
-            }
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 设置良品采集结果,iResult含有“批次通过”按抽检批次通过
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="iUserName"></param>
-        /// <param name="iResult"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public static bool UpdateMakeMessage(string iSnCode, string iMakeCode, string iMPKind, string iSourceCode, string iUserCode, string iResult, out string oErrorMessage)
-        {
-            return SetStepFinish(iMakeCode, iSourceCode, iSnCode, iMPKind, iResult, iUserCode, out oErrorMessage);
-        }
-
-        /// <summary>
-        /// 获取执行步骤代码,名称和线别
-        /// </summary>
-        /// <param name="Source"></param>
-        /// <param name="StepCode"></param>
-        /// <param name="StepName"></param>
-        /// <param name="LineCode"></param>
-        private static void GetStepCodeAndNameAndLineBySource(string Source, ref string StepCode, ref string StepName, ref string LineCode)
-        {
-            DataTable dt = dh.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 static void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
-        {
-            DataTable dt = dh.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 static string GetStepCodeBySource(string Source)
-        {
-            return dh.getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
-        }
-
-        /// <summary>
-        /// 获取箱号
-        /// </summary>
-        /// <param name="pr_id">物料主表的ID</param>
-        /// <param name="kind">管控类型</param>
-        /// <returns></returns>
-        public static string GetOutBoxCode(string Caller, string iMakeCode, string iProdCode, string iUserCode)
-        {
-            string BoxCode = "";
-            string[] param = new string[] { Caller, iMakeCode, iProdCode, iUserCode, BoxCode };
-            dh.CallProcedure("SP_GETPACKORPALLETCODE", ref param);
-            return param[4];
-        }
-
-        public static bool CheckSNBeforeLoad(string iMakeCode, string iSN, string iSonCode, string iRule, string iPrefix, string iLength, out string ErrMessage)
-        {
-            DataTable dt;
-            ErrMessage = "";
-            switch (iRule)
-            {
-                case "TSN":
-                    dt = (DataTable)dh.ExecuteSql("select ms_id,ms_prodcode,ms_nextmacode,ms_salecode,ms_downstatus from makeserial where ms_sncode='" + iSN + "' and ms_makecode<>'" + iMakeCode + "' and ms_status=2 order by ms_id desc", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        if (dt.Rows[0]["ms_downstatus"].ToString() != "0")
-                        {
-                            ErrMessage = "序列号:" + iSN + "已下地,请先取消下地";
-                            return false;
-                        }
-                        if (dt.Rows[0]["ms_nextmacode"].ToString() != "")
-                        {
-                            ErrMessage = "序列号:" + iSN + "已被工单" + dt.Rows[0]["ms_nextmacode"].ToString() + "使用";
-                            return false;
-                        }
-                        if (dt.Rows[0]["ms_salecode"].ToString() != dh.getFieldDataByCondition("make", "ma_salecode", "ma_code='" + iMakeCode + "'").ToString())
-                        {
-                            ErrMessage = "序列号对应销售订单与工单不符";
-                            return false;
-                        }
-                        //ms_salecode是否等于工单的SaleCode
-                        if (iSonCode != dt.Rows[0]["ms_prodcode"].ToString())
-                        {
-                            ErrMessage = "序列号对应的物料不是:" + iSonCode;
-                            return false;
-                        }
-                        else
-                        {
-                            dh.UpdateByCondition("makeserial", "ms_nextmacode='" + iMakeCode + "'", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')");
-                            return true;
-                        }
-                    }
-                    else ErrMessage = "序列号" + iSN + "不存在";
-                    break;
-                case "BARCODE":
-                    dt = (DataTable)dh.ExecuteSql("select bar_prodcode,bar_code from barcode where bar_code='" + iSN + "'", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        if (iSonCode != dt.Rows[0]["bar_prodcode"].ToString())
-                            ErrMessage = "用户条码号对应的物料不是:" + iSonCode;
-                        else
-                            return true;
-                    }
-                    else ErrMessage = "条码" + iSN + "不存在";
-                    break;
-                case "RULE":
-                    int sp_length = int.Parse(iLength != "" ? iLength : "0");
-                    if (iSN.StartsWith(iPrefix) || iPrefix == "")
-                    {
-                        //进行长度匹配
-                        if (iSN.Length == sp_length || sp_length == 0)
-                        {
-                            return true;
-                        }
-                        else ErrMessage = iSN + "长度不匹配";
-                    }
-                    else ErrMessage = iSN + "前缀不匹配";
-                    break;
-                default:
-                    break;
-            }
-            return false;
-        }
-
-        public static bool Packing(string iSN, string iOutBoxCode, bool iAutoNew, string iType, string iSource, string iUser, string iStandarqty, bool iInOrOut, out string oOutBoxCode, out string oErrMessage)
-        {
-            oErrMessage = "";
-            oOutBoxCode = "";
-            string[] param = new string[] { iSN, iOutBoxCode, iAutoNew ? "Y" : "N", iType, iSource, iUser, iStandarqty, iInOrOut ? "OUT" : "IN", oOutBoxCode, oErrMessage };
-            dh.CallProcedure("CS_PACKCARTON", ref param);
-            oOutBoxCode = param[8];
-            oErrMessage = param[9];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return true;
-            else
-                return false;
-        }
     }
 }