Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 8 years ago
parent
commit
c472855e0d
2 changed files with 29 additions and 58 deletions
  1. 14 34
      UAS_MesInterface(4.0)/MesHelper.cs
  2. 15 24
      UAS_MesInterface/MESHelper.cs

+ 14 - 34
UAS_MesInterface(4.0)/MesHelper.cs

@@ -13,7 +13,7 @@ namespace BenQGuru.eMES.DLLService
     [InterfaceType(ComInterfaceType.InterfaceIsDual)]
     public interface IMESHelper
     {
-        [DispId(13)]
+        [DispId(12)]
         bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
         bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage);
         bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord, out string oErrMessage);
@@ -26,7 +26,6 @@ namespace BenQGuru.eMES.DLLService
         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);
     }
 
     [Guid("41EAB546-6EF4-464A-895A-9C34013A5D8C")]
@@ -40,7 +39,7 @@ namespace BenQGuru.eMES.DLLService
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Data Source=192.168.230.200/orcl;User ID=MES_TEST;PassWord=select!#%*(;";
+        private string ConnectionStrings = "Data Source=117.25.180.218/orcl;User ID=MES_TEST;PassWord=select!#%*(;";
         //用户选择的数据库的连接字符串
         private OracleConnection connection;
         //用户选择的数据库的连接字符串
@@ -71,19 +70,16 @@ namespace BenQGuru.eMES.DLLService
             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];
-            string MSID = param[5];
-            if (MSID == "" || MSID == null || MSID == "null")
-            {
-                MSID = "0";
-            }
-            string StepCode = getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + iResCode + "'").ToString();
-            string MS_StepCode = getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + MSID + "'").ToString();
-            if (StepCode != MS_StepCode && MS_StepCode != "")
+            oErrMessage = param[6];
+            string ms_status = getFieldDataByCondition("makeserial", "ms_status", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')").ToString();
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || ms_status == "3")
             {
-                oErrMessage = "当前岗位资源所属工序不正确,下一工序" + MS_StepCode;
-            }
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                if (ms_status == "3")
+                {
+                    oErrMessage = "";
+                }
                 return true;
+            }
             else
                 return false;
         }
@@ -272,16 +268,6 @@ namespace BenQGuru.eMES.DLLService
                 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;
-        }
-
         /// <summary>
         /// 获取工单的最近一条执行记录
         /// </summary>
@@ -656,14 +642,10 @@ namespace BenQGuru.eMES.DLLService
                 return false;
             }
             oErrMessage = "";
-            string omakecode = "";
-            string[] param = new string[] { "", iResCode, iSN, iOperator, omakecode, "", 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];
-            omakecode = param[4];
+            string oMakeCode = "";
+            GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return SetStepFinish(omakecode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
+                return SetStepFinish(oMakeCode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
             else
                 return false;
         }
@@ -970,7 +952,6 @@ namespace BenQGuru.eMES.DLLService
                 case "INSERT":
                     try
                     {
-                        Console.WriteLine(sql);
                         result = command.ExecuteNonQuery();
                     }
                     catch (Exception)
@@ -1001,10 +982,9 @@ namespace BenQGuru.eMES.DLLService
             {
                 foreach (string sql in SQL)
                 {
-                    if (!String.IsNullOrEmpty(sql))
+                    if (!string.IsNullOrEmpty(sql))
                     {
                         command.CommandText = sql;
-                        Console.WriteLine(sql);
                         command.ExecuteNonQuery();
                     }
                 }

+ 15 - 24
UAS_MesInterface/MESHelper.cs

@@ -58,7 +58,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -69,8 +68,15 @@ namespace BenQGuru.eMES.DLLService
             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];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+            string ms_status = getFieldDataByCondition("makeserial", "ms_status", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')").ToString();
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || ms_status == "3")
+            {
+                if (ms_status == "3")
+                {
+                    oErrMessage = "";
+                }
                 return true;
+            }
             else
                 return false;
         }
@@ -174,7 +180,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             oWIFI = "";
             oBT = "";
             oCode1 = "";
@@ -223,7 +228,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         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)
         {
-            iSN = iSN.ToUpper();
             oIMEI1 = "";
             oIMEI2 = "";
             oMEID = "";
@@ -267,7 +271,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             //取MakeProcess表中的执行记录ID最大的一个工单的号码
             oMoCode = "";
             if (iSN == "")
@@ -315,7 +318,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         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)
         {
-            iSN = iSN.ToUpper();
             oBT = "";
             oMEID = "";
             oWIFI = "";
@@ -382,7 +384,6 @@ namespace BenQGuru.eMES.DLLService
         /// <param name="iUserCode"></param>
         private void InsertMakeProcess(string iSnCode, string iMakeCode, string iSourceCode, string iMPKind, string result, string iUserCode)
         {
-            iSnCode = iSnCode.ToUpper();
             string CurrentStep = "";
             string LineCode = "";
             string CurrentStepName = "";
@@ -410,7 +411,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -429,7 +429,7 @@ namespace BenQGuru.eMES.DLLService
 
         public bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
+            
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -505,7 +505,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iOperater, string iResult, string iErrCode, string flag, out string oErrorMessage)
         {
-            iSN = iSN.ToUpper();
             oErrorMessage = "";
             if (iTSN == "") { oErrorMessage = "TSN不能为空"; return false; }
             if (iSN == "") { oErrorMessage = "SN不能为空"; return false; }
@@ -521,7 +520,7 @@ namespace BenQGuru.eMES.DLLService
 
         private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, string iResult, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
+            
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -557,7 +556,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool SetTestDetail(string iSN, string iTestResult, string iResCode,ref string[] iTestDetail, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             if (iSN == "" || iSN == null)
             {
                 oErrMessage = "SN不能为空";
@@ -598,7 +596,6 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool SetIMEIInfo(string iSN, string iIMEI1, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -627,28 +624,23 @@ namespace BenQGuru.eMES.DLLService
         /// <returns></returns>
         public bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
                 return false;
             }
             oErrMessage = "";
-            string omakecode = "";
-            string[] param = new string[] { "", iResCode, iSN, iOperator, omakecode, "", 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];
-            omakecode = param[4];
+            string oMakeCode = "";
+            GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return SetStepFinish(omakecode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
+                return SetStepFinish(oMakeCode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
             else
                 return false;
         }
 
         public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
         {
-            iSN = iSN.ToUpper();
+            
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -970,10 +962,9 @@ namespace BenQGuru.eMES.DLLService
             {
                 foreach (string sql in SQL)
                 {
-                    if (!String.IsNullOrEmpty(sql))
+                    if (!string.IsNullOrEmpty(sql))
                     {
                         command.CommandText = sql;
-                        Console.WriteLine(sql);
                         command.ExecuteNonQuery();
                     }
                 }