Esempio n. 1
0
 public static void Load_To_AQT_Database(OPCField F, float Value, DateTime time, MySqlConnection conn)
 {
     MySqlCommand c = new MySqlCommand("INSERT INTO opc_data (Value,Time,ID) VALUES (@val,@t,@id)", conn);
     c.Parameters.Add(FillP("@val", Value, MySqlDbType.Float));
     c.Parameters.Add(FillP("@id", F.ID, MySqlDbType.Int32));
     c.Parameters.Add(FillP("@t", time, MySqlDbType.DateTime));
     //c.Parameters.Add(FillParam("@st", d.fieldinfo.StationInfo.StationID, conn, System.Data.SqlDbType.TinyInt));
     c.ExecuteNonQuery();
 }
Esempio n. 2
0
        public static OPCField GetFieldInfo(string Name, MySqlConnection conn)
        {
            MySqlCommand c = new MySqlCommand("SELECT * from fields WHERE Name =" + Name, conn);
            OPCField Field = null;

            MySqlDataReader reader = c.ExecuteReader();

            if (reader.Read())
            {
                Field = new OPCField();
                Field.ID = (short)reader["ID"];
                Field.Name = (string)reader["Name"];
                Field.Scale = (float)reader["Scale"];
            }
            return Field;
        }
Esempio n. 3
0
        public static void FieldInsert(OPCField F, MySqlConnection Conn)
        {
            MySqlCommand c = new MySqlCommand("INSERT INTO fields (Scale,Name,StationID,StationTypeID,ChamberTypeID, Type,Units) VALUES (@sc, @nm, @SID, @STID,@CHTID,@TI,@Un)", Conn);
            c.Parameters.Add(FillP( "@sc", F.Scale, MySqlDbType.Float ));
            c.Parameters.Add(FillP( "@nm", F.Name, MySqlDbType.VarChar ));
            c.Parameters.Add(FillP( "@SID", F.StationID, MySqlDbType.Int32 ));
            c.Parameters.Add(FillP( "@STID", F.StationTypeID, MySqlDbType.Int32 ));
            c.Parameters.Add(FillP( "@CHTID", F.ChamberTypeID, MySqlDbType.Int32 ));
            c.Parameters.Add(FillP("@TI", F.Type, MySqlDbType.VarChar));
            c.Parameters.Add(FillP("@Un", F.Units, MySqlDbType.VarChar));
            //UNITS
            //Comments
            //AQT_Name

            c.ExecuteNonQuery();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ToolServer = string.Format(ToolServerF, @"C:\Users\administrator.AQTSOLAR\Desktop\Intevac_Access_Databases\ToolServer.mdb");
                CellWork = string.Format(CellWorkF, @"C:\Users\administrator.AQTSOLAR\Desktop\Intevac_Access_Databases\CellWork.mdb");
            }
            else
            {
                ToolServer = string.Format(ToolServerF, args[0]);
                CellWork = string.Format(CellWorkF, args[1]);
            }

            Console.WriteLine(string.Format("using Tool Server File: {0}",ToolServer ));
            Console.WriteLine(string.Format("using Cell Work File: {0}", CellWork)) ;

            Thread.Sleep(1000);

            List<OPCField_ex> OPCFields = new List<OPCField_ex>();

            //Get the list of stations and the cahmber type for each station
             StationInfoList = GetDistinctStations(CellWork);

            //add all available OPC fields for each station
               // foreach (OPCStationInfo station in StationInfoList)
               // {
               //     OPCFields.AddRange(ProcessDataQuery(station, ToolServer));
               // }

            GetFromItemTable( OPCFields , ToolServer );

            MySqlConnection Conn = AQT_Database.GetMYSQLConnection();
            Conn.Open();
            int StationID = -1;

            foreach (OPCField_ex o in OPCFields)
            {
                OPCField F = new OPCField();
                F.StationID = StationID;
                F.StationTypeID = StationID;
                F.ChamberTypeID = StationID;
                if (o.StationInfo != null)
                {
                    F.StationID = o.StationInfo.StationID;
                    F.StationTypeID = o.StationInfo.StationTypeID;
                    F.ChamberTypeID = o.StationInfo.ChamberTypeID;
                }
                F.Type = o.Type;
                F.Name = o.OPC_Lookup;
                F.Scale = o.ScaleFactor;
                F.Units = o.units;
                Console.WriteLine("added: " + F.Name);
                AQT_Database.FieldInsert(F, Conn);
            }
            Conn.Close();
        }