public virtual bool S1F1SendAreYouThere() { try { S1F1 s1f1 = new S1F1() { SECSAgentName = scApp.EAPSecsAgentName }; S1F2 s1f2 = null; string rtnMsg = string.Empty; SXFY abortSecs = null; //SCUtility.secsActionRecordMsg(scApp, false, s1f1); TrxSECS.ReturnCode rtnCode = ISECSControl.sendRecv <S1F2>(bcfApp, s1f1, out s1f2, out abortSecs, out rtnMsg, null); SCUtility.actionRecordMsg(scApp, s1f1.StreamFunction, line.Real_ID, "Send Are You There To MES.", rtnCode.ToString()); if (rtnCode == TrxSECS.ReturnCode.Normal) { //SCUtility.secsActionRecordMsg(scApp, false, s1f2); return(true); } else if (rtnCode == TrxSECS.ReturnCode.Abort) { SCUtility.secsActionRecordMsg(scApp, false, abortSecs); } } catch (Exception ex) { logger.Error(ex, "Exection:"); } return(false); }
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); }
public virtual bool S2F17SendDateAndTimeRequest() { try { S2F17 s2f17 = new S2F17(); s2f17.SECSAgentName = scApp.EAPSecsAgentName; S2F18 s2f18 = null; string rtnMsg = string.Empty; SXFY abortSecs = null; SCUtility.secsActionRecordMsg(scApp, false, s2f17); TrxSECS.ReturnCode rtnCode = ISECSControl.sendRecv <S2F18>(bcfApp, s2f17, out s2f18, out abortSecs, out rtnMsg, null); SCUtility.actionRecordMsg(scApp, s2f17.StreamFunction, line.Real_ID, "Date Time Request.", rtnCode.ToString()); if (rtnCode == TrxSECS.ReturnCode.Normal) { SCUtility.secsActionRecordMsg(scApp, true, s2f18); string timeStr = s2f18.TIME; DateTime mesDateTime = DateTime.Now; try { mesDateTime = DateTime.ParseExact(timeStr.Trim(), SCAppConstants.TimestampFormat_16, CultureInfo.CurrentCulture); } catch (Exception dtEx) { logger.Error(dtEx, String.Format("Receive Date Time Set Request From MES. Format Error![Date Time:{0}]", timeStr)); } if (!DebugParameter.DisableSyncTime) { SCUtility.updateSystemTime(mesDateTime); } //todo 跟其他設備同步 return(true); } else { logger.Warn("Send Date Time Request[S2F17] Error!"); } } catch (Exception ex) { logger.Error("MESDefaultMapAction has Error[Line Name:{0}],[Error method:{1}],[Error Message:{2}", line.LINE_ID, "sendS2F17_DateTimeReq", ex.ToString()); } return(false); }
public virtual bool S5F1SendAlarmReport(string alcd, string alid, string altx) { try { S5F1 s5f1 = new S5F1() { SECSAgentName = scApp.EAPSecsAgentName, ALCD = alcd, ALID = alid, ALTX = altx }; S5F2 s5f2 = null; SXFY abortSecs = null; String rtnMsg = string.Empty; if (isSend()) { TrxSECS.ReturnCode rtnCode = ISECSControl.sendRecv <S5F2>(bcfApp, s5f1, out s5f2, out abortSecs, out rtnMsg, null); LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(GEMDriver), Device: DEVICE_NAME_MCS, Data: s5f1); LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(GEMDriver), Device: DEVICE_NAME_MCS, Data: s5f2); SCUtility.actionRecordMsg(scApp, s5f1.StreamFunction, line.Real_ID, "Send Alarm Report.", rtnCode.ToString()); if (rtnCode != TrxSECS.ReturnCode.Normal) { logger.Warn("Send Alarm Report[S5F1] Error![rtnCode={0}]", rtnCode); return(false); } } return(true); } catch (Exception ex) { logger.Error(ex, "Exception:"); return(false); } }