diff --git a/DataBase/版本日志/SUBQHSE_V2024-10-28-bwj.sql b/DataBase/版本日志/SUBQHSE_V2024-10-28-bwj.sql new file mode 100644 index 00000000..6d9727b4 --- /dev/null +++ b/DataBase/版本日志/SUBQHSE_V2024-10-28-bwj.sql @@ -0,0 +1,5 @@ + +update ProcessControl_InspectionManagement set CNProfessionalId='10487C07-DE54-4ED6-BBDF-2C7988A44665' where CNProfessionalId='D03E079B-8B97-4C5A-BF1C-782887548B92'--ܵ +update ProcessControl_InspectionManagement set CNProfessionalId='DEB367FF-AD35-41A0-B68E-FA8E68737B93' where CNProfessionalId='445B1EE6-901E-4A07-A4AB-4EE1066E742F'-- +update ProcessControl_InspectionManagement set CNProfessionalId='F41C5022-F499-4BD7-84B6-E87E4CE53CAC' where CNProfessionalId='E9AC9563-E338-48B7-867D-488222AD0557'-- +go \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNotice.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNotice.aspx.cs index 5bd73ea7..bec70518 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNotice.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNotice.aspx.cs @@ -25,14 +25,18 @@ namespace FineUIPro.Web.CQMS.ProcessControl if (!IsPostBack) { GetButtonPower(); - //BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessional, true);//专业 - //专业 - this.drpCNProfessional.DataTextField = "DetectionItems"; - this.drpCNProfessional.DataValueField = "ControlId"; - this.drpCNProfessional.DataSource = BLL.CNProfessionalService.GetCnProList(); - this.drpCNProfessional.DataBind(); - Funs.FineUIPleaseSelect(this.drpCNProfessional); - + if (this.CurrUser.UserId == BLL.Const.hfnbdId) + { + this.drpCNProfessional.DataTextField = "DetectionItems"; + this.drpCNProfessional.DataValueField = "ControlId"; + this.drpCNProfessional.DataSource = BLL.CNProfessionalService.GetCnProList(); + this.drpCNProfessional.DataBind(); + Funs.FineUIPleaseSelect(this.drpCNProfessional); + } + else + { + BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessional, true);//专业 + } BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);//施工分包商 BindGrid(); } @@ -43,7 +47,10 @@ namespace FineUIPro.Web.CQMS.ProcessControl /// public void BindGrid() { - string strSql = @"SELECT P.InspectionId, + if (this.CurrUser.UserId==BLL.Const.hfnbdId) + { + + string strSql = @"SELECT P.InspectionId, P.ProjectId, P.UnitId, P.CNProfessionalId, @@ -57,42 +64,96 @@ namespace FineUIPro.Web.CQMS.ProcessControl BP.Class, P.AcceptanceSite, P.AcceptanceCheckMan" - + @" FROM ProcessControl_InspectionManagement AS P" - + @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId" - + @" LEFT JOIN Control_PointCropping C ON C.ControlId = P.CNProfessionalId" - + @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId" - + @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch" - + @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType" - + @" WHERE P.ProjectId=@ProjectId "; - List listStr = new List(); - listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); - if (drpUnit.SelectedValue != BLL.Const._Null) - { - strSql += " AND P.UnitId=@UnitId"; - listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue)); + + @" FROM ProcessControl_InspectionManagement AS P" + + @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId" + + @" LEFT JOIN Control_PointCropping C ON C.ControlId = P.CNProfessionalId" + + @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId" + + @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch" + + @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType" + + @" WHERE P.ProjectId=@ProjectId "; + List listStr = new List(); + listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); + if (drpUnit.SelectedValue != BLL.Const._Null) + { + strSql += " AND P.UnitId=@UnitId"; + listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue)); + } + if (drpCNProfessional.SelectedValue != BLL.Const._Null) + { + strSql += " AND P.CNProfessionalId=@CNProfessionalId"; + listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue)); + } + if (!string.IsNullOrEmpty(txtStarTime.Text.Trim())) + { + strSql += " AND P.InspectionDate >= @startTime"; + listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim()))); + } + if (!string.IsNullOrEmpty(txtEndTime.Text.Trim())) + { + strSql += " AND P.InspectionDate <= @endTime"; + listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim()))); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + //tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); } - if (drpCNProfessional.SelectedValue != BLL.Const._Null) + else { - strSql += " AND P.CNProfessionalId=@CNProfessionalId"; - listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue)); + string strSql = @"SELECT P.InspectionId, + P.ProjectId, + P.UnitId, + P.CNProfessionalId, + P.UnitWorkId, + U.UnitName, + C.ProfessionalName as ProfessionalName, + P.NoticeCode, + UnitWork.UnitWorkName, + DP.DivisionName AS Branch, + BP.BreakdownName AS ControlPointType, + BP.Class, + P.AcceptanceSite, + P.AcceptanceCheckMan" + + @" FROM ProcessControl_InspectionManagement AS P" + + @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId" + + @" left join Base_CNProfessional c on c.CNProfessionalId = P.CNProfessionalId" + + @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId" + + @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch" + + @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType" + + @" WHERE P.ProjectId=@ProjectId "; + List listStr = new List(); + listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); + if (drpUnit.SelectedValue != BLL.Const._Null) + { + strSql += " AND P.UnitId=@UnitId"; + listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue)); + } + if (drpCNProfessional.SelectedValue != BLL.Const._Null) + { + strSql += " AND P.CNProfessionalId=@CNProfessionalId"; + listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue)); + } + if (!string.IsNullOrEmpty(txtStarTime.Text.Trim())) + { + strSql += " AND P.InspectionDate >= @startTime"; + listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim()))); + } + if (!string.IsNullOrEmpty(txtEndTime.Text.Trim())) + { + strSql += " AND P.InspectionDate <= @endTime"; + listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim()))); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid1.RecordCount = tb.Rows.Count; + //tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); } - if (!string.IsNullOrEmpty(txtStarTime.Text.Trim())) - { - strSql += " AND P.InspectionDate >= @startTime"; - listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim()))); - } - if (!string.IsNullOrEmpty(txtEndTime.Text.Trim())) - { - strSql += " AND P.InspectionDate <= @endTime"; - listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim()))); - } - SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); - Grid1.RecordCount = tb.Rows.Count; - //tb = GetFilteredTable(Grid1.FilteredData, tb); - var table = this.GetPagedDataTable(Grid1, tb); - Grid1.DataSource = table; - Grid1.DataBind(); } #endregion diff --git a/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs index 0c1f311f..6745f3ea 100644 --- a/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ProcessControl/InspectionNoticeEdit.aspx.cs @@ -27,15 +27,22 @@ namespace FineUIPro.Web.CQMS.ProcessControl } GetButtonPower(); BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);//施工分包商 - //BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);//专业 + UserService.InitUserProjectIdUnitTypeDropDownList(this.drpAcceptanceCheckMan, this.CurrUser.LoginProjectId, string.Empty, false); //UserService.InitUserNameProjectIdUnitTypeDropDownList(this.drpAcceptanceCheckMan, this.CurrUser.LoginProjectId, string.Empty, false); - //专业 - this.drpCNProfessionalId.DataTextField = "DetectionItems"; - this.drpCNProfessionalId.DataValueField = "ControlId"; - this.drpCNProfessionalId.DataSource = BLL.CNProfessionalService.GetCnProList(); - this.drpCNProfessionalId.DataBind(); - Funs.FineUIPleaseSelect(this.drpCNProfessionalId); + if (this.CurrUser.UserId == BLL.Const.hfnbdId)//测试阶段,仅hfnbd账号使用 + { + //专业 + this.drpCNProfessionalId.DataTextField = "DetectionItems"; + this.drpCNProfessionalId.DataValueField = "ControlId"; + this.drpCNProfessionalId.DataSource = BLL.CNProfessionalService.GetCnProList(); + this.drpCNProfessionalId.DataBind(); + Funs.FineUIPleaseSelect(this.drpCNProfessionalId); + } + else + { + BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);//专业 + } //单位工程 var q = (from x in Funs.DB.WBS_DivisionDivide diff --git a/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx b/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx index fe926e6f..5be33799 100644 --- a/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx +++ b/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx @@ -18,7 +18,7 @@ - + diff --git a/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx.cs b/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx.cs index 952f78fc..416f991a 100644 --- a/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionDivideList.aspx.cs @@ -25,11 +25,11 @@ namespace FineUIPro.Web.CQMS.WBS.Control { BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWork, this.CurrUser.LoginProjectId, true); - var subProjectLists = from x in Funs.DB.Division_SubProjects where x.ProjectId==this.CurrUser.LoginProjectId && x.ParentId==null select x; - this.drpBranchEngineering.DataTextField = "BranchEngineeringName"; - this.drpBranchEngineering.DataValueField = "DivisionId"; - this.drpBranchEngineering.DataSource = subProjectLists; - this.drpBranchEngineering.DataBind(); + //var subProjectLists = from x in Funs.DB.Division_SubProjects where x.ProjectId==this.CurrUser.LoginProjectId && x.ParentId==null select x; + //this.drpBranchEngineering.DataTextField = "BranchEngineeringName"; + //this.drpBranchEngineering.DataValueField = "DivisionId"; + //this.drpBranchEngineering.DataSource = subProjectLists; + //this.drpBranchEngineering.DataBind(); Funs.FineUIPleaseSelect(this.drpBranchEngineering); BindGrid(); @@ -49,7 +49,7 @@ namespace FineUIPro.Web.CQMS.WBS.Control strSql += " AND (UnitWorkId =@unitWorkId or SuperUnitWork=@unitWorkId) "; listStr.Add(new SqlParameter("@unitWorkId", this.drpUnitWork.SelectedValue)); } - if (this.drpBranchEngineering.SelectedValue!=BLL.Const._Null) + if (this.drpBranchEngineering.SelectedValue != BLL.Const._Null) { strSql += " AND (DivisionId = @divisionId or ParentId=@divisionId) "; listStr.Add(new SqlParameter("@divisionId", this.drpBranchEngineering.SelectedValue)); @@ -57,7 +57,7 @@ namespace FineUIPro.Web.CQMS.WBS.Control strSql += " ORDER BY SupUnitWorkCode,ChildUnitWorkCode,Sort,DivisionLevel "; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); - + Grid1.RecordCount = tb.Rows.Count; //tb = GetFilteredTable(Grid1.FilteredData, tb); //var table = this.GetPagedDataTable(Grid1, tb); @@ -100,7 +100,7 @@ namespace FineUIPro.Web.CQMS.WBS.Control } if (this.drpBranchEngineering.SelectedValue != BLL.Const._Null) { - lists = lists.Where(x => x.DivisionId == this.drpBranchEngineering.SelectedValue || x.ParentId==this.drpBranchEngineering.SelectedValue); + lists = lists.Where(x => x.DivisionId == this.drpBranchEngineering.SelectedValue || x.ParentId == this.drpBranchEngineering.SelectedValue); } lists = lists.OrderBy(x => x.SupUnitWorkCode).ThenBy(x => x.ChildUnitWorkCode).ThenBy(x => x.Sort).ThenBy(x => x.DivisionLevel); @@ -139,7 +139,7 @@ namespace FineUIPro.Web.CQMS.WBS.Control row = sheet.CreateRow(i); // 添加数据 cell = row.CreateCell(0); - cell.CellStyle = cellStyle; + cell.CellStyle = cellStyle; cell.SetCellValue(item.SupUnitWorkCode);//单位工程编码 cell = row.CreateCell(1); @@ -208,5 +208,33 @@ namespace FineUIPro.Web.CQMS.WBS.Control } } #endregion + + /// + /// 单位工程下拉选择 + /// + /// + /// + protected void drpUnitWork_SelectedIndexChanged(object sender, EventArgs e) + { + this.drpBranchEngineering.Items.Clear(); + if (this.drpUnitWork.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpUnitWork.SelectedValue)) + { + var q = (from x in Funs.DB.View_WBS_DivisionDivide + where x.ProjectId == this.CurrUser.LoginProjectId + && x.UnitWorkId == this.drpUnitWork.SelectedValue + && x.ParentId==null + select new + { + x.DivisionId, + x.BranchEngineeringName + }).Distinct().ToList(); + this.drpBranchEngineering.DataTextField = "BranchEngineeringName"; + this.drpBranchEngineering.DataValueField = "DivisionId"; + this.drpBranchEngineering.DataSource = q; + this.drpBranchEngineering.DataBind(); + Funs.FineUIPleaseSelect(this.drpBranchEngineering); + this.drpBranchEngineering.SelectedIndex = 0; + } + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionSubProjectsNewEdit.aspx.cs b/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionSubProjectsNewEdit.aspx.cs index 1b14544c..75832afa 100644 --- a/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionSubProjectsNewEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/WBS/Control/DivisionSubProjectsNewEdit.aspx.cs @@ -235,11 +235,11 @@ namespace FineUIPro.Web.CQMS.WBS.Control } else { - var sub = BLL.SubProjectsService.GetSubProjectsById(this.ParentId); - if (sub.DivisionLevel == 1) - { + //var sub = BLL.SubProjectsService.GetSubProjectsById(this.ParentId); + //if (sub.DivisionLevel == 1) + //{ newSubProjects.DivisionLevel = 2; - } + //} newSubProjects.ProEngineeringName = this.txtProEngineeringName.Text.Trim(); newSubProjects.DivisionId = SQLHelper.GetNewID(typeof(Model.Division_SubProjects)); this.DivisionId = newSubProjects.DivisionId; @@ -264,15 +264,15 @@ namespace FineUIPro.Web.CQMS.WBS.Control } else { - var sub = BLL.SubProjectsService.GetSubProjectsById(this.ParentId); - if (sub.DivisionLevel == 1) - { - newSubProjects.DivisionLevel = 2; - } - else if (sub.DivisionLevel==2) - { + //var sub = BLL.SubProjectsService.GetSubProjectsById(this.ParentId); + //if (sub.DivisionLevel == 1) + //{ + // newSubProjects.DivisionLevel = 2; + //} + //else if (sub.DivisionLevel==2) + //{ newSubProjects.DivisionLevel = 3; - } + //} newSubProjects.DivisionId = SQLHelper.GetNewID(typeof(Model.Division_SubProjects)); this.DivisionId = newSubProjects.DivisionId; BLL.SubProjectsService.AddSubProjects(newSubProjects); diff --git a/SGGL/FineUIPro.Web/common/Menu_CQMS.xml b/SGGL/FineUIPro.Web/common/Menu_CQMS.xml index c90f11c5..cefc9ef0 100644 --- a/SGGL/FineUIPro.Web/common/Menu_CQMS.xml +++ b/SGGL/FineUIPro.Web/common/Menu_CQMS.xml @@ -8,9 +8,10 @@ - + + diff --git a/SGGL/FineUIPro.Web/common/mainMenu_CQMS.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_CQMS.aspx.cs index cb3b0e12..44a11776 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_CQMS.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_CQMS.aspx.cs @@ -333,50 +333,100 @@ namespace FineUIPro.Web Model.BusinessColumn businessColumn = new Model.BusinessColumn(); List listCategories = new List(); businessColumn.title = "质量一次合格率"; - var cns = BLL.CNProfessionalService.GetCnProList(); - Model.SGGLDB db = Funs.DB; - List TotalCheckDetailOKLists = (from x in db.ProcessControl_InspectionManagement - where x.ProjectId == this.CurrUser.LoginProjectId && x.IsOnceQualified == true - select x).ToList(); - List TotalCheckDetailLists = (from x in db.ProcessControl_InspectionManagement - where x.ProjectId == this.CurrUser.LoginProjectId - select x).ToList(); - Model.SingleSerie s = new Model.SingleSerie(); - Model.SingleSerie s2 = new Model.SingleSerie(); - List listdata = new List(); - List listdata2 = new List(); - double result = 0, result2 = 0; - foreach (var cn in cns) + + //专业测试阶段,仅hfnbd使用 + if (this.CurrUser.UserId == BLL.Const.hfnbdId) { - listCategories.Add(cn.DetectionItems); - var okChecks = TotalCheckDetailOKLists.Where(x => x.CNProfessionalId == cn.ControlId).ToList(); - var totalChecks = TotalCheckDetailLists.Where(x => x.CNProfessionalId == cn.ControlId).ToList(); - if (okChecks.Count > 0 && totalChecks.Count > 0) + var cns = BLL.CNProfessionalService.GetCnProList(); + Model.SGGLDB db = Funs.DB; + List TotalCheckDetailOKLists = (from x in db.ProcessControl_InspectionManagement + where x.ProjectId == this.CurrUser.LoginProjectId && x.IsOnceQualified == true + select x).ToList(); + List TotalCheckDetailLists = (from x in db.ProcessControl_InspectionManagement + where x.ProjectId == this.CurrUser.LoginProjectId + select x).ToList(); + Model.SingleSerie s = new Model.SingleSerie(); + Model.SingleSerie s2 = new Model.SingleSerie(); + List listdata = new List(); + List listdata2 = new List(); + double result = 0, result2 = 0; + foreach (var cn in cns) { - var a = Convert.ToDouble(okChecks.Count); - var b = Convert.ToDouble(totalChecks.Count); - result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 1)); - } - if (cn.DetectionItems.Contains("管道")) - { - var ndtList = (from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && x.ProjectId == this.CurrUser.LoginProjectId orderby x.CreateDate descending select x).FirstOrDefault(); - if (ndtList != null && !string.IsNullOrEmpty(ndtList.TotalRate)) + listCategories.Add(cn.DetectionItems); + var okChecks = TotalCheckDetailOKLists.Where(x => x.CNProfessionalId == cn.ControlId).ToList(); + var totalChecks = TotalCheckDetailLists.Where(x => x.CNProfessionalId == cn.ControlId).ToList(); + if (okChecks.Count > 0 && totalChecks.Count > 0) { - result2 = Convert.ToDouble(ndtList.TotalRate); + var a = Convert.ToDouble(okChecks.Count); + var b = Convert.ToDouble(totalChecks.Count); + result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 1)); } + if (cn.DetectionItems.Contains("管道")) + { + var ndtList = (from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && x.ProjectId == this.CurrUser.LoginProjectId orderby x.CreateDate descending select x).FirstOrDefault(); + if (ndtList != null && !string.IsNullOrEmpty(ndtList.TotalRate)) + { + result2 = Convert.ToDouble(ndtList.TotalRate); + } + } + listdata.Add(result); + listdata2.Add(result2); + result = 0; + result2 = 0; } - listdata.Add(result); - listdata2.Add(result2); - result = 0; - result2 = 0; + s.data = listdata; + s2.data = listdata2; + series.Add(s); + series.Add(s2); + } + else + { + var cns = BLL.CNProfessionalService.GetList(); + Model.SGGLDB db = Funs.DB; + List TotalCheckDetailOKLists = (from x in db.ProcessControl_InspectionManagement + where x.ProjectId == this.CurrUser.LoginProjectId && x.IsOnceQualified == true + select x).ToList(); + List TotalCheckDetailLists = (from x in db.ProcessControl_InspectionManagement + where x.ProjectId == this.CurrUser.LoginProjectId + select x).ToList(); + Model.SingleSerie s = new Model.SingleSerie(); + Model.SingleSerie s2 = new Model.SingleSerie(); + List listdata = new List(); + List listdata2 = new List(); + double result = 0, result2 = 0; + foreach (var cn in cns) + { + listCategories.Add(cn.ProfessionalName); + var okChecks = TotalCheckDetailOKLists.Where(x => x.CNProfessionalId == cn.CNProfessionalId).ToList(); + var totalChecks = TotalCheckDetailLists.Where(x => x.CNProfessionalId == cn.CNProfessionalId).ToList(); + if (okChecks.Count > 0 && totalChecks.Count > 0) + { + var a = Convert.ToDouble(okChecks.Count); + var b = Convert.ToDouble(totalChecks.Count); + result = Convert.ToDouble(decimal.Round(decimal.Parse((a / b * 100).ToString()), 1)); + } + if (cn.ProfessionalName.Contains("管道")) + { + var ndtList = (from x in db.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" && x.ProjectId == this.CurrUser.LoginProjectId orderby x.CreateDate descending select x).FirstOrDefault(); + if (ndtList != null && !string.IsNullOrEmpty(ndtList.TotalRate)) + { + result2 = Convert.ToDouble(ndtList.TotalRate); + } + } + listdata.Add(result); + listdata2.Add(result2); + result = 0; + result2 = 0; + } + s.data = listdata; + s2.data = listdata2; + series.Add(s); + series.Add(s2); } - s.data = listdata; - s2.data = listdata2; - series.Add(s); - series.Add(s2); businessColumn.categories = listCategories; businessColumn.series = series; return JsonConvert.SerializeObject(businessColumn); + } } diff --git a/SGGL/FineUIPro.Web/common/main_new1.aspx.cs b/SGGL/FineUIPro.Web/common/main_new1.aspx.cs index a1f0cc7d..eddc0f93 100644 --- a/SGGL/FineUIPro.Web/common/main_new1.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new1.aspx.cs @@ -141,7 +141,7 @@ namespace FineUIPro.Web.common /// 获取项目部人数 /// /// - public int GetProjectPersonNum() + public int GetProjectPersonNum() { if (pids == null) { @@ -154,18 +154,18 @@ namespace FineUIPro.Web.common else { int result = (from x in Funs.DB.SitePerson_Person join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where y.IsCQMS == true && x.IsUsed == true && pids.Contains(x.ProjectId) + where y.IsCQMS == true && x.IsUsed == true && pids.Contains(x.ProjectId) select x).Count(); return result; } - + } /// /// 获取在用计量器具数 /// /// - public int GetUseNum() + public int GetUseNum() { if (pids == null) { @@ -180,13 +180,13 @@ namespace FineUIPro.Web.common select x).Count(); return result; } - + } /// /// 获取校准合格数 /// /// - public int GetOKNum() + public int GetOKNum() { if (pids == null) { @@ -207,7 +207,7 @@ namespace FineUIPro.Web.common /// 机械预警 /// /// - public int GetJxyjNum() + public int GetJxyjNum() { if (pids == null) { @@ -237,7 +237,7 @@ namespace FineUIPro.Web.common /// 获取质量培训人次数 /// /// - public int GetTrainPersonNum() + public int GetTrainPersonNum() { if (pids == null) { @@ -258,7 +258,7 @@ namespace FineUIPro.Web.common /// 获取技术交底人次数 /// /// - public int GetTechnicalDisclosePersonNum() + public int GetTechnicalDisclosePersonNum() { if (pids == null) { @@ -269,7 +269,7 @@ namespace FineUIPro.Web.common } else { var result = (from x in Funs.DB.Comprehensive_DesignDetails - where pids.Contains(x.ProjectId) + where pids.Contains(x.ProjectId) select x.JoinPersonNum ?? 0).ToList().Sum(); var q = Funs.GetNewIntOrZero(result.ToString()); return q; @@ -308,7 +308,7 @@ namespace FineUIPro.Web.common /// 共检总数 /// /// - public int getAllInspectionManagement() + public int getAllInspectionManagement() { if (pids == null) { @@ -328,10 +328,10 @@ namespace FineUIPro.Web.common else { int result = 0; var num1 = (from x in Funs.DB.ProcessControl_InspectionManagement - where pids.Contains(x.ProjectId) + where pids.Contains(x.ProjectId) select x).Count(); result = num1; - + return result; } } @@ -339,7 +339,7 @@ namespace FineUIPro.Web.common /// 次合格数量 /// /// - public int getIsOnceInspectionManagement() + public int getIsOnceInspectionManagement() { if (pids == null) { @@ -360,13 +360,13 @@ namespace FineUIPro.Web.common } else { int result = 0; - + var num2 = (from x in Funs.DB.ProcessControl_InspectionManagement where x.IsOnceQualified == true && pids.Contains(x.ProjectId) select x).Count(); result = num2; - + return result; } } @@ -374,7 +374,7 @@ namespace FineUIPro.Web.common /// 整改率 /// /// - public string GetInspectionManagementZgl() + public string GetInspectionManagementZgl() { string zgl = String.Format("{0:N2}", 100.0 * getIsOnceInspectionManagement() / getAllInspectionManagement()); return zgl + "%"; @@ -388,7 +388,7 @@ namespace FineUIPro.Web.common /// 获取整改完成数 /// /// - public int GetProblemCompletedNum() + public int GetProblemCompletedNum() { if (pids == null) { @@ -408,7 +408,7 @@ namespace FineUIPro.Web.common /// 获取未整改数 /// /// - public int GetProblemNotCompletedNum() + public int GetProblemNotCompletedNum() { if (pids == null) { @@ -429,7 +429,7 @@ namespace FineUIPro.Web.common /// 整改率 /// /// - public string GetProblemZgl() + public string GetProblemZgl() { string zgl = String.Format("{0:N2}", 100.0 * GetProblemCompletedNum() / (GetProblemCompletedNum() + GetProblemNotCompletedNum())); return zgl + "%"; @@ -453,7 +453,7 @@ namespace FineUIPro.Web.common /// 获取问题个数 /// /// - public int GetProblemNum() + public int GetProblemNum() { if (pids == null) { @@ -475,7 +475,7 @@ namespace FineUIPro.Web.common /// 获取焊工总数 /// /// - public int GetWelderNum() + public int GetWelderNum() { if (pids == null) { @@ -496,7 +496,7 @@ namespace FineUIPro.Web.common /// 获取总达因数 /// /// - public int GetTotalDineNum() + public int GetTotalDineNum() { if (pids == null) { @@ -553,7 +553,7 @@ namespace FineUIPro.Web.common /// 获取完成达因数 /// /// - public int GetCompleteDineNum() + public int GetCompleteDineNum() { if (pids == null) { @@ -651,7 +651,7 @@ namespace FineUIPro.Web.common /// 获取合格片数 /// /// - public int GetOKFilmNum() + public int GetOKFilmNum() { if (pids == null) { @@ -684,7 +684,7 @@ namespace FineUIPro.Web.common /// 一次拍片合格率 /// /// - public string GetOKFilmHgl() + public string GetOKFilmHgl() { string zgl = "0"; if (GetOKFilmNum() > 0) @@ -707,57 +707,114 @@ namespace FineUIPro.Web.common private void getInspectionManagementInfo() { - //var q=(from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); - var q = (from x in Funs.DB.Control_PointCropping where x.ParentId == null || x.ParentId == "" orderby x.OperateTime select x).ToList(); - - - foreach (var item in q) + if (this.CurrUser.UserId == BLL.Const.hfnbdId) { - //获取专业 - InspectionManagementZy += "'" + item.DetectionItems + "',"; - //根据专业获取总计 - //var num1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - // where y.CNProfessionalId == item.CNProfessionalId - // select x).ToList().Count; - var num1 = 0; - var num2 = 0; - if (pids == null) + //var q=(from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); + var q = (from x in Funs.DB.Control_PointCropping where x.ParentId == null || x.ParentId == "" orderby x.OperateTime select x).ToList(); + + + foreach (var item in q) { - num1 = (from x in Funs.DB.ProcessControl_InspectionManagement - where x.CNProfessionalId == item.ControlId - select x).Count(); - num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + //获取专业 + InspectionManagementZy += "'" + item.DetectionItems + "',"; + //根据专业获取总计 + //var num1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId + // where y.CNProfessionalId == item.CNProfessionalId + // select x).ToList().Count; + var num1 = 0; + var num2 = 0; + if (pids == null) + { + num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.ControlId + select x).Count(); + num2 = (from x in Funs.DB.ProcessControl_InspectionManagement where x.CNProfessionalId == item.ControlId && x.IsOnceQualified == true select x).Count(); - } - else { - num1 = (from x in Funs.DB.ProcessControl_InspectionManagement - where x.CNProfessionalId == item.ControlId && pids.Contains(x.ProjectId) - select x).Count(); - num2 = (from x in Funs.DB.ProcessControl_InspectionManagement - where x.CNProfessionalId == item.ControlId && x.IsOnceQualified == true && pids.Contains(x.ProjectId) - select x).Count(); - } - - - InspectionManagementSumCount += "'" + num1 + "',"; + } + else + { + num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.ControlId && pids.Contains(x.ProjectId) + select x).Count(); + num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.ControlId && x.IsOnceQualified == true && pids.Contains(x.ProjectId) + select x).Count(); + } - //根据专业获取合格数 - //var num2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail - // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId - // where y.CNProfessionalId == item.CNProfessionalId && y.IsOnceQualified==true - // select x).ToList().Count; + + InspectionManagementSumCount += "'" + num1 + "',"; + + //根据专业获取合格数 + //var num2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId + // where y.CNProfessionalId == item.CNProfessionalId && y.IsOnceQualified==true + // select x).ToList().Count; + + InspectionManagementOkCount += "'" + num2 + "',"; + + //一次验收合格率 + var hgl = "0"; + if (num1 > 0) + { + hgl += String.Format("{0:N2}", 100.0 * num2 / num1); + } + InspectionManagementOneOkCount += "'" + hgl + "',"; + } + } + else + { + var q = (from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId orderby x.SortIndex select x).ToList(); - InspectionManagementOkCount += "'" + num2 + "',"; - - //一次验收合格率 - var hgl = "0"; - if (num1 > 0) + foreach (var item in q) { - hgl += String.Format("{0:N2}", 100.0 * num2 / num1); + //获取专业 + InspectionManagementZy += "'" + item.ProfessionalName + "',"; + //根据专业获取总计 + //var num1 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId + // where y.CNProfessionalId == item.CNProfessionalId + // select x).ToList().Count; + var num1 = 0; + var num2 = 0; + if (pids == null) + { + num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId + select x).Count(); + num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true + select x).Count(); + } + else + { + num1 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId && pids.Contains(x.ProjectId) + select x).Count(); + num2 = (from x in Funs.DB.ProcessControl_InspectionManagement + where x.CNProfessionalId == item.CNProfessionalId && x.IsOnceQualified == true && pids.Contains(x.ProjectId) + select x).Count(); + } + + InspectionManagementSumCount += "'" + num1 + "',"; + + //根据专业获取合格数 + //var num2 = (from x in Funs.DB.ProcessControl_InspectionManagementDetail + // join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId + // where y.CNProfessionalId == item.CNProfessionalId && y.IsOnceQualified==true + // select x).ToList().Count; + + InspectionManagementOkCount += "'" + num2 + "',"; + + //一次验收合格率 + var hgl = "0"; + if (num1 > 0) + { + hgl += String.Format("{0:N2}", 100.0 * num2 / num1); + } + InspectionManagementOneOkCount += "'" + hgl + "',"; } - InspectionManagementOneOkCount += "'" + hgl + "',"; } InspectionManagementZy = InspectionManagementZy.TrimEnd(','); InspectionManagementSumCount = InspectionManagementSumCount.TrimEnd(',');