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); }
//using when changing mode back to entry in normal and morning mode public bool IsEESReadyForParkingChangeModeBack(EESData objEESData) { bool isEESReady = false; objEESDaoService = new EESDaoImp(); isEESReady = CheckEESHealthy(objEESData); //isEESReady = isEESReady && !objEESDaoService.IsEESBlockedInDBForParking(objEESData.machineCode); //isEESReady = isEESReady && !objEESDaoService.IsEESBlockedInDBForPMS(objEESData.machineCode); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { isEESReady = isEESReady && opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_L2_Change_Mode_OK); isEESReady = isEESReady && !opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_OutDoor_NotClosed_LS); // isEESReady = isEESReady && opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_L2_Change_Mode_OK); // //isEESReady = isEESReady && !opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Inner_Door_Close_Con); // //isEESReady = isEESReady && !opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Inner_Door_Open_Con); // //isEESReady = isEESReady && !opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Outer_Door_Close_Con); // //isEESReady = isEESReady && !opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Outer_Door_Open_Con); // //isEESReady = isEESReady && !opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_LOCKED_BY_PS); // //isEESReady = isEESReady && !opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_LOCKED_BY_REM); } return(isEESReady); }
public bool GetCarAtEESStatus(string eesChannel, string eesCode) { bool dataValueInBool = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { dataValueInBool = opcd.ReadTag <bool>(eesChannel, eesCode, OpcTags.EES_Car_At_EES); dataValueInBool = dataValueInBool || opcd.ReadTag <bool>(eesChannel, eesCode, OpcTags.EES_OutDoor_NotClosed_LS); } return(dataValueInBool); }
public bool IsPalletPresentOnEES(Model.EESData objEESData) { bool isPresent = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Ready)) { isPresent = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Pallet_Present_Prox_NE); isPresent = isPresent || opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Pallet_Present_Prox_SW); } } return(isPresent); }
public bool UpdateMachineValues() { objEESDaoService = new EESDaoImp(); List <EESData> eesList; bool result; int dataValue; bool dataValueInBool; try { eesList = objEESDaoService.GetEESList(); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { foreach (EESData objEESData in eesList) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Mode) == true) { //dataValueInBool = false; //dataValueInBool = opcd.ReadTag<bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Auto_Mode); // UpdateEESBoolData(objEESData.machineCode, OpcTags.EES_Auto_Mode, dataValueInBool); dataValueInBool = false; dataValueInBool = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Auto_Ready); UpdateEESBoolData(objEESData.machineCode, OpcTags.EES_Auto_Ready, dataValueInBool); dataValueInBool = false; dataValueInBool = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Car_Ready_At_Entry); UpdateEESBoolData(objEESData.machineCode, OpcTags.EES_Car_Ready_At_Entry, dataValueInBool); dataValueInBool = false; dataValueInBool = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Car_Ready_At_Exit); UpdateEESBoolData(objEESData.machineCode, OpcTags.EES_Car_Ready_At_Exit, dataValueInBool); dataValueInBool = false; dataValueInBool = GetCarAtEESStatus(objEESData.machineChannel, objEESData.machineCode); UpdateEESBoolData(objEESData.machineCode, OpcTags.EES_Car_At_EES, dataValueInBool); } } } result = true; } catch (Exception errMsg) { result = false; Console.WriteLine(errMsg.Message); } return(result); }
public bool UpdateMachineValues() { objVLCDaoService = new VLCDaoImp(); List <VLCData> vlcList; bool result; int dataValue; bool dataValueInBool; try { vlcList = objVLCDaoService.GetVLCList(); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { foreach (VLCData objVLCData in vlcList) { if (opcd.IsMachineHealthy(objVLCData.machineChannel + "." + objVLCData.machineCode + "." + OpcTags.VLC_Auto_Ready) == true) { dataValueInBool = false; dataValueInBool = opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_Auto_Ready); UpdateVLCBoolData(objVLCData.machineCode, OpcTags.VLC_Auto_Ready, dataValueInBool); } } } result = true; } catch (Exception errMsg) { result = false; Console.WriteLine(errMsg.Message); } return(result); }
public bool UpdateMachineValues() { objPSDaoService = new PSDaoImp(); List <Model.PSData> psList; bool result; int dataValue; bool dataValueInBool; try { psList = objPSDaoService.GetPSList(); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { foreach (Model.PSData objPSData in psList) { if (opcd.IsMachineHealthy(objPSData.machineChannel + "." + objPSData.machineCode + "." + OpcTags.PS_Auto_Mode) == true) { dataValue = opcd.ReadTag <Int16>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_Shuttle_Aisle_Position_for_L2); if (dataValue > 0) { UpdatePSIntData(objPSData.machineCode, OpcTags.PS_Shuttle_Aisle_Position_for_L2, dataValue); } dataValue = opcd.ReadTag <Int16>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Max_Window_Limit); if (dataValue > 0) { UpdatePSIntData(objPSData.machineCode, OpcTags.PS_L2_Max_Window_Limit, dataValue); } dataValue = opcd.ReadTag <Int16>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Min_Window_Limit); if (dataValue > 0) { UpdatePSIntData(objPSData.machineCode, OpcTags.PS_L2_Min_Window_Limit, dataValue); } } } } result = true; } catch (Exception errMsg) { result = false; Console.WriteLine(errMsg.Message); } return(result); }
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 VLCAtFloor(VLCData objVLCData) { int vlcFloor = 0; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { vlcFloor = opcd.ReadTag <Int32>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_At_Floor); } return(vlcFloor); }
public int GetEESMode(EESData objEESData) { Int32 eesMode; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { eesMode = opcd.ReadTag <Int32>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Mode); } return(eesMode); }
public bool IsDoneExcecuteEESGetCar(EESData objEESData) { bool isDone = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { isDone = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_InDoor_NotClosed_LS); } return(isDone); }
public bool checkCarReadyAtEntry(EESData objEESData) { bool carReadyAtEntry = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { carReadyAtEntry = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Car_Ready_At_Entry); } return(carReadyAtEntry); }
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 bool GetVehicleDetectorStatus(Model.EESData objEESData) { bool status = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { status = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Vehicle_Detector); } return(status); }
public bool IsEESReadyForRem(EESData objEESData) { bool isReady = false; if (objEESDaoService == null) { objEESDaoService = new EESDaoImp(); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Ready)) { isReady = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Ready_for_REM_Lock); isReady = isReady && !opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Car_At_EES); isReady = isReady && objEESDaoService.IsPSNotGettingFromEES(objEESData.machineCode); isReady = isReady && !objEESDaoService.IsEESDisabled(objEESData.machineCode); } } return(isReady); }
public int GetEESState(EESData objEESData) { int eesState = 0; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Ready)) { eesState = opcd.ReadTag <int>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_State_EES_HMI); } } return(eesState); }
public bool IsEESReadyForPS(EESData objEESData) { bool isReady = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Ready)) { isReady = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Ready_for_PS_Lock); } } return(isReady); }
public bool IsEESEntryInOPC(EESData objEESData) { bool isEntry = false; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Ready)) { isEntry = opcd.ReadTag <Int32>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Mode) == GlobalValues.EESEntry; } } return(isEntry); }
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 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 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 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 GetMidHeightSensorStatus(EESData objEESData) { bool midSensor = false; try { using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { //for low car is true, for high car its false. midSensor = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Mid_Height_Sensor_Blocked); } } finally { } return(midSensor); }
public bool CheckEESHealthy(EESData objEESData) { bool isHealthy = false; objEESDaoService = new EESDaoImp(); using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objEESData.machineChannel + "." + objEESData.machineCode + "." + OpcTags.EES_Auto_Ready)) { isHealthy = opcd.ReadTag <bool>(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_Auto_Ready); isHealthy = isHealthy && !objEESDaoService.IsEESDisabled(objEESData.machineCode); // isHealthy = isHealthy && !objEESDaoService.IsEESSwitchOff(objEESData.machineCode); } } return(isHealthy); }
//public int GetCountOfPallet(Model.PSTData objPSTData) //{ // int palletCount = -1; // using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) // { // palletCount=opcd.ReadTag<Int32>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_Pallet_Count); // } // return palletCount; //} public int GetCountOfPallet(Model.PSTData objPSTData) { int palletCount = -1; bool isPalletOnPST = true; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { palletCount = opcd.ReadTag <int>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_Pallet_Count); /* if (!objPSTData.machineCode.Contains("PST_FLR4_01")) * { * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_1); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_1); * palletCount = isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_2); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_2); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_3); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_3); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_4); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_4); * palletCount += isPalletOnPST == true ? 1 : 0; * } * else if (objPSTData.machineCode.Contains("PST_FLR4_01")) * { * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_1_Bottom); * palletCount = isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_2); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_3); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_4_Top); * palletCount += isPalletOnPST == true ? 1 : 0; * }*/ } return(palletCount); }
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 bool CheckPSTHealthy(Model.PSTData objPSTData) { bool isHealthy = false; if (objPSTDaoService == null) { objPSTDaoService = new PSTDaoImp(); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objPSTData.machineChannel + "." + objPSTData.machineCode + "." + OpcTags.PST_Auto_Ready)) { isHealthy = opcd.ReadTag <bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_Auto_Ready); isHealthy = isHealthy && !objPSTDaoService.IsPSTDisabled(objPSTData.machineCode); isHealthy = isHealthy && !objPSTDaoService.IsPSTSwitchOff(objPSTData.machineCode); } } return(isHealthy); }
public int GetErrorCode(string channel, string machine, string errorRegister) { int errorCode = 0; try { using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { errorCode = opcd.ReadTag <Int32>(channel, machine, errorRegister); } } catch (Exception errmsg) { Console.WriteLine(errmsg); } finally { } return(errorCode); }
public void ReadWashingTagStatus() { bool carWashReady = false; bool carWashCarPresent = false; bool carWashFinish = false; bool carWashFinishTriggered = false; if (objCarWashControllerService == null) { objCarWashControllerService = new CarWashControllerImp(); } int washQId = 0; try { using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { carWashReady = opcd.ReadTag <bool>("CH003", "VLC_Drive_03", "CarWash_Ready"); carWashCarPresent = opcd.ReadTag <bool>("CH003", "VLC_Drive_03", "CarWash_Car_Present"); carWashFinish = opcd.ReadTag <bool>("CH003", "VLC_Drive_03", "CW_Fin"); objCarWashControllerService.UpdateIsWashReady(carWashReady); if (carWashReady && !carWashCarPresent) { carWashReader.Stop(); objCarWashControllerService.UpdateCarWashFinishTrigger(0); washQId = objCarWashControllerService.InsertQueueForWashing(1); if (washQId != 0) { //CancellationTokenSource tokenSource = new CancellationTokenSource(); //GlobalValues.threadsDictionary.Add(washQId, tokenSource); //Task.Factory.StartNew(() => objCarWashControllerService.ProcessWashPath(washQId), GlobalValues.threadsDictionary[washQId].Token); } } else if (carWashFinish && carWashCarPresent) { //update car finish flag as 1. carWashReader.Stop(); //carWashFinishTriggered = objCarWashControllerService.IsCarWashFinishTriggeredByUser(); //if (carWashFinishTriggered) //{ //} objCarWashControllerService.UpdateCarWashFinishTrigger(1); } else if (carWashCarPresent && objCarWashControllerService.IsCarWashFinishTriggeredByUser()) { objCarWashControllerService.UpdateCarWashFinishTrigger(0); washQId = objCarWashControllerService.InsertQueueForWashing(-1); if (washQId != 0) { //CancellationTokenSource tokenSource = new CancellationTokenSource(); //GlobalValues.threadsDictionary.Add(washQId, tokenSource); //Task.Factory.StartNew(() => objCarWashControllerService.ProcessWashPath(washQId), GlobalValues.threadsDictionary[washQId].Token); } } } } catch (Exception errMsg) { //Console.WriteLine("StartWashingScan, Error = " + errMsg.Message); } finally { carWashReader.Interval = 3000; carWashReader.Start(); } }
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); }