Browse Source

特殊报表修改

callm 4 months ago
parent
commit
178f475888

+ 1 - 1
UAS_MES_LGDZ/FunctionCode/Query/Query_SpecialReport.cs

@@ -202,7 +202,7 @@ namespace UAS_MES_NEW.Query
                 dh.ExecuteSql("delete from SMTTRACEFILE where ( STF_MODEL is null and  STF_FEEDER is null and STF_FEEDERNO is null and STF_MACHINE is null ) or stf_model in ('料槽','数量','印刷板') or STF_MACHINE in('贴片生产线:','设置:','***') ", "delete");
                 dataGridView1.DataSource = dt;
                 DataTable dt1 = (DataTable)dh.ExecuteSql("select STF_ID, STF_MODEL,STF_MACHINE, STF_FEEDER, STF_FEEDERNO, STF_LOCATION,replace(pr_orispeccode,' ','\n')pr_orispeccode,bo_mothercode,bd_baseqty,bd_soncode,bd_location, STF_CODE, STF_INDATE, STF_INMAN,sumqty from SMTTRACEFILE left join (select bo_mothercode,bd_baseqty,bd_soncode,replace(bd_location,',',' ')bd_location from BOMDetail LEFT JOIN bom on bd_bomid=bo_id left join Product ON bd_soncode=pr_code left join ProdReplace on pre_bdid =bd_id where bo_mothercode='" + pr_code.Text + "' ) on bo_mothercode=stf_prodcode and bd_soncode=STF_LOCATION left join product on pr_code=STF_LOCATION " +
-                    "left join (select sum(bd_baseqty)sumqty,bo_mothercode mothercode from BOMDetail LEFT JOIN bom on bd_bomid=bo_id left join Product ON bd_soncode=pr_code left join ProdReplace on pre_bdid =bd_id where bo_mothercode='" + pr_code.Text + "' group by bo_mothercode)on mothercode=bo_mothercode where stf_prodcode='" + pr_code.Text + "' order by stf_id", "select");
+                    "left join (select sum(bd_baseqty)sumqty,bo_mothercode mothercode from BOMDetail LEFT JOIN bom on bd_bomid=bo_id left join Product ON bd_soncode=pr_code where bo_mothercode='" + pr_code.Text + "' group by bo_mothercode)on mothercode=bo_mothercode where stf_prodcode='" + pr_code.Text + "' order by stf_id", "select");
                 ExportFileDialog.Description = "选择导出的路径";
                 DialogResult result1 = ExportFileDialog.ShowDialog();
                 if (result1 == DialogResult.OK)

+ 52 - 45
UAS_MesInterface(LGDZ)/MesHelper.cs

@@ -25,7 +25,7 @@ namespace UMESDLLService
         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 string oInfo, out string oErrMessage);
-        bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iNETCODE, string iID1, string iID2, string iID3, out string oErrMessage);
+        bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iIMEI4, string iMEID, string iNETCODE, string iID1, string iID2, string iID3, 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);
@@ -48,7 +48,7 @@ namespace UMESDLLService
 
         string Master = "N_MES";
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.64.89.153)(PORT=61521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.28.21)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
         private OracleConnection connection;
         //用户选择的数据库的连接字符串
@@ -124,12 +124,9 @@ namespace UMESDLLService
                 return false;
             }
             string SNcode = iSN;
-            if (getFieldDataByCondition("source left join step on SC_STEPCODE=st_code", "nvl(st_getsn,'0')", "sc_code='" + iResCode + "'").ToString() != "0")
+            if (!GetInfoByMaterial(iSN, out iSN, out oErrMessage))
             {
-                if (!GetInfoByMaterial(iSN, out iSN, out oErrMessage))
-                {
-                    oErrMessage = "";
-                }
+                oErrMessage = "";
             }
             if (iSN == "")
             {
@@ -291,14 +288,14 @@ namespace UMESDLLService
             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);
+            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_netcard", "v_o_code1", "v_o_code2", "v_o_code3", "v_o_errmsg" };
+            CallProcedure("CS_GETADDRESSBYMAKECODE_FIMEI", ParamName, ref param);
             oInfo += "MAC:" + param[2].ToString() + "^".Replace("null", "");
             oInfo += "BT:" + param[3].ToString() + "^".Replace("null", "");
-            oInfo += "Code1:" + param[4].ToString() + "^".Replace("null", "");
-            oInfo += "Code2:" + param[5].ToString() + "^".Replace("null", "");
-            oInfo += "Code3:" + param[6].ToString() + "";
+            oInfo += "Code1:" + param[5].ToString() + "^".Replace("null", "");
+            oInfo += "Code2:" + param[6].ToString() + "^".Replace("null", "");
+            oInfo += "Code3:" + param[7].ToString() + "";
             oErrMessage = param[7];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -330,6 +327,8 @@ namespace UMESDLLService
             oInfo = "";
             string oIMEI1 = "";
             string oIMEI2 = "";
+            string oIMEI3 = "";
+            string oIMEI4 = "";
             string oMEID = "";
             string oNetCode = "";
             string oPSN = "";
@@ -344,18 +343,20 @@ namespace UMESDLLService
             }
 
             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_TEST", ParamName, ref param);
+            string[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, oIMEI4, 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_imei4", "v_o_meid", "v_o_netcode", "v_o_psn", "v_o_id1", "v_o_id2", "v_o_id3", "v_o_errmsg" };
+            CallProcedure("CS_GETIMEIORNETCODERANGE_FIMEI", ParamName, ref param);
 
             oInfo += "IMEI1:" + param[4].ToString() + "^".Replace("null", "");
             oInfo += "IMEI2:" + param[5].ToString() + "^".Replace("null", "");
-            oInfo += "MEID:" + param[7].ToString() + "^".Replace("null", "");
-            oInfo += "NETCODE:" + param[8].ToString() + "^".Replace("null", "");
-            oInfo += "PSN:" + param[9].ToString() + "^".Replace("null", "");
-            oInfo += "ID1:" + param[10].ToString() + "^".Replace("null", "");
-            oInfo += "ID2:" + param[11].ToString() + "^".Replace("null", "");
-            oInfo += "ID3:" + param[12].ToString() + "".Replace("null", "");
+            oInfo += "IMEI3:" + param[6].ToString() + "^".Replace("null", "");
+            oInfo += "IMEI4:" + param[7].ToString() + "^".Replace("null", "");
+            oInfo += "MEID:" + param[8].ToString() + "^".Replace("null", "");
+            oInfo += "NETCODE:" + param[9].ToString() + "^".Replace("null", "");
+            oInfo += "PSN:" + param[10].ToString() + "^".Replace("null", "");
+            oInfo += "ID1:" + param[11].ToString() + "^".Replace("null", "");
+            oInfo += "ID2:" + param[12].ToString() + "^".Replace("null", "");
+            oInfo += "ID3:" + param[13].ToString() + "".Replace("null", "");
             oErrMessage = param[13];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -425,12 +426,12 @@ namespace UMESDLLService
             Dictionary<string, string> oInfo = new Dictionary<string, string>();
             oErrMessage = "";
             oJson = "";
-            if (iSN == "")
-            {
-                oErrMessage = "SN不能为空";
-                return false;
-            }
-            string MacInfo;
+            //if (iSN == "")
+            //{
+            //    oErrMessage = "SN不能为空";
+            //    return false;
+            //}
+            //string MacInfo;
             //if (!GetAddressRangeByMO(iSN, out MacInfo, out oErrMessage))
             //{
             //    if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
@@ -460,13 +461,14 @@ namespace UMESDLLService
             //}
             //string IMEI1 = ImeiInfo.Split('^')[0].Replace("IMEI1:", "");
             //string IMEI2 = ImeiInfo.Split('^')[1].Replace("IMEI2:", "");
-            //string MEID = ImeiInfo.Split('^')[2].Replace("MEID:", "");
-            //string NETCODE = ImeiInfo.Split('^')[3].Replace("NETCODE:", "");
-            //string PSN = ImeiInfo.Split('^')[4].Replace("PSN:", "");
-            //string ID1 = ImeiInfo.Split('^')[5].Replace("ID1:", "");
-            //string ID2 = ImeiInfo.Split('^')[6].Replace("ID2:", "");
-            //string ID3 = ImeiInfo.Split('^')[7].Replace("ID3:", "");
-            //if (!SetIMEIInfo(iSN, IMEI1 == "null" ? "" : IMEI1, IMEI2 == "null" ? "" : IMEI2, "", MEID == "null" ? "" : MEID, NETCODE == "null" ? "" : NETCODE, ID1 == "null" ? "" : ID1, ID2 == "null" ? "" : ID2, ID3 == "null" ? "" : ID3, out oErrMessage))
+            //string IMEI3 = ImeiInfo.Split('^')[2].Replace("IMEI3:", "");
+            //string MEID = ImeiInfo.Split('^')[3].Replace("MEID:", "");
+            //string NETCODE = ImeiInfo.Split('^')[4].Replace("NETCODE:", "");
+            //string PSN = ImeiInfo.Split('^')[5].Replace("PSN:", "");
+            //string ID1 = ImeiInfo.Split('^')[6].Replace("ID1:", "");
+            //string ID2 = ImeiInfo.Split('^')[7].Replace("ID2:", "");
+            //string ID3 = ImeiInfo.Split('^')[8].Replace("ID3:", "");
+            //if (!SetIMEIInfo(iSN, IMEI1 == "null" ? "" : IMEI1, IMEI2 == "null" ? "" : IMEI2, IMEI3 == "null" ? "" : IMEI3, MEID == "null" ? "" : MEID, NETCODE == "null" ? "" : NETCODE, ID1 == "null" ? "" : ID1, ID2 == "null" ? "" : ID2, ID3 == "null" ? "" : ID3, out oErrMessage))
             //{
             //    if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
             //        return true;
@@ -474,7 +476,7 @@ namespace UMESDLLService
             //        return false;
             //}
             //通过序列号获取最近操作的工单号
-            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
+            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "' or ms_imei1='"+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 + "'");
@@ -569,7 +571,7 @@ namespace UMESDLLService
         /// <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)
+        public bool SetAddressInfo(string iSN, string iMac, string iBT,  string iCode1, string iCode2, string iCode3, out string oErrMessage)
         {
             if (iSN == "")
             {
@@ -577,9 +579,9 @@ namespace UMESDLLService
                 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);
+            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_netcard", "v_i_code1", "v_i_code2", "v_i_code3", "v_o_errmsg" };
+            CallProcedure("CS_SETADDRESSINFO_FIMEI", ParamName, ref param);
             oErrMessage = param[6];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -780,7 +782,7 @@ namespace UMESDLLService
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
         [Description("设置IMEI信息")]
-        public bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iNETCODE, string iID1, string iID2, string iID3, out string oErrMessage)
+        public bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iIMEI4, string iMEID, string iNETCODE, string iID1, string iID2, string iID3, out string oErrMessage)
         {
             if (iSN == "")
             {
@@ -788,9 +790,9 @@ namespace UMESDLLService
                 return false;
             }
             oErrMessage = "";
-            string[] param = new string[] { iSN, iIMEI1, iIMEI2, iIMEI3, iMEID, iNETCODE, "", iID1, iID2, iID3, 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);
+            string[] param = new string[] { iSN, iIMEI1, iIMEI2, iIMEI3, iIMEI4, iMEID, iNETCODE, "", iID1, iID2, iID3, oErrMessage };
+            string[] ParamName = new string[] { "v_i_sncode", "v_i_imei1", "v_i_imei2", "v_i_imei3", "v_i_imei4", "v_i_meid", "v_i_netcode", "v_i_psn", "v_i_id1", "v_i_id2", "v_i_id3", "v_o_errmsg" };
+            CallProcedure("CS_SETIMEIINFO_FIMEI", ParamName, ref param);
             oErrMessage = param[10];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -866,6 +868,11 @@ namespace UMESDLLService
                 ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
             }
             string stepcode = GetStepCodeBySource(iResCode);
+            if (ms_nextstepcode != "" && ms_nextstepcode != stepcode)
+            {
+                oErrMessage = "当前序列号" + iSN + "下一工序" + ms_nextstepcode;
+                return false;
+            }
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && ms_stepcode == stepcode))
             {
                 if (ms_status == "3")
@@ -1294,7 +1301,7 @@ namespace UMESDLLService
             oErrorMessage = "";
             try
             {
-                string url = "http://218.64.89.153:8099/mes/mobile/login.action";//html调用的地址              
+                string url = "http://10.11.28.21:8099/mes/mobile/login.action";//html调用的地址              
                 HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);
                 if (webrequest == null)
                 {

+ 145 - 114
UAS_MesInterface(ODLF)/MesHelper.cs

@@ -3,9 +3,11 @@ using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
+using System.Globalization;
 using System.IO;
 using System.Net;
 using System.Runtime.InteropServices;
+using System.Security.Cryptography;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Web.Script.Serialization;
@@ -21,10 +23,10 @@ namespace UMESDLLService
         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 string oInfo, out string oErrMessage);
+        bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, 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 string oInfo, out string oErrMessage);
+        bool SetTestDetail(string iSN, string iResCode, string[] iClassName, string[] iTestResult, string iMaxValue, string iMinValue, string[] iTestDetail, out string oErrMessage);
+        bool GetMEIOrNetCodeRange(string iSN, 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 oErrMessage);
         bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iPSN, string iNETCODE, string iID1, string iID2, string iID3, 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);
@@ -32,6 +34,10 @@ namespace UMESDLLService
         bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage);
         bool GetInfoByMaterial(string iPCBA, out string oSN, out string oErrMessage);
         bool GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage);
+        bool GetMakeInfoBySN(string iSN, out string oInfo, out string oErrorMessage);
+        bool GetPSN(string iSN, out string oInfo, out string oErrorMessage);
+
+        bool GetMakeInfo(string iSN, out string oInfo, out string oErrorMessage);
 
     }
 
@@ -46,7 +52,7 @@ namespace UMESDLLService
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
 
-        string Master = "N_MES";
+        string Master = "YD_CYZZ";
         //系统默认的的连接字符串
         private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11568)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
@@ -81,6 +87,7 @@ namespace UMESDLLService
             return true;
         }
 
+
         public bool GetInfoByMaterial(string iPCBA, out string oSN, out string oErrMessage)
         {
             oSN = "";
@@ -273,14 +280,13 @@ namespace UMESDLLService
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
         [Description("分配MAC和BT信息")]
-        public bool GetAddressRangeByMO(string iSN, out string oInfo, out string oErrMessage)
+        public bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oErrMessage)
         {
-            oInfo = "";
-            string oWIFI = "";
-            string oBT = "";
-            string oCode1 = "";
-            string oCode2 = "";
-            string oCdoe3 = "";
+            oWIFI = "";
+            oBT = "";
+            oCode1 = "";
+            oCode2 = "";
+            oCode3 = "";
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -289,14 +295,14 @@ namespace UMESDLLService
             oErrMessage = "";
             string omakeCode = "";
             GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
-            string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
+            string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCode3, 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 += "MAC:" + param[2].ToString() + "^".Replace("null", "");
-            oInfo += "BT:" + param[3].ToString() + "^".Replace("null", "");
-            oInfo += "Code1:" + param[4].ToString() + "^".Replace("null", "");
-            oInfo += "Code2:" + param[5].ToString() + "^".Replace("null", "");
-            oInfo += "Code3:" + param[6].ToString() + "";
+            oWIFI = param[2].ToString();
+            oBT = param[3].ToString();
+            oCode1 = param[4].ToString();
+            oCode2 = param[5].ToString();
+            oCode3 = param[6].ToString();
             oErrMessage = param[7];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -323,37 +329,35 @@ namespace UMESDLLService
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
         [Description("分配IMEI和NetCode信息")]
-        public bool GetMEIOrNetCodeRange(string iSN, string iIMEI1, string iNetCode, out string oInfo, out string oErrMessage)
+        public bool GetMEIOrNetCodeRange(string iSN, 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 oErrMessage)
         {
-            oInfo = "";
-            string oIMEI1 = "";
-            string oIMEI2 = "";
-            string oMEID = "";
-            string oNetCode = "";
-            string oPSN = "";
-            string oID1 = "";
-            string oID2 = "";
-            string oID3 = "";
-
+            oIMEI1 = "";
+            oIMEI2 = "";
+            oIMEI3 = "";
+            oMEID = "";
+            oNetCode = "";
+            oPSN = "";
+            oID1 = "";
+            oID2 = "";
+            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[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, 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 += "IMEI1:" + param[4].ToString() + "^".Replace("null", "");
-            oInfo += "IMEI2:" + param[5].ToString() + "^".Replace("null", "");
-            oInfo += "MEID:" + param[7].ToString() + "^".Replace("null", "");
-            oInfo += "NETCODE:" + param[8].ToString() + "^".Replace("null", "");
-            oInfo += "PSN:" + param[9].ToString() + "^".Replace("null", "");
-            oInfo += "ID1:" + param[10].ToString() + "^".Replace("null", "");
-            oInfo += "ID2:" + param[11].ToString() + "^".Replace("null", "");
-            oInfo += "ID3:" + param[12].ToString() + "".Replace("null", "");
+            oIMEI1 = param[4].ToString();
+            oIMEI2 = param[5].ToString();
+            oIMEI3 = param[6].ToString();
+            oMEID = param[7].ToString();
+            oNetCode = param[8].ToString();
+            oPSN = param[9].ToString();
+            oID1 = param[10].ToString();
+            oID2 = param[11].ToString();
+            oID3 = param[12].ToString();
             oErrMessage = param[13];
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                 return true;
@@ -428,54 +432,11 @@ namespace UMESDLLService
                 oErrMessage = "SN不能为空";
                 return false;
             }
-            DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "' or ms_imei1='" + iSN + "' or ms_imei2='" + iSN + "' order by ms_id desc", "select");
+            DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'  order by ms_id desc", "select");
             if (dt.Rows.Count > 0)
             {
                 iSN = dt.Rows[0]["ms_sncode"].ToString();
             }
-            string MacInfo;
-            //if (!GetAddressRangeByMO(iSN, out MacInfo, out oErrMessage))
-            //{
-            //    if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-            //        return true;
-            //    else
-            //        return false;
-            //}
-            //string MAC = MacInfo.Split('^')[0].Replace("MAC:", "");
-            //string BT = MacInfo.Split('^')[1].Replace("BT:", "");
-            //string TCode1 = MacInfo.Split('^')[2].Replace("Code1:", "");
-            //string TCode2 = MacInfo.Split('^')[3].Replace("Code2:", "");
-            //string TCode3 = MacInfo.Split('^')[4].Replace("Code3:", "");
-            //if (!SetAddressInfo(iSN, MAC == "null" ? "" : MAC, BT == "null" ? "" : BT, TCode1 == "null" ? "" : TCode1, TCode2 == "null" ? "" : TCode2, TCode3 == "null" ? "" : TCode3, out oErrMessage))
-            //{
-            //    if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-            //        return true;
-            //    else
-            //        return false;
-            //}
-            string ImeiInfo;
-            if (!GetMEIOrNetCodeRange(iSN, "", "", out ImeiInfo, out oErrMessage))
-            {
-                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                    return true;
-                else
-                    return false;
-            }
-            string IMEI1 = ImeiInfo.Split('^')[0].Replace("IMEI1:", "");
-            string IMEI2 = ImeiInfo.Split('^')[1].Replace("IMEI2:", "");
-            string MEID = ImeiInfo.Split('^')[2].Replace("MEID:", "");
-            string NETCODE = ImeiInfo.Split('^')[3].Replace("NETCODE:", "");
-            string PSN = ImeiInfo.Split('^')[4].Replace("PSN:", "");
-            string ID1 = ImeiInfo.Split('^')[5].Replace("ID1:", "");
-            string ID2 = ImeiInfo.Split('^')[6].Replace("ID2:", "");
-            string ID3 = ImeiInfo.Split('^')[7].Replace("ID3:", "");
-            if (!SetIMEIInfo(iSN, IMEI1 == "null" ? "" : IMEI1, IMEI2 == "null" ? "" : IMEI2, "", MEID == "null" ? "" : MEID, PSN == "null" ? "" : PSN, NETCODE == "null" ? "" : NETCODE, ID1 == "null" ? "" : ID1, ID2 == "null" ? "" : ID2, ID3 == "null" ? "" : ID3, 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 != "")
@@ -580,6 +541,7 @@ namespace UMESDLLService
                 return false;
             }
             oErrMessage = "";
+            iSN = getFieldDataByCondition("makeserial", "ms_sncode", "ms_sncode='" + iSN + "' order by ms_id").ToString();
             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);
@@ -673,7 +635,7 @@ namespace UMESDLLService
             oErrorMessage = "";
             if (iTSN == "") { oErrorMessage = "TSN不能为空"; return false; }
             if (iSN == "") { oErrorMessage = "SN不能为空"; return false; }
-            DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_imei1='" + iTSN + "' order by ms_id desc", "select");
+            DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_sncode='" + iTSN + "' order by ms_id desc", "select");
             if (dt.Rows.Count > 0)
             {
                 iTSN = dt.Rows[0]["ms_sncode"].ToString();
@@ -732,7 +694,7 @@ namespace UMESDLLService
         /// <param name="oErrMessage"></param>                                                      
         /// <returns></returns>
         [Description("设置测试结果")]
-        public bool SetTestDetail(string iSN, string iClass, string iResCode, string[,] iTestDetail, out string oErrMessage)
+        public bool SetTestDetail(string iSN, string iResCode, string[] iClassName, string[] iTestResult, string iMaxValue, string iMinValue, string[] iTestDetail, out string oErrMessage)
         {
             if (iSN == "" || iSN == null)
             {
@@ -744,36 +706,17 @@ namespace UMESDLLService
             GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
             sql.Clear();
             sql.Append("begin ");
-            bool needBreak = false;
-            for (int i = 0; i < iTestDetail.Length / 200; i++)
+            if (iClassName.Length != iTestResult.Length || iTestResult.Length != iTestDetail.Length)
             {
-                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) + ");");
+                oErrMessage = "参数项次不对应";
+                return false;
+            }
+            for (int i = 0; i < iTestDetail.Length; i++)
+            {
+                string sql = "Insert into STEPTESTDETAIL (STD_ID,STD_CLASS,STD_SN,STD_MAKECODE,STD_ACTUALVALUE,STD_TESTRESULT,STD_INDATE,STD_RESCODE,STD_MAXVALUE, STD_MINVALUE)";
+                sql += "values(STEPTESTDETAIL_SEQ.nextval,'" + iClassName[i] + "','" + iSN + "','" + omakeCode + "','" + iTestDetail[i] + "','" + iTestResult[i] + "',sysdate,'" + iResCode + "','" + iMaxValue + "','" + iMinValue + "')";
+                ExecuteSql(sql.ToString(), "insert");
             }
-            sql.Append("end;");
-            ExecuteSql(sql.ToString(), "insert");
             return true;
         }
 
@@ -1310,7 +1253,7 @@ namespace UMESDLLService
             oErrorMessage = "";
             try
             {
-                string url = "http://10.98.0.21:8099/mes/mobile/login.action";//html调用的地址              
+                string url = "http://192.168.0.85:8099/mes/mobile/login.action";//html调用的地址              
                 HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);
                 if (webrequest == null)
                 {
@@ -1408,5 +1351,93 @@ namespace UMESDLLService
             }
             return Dic;
         }
+
+        public bool GetMakeInfoBySN(string iSN, out string oInfo, out string oErrorMessage)
+        {
+            oInfo = "";
+            oErrorMessage = "";
+            DataTable rs = (DataTable)ExecuteSql("select ma_remark1,ma_remark2,ma_remark3,ma_remark4,ma_remark5,ma_remark6,ma_remark7,ma_remark8,ma_remark9,ma_remark10,ma_remark11,ma_remark12,ma_remark13,ma_remark14,ma_remark15,ma_remark16,ma_remark17,ma_remark18 from  " + Master + ".make  " +
+                  "left join " + Master + ".makeserial on ms_makecode=ma_code  where ms_sncode='" + iSN + "' order by ms_id desc", "select");
+            if (rs.Rows.Count > 0)
+            {
+                oInfo += "oMaremark1:" + rs.Rows[0]["ma_remark1"].ToString() + "^";
+                oInfo += "oMaremark2:" + rs.Rows[0]["ma_remark2"].ToString() + "^";
+                oInfo += "oMaremark3:" + rs.Rows[0]["ma_remark3"].ToString() + "^";
+                oInfo += "oMaremark4:" + rs.Rows[0]["ma_remark4"].ToString() + "^";
+                oInfo += "oMaremark5:" + rs.Rows[0]["ma_remark5"].ToString() + "^";
+                oInfo += "oMaremark6:" + rs.Rows[0]["ma_remark6"].ToString() + "^";
+                oInfo += "oMaremark7:" + rs.Rows[0]["ma_remark7"].ToString() + "^";
+                oInfo += "oMaremark8:" + rs.Rows[0]["ma_remark8"].ToString() + "^";
+                oInfo += "oMaremark9:" + rs.Rows[0]["ma_remark9"].ToString() + "^";
+                oInfo += "oMaremark10:" + rs.Rows[0]["ma_remark10"].ToString() + "^";
+                oInfo += "oMaremark11:" + rs.Rows[0]["ma_remark11"].ToString() + "^";
+                oInfo += "oMaremark12:" + rs.Rows[0]["ma_remark12"].ToString() + "^";
+                oInfo += "oMaremark13:" + rs.Rows[0]["ma_remark13"].ToString() + "^";
+                oInfo += "oMaremark14:" + rs.Rows[0]["ma_remark14"].ToString() + "^";
+                oInfo += "oMaremark15:" + rs.Rows[0]["ma_remark15"].ToString() + "^";
+                oInfo += "oMaremark16:" + rs.Rows[0]["ma_remark16"].ToString() + "^";
+                oInfo += "oMaremark17:" + rs.Rows[0]["ma_remark17"].ToString() + "^";
+                oInfo += "oMaremark18:" + rs.Rows[0]["ma_remark18"].ToString() + "^";
+                return true;
+            }
+            else
+            {
+                oErrorMessage = "SN未查询到关联信息";
+                return false;
+            }
+        }
+
+        public bool GetMakeInfo(string iSN, out string oInfo, out string oErrorMessage)
+        {
+            oInfo = "";
+            oErrorMessage = "";
+            JavaScriptSerializer jss = new JavaScriptSerializer();
+            if (iSN == "")
+            {
+                oErrorMessage = "SN不能为空";
+                return false;
+            }
+            Dictionary<string, string> Info = new Dictionary<string, string>();
+            String makecode = getFieldDataByCondition("makeserial", "ms_makecode", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')").ToString();
+            DataTable rs = (DataTable)ExecuteSql("select mid_item,mid_value from makeitem left join makeitemdetail on mi_id=mid_miid where mi_makecode='" + makecode + "' and mid_item is not null", "select");
+            for (int i = 0; i < rs.Rows.Count; i++)
+            {
+                Info.Add(rs.Rows[i]["mid_item"].ToString(), rs.Rows[i]["mid_value"].ToString());
+            }
+            oInfo = jss.Serialize(Info);
+            return true;
+        }
+
+        public bool GetPSN(string iSN, out string oPSN, out string oErrorMessage)
+        {
+            oPSN = "";
+            oErrorMessage = "";
+            string iMakecode = getFieldDataByCondition("makeserial", "ms_makecode", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')").ToString();
+            if (iMakecode == "")
+            {
+                oErrorMessage = iSN + "无关联工单";
+                return false;
+            }
+            DataTable rs = (DataTable)ExecuteSql("select msl_sncode from makesnlist where msl_beforesn='" + iSN + "'", "select");
+            if (rs.Rows.Count > 0)
+            {
+                oPSN = rs.Rows[0][0].ToString();
+                return true;
+            }
+            rs = (DataTable)ExecuteSql("select msl_sncode,msl_id from makesnlist where msl_makecode='" + iMakecode + "' and msl_type='after' and nvl(msl_status,0)=0 order by msl_sncode", "select");
+            if (rs.Rows.Count > 0)
+            {
+                String msl_id = rs.Rows[0]["msl_id"].ToString();
+                String msl_sncode = rs.Rows[0]["msl_sncode"].ToString();
+                ExecuteSql("update makesnlist set msl_status=-1,msl_beforesn='" + iSN + "' where msl_id=" + msl_id + " and nvl(msl_status,0)=0", "update");
+                oPSN = rs.Rows[0][0].ToString();
+                return true;
+            }
+            else
+            {
+                oErrorMessage = "无可分配号段";
+                return false;
+            }
+        }
     }
 }

+ 0 - 1441
UAS_MesInterface_YD/MesHelper.cs

@@ -1,1441 +0,0 @@
-using Oracle.ManagedDataAccess.Client;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Web.Script.Serialization;
-
-namespace UMESDLLService
-{
-
-    [Guid("99D0E96E-1058-415D-9874-D34537625284")]
-    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
-    public interface IMESHelper
-    {
-        [DispId(20)]
-        bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
-        bool CheckRoutePassed_OnlyOK(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 string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage);
-        bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage);
-        bool GetMaster(out string oMaster);
-        bool SetMaster(string Master);
-        bool SetTestDetail(string iSN, string iTestResult, string iResCode, string[] iTestDetail, out string oErrMessage);
-        bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage);
-        bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iNET, string iID1, string iID2, string iID3, out string oErrMessage);
-        bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, 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 GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage);
-        bool GetProductRelation(string iSN, out string oWIFI, out string oBT, out string IMEI1, out string IMEI2, out string IMEI3, out string oNetCode, out string oMEID, out string oErrMessage);
-        bool GetSNList(string iMaCode, out string[] TSN_List, out string[] SN_List, out string[] TSN_Rule, out string[] SN_Rule, out string oErrMessage);
-        bool GetMaterialInfo(string iSN, out string oResult, out string oErrMessage);
-        bool GetPrintLabel(string iSN, out string oResult, out string oErrMessage);
-    }
-
-    [Guid("41EAB546-6EF4-464A-895A-9C34013A5D8C")]
-    [ComSourceInterfaces(typeof(IMESHelper))]
-    [ClassInterface(ClassInterfaceType.None)]
-    [ProgId("UMESDLLService.MESHelper")]
-    public class MESHelper : IMESHelper
-    {
-        //用于拼接SQL 
-        StringBuilder sql = new StringBuilder();
-        //用于存放批量执行的SQL
-        List<string> sqls = new List<string>();
-        //系统默认的的连接字符串
-        private string ConnectionStrings = "Data Source=81.71.42.91/orcl;User ID=MES;PassWord=select!#%*(;";
-        //用户选择的数据库的连接字符串
-        private OracleConnection connection;
-        //用户选择的数据库的连接字符串
-        private OracleCommand command = null;
-
-        DataTable MasterDB;
-
-        public MESHelper()
-        {
-            connection = new OracleConnection(ConnectionStrings);
-        }
-
-        /// <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 = "";
-                }
-                return true;
-            }
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 检测当前的岗位资源对应的工序
-        /// </summary>
-        /// <param name="iSN"></param>
-        /// <param name="iResCode"></param>
-        /// <param name="oErrMessage"></param>
-        /// <returns></returns>
-        [Description("序列号对应工序检测,不允许测试NG序列号")]
-        public bool CheckRoutePassed_OnlyOK(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))
-            {
-                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;
-            }
-        }
-
-        [Description("获取工单软件版本")]
-        public bool GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage)
-        {
-            string oMakeCode = "";
-            oErrMessage = "";
-            GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
-            oSoftVersion = getFieldDataByCondition("make", "ma_softversion", "ma_code='" + oMakeCode + "'").ToString();
-            return true;
-        }
-
-        [Description("获取SN关联采集信息")]
-        public bool GetProductRelation(string iSN, out string oWIFI, out string oBT, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oNetCode, out string oMEID, out string oErrMessage)
-        {
-            oWIFI = "";
-            oBT = "";
-            oIMEI1 = "";
-            oIMEI2 = "";
-            oIMEI3 = "";
-            oNetCode = "";
-            oMEID = "";
-            string oMakeCode = "";
-            if (GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage))
-            {
-                DataTable dt = (DataTable)ExecuteSql("select mal_mac,mal_bt from makeaddresslist where mal_makecode='" + oMakeCode + "' and rownum=1 ", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    if (dt.Rows[0]["mal_mac"].ToString() != "")
-                    {
-                        oWIFI = "Required";
-                    }
-                    if (dt.Rows[0]["mal_bt"].ToString() != "")
-                    {
-                        oBT = "Required";
-                    }
-                }
-                dt = (DataTable)ExecuteSql("select mil_imei1,mil_imei2,mil_imei3,mil_netcode,mil_meid from makeimeilist where mil_makecode='" + oMakeCode + "' and rownum=1", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    if (dt.Rows[0]["mil_imei1"].ToString() != "")
-                    {
-                        oIMEI1 = "Required";
-                    }
-                    if (dt.Rows[0]["mil_imei2"].ToString() != "")
-                    {
-                        oIMEI2 = "Required";
-                    }
-                    if (dt.Rows[0]["mil_imei3"].ToString() != "")
-                    {
-                        oIMEI3 = "Required";
-                    }
-                    if (dt.Rows[0]["mil_netcode"].ToString() != "")
-                    {
-                        oNetCode = "Required";
-                    }
-                    if (dt.Rows[0]["mil_meid"].ToString() != "")
-                    {
-                        oMEID = "Required";
-                    }
-                }
-                return true;
-            }
-            else 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 string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage)
-        {
-            oWIFI = "";
-            oBT = "";
-            oCode1 = "";
-            oCode2 = "";
-            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);
-            oWIFI = param[2];
-            oBT = param[3];
-            oCode1 = param[4];
-            oCode2 = param[5];
-            oCdoe3 = 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 string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
-        {
-            oIMEI1 = "";
-            oIMEI2 = "";
-            oMEID = "";
-            oNetCode = "";
-            oPSN = "";
-            oID1 = "";
-            oID2 = "";
-            oID3 = "";
-            oID4 = "";
-            oID5 = "";
-            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);
-            oIMEI1 = param[4];
-            oIMEI2 = param[5];
-            oMEID = param[7];
-            oNetCode = param[8];
-            oPSN = param[9];
-            oID1 = param[10];
-            oID2 = param[11];
-            oID3 = 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;
-            }
-        }
-
-        /// <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 oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
-        {
-            oBT = "";
-            oMEID = "";
-            oWIFI = "";
-            oPSN = "";
-            oNetCode = "";
-            oIMEI1 = "";
-            oIMEI2 = "";
-            oCode1 = "";
-            oCode2 = "";
-            oCode3 = "";
-            oID1 = "";
-            oID2 = "";
-            oID3 = "";
-            oID4 = "";
-            oID5 = "";
-            if (iSN == "")
-            {
-                oErrMessage = "SN不能为空";
-                return false;
-            }
-            //通过序列号获取最近操作的工单号
-            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + 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)
-                {
-                    oWIFI = dt.Rows[0]["ms_mac"].ToString();
-                    oBT = dt.Rows[0]["ms_bt"].ToString();
-                    oPSN = dt.Rows[0]["ms_psn"].ToString();
-                    oNetCode = dt.Rows[0]["ms_netcode"].ToString();
-                    oMEID = dt.Rows[0]["ms_meid"].ToString();
-                    oIMEI1 = dt.Rows[0]["ms_imei1"].ToString();
-                    oIMEI2 = dt.Rows[0]["ms_imei2"].ToString();
-                    oCode1 = dt.Rows[0]["ms_othcode1"].ToString();
-                    oCode2 = dt.Rows[0]["ms_othcode2"].ToString();
-                    oCode3 = dt.Rows[0]["ms_othcode3"].ToString();
-                    oID1 = dt.Rows[0]["ms_othid3"].ToString();
-                    oID2 = dt.Rows[0]["ms_othid3"].ToString();
-                    oID3 = dt.Rows[0]["ms_othid3"].ToString();
-                    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="iWIFI"></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 iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrMessage)
-        {
-            if (iSN == "")
-            {
-                oErrMessage = "SN不能为空";
-                return false;
-            }
-            oErrMessage = "";
-            string[] param = new string[] { iSN, iWIFI, 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("序列号跳到下一 步")]
-        public 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(',');
-                        List<string> InsertSQL = new List<string>();
-                        for (int i = 0; i < BadCode.Length; i++)
-                        {
-                            string mb_id = GetSEQ("makebad_seq");
-                            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 '" + mb_id + "'");
-                            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 + "'");
-                            InsertSQL.Add(sql.ToString().Replace(":bc_code", "'" + (BadCode[i].IndexOf("|") > 0 ? BadCode[i].Split('|')[0] : BadCode[i]) + "'"));
-                            //如果含有不良位号的则进行插入
-                            if (BadCode[i].IndexOf("|") > 0)
-                            {
-                                //使用|来分割不良代码和位号
-                                string badloc = BadCode[i].Split('|')[1];
-                                //获取多个位号
-                                string[] balocstr = badloc.Split('#');
-                                for (int j = 0; j < balocstr.Length; j++)
-                                {
-                                    //插入不良位号
-                                    sql.Length = 0;
-                                    sql.Append("insert into MAKEBADRSLOC(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,mbl_sncode,mbl_makecode,mbl_indate,mbl_inman)");
-                                    sql.Append("values(MAKEBADRSLOC_seq.nextval,'" + mb_id + "','" + balocstr[j] + "','" + BadCode[i].Split('|')[0] + "','" + BadCode[i].Split('|')[0] + "','" + iSN + "','" + iMakeCode + "',sysdate,'" + iUserCode + "')");
-                                    InsertSQL.Add(sql.ToString());
-                                }
-                            }
-                        }
-                        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);
-        }
-
-        [Description("获取账套信息")]
-        public bool GetMaster(out string oMaster)
-        {
-            MasterDB = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_address from master", "select");
-            oMaster = "";
-            for (int i = 0; i < MasterDB.Rows.Count; i++)
-            {
-                if (i != MasterDB.Rows.Count - 1)
-                    oMaster += MasterDB.Rows[i]["ma_user"].ToString() + "|";
-                else
-                    oMaster += MasterDB.Rows[i]["ma_user"].ToString();
-            }
-            return true;
-        }
-
-        [Description("设置账套信息")]
-        public bool SetMaster(string iMaster)
-        {
-            DataTable dt = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_address,ma_inneraddress from master where ma_user='" + iMaster + "'", "select");
-            if (dt.Rows.Count > 0)
-            {
-                ConnectionStrings = "Data Source=" + dt.Rows[0]["ma_inneraddress"].ToString() + "/orcl;User ID=" + iMaster + ";PassWord=" + dt.Rows[0]["ms_pwd"].ToString() + ";";
-                try
-                {
-                    connection = new OracleConnection(ConnectionStrings);
-                }
-                catch (Exception)
-                {
-                    return false;
-                }
-                return true;
-            }
-            return false;
-        }
-
-        /// <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 iTestResult, 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 ");
-            for (int i = 0; i < iTestDetail.Length; i++)
-            {
-                sql.Append("Insert into STEPTESTDETAIL (STD_ID,STD_CLASS,STD_SN,STD_MAKECODE,STD_ACTUALVALUE,STD_TESTRESULT,STD_INDATE,STD_RESCODE)");
-                sql.Append("values(STEPTESTDETAIL_SEQ.nextval,'ITEM" + i + "','" + iSN + "','" + omakeCode + "','" + iTestDetail[i] + "','" + iTestResult + "',sysdate,'" + iResCode + "');");
-            }
-            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, string iIMEI2, string iIMEI3, string iMEID, string iNET, string iID1, string iID2, string iID3, out string oErrMessage)
-        {
-            if (iSN == "")
-            {
-                oErrMessage = "SN不能为空";
-                return false;
-            }
-            oErrMessage = "";
-            string[] param = new string[] { iSN, iIMEI1, iIMEI2, iIMEI3, iMEID, iNET, "", iID1, iID2, iID3, 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)
-        {
-            oErrMessage = "";
-            if (iSN == "")
-            {
-                oErrMessage = "SN不能为空";
-                return false;
-            }
-            //if (CheckExist("makeserial", "ms_sncode='" + iSN + "' and ms_makecode='" + iMO + "'"))
-            //{
-            //    oErrMessage = "SN:" + iSN + "已存在于工单" + iMO;
-            //    return false;
-            //}
-            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>
-        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();
-            }
-        }
-
-        private string GetSEQ(string SeqName)
-        {
-            DataTable dt = new DataTable();
-            dt = (DataTable)ExecuteSql("SELECT " + SeqName + ".NEXTVAL FROM DUAL", "select");
-            return dt.Rows[0][0].ToString();
-        }
-
-        [Description("获取上料信息")]
-        public bool GetMaterialInfo(string iSN, out string oResult, out string oErrMessage)
-        {
-            JavaScriptSerializer jss = new JavaScriptSerializer();
-            Dictionary<string, string> oInfo = new Dictionary<string, string>();
-            oErrMessage = "";
-            oResult = "";
-            if (iSN == "")
-            {
-                oErrMessage = "SN不能为空";
-                return false;
-            }
-            Dictionary<string, string> MacInfo = new Dictionary<string, string>();
-            //通过序列号获取最近操作的工单号
-            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[] param = new string[] { ms_id, Code1, Code2, Code3, Code4, Code5, Code6, Code7, Code8, Code9, Code10, Code11, Code12, Code13, Code14, Code15 };
-                    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" };
-                    CallProcedure("GetMaterialInfo", 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]);
-                        }
-                    }
-                    oResult = jss.Serialize(oInfo);
-                    oErrMessage = "";
-                    return true;
-                }
-                else
-                {
-                    oErrMessage = "序列号" + iSN + "不存在";
-                    return false;
-                }
-            }
-            else
-            {
-                oErrMessage = "序列号" + iSN + "不存在";
-                return false;
-            }
-        }
-
-
-        [Description("获取打印路径")]
-        public bool GetPrintLabel(string iSN, out string oResult, out string oErrMessage)
-        {
-            oResult = "";
-            oErrMessage = "";
-            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
-            if (ms_id == "")
-            {
-                oErrMessage = "SN" + iSN + "不存在";
-                return false;
-            }
-            string prcode = getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id=" + ms_id).ToString();
-            DataTable dt = (DataTable)ExecuteSql("select la_templatetype,la_url from label where la_prodcode='" + prcode + "' and la_statuscode='AUDITED'", "select");
-            if (dt.Rows.Count > 0)
-            {
-                for (int i = 0; i < dt.Rows.Count; i++)
-                {
-                    oResult = dt.Rows[i]["la_templatetype"].ToString() + "^" + dt.Rows[i]["la_url"].ToString() + "#";
-                }
-                if (oResult.IndexOf("#") > 0)
-                {
-                    oResult = oResult.Substring(0, oResult.Length - 1);
-                }
-            }
-            else
-            {
-                oErrMessage = "产品" + prcode + "未维护标签";
-                return false;
-            }
-            return true;
-        }
-
-        [Description("获取序列号")]
-        public bool GetSNList(string iMaCode, out string[] TSN_List, out string[] SN_List, out string[] TSN_Rule, out string[] SN_Rule, out string oErrMessage)
-        {
-            TSN_List = null;
-            SN_List = null;
-            TSN_Rule = null;
-            SN_Rule = null;
-            if (!CheckExist("Make", "ma_code='" + iMaCode + "'"))
-            {
-                oErrMessage = "工单号" + iMaCode + "不存在";
-                return false;
-            }
-            //导入前的清单
-            DataTable listbefore = (DataTable)ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + iMaCode + "' and msl_type='before' and nvl(msl_status,0)=0  order by msl_sncode", "select");
-            List<string> _TSN = new List<string>();
-            for (int i = 0; i < listbefore.Rows.Count; i++)
-            {
-                _TSN.Add(listbefore.Rows[i]["msl_sncode"].ToString());
-            }
-            TSN_List = _TSN.ToArray();
-
-            //导入后的清单
-            DataTable listafter = (DataTable)ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + iMaCode + "' and msl_type='after' and nvl(msl_status,0)=0 and msl_sncode not in (select ms_firstsn from makeserial where ms_makecode='"+iMaCode+"')  order by msl_sncode", "select");
-            List<string> _SN = new List<string>();
-            for (int i = 0; i < listafter.Rows.Count; i++)
-            {
-                _SN.Add(listafter.Rows[i]["msl_sncode"].ToString());
-            }
-            SN_List = _SN.ToArray();
-
-            //转换前的规则
-            DataTable rulebefore = (DataTable)ExecuteSql("select msd_sncode from MAKESNRULEDETAIL where msd_makecode='" + iMaCode + "' and msd_type='before' and nvl(msd_status,0)=0 and msd_sncode not in (select ms_firstsn from makeserial where ms_makecode='" + iMaCode + "') order by msd_sncode", "select");
-            List<string> _TSN_rule = new List<string>();
-            for (int i = 0; i < rulebefore.Rows.Count; i++)
-            {
-                _TSN_rule.Add(rulebefore.Rows[i]["msd_sncode"].ToString());
-            }
-            TSN_Rule = _TSN_rule.ToArray();
-
-            //转换后的规则
-            DataTable ruleafter = (DataTable)ExecuteSql("select msd_sncode from MAKESNRULEDETAIL where msd_makecode='" + iMaCode + "' and msd_type='after' and nvl(msd_status,0)=0 order by msd_sncode", "select");
-            List<string> _SN_rule = new List<string>();
-            for (int i = 0; i < ruleafter.Rows.Count; i++)
-            {
-                _SN_rule.Add(ruleafter.Rows[i]["msd_sncode"].ToString());
-            }
-            SN_Rule = _SN_rule.ToArray();
-
-            oErrMessage = "";
-            return true;
-        }
-    }
-}

+ 0 - 36
UAS_MesInterface_YD/Properties/AssemblyInfo.cs

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

+ 0 - 59
UAS_MesInterface_YD/UAS_MesInterface_YD.csproj

@@ -1,59 +0,0 @@
-<?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>{37747068-7ED1-4F09-A62F-B3C1E62A9F0F}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>UMESDLLService</RootNamespace>
-    <AssemblyName>UMESDLLService</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">
-      <HintPath>tool\Oracle.ManagedDataAccess.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Data.OracleClient" />
-    <Reference Include="System.Web.Extensions" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="System.Data" />
-    <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>

BIN
UAS_MesInterface_YD/tool/Oracle.ManagedDataAccess.dll