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 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 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 SetHighCarBitForCarWash(VLCData objVLCData, bool bit)
        {
            bool success = false;

            using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()))
            {
                if (opcd.IsMachineHealthy(objVLCData.machineChannel + "." + objVLCData.machineCode + "." + OpcTags.WASH_CarWash_HighCar))
                {
                    success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.WASH_CarWash_HighCar, bit);
                }
            }
            return(success);
        }
        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 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 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 StartCarWash(Modules.Machines.VLC.Model.VLCData objVLCData)
        {
            bool success = false;

            using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()))
            {
                if (opcd.IsMachineHealthy(objVLCData.machineChannel + "." + objVLCData.machineCode + "." + OpcTags.WASH_CarWash_Start_Cycle))
                {
                    success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true);
                    Thread.Sleep(2000);
                    success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, false);
                }
            }
            return(success);
        }
        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 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 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);
        }
예제 #16
0
        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 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 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);
        }