コード例 #1
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        void BindValues()
        {
            string UnitID = ViewState["unitid"].ToString();

            KPI_UnitEntity mEntity = KPI_UnitDal.GetEntity(UnitID);

            ddl_PlantID.Value     = mEntity.PlantID;
            txt_UnitCode.Value    = mEntity.UnitCode;
            txt_UnitName.Value    = mEntity.UnitName;
            txt_UnitDesc.Value    = mEntity.UnitDesc;
            txt_UnitIndex.Value   = mEntity.UnitIndex.ToString();
            txt_UnitPrefix.Value  = mEntity.UnitPrefix;
            ddl_UnitIsValid.Value = mEntity.UnitIsValid.ToString();

            txt_UnitMW.Value    = mEntity.UnitMW.ToString();
            txt_UnitMWTag.Value = mEntity.UnitMWTag;

            txt_UnitCondition.Value  = mEntity.UnitCondition;
            ddl_UnitIsKPI.Value      = mEntity.UnitIsKPI.ToString();
            ddl_UnitIsSnapshot.Value = mEntity.UnitIsSnapshot.ToString();
            ddl_UnitIsSort.Value     = mEntity.UnitIsSort.ToString();
            ddl_UnitIsSecurity.Value = mEntity.UnitIsSecurity.ToString();
            ddl_UnitIsPower.Value    = mEntity.UnitIsPower.ToString();

            if (mEntity.WorkID == null || mEntity.WorkID == "")
            {
                ddl_UnitWorkID.Value = "NULL";
            }
            else
            {
                ddl_UnitWorkID.Value = mEntity.WorkID;
            }

            txt_UnitNote.Value = mEntity.UnitNote;
        }
コード例 #2
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (!IsPostBack)
     {
         String strStartTime            = "";
         String strEndTime              = "";
         String CurrentShift            = "";
         String Period                  = "";
         List <KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity();
         if (UnitList.Count > 0)
         {
             String         UnitID = UnitList.First().UnitID;
             KPI_UnitEntity Entity = KPI_UnitDal.GetEntity(UnitID);
             if (Entity != null)
             {
                 String strWorkID        = Entity.WorkID;
                 String strCurrentMinute = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00");
                 KPI_WorkDal.GetShiftAndPeriod(strWorkID, strCurrentMinute,
                                               ref CurrentShift, ref Period, ref strStartTime, ref strEndTime);
             }
             lblShift.Text  = CurrentShift;
             Shift          = CurrentShift;
             ShiftStartTime = Convert.ToDateTime(strStartTime);
             ShiftEndTime   = Convert.ToDateTime(strEndTime);
         }
         DataBind();
     }
 }
コード例 #3
0
        /// <summary>
        /// 获取班次与值次
        /// </summary>
        /// <param name="UnitID">机组编码</param>
        /// <param name="Shift">当前值</param>
        /// <param name="Period">当前班</param>
        private void GetShiftAndPeriod(String UnitID, out String Shift, out String Period, DateTime CalcTime)
        {
            String strStartTime = "";
            String strEndTime   = "";

            Shift  = "";
            Period = "";
            KPI_UnitEntity Entity = KPI_UnitDal.GetEntity(UnitID);

            if (Entity == null)
            {
                return;
            }
            try
            {
                String strWorkID        = Entity.WorkID;
                String strCurrentMinute = CalcTime.ToString("yyyy-MM-dd HH:mm:00");
                KPI_WorkDal.GetShiftAndPeriod(strWorkID, strCurrentMinute,
                                              ref Shift, ref Period, ref strStartTime, ref strEndTime);
            }
            catch (Exception ex)
            {
                m_Logger.Error(ex.Message, ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// 交接时关闭上一班报警
        /// </summary>
        /// <param name="faultConfiguration"></param>
        private void StopLastShiftAlarm(OverLimitConfigEntity faultConfiguration)
        {
            KPI_UnitEntity Entity = KPI_UnitDal.GetEntity(faultConfiguration.UnitID);

            if (Entity == null)
            {
                return;
            }
            String strWorkID        = Entity.WorkID;
            String strStartTime     = "";
            String strEndTime       = "";
            String Shift            = "";
            String Period           = "";
            String strCurrentMinute = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00");

            KPI_WorkDal.GetShiftAndPeriod(strWorkID, strCurrentMinute,
                                          ref Shift, ref Period, ref strStartTime, ref strEndTime);
            DateTime ShiftStartTime = Convert.ToDateTime(strStartTime);
            DateTime CurrentTime    = DateTime.Now;
            TimeSpan Span           = CurrentTime - ShiftStartTime;
            double   TotalMinutes   = Span.TotalMinutes;

            if (TotalMinutes <= 10)
            {
                try {
                    using (KPI_OverLimitRecordDal DataAccess = new KPI_OverLimitRecordDal()) {
                        KPI_OverLimitRecordEntity entity = new KPI_OverLimitRecordEntity();
                        for (int i = 1; i < 4; i++)
                        {
                            entity.TagID          = faultConfiguration.TagName;
                            entity.AlarmStartTime = ShiftStartTime;
                            entity.AlarmType      = i;
                            DataAccess.UpdateOverLimitRecord(entity);
                        }
                    }
                }
                catch (Exception ex) {
                    m_Logger.InfoFormat("StopLastShiftAlarm安全指标超限报警计算错误,错误信息是:{0},调用栈信息是:{1}",
                                        ex.Message, ex.StackTrace);
                    m_Logger.Error(ex);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// 获取班次与值次
        /// </summary>
        /// <param name="UnitID">机组编码</param>
        /// <param name="Shift">当前值</param>
        /// <param name="Period">当前班</param>
        private void GetShiftAndPeriod(String UnitID, out String Shift, out String Period)
        {
            String strStartTime = "";
            String strEndTime   = "";

            Shift  = "";
            Period = "";
            KPI_UnitEntity Entity = KPI_UnitDal.GetEntity(UnitID);

            if (Entity == null)
            {
                return;
            }
            String strWorkID        = Entity.WorkID;
            String strCurrentMinute = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00");

            KPI_WorkDal.GetShiftAndPeriod(strWorkID, strCurrentMinute,
                                          ref Shift, ref Period, ref strStartTime, ref strEndTime);
        }
コード例 #6
0
ファイル: SACalculate.cs プロジェクト: jht1983/SISKPI
        private CurrentWorkInfo GetWorkInfo(String unitID, DateTime CalcDateTime)
        {
            CurrentWorkInfo Result = new CurrentWorkInfo();
            KPI_UnitEntity  Entity = KPI_UnitDal.GetEntity(unitID);

            Result.WorkID = Entity.WorkID;
            String strStartTime     = "";
            String strEndTime       = "";
            String Shift            = "";
            String Period           = "";
            String strCurrentMinute = CalcDateTime.ToString("yyyy-MM-dd HH:mm:00");

            KPI_WorkDal.GetShiftAndPeriod(Result.WorkID, strCurrentMinute,
                                          ref Shift, ref Period, ref strStartTime, ref strEndTime);
            Result.Shift     = Shift;
            Result.Period    = Period;
            Result.StartTime = Convert.ToDateTime(strStartTime);
            Result.EndTime   = Convert.ToDateTime(strEndTime);
            return(Result);
        }
コード例 #7
0
        private bool UnitIsRunning(String UnitID)
        {
            bool Result = false;

            //m_Logger.InfoFormat("机组编码{0}", UnitID);
            if (String.IsNullOrEmpty(UnitID))
            {
                return(Result);
            }
            if (m_Cache.ContainsKey(UnitID))
            {
                return(m_Cache[UnitID]);
            }
            KPI_UnitEntity item = KPI_UnitDal.GetEntity(UnitID);

            if (item != null)
            {
                Result = ExpCurrentValue(item.UnitCondition) > 0;
            }
            m_Cache.Add(UnitID, Result);
            m_Logger.InfoFormat("机组{0}的运行条件是:{1}", UnitID, item.UnitCondition);
            return(Result);
        }