瀏覽代碼

接口程序调整

章政 8 年之前
父節點
當前提交
4357f9bfd3
共有 2 個文件被更改,包括 61 次插入30 次删除
  1. 60 19
      UAS_CustomerInterface/MesHelper.cs
  2. 1 11
      UAS_MesInterface(4.0)/MesHelper.cs

+ 60 - 19
UAS_CustomerInterface/MesHelper.cs

@@ -27,6 +27,7 @@ namespace UAS.MES
         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 GetSNAllInfo(string iSN, out string oMakeCode, out string oSaleCode, out string oProdType, out string oSoftVersion1, out string oSoftVersion2, out string oSoftVersion3, out string oMaterialCode1, out string oMaterialCode2, out string oMaterialCode3, out string oMaterialCode4, out string oMaterialCode5, out string oMAC, out string oBT, 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 oItem1, out string oItem2, out string oItem3, out string oItem4, out string oErrMessage);
     }
 
@@ -41,7 +42,7 @@ namespace UAS.MES
         //用于存放批量执行的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;
         //用户选择的数据库的连接字符串
@@ -72,12 +73,39 @@ namespace UAS.MES
             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")
+            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" && stepcode == ms_stepcode))
+            {
+                if (ms_status == "3")
+                {
+                    oErrMessage = "";
+                }
                 return true;
+            }
             else
                 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>
@@ -280,7 +308,11 @@ namespace UAS.MES
                 return false;
             }
             oErrMessage = "";
-            string ms_id = getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSN + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSN + "')").ToString();
+            sql.Clear();
+            sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select ");
+            sql.Append("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;
@@ -437,6 +469,7 @@ namespace UAS.MES
             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":
@@ -452,9 +485,9 @@ namespace UAS.MES
                         string[] BadCode = iErrCode.Split(',');
                         sql.Length = 0;
                         sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
-                        sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_soncode,mb_status) select makebad_seq.nextval");
+                        sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_bgcode,mb_soncode,mb_status) select makebad_seq.nextval");
                         sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + CurrentStep + "','" + iSourceCode + "',:bc_code,'',");
-                        sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
+                        sql.Append("'" + BgCode + "',sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
                         sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
                         List<string> InsertSQL = new List<string>();
                         for (int i = 0; i < BadCode.Length; i++)
@@ -463,9 +496,8 @@ namespace UAS.MES
                         }
                         ExecuteSQLTran(InsertSQL.ToArray());
                         oErrMessage = "测试NG,请重新测试或者判定为不良";
-                        return false;
                         //将不良的序列号的状态码设为3
-                        //ExecuteSql("update makeserial set ms_status='3' where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'", "update");
+                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'", "update");
                     }
                     break;
                 default:
@@ -652,16 +684,9 @@ namespace UAS.MES
                 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];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return SetStepFinish(omakecode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
-            else
-                return false;
+            string oMakeCode = "";
+            GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
+            return SetStepFinish(oMakeCode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
         }
 
         [Description("序列号归属工单")]
@@ -677,8 +702,25 @@ namespace UAS.MES
             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")
+            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" && stepcode == ms_stepcode))
+            {
+                if (ms_status == "3")
+                {
+                    oErrMessage = "";
+                }
                 return true;
+            }
             else
                 return false;
         }
@@ -991,7 +1033,6 @@ namespace UAS.MES
                     if (!String.IsNullOrEmpty(sql))
                     {
                         command.CommandText = sql;
-                        Console.WriteLine(sql);
                         command.ExecuteNonQuery();
                     }
                 }

+ 1 - 11
UAS_MesInterface(4.0)/MesHelper.cs

@@ -39,7 +39,7 @@ namespace BenQGuru.eMES.DLLService
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Data Source=117.25.180.218/orcl;User ID=MES;PassWord=select!#%*(;";
+        private string ConnectionStrings = "Data Source=192.168.230.200/orcl;User ID=MES_TEST;PassWord=select!#%*(;";
         //用户选择的数据库的连接字符串
         private OracleConnection connection;
         //用户选择的数据库的连接字符串
@@ -81,11 +81,6 @@ namespace BenQGuru.eMES.DLLService
                 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")
@@ -696,11 +691,6 @@ namespace BenQGuru.eMES.DLLService
                 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" && ms_stepcode == stepcode))
             {
                 if (ms_status == "3")