Esempio n. 1
0
        public static Boolean fnIniciarLectorSonda(string bytPosID, string strHost, out Forecourt fc, out IFCConfig ifc, string idmaquina)
        {
            fc  = new Forecourt();
            ifc = null;

            //fc.TankGaugeCfgChanged += new _IForecourtEvents_TankGaugeCfgChangedEventHandler(FC_TankGaugeCfgChanged);
            string logon = "POS,UNSO_FPSTA_2,APPL_ID=" + idmaquina;

            fc.PosId    = Convert.ToByte(bytPosID);
            fc.HostName = strHost;
            fc.Disconnect();
            string strEstadoSonda = "Initialize";

            fc.Initialize();
            strEstadoSonda = "Logon";

            ifc = (IFCConfig)fc;
            int          cnt          = 0;
            bool         auxLogon     = false;
            FcLogonParms objParametro = new FcLogonParms();

            do
            {
                cnt++;
                try
                { objParametro.EnableFcEvent(FcEvents.xxxxCfgChanged);
                  fc.FcLogon2(logon, objParametro);
                  auxLogon = true; }
                catch
                {
                    if (cnt == 3)
                    {
                        throw new Exception("Intento de Conexión 3 veces fallida" + strEstadoSonda);
                    }
                    Thread.Sleep(1000); // Pausa de 1 segundo para reintentar el Logon
                }
            } while ((cnt < 3) && !auxLogon);

            return(auxLogon);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //Conexión de prueba
            Forecourt fc = new Forecourt();

            fc.PosId    = 60;
            fc.HostName = "83.56.16.44";
            FcLogonParms fcLogonParams = new FcLogonParms();

            fc.Disconnect();
            fc.Initialize();
            IDomsPos idp = (IDomsPos)fc;

            fcLogonParams.EnableFcEvent(FcEvents.xxxxCfgChanged);
            fcLogonParams.EnableFcEvent(FcEvents.TankGaugeStatusChanged);
            fc.FcLogon2("POS,UNSO_TGSTA_2,RI,APPL_ID=SvcTPVCOFO", fcLogonParams);

            //Llamar a método estático desde libreria DOMSLibrary
            string path = Assembly.GetExecutingAssembly().Location;

            path = path.Substring(0, (path.Length - 16));
            string     lib    = "DOMSLibrary";
            Assembly   ass    = Assembly.LoadFile(path + "Lib\\" + lib + ".dll");//Ruta de DOMSLibrary.dll
            Type       tipo   = ass.GetType(lib + ".DOMSTankGaugeAlarms");
            MethodInfo metodo = tipo.GetMethod("GetTankGaugeAlarmTxt");
            //Ejecutar el metodo y guardar el retorno
            string resultado = metodo.Invoke(null, new object[] { idp, (byte)3 }).ToString();

            Console.WriteLine("TEST20180618: " + resultado);

            Console.WriteLine("\nA la espera.\nPulse Esc para salir...\n");
            while (Console.ReadKey().Key != ConsoleKey.Escape)
            {
                ;
            }
        }
Esempio n. 3
0
        public string fnGetAlarm(string pstrHost, string pbytPosId, string pscompany, string pstoreID, string psUserID, string pstrMaquina, Forecourt fc0, IFCConfig ifc0)
        {
            AlarmTank           objAlarmTank = null;
            List <AlarmTank>    lstAlarmTank = null;
            TankGaugeCollection tgcSondaa    = null;
            string       json           = "";
            string       strFechaIso    = "";
            TgMainStates tmsMainState   = 0;
            byte         bytStatus      = 0;
            int          intAlarmStatus = 0;

            try
            {
                Thread.Sleep(5000);
                fc0.EventsDisabled = false;
                tgcSondaa          = (TankGaugeCollection)ifc0.TankGauges;

                if (tgcSondaa.Count > 0)
                {
                    lstAlarmTank = new List <AlarmTank>();
                    strFechaIso  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                    foreach (PSS_Forecourt_Lib.TankGauge tgesondaa2 in tgcSondaa)
                    {
                        tgesondaa2.GetStatus(out tmsMainState, out bytStatus, out intAlarmStatus);

                        if (Convert.ToByte(TgStatusBits.TGS_ALARM) == bytStatus)
                        {
                            objAlarmTank             = new AlarmTank();
                            objAlarmTank.Ncompany    = pscompany;
                            objAlarmTank.StoreID     = pstoreID;
                            objAlarmTank.Date        = strFechaIso;
                            objAlarmTank.UserID      = psUserID;
                            objAlarmTank.TgID        = tgesondaa2.Id;
                            objAlarmTank.bitAlarm    = bytStatus;
                            objAlarmTank.AlarmStatus = intAlarmStatus;
                            lstAlarmTank.Add(objAlarmTank);
                        }
                    }
                    json = TransformJson(lstAlarmTank);
                }
                else
                {
                    json = "";
                }

                return(json);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 4
0
 protected DOMSController()
 {
     Forecourt = new Forecourt();
     IFCConfig = (IFCConfig)Forecourt;
 }