コード例 #1
0
        public bool CheckVLCCommandDone(Model.VLCData objVLCData)
        {
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Entering 'CheckVLCCommandDone' ");
            bool result = false;

            bool isWaitingForCmdDoneOn = false;
            int  counter = 1;
            OpcOperationsService opcd = null;

            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }
            if (objErrorControllerService == null)
            {
                objErrorControllerService = new ErrorControllerImp();
            }
            if (objErrorDaoService == null)
            {
                objErrorDaoService = new ErrorDaoImp();
            }
            bool        triggerAlreadyEnabled = false;
            TriggerData objTriggerData        = null;

            try
            {
                opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection());

                Thread.Sleep(3000);
                result = false;
                //TimeSpan startTime = System.DateTime.Now.TimeOfDay;

                do
                {
                    triggerAlreadyEnabled = objErrorControllerService.GetTriggerActiveStatus(objVLCData.machineCode);
                    if (!triggerAlreadyEnabled)
                    {
                        objTriggerData = NeedToShowTrigger(objVLCData);
                    }
                    if (triggerAlreadyEnabled || objTriggerData.TriggerEnabled)
                    {
                        if (!triggerAlreadyEnabled)
                        {
                            objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);
                        }


                        while (objErrorControllerService.GetTriggerActiveStatus(objVLCData.machineCode))
                        {
                            /**checking transaction deleted or not****/
                            objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                            /******/
                            Thread.Sleep(1000);
                        }
                        if (objQueueControllerService.NeedToOptimizePath(objVLCData.queueId))
                        {
                            break;
                        }
                        if (objErrorControllerService.GetTriggerAction(objVLCData.machineCode) == 1)
                        {
                            VLCMove(objVLCData);

                            Thread.Sleep(2000);
                        }
                    }


                    result = opcd.ReadTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_CP_Done);

                    if (counter > 3)
                    {
                        counter = 1;
                        /**checking transaction deleted or not****/
                        objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                        /******/
                        Thread.Sleep(700);
                    }
                    counter += 1;
                } while (!result);
            }
            catch (OperationCanceledException errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": CM=" + objVLCData.machineCode + " --TaskCanceledException 'CheckVLCCommandDone':: " + errMsg.Message);
                throw new OperationCanceledException();
            }
            catch (Exception errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exception 'CheckVLCCommandDone':: " + errMsg.Message);
                if (errMsg is TaskCanceledException)
                {
                    throw new Exception();
                }
            }
            finally
            {
                if (opcd != null)
                {
                    opcd.Dispose();
                }
            }
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exitting 'CheckVLCCommandDone' ");
            return(result);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public bool CheckPVLCommandDone(Model.PVLData objPVLData)
        {
            bool result = false;

            int counter = 1;
            OpcOperationsService opcd = null;

            int    commandType  = 0;
            string doneCheckTag = null;
            int    error        = 0;

            try
            {
                opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection());
                if (objErrorControllerService == null)
                {
                    objErrorControllerService = new ErrorControllerImp();
                }
                if (objErrorDaoService == null)
                {
                    objErrorDaoService = new ErrorDaoImp();
                }
                Thread.Sleep(2000);
                result = false;
                FindCommandTypeAndDoneTag(objPVLData, out commandType, out doneCheckTag);


                do
                {
                    error = objErrorControllerService.GetErrorCode(objPVLData.machineChannel, objPVLData.machineCode, OpcTags.PVL_L2_ErrCode);
                    if (error > 0)
                    {
                        TriggerData objTriggerData = new TriggerData();
                        objTriggerData.MachineCode    = objPVLData.machineCode;
                        objTriggerData.category       = TriggerData.triggerCategory.ERROR;
                        objTriggerData.ErrorCode      = error.ToString();
                        objTriggerData.TriggerEnabled = true;
                        objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);


                        while (objErrorControllerService.GetTriggerActiveStatus(objPVLData.machineCode))
                        {
                            Thread.Sleep(1000);
                        }
                        if (objErrorControllerService.GetTriggerAction(objPVLData.machineCode) == 1)
                        {
                            DoTriggerAction(objPVLData, commandType);

                            Thread.Sleep(2000);
                        }
                    }

                    result = opcd.ReadTag <bool>(objPVLData.machineChannel, objPVLData.machineCode, doneCheckTag);

                    if (counter > 3)
                    {
                        Thread.Sleep(700);
                    }
                    counter += 1;
                } while (!result);
            }
            catch (Exception errMsg)
            {
                Console.WriteLine(errMsg.Message);
            }
            finally
            {
                if (opcd != null)
                {
                    opcd.Dispose();
                }
            }
            return(result);
        }