Пример #1
0
        public DevMonitorNodeHistory ToHistory()
        {
            DevMonitorNodeHistory history = new DevMonitorNodeHistory();

            history.TagName   = this.TagName;
            history.DbTagName = this.DbTagName;
            history.Describe  = this.Describe;
            history.Value     = this.Value;
            history.Unit      = this.Unit;
            history.DataType  = this.DataType;
            history.KKS       = this.KKS;
            history.ParentKKS = this.ParentKKS;
            history.Time      = this.Time;

            return(history);
        }
Пример #2
0
        private void SaveSisToDb(List <sis> sisList, bool isSaveToHistory, Action <List <DevMonitorNode> > callback)
        {
            List <DevMonitorNode> monitorNodes = new List <DevMonitorNode>();

            try
            {
                foreach (sis item in sisList)
                {
                    string strTag = item.kks;
                    //DevMonitorNode Dmn = bll.DevMonitorNodes.DbSet.Where(p => p.KKS == item.kks).FirstOrDefault();
                    DevMonitorNode Dmn = bll.DevMonitorNodes.DbSet.Where(p => p.TagName == strTag).FirstOrDefault();
                    if (Dmn == null)
                    {
                        continue;
                    }
                    Dmn.Value = item.value;
                    Dmn.Time  = item.t + nEightHourSecond;
                    bll.DevMonitorNodes.Edit(Dmn);//修改数据库数据
                    monitorNodes.Add(Dmn);
                }

                if (isSaveToHistory)
                {
                    foreach (var mn in monitorNodes)
                    {
                        DevMonitorNodeHistory Dmnh = mn.ToHistory();
                        bll.DevMonitorNodeHistorys.Add(Dmnh);
                    }
                }
            }
            catch (Exception ex)
            {
                string messgae = ex.Message;
                Log.Error(LogTags.KKS, "SaveSisToDb:" + ex);
            }
            if (callback != null)
            {
                callback(monitorNodes);
            }
        }