using BLL; using FineUIPro.Web.BaseInfo; using FineUIPro.Web.DataShow; using FineUIPro.Web.SysManage; using Model; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.common { public partial class mainProject2 : PageBase { /// /// 项目id /// public string ProjectId { get { return (string)ViewState["ProjectId"]; } set { ViewState["ProjectId"] = value; } } /// /// 页面加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ProjectId = CurrUser.LoginProjectId; Model.SGGLDB db = Funs.DB; //安全人工时 int wHours = db.SitePerson_PersonInOutNumber.Where(x => x.ProjectId == ProjectId).Max(x => x.WorkHours) ?? 0; this.divSafeWorkTime.InnerHtml = wHours.ToString(); //本月安全人工时 int wHoursMonth = 0; DateTime? sDate = Funs.GetNewDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString()); var dayReports = BLL.SitePerson_MonthReportService.getMonthReports(this.ProjectId, sDate); if (dayReports.Count > 0) { wHoursMonth = Convert.ToInt32(dayReports[0].DayWorkTime); } this.divSafeWorkTimeMonth.InnerHtml = wHoursMonth.ToString(); //安全培训累计人员 var getTrainRecord = db.EduTrain_TrainRecord.Where(x => x.ProjectId == ProjectId).Max(x => x.TrainPersonNum) ?? 0; this.divSafePersonNum.InnerHtml = getTrainRecord.ToString(); //安全管理人员 var allSum = from x in Funs.DB.SitePerson_Person where x.ProjectId == ProjectId && x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime.Value > DateTime.Now) select x; var glAllPerson = from x in allSum join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId where y.IsHsse==true && x.ProjectId == ProjectId //安管人员 select x; this.divSafeManagePersonNum.InnerHtml = glAllPerson.Count().ToString(); //未遂事故 var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord join y in db.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId where y.AccidentTypeName.Contains("未遂") && x.ProjectId == ProjectId select x; var wsAccidentList2 = from x in db.Accident_AccidentReportOther join y in db.Sys_Const on x.AccidentTypeId equals y.ConstValue where y.ConstText.Contains("未遂") && x.ProjectId == ProjectId select x; this.divWS.InnerHtml = (wsAccidentList1.Count() + wsAccidentList2.Count()).ToString(); //整改数据 getZgsj(); //风险预警 getHazard(); //工程概况 getProjectInfo(); //质量培训人员 DateTime date = DateTime.Now.AddDays(-1); int CqmsPxNum = (from x in Funs.DB.Comprehensive_InspectionPerson where x.IsTrain == true && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month && x.CompileDate.Value.Day == date.Day select x).Count(); divCqmsPxNum.InnerHtml = CqmsPxNum.ToString(); //施工审批量 int sgspl = Funs.DB.Solution_CQMSConstructSolution.Where(x => x.ProjectId == ProjectId && x.State == "1").Count(); div_sgfaSpl.InnerHtml = sgspl.ToString(); GetJD(); //质量共检 getZlgj(); //焊接 getHj(); //加载质量问题 getZlwt(); //人员信息 getSitePerson(); //项目人员图表 getProjectSitePerson(); //工作台面 getGjsx(); getGztm(); //材料到货 getCldh(); } } #region 人员信息 private void getSitePerson() { int AllCount = 0; int MCount = 0; var getallin = APIPageDataService.getPersonNum(ProjectId, DateTime.Now); AllCount = getallin.Count(); if (AllCount > 0) { MCount = getallin.Where(x => x.PostType == Const.PostType_1).Count(); } if (AllCount > 0) { ////当前现场总人数 div_xcrs.InnerHtml = AllCount.ToString(); //作业人数 div_zyxcrs.InnerHtml = (AllCount - MCount).ToString(); //管理人数 div_glxcrs.InnerHtml = MCount.ToString(); } } #endregion #region 项目人员图表 protected string ProjectPersonCount; protected string ProjectPersonMc; private void getProjectSitePerson() { var list = Funs.DB.Base_Project.Where(x => (x.ProjectState == Const.ProjectState_1 || x.ProjectState == null) && x.Progress != null && x.ProjectId == ProjectId).ToList(); foreach (var item in list) { ProjectPersonMc += "'" + item.ShortName + "',"; ProjectPersonCount += "'" + APIPageDataService.getPersonNum(item.ProjectId, DateTime.Now).Count() + "',"; } if (!string.IsNullOrEmpty(ProjectPersonMc) && !string.IsNullOrEmpty(ProjectPersonCount)) { ProjectPersonMc = ProjectPersonMc.TrimEnd(','); ProjectPersonCount = ProjectPersonCount.TrimEnd(','); } } #endregion #region 整改数据 protected void getZgsj() { div_zgsj.InnerHtml = (GetGeneralClosedNum() + GetGeneralNotClosedNum()).ToString(); div_zgywc.InnerHtml = GetGeneralClosedNum().ToString(); div_zgwwc.InnerHtml = GetGeneralNotClosedNum().ToString(); div_zgwcl.InnerHtml = String.Format("{0:N2}", 100.0 * GetGeneralClosedNum() / (GetGeneralNotClosedNum() + GetGeneralClosedNum())).Replace("NaN","0") + "%"; } /// /// 获取隐患整改闭环项 /// /// public int GetGeneralClosedNum() { int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States == "3" && x.ProjectId == ProjectId select x).Count(); return result; } /// /// 获取隐患未整改完成项 /// /// public int GetGeneralNotClosedNum() { int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.States != "3" && x.ProjectId == ProjectId select x).Count(); return result; } #endregion #region 工程概括 protected string divProjectNameTitle; protected string divProjectAddressTitle; protected string divProjectMoneyTitle; protected string divOwnUnitTitle; protected string divSGUnitTitle; protected string divJLUnitTitle; protected string divProjectImg; protected string spanProjectName; protected string spanProjectAddress; protected string spanOwnUnit; protected string spanSGUnit; protected string spanJLUnit; protected string spanRemark; /// /// /// private void getProjectInfo() { divProjectNameTitle = ""; divProjectAddressTitle = ""; divProjectMoneyTitle = ""; divOwnUnitTitle = ""; divSGUnitTitle = ""; divJLUnitTitle = ""; divProjectImg = "
"; var project = ProjectService.GetProjectByProjectId(this.ProjectId); if (project != null) { spanProjectName = "" + project.ShortName + ""; spanRemark = "" + project.Remark + ""; divProjectNameTitle = project.ProjectName; if (!string.IsNullOrEmpty(project.ProjectAddress)) { //this.divProjectAddress.InnerHtml = project.ProjectAddress.Length > 8 ? project.ProjectAddress.Substring(0, 8) + "..." : project.ProjectAddress; spanProjectAddress = spanProjectName = "" + (project.ProjectAddress.Length > 8 ? project.ProjectAddress.Substring(0, 8) + "..." : project.ProjectAddress) + ""; divProjectAddressTitle = project.ProjectAddress; } string unit_yz = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_4); if (!string.IsNullOrEmpty(unit_yz)) { //this.divOwnUnit.InnerHtml = unit_yz.Length > 8 ? unit_yz.Substring(0, 8) + "..." : unit_yz; spanOwnUnit = "" + (unit_yz.Length > 8 ? unit_yz.Substring(0, 8) + "..." : unit_yz) + ""; divOwnUnitTitle = unit_yz; } string unit_JL = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_3); if (!string.IsNullOrEmpty(unit_JL)) { //this.divJLUnit.InnerHtml = unit_JL.Length > 8 ? unit_JL.Substring(0, 8) + "..." : unit_JL; spanJLUnit = "" + (unit_JL.Length > 8 ? unit_JL.Substring(0, 8) + "..." : unit_JL) + ""; divJLUnitTitle = unit_JL; } string unit_FB = ProjectService.getProjectUnitNameByUnitType(project.ProjectId, Const.ProjectUnitType_2); if (!string.IsNullOrEmpty(unit_FB)) { //this.divSGUnit.InnerHtml = unit_FB.Length > 8 ? unit_FB.Substring(0, 8) + "..." : unit_FB + "..."; spanSGUnit = "" + (unit_FB.Length > 8 ? unit_FB.Substring(0, 8) + "..." : unit_FB + "...") + ""; } var getSGName = from x in Funs.DB.Project_ProjectUnit join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.ProjectId == project.ProjectId && x.UnitType == Const.ProjectUnitType_2 select y.UnitName; foreach (var item in getSGName) { divSGUnitTitle += item + ","; } //this.divProjectMoney.InnerHtml = divProjectMoneyTitle = project.ProjectMoney.ToString() + "万元"; if (project.EndDate.HasValue) { this.divEndDate.InnerHtml = string.Format("{0:yyyy-MM-dd}", project.EndDate); int endDays = (project.EndDate.Value - DateTime.Now).Days; if (endDays >= 0) { this.divRemainingDays.InnerHtml = endDays.ToString() + ""; } if (project.StartDate.HasValue) { int pdays = (project.EndDate.Value - project.StartDate.Value).Days; if (pdays >= 0) { this.divProjectDays.InnerHtml = pdays.ToString() + ""; } } } var allowExtensions = new List { "jpg", "jpeg", "png", "bmp", "gif", // 图片文件类型 }; var getImag = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == project.ProjectId); if (getImag != null && !string.IsNullOrEmpty(getImag.AttachUrl)) { string url = getImag.AttachUrl.Replace('\\', '/'); var UrlList = Funs.GetStrListByStr(url, ','); bool isHiddDefaultImg = false; foreach (var item in UrlList) { if (!string.IsNullOrEmpty(item)) { string atturl = Funs.RootPath + item.Replace(';', ' ').Trim(); string fileType = GetFileType(atturl); if (File.Exists(atturl) && allowExtensions.Contains(fileType)) { isHiddDefaultImg=true; divProjectImg += string.Format("
", atturl.Replace(Funs.RootPath,"/")); //this.divProjectImgs.Src = divProjectImg; } } } divProjectImg= divProjectImg.Replace("
", ""); /*string firtstUrl = Funs.GetStrListByStr(url, ',').FirstOrDefault(); if (!string.IsNullOrEmpty(firtstUrl)) { string atturl = Funs.RootPath + firtstUrl.Replace(';', ' ').Trim(); if (File.Exists(atturl)) { divProjectImg = "../" + firtstUrl.Replace(';', ' ').Trim(); //this.divProjectImgs.Src = divProjectImg; } }*/ } } } private string GetFileType(string fileName) { string fileType = String.Empty; int lastDotIndex = fileName.LastIndexOf("."); if (lastDotIndex >= 0) { fileType = fileName.Substring(lastDotIndex + 1).ToLower(); } return fileType; } #endregion #region 风险预警 protected string riskData1; protected string riskData2; protected string riskData3; protected string riskData4; /// /// 获取风险管控 /// private void getHazard() { var getHazards = from x in Funs.DB.Hazard_HazardSelectedItem join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId where x.ProjectId == ProjectId select new { x.HazardSelectedItemId, y.RiskLevel }; var riskLevels = from x in Funs.DB.Base_RiskLevel select x; List RiskLevelNum = new List(); List series = new List(); riskData1 = getHazards.Count(x => x.RiskLevel == 1).ToString(); riskData2 = getHazards.Count(x => x.RiskLevel == 2).ToString(); riskData3 = getHazards.Count(x => x.RiskLevel == 3).ToString(); riskData4 = getHazards.Count(x => x.RiskLevel == 4).ToString(); } /// /// 资质预警 /// protected string getEarlyWarningCounts() { int allCount = 0; var getPersonQualitys = from x in Funs.DB.QualityAudit_PersonQuality join y in Funs.DB.SitePerson_Person on x.PersonId equals y.PersonId where x.LimitDate.HasValue && x.LimitDate < DateTime.Now && y.ProjectId == ProjectId select x; //// 预警人数 allCount = getPersonQualitys.Count(); return allCount.ToString(); } /// /// 机械预警 /// /// protected int GetJxyjNum() { int result = 0; //机具报验的到期提醒和过期提醒记录数加一起 //机具报验的到期提醒数 var num1 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && DateTime.Now < x.NextTestDate && x.ProjectId == ProjectId && ((DateTime)x.NextTestDate).AddDays(-15) < DateTime.Now).Count(); //过期提醒记录数 var num2 = Funs.DB.Comprehensive_InspectionMachine.Where(x => x.IsOnSite == true && x.NextTestDate < DateTime.Now && x.ProjectId == ProjectId).Count(); result = num1 + num2; return result; } /// /// 获取危大工程审批完成数 /// /// protected int GetCompletedNum() { var result = Project_HSSEData_HSSEService.GetCompletedNum(ProjectId); return result; } /// /// 获取危大工程培训人次数 /// /// protected int GetTrainPersonNum() { var result = Project_HSSEData_HSSEService.GetTrainPersonNum(ProjectId); return result; } /// /// 获取危大工程施工个数 /// /// protected int GetConstructionNum() { var result = Project_HSSEData_HSSEService.GetConstructionNum(ProjectId); return result; } /// /// 获取危大工程完工个数 /// /// protected int GetFinishedNum() { var result = Project_HSSEData_HSSEService.GetFinishedNum(ProjectId); return result; } /// /// 获取超危大工程审批完成数 /// /// protected int GetSuperCompletedNum() { var result = Project_HSSEData_HSSEService.GetSuperCompletedNum(ProjectId); return result; } /// /// 获取超危大工程培训人次数 /// /// protected int GetSuperTrainPersonNum() { var result = Project_HSSEData_HSSEService.GetSuperTrainPersonNum(ProjectId); return result; } /// /// 获取超危大工程施工个数 /// /// protected int GetSuperConstructionNum() { var result = Project_HSSEData_HSSEService.GetSuperConstructionNum(ProjectId); return result; } /// /// 获取超危大工程完工个数 /// /// protected int GetSuperFinishedNum() { var result = Project_HSSEData_HSSEService.GetSuperFinishedNum(ProjectId); return result; } #endregion #region 作业许可 protected int getTodayCount() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.WorkStatesStr == "作业中").ToList().Count; return result; } protected int getAllCount() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId ).ToList().Count; return result; } /// /// 动火作业许可证 /// /// protected int getWrokCount0() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "动火作业许可证" &&x.WorkStatesStr=="作业中").ToList().Count; return result; } protected int getALLWrokCount0() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "动火作业许可证" ).ToList().Count; return result; } protected int getWrokCount1() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "高处作业许可证" && x.WorkStatesStr == "作业中").ToList().Count; return result; } protected int getALLWrokCount1() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "高处作业许可证" ).ToList().Count; return result; } protected int getWrokCount2() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "吊装作业许可证" && x.WorkStatesStr == "作业中").ToList().Count; return result; } protected int getALLWrokCount2() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName == "吊装作业许可证").ToList().Count; return result; } protected int getWrokCount3() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName != "动火作业许可证" && x.LicenseTypeName != "高处作业许可证" && x.LicenseTypeName != "吊装作业许可证" && x.WorkStatesStr == "作业中").ToList().Count; return result; } protected int getALLWrokCount3() { var result = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId && x.LicenseTypeName != "动火作业许可证" && x.LicenseTypeName != "高处作业许可证" && x.LicenseTypeName != "吊装作业许可证" ).ToList().Count; return result; } #endregion #region 质量问题 //质量问题总计 protected string zlallNumber; //质量问题合格数量 protected string zlfinishNumber; //质量问题整改率 protected string zlzgl; protected string zgzglDataValue; protected void getZlwt() { zlallNumber = (from x in Funs.DB.Check_CheckControl where x.CheckDate <= DateTime.Now && x.ProjectId == ProjectId select x).Count().ToString(); var num2 = (from x in Funs.DB.Check_CheckControl where x.CheckDate <= DateTime.Now && x.State == "7" && x.ProjectId == ProjectId select x).Count(); zlfinishNumber = num2.ToString(); var num3 = (from x in Funs.DB.Check_CheckControl where x.CheckDate <= DateTime.Now && x.State != "7" && x.ProjectId == ProjectId select x).Count(); var zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); zlzgl = zgl.ToString().Replace("NaN", "0") ; zgzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); } #endregion #region 质量共检 protected string zlgjallNumber; protected string zlgjfinishNumber; protected string zlgjzgl; protected string zggjzglDataValue; protected void getZlgj() { //Check_JointCheck zlgjallNumber = (from x in Funs.DB.Check_JointCheck where x.CheckDate <= DateTime.Now && x.ProjectId == ProjectId select x).Count().ToString(); var num2 = (from x in Funs.DB.Check_JointCheck where x.CheckDate <= DateTime.Now && x.State == BLL.Const.JointCheck_Complete && x.ProjectId == ProjectId select x).Count(); zlgjfinishNumber = num2.ToString(); var num3 = (from x in Funs.DB.Check_JointCheck where x.CheckDate <= DateTime.Now && x.State != BLL.Const.JointCheck_Complete && x.ProjectId == ProjectId select x).Count(); var zgl = "0"; if (num2 != 0) { zgl = String.Format("{0:N2}", 100.0 * num2 / (num2 + num3)); zlgjzgl = zgl.ToString(); zggjzglDataValue = (100 - (100.0 * num2 / (num2 + num3))).ToString(); } else { zlgjzgl = zgl.ToString(); zggjzglDataValue = "0"; } } #endregion #region 焊接 protected string hjallNumber = "0"; protected string hjfinishNumber = "0"; protected string hjzgl = "0"; protected string hjDataValue = "0"; protected void getHj() { Model.SingleSerie series = new Model.SingleSerie(); Model.BusinessColumn businessColumn = new Model.BusinessColumn(); List listdata = new List(); double result = 0; Model.SGGLDB db = Funs.DB; //一次检测合格焊口数 int oneCheckJotNum = (from x in db.HJGL_Batch_NDEItem join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId join z in db.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId join a in db.HJGL_Batch_NDE on x.NDEID equals a.NDEID where z.PointDate != null && z.PointState == "1" && y.RepairRecordId == null && a.ProjectId == ProjectId select x.NDEItemID).Count(); //一次检测返修焊口数 int oneCheckRepairJotNum = (from x in db.HJGL_Batch_NDEItem join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId join z in db.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId join a in db.HJGL_Batch_NDE on x.NDEID equals a.NDEID where z.PointDate != null && z.PointState == "1" && y.RepairRecordId == null && x.CheckResult == "2" && a.ProjectId == ProjectId select x.NDEItemID).Count(); if (oneCheckJotNum > 0) { var a = Convert.ToDouble(oneCheckJotNum - oneCheckRepairJotNum); var b = Convert.ToDouble(oneCheckJotNum); result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 0)); hjallNumber = b.ToString(); hjfinishNumber = a.ToString(); hjzgl = result.ToString(); hjDataValue = (100 - result).ToString(); } } #endregion #region 赢得值曲线 protected string swgclHtml; protected void GetJD() { int index = 0; var result = Funs.DB.View_JDGL_QuantityCompletion .Where(qc => qc.ProjectId == this.CurrUser.LoginProjectId) .OrderBy(qc => qc.SortIndex) .ThenBy(qc => qc.Name) .ToList(); foreach (var item in result) { index++; swgclHtml += "
"; swgclHtml += string.Format("

{0}

",index); swgclHtml += string.Format("

{0}

",item.Name); swgclHtml += string.Format("

{0}

",item.Unit); swgclHtml += string.Format("

{0}

",item.DesignNum); swgclHtml += string.Format("

{0}{1}{2}

",item.PlanNum,item.RealNum,item.Rate); swgclHtml += string.Format("

{0}{1}{2}

",item.TotalPlanNum,item.TotalRealNum,item.TotalRate); swgclHtml += string.Format("

{0}

",item.SumRate); swgclHtml += "
"; } } protected string Two { get { List series = new List(); Model.BusinessColumn businessColumn = new Model.BusinessColumn(); List listCategories = new List(); businessColumn.title = "赢得值曲线"; Model.Project_Installation installation = BLL.Project_InstallationService.GetProjectInstallationByProjectId(this.CurrUser.LoginProjectId); if (installation != null) { Model.SingleSerie s = new Model.SingleSerie(); Model.SingleSerie s2 = new Model.SingleSerie(); Model.SingleSerie s3 = new Model.SingleSerie(); Model.SingleSerie s4 = new Model.SingleSerie(); Model.SingleSerie s5 = new Model.SingleSerie(); Model.SingleSerie s6 = new Model.SingleSerie(); List listdata = new List(); List listdata2 = new List(); List listdata3 = new List(); List listdata4 = new List(); List listdata5 = new List(); List listdata6 = new List(); string strSql = "select distinct (cast(YEAR(Months) as varchar(4))+'.'+cast(MONTH(Months) as varchar(2))) as 月份,t.Months," + "ThisRealCost as '本月已完工作实际费用-ACWP',ThisPlanCost as '本月已完工作预算费用-BCWP',ThisPlanValue as '本月计划工作预算费用-BCWS',TotalPlanValue as '累计计划工作预算费用-BCWS',TotalRealCost as '累计已完工作实际费用-ACWP',TotalPlanCost as '累计已完工作预算费用-BCWP' " + "from dbo.View_WBS_CostControlParentDetail as t where ParentId=@Id order by t.Months"; //string date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-01"; SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@Id",installation.InstallationId), //new SqlParameter("@Months",date), }; DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter); decimal lastbcws = 0, bcws = 0, lastacwp = 0, acwp = 0, lastbcwp = 0, bcwp = 0; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["本月已完工作实际费用-ACWP"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月已完工作实际费用-ACWP"].ToString()) / 10000; dt.Rows[i]["本月已完工作预算费用-BCWP"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月已完工作预算费用-BCWP"].ToString()) / 10000; dt.Rows[i]["本月计划工作预算费用-BCWS"] = Funs.GetNewDecimalOrZero(dt.Rows[i]["本月计划工作预算费用-BCWS"].ToString()) / 10000; bcws = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计计划工作预算费用-BCWS"].ToString()); acwp = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计已完工作实际费用-ACWP"].ToString()); bcwp = Funs.GetNewDecimalOrZero(dt.Rows[i]["累计已完工作预算费用-BCWP"].ToString()); if (bcws == lastbcws) { if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now) { dt.Rows[i]["累计计划工作预算费用-BCWS"] = 0; } else { dt.Rows[i]["累计计划工作预算费用-BCWS"] = bcws / 10000; } } else { dt.Rows[i]["累计计划工作预算费用-BCWS"] = bcws / 10000; } if (acwp == lastacwp) { if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now) { dt.Rows[i]["累计已完工作实际费用-ACWP"] = 0; } else { dt.Rows[i]["累计已完工作实际费用-ACWP"] = acwp / 10000; } } else { dt.Rows[i]["累计已完工作实际费用-ACWP"] = acwp / 10000; } if (bcwp == lastbcwp) { if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) > DateTime.Now) { dt.Rows[i]["累计已完工作预算费用-BCWP"] = 0; } else { dt.Rows[i]["累计已完工作预算费用-BCWP"] = bcwp / 10000; } } else { dt.Rows[i]["累计已完工作预算费用-BCWP"] = bcwp / 10000; } lastbcws = bcws; lastacwp = acwp; lastbcwp = bcwp; listCategories.Add(dt.Rows[i]["月份"].ToString()); if (Funs.GetNewDateTimeOrNow(dt.Rows[i]["Months"].ToString()) <= DateTime.Now) { listdata.Add(Convert.ToDouble(dt.Rows[i]["本月计划工作预算费用-BCWS"])); listdata2.Add(Convert.ToDouble(dt.Rows[i]["累计计划工作预算费用-BCWS"])); listdata3.Add(Convert.ToDouble(dt.Rows[i]["本月已完工作预算费用-BCWP"])); listdata4.Add(Convert.ToDouble(dt.Rows[i]["累计已完工作预算费用-BCWP"])); listdata5.Add(Convert.ToDouble(dt.Rows[i]["本月已完工作实际费用-ACWP"])); listdata6.Add(Convert.ToDouble(dt.Rows[i]["累计已完工作实际费用-ACWP"])); } } s.data = listdata; s2.data = listdata2; s3.data = listdata3; s4.data = listdata4; s5.data = listdata5; s6.data = listdata6; series.Add(s); series.Add(s2); series.Add(s3); series.Add(s4); series.Add(s5); series.Add(s6); businessColumn.categories = listCategories; businessColumn.series = series; } return JsonConvert.SerializeObject(businessColumn); } } #endregion #region 人力情况 protected string Person { get { Model.SGGLDB db = Funs.DB; List series = new List(); Model.BusinessColumn businessColumn = new Model.BusinessColumn(); List listCategories = new List(); var persons = from x in db.SitePerson_Person where x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now) select x; var posts = (from x in persons join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId select y).Distinct(); Model.SingleSerie s = new Model.SingleSerie(); List listdata = new List(); //木工 listCategories.Add("木工"); int workPostCount1 = persons.Count(x => x.WorkPostId == Const.WorkPost_Carpentry); listdata.Add(workPostCount1); //钢筋工 listCategories.Add("钢筋工"); int workPostCount2 = persons.Count(x => x.WorkPostId == Const.WorkPost_SteelWorker); listdata.Add(workPostCount2); //瓦工 listCategories.Add("瓦工"); int workPostCount3 = persons.Count(x => x.WorkPostId == Const.WorkPost_Bricklayer); listdata.Add(workPostCount3); //混凝土工 listCategories.Add("混凝土工"); int workPostCount4 = persons.Count(x => x.WorkPostId == Const.WorkPost_ConcreteWorker); listdata.Add(workPostCount4); //钳工 listCategories.Add("钳工"); int workPostCount5 = persons.Count(x => x.WorkPostId == Const.WorkPost_Fitter1 || x.WorkPostId == Const.WorkPost_Fitter2); listdata.Add(workPostCount5); //焊工 listCategories.Add("焊工"); int workPostCount6 = persons.Count(x => x.WorkPostId == Const.WorkPost_Welder1 || x.WorkPostId == Const.WorkPost_Welder2 || x.WorkPostId == Const.WorkPost_Welder3 || x.WorkPostId == Const.WorkPost_Welder4 || x.WorkPostId == Const.WorkPost_Welder5); listdata.Add(workPostCount6); //铆工 listCategories.Add("铆工"); int workPostCount7 = persons.Count(x => x.WorkPostId == Const.WorkPost_Riveter); listdata.Add(workPostCount7); //管工 listCategories.Add("管工"); int workPostCount8 = persons.Count(x => x.WorkPostId == Const.WorkPost_Foreman); listdata.Add(workPostCount8); //电工 listCategories.Add("电工"); int workPostCount9 = persons.Count(x => x.WorkPostId == Const.WorkPost_Electrician1 || x.WorkPostId == Const.WorkPost_Electrician2 || x.WorkPostId == Const.WorkPost_Electrician3); listdata.Add(workPostCount9); //仪表工 listCategories.Add("仪表工"); int workPostCount10 = persons.Count(x => x.WorkPostId == Const.WorkPost_Instrumentalist); listdata.Add(workPostCount10); //防腐保温工 listCategories.Add("防腐保温工"); int workPostCount11 = persons.Count(x => x.WorkPostId == Const.WorkPost_AnticorrosionWorker); listdata.Add(workPostCount11); //防腐保温工 listCategories.Add("管理人员"); int workPostCount12 = (from x in persons join y in db.Base_WorkPost on x.WorkPostId equals y.WorkPostId where y.PostType == Const.PostType_1 select x).Count(); listdata.Add(workPostCount12); //其他 listCategories.Add("其他"); int workPostCount13 = persons.Count() - workPostCount1 - workPostCount2 - workPostCount3 - workPostCount4 - workPostCount5 - workPostCount6 - workPostCount7 - workPostCount8 - workPostCount9 - workPostCount10 - workPostCount11 - workPostCount12; listdata.Add(workPostCount13); s.data = listdata; series.Add(s); businessColumn.categories = listCategories; businessColumn.title = persons.Count().ToString(); businessColumn.series = series; return JsonConvert.SerializeObject(businessColumn); } } #endregion #region 作业许可列表 protected string getLicenseManager() { string returnHtml = ""; var list = Funs.DB.View_License_LicenseManager.Where(x => x.ProjectId == ProjectId).ToList(); foreach (var item in list) { var gfx = "风险作业"; if (item.IsHighRisk != true) { gfx = "非高风险"; } var shortUnitname = Funs.DB.Base_Unit.Where(x => x.UnitId == item.UnitId).FirstOrDefault().ShortUnitName; returnHtml += "
" + item.LicenseManagerCode + "-" + shortUnitname + "-" + item.WorkAreaName + "-" + gfx + "-" + item.LicenseTypeName + "
"; } return returnHtml; } #endregion #region 工作台面 protected string gjsxRate = "0"; protected void getGztm() { //div_dbsxlist.InnerHtml = ""; string returnDbHtml = "
"; if (!string.IsNullOrEmpty(ProjectId)) { //关键事项 string strSql = @"SELECT GJSXID AS DataId ,'0BEA2126-7A48-40EB-8E21-99148E91A22B' AS MenuId ,'关键事项待处理' AS MenuName ,GJSX.Detail AS Content ,users.UserId ,users.UserName ,GJSX.CreateDate AS DataTime ,CONVERT(varchar(100),GJSX.CreateDate, 23) AS DataTimeStr ,'../PZHGL/GJSX/GJSXListEdit.aspx?ToDo=ToDo&EditType=Edit&ID='+GJSXID AS PCUrl FROM GJSX LEFT JOIN Sys_User AS users ON users.UserId =@userId WHERE GJSX.ProjectId=@projectId AND GJSX.State != 0 AND (((select count(*) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0 and (select count(*) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0) or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(*) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(*) from GJSX_Process process where process.GJSXID=GJSX.GJSXID)) )"; List listStr = new List(); listStr.Add(new SqlParameter("@userId", CurrUser.UserId)); listStr.Add(new SqlParameter("@projectId", ProjectId)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); var Gjsxcount = tb.Rows.Count; div_gjsx.InnerHtml = Gjsxcount.ToString(); var getDataList = Funs.DB.Sp_Project_GetToDoItems(this.CurrUser.LoginProjectId, this.CurrUser.UserId).ToList(); //待办事项、个人流程 div_dbsx.InnerHtml = getDataList.Count().ToString(); div_grlc.InnerHtml = getDataList.Count().ToString(); foreach (var item in getDataList) { returnDbHtml += "
" + item.MenuName + "" + item.Content + "" + item.DataTime.ToString().Replace('/', '-').Split(' ')[0] + "
"; } } else { returnDbHtml = "
"; } this.div_dbsxlist.InnerHtml = returnDbHtml; } /// /// 加载关键事项 /// protected void getGjsx() { string returnDbHtml = "
"; ////关键事项 if (!string.IsNullOrEmpty(ProjectId)) { string strSql = @"SELECT GJSXID AS DataId ,'0BEA2126-7A48-40EB-8E21-99148E91A22B' AS MenuId ,'关键事项待处理' AS MenuName ,GJSX.Detail AS Content ,users.UserId ,users.UserName ,GJSX.CreateDate AS DataTime ,CONVERT(varchar(100),GJSX.CreateDate, 23) AS DataTimeStr ,'../PZHGL/GJSX/GJSXListEdit.aspx?ToDo=ToDo&EditType=Edit&ID='+GJSXID AS PCUrl FROM GJSX LEFT JOIN Sys_User AS users ON users.UserId =@userId WHERE GJSX.ProjectId=@projectId AND GJSX.State != 0 AND (((select count(*) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0 and (select count(*) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0) or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(*) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(*) from GJSX_Process process where process.GJSXID=GJSX.GJSXID)) )"; List listStr = new List(); listStr.Add(new SqlParameter("@userId", CurrUser.UserId)); listStr.Add(new SqlParameter("@projectId", ProjectId)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); for (int i = 0; i < tb.Rows.Count; i++) { returnDbHtml += "
" + tb.Rows[i]["MenuName"] + "" + tb.Rows[i]["Content"] + "" + tb.Rows[i]["DataTime"].ToString().Replace('/', '-').Split(' ')[0] + "
"; } } else { returnDbHtml = "
"; } this.div_gjsxlist.InnerHtml = returnDbHtml; List listStaticListStr = new List(); listStaticListStr.Add(new SqlParameter("@UserID", null)); listStaticListStr.Add(new SqlParameter("@unit", null)); listStaticListStr.Add(new SqlParameter("@projectid", this.CurrUser.LoginProjectId)); listStaticListStr.Add(new SqlParameter("@CNProfessional_ID", null)); listStaticListStr.Add(new SqlParameter("@questionType", null)); listStaticListStr.Add(new SqlParameter("@processMan", null)); listStaticListStr.Add(new SqlParameter("@User_Acceptance", null)); SqlParameter[] Staticparameter = listStaticListStr.ToArray(); DataTable statcitbDataTable = SQLHelper.GetDataTableRunProc("Sp_GJSXStatistic", Staticparameter); var allcount = Funs.GetNewIntOrZero(statcitbDataTable.Rows[0]["allcount"].ToString()) ; var closecount = Funs.GetNewIntOrZero(statcitbDataTable.Rows[0]["closecount"].ToString()); gjsxRate = String.Format("{0:N2}", 100.0 * closecount / allcount); gjsxRate = gjsxRate.ToString().Replace("NaN", "0")+"%"; } #endregion /// /// 关闭弹出窗 /// /// /// protected void Window1_Close(object sender, WindowCloseEventArgs e) { getGztm(); getGjsx(); } /// /// 打开待办 /// /// /// protected void btnshowWindows(object sender, EventArgs e) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("{0}", hiddenUrl.Value, "办理 - "))); } #region 材料到货 protected string gdclHtml; protected string sbclHtml; protected string gdclHead = "

材料类别

设计量

采购量

采购量百分比

到货量

已到货百分比

领料量

已领料百分比

"; protected string sbclHead = "

合同号

" + "

采购总量

" + "

发货总量

" + "

到货总量

" + "

到货百分比

"; private void getCldh() { //管道材料 var pid = BLL.ProjectService.GetCLProjectCodeByProjectId(ProjectId).ToString(); var list = Funs.DB.CLGL_PipelineMaterialSumList.Where(x => x.Type == "M" && x.ProjectId == pid); foreach (var item in list) { gdclHtml += "
"; gdclHtml += "" + item.C1 + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C2) ? "0" : item.C2) + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C4) ? "0" : item.C4) + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C5) ? "0%" : item.C5) + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C6) ? "0" : item.C6) + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C7) ? "0%" : item.C7) + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C8) ? "0" : item.C8) + ""; gdclHtml += "" + (string.IsNullOrEmpty(item.C9) ? "0%" : item.C9) + ""; gdclHtml += "
"; } //设备材料 var SbclList = Funs.DB.CLGL_ContractListSum.Where(x => x.C1 == "设备" && x.ProjectId == pid); foreach (var item in SbclList) { sbclHtml += "
"; double SbcllCgl = 0.0; double Sbdhs = 0.0; if (string.IsNullOrEmpty(item.C7)) { SbcllCgl += 0; Sbdhs += 0; } else { SbcllCgl += Convert.ToDouble(item.C7); Sbdhs += Convert.ToDouble(item.C9); } sbclHtml += "" + item.C2 + ""; sbclHtml += "" + SbcllCgl + ""; sbclHtml += "" + item.C7 + ""; sbclHtml += "" + Sbdhs + ""; //百分比 var dhbfb = "0%"; if (SbcllCgl + Sbdhs != 0) { dhbfb = String.Format("{0:N2}", 100.0 * Sbdhs / (Sbdhs + SbcllCgl), 2) + "%"; } sbclHtml += "" + dhbfb + ""; sbclHtml += "
"; } } #endregion } }