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);
        }
        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 bool PSPutToPST(Model.PSData objPSData, PSTData objPSTData)
        {
            //Logger.WriteLogger(GlobalValues.PMS_LOG, "Entering PSPutToPST: " + objPSData.machineCode + " >> dest_aisle: " + objPSData.destAisle);
            bool isPSHealthy = false;
            bool success     = false;
            bool isPathClear = false;
            int  checkCount  = 0;
            int  setAisle    = 0;

            //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);
                    }
                    else
                    {
                        isPathClear = true;
                    }

                    if (isPathClear)
                    {
                        do
                        {
                            opcd.WriteTag <int>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Destination_Aisle, objPSData.destAisle);
                            setAisle = opcd.ReadTag <int>(objPSData.machineChannel, objPSData.machineCode, OpcTags.PS_L2_Destination_Aisle);
                            checkCount++;
                        } while (objPSData.destAisle != setAisle && checkCount < 5);

                        if (objPSData.destAisle == setAisle)
                        {
                            success = opcd.WriteTag <bool>(objPSData.machineChannel, objPSData.machineCode, objPSData.command, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLogger(GlobalValues.PMS_LOG, "Error in PSPutToPST: " + objPSData.machineCode
                                   + " >> dest_aisle: " + objPSData.destAisle + "; error: " + ex.Message);
                success = false;
            }
            finally
            {
                //Logger.WriteLogger(GlobalValues.PMS_LOG, "Exitting PSPutToPST: " + objPSData.machineCode + " >> dest_aisle: " + objPSData.destAisle);
            }

            //} while (!success);
            return(success);
        }