public List <Model.VLCData> GetVLCList() { List <VLCData> lstVLCData = null; try { using (OracleConnection con = new OracleConnection(Connection.connectionString)) { if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT VLC_ID, VLC_NAME,F_ROW,F_AISLE,MACHINE_CODE" + " ,STATUS, MACHINE_CHANNEL,VLC_DECK_CODE" + " FROM L2_VLC_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstVLCData = new List <VLCData>(); while (reader.Read()) { Model.VLCData objVLCData = new Model.VLCData(); objVLCData.vlcPkId = Int32.Parse(reader["VLC_ID"].ToString()); objVLCData.vlcName = reader["VLC_NAME"].ToString(); objVLCData.row = Int32.Parse(reader["F_ROW"].ToString()); objVLCData.aisle = Int32.Parse(reader["F_AISLE"].ToString()); objVLCData.machineCode = reader["MACHINE_CODE"].ToString(); objVLCData.status = Int32.Parse(reader["STATUS"].ToString()); objVLCData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objVLCData.vlcDeckCode = reader["VLC_DECK_CODE"].ToString(); lstVLCData.Add(objVLCData); } } } } } } catch (Exception errMsg) { } return(lstVLCData); }
public List <Model.VLCData> GetVLCList() { List <VLCData> lstVLCData = null; try { using (OracleConnection con = new DBConnection().getDBConnection()) { using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT VLC_ID, VLC_NAME,F_ROW,F_AISLE,HOME_FLOOR,MACHINE_CODE,IS_BLOCKED" + " ,STATUS,IS_AUTOMODE,MACHINE_CHANNEL,VLC_DECK_CODE" + " FROM L2_VLC_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstVLCData = new List <VLCData>(); while (reader.Read()) { Model.VLCData objVLCData = new Model.VLCData(); objVLCData.vlcPkId = Int32.Parse(reader["VLC_ID"].ToString()); objVLCData.vlcName = reader["VLC_NAME"].ToString(); objVLCData.row = Int32.Parse(reader["F_ROW"].ToString()); objVLCData.aisle = Int32.Parse(reader["F_AISLE"].ToString()); objVLCData.floor = Int32.Parse(reader["HOME_FLOOR"].ToString()); objVLCData.machineCode = reader["MACHINE_CODE"].ToString(); objVLCData.isBlocked = Int32.Parse(reader["IS_BLOCKED"].ToString()); objVLCData.status = Int32.Parse(reader["STATUS"].ToString()); objVLCData.isAutoMode = Int32.Parse(reader["IS_AUTOMODE"].ToString()) == 1?true:false; objVLCData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objVLCData.vlcDeckCode = reader["VLC_DECK_CODE"].ToString(); lstVLCData.Add(objVLCData); } } } } } } catch (Exception errMsg) { } return(lstVLCData); }
public Model.VLCData GetVLCDetails(Model.VLCData objVLCData) { try { using (OracleConnection con = new DBConnection().getDBConnection()) { using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT VLC_ID, VLC_NAME,F_ROW,F_AISLE,HOME_FLOOR,MACHINE_CODE,IS_BLOCKED" + " ,STATUS,IS_AUTOMODE,MACHINE_CHANNEL,VLC_DECK_CODE" + " FROM L2_VLC_MASTER"; if (!string.IsNullOrEmpty(objVLCData.machineCode)) { sql += " where MACHINE_CODE='" + objVLCData.machineCode + "'"; } command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { objVLCData.vlcPkId = Int32.Parse(reader["VLC_ID"].ToString()); objVLCData.vlcName = reader["VLC_NAME"].ToString(); objVLCData.row = Int32.Parse(reader["F_ROW"].ToString()); objVLCData.aisle = Int32.Parse(reader["F_AISLE"].ToString()); objVLCData.floor = Int32.Parse(reader["HOME_FLOOR"].ToString()); objVLCData.machineCode = reader["MACHINE_CODE"].ToString(); objVLCData.isBlocked = Int32.Parse(reader["IS_BLOCKED"].ToString()); objVLCData.status = Int32.Parse(reader["STATUS"].ToString()); objVLCData.isAutoMode = Int32.Parse(reader["IS_AUTOMODE"].ToString()) == 1 ? true : false; objVLCData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objVLCData.vlcDeckCode = reader["VLC_DECK_CODE"].ToString(); } } } } } } catch (Exception errMsg) { } return(objVLCData); }
public bool CheckVLCHealthy(Model.VLCData objVLCData) { bool isHealthy = false; objVLCDaoService = new VLCDaoImp(); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objVLCData.machineChannel + "." + objVLCData.machineCode + "." + OpcTags.VLC_Auto_Ready)) { isHealthy = opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_Auto_Ready); isHealthy = isHealthy && !objVLCDaoService.IsVLCDisabled(objVLCData.machineCode); isHealthy = isHealthy && !objVLCDaoService.IsVLCSwitchOff(objVLCData.machineCode); isHealthy = isHealthy && opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_CP_Done); } } return(isHealthy); }
public int CheckError(Model.VLCData objVLCData) { throw new NotImplementedException(); }
public bool CheckVLCCommandDone(Model.VLCData objVLCData) { Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Entering 'CheckVLCCommandDone' "); bool result = false; bool isWaitingForCmdDoneOn = false; int counter = 1; OpcOperationsService opcd = null; if (objQueueControllerService == null) { objQueueControllerService = new QueueControllerImp(); } if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } bool triggerAlreadyEnabled = false; TriggerData objTriggerData = null; try { opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()); Thread.Sleep(3000); result = false; //TimeSpan startTime = System.DateTime.Now.TimeOfDay; do { triggerAlreadyEnabled = objErrorControllerService.GetTriggerActiveStatus(objVLCData.machineCode); if (!triggerAlreadyEnabled) { objTriggerData = NeedToShowTrigger(objVLCData); } if (triggerAlreadyEnabled || objTriggerData.TriggerEnabled) { if (!triggerAlreadyEnabled) { objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); } while (objErrorControllerService.GetTriggerActiveStatus(objVLCData.machineCode)) { /**checking transaction deleted or not****/ objQueueControllerService.CancelIfRequested(objVLCData.queueId); /******/ Thread.Sleep(1000); } if (objQueueControllerService.NeedToOptimizePath(objVLCData.queueId)) { break; } if (objErrorControllerService.GetTriggerAction(objVLCData.machineCode) == 1) { VLCMove(objVLCData); Thread.Sleep(2000); } } result = opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_CP_Done); if (counter > 3) { counter = 1; /**checking transaction deleted or not****/ objQueueControllerService.CancelIfRequested(objVLCData.queueId); /******/ Thread.Sleep(700); } counter += 1; } while (!result); } catch (OperationCanceledException errMsg) { Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": CM=" + objVLCData.machineCode + " --TaskCanceledException 'CheckVLCCommandDone':: " + errMsg.Message); throw new OperationCanceledException(); } catch (Exception errMsg) { Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exception 'CheckVLCCommandDone':: " + errMsg.Message); if (errMsg is TaskCanceledException) { throw new Exception(); } } finally { if (opcd != null) { opcd.Dispose(); } } Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exitting 'CheckVLCCommandDone' "); return(result); }
public bool VLCMove(Model.VLCData objVLCData) { Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Entering 'VLCMove' "); bool isCMHealthy = false; bool success = false; if (objQueueControllerService == null) { objQueueControllerService = new QueueControllerImp(); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } do { /**checking transaction deleted or not****/ objQueueControllerService.CancelIfRequested(objVLCData.queueId); /******/ try { TriggerData objTriggerData = NeedToShowTrigger(objVLCData); if (objTriggerData.TriggerEnabled) { objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); break; } isCMHealthy = CheckVLCHealthy(objVLCData); if (!isCMHealthy) { Thread.Sleep(200); continue; } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { objVLCData.floor = opcd.ReadTag <Int32>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_At_Floor); if (objVLCData.floor != objVLCData.destFloor) { opcd.WriteTag <int>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_DestFloor, objVLCData.destFloor); success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true); } else { success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true); success = true; } } } catch (OperationCanceledException errMsg) { Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": CM=" + objVLCData.machineCode + " --TaskCanceledException 'VLCMove':: " + errMsg.Message); throw new OperationCanceledException(); } catch (Exception ex) { Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exception 'VLCMove':: " + ex.Message); /**checking transaction deleted or not****/ objQueueControllerService.CancelIfRequested(objVLCData.queueId); /******/ if (ex is TaskCanceledException) { throw new Exception(); } success = false; } } while (!success); Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exitting 'VLCMove' "); return(success); }