public bool ExcecuteEESGetCar(EESData objEESData)
        {
            bool success      = false;
            int  printCounter = 0;

            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }
            using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()))
            {
                do
                {
                    success = opcd.WriteTag <bool>(objEESData.machineChannel, objEESData.machineCode, objEESData.command, true);
                    System.Threading.Thread.Sleep(1000);

                    printCounter += 1;
                    if (printCounter > 3)
                    {
                        //checking transaction deleted or not
                        objQueueControllerService.CancelIfRequested(objEESData.queueId);
                        Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objEESData.queueId + ":--Failed to excecute get car for EES" + objEESData.machineCode);
                        printCounter = 0;
                    }
                } while (!IsDoneExcecuteEESGetCar(objEESData));
            }
            return(success);
        }
        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 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 bool IsEESReadyForChangeMode(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_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 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 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 bool ExcecutePaymentDone(EESData objEESData)
        {
            bool success = false;

            using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()))
            {
                success = opcd.WriteTag <bool>(objEESData.machineChannel, objEESData.machineCode, objEESData.command, true);
            }
            return(success);
        }
        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 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 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 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 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 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 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 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 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 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 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 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 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 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);
        }
Beispiel #28
0
        //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);
        }
Beispiel #30
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);
        }