public void FindCommandTypeAndDoneTag(Model.PSData objPSData, out int commandType, out string doneTag) { commandType = 0; doneTag = null; if (objPSData.command.Equals(OpcTags.PS_L2_MoveCmd)) { commandType = 1; //doneTag = OpcTags.PS_L2_CMD_POSITION_DONE; } else if (objPSData.command.Equals(OpcTags.PS_L2_EES_GetCmd)) { commandType = 2; //doneTag = OpcTags.PS_L2_EES_GET_DONE; } else if (objPSData.command.Equals(OpcTags.PS_L2_EES_PutCmd)) { commandType = 3; //doneTag = OpcTags.PS_L2_EES_PUT_DONE; } else if (objPSData.command.Equals(OpcTags.PS_L2_PST_GetCmd)) { commandType = 4; //doneTag = OpcTags.PS_L2_PST_GET_DONE; } else if (objPSData.command.Equals(OpcTags.PS_L2_PST_PutCmd)) { commandType = 5; //doneTag = OpcTags.PS_L2_PST_PUT_DONE; } doneTag = OpcTags.PS_L2_CMD_DONE; }
public bool DoTriggerAction(Model.PSData objPSData, PSTData objPSTData, EESData objEESData, int commandType) { bool success = false; if (commandType == 1) { success = PSMove(objPSData); } else if (commandType == 2) { success = PSGetFromEES(objPSData, objEESData); } else if (commandType == 3) { success = PSPutToEES(objPSData, objEESData); } else if (commandType == 4) { success = PSGetFromPST(objPSData, objPSTData); } else if (commandType == 5) { success = PSPutToPST(objPSData, objPSTData); } return(success); }
private bool ShowTrigger(Model.PSData objPSData) { if (objPSData == null) { return(false); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } int error = objErrorControllerService.GetErrorCode(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Error_Data_Register); if (error != 0) { return(false); } TriggerData objTriggerData = new TriggerData(); objTriggerData.MachineCode = objPSData.machineCode; objTriggerData.category = TriggerData.triggerCategory.ERROR; objTriggerData.ErrorCode = error.ToString(); objTriggerData.TriggerEnabled = true; objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); return(true); }
public List <Model.PSData> GetPSList() { List <Model.PSData> lstPSData = 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 PS_ID, PS_NAME,MACHINE_CODE,IS_BLOCKED,ACTUAL_MIN,ACTUAL_MAX,DYNAMIC_MIN,DYNAMIC_MAX,DYNAMIC_HOME,STATUS" + " ,MACHINE_CHANNEL,IS_SWITCH_OFF,ACTUAL_HOME" + " FROM L2_PS_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstPSData = new List <Model.PSData>(); while (reader.Read()) { Model.PSData objPSData = new Model.PSData(); objPSData.psPkId = Int32.Parse(reader["PS_ID"].ToString()); objPSData.psName = reader["PS_NAME"].ToString(); objPSData.machineCode = reader["MACHINE_CODE"].ToString(); objPSData.isBlocked = Int32.Parse(reader["IS_BLOCKED"].ToString()) == 1; objPSData.actualMin = Int32.Parse(reader["ACTUAL_MIN"].ToString()); objPSData.actualMax = Int32.Parse(reader["ACTUAL_MAX"].ToString()); objPSData.dynamicMin = Int32.Parse(reader["DYNAMIC_MIN"].ToString()); objPSData.dynamicMax = Int32.Parse(reader["DYNAMIC_MAX"].ToString()); objPSData.dynamicHome = Int32.Parse(reader["DYNAMIC_HOME"].ToString()); objPSData.status = Int32.Parse(reader["STATUS"].ToString()); objPSData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objPSData.isSwitchOff = Int32.Parse(reader["IS_SWITCH_OFF"].ToString()) == 1; objPSData.actualHome = Int32.Parse(reader["ACTUAL_HOME"].ToString()); lstPSData.Add(objPSData); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(lstPSData); }
public bool PSMove(Model.PSData objPSData) { //Logger.WriteLogger(GlobalValues.PMS_LOG, "Entering PSMove: " + objPSData.machineCode+" >> dest_aisle: "+objPSData.destAisle); bool isPSHealthy = false; bool success = false; bool isPathClear = false; //do //{ try { isPSHealthy = CheckPSHealthy(objPSData); if (!isPSHealthy) { return(false); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { objPSData.dynamicHome = opcd.ReadTag <Int32>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_Shuttle_Aisle_Position_for_L2); if (objPSData.dynamicHome != objPSData.destAisle) { isPathClear = ClearPathForPS(objPSData); if (isPathClear) { opcd.WriteTag <int>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Destination_Aisle, objPSData.destAisle); success = opcd.WriteTag <bool>(objPSData.machineChannel, objPSData.machineCode, objPSData.command, true); } } else { success = true; } } } catch (Exception ex) { Logger.WriteLogger(GlobalValues.PMS_LOG, "Error in PSMove: " + objPSData.machineCode + " >> dest_aisle: " + objPSData.destAisle + "; error: " + ex.Message); success = false; } finally { //Logger.WriteLogger(GlobalValues.PMS_LOG, "Exitting PSMove: " + objPSData.machineCode + " >> dest_aisle: " + objPSData.destAisle); } //} while (!success); return(success); }
public int GetAisleOfPS(Model.PSData objPSData) { int aisle = 0; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objPSData.machineChannel + "." + objPSData.machineCode + "." + OpcTags.PS_Shuttle_Aisle_Position_for_L2)) { aisle = opcd.ReadTag <Int32>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_Shuttle_Aisle_Position_for_L2); } } return(aisle); }
public List <Model.PSData> GetPSList() { List <Model.PSData> lstPSData = 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 PS_ID, PS_NAME,MACHINE_CODE,STATUS,MACHINE_CHANNEL" + " FROM L2_PS_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstPSData = new List <Model.PSData>(); while (reader.Read()) { Model.PSData objPSData = new Model.PSData(); objPSData.psPkId = Int32.Parse(reader["PS_ID"].ToString()); objPSData.psName = reader["PS_NAME"].ToString(); objPSData.machineCode = reader["MACHINE_CODE"].ToString(); objPSData.status = Int32.Parse(reader["STATUS"].ToString()); objPSData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); lstPSData.Add(objPSData); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(lstPSData); }
public bool CheckPSHealthy(Model.PSData objPSData) { bool isHealthy = false; objPSDaoService = new PSDaoImp(); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objPSData.machineChannel + "." + objPSData.machineCode + "." + OpcTags.PS_Shuttle_Aisle_Position_for_L2)) { isHealthy = opcd.ReadTag <bool>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Auto_Ready_Bit); isHealthy = isHealthy && !objPSDaoService.IsPSDisabled(objPSData.machineCode); isHealthy = isHealthy && !objPSDaoService.IsPSSwitchOff(objPSData.machineCode); } } return(isHealthy); }
public bool IsPalletPresentOnPS(Model.PSData objPSData, out bool hasPSCommunication) { bool isPresent = false; int healthCheckCount = 0; hasPSCommunication = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { while (healthCheckCount < 3) { hasPSCommunication = opcd.IsMachineHealthy(objPSData.machineChannel + "." + objPSData.machineCode + "." + OpcTags.PS_East_Pallet_Present_Prox); if (hasPSCommunication) { isPresent = opcd.ReadTag <bool>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_East_Pallet_Present_Prox); isPresent = isPresent || opcd.ReadTag <bool>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_West_Pallet_Present_Prox); break; } healthCheckCount++; } } return(isPresent); }
public int GetValidAisleForMoving(Model.PSData objPSData) { bool bOk = false; int aisle = 0; try { using (OracleConnection con = new DBConnection().getDBConnection()) { using (OracleCommand command = con.CreateCommand()) { bOk = true; } } } catch (Exception errMsg) { throw new Exception(errMsg.Message); } return(aisle); }
public bool ClearNearestPS(Model.PSData objPSData) { throw new NotImplementedException(); }
public bool ClearPathForPS(Model.PSData objPSData) { //TODO: implement the logic return(true); }
public bool CheckPSCommandDone(Model.PSData objPSData, PSTData objPSTData, EESData objEESData) { //Logger.WriteLogger(GlobalValues.PMS_LOG, "Entering CheckPSCommandDone: " + objPSData.machineCode + " >> dest_aisle: " + objPSData.destAisle); bool result = false; int counter = 1; OpcOperationsService opcd = null; int commandType = 0; string doneCheckTag = null; int error = 0; if (objPSTControllerService == null) { objPSTControllerService = new PSTControllerImp(); } try { opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()); if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } Thread.Sleep(3000); result = false; FindCommandTypeAndDoneTag(objPSData, out commandType, out doneCheckTag); do { if (ShowTrigger(objPSData) || objPSTControllerService.ShowTrigger(objPSTData) || objEESControllerService.ShowTrigger(objEESData)) { while (objErrorControllerService.GetTriggerActiveStatus(objPSData.machineCode)) { Thread.Sleep(1000); } if (objErrorControllerService.GetTriggerAction(objPSData.machineCode) == 1) { DoTriggerAction(objPSData, objPSTData, objEESData, commandType); Thread.Sleep(2000); } } result = opcd.ReadTag <bool>(objPSData.machineChannel, objPSData.machineCode, doneCheckTag); if (counter > 3) { Thread.Sleep(700); } counter += 1; } while (!result); } catch (Exception errMsg) { Logger.WriteLogger(GlobalValues.PMS_LOG, "Error in CheckPSCommandDone: " + objPSData.machineCode + " >> dest_aisle: " + objPSData.destAisle + "; error: " + errMsg.Message); } finally { //Logger.WriteLogger(GlobalValues.PMS_LOG, "Exitting CheckPSCommandDone: " + objPSData.machineCode + " >> dest_aisle: " // + objPSData.destAisle + ", result =" + result); if (opcd != null) { opcd.Dispose(); } } return(result); }
public Model.PSData GetPSDetails(Model.PSData objPSData) { throw new NotImplementedException(); }