首页数据绑定
This commit is contained in:
		
							parent
							
								
									09194dae85
								
							
						
					
					
						commit
						cab3443c9f
					
				| 
						 | 
				
			
			@ -1676,3 +1676,21 @@ IP地址:::1
 | 
			
		|||
 | 
			
		||||
出错时间:02/01/2023 15:55:02
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
错误信息开始=====>
 | 
			
		||||
错误类型:NullReferenceException
 | 
			
		||||
错误信息:未将对象引用设置到对象的实例。
 | 
			
		||||
错误堆栈:
 | 
			
		||||
   在 FineUIPro.Web.indexProject.Page_Load(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\indexProject.aspx.cs:行号 354
 | 
			
		||||
   在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
 | 
			
		||||
   在 System.EventHandler.Invoke(Object sender, EventArgs e)
 | 
			
		||||
   在 System.Web.UI.Control.OnLoad(EventArgs e)
 | 
			
		||||
   在 System.Web.UI.Control.LoadRecursive()
 | 
			
		||||
   在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 | 
			
		||||
出错时间:02/14/2023 15:08:41
 | 
			
		||||
出错文件:http://localhost:8119/indexProject.aspx
 | 
			
		||||
IP地址:::1
 | 
			
		||||
 | 
			
		||||
出错时间:02/14/2023 15:08:41
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,8 @@
 | 
			
		|||
using Newtonsoft.Json;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Data.SqlClient;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Web.UI;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -77,24 +79,52 @@ namespace FineUIPro.Web.common
 | 
			
		|||
        private void getSitePerson()
 | 
			
		||||
        {
 | 
			
		||||
            OnDutyRate = 0;
 | 
			
		||||
            int AllCount = 0;
 | 
			
		||||
            int MCount = 0;
 | 
			
		||||
            //int AllCount = 0;
 | 
			
		||||
            //int MCount = 0;
 | 
			
		||||
            var getallin = APIPageDataService.getPersonInOutAllNum(DateTime.Now.AddDays(-1));
 | 
			
		||||
            AllCount = getallin.Count();
 | 
			
		||||
            if (AllCount > 0)
 | 
			
		||||
            //AllCount = getallin.Count();
 | 
			
		||||
            //if (AllCount > 0)
 | 
			
		||||
            //{
 | 
			
		||||
            //    MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count();
 | 
			
		||||
            //    /////管理人数
 | 
			
		||||
            //    this.divGLPerson.InnerHtml = MCount.ToString();
 | 
			
		||||
            //    /////作业人数
 | 
			
		||||
            //    this.divZYPerson.InnerHtml = (AllCount - MCount).ToString();
 | 
			
		||||
            //    int getPersonCount=Funs.DB.SitePerson_Person.Where(x => x.IsUsed == 1  && x.CardNo.Length > 1 
 | 
			
		||||
            //    && x.InTime <= DateTime.Now && !x.OutTime.HasValue && x.AuditorDate.HasValue).Count();
 | 
			
		||||
            //    if (getPersonCount > 0)
 | 
			
		||||
            //    {
 | 
			
		||||
            //        OnDutyRate = Math.Round(AllCount * 1.0 / getPersonCount * 100, 1);
 | 
			
		||||
            //    }
 | 
			
		||||
            //}
 | 
			
		||||
 | 
			
		||||
            string sql = @"select c.ConstText,b.PostType,count( *) num from SitePerson_Person a left join Base_WorkPost b on a.WorkPostId=b.WorkPostId 
 | 
			
		||||
                         LEFT JOIN Sys_Const AS c ON c.ConstValue = b.PostType and   c.GroupId = 'PostType' where IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
 | 
			
		||||
                         and AuditorDate is not null
 | 
			
		||||
                        group by c.ConstText,b.PostType  ";
 | 
			
		||||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
			
		||||
            SqlParameter[] parameter = listStr.ToArray();
 | 
			
		||||
            DataTable tb = SQLHelper.GetDataTableRunText(sql, parameter);
 | 
			
		||||
            int allcount = 0;
 | 
			
		||||
            int mcount = 0;
 | 
			
		||||
            if (tb != null)
 | 
			
		||||
            {
 | 
			
		||||
                MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count();
 | 
			
		||||
                /////管理人数
 | 
			
		||||
                this.divGLPerson.InnerHtml = MCount.ToString();
 | 
			
		||||
                /////作业人数
 | 
			
		||||
                this.divZYPerson.InnerHtml = (AllCount - MCount).ToString();
 | 
			
		||||
                int getPersonCount=Funs.DB.SitePerson_Person.Where(x => x.IsUsed == 1  && x.CardNo.Length > 1 
 | 
			
		||||
                && x.InTime <= DateTime.Now && !x.OutTime.HasValue && x.AuditorDate.HasValue).Count();
 | 
			
		||||
                if (getPersonCount > 0)
 | 
			
		||||
                foreach (DataRow row in tb.Rows)
 | 
			
		||||
                {
 | 
			
		||||
                    OnDutyRate = Math.Round(AllCount * 1.0 / getPersonCount * 100, 1);
 | 
			
		||||
                    allcount += int.Parse(row["num"].ToString());
 | 
			
		||||
                    if (!string.IsNullOrEmpty(row["ConstText"].ToString()) && row["ConstText"].ToString().Contains("管理"))
 | 
			
		||||
                    {
 | 
			
		||||
                        mcount += int.Parse(row["num"].ToString());
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //this.divALLPerson.InnerHtml = allcount.ToString();
 | 
			
		||||
            this.divGLPerson.InnerHtml = mcount.ToString();
 | 
			
		||||
            this.divZYPerson.InnerHtml = (allcount - mcount).ToString();
 | 
			
		||||
 | 
			
		||||
            OnDutyRate = Math.Round(getallin.Count() * 1.0 / allcount * 100, 1);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,24 +134,37 @@ namespace FineUIPro.Web.common
 | 
			
		|||
        /// </summary>
 | 
			
		||||
        private void getPersonWorkTime()
 | 
			
		||||
        {
 | 
			
		||||
            var getItem = (from x in Funs.DB.DigData_HSEDataCollectItem
 | 
			
		||||
                                    join y in Funs.DB.DigData_HSEDataCollect on x.HSEDataCollectId equals y.HSEDataCollectId
 | 
			
		||||
                                    where y.Year == DateTime.Now.Year && x.SortIndex == 7
 | 
			
		||||
                                    select x).FirstOrDefault();
 | 
			
		||||
            if (getItem != null)
 | 
			
		||||
            {
 | 
			
		||||
                int wHours = Funs.GetNewIntOrZero(getItem.Month1) + Funs.GetNewIntOrZero(getItem.Month2)
 | 
			
		||||
                    + Funs.GetNewIntOrZero(getItem.Month3) + Funs.GetNewIntOrZero(getItem.Month4)
 | 
			
		||||
                    + Funs.GetNewIntOrZero(getItem.Month5) + Funs.GetNewIntOrZero(getItem.Month6)
 | 
			
		||||
                    + Funs.GetNewIntOrZero(getItem.Month7) + Funs.GetNewIntOrZero(getItem.Month8)
 | 
			
		||||
                    + Funs.GetNewIntOrZero(getItem.Month9) + Funs.GetNewIntOrZero(getItem.Month10)
 | 
			
		||||
                    + Funs.GetNewIntOrZero(getItem.Month11) + Funs.GetNewIntOrZero(getItem.Month12);
 | 
			
		||||
                if (wHours > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    this.divSafeWorkTime.InnerHtml = wHours.ToString("0000000000");
 | 
			
		||||
                }
 | 
			
		||||
            }                     
 | 
			
		||||
            //var getItem = (from x in Funs.DB.DigData_HSEDataCollectItem
 | 
			
		||||
            //                        join y in Funs.DB.DigData_HSEDataCollect on x.HSEDataCollectId equals y.HSEDataCollectId
 | 
			
		||||
            //                        where y.Year == DateTime.Now.Year && x.SortIndex == 7
 | 
			
		||||
            //                        select x).FirstOrDefault();
 | 
			
		||||
            //if (getItem != null)
 | 
			
		||||
            //{
 | 
			
		||||
            //    int wHours = Funs.GetNewIntOrZero(getItem.Month1) + Funs.GetNewIntOrZero(getItem.Month2)
 | 
			
		||||
            //        + Funs.GetNewIntOrZero(getItem.Month3) + Funs.GetNewIntOrZero(getItem.Month4)
 | 
			
		||||
            //        + Funs.GetNewIntOrZero(getItem.Month5) + Funs.GetNewIntOrZero(getItem.Month6)
 | 
			
		||||
            //        + Funs.GetNewIntOrZero(getItem.Month7) + Funs.GetNewIntOrZero(getItem.Month8)
 | 
			
		||||
            //        + Funs.GetNewIntOrZero(getItem.Month9) + Funs.GetNewIntOrZero(getItem.Month10)
 | 
			
		||||
            //        + Funs.GetNewIntOrZero(getItem.Month11) + Funs.GetNewIntOrZero(getItem.Month12);
 | 
			
		||||
            //    if (wHours > 0)
 | 
			
		||||
            //    {
 | 
			
		||||
            //        this.divSafeWorkTime.InnerHtml = wHours.ToString("0000000000");
 | 
			
		||||
            //    }
 | 
			
		||||
            //}                     
 | 
			
		||||
            this.divSafeWorkTime.InnerHtml = "0000000000";
 | 
			
		||||
            var ProjectTotal = (from x in Funs.DB.HSSE_MonthReportItem
 | 
			
		||||
                                join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
 | 
			
		||||
                                where  "安全生产人工时数" == x.ReportItem
 | 
			
		||||
                                select x.YearTotal).Sum();
 | 
			
		||||
 | 
			
		||||
            if (ProjectTotal.HasValue)
 | 
			
		||||
            {
 | 
			
		||||
                this.divSafeWorkTime.InnerHtml = ProjectTotal.Value.ToString("0000000000"); ;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                this.divSafeWorkTime.InnerHtml = "0000000000";
 | 
			
		||||
            }
 | 
			
		||||
            ///整改单          
 | 
			
		||||
            var getRectify =from x in Funs.DB.Check_RectifyNotices
 | 
			
		||||
                            where x.States !=Const.State_0 && x.States != null  && x.ProjectId != null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ namespace FineUIPro.Web.common
 | 
			
		|||
        private void getPersonWorkTime()
 | 
			
		||||
        {
 | 
			
		||||
            this.divSafeWorkTime.InnerHtml = "0000000000";
 | 
			
		||||
           var ProjectTotal = (from x in Funs.DB.HSSE_MonthReportItem
 | 
			
		||||
             var ProjectTotal = (from x in Funs.DB.HSSE_MonthReportItem
 | 
			
		||||
             join y in Funs.DB.HSSE_MonthReport on x.MonthReportId equals y.MonthReportId
 | 
			
		||||
             where y.ProjectId == this.ProjectId  && "安全生产人工时数" == x.ReportItem
 | 
			
		||||
                               select x.YearTotal).Sum();
 | 
			
		||||
| 
						 | 
				
			
			@ -120,8 +120,8 @@ namespace FineUIPro.Web.common
 | 
			
		|||
        {
 | 
			
		||||
 | 
			
		||||
            string sql = @"select c.ConstText,b.PostType,count( *) num from SitePerson_Person a left join Base_WorkPost b on a.WorkPostId=b.WorkPostId 
 | 
			
		||||
                         LEFT JOIN Sys_Const AS c ON c.ConstValue = b.PostType and   c.GroupId = 'PostType' and IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
 | 
			
		||||
                        where ProjectId='" + this.ProjectId + @"'
 | 
			
		||||
                         LEFT JOIN Sys_Const AS c ON c.ConstValue = b.PostType and   c.GroupId = 'PostType' where IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
 | 
			
		||||
                        and  a.ProjectId='" + this.ProjectId + @"' and a.AuditorDate is not null
 | 
			
		||||
                        group by c.ConstText,b.PostType  ";
 | 
			
		||||
            List<SqlParameter> listStr = new List<SqlParameter>();
 | 
			
		||||
            SqlParameter[] parameter = listStr.ToArray();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue