Browse Source

接口调整

章政 7 years ago
parent
commit
5e5553a2f1
1 changed files with 29 additions and 8 deletions
  1. 29 8
      UAS_MesInterface/MESHelper.cs

+ 29 - 8
UAS_MesInterface/MESHelper.cs

@@ -5,7 +5,7 @@ using System.Data;
 using System.Runtime.InteropServices;
 using System.Text;
 
-namespace DllService
+namespace BenQGuru.eMES.DLLService
 {
 
     [Guid("99D0E96E-1058-415D-9874-D34537625284")]
@@ -23,6 +23,8 @@ namespace DllService
         bool SetIMEIInfo(string iSnCode, string iIMEI1, 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 iMPKind, 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);
     }
 
     [Guid("41EAB546-6EF4-464A-895A-9C34013A5D8C")]
@@ -381,7 +383,7 @@ namespace DllService
         private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
         {
             oErrorMessage = "";
-            string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
+            string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
             switch (iResult)
             {
@@ -401,20 +403,20 @@ namespace DllService
                         sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_soncode,mb_status) select makebad_seq.nextval");
                         sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + StepCode + "',ms_sourcecode,:bc_code,'',");
                         sql.Append("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 + "'");
+                        sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
                         BatchInsert(sql.ToString(), new string[] { "bc_code" }, BadCode);
                         //将不良的序列号的状态码设为3
-                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode", "update", iSN);
+                        ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode and ms_makecode=:macode", "update", iSN, iMakeCode);
                     }
                     break;
                 default:
                     oErrorMessage = "测试结果必须为NG或者OK";
                     return false;
             }
-
+            //不良采集为良品是更新
             if (StepCode == CurrentStep && iResult == "OK")
             {
-                DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "'");
+                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();
@@ -423,8 +425,8 @@ namespace DllService
                     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 + "'");
-                        UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
+                        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+"'");
                     }
                 }
             }
@@ -903,5 +905,24 @@ namespace DllService
                 cmd.Connection.Open();
             }
         }
+
+        public bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage)
+        {
+            oErrMessage = "";
+            //SetMobileData();
+            return true;
+        }
+
+        public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
+        {
+            oErrMessage = "";
+            string[] param = new string[] { iMO, iResCode, iSN, "", "", "", oErrMessage };
+            CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
+            oErrMessage = param[6];
+            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                return true;
+            else
+                return false;
+        }
     }
 }