Example #1
0
        public static void Add()
        {
            List <TVD> TVDs = new List <TVD>();

            for (int i = 0; i < Current.ovens.Count; i++)
            {
                if (Current.ovens[i].IsAlive)
                {
                    for (int j = 0; j < Current.ovens[i].Floors.Count; j++)
                    {
                        if (Current.ovens[i].Floors[j].IsBaking)
                        {
                            for (int k = 0; k < Current.ovens[i].Floors[j].Stations.Count; k++)
                            {
                                TVD tvd = new TVD();
                                tvd.StationId  = Current.ovens[i].Floors[j].Stations[k].Id;
                                tvd.UserId     = TengDa.WF.Current.user.Id;
                                tvd.RunMinutes = Current.ovens[i].Floors[j].RunMinutes;
                                tvd.T          = Current.ovens[i].Floors[j].Stations[k].Temperatures;
                                tvd.V1         = Current.ovens[i].Floors[j].Vacuum;
                                TVDs.Add(tvd);
                            }
                        }
                    }
                }
            }
            string msg = string.Empty;

            if (!TVD.Add(TVDs, out msg))
            {
                Error.Alert(msg);
            }
        }
Example #2
0
        public static void ClearOldDbData()
        {
            try
            {
                new Thread(() =>
                {
                    string msg = "";

                    if (AlarmLog.GetCount(out msg) > 21000)
                    {
                        AlarmLog.DeleteLongAgo(out msg);
                    }

                    if (Battery.GetCount(out msg) > 110000)
                    {
                        Battery.DeleteLongAgo(out msg);
                    }

                    if (Clamp.GetCount(out msg) > 11000)
                    {
                        Clamp.DeleteLongAgo(out msg);
                    }

                    if (FloorLog.GetCount(out msg) > 11000)
                    {
                        FloorLog.DeleteLongAgo(out msg);
                    }

                    if (TaskLog.GetCount(out msg) > 11000)
                    {
                        TaskLog.DeleteLongAgo(out msg);
                    }

                    if (TVD.GetCount(out msg) > 210000)
                    {
                        TVD.DeleteLongAgo(out msg);
                    }
                }).Start();
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("删除数据库中较早的数据失败,msg:" + ex.ToString());
            }
        }