public virtual ALARM setAlarmReport(string nodeID, string eq_id, string error_code, string errorDesc) { lock (lock_obj_alarm) { if (IsAlarmExist(eq_id, error_code)) { return(null); } //AlarmMap alarmMap = alarmMapDao.getAlarmMap(eq_id, error_code); AlarmMap alarmMap = alarmMapDao.getAlarmMap(nodeID, error_code); string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); ALARM alarm = new ALARM() { EQPT_ID = eq_id, RPT_DATE_TIME = DateTime.Now, ALAM_CODE = error_code, ALAM_LVL = alarmMap == null ? E_ALARM_LVL.None : alarmMap.ALARM_LVL, ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrSet, ALAM_DESC = alarmMap == null ? errorDesc : alarmMap.ALARM_DESC, }; if (SCUtility.isEmpty(alarm.ALAM_DESC)) { alarm.ALAM_DESC = $"Unknow error:{error_code}"; } using (DBConnection_EF con = DBConnection_EF.GetUContext()) { alarmDao.insertAlarm(con, alarm); CheckSetAlarm(); } return(alarm); } }
public ALARM setAlarmReport(string node_id, string eq_id, string error_code) { lock (lock_obj_alarm) { if (IsAlarmExist(eq_id, error_code)) { return(null); } string alarmUnitType = "OHCV"; if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.AGV)) { alarmUnitType = "AGV STATION"; } if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.CRANE)) { alarmUnitType = "CRANE"; } AlarmMap alarmMap = alarmMapDao.getAlarmMap(alarmUnitType, error_code); if (alarmMap == null) { scApp.TransferService.TransferServiceLogger.Info ( DateTime.Now.ToString("HH:mm:ss.fff ") + "OHT >> OHB|AlarmMap 不存在:" + " EQ_Name:" + eq_id + " Error_code:" + error_code ); } string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); ALARM alarm = new ALARM() { EQPT_ID = eq_id, RPT_DATE_TIME = strNow, ALAM_CODE = error_code, ALAM_LVL = alarmMap == null ? E_ALARM_LVL.Warn : alarmMap.ALARM_LVL, ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrSet, ALAM_DESC = alarmMap == null ? $"unknow alarm code:{error_code}" : $"{alarmMap.ALARM_DESC}(error code:{error_code})", ERROR_ID = error_code, //alarmMap?.ALARM_ID ?? "0", UnitID = eq_id, UnitState = "1", }; using (DBConnection_EF con = DBConnection_EF.GetUContext()) { alarmDao.insertAlarm(con, alarm); CheckSetAlarm(); } return(alarm); } }
/// <summary> /// Initials the bc system. /// </summary> /// <returns>SCAppConstants.BCSystemInitialRtnCode.</returns> public SCAppConstants.BCSystemInitialRtnCode initialBCSystem() { string bc_id = scApp.getBCFApplication().BC_ID; SCAppConstants.BCSystemInitialRtnCode rtnCode = SCAppConstants.BCSystemInitialRtnCode.Normal; try { using (DBConnection_EF conn = new DBConnection_EF()) { BCSTAT bc = bcStatusDao.getBCStatByID(conn, bc_id); if (bc == null) { bc = new BCSTAT() { BC_ID = bc_id, CLOSE_MODE = SCAppConstants.BCSystemStatus.Default, RUN_TIMESTAMP = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_16) }; bcStatusDao.insertBCStat(conn, bc); } else { if (BCFUtility.isMatche(bc.CLOSE_MODE, SCAppConstants.BCSystemStatus.NormalClosed)) { logger.Info("Normal shutdown BC System!"); rtnCode = SCAppConstants.BCSystemInitialRtnCode.Normal; } else { logger.Info("Non-normal shutdown BC System!"); rtnCode = SCAppConstants.BCSystemInitialRtnCode.NonNormalShutdown; } bc.CLOSE_MODE = SCAppConstants.BCSystemStatus.Default; bcStatusDao.updateBCStat(conn, bc); } } } catch (Exception ex) { logger.Warn("Insert Failed to BCSTAT [BC_ID:{0}]", bc_id, ex); rtnCode = SCAppConstants.BCSystemInitialRtnCode.Error; } finally { } return(rtnCode); }
//public ALARM setAlarmReport(string nodeID, string eq_id, string error_code, string errorDesc, string cmd_id_1, string cmd_id_2) public ALARM setAlarmReport(string nodeID, string eq_id, string error_code, string errorDesc, List <string> effectTranIDs) { lock (lock_obj_alarm) { if (IsAlarmExist(eq_id, error_code)) { return(null); } //AlarmMap alarmMap = alarmMapDao.getAlarmMap(eq_id, error_code); AlarmMap alarmMap = null; if (!SCUtility.isEmpty(nodeID)) { alarmMap = alarmMapDao.getAlarmMap(nodeID, error_code); } else { alarmMap = alarmMapDao.getAlarmMap(eq_id, error_code); } var effect_tran_ids = tryGetTransferCommandIDs(effectTranIDs); string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); ALARM alarm = new ALARM() { EQPT_ID = eq_id, RPT_DATE_TIME = DateTime.Now, ALAM_CODE = error_code, ALAM_LVL = alarmMap == null ? E_ALARM_LVL.None : alarmMap.ALARM_LVL, ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrSet, ALAM_DESC = alarmMap == null ? errorDesc : alarmMap.ALARM_DESC, CMD_ID_1 = effect_tran_ids.TranCmdId1, CMD_ID_2 = effect_tran_ids.TranCmdId2, CMD_ID_3 = effect_tran_ids.TranCmdId3, CMD_ID_4 = effect_tran_ids.TranCmdId4 }; if (SCUtility.isEmpty(alarm.ALAM_DESC)) { alarm.ALAM_DESC = $"Unknow error:{error_code}"; } using (DBConnection_EF con = DBConnection_EF.GetUContext()) { alarmDao.insertAlarm(con, alarm); CheckSetAlarm(); } return(alarm); } }
public void addOperationHis(string user_id, string formName, string action, [CallerMemberName] string Method = "") { try { string timeStamp = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); HOPERATION his = new HOPERATION() { T_STAMP = timeStamp, USER_ID = user_id, FORM_NAME = $"{formName}-({Method})", ACTION = action }; PrintOperationLog(his); } catch (Exception ex) { logger.Error(ex, "Execption:"); } }
public ALARM resetAlarmReport(string eq_id, string error_code) { lock (lock_obj_alarm) { using (DBConnection_EF con = DBConnection_EF.GetUContext()) { ALARM alarm = alarmDao.getSetAlarm(con, eq_id, error_code); if (alarm != null) { string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); alarm.ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrReset; alarm.END_TIME = strNow; alarmDao.updateAlarm(con, alarm); CheckSetAlarm(); } return(alarm); } } }
/// <summary> /// Res the write bc system run time. /// </summary> public void reWriteBCSystemRunTime() { string bc_id = scApp.getBCFApplication().BC_ID; try { using (DBConnection_EF conn = new DBConnection_EF()) { BCSTAT bc = bcStatusDao.getBCStatByID(conn, bc_id); bc.RUN_TIMESTAMP = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_16); bcStatusDao.updateBCStat(conn, bc); } } catch (Exception ex) { logger.Warn("Update Failed to BCSTAT [BC_ID:{0}]", bc_id, ex); } finally { } }
/// <summary> /// Adds the operation his. /// </summary> /// <param name="user_id">The user_id.</param> /// <param name="formName">Name of the form.</param> /// <param name="action">The action.</param> public void addOperationHis(string user_id, string formName, string action) { DBConnection_EF conn = null; try { conn = DBConnection_EF.GetContext(); conn.BeginTransaction(); string timeStamp = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); HOPERATION his = new HOPERATION() { SEQ_NO = GetGuid(), T_STAMP = timeStamp, USER_ID = user_id, FORM_NAME = formName, ACTION = action }; SCUtility.PrintOperationLog(his); operationHisDao.insertOperationHis(conn, his); conn.Commit(); } catch (Exception ex) { if (conn != null) { try { conn.Rollback(); } catch (Exception ex_rollback) { logger.Error(ex_rollback, "Exception"); } } logger.Error(ex); } finally { if (conn != null) { try { conn.Close(); } catch (Exception ex_close) { logger.Error(ex_close, "Exception:"); } } } }
public HASHEET(ASHEET sht) : this(sht, BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19)) { }
public MPCTipMessage() { Time = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.DateTimeFormat_22); }
public ALARM setAlarmReport(string node_id, string eq_id, string error_code, ACMD_MCS mcsCmdData) { lock (lock_obj_alarm) { string alarmEq = eq_id; //if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.AGVZONE)) //{ // alarmEq = eq_id.Remove(0, 12); //} if (IsAlarmExist(alarmEq, error_code)) { return(null); } string alarmUnitType = "LINE"; if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.AGV)) { alarmUnitType = "AGV"; } else if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.CRANE)) { alarmUnitType = "CRANE"; } else if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.NTB)) { alarmUnitType = "NTB"; } else if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.OHCV) || scApp.TransferService.isUnitType(eq_id, Service.UnitType.STK) ) { int stage = scApp.TransferService.portINIData[eq_id].Stage; if (stage == 7) { alarmUnitType = "OHCV_7"; } else { alarmUnitType = "OHCV_5"; } } else if (scApp.TransferService.isUnitType(eq_id, Service.UnitType.AGVZONE)) { //B7_OHBLINE1_ST01 alarmUnitType = "LINE"; //eq_id = eq_id.Remove(0, 12); } AlarmMap alarmMap = alarmMapDao.getAlarmMap(alarmUnitType, error_code); if (alarmMap == null) { scApp.TransferService.TransferServiceLogger.Info ( DateTime.Now.ToString("HH:mm:ss.fff ") + "OHT >> OHB|AlarmMap 不存在:" + " EQ_Name:" + eq_id + " Error_code:" + error_code ); } string strNow = BCFUtility.formatDateTime(DateTime.Now, SCAppConstants.TimestampFormat_19); ALARM alarm = new ALARM() { EQPT_ID = eq_id, RPT_DATE_TIME = strNow, ALAM_CODE = error_code, ALAM_LVL = alarmMap == null ? E_ALARM_LVL.Warn : alarmMap.ALARM_LVL, ALAM_STAT = ProtocolFormat.OHTMessage.ErrorStatus.ErrSet, ALAM_DESC = alarmMap == null ? $"unknow alarm code:{error_code}" : $"{eq_id} {alarmMap.ALARM_DESC}(error code:{error_code})", ERROR_ID = error_code, //alarmMap?.ALARM_ID ?? "0", UnitID = eq_id, UnitState = "3", RecoveryOption = "", CMD_ID = "", }; if (mcsCmdData != null) { alarm.CMD_ID = mcsCmdData.CMD_ID.Trim(); } if (scApp.TransferService.isUnitType(eq_id, UnitType.CRANE)) { if (error_code == SCAppConstants.SystemAlarmCode.OHT_Issue.DoubleStorage) { alarm.UnitState = "1"; alarm.RecoveryOption = "ABORT"; } if (error_code == SCAppConstants.SystemAlarmCode.OHT_Issue.EmptyRetrieval) { alarm.UnitState = "2"; alarm.RecoveryOption = "ABORT"; } } using (DBConnection_EF con = DBConnection_EF.GetUContext()) { if (alarmDao.insertAlarm(con, alarm) == false) { alarm = null; } CheckSetAlarm(); } //if (scApp.TransferService.isUnitType(eq_id, UnitType.CRANE) == false) //{ // alarm.EQPT_ID = ""; // alarm.UnitID = ""; //} return(alarm); } }