Sfoglia il codice sorgente

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

Hcsy 8 anni fa
parent
commit
2af4689c03
1 ha cambiato i file con 36 aggiunte e 20 eliminazioni
  1. 36 20
      MES接口/LogicHandler.cs

+ 36 - 20
MES接口/LogicHandler.cs

@@ -25,7 +25,7 @@ namespace MES_Interface
         /// <param name="iSourceCode"></param>
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
-        public bool CheckCurrentStep(string iSnCode, string iMakeCode, string iSourceCode, string iUserCode,out string oMacode, out string oMSID, out string oErrMessage)
+        public bool CheckCurrentStep(string iSnCode, string iMakeCode, string iSourceCode, string iUserCode, out string oMacode, out string oMSID, out string oErrMessage)
         {
             oErrMessage = "";
             oMSID = "";
@@ -119,18 +119,6 @@ namespace MES_Interface
             return false;
         }
 
-        public bool CheckStepAttribute(string iCaller, string iSourceCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string[] param = new string[] { iCaller, iSourceCode, oErrorMessage };
-            dh.CallProcedure("CS_CHECKSTEPATTRIBUTE", ref param);
-            oErrorMessage = param[2];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }     
-
         /// <summary>
         /// 分配Mac地址和BT地址
         /// </summary>
@@ -356,11 +344,39 @@ namespace MES_Interface
                 return false;
         }
 
-        private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
+        private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
         {
             oErrorMessage = "";
             string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
             string CurrentStep = GetStepCodeBySource(iSourceCode);
+            switch (iResult)
+            {
+                case "OK":
+                    break;
+                case "NG":
+                    if (iErrCode == "")
+                    {
+                        oErrorMessage = "测试结果为NG时必须传递不良代码";
+                        return false;
+                    }
+                    else
+                    {
+                        string[] BadCode = iErrCode.Split(',');
+                        sql.Clear();
+                        sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
+                        sql.Append(",mb_sourcecode,mb_badcode,mb_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 + "'");
+                        dh.BatchInsert(sql.ToString(), new string[] { "bc_code"}, BadCode);
+                        dh.BatchInsert("",new string[] { "BadCode"},BadCode);
+                    }
+                    break;
+                default:
+                    oErrorMessage = "测试结果必须为NG或者OK";
+                    return false;
+            }
+        
             if (StepCode == CurrentStep)
             {
                 InsertMakeProcess(iSN, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);
@@ -368,7 +384,7 @@ namespace MES_Interface
             }
             else
             {
-                return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, out oErrorMessage);
+                return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);
             }
         }
 
@@ -383,16 +399,16 @@ namespace MES_Interface
         /// <param name="iUserCode"></param>
         /// <param name="oErrorMessage"></param>
         /// <returns></returns>
-        public bool SetTestResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
+        public bool SetTestResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
         {
-            return SetStepFinish(iMakeCode, iSourceCode, iSN, iMPKind, iResult, iUserCode, out oErrorMessage);
+            return SetStepFinish(iMakeCode, iSourceCode, iSN, iMPKind, iResult, iUserCode, iErrCode, out oErrorMessage);
         }
 
-        private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, out string oErrorMessage)
+        private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode,string iResult, out string oErrorMessage)
         {
             oErrorMessage = "";
-            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, oErrorMessage };
-            dh.CallProcedure("CS_SETSTEPFINISH", ref param);
+            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrorMessage };
+            dh.CallProcedure("CS_SETSTEPRESULT", ref param);
             oErrorMessage = param[4];
             if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
                 return true;