コード例 #1
0
        public void AsynchReadSettings()
        {
            //initiate notification from opc

            CommonServicesForMachines objCommonService;

            objCommonService = new CMControllerImp();
            objCommonService.AsynchReadSettings();



            objCommonService = new EESControllerImp();
            objCommonService.AsynchReadSettings();

            objCommonService = new PSControllerImp();
            objCommonService.AsynchReadSettings();

            //objCommonService = new PSTControllerImp();
            //objCommonService.AsynchReadSettings();

            //objCommonService = new PVLControllerImp();
            //objCommonService.AsynchReadSettings();

            objCommonService = new VLCControllerImp();
            objCommonService.AsynchReadSettings();
        }
コード例 #2
0
        public void DoInitializeEngine(GlobalValues.engineStartMode startMode)
        {
            if (OnToDisplayMessage != null)
            {
                OnToDisplayMessage("Initialization.....", null);
            }


            /**
             * 1. set all global variables(including path of display xml)
             * 2. update machine values to DB
             * 3. update status of car at EES to DB: this included in EES machine value updation
             * 4. call engine reset procedure
             * 5. initiate notification from opc
             * 6. initiate home position
             * 7. initiate mode changing of ees
             * 8. initiate pallet management
             * 9. initiate click transfer listener
             * 10.initiate generator mode listener
             * 11.start machine values updation trigger
             * 12.call queue manager
             */

            try
            {
                //1. set all global variables(including path of display xml)
                SetAllGlobalVariables();

                if (objParkingControllerService == null)
                {
                    objParkingControllerService = new ParkingControllerImp();
                }
                if (objPalletManagerService == null)
                {
                    objPalletManagerService = new PalletManagerImp();
                }
                if (objParkingControllerService == null)
                {
                    objParkingControllerService = new ParkingControllerImp();
                }


                #region OPC and Oracle Initialization
                //checking opc server connection established or not
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("Initialization.....", null);
                }
                OpcServer opc = null;
                while (!OpcConnection.IsOpcServerConnectionAvailable())
                {
                    if (OnToDisplayMessage != null)
                    {
                        OnToDisplayMessage("OPC Initialization failed.....", null);
                    }
                    Thread.Sleep(1000);
                }
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("OPC Initialization success.....", null);
                }



                //checking database connection established or not
                OracleConnection con = null;
                do
                {
                    con = new DBConnection().getDBConnection();
                    if (con.State == ConnectionState.Closed)
                    {
                        if (OnToDisplayMessage != null)
                        {
                            OnToDisplayMessage("Oracle Initialization failed.....", null);
                        }
                    }
                    Thread.Sleep(1000);
                }while(con.State == ConnectionState.Closed);
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("Oracle Initialization success.....", null);
                }
                #endregion



                //2. update machine values to DB //11.start machine values updation trigger
                #region Synchind OPC data and reset or resume engine
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("Synching data.....", null);
                }
                UpdateMachineValues();
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("Synching data finished.....", null);
                }
                Thread threadUpdateMachineStatus = new Thread(delegate()
                {
                    updateMachineValuesTimer();
                });
                threadUpdateMachineStatus.IsBackground = true;
                threadUpdateMachineStatus.Start();

                //4. call engine reset procedure

                if (startMode == GlobalValues.engineStartMode.restart)
                {
                    objParkingControllerService.CallResetProcedure();
                }
                else
                {
                    objParkingControllerService.CallResumeProcedure();
                }
                #endregion


                //5. initiate notification from opc
                #region OPC Notification
                CommonServicesForMachines objCommonService;

                objCommonService = new CMControllerImp();
                objCommonService.AsynchReadSettings();



                objCommonService = new EESControllerImp();
                objCommonService.AsynchReadSettings();

                objCommonService = new PSControllerImp();
                objCommonService.AsynchReadSettings();

                ////objCommonService = new PSTControllerImp();
                ////objCommonService.AsynchReadSettings();

                ////objCommonService = new PVLControllerImp();
                ////objCommonService.AsynchReadSettings();

                objCommonService = new VLCControllerImp();
                objCommonService.AsynchReadSettings();
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("initialized OPC notifications.....", null);
                }
                #endregion

                //6. initiate home position
                if (GlobalValues.PARKING_ENABLED)
                {
                    #region Home Position
                    MoveIdealCMToHomePosition = new Thread(delegate()
                    {
                        objParkingControllerService.HomePositionMoveTrigger();
                    });
                    MoveIdealCMToHomePosition.IsBackground = true;
                    MoveIdealCMToHomePosition.Start();
                    #endregion
                }

                //  * 7. initiate mode changing of ees //* 8. initiate pallet management
                if (GlobalValues.PMS_ENABLED)
                {
                    #region PMS



                    triggerESSModeChange = new Thread(delegate()
                    {
                        objPalletManagerService.StartModeScanning();
                    });
                    triggerESSModeChange.IsBackground = true;
                    triggerESSModeChange.Start();


                    triggerGetPalletForESS = new Thread(delegate()
                    {
                        objPalletManagerService.StartPMSProcessing();
                    });
                    triggerGetPalletForESS.IsBackground = true;
                    triggerGetPalletForESS.Start();
                    #endregion
                }
                // * 9. initiate click transfer listener
                // * 10.initiate generator mode listener

                #region Listening new parking request
                // * 12.call queue manager

                objQueueControllerService = new QueueControllerImp();
                if (startMode == GlobalValues.engineStartMode.resume)
                {
                    objQueueControllerService.DoResumeEngine();
                }

                objQueueControllerService.CreateDispalyXML();
                objQueueControllerService.RequestListener();
                #endregion

                //13. iterate queueEntries
                if (GlobalValues.PARKING_ENABLED)
                {
                    InitializeParkingQueue();
                }

                //Delete all old images
                #region Delete all old images


                Thread threadForDeleteImages = new Thread(delegate()
                {
                    DeleteOldRecords();
                });
                threadForDeleteImages.IsBackground = true;
                threadForDeleteImages.Name         = "DeleteImages";
                threadForDeleteImages.Start();

                #endregion
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("initialization completed succesfully.....", null);
                }
                //MessageBox.Show("Car type checking disabled");
            }
            catch (Exception errMsg)
            {
                if (OnToDisplayMessage != null)
                {
                    OnToDisplayMessage("Error....." + errMsg.Message, null);
                }
                MessageBox.Show(errMsg.Message);
            }
            finally
            {
            }
        }