Пример #1
0
        public void ProcessTransfer(QueueData objQueueData)
        {
            if (objParkingControllerService == null)
            {
                objParkingControllerService = new ParkingControllerImp();
            }
            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }

            List <PathDetailsData> lstPathDetails = null;

            //   lstPathDetails = new List<PathDetailsData>();
            try
            {
                bool needIteration = false;
                do
                {
                    /**checking transaction deleted or not****/
                    objQueueControllerService.CancelIfRequested(objQueueData.queuePkId);
                    /******/
                    do
                    {
                        lstPathDetails = GetAllocatePath(objQueueData.queuePkId);
                        if (lstPathDetails == null)
                        {
                            Thread.Sleep(1500);
                        }
                        /**checking transaction deleted or not****/
                        objQueueControllerService.CancelIfRequested(objQueueData.queuePkId);
                        /******/
                    } while (lstPathDetails == null);
                    objParkingControllerService.ExcecuteCommands(objQueueData);
                    needIteration = objParkingControllerService.GetIterationStatus(objQueueData.queuePkId);
                } while (needIteration);

                UpdateAfterTransfer(objQueueData.queuePkId);
            }
            catch (OperationCanceledException errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objQueueData.queuePkId + " --TaskCanceledException 'ProcessTransfer':: " + errMsg.Message);
            }
            catch (Exception errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objQueueData.queuePkId + ":--Exception 'ProcessTransfer':: " + errMsg.Message);
            }
            finally
            {
            }
        }
        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 ProcessWashPath(QueueData objQueueData)
        {
            if (objParkingControllerService == null)
            {
                objParkingControllerService = new ParkingControllerImp();
            }
            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }

            List <PathDetailsData> lstPathDetails = null;

            // QueueData objQueueData = new QueueData();
            try
            {
                lstPathDetails = new List <PathDetailsData>();
                do
                {
                    lstPathDetails = FindCarWashingPathFirst(objQueueData.queuePkId);
                    if (lstPathDetails == null)
                    {
                        Thread.Sleep(1500);
                    }

                    /**checking transaction deleted or not****/
                    objQueueControllerService.CancelIfRequested(objQueueData.queuePkId);
                    /******/
                } while (lstPathDetails == null);
                //objQueueData.queuePkId = washQId;
                objParkingControllerService.ExcecuteCommands(objQueueData);

                if (!IsSameFloorTravel(lstPathDetails))
                {
                    lstPathDetails = new List <PathDetailsData>();

                    do
                    {
                        lstPathDetails = FindCarWashingPathSecond(objQueueData.queuePkId);
                        if (lstPathDetails == null)
                        {
                            Thread.Sleep(1500);
                        }

                        /**checking transaction deleted or not****/
                        objQueueControllerService.CancelIfRequested(objQueueData.queuePkId);
                        /******/
                    } while (lstPathDetails == null);

                    //  objQueueData.queuePkId = washQId;
                    objParkingControllerService.ExcecuteCommands(objQueueData);
                }
                objCarWashDaoService.updateAfterProcessing(objQueueData.queuePkId);
            }
            catch (OperationCanceledException errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objQueueData.queuePkId + " --TaskCanceledException 'ProcessWashPath':: " + errMsg.Message);
            }
            catch (Exception errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objQueueData.queuePkId + ":--Exception 'ProcessWashPath':: " + errMsg.Message);
            }
            finally
            {
            }
            return(true);
        }
        public bool VLCMove(Model.VLCData objVLCData)
        {
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Entering 'VLCMove' ");
            bool isCMHealthy = false;
            bool success     = false;

            if (objQueueControllerService == null)
            {
                objQueueControllerService = new QueueControllerImp();
            }
            if (objErrorDaoService == null)
            {
                objErrorDaoService = new ErrorDaoImp();
            }

            do
            {
                /**checking transaction deleted or not****/
                objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                /******/
                try
                {
                    TriggerData objTriggerData = NeedToShowTrigger(objVLCData);
                    if (objTriggerData.TriggerEnabled)
                    {
                        objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);
                        break;
                    }
                    isCMHealthy = CheckVLCHealthy(objVLCData);

                    if (!isCMHealthy)
                    {
                        Thread.Sleep(200);
                        continue;
                    }

                    using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection()))
                    {
                        objVLCData.floor = opcd.ReadTag <Int32>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_At_Floor);
                        if (objVLCData.floor != objVLCData.destFloor)
                        {
                            opcd.WriteTag <int>(objVLCData.machineChannel, objVLCData.machineCode, OpcTags.VLC_DestFloor, objVLCData.destFloor);
                            success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true);
                        }
                        else
                        {
                            success = opcd.WriteTag <bool>(objVLCData.machineChannel, objVLCData.machineCode, objVLCData.command, true);
                            success = true;
                        }
                    }
                }
                catch (OperationCanceledException errMsg)
                {
                    Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ": CM=" + objVLCData.machineCode + " --TaskCanceledException 'VLCMove':: " + errMsg.Message);
                    throw new OperationCanceledException();
                }
                catch (Exception ex)
                {
                    Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exception 'VLCMove':: " + ex.Message);
                    /**checking transaction deleted or not****/
                    objQueueControllerService.CancelIfRequested(objVLCData.queueId);
                    /******/
                    if (ex is TaskCanceledException)
                    {
                        throw new Exception();
                    }
                    success = false;
                }
            } while (!success);
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objVLCData.queueId + ":--Exitting 'VLCMove' ");
            return(success);
        }