public bool ShowTrigger(Model.EESData objEESData)
        {
            if (objEESData == null)
            {
                return(false);
            }
            if (objErrorDaoService == null)
            {
                objErrorDaoService = new ErrorDaoImp();
            }
            if (objErrorControllerService == null)
            {
                objErrorControllerService = new ErrorControllerImp();
            }

            int error = objErrorControllerService.GetErrorCode(objEESData.machineChannel, objEESData.machineCode, OpcTags.EES_L2_ErrCode);

            if (error != 0)
            {
                return(false);
            }
            TriggerData objTriggerData = new TriggerData();

            objTriggerData.MachineCode    = objEESData.machineCode;
            objTriggerData.category       = TriggerData.triggerCategory.ERROR;
            objTriggerData.ErrorCode      = error.ToString();
            objTriggerData.TriggerEnabled = true;
            objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData);
            return(true);
        }
        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);
        }
Exemplo n.º 3
0
        public bool GetVehicleDetectorStatus(Model.EESData objEESData)
        {
            bool status = false;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }

            status = objOPCServerDirector.ReadTag <bool>(objEESData.machineChannel + "." + objEESData.machineCode + ".Vehicle_Detector");


            return(status);
        }
        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);
        }
Exemplo n.º 5
0
        public bool IsPalletPresentOnEES(Model.EESData objEESData)
        {
            bool isPresent = false;

            if (objOPCServerDirector == null)
            {
                objOPCServerDirector = new OPCServerDirector();
            }

            isPresent = objOPCServerDirector.ReadTag <bool>(objEESData.machineChannel + "." + objEESData.machineCode + ".Pallet_Present_Prox_NE");
            isPresent = isPresent || objOPCServerDirector.ReadTag <bool>(objEESData.machineChannel + "." + objEESData.machineCode + ".Pallet_Present_Prox_SW");


            return(isPresent);
        }
 public bool CheckEESClear(Model.EESData objEESData)
 {
     throw new NotImplementedException();
 }
 public int CheckError(Model.EESData objEESData)
 {
     throw new NotImplementedException();
 }
        public bool TakePhoto(Model.EESData objEESData)
        {
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objEESData.queueId + ":Entered TakePhoto");
            if (objEESDaoService == null)
            {
                objEESDaoService = new EESDaoImp();
            }
            if (objUtilityClass == null)
            {
                objUtilityClass = new UtilityClass();
            }

            try
            {
                //string northimg =null;
                //string southimg = null;
                string imagePath           = GlobalValues.IMG_DIR;
                string cameraConfigXmlName = "eft_config\\CameraNodes.xml";
                string cuurDate            = System.DateTime.Now.Date.Date.Day + "_" + System.DateTime.Now.Date.Date.Month + "_" + System.DateTime.Now.Date.Date.Year;
                string northimg            = objEESData.queueId + "_" + objEESData.customerPkId + "_" + cuurDate + "_" + "north.jpg";
                string southimg            = objEESData.queueId + "_" + objEESData.customerPkId + "_" + cuurDate + "_" + "south.jpg";
                string northFullPath       = null;
                string southFullPath       = null;
                if (objEESData.isEntry)
                {
                    northFullPath = imagePath + "\\" + northimg;
                    southFullPath = imagePath + "\\" + southimg;
                }
                else
                {
                    northFullPath = imagePath + "\\" + northimg;
                    southFullPath = imagePath + "\\" + southimg;
                }

                string northImgOPCMachine = objEESData.eesName + "_North";
                string southImgOPCMachine = objEESData.eesName + "_South";

                // Define a delegate that prints and returns the system tick count
                Func <object, bool> north = (object obj) =>
                {
                    //  using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetCamOPCServerConnection()))
                    //   {

                    try
                    {
                        //  opcd.WriteTagToCamOpc<bool>(northImgOPCMachine + "." + OpcTags.EES_Cam_GetCmd, true);
                        //  northimg = opcd.ReadTagFromCamOpc<string>(northImgOPCMachine + "." + OpcTags.EES_Cam_ImgPath);

                        if (BasicConfig.GetXmlAttributeValueOfTag(cameraConfigXmlName, "Node", "Name", northImgOPCMachine, "Active").Equals("true"))
                        {
                            objUtilityClass.CaptureImage(BasicConfig.GetXmlAttributeValueOfTag(cameraConfigXmlName, "Node", "Name", northImgOPCMachine, "IP"), northFullPath);
                        }
                        //if (!string.IsNullOrEmpty(opcd.GetCamOpcError("EES" + eesNumber + "_North.Error")))
                        //break;
                    }
                    finally
                    {
                        //opcd.WriteTagToCamOpc<bool>(northImgOPCMachine + "." + OpcTags.EES_Cam_GetCmd, true);
                    }

                    // }
                    return(true);
                };

                // Define a delegate that prints and returns the system tick count
                Func <object, bool> south = (object obj) =>
                {
                    //using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetCamOPCServerConnection()))
                    //{

                    try
                    {
                        //opcd.WriteTagToCamOpc<bool>(southImgOPCMachine + "." + OpcTags.EES_Cam_GetCmd, true);
                        //southimg = opcd.ReadTagFromCamOpc<string>(southImgOPCMachine + "." + OpcTags.EES_Cam_ImgPath);
                        if (BasicConfig.GetXmlAttributeValueOfTag(cameraConfigXmlName, "Node", "Name", southImgOPCMachine, "Active").Equals("true"))
                        {
                            objUtilityClass.CaptureImage(BasicConfig.GetXmlAttributeValueOfTag(cameraConfigXmlName, "Node", "Name", southImgOPCMachine, "IP"), southFullPath);
                        }
                        //if (!string.IsNullOrEmpty(opcd.GetCamOpcError("EES" + eesNumber + "_North.Error")))
                        //break;
                    }
                    finally
                    {
                        //opcd.WriteTagToCamOpc<bool>(southImgOPCMachine + "." + OpcTags.EES_Cam_GetCmd, false);
                    }

                    // }
                    return(true);
                };

                Task <bool>[] tasks = new Task <bool> [2];
                tasks[0] = Task <bool> .Factory.StartNew(north, 1);

                tasks[1] = Task <bool> .Factory.StartNew(south, 1);


                // Wait for all the tasks to finish.
                // Task.WaitAll(tasks);

                if (!string.IsNullOrEmpty(northimg))
                {
                    northimg = new FileInfo(northimg).Name;
                }

                if (!string.IsNullOrEmpty(southimg))
                {
                    southimg = new FileInfo(southimg).Name;
                }


                objEESDaoService.UpdatePhotoPathToCustomerTable(objEESData, southimg, northimg);
            }
            catch (Exception errMsg)
            {
                Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objEESData.queueId + ":Error in TakePhoto: " + errMsg.Message);
            }
            finally
            {
            }
            Logger.WriteLogger(GlobalValues.PARKING_LOG, "Queue Id:" + objEESData.queueId + ":Exitting  TakePhoto");
            return(true);
        }