Ejemplo n.º 1
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();
     }
 }
Ejemplo n.º 2
0
        public void Execute(IJobExecutionContext context)
        {
            MonitorDurationDal    DataAccess = new MonitorDurationDal();
            List <KPI_UnitEntity> UnitList   = KPI_UnitDal.GetAllEntity();

            foreach (KPI_UnitEntity Unit in UnitList)
            {
                if (String.IsNullOrEmpty(Unit.WorkID))
                {
                    return;
                }
                if (UnitIsRunning(Unit.UnitID))
                {
                    m_Loger.InfoFormat("开始计算{0}操盘时间", Unit.UnitName);
                    MonitorDurationEntity MonitorDuration = new MonitorDurationEntity();
                    DateTime Now              = DateTime.Now;
                    String   strStartTime     = "";
                    String   strEndTime       = "";
                    String   Shift            = "";
                    String   Period           = "";
                    String   strCurrentMinute = Now.ToString("yyyy-MM-dd HH:mm:00");
                    KPI_WorkDal.GetShiftAndPeriod(Unit.WorkID, strCurrentMinute,
                                                  ref Shift, ref Period, ref strStartTime, ref strEndTime);
                    DateTime ShiftStartTime = Convert.ToDateTime(strStartTime);
                    DateTime ShiftEndTime   = Convert.ToDateTime(strEndTime);
                    MonitorDuration.UnitID    = Unit.UnitID;
                    MonitorDuration.Shift     = Shift;
                    MonitorDuration.CheckDate = Now.Date;
                    MonitorDuration.Duration  = GetDuration(ShiftStartTime, ShiftEndTime);
                    m_Loger.InfoFormat("{0}值值班开始时间{1}值班结束时间{2}当天操盘时长是{3}小时", Shift, ShiftStartTime, ShiftEndTime, MonitorDuration.Duration);
                    DataAccess.SaveMonitorDuration(MonitorDuration);
                    m_Loger.InfoFormat("{0}操盘时间计算结束", Unit.UnitName);
                }
            }
        }
Ejemplo n.º 3
0
        private List <SystemParameterEntity> GetDataSource()
        {
            KPI_SystemDal DataAccess = new KPI_SystemDal();
            List <SystemParameterEntity> List = new List <SystemParameterEntity>();
            SystemParameterEntity        SystemParameter, Param;
            List <KPI_UnitEntity>        UnitList = KPI_UnitDal.GetAllEntity();

            foreach (KPI_UnitEntity Unit in UnitList)
            {
                SystemParameter = DataAccess.GetSystemParameter(Unit.UnitID);
                if (SystemParameter == null)
                {
                    SystemParameter         = new SystemParameterEntity();
                    SystemParameter.SysName = Unit.UnitID;
                    SystemParameter.SysDesc = Unit.UnitName + "奖金金额";
                }
                SystemParameter.SysCode = Unit.UnitCode;
                Param = DataAccess.GetSystemParameter(Unit.UnitCode);
                if (Param != null)
                {
                    SystemParameter.SysValue2 = Param.SysValue;
                }
                //SystemParameter.SysValue2 = DataAccess.GetSystemParameter(Unit.UnitCode).SysValue;
                List.Add(SystemParameter);
            }
            return(List);
        }
Ejemplo n.º 4
0
        private void ClientInitial()
        {
            List <KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity();

            //drpUnits.Items.Add(new ListItem("全厂", "00"));
            drpSUnits.Items.Add(new ListItem("【所有机组】", ""));
            foreach (KPI_UnitEntity Unit in UnitList)
            {
                drpSUnits.Items.Add(new ListItem(Unit.UnitName, Unit.UnitID));
                drpUnits.Items.Add(new ListItem(Unit.UnitName, Unit.UnitID));
            }

            DataTable Shifts = KPI_ShiftDal.GetShifts();

            drpSShifts.Items.Add(new ListItem("【所有值次】", ""));
            foreach (DataRow dr in Shifts.Rows)
            {
                drpShifts.Items.Add(new ListItem(dr["Name"] + "值", dr["Name"] + ""));
                drpSShifts.Items.Add(new ListItem(dr["Name"] + "值", dr["Name"] + ""));
            }
            Shifts.Dispose();

            DataTable PositionTable = KPI_PositionDal.GetDataTable();

            foreach (DataRow dr in PositionTable.Rows)
            {
                drpPositions.Items.Add(new ListItem(dr["PositionName"] + "", dr["PositionID"] + ""));
            }
            PositionTable.Dispose();
        }
Ejemplo n.º 5
0
        private String GetWorkID()
        {
            String Result = "";
            List <KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity();

            if (UnitList.Count > 0)
            {
                Result = UnitList.First().WorkID;
            }
            return(Result);
        }
Ejemplo n.º 6
0
        public void Execute(IJobExecutionContext context)
        {
            MonitorDurationEntity MonitorDuration = new MonitorDurationEntity();
            DateTime Now              = DateTime.Now;
            decimal  Hours            = Now.Hour + Now.Minute / 60.0m;
            String   strStartTime     = "";
            String   strEndTime       = "";
            String   Shift            = "";
            String   Period           = "";
            String   strCurrentMinute = Now.AddMinutes(-2).ToString("yyyy-MM-dd HH:mm:00");

            try {
                KPI_WorkDal.GetShiftAndPeriod(WorkID, strCurrentMinute,
                                              ref Shift, ref Period, ref strStartTime, ref strEndTime);
                DateTime ShiftStartTime = Convert.ToDateTime(strStartTime);
                DateTime CurrentTime    = DateTime.Now;
                TimeSpan Span           = CurrentTime - ShiftStartTime;
                MonitorDuration.Shift     = Shift;
                MonitorDuration.CheckDate = Now.AddMinutes(-1);
                MonitorDuration.Duration  = 0.5m;
                //if ((Hours > 16.5m) && (Hours <= 24.0m)) MonitorDuration.Duration = 7.5m;//SET @Duration=7.5
                //if ((Hours >= 0.0m) && (Hours <= 0.5m)) MonitorDuration.Duration = 0.5m;
                List <KPI_UnitEntity> Units = KPI_UnitDal.GetAllEntity();

                using (MonitorDurationDal DataAccess = new MonitorDurationDal()) {
                    foreach (KPI_UnitEntity Unit in Units)
                    {
                        MonitorDuration.UnitID = Unit.UnitID;
                        DataAccess.SaveMonitorDuration(MonitorDuration);
                    }
                }
            }
            catch (Exception ex) {
                m_Log.Error("各值监盘时间计算错误", ex);
            }
        }