public int FindPalletStoringSlotAndPath(Model.PVLData objPVLData) { int pathID = 0; try { using (OracleConnection con = new DBConnection().getDBConnection()) { using (OracleCommand command = con.CreateCommand()) { command.Connection = con; command.CommandType = CommandType.StoredProcedure; command.CommandText = "PVL_MANIPULATION.PALLET_STORE_PROC"; command.Parameters.Add("pvl_code", OracleDbType.Varchar2, 20, objPVLData.machineCode, ParameterDirection.Input); command.Parameters.Add("path_id", OracleDbType.Int32, pathID, ParameterDirection.Output); command.ExecuteNonQuery(); int.TryParse(command.Parameters["path_id"].Value.ToString(), out pathID); } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(pathID); }
public bool PVLPut(Model.PVLData objPVLData) { bool isPVLHealthy = false; bool success = false; //do //{ try { isPVLHealthy = CheckPVLHealthy(objPVLData); if (!isPVLHealthy) { return(false); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { success = opcd.WriteTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, objPVLData.command, true); Thread.Sleep(500); success = opcd.WriteTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, objPVLData.command, false); } } catch (Exception ex) { Console.WriteLine(ex); success = false; } // } while (!success); return(success); }
public void UpdateAfterPVLTask(Model.PVLData objPVLData) { try { using (OracleConnection con = new DBConnection().getDBConnection()) { using (OracleCommand command = con.CreateCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } command.CommandType = CommandType.StoredProcedure; command.CommandText = "PVL_MANIPULATION.task_after_pvl_processing"; command.Parameters.Add("pathid", OracleDbType.Int32, objPVLData.queueId, ParameterDirection.Input); command.ExecuteNonQuery(); } } } catch (Exception errMsg) { throw new Exception(errMsg.Message); } }
public bool IsPalletOnPVL(Model.PVLData objPVLData, out bool isHealthy) { Logger.WriteLogger(GlobalValues.PMS_LOG, "Entered IsPalletOnPVL : PVL=" + objPVLData.machineCode); bool isPalletPresent = true; isHealthy = false; int checkCount = 0; string pvlDeck = GetDeckCodeOfPVL(objPVLData.machineCode); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { do { //string pvlDeck = objPVLData.machineCode.Replace("Drive", "Deck"); isHealthy = opcd.IsMachineHealthy(objPVLData.machineChannel + "." + objPVLData.machineCode + "." + OpcTags.PVL_Auto_Ready); if (isHealthy) { isPalletPresent = opcd.ReadTag <bool>(objPVLData.machineChannel, pvlDeck, OpcTags.PVL_West_Pallet_Present); isPalletPresent = isPalletPresent || opcd.ReadTag <bool>(objPVLData.machineChannel, pvlDeck, OpcTags.PVL_East_Pallet_Present); } checkCount++; Thread.Sleep(100); } while (!isPalletPresent && checkCount < 5); } Logger.WriteLogger(GlobalValues.PMS_LOG, "Exitting IsPalletOnPVL : PVL=" + objPVLData.machineCode + ", isPalletPresent= " + isPalletPresent + ", isHealthy= " + isHealthy); return(isPalletPresent); }
public void UpdateAfterPVLTask(Model.PVLData objPVLData) { if (objPVLDaoService == null) { objPVLDaoService = new PVLDaoImp(); } objPVLDaoService.UpdateAfterPVLTask(objPVLData); }
public int FindPalletStoringSlotAndPath(Model.PVLData objPVLData) { if (objPVLDaoService == null) { objPVLDaoService = new PVLDaoImp(); } return(objPVLDaoService.FindPalletStoringSlotAndPath(objPVLData)); }
public Model.PVLData GetPVLDetails(Model.PVLData objPVLData) { if (objPVLDaoService == null) { objPVLDaoService = new PVLDaoImp(); } return(objPVLDaoService.GetPVLDetails(objPVLData)); }
public Model.PVLData GetPVLDetails(Model.PVLData objPVLData) { try { using (OracleConnection con = new DBConnection().getDBConnection()) // DA.Connection().getDBConnection()) { // if (con.State == System.Data.ConnectionState.Closed) con.Open(); using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT PVL_ID, PVL_NAME,MACHINE_CODE,F_AISLE,F_ROW,IS_BLOCKED,STATUS,IS_AUTOMODE" + " ,MACHINE_CHANNEL,IS_SWITCH_OFF,START_AISLE,END_AISLE,FROM_FLOOR,TO_FLOOR" + " FROM L2_PVL_MASTER" + " WHERE "; if (objPVLData.pvlPkId != 0) { sql += " PVL_ID=" + objPVLData.pvlPkId; } if (!string.IsNullOrEmpty(objPVLData.machineCode)) { sql += " MACHINE_CODE='" + objPVLData.machineCode + "'"; } command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { if (reader.Read()) { objPVLData.pvlPkId = Int32.Parse(reader["PVL_ID"].ToString()); objPVLData.pvlName = reader["PVL_NAME"].ToString(); objPVLData.machineCode = reader["MACHINE_CODE"].ToString(); objPVLData.aisle = Int32.Parse(reader["F_AISLE"].ToString()); objPVLData.row = Int32.Parse(reader["F_ROW"].ToString()); objPVLData.isBlocked = Int32.Parse(reader["IS_BLOCKED"].ToString()) == 1; objPVLData.status = Int32.Parse(reader["STATUS"].ToString()); objPVLData.autoMode = Int32.Parse(reader["IS_AUTOMODE"].ToString()); objPVLData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objPVLData.isSwitchOff = Int32.Parse(reader["IS_SWITCH_OFF"].ToString()) == 1; objPVLData.startAisle = Int32.Parse(reader["START_AISLE"].ToString()); objPVLData.endAisle = Int32.Parse(reader["END_AISLE"].ToString()); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(objPVLData); }
public List <Model.PVLData> GetPVLList() { List <Model.PVLData> lstPVLData = null; try { using (OracleConnection con = new DBConnection().getDBConnection()) // DA.Connection().getDBConnection()) { // if (con.State == System.Data.ConnectionState.Closed) con.Open(); using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT PVL_ID, PVL_NAME,MACHINE_CODE,F_AISLE,F_ROW,IS_BLOCKED,STATUS,IS_AUTOMODE" + " ,MACHINE_CHANNEL,IS_SWITCH_OFF,START_AISLE,END_AISLE,FROM_FLOOR,TO_FLOOR" + " FROM L2_PVl_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstPVLData = new List <Model.PVLData>(); while (reader.Read()) { Model.PVLData objPVLData = new Model.PVLData(); objPVLData.pvlPkId = Int32.Parse(reader["PVL_ID"].ToString()); objPVLData.pvlName = reader["PVL_NAME"].ToString(); objPVLData.machineCode = reader["MACHINE_CODE"].ToString(); objPVLData.aisle = Int32.Parse(reader["F_AISLE"].ToString()); objPVLData.row = Int32.Parse(reader["F_ROW"].ToString()); objPVLData.isBlocked = Int32.Parse(reader["IS_BLOCKED"].ToString()) == 1; objPVLData.status = Int32.Parse(reader["STATUS"].ToString()); objPVLData.autoMode = Int32.Parse(reader["IS_AUTOMODE"].ToString()); objPVLData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objPVLData.isSwitchOff = Int32.Parse(reader["IS_SWITCH_OFF"].ToString()) == 1; objPVLData.startAisle = Int32.Parse(reader["START_AISLE"].ToString()); objPVLData.endAisle = Int32.Parse(reader["END_AISLE"].ToString()); lstPVLData.Add(objPVLData); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(lstPVLData); }
public List <Model.PVLData> GetPVLList() { List <Model.PVLData> lstPVLData = null; try { using (OracleConnection con = new OracleConnection(Connection.connectionString)) // DA.Connection().getDBConnection()) { if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT PVL_ID, PVL_NAME,MACHINE_CODE,F_AISLE,F_ROW,STATUS, MACHINE_CHANNEL" + " FROM L2_PVl_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstPVLData = new List <Model.PVLData>(); while (reader.Read()) { Model.PVLData objPVLData = new Model.PVLData(); objPVLData.pvlPkId = Int32.Parse(reader["PVL_ID"].ToString()); objPVLData.pvlName = reader["PVL_NAME"].ToString(); objPVLData.machineCode = reader["MACHINE_CODE"].ToString(); objPVLData.aisle = Int32.Parse(reader["F_AISLE"].ToString()); objPVLData.row = Int32.Parse(reader["F_ROW"].ToString()); objPVLData.status = Int32.Parse(reader["STATUS"].ToString()); objPVLData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); lstPVLData.Add(objPVLData); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(lstPVLData); }
public bool ConfirmPVLReadyPUTByCM(string machineCode) { bool isReady = false; Model.PVLData objPVLData = new Model.PVLData(); objPVLData.machineCode = machineCode; if (objPVLDaoService == null) { objPVLDaoService = new PVLDaoImp(); } objPVLData = objPVLDaoService.GetPVLDetails(objPVLData); isReady = IsPVLReadyForPUTByCM(objPVLData); return(isReady); }
public bool IsPVLReadyForPUTByCM(Model.PVLData objPVLData) { bool isReady = false; string pvlDeck = GetDeckCodeOfPVL(objPVLData.machineCode); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objPVLData.machineChannel + "." + objPVLData.machineCode + "." + OpcTags.PVL_Auto_Ready)) { isReady = !opcd.ReadTag <bool>(objPVLData.machineChannel, pvlDeck, OpcTags.PVL_Deck_Pallet_Present); isReady = isReady && CheckPVLHealthy(objPVLData); } } return(isReady); }
public bool DoTriggerAction(Model.PVLData objPVLData, int commandType) { bool success = false; if (commandType == 1) { success = PVLMove(objPVLData); } else if (commandType == 2) { success = PVLGet(objPVLData); } else if (commandType == 3) { success = PVLPut(objPVLData); } return(success); }
public bool PVLMove(Model.PVLData objPVLData) { bool isPVLHealthy = false; bool success = false; //do //{ try { isPVLHealthy = CheckPVLHealthy(objPVLData); if (!isPVLHealthy) { return(false); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { objPVLData.floor = opcd.ReadTag <Int32>(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_Current_Floor); if (objPVLData.floor != objPVLData.destFloor) { opcd.WriteTag <int>(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_Request_Floor, objPVLData.destFloor); success = opcd.WriteTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, objPVLData.command, true); Thread.Sleep(500); success = opcd.WriteTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, objPVLData.command, false); } else { success = true; } } } catch (Exception ex) { Console.WriteLine(ex); success = false; } // } while (!success); return(success); }
public void FindCommandTypeAndDoneTag(Model.PVLData objPVLData, out int commandType, out string doneTag) { commandType = 0; doneTag = null; if (objPVLData.command.Equals(OpcTags.PVL_CP_Start)) { commandType = 1; doneTag = OpcTags.PVL_CP_Done; } else if (objPVLData.command.Equals(OpcTags.PVL_Get_PB)) { commandType = 2; doneTag = OpcTags.PVL_Get_PB_Done; } else if (objPVLData.command.Equals(OpcTags.PVL_Put_PB)) { commandType = 3; doneTag = OpcTags.PVL_Put_PB_Done; } }
public bool CheckPVLHealthy(Model.PVLData objPVLData) { bool isHealthy = false; if (objPVLDaoService == null) { objPVLDaoService = new PVLDaoImp(); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objPVLData.machineChannel + "." + objPVLData.machineCode + "." + OpcTags.PVL_Auto_Ready)) { isHealthy = opcd.ReadTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_Auto_Ready); isHealthy = isHealthy && !objPVLDaoService.IsPVLDisabled(objPVLData.machineCode); isHealthy = isHealthy && !objPVLDaoService.IsPVLSwitchOff(objPVLData.machineCode); } } return(isHealthy); }
public bool CheckPVLCommandDone(Model.PVLData objPVLData) { bool result = false; int counter = 1; OpcOperationsService opcd = null; int commandType = 0; string doneCheckTag = null; int error = 0; try { opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()); if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } Thread.Sleep(2000); result = false; FindCommandTypeAndDoneTag(objPVLData, out commandType, out doneCheckTag); do { error = objErrorControllerService.GetErrorCode(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_L2_ErrCode); if (error > 0) { TriggerData objTriggerData = new TriggerData(); objTriggerData.MachineCode = objPVLData.machineCode; objTriggerData.category = TriggerData.triggerCategory.ERROR; objTriggerData.ErrorCode = error.ToString(); objTriggerData.TriggerEnabled = true; objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); while (objErrorControllerService.GetTriggerActiveStatus(objPVLData.machineCode)) { Thread.Sleep(1000); } if (objErrorControllerService.GetTriggerAction(objPVLData.machineCode) == 1) { DoTriggerAction(objPVLData, commandType); Thread.Sleep(2000); } } result = opcd.ReadTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, doneCheckTag); if (counter > 3) { Thread.Sleep(700); } counter += 1; } while (!result); } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } finally { if (opcd != null) { opcd.Dispose(); } } return(result); }
public bool TaskAfterPvlProcess(Model.PVLData objPVLData) { throw new NotImplementedException(); }
public bool FindSlotAndPathForPVL(Model.PVLData objPVLData) { throw new NotImplementedException(); }