Example #1
0
        public virtual bool S1F13SendEstablishCommunicationRequest()
        {
            try
            {
                S1F13 s1f13 = new S1F13();
                s1f13.SECSAgentName = scApp.EAPSecsAgentName;
                s1f13.MDLN          = scApp.getEQObjCacheManager().getLine().LINE_ID.Trim();
                s1f13.SOFTREV       = SCApplication.getMessageString("SYSTEM_VERSION");

                S1F14  s1f14     = null;
                string rtnMsg    = string.Empty;
                SXFY   abortSecs = null;
                SCUtility.secsActionRecordMsg(scApp, false, s1f13);

                TrxSECS.ReturnCode rtnCode = ISECSControl.sendRecv <S1F14>(bcfApp, s1f13, out s1f14, out abortSecs, out rtnMsg, null);
                SCUtility.actionRecordMsg(scApp, s1f13.StreamFunction, line.Real_ID, "Establish Communication.", rtnCode.ToString());

                if (rtnCode == TrxSECS.ReturnCode.Normal)
                {
                    SCUtility.secsActionRecordMsg(scApp, true, s1f14);
                    line.EstablishComm = true;
                    return(true);
                }
                else
                {
                    line.EstablishComm = false;
                    logger.Warn("Send Establish Communication[S1F13] Error!");
                }
            }
            catch (Exception ex)
            {
                logger.Error("MESDefaultMapAction has Error[Line Name:{0}],[Error method:{1}],[Error Message:{2}", line.LINE_ID, " sendS1F13_Establish_Comm", ex.ToString());
            }
            return(false);
        }
Example #2
0
        protected virtual void S1F13ReceiveEstablishCommunicationRequest(object sender, SECSEventArgs e)
        {
            try
            {
                S1F13 s1f13 = ((S1F13)e.secsHandler.Parse <S1F13>(e));
                SCUtility.secsActionRecordMsg(scApp, true, s1f13);
                SCUtility.actionRecordMsg(scApp, s1f13.StreamFunction, line.Real_ID,
                                          "Receive Establish Communication From MES.", "");

                scApp.TransferService.TransferServiceLogger.Info(
                    DateTime.Now.ToString("HH:mm:ss.fff ") + "MCS >> OHB|s1f13:\n" + s1f13.toSECSString());

                //if (!isProcessEAP(s1f13)) { return; }
                S1F14 s1f14 = new S1F14();
                s1f14.SECSAgentName = scApp.EAPSecsAgentName;
                s1f14.SystemByte    = s1f13.SystemByte;
                s1f14.COMMACK       = "0";
                s1f14.VERSION_INFO  = new string[2]
                {
                    "OHTC",
                    SCAppConstants.getMainFormVersion("")
                };

                SCUtility.secsActionRecordMsg(scApp, false, s1f14);
                TrxSECS.ReturnCode rtnCode = ISECSControl.replySECS(bcfApp, s1f14);
                SCUtility.actionRecordMsg(scApp, s1f13.StreamFunction, line.Real_ID,
                                          "Reply Establish Communication To MES.", rtnCode.ToString());

                scApp.TransferService.TransferServiceLogger.Info(DateTime.Now.ToString("HH:mm:ss.fff ")
                                                                 + "MCS >> OHB|s1f14 COMMACK:" + s1f14.COMMACK + "   SCES_ReturnCode:" + rtnCode);

                if (rtnCode != TrxSECS.ReturnCode.Normal)
                {
                    logger.Warn("Reply EAP S1F14 Error:{0}", rtnCode);
                }
                logger.Debug("s1f13Receive ok!");
                line.EstablishComm = true;
            }
            catch (Exception ex)
            {
                scApp.TransferService.TransferServiceLogger.Error(
                    DateTime.Now.ToString("HH:mm:ss.fff ") + "  S1F13ReceiveEstablishCommunicationRequest \n" + ex);

                logger.Error("MESDefaultMapAction has Error[Line Name:{0}],[Error method:{1}],[Error Message:{2}",
                             line.LINE_ID, "s1f13_Receive_EstablishCommunication", ex.ToString());
            }
        }