Ejemplo n.º 1
0
        //
        public static void SaveopcXML()
        {
            try
            {
                string sPath = "D:/OpcXML/data.xml";
                ZipFile(sPath);

                FileStream   fs          = new FileStream("D:/OpcXML/data.zip", FileMode.Open);
                BinaryReader br          = new BinaryReader(fs);
                Byte[]       byData      = br.ReadBytes((int)fs.Length);
                string       sData       = System.Text.Encoding.UTF8.GetString(byData);
                DateTime     dt_value    = DateTime.Now;
                string       sCreateTime = dt_value.Year.ToString("000#") +
                                           dt_value.Month.ToString("0#") +
                                           dt_value.Day.ToString("0#") +
                                           dt_value.Hour.ToString("0#") +
                                           dt_value.Minute.ToString("0#") +
                                           dt_value.Second.ToString("0#");
                //rawtohex()
                fs.Dispose();//释放资源
                DeleteFile("D:/OpcXML/data.zip");
                OdbcHelper.OracleExeQuery("update U_WIPPROCDATA set FILE_DATA=:zp, CREATE_TIME=" + sCreateTime + ",CREATE_USER_ID='1111' where FACTORY ='15车间' AND LOT_ID ='1'", byData);

                fs.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
        }