7171 lines
319 KiB
C#
7171 lines
319 KiB
C#
using BLL;
|
||
using FineUIPro.Web.BaseInfo;
|
||
using FineUIPro.Web.DataShow;
|
||
using FineUIPro.Web.HJGL.FL;
|
||
using ICSharpCode.SharpZipLib.Checksum;
|
||
using Model;
|
||
using Newtonsoft.Json.Linq;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Threading;
|
||
using System.Threading.Tasks;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
namespace FineUIPro.Web.CQMS.ManageReportNew
|
||
{
|
||
public partial class MonthReportEdit : PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 主键
|
||
/// </summary>
|
||
public string ReportId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["ReportId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["ReportId"] = value;
|
||
}
|
||
}
|
||
|
||
public string AddOrUpdate
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["AddOrUpdate"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["AddOrUpdate"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
public Model.SGGLDB db = Funs.DB;
|
||
|
||
#region 列表集合
|
||
private static List<Model.Report_CqmsTarget> detailsGrid1 = new List<Model.Report_CqmsTarget>();
|
||
|
||
/// <summary>
|
||
/// 18.本月质量问题处理情况
|
||
/// (1)原材料问题
|
||
/// </summary>
|
||
private static List<Model.Report_RowMaterialProblem> rowMaterialProblemLists = new List<Model.Report_RowMaterialProblem>();
|
||
|
||
/// <summary>
|
||
/// 18.本月质量问题处理情况
|
||
/// (2)施工过程问题
|
||
/// </summary>
|
||
private static List<Model.Report_ConstructionProblems> constructionProblemsLists = new List<Model.Report_ConstructionProblems>();
|
||
|
||
/// <summary>
|
||
/// 19.下月质量控制重点
|
||
/// </summary>
|
||
private static List<Model.Report_NextQualityControl> nextQualityControlLists = new List<Model.Report_NextQualityControl>();
|
||
#endregion
|
||
|
||
#region 加载所有单位
|
||
[Serializable]
|
||
public class UnitClass
|
||
{
|
||
public string UnitId { get; set; }
|
||
public string UnitName { get; set; }
|
||
|
||
public string UnitType { get; set; }
|
||
}
|
||
|
||
//public List<UnitClass> units = new List<UnitClass>();
|
||
|
||
public List<UnitClass> units
|
||
{
|
||
get
|
||
{
|
||
return (List<UnitClass>)ViewState["units"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["units"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载所有专业
|
||
[Serializable]
|
||
public class ProfessionalsClass
|
||
{
|
||
public string CNProfessionalId { get; set; }
|
||
public string ProfessionalName { get; set; }
|
||
}
|
||
|
||
//public List<ProfessionalsClass> CNProfessionals = new List<ProfessionalsClass>();
|
||
public List<ProfessionalsClass> CNProfessionals
|
||
{
|
||
get
|
||
{
|
||
return (List<ProfessionalsClass>)ViewState["CNProfessionals"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["CNProfessionals"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
//加载所有单位
|
||
units = (from x in db.Project_ProjectUnit
|
||
join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||
orderby y.UnitCode
|
||
select new UnitClass { UnitId = x.UnitId, UnitName = y.UnitName, UnitType = x.UnitType }).ToList();
|
||
//加载所有专业
|
||
CNProfessionals = (from x in db.Base_CNProfessional
|
||
where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId
|
||
&& x.CNProfessionalId != BLL.Const.CNProfessionalHSEId
|
||
orderby x.SortIndex
|
||
select new ProfessionalsClass
|
||
{
|
||
CNProfessionalId = x.CNProfessionalId,
|
||
ProfessionalName = x.ProfessionalName
|
||
}).ToList();
|
||
|
||
BLL.UnitService.InitUnitNameByProjectIdUnitTypeDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false);
|
||
BLL.UnitService.InitUnitDownListByText(this.drpUnitIdGrid9, this.CurrUser.LoginProjectId, true);
|
||
this.EnableViewState = true;
|
||
this.lblProjectName.Text = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||
this.ReportId = Request.Params["reportId"];
|
||
if (!string.IsNullOrEmpty(Request.Params["view"]))
|
||
{
|
||
this.Button1.Hidden = true;
|
||
this.Button2.Hidden = true;
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(this.ReportId))
|
||
{
|
||
Model.Report_WeekAndMonthReport_New weekAndMonthReport = WeekAndMonthReportNewService.Detail(this.ReportId);
|
||
if (weekAndMonthReport != null)
|
||
{
|
||
if (weekAndMonthReport.SortId != null)
|
||
{
|
||
this.txtPeriod.Text = Convert.ToString(weekAndMonthReport.SortId);
|
||
}
|
||
if (weekAndMonthReport.StartDate != null)
|
||
{
|
||
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.StartDate);
|
||
}
|
||
if (weekAndMonthReport.EndDate != null)
|
||
{
|
||
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.EndDate);
|
||
}
|
||
}
|
||
AddOrUpdate = "update";
|
||
|
||
#region 加载本月质量目标管理情况
|
||
detailsGrid1.Clear();
|
||
detailsGrid1 = (from x in db.Report_CqmsTarget
|
||
where x.ReportId == this.ReportId
|
||
orderby x.SortId
|
||
select x).ToList();
|
||
if (detailsGrid1.Count > 0)
|
||
{
|
||
Grid1.Hidden = false;
|
||
Grid1.DataSource = detailsGrid1;
|
||
Grid1.DataBind();
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 加载7.2 PQR/WPS报验情况
|
||
var detailsGrid9 = (from x in db.Report_Construction_Plan
|
||
where x.ReportId == ReportId && x.ReType == "5"
|
||
select x).ToList();
|
||
if (detailsGrid9.Count > 0)
|
||
{
|
||
Grid9.Hidden = false;
|
||
Grid9.DataSource = detailsGrid9;
|
||
Grid9.DataBind();
|
||
}
|
||
if (!string.IsNullOrEmpty(Request.Params["view"]))
|
||
{
|
||
//查看页面
|
||
Button4.Hidden = true;
|
||
Button3.Hidden = true;
|
||
//合计
|
||
OutPutSummaryGrid9();
|
||
Grid1.FindColumn("Delete1").Hidden = true;
|
||
Grid9.FindColumn("Delete9").Hidden = true;
|
||
}
|
||
#endregion
|
||
|
||
#region 加载18.本月质量问题处理情况
|
||
//(1)原材料问题
|
||
rowMaterialProblemLists.Clear();
|
||
rowMaterialProblemLists = (from x in db.Report_RowMaterialProblem
|
||
where x.ReportId == this.ReportId
|
||
select x).ToList();
|
||
if (rowMaterialProblemLists.Count > 0)
|
||
{
|
||
gvRowMaterialProblem.Hidden = false;
|
||
gvRowMaterialProblem.DataSource = rowMaterialProblemLists;
|
||
gvRowMaterialProblem.DataBind();
|
||
}
|
||
//(2)施工过程问题
|
||
constructionProblemsLists.Clear();
|
||
constructionProblemsLists = (from x in db.Report_ConstructionProblems
|
||
where x.ReportId == this.ReportId
|
||
select x).ToList();
|
||
if (constructionProblemsLists.Count > 0)
|
||
{
|
||
gvConstructionProblems.Hidden = false;
|
||
gvConstructionProblems.DataSource = constructionProblemsLists;
|
||
gvConstructionProblems.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 加载19.下月质量控制重点
|
||
nextQualityControlLists.Clear();
|
||
nextQualityControlLists = (from x in db.Report_NextQualityControl
|
||
where x.ReportId == this.ReportId
|
||
select x).ToList();
|
||
if (nextQualityControlLists.Count > 0)
|
||
{
|
||
gvNextQualityControl.Hidden = false;
|
||
gvNextQualityControl.DataSource = nextQualityControlLists;
|
||
gvNextQualityControl.DataBind();
|
||
}
|
||
#endregion
|
||
|
||
#region 加载文本框内容
|
||
var txtReportList = db.Report_TextBoxContent.Where(x => x.ReportId == ReportId).ToList();
|
||
if (txtReportList.Count > 0)
|
||
{
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "0") != null)
|
||
{
|
||
txtAre0.Text = txtReportList.FirstOrDefault(x => x.ContentType == "0").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "1") != null)
|
||
{
|
||
txtAre1.Text = txtReportList.FirstOrDefault(x => x.ContentType == "1").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "2") != null)
|
||
{
|
||
txtAre2.Text = txtReportList.FirstOrDefault(x => x.ContentType == "2").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "20") != null)
|
||
{
|
||
txtAre20.Text = txtReportList.FirstOrDefault(x => x.ContentType == "20").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "21") != null)
|
||
{
|
||
txtAre21.Text = txtReportList.FirstOrDefault(x => x.ContentType == "21").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "22") != null)
|
||
{
|
||
txtAre22.Text = txtReportList.FirstOrDefault(x => x.ContentType == "22").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "8") != null)
|
||
{
|
||
txtAre8.Text = txtReportList.FirstOrDefault(x => x.ContentType == "8").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "23-1") != null)
|
||
{
|
||
imgPhoto.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ImageUrl;
|
||
txtPhotoContent1.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "23-2") != null)
|
||
{
|
||
imgPhoto2.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ImageUrl;
|
||
txtPhotoContent2.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "23-3") != null)
|
||
{
|
||
imgPhoto3.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ImageUrl;
|
||
txtPhotoContent3.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "23-4") != null)
|
||
{
|
||
imgPhoto4.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ImageUrl;
|
||
txtPhotoContent4.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "23-5") != null)
|
||
{
|
||
imgPhoto5.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ImageUrl;
|
||
txtPhotoContent5.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ContentText;
|
||
}
|
||
if (txtReportList.FirstOrDefault(x => x.ContentType == "23-6") != null)
|
||
{
|
||
imgPhoto6.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ImageUrl;
|
||
txtPhotoContent6.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ContentText;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
//加载所有grid
|
||
// lodAllGrid("1");
|
||
objType = "1";
|
||
RegisterAsyncTask(new PageAsyncTask(lodAllGrid));
|
||
}
|
||
else
|
||
{
|
||
this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : Request.Params["startdate"];
|
||
this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtStartDate.Text).AddMonths(1).AddDays(-1)) : Request.Params["enddate"];
|
||
//给个新的主键
|
||
ReportId = Guid.NewGuid().ToString();
|
||
AddOrUpdate = "add";
|
||
|
||
//加载所有grid
|
||
// lodAllGrid("0");
|
||
objType = "0";
|
||
RegisterAsyncTask(new PageAsyncTask(lodAllGrid));
|
||
|
||
|
||
}
|
||
|
||
//Grid10.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//gvTj.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//GvSb.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//GvGD.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//GvDq.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//GvYb.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//GvFf.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
//GvXf.EmptyText = "<raw><div class=\"grid-empty-text\">无数据</div></raw>";
|
||
|
||
hidReportId.Value = ReportId;
|
||
}
|
||
}
|
||
string objType;
|
||
/// <summary>
|
||
/// 加载grid
|
||
/// </summary>
|
||
/// <param name="objType"></param>
|
||
async Task lodAllGrid()
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var units21 = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
var units2 = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2).ToList();
|
||
|
||
var remarks = loadRemarksDt();
|
||
var cqmsRemarks = cqmsRemarksDt();
|
||
var generalPlanApproval = loadGeneralPlanApprovalDt();
|
||
var majorPlanApproval = loadMajorPlanApprovalDt();
|
||
var inspectionTestPlan = loadInspectionTestPlanDt();
|
||
var designDetailsApprove = loadDesignDetailsApproveDt();
|
||
var reviewDrawings = loadReviewDrawingsDt();
|
||
var designChangeOrder = loadDesignChangeOrderDt();
|
||
var passWelder = loadPassWelderDt();
|
||
var processControl_NondestructiveTest = loadProcessControl_NondestructiveTest_NewDt();
|
||
var inspectionEquipment = LoadInspectionEquipmentDt();
|
||
var measuringInspection = LoadMeasuringInspectionDt();
|
||
var checkLotBindStatisc = CheckLotBindStatiscDt();
|
||
var pressureInspection = LoadPressureInspectionDt();
|
||
var InspectionDataInspection = loadInspectionDataInspectionDt();
|
||
var pipingInspection = LoadPipingInspectionDt();
|
||
var specialInspection = LoadSpecialInspectionDt();
|
||
var ncrManagementInspection = LoadNcrManagementInspectionDt();
|
||
var qualityInspection = LoadQualityInspectionDt();
|
||
var specialCheck = loadSpecialCheckDt();
|
||
var fileReport = loadFileReportDt();
|
||
await Task.WhenAll(new[] { remarks, cqmsRemarks, generalPlanApproval, majorPlanApproval, inspectionTestPlan, designDetailsApprove, reviewDrawings, designChangeOrder, passWelder, processControl_NondestructiveTest, inspectionEquipment, measuringInspection, checkLotBindStatisc, InspectionDataInspection, pressureInspection, pipingInspection, specialInspection, ncrManagementInspection, qualityInspection, specialCheck, fileReport });
|
||
|
||
var generalPlanApprovalData = await generalPlanApproval;
|
||
var remarksData = await remarks;
|
||
var cqmsRemarksData = await cqmsRemarks;
|
||
var majorPlanApprovalData = await majorPlanApproval;
|
||
var inspectionTestPlanData = await inspectionTestPlan;
|
||
var designDetailsApproveData = await designDetailsApprove;
|
||
var reviewDrawingsData = await reviewDrawings;
|
||
var designChangeOrderData = await designChangeOrder;
|
||
var passWelderData = await passWelder;
|
||
var processControl_NondestructiveTestData = await processControl_NondestructiveTest;
|
||
var inspectionEquipmentData = await inspectionEquipment;
|
||
var measuringInspectionData = await measuringInspection;
|
||
var checkLotBindStatiscData = await checkLotBindStatisc;
|
||
var InspectionDataInspectionData = await InspectionDataInspection;
|
||
var pressureInspectionData = await pressureInspection;
|
||
var pipingInspectionData = await pipingInspection;
|
||
var specialInspectionData = await specialInspection;
|
||
var ncrManagementInspectionData = await ncrManagementInspection;
|
||
var qualityInspectionData = await qualityInspection;
|
||
var specialCheckData = await specialCheck;
|
||
var fileReportData = await fileReport;
|
||
Dictionary<string, string> remarksDic = new Dictionary<string, string>();
|
||
Dictionary<string, string> cqmsremarksDic = new Dictionary<string, string>();
|
||
if (remarksData != null)
|
||
{
|
||
foreach (DataRow row in remarksData.Rows)
|
||
{
|
||
string UnitOrMajor = row["UnitOrMajor"].ToString();
|
||
string Remarks = row["Remarks"].ToString();
|
||
string ReType = row["ReType"].ToString();
|
||
if (!remarksDic.ContainsKey(UnitOrMajor + ReType))
|
||
{
|
||
remarksDic.Add(UnitOrMajor + ReType, Remarks);
|
||
}
|
||
}
|
||
|
||
}
|
||
if (cqmsRemarksData != null)
|
||
{
|
||
foreach (DataRow row in cqmsRemarksData.Rows)
|
||
{
|
||
string ContentName = row["ContentName"].ToString();
|
||
string Remarks = row["Remarks"].ToString();
|
||
string ReType = row["ReType"].ToString();
|
||
if (!cqmsremarksDic.ContainsKey(ContentName + ReType))
|
||
{
|
||
cqmsremarksDic.Add(ContentName + ReType, Remarks);
|
||
}
|
||
}
|
||
|
||
}
|
||
if (generalPlanApprovalData != null)
|
||
{
|
||
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
|
||
foreach (DataRow row in generalPlanApprovalData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
DateTime? ApprovalDate = Funs.GetNewDateTime(row["ApprovalDate"].ToString());
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (ApprovalDate.HasValue && ApprovalDate.Value >= startDate && ApprovalDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
|
||
foreach (var item in units21)
|
||
{
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.UnitName;
|
||
model.Quantity1 = 0;
|
||
model.Quantity2 = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.Quantity1 = Quantity1Dic[item.UnitId];
|
||
}
|
||
if (Quantity2Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.Quantity2 = Quantity2Dic[item.UnitId];
|
||
}
|
||
if (remarksDic.ContainsKey(item.UnitName + "1"))
|
||
{
|
||
model.Remarks = remarksDic[item.UnitName + "1"];
|
||
}
|
||
model.ReportId = ReportId;
|
||
list.Add(model);
|
||
Quantity1Sum += model.Quantity1.Value;
|
||
Quantity2Sum += model.Quantity2.Value;
|
||
|
||
}
|
||
Grid2.DataSource = list;
|
||
Grid2.DataBind();
|
||
}
|
||
|
||
if (majorPlanApprovalData != null)
|
||
{
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
int Quantity3Sum = 0;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in majorPlanApprovalData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
string IsReview = row["IsReview"].ToString();
|
||
DateTime? ApprovalDate = Funs.GetNewDateTime(row["ApprovalDate"].ToString());
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (ApprovalDate.HasValue && ApprovalDate.Value >= startDate && ApprovalDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
if (IsReview == "1" || IsReview == "true" || IsReview == "True")
|
||
{
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
|
||
|
||
foreach (var item in units21)
|
||
{
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.UnitName;
|
||
model.Quantity1 = 0;
|
||
model.Quantity2 = 0;
|
||
model.Quantity3 = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.Quantity1 = Quantity1Dic[item.UnitId];
|
||
}
|
||
if (Quantity2Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.Quantity2 = Quantity2Dic[item.UnitId];
|
||
}
|
||
if (Quantity3Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.Quantity3 = Quantity3Dic[item.UnitId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
if (remarksDic.ContainsKey(item.UnitName + "1"))
|
||
{
|
||
model.Remarks = remarksDic[item.UnitName + "1"];
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += model.Quantity1.Value;
|
||
Quantity2Sum += model.Quantity2.Value;
|
||
Quantity3Sum += model.Quantity3.Value;
|
||
}
|
||
Grid3.DataSource = list;
|
||
Grid3.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
summary.Add("Quantity3", Quantity3Sum.ToString());
|
||
Grid3.SummaryData = summary;
|
||
}
|
||
|
||
if (inspectionTestPlanData != null)
|
||
{
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有专业
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
|
||
foreach (DataRow row in inspectionTestPlanData.Rows)
|
||
{
|
||
string CNProfessionalId = row["CNProfessionalId"].ToString();
|
||
DateTime? ApprovalDate = Funs.GetNewDateTime(row["ApprovalDate"].ToString());
|
||
if (!Quantity2Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity2Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1;
|
||
|
||
if (!Quantity1Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity1Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (ApprovalDate.HasValue && ApprovalDate.Value >= startDate && ApprovalDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1;
|
||
}
|
||
}
|
||
|
||
foreach (var item in CNProfessionals)
|
||
{
|
||
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.ProfessionalName;
|
||
model.Quantity1 = 0;
|
||
model.Quantity2 = 0;
|
||
if (Quantity1Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
model.Quantity1 = Quantity1Dic[item.CNProfessionalId];
|
||
}
|
||
if (Quantity2Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
model.Quantity2 = Quantity2Dic[item.CNProfessionalId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
if (remarksDic.ContainsKey(item.ProfessionalName + "2"))
|
||
{
|
||
model.Remarks = remarksDic[item.ProfessionalName + "2"];
|
||
|
||
}
|
||
list.Add(model);
|
||
Quantity1Sum += model.Quantity1.Value;
|
||
Quantity2Sum += model.Quantity2.Value;
|
||
}
|
||
Grid4.DataSource = list;
|
||
Grid4.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid4.SummaryData = summary;
|
||
}
|
||
|
||
if (designDetailsApproveData != null)
|
||
{
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
|
||
|
||
foreach (DataRow row in designDetailsApproveData.Rows)
|
||
{
|
||
string CNProfessionalId = row["CNProfessionalId"].ToString();
|
||
DateTime? CompileDate = Funs.GetNewDateTime(row["CompileDate"].ToString());
|
||
if (!Quantity2Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity2Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1;
|
||
|
||
if (!Quantity1Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity1Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (CompileDate.HasValue && CompileDate.Value >= startDate && CompileDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1;
|
||
}
|
||
}
|
||
foreach (var item in CNProfessionals)
|
||
{
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.ProfessionalName;
|
||
model.Quantity1 = 0;
|
||
model.Quantity2 = 0;
|
||
if (Quantity1Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
model.Quantity1 = Quantity1Dic[item.CNProfessionalId];
|
||
}
|
||
if (Quantity2Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
model.Quantity2 = Quantity2Dic[item.CNProfessionalId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (remarksDic.ContainsKey(item.ProfessionalName + "3"))
|
||
{
|
||
model.Remarks = remarksDic[item.ProfessionalName + "3"];
|
||
}
|
||
list.Add(model);
|
||
Quantity1Sum += model.Quantity1.Value;
|
||
Quantity2Sum += model.Quantity2.Value;
|
||
}
|
||
Grid5.DataSource = list;
|
||
Grid5.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid5.SummaryData = summary;
|
||
}
|
||
|
||
if (reviewDrawingsData != null)
|
||
{
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in reviewDrawingsData.Rows)
|
||
{
|
||
string CNProfessionalId = row["CNProfessionalId"].ToString();
|
||
DateTime? ReviewDate = Funs.GetNewDateTime(row["ReviewDate"].ToString());
|
||
if (!Quantity2Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity2Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1;
|
||
|
||
if (!Quantity1Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity1Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (ReviewDate.HasValue && ReviewDate.Value >= startDate && ReviewDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1;
|
||
}
|
||
}
|
||
foreach (var item in CNProfessionals)
|
||
{
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.ProfessionalName;
|
||
model.Quantity1 = 0;
|
||
model.Quantity2 = 0;
|
||
if (Quantity1Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
model.Quantity1 = Quantity1Dic[item.CNProfessionalId];
|
||
}
|
||
if (Quantity2Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
model.Quantity2 = Quantity2Dic[item.CNProfessionalId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (remarksDic.ContainsKey(item.ProfessionalName + "4"))
|
||
{
|
||
model.Remarks = remarksDic[item.ProfessionalName + "4"];
|
||
}
|
||
list.Add(model);
|
||
Quantity1Sum += model.Quantity1.Value;
|
||
Quantity2Sum += model.Quantity2.Value;
|
||
}
|
||
Grid6.DataSource = list;
|
||
Grid6.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid6.SummaryData = summary;
|
||
}
|
||
|
||
if (designChangeOrderData != null)
|
||
{
|
||
int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0;
|
||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||
List<Model.CheckStatisc> StatisticsList = new List<Model.CheckStatisc>();
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
if (project != null)
|
||
{
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
}
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity4Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity5Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity6Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in designChangeOrderData.Rows)
|
||
{
|
||
string CNProfessionalId = row["CNProfessionalId"].ToString();
|
||
string ImplementationFrontState = row["ImplementationFrontState"].ToString();
|
||
DateTime? IssuedDate = Funs.GetNewDateTime(row["IssuedDate"].ToString());
|
||
string ApprovalDate = row["ApprovalDate"].ToString();
|
||
|
||
if (!Quantity1Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity1Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity2Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity3Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (!Quantity4Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity4Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (!Quantity5Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity5Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
if (!Quantity6Dic.ContainsKey(CNProfessionalId))
|
||
{
|
||
Quantity6Dic.Add(CNProfessionalId, 0);
|
||
}
|
||
|
||
if (IssuedDate.HasValue && IssuedDate.Value >= projectStartDate && IssuedDate.Value <= DateTime.Now)
|
||
{
|
||
Quantity2Dic[CNProfessionalId] = Quantity2Dic[CNProfessionalId] + 1;
|
||
if (!string.IsNullOrEmpty(ApprovalDate))
|
||
{
|
||
Quantity4Dic[CNProfessionalId] = Quantity4Dic[CNProfessionalId] + 1;
|
||
|
||
}
|
||
if (ImplementationFrontState == "已完成")
|
||
{
|
||
Quantity6Dic[CNProfessionalId] = Quantity6Dic[CNProfessionalId] + 1;
|
||
}
|
||
}
|
||
if (IssuedDate.HasValue && IssuedDate.Value >= startDate && IssuedDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[CNProfessionalId] = Quantity1Dic[CNProfessionalId] + 1;
|
||
if (!string.IsNullOrEmpty(ApprovalDate))
|
||
{
|
||
Quantity3Dic[CNProfessionalId] = Quantity3Dic[CNProfessionalId] + 1;
|
||
}
|
||
if (ImplementationFrontState == "已完成")
|
||
{
|
||
Quantity5Dic[CNProfessionalId] = Quantity5Dic[CNProfessionalId] + 1;
|
||
}
|
||
}
|
||
}
|
||
int i = 1;
|
||
var cNProfessionals = from x in db.Base_CNProfessional
|
||
where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId
|
||
&& x.CNProfessionalId != BLL.Const.ComprehensiveId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId
|
||
orderby x.SortIndex
|
||
select x;
|
||
foreach (var item in cNProfessionals)
|
||
{
|
||
//专业下所有集合
|
||
List<Model.Comprehensive_DesignChangeOrder> totalManagementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, projectStartDate, DateTime.Now);
|
||
//专业下当期集合
|
||
List<Model.Comprehensive_DesignChangeOrder> managementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, startDate, endDate);
|
||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||
checkStatisc.Num = i;
|
||
checkStatisc.WorkName = item.ProfessionalName;
|
||
|
||
checkStatisc.OneOKRate = "0";
|
||
checkStatisc.TotalOneOKRate = "0";
|
||
if (Quantity1Dic.ContainsKey(item.CNProfessionalId))
|
||
{
|
||
checkStatisc.CheckNum = Quantity1Dic[item.CNProfessionalId];
|
||
checkStatisc.TotalCheckNum = Quantity2Dic[item.CNProfessionalId];
|
||
checkStatisc.OKNum = Quantity3Dic[item.CNProfessionalId];
|
||
checkStatisc.TotalOKNum = Quantity4Dic[item.CNProfessionalId];
|
||
checkStatisc.OneOKRate = Quantity5Dic[item.CNProfessionalId].ToString(); //当期完成数
|
||
checkStatisc.TotalOneOKRate = Quantity6Dic[item.CNProfessionalId].ToString(); //累计完成数
|
||
}
|
||
StatisticsList.Add(checkStatisc);
|
||
Quantity1Sum += checkStatisc.CheckNum;
|
||
Quantity2Sum += checkStatisc.TotalCheckNum;
|
||
Quantity3Sum += checkStatisc.OKNum;
|
||
Quantity4Sum += checkStatisc.TotalOKNum;
|
||
Quantity5Sum += Convert.ToInt32(checkStatisc.OneOKRate);
|
||
Quantity6Sum += Convert.ToInt32(checkStatisc.TotalOneOKRate);
|
||
|
||
}
|
||
|
||
Grid7.DataSource = StatisticsList;
|
||
Grid7.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
summary.Add("CheckNum", Quantity1Sum.ToString());
|
||
summary.Add("TotalCheckNum", Quantity2Sum.ToString());
|
||
summary.Add("OKNum", Quantity3Sum.ToString());
|
||
summary.Add("TotalOKNum", Quantity4Sum.ToString());
|
||
summary.Add("OneOKRate", Quantity5Sum.ToString());
|
||
summary.Add("TotalOneOKRate", Quantity6Sum.ToString());
|
||
Grid7.SummaryData = summary;
|
||
}
|
||
|
||
if (passWelderData != null)
|
||
{
|
||
int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0, Quantity7Sum = 0, Quantity8Sum = 0;
|
||
|
||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||
List<Model.PassWelderStatisc> StatisticsList = new List<Model.PassWelderStatisc>();
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
if (project != null)
|
||
{
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
}
|
||
int i = 1;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity4Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity5Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity6Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity7Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity8Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in passWelderData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
string ProfessionalName = row["ProfessionalName"].ToString();
|
||
DateTime? ApprovalTime = Funs.GetNewDateTime(row["ApprovalTime"].ToString());
|
||
string PostName = row["PostName"].ToString();
|
||
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity4Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity4Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity5Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity5Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity6Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity6Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity7Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity7Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity8Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity8Dic.Add(UnitId, 0);
|
||
}
|
||
if (ApprovalTime.HasValue && ApprovalTime.Value >= projectStartDate && ApprovalTime.Value <= DateTime.Now)
|
||
{
|
||
if (ProfessionalName == "管道" && PostName == "焊工")
|
||
{
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
}
|
||
if (ProfessionalName == "土建" && PostName == "焊工")
|
||
{
|
||
Quantity4Dic[UnitId] = Quantity4Dic[UnitId] + 1;
|
||
}
|
||
if (ProfessionalName == "设备" && PostName == "焊工")
|
||
{
|
||
Quantity6Dic[UnitId] = Quantity6Dic[UnitId] + 1;
|
||
}
|
||
if ((ProfessionalName != "管道" && ProfessionalName != "土建" && ProfessionalName != "设备") && PostName == "焊工")
|
||
{
|
||
Quantity8Dic[UnitId] = Quantity8Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
if (ApprovalTime.HasValue && ApprovalTime.Value >= startDate && ApprovalTime.Value <= endDate)
|
||
{
|
||
if (ProfessionalName == "管道" && PostName == "焊工")
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
}
|
||
if (ProfessionalName == "土建" && PostName == "焊工")
|
||
{
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1;
|
||
}
|
||
if (ProfessionalName == "设备" && PostName == "焊工")
|
||
{
|
||
Quantity5Dic[UnitId] = Quantity5Dic[UnitId] + 1;
|
||
}
|
||
if ((ProfessionalName != "管道" && ProfessionalName != "土建" && ProfessionalName != "设备") && PostName == "焊工")
|
||
{
|
||
Quantity7Dic[UnitId] = Quantity5Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
foreach (var item in units2)
|
||
{
|
||
|
||
Model.PassWelderStatisc passWelderStatisc = new Model.PassWelderStatisc();
|
||
passWelderStatisc.Num = i;
|
||
passWelderStatisc.UnitName = item.UnitName;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
passWelderStatisc.PipeMountGuard = Quantity1Dic[item.UnitId];
|
||
passWelderStatisc.PipeTotal = Quantity2Dic[item.UnitId];
|
||
passWelderStatisc.SteelStructureMountGuard = Quantity3Dic[item.UnitId];
|
||
passWelderStatisc.SteelStructureTotal = Quantity4Dic[item.UnitId];
|
||
passWelderStatisc.EquipmentMountGuard = Quantity5Dic[item.UnitId];
|
||
passWelderStatisc.EquipmentTotal = Quantity6Dic[item.UnitId];
|
||
passWelderStatisc.OtherMountGuard = Quantity7Dic[item.UnitId];
|
||
passWelderStatisc.OtherTotal = Quantity8Dic[item.UnitId];
|
||
}
|
||
StatisticsList.Add(passWelderStatisc);
|
||
i++;
|
||
Quantity1Sum += passWelderStatisc.PipeMountGuard;
|
||
Quantity2Sum += passWelderStatisc.PipeTotal;
|
||
Quantity3Sum += passWelderStatisc.SteelStructureMountGuard;
|
||
Quantity4Sum += passWelderStatisc.SteelStructureTotal;
|
||
Quantity5Sum += passWelderStatisc.EquipmentMountGuard;
|
||
Quantity6Sum += passWelderStatisc.EquipmentTotal;
|
||
Quantity7Sum += passWelderStatisc.OtherMountGuard;
|
||
Quantity8Sum += passWelderStatisc.OtherTotal;
|
||
}
|
||
|
||
Grid8.DataSource = StatisticsList;
|
||
Grid8.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitName", "合计");
|
||
summary.Add("PipeMountGuard", Quantity1Sum.ToString());
|
||
summary.Add("PipeTotal", Quantity2Sum.ToString());
|
||
summary.Add("SteelStructureMountGuard", Quantity3Sum.ToString());
|
||
summary.Add("SteelStructureTotal", Quantity4Sum.ToString());
|
||
summary.Add("EquipmentMountGuard", Quantity5Sum.ToString());
|
||
summary.Add("EquipmentTotal", Quantity6Sum.ToString());
|
||
summary.Add("OtherMountGuard", Quantity7Sum.ToString());
|
||
summary.Add("OtherTotal", Quantity8Sum.ToString());
|
||
Grid8.SummaryData = summary;
|
||
}
|
||
|
||
if (processControl_NondestructiveTestData != null)
|
||
{
|
||
|
||
|
||
var list = new List<Model.ProcessControl_NondestructiveTest_New>();
|
||
int? totalNum0 = 0, totalNum1 = 0;//拍片数量合计
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, string> Quantity3Dic = new Dictionary<string, string>();
|
||
Dictionary<string, string> Quantity4Dic = new Dictionary<string, string>();
|
||
foreach (DataRow row in processControl_NondestructiveTestData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
string ProfessionalName = row["ProfessionalName"].ToString();
|
||
int MonthQuantity = Funs.GetNewIntOrZero(row["MonthQuantity"].ToString());
|
||
int TotalQuantity = Funs.GetNewIntOrZero(row["TotalQuantity"].ToString());
|
||
string MonthRate = row["MonthRate"].ToString();
|
||
string TotalRate = row["TotalRate"].ToString();
|
||
|
||
|
||
if (!Quantity1Dic.ContainsKey(UnitId + ProfessionalName))
|
||
{
|
||
Quantity1Dic.Add(UnitId + ProfessionalName, MonthQuantity);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId + ProfessionalName))
|
||
{
|
||
Quantity2Dic.Add(UnitId + ProfessionalName, TotalQuantity);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId + ProfessionalName))
|
||
{
|
||
Quantity3Dic.Add(UnitId + ProfessionalName, MonthRate);
|
||
}
|
||
if (!Quantity4Dic.ContainsKey(UnitId + ProfessionalName))
|
||
{
|
||
Quantity4Dic.Add(UnitId + ProfessionalName, TotalRate);
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
foreach (var item in units2)
|
||
{
|
||
int? num0 = 0, num1 = 0;//拍片数量小计
|
||
//加载工艺管道
|
||
if (Quantity1Dic.ContainsKey(item.UnitId + "工艺管道") || Quantity1Dic.ContainsKey(item.UnitId + "地管") || Quantity1Dic.ContainsKey(item.UnitId + "非标"))
|
||
{
|
||
var model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "工艺管道";
|
||
|
||
if (Quantity1Dic.ContainsKey(item.UnitId + "工艺管道"))
|
||
{
|
||
model.MonthQuantity = Quantity1Dic[item.UnitId + "工艺管道"];
|
||
model.TotalQuantity = Quantity2Dic[item.UnitId + "工艺管道"];
|
||
model.MonthRate = Quantity3Dic[item.UnitId + "工艺管道"] + "%";
|
||
model.TotalRate = Quantity4Dic[item.UnitId + "工艺管道"] + "%";
|
||
#region 小计和合计
|
||
//小计
|
||
num0 += Quantity1Dic[item.UnitId + "工艺管道"];
|
||
num1 += Quantity2Dic[item.UnitId + "工艺管道"];
|
||
|
||
//合计
|
||
totalNum0 += Quantity1Dic[item.UnitId + "工艺管道"];
|
||
totalNum1 += Quantity2Dic[item.UnitId + "工艺管道"];
|
||
|
||
#endregion
|
||
list.Add(model);
|
||
}
|
||
else
|
||
{
|
||
model.MonthQuantity = 0;
|
||
model.TotalQuantity = 0;
|
||
model.MonthRate = "0%";
|
||
model.TotalRate = "0%";
|
||
list.Add(model);
|
||
}
|
||
|
||
//地管
|
||
model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "地管";
|
||
if (Quantity1Dic.ContainsKey(item.UnitId + "地管"))
|
||
{
|
||
model.MonthQuantity = Quantity1Dic[item.UnitId + "地管"];
|
||
model.TotalQuantity = Quantity2Dic[item.UnitId + "地管"];
|
||
model.MonthRate = Quantity3Dic[item.UnitId + "地管"] + "%";
|
||
model.TotalRate = Quantity4Dic[item.UnitId + "地管"] + "%";
|
||
#region 小计和合计
|
||
//小计
|
||
num0 += Quantity1Dic[item.UnitId + "地管"];
|
||
num1 += Quantity2Dic[item.UnitId + "地管"];
|
||
|
||
//合计
|
||
totalNum0 += Quantity1Dic[item.UnitId + "地管"];
|
||
totalNum1 += Quantity2Dic[item.UnitId + "地管"];
|
||
|
||
#endregion
|
||
list.Add(model);
|
||
}
|
||
else
|
||
{
|
||
model.MonthQuantity = 0;
|
||
model.TotalQuantity = 0;
|
||
model.MonthRate = "0%";
|
||
model.TotalRate = "0%";
|
||
list.Add(model);
|
||
}
|
||
|
||
//非标
|
||
model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "非标";
|
||
|
||
if (Quantity1Dic.ContainsKey(item.UnitId + "非标"))
|
||
{
|
||
model.MonthQuantity = Quantity1Dic[item.UnitId + "非标"];
|
||
model.TotalQuantity = Quantity2Dic[item.UnitId + "非标"];
|
||
model.MonthRate = Quantity3Dic[item.UnitId + "非标"] + "%";
|
||
model.TotalRate = Quantity4Dic[item.UnitId + "非标"] + "%";
|
||
#region 小计和合计
|
||
//小计
|
||
num0 += Quantity1Dic[item.UnitId + "非标"];
|
||
num1 += Quantity2Dic[item.UnitId + "非标"];
|
||
//合计
|
||
totalNum0 += Quantity1Dic[item.UnitId + "非标"];
|
||
totalNum1 += Quantity2Dic[item.UnitId + "非标"];
|
||
|
||
#endregion
|
||
list.Add(model);
|
||
}
|
||
else
|
||
{
|
||
model.MonthQuantity = 0;
|
||
model.TotalQuantity = 0;
|
||
model.MonthRate = "0%";
|
||
model.TotalRate = "0%";
|
||
list.Add(model);
|
||
}
|
||
//小计
|
||
model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "小计";
|
||
model.MonthQuantity = num0;
|
||
model.TotalQuantity = num1;
|
||
model.MonthRate = "";
|
||
model.TotalRate = "";
|
||
list.Add(model);
|
||
}
|
||
|
||
}
|
||
if (list.Count == 0)
|
||
{
|
||
Grid10.Hidden = true;
|
||
hidWsjcgl.Hidden = false;
|
||
}
|
||
else
|
||
{
|
||
Grid10.Hidden = false;
|
||
hidWsjcgl.Hidden = true;
|
||
Grid10.DataSource = list;
|
||
Grid10.DataBind();
|
||
|
||
//合计
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("CreateMan", "合计");
|
||
summary.Add("MonthQuantity", totalNum0.ToString());
|
||
summary.Add("TotalQuantity", totalNum1.ToString());
|
||
|
||
Grid10.SummaryData = summary;
|
||
}
|
||
}
|
||
|
||
if (inspectionEquipmentData != null)
|
||
{
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有单位
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in inspectionEquipmentData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
string SamplingResult = row["SamplingResult"].ToString();
|
||
DateTime? InspectionDate = Funs.GetNewDateTime(row["InspectionDate"].ToString());
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
if (SamplingResult == "1")
|
||
{
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
foreach (var item in units21)
|
||
{
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.UnitName;
|
||
model.Quantity1 = 0;
|
||
model.Quantity2 = 0;
|
||
model.QuaRate = "100%";
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.Quantity1 = Quantity1Dic[item.UnitId];
|
||
model.Quantity2 = Quantity2Dic[item.UnitId];
|
||
//验收合格率
|
||
if (Quantity3Dic[item.UnitId] == Quantity2Dic[item.UnitId] && Quantity2Dic[item.UnitId] != 0)
|
||
{
|
||
model.QuaRate = "100%";
|
||
}
|
||
else if (Quantity3Dic[item.UnitId] == 0 && Quantity2Dic[item.UnitId] == 0)
|
||
{
|
||
model.QuaRate = "0%";
|
||
}
|
||
else
|
||
{
|
||
var Qualificationrate = (Convert.ToDouble(Quantity3Dic[item.UnitId]) / Convert.ToDouble(Quantity2Dic[item.UnitId])) * 100;
|
||
model.QuaRate = Qualificationrate.ToString("0.00") + "%";
|
||
}
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (remarksDic.ContainsKey(item.UnitName + "6"))
|
||
{
|
||
model.Remarks = remarksDic[item.UnitName + "6"];
|
||
|
||
}
|
||
list.Add(model);
|
||
Quantity1Sum += model.Quantity1.Value;
|
||
Quantity2Sum += model.Quantity2.Value;
|
||
}
|
||
Grid11.DataSource = list;
|
||
Grid11.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid11.SummaryData = summary;
|
||
}
|
||
|
||
if (measuringInspectionData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in measuringInspectionData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
DateTime? InspectionDate = Funs.GetNewDateTime(row["InspectionDate"].ToString());
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
|
||
if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
|
||
}
|
||
|
||
foreach (var item in units21)
|
||
{
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.MonthsCount = Quantity1Dic[item.UnitId];
|
||
model.ProjectCount = Quantity2Dic[item.UnitId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (cqmsremarksDic.ContainsKey(item.UnitName + "9"))
|
||
{
|
||
model.Remarks = cqmsremarksDic[item.UnitName + "9"];
|
||
}
|
||
|
||
list.Add(model);
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
}
|
||
gvMeasuringInspection.DataSource = list;
|
||
gvMeasuringInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvMeasuringInspection.SummaryData = summary;
|
||
}
|
||
|
||
if (checkLotBindStatiscData != null)
|
||
{
|
||
|
||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||
List<Model.CheckStatisc> StatisticsListCV = new List<Model.CheckStatisc>();
|
||
List<Model.CheckStatisc> StatisticsListEQ = new List<Model.CheckStatisc>();
|
||
List<Model.CheckStatisc> StatisticsListPP = new List<Model.CheckStatisc>();
|
||
List<Model.CheckStatisc> StatisticsListEL = new List<Model.CheckStatisc>();
|
||
List<Model.CheckStatisc> StatisticsListIN = new List<Model.CheckStatisc>();
|
||
List<Model.CheckStatisc> StatisticsListAC = new List<Model.CheckStatisc>();
|
||
List<Model.CheckStatisc> StatisticsListFF = new List<Model.CheckStatisc>();
|
||
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
if (project != null)
|
||
{
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
}
|
||
int CheckNumCV = 0;
|
||
int TotalCheckNumCV = 0;
|
||
int OKNumCV = 0;
|
||
int TotalOKNumCV = 0;
|
||
string OneOKRateCV = String.Empty;
|
||
string TotalOneOKRateCV = String.Empty;
|
||
|
||
int CheckNumEQ = 0;
|
||
int TotalCheckNumEQ = 0;
|
||
int OKNumEQ = 0;
|
||
int TotalOKNumEQ = 0;
|
||
string OneOKRateEQ = String.Empty;
|
||
string TotalOneOKRateEQ = String.Empty;
|
||
|
||
int CheckNumPP = 0;
|
||
int TotalCheckNumPP = 0;
|
||
int OKNumPP = 0;
|
||
int TotalOKNumPP = 0;
|
||
string OneOKRatePP = String.Empty;
|
||
string TotalOneOKRatePP = String.Empty;
|
||
|
||
int CheckNumEL = 0;
|
||
int TotalCheckNumEL = 0;
|
||
int OKNumEL = 0;
|
||
int TotalOKNumEL = 0;
|
||
string OneOKRateEL = String.Empty;
|
||
string TotalOneOKRateEL = String.Empty;
|
||
|
||
int CheckNumIN = 0;
|
||
int TotalCheckNumIN = 0;
|
||
int OKNumIN = 0;
|
||
int TotalOKNumIN = 0;
|
||
string OneOKRateIN = String.Empty;
|
||
string TotalOneOKRateIN = String.Empty;
|
||
|
||
int CheckNumAC = 0;
|
||
int TotalCheckNumAC = 0;
|
||
int OKNumAC = 0;
|
||
int TotalOKNumAC = 0;
|
||
string OneOKRateAC = String.Empty;
|
||
string TotalOneOKRateAC = String.Empty;
|
||
|
||
|
||
int CheckNumFF = 0;
|
||
int TotalCheckNumFF = 0;
|
||
int OKNumFF = 0;
|
||
int TotalOKNumFF = 0;
|
||
string OneOKRateFF = String.Empty;
|
||
string TotalOneOKRateFF = String.Empty;
|
||
|
||
string tempCV = "";
|
||
string tempArea = "";
|
||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||
for (int i = 0; i < checkLotBindStatiscData.Rows.Count; i++)
|
||
{
|
||
string UnitWorkName = checkLotBindStatiscData.Rows[i]["UnitWorkName"].ToString();
|
||
string cNProfessionalCode = checkLotBindStatiscData.Rows[i]["cNProfessionalCode"].ToString();
|
||
string IsOnceQualified = checkLotBindStatiscData.Rows[i]["IsOnceQualified"].ToString();
|
||
DateTime? InspectionDate = Funs.GetNewDateTime(checkLotBindStatiscData.Rows[i]["InspectionDate"].ToString());
|
||
|
||
if (tempCV != cNProfessionalCode || tempArea != UnitWorkName)
|
||
{
|
||
tempCV = cNProfessionalCode;
|
||
tempArea = UnitWorkName;
|
||
checkStatisc = new Model.CheckStatisc();
|
||
checkStatisc.Id = Guid.NewGuid().ToString();
|
||
checkStatisc.WorkName = UnitWorkName;
|
||
checkStatisc.CheckNum = 0;
|
||
checkStatisc.CheckNum = 0;
|
||
switch (cNProfessionalCode)
|
||
{
|
||
case "CV": StatisticsListCV.Add(checkStatisc); break;
|
||
case "EQ": StatisticsListEQ.Add(checkStatisc); break;
|
||
case "PP": StatisticsListPP.Add(checkStatisc); break;
|
||
case "EL": StatisticsListEL.Add(checkStatisc); break;
|
||
case "IN": StatisticsListIN.Add(checkStatisc); break;
|
||
case "AC": StatisticsListAC.Add(checkStatisc); break;
|
||
case "FF": StatisticsListFF.Add(checkStatisc); break;
|
||
|
||
}
|
||
}
|
||
if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate)
|
||
{
|
||
checkStatisc.CheckNum += 1;
|
||
if (IsOnceQualified == "1" || IsOnceQualified == "True" || IsOnceQualified == "true")
|
||
{
|
||
checkStatisc.OKNum += 1;
|
||
}
|
||
}
|
||
|
||
checkStatisc.TotalCheckNum += 1;
|
||
if (IsOnceQualified == "1")
|
||
checkStatisc.OKNum += 1;
|
||
if (IsOnceQualified == "1" || IsOnceQualified == "True" || IsOnceQualified == "true")
|
||
{
|
||
checkStatisc.CheckNum += 1;
|
||
}
|
||
}
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListCV)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumCV += cs.CheckNum;
|
||
TotalCheckNumCV += cs.TotalCheckNum;
|
||
OKNumCV += cs.OKNum;
|
||
TotalOKNumCV += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumCV != 0)//被除数不能为零
|
||
{
|
||
OneOKRateCV = Math.Round((double)OKNumCV / (double)CheckNumCV * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRateCV = "0";
|
||
}
|
||
if (TotalCheckNumCV != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRateCV = Math.Round((double)TotalOKNumCV / (double)TotalCheckNumCV * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRateCV = "0";
|
||
}
|
||
//检验批统计:土建
|
||
this.gvTj.DataSource = StatisticsListCV;
|
||
this.gvTj.DataBind();
|
||
//合计
|
||
JObject summaryCV = new JObject();
|
||
summaryCV.Add("WorkName", "合计");
|
||
summaryCV.Add("CheckNum", CheckNumCV.ToString()); //当前检查点数
|
||
summaryCV.Add("TotalCheckNum", TotalCheckNumCV.ToString());//累计点数
|
||
summaryCV.Add("OKNum", OKNumCV.ToString());//当前合格点数
|
||
summaryCV.Add("TotalOKNum", TotalOKNumCV.ToString());//累计合格点数
|
||
summaryCV.Add("OneOKRate", OneOKRateCV.ToString());//本月合格点数
|
||
summaryCV.Add("TotalOneOKRate", TotalOneOKRateCV.ToString());//本月累计合格点数
|
||
gvTj.SummaryData = summaryCV;
|
||
|
||
|
||
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListEQ)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumEQ += cs.CheckNum;
|
||
TotalCheckNumEQ += cs.TotalCheckNum;
|
||
OKNumEQ += cs.OKNum;
|
||
TotalOKNumEQ += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumEQ != 0)//被除数不能为零
|
||
{
|
||
OneOKRateEQ = Math.Round((double)OKNumEQ / (double)CheckNumEQ * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRateEQ = "0";
|
||
}
|
||
if (TotalCheckNumEQ != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRateEQ = Math.Round((double)TotalOKNumEQ / (double)TotalCheckNumEQ * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRateEQ = "0";
|
||
}
|
||
//检验批统计:设备
|
||
|
||
this.GvSb.DataSource = StatisticsListEQ;
|
||
this.GvSb.DataBind();
|
||
|
||
//合计
|
||
JObject summaryEQ = new JObject();
|
||
summaryEQ.Add("WorkName", "合计");
|
||
|
||
summaryEQ.Add("CheckNum", CheckNumEQ.ToString()); //当前检查点数
|
||
summaryEQ.Add("TotalCheckNum", TotalCheckNumEQ.ToString());//累计点数
|
||
|
||
summaryEQ.Add("OKNum", OKNumEQ.ToString());//当前合格点数
|
||
summaryEQ.Add("TotalOKNum", TotalOKNumEQ.ToString());//累计合格点数
|
||
|
||
summaryEQ.Add("OneOKRate", OneOKRateEQ.ToString());//本月合格点数
|
||
summaryEQ.Add("TotalOneOKRate", TotalOneOKRateEQ.ToString());//本月累计合格点数
|
||
GvSb.SummaryData = summaryEQ;
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListPP)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumPP += cs.CheckNum;
|
||
TotalCheckNumPP += cs.TotalCheckNum;
|
||
OKNumPP += cs.OKNum;
|
||
TotalOKNumPP += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumPP != 0)//被除数不能为零
|
||
{
|
||
OneOKRatePP = Math.Round((double)OKNumPP / (double)CheckNumPP * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRatePP = "0";
|
||
}
|
||
if (TotalCheckNumPP != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRatePP = Math.Round((double)TotalOKNumPP / (double)TotalCheckNumPP * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRatePP = "0";
|
||
}
|
||
//检验批统计:管道
|
||
|
||
this.GvGD.DataSource = StatisticsListPP;
|
||
this.GvGD.DataBind();
|
||
//合计
|
||
JObject summaryPP = new JObject();
|
||
summaryPP.Add("WorkName", "合计");
|
||
|
||
summaryPP.Add("CheckNum", CheckNumPP.ToString()); //当前检查点数
|
||
summaryPP.Add("TotalCheckNum", TotalCheckNumPP.ToString());//累计点数
|
||
|
||
summaryPP.Add("OKNum", OKNumPP.ToString());//当前合格点数
|
||
summaryPP.Add("TotalOKNum", TotalOKNumPP.ToString());//累计合格点数
|
||
|
||
summaryPP.Add("OneOKRate", OneOKRatePP.ToString());//本月合格点数
|
||
summaryPP.Add("TotalOneOKRate", TotalOneOKRatePP.ToString());//本月累计合格点数
|
||
GvGD.SummaryData = summaryPP;
|
||
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListEL)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumEL += cs.CheckNum;
|
||
TotalCheckNumEL += cs.TotalCheckNum;
|
||
OKNumEL += cs.OKNum;
|
||
TotalOKNumEL += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumEL != 0)//被除数不能为零
|
||
{
|
||
OneOKRateEL = Math.Round((double)OKNumEL / (double)CheckNumEL * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRateEL = "0";
|
||
}
|
||
if (TotalCheckNumEL != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRateEL = Math.Round((double)TotalOKNumEL / (double)TotalCheckNumEL * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRateEL = "0";
|
||
}
|
||
//检验批统计:电气
|
||
|
||
this.GvDq.DataSource = StatisticsListEL;
|
||
this.GvDq.DataBind();
|
||
//合计
|
||
JObject summaryEL = new JObject();
|
||
summaryEL.Add("WorkName", "合计");
|
||
|
||
summaryEL.Add("CheckNum", CheckNumEL.ToString()); //当前检查点数
|
||
summaryEL.Add("TotalCheckNum", TotalCheckNumEL.ToString());//累计点数
|
||
|
||
summaryEL.Add("OKNum", OKNumEL.ToString());//当前合格点数
|
||
summaryEL.Add("TotalOKNum", TotalOKNumEL.ToString());//累计合格点数
|
||
|
||
summaryEL.Add("OneOKRate", OneOKRateEL.ToString());//本月合格点数
|
||
summaryEL.Add("TotalOneOKRate", TotalOneOKRateEL.ToString());//本月累计合格点数
|
||
GvDq.SummaryData = summaryEL;
|
||
|
||
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListIN)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumIN += cs.CheckNum;
|
||
TotalCheckNumIN += cs.TotalCheckNum;
|
||
OKNumIN += cs.OKNum;
|
||
TotalOKNumIN += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumIN != 0)//被除数不能为零
|
||
{
|
||
OneOKRateIN = Math.Round((double)OKNumIN / (double)CheckNumIN * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRateIN = "0";
|
||
}
|
||
if (TotalCheckNumIN != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRateIN = Math.Round((double)TotalOKNumIN / (double)TotalCheckNumIN * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRateIN = "0";
|
||
}
|
||
//检验批统计:仪表
|
||
|
||
this.GvYb.DataSource = StatisticsListIN;
|
||
this.GvYb.DataBind();
|
||
//合计
|
||
JObject summaryIN = new JObject();
|
||
summaryIN.Add("WorkName", "合计");
|
||
|
||
summaryIN.Add("CheckNum", CheckNumIN.ToString()); //当前检查点数
|
||
summaryIN.Add("TotalCheckNum", TotalCheckNumIN.ToString());//累计点数
|
||
|
||
summaryIN.Add("OKNum", OKNumIN.ToString());//当前合格点数
|
||
summaryIN.Add("TotalOKNum", TotalOKNumIN.ToString());//累计合格点数
|
||
|
||
summaryIN.Add("OneOKRate", OneOKRateIN.ToString());//本月合格点数
|
||
summaryIN.Add("TotalOneOKRate", TotalOneOKRateIN.ToString());//本月累计合格点数
|
||
GvYb.SummaryData = summaryIN;
|
||
|
||
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListAC)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumAC += cs.CheckNum;
|
||
TotalCheckNumAC += cs.TotalCheckNum;
|
||
OKNumAC += cs.OKNum;
|
||
TotalOKNumAC += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumAC != 0)//被除数不能为零
|
||
{
|
||
OneOKRateAC = Math.Round((double)OKNumAC / (double)CheckNumAC * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRateAC = "0";
|
||
}
|
||
if (TotalCheckNumAC != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRateAC = Math.Round((double)TotalOKNumAC / (double)TotalCheckNumAC * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRateAC = "0";
|
||
}
|
||
//检验批统计:防腐
|
||
|
||
this.GvFf.DataSource = StatisticsListAC;
|
||
this.GvFf.DataBind();
|
||
//合计
|
||
JObject summaryAC = new JObject();
|
||
summaryAC.Add("WorkName", "合计");
|
||
|
||
summaryAC.Add("CheckNum", CheckNumAC.ToString()); //当前检查点数
|
||
summaryAC.Add("TotalCheckNum", TotalCheckNumAC.ToString());//累计点数
|
||
|
||
summaryAC.Add("OKNum", OKNumAC.ToString());//当前合格点数
|
||
summaryAC.Add("TotalOKNum", TotalOKNumAC.ToString());//累计合格点数
|
||
|
||
summaryAC.Add("OneOKRate", OneOKRateAC.ToString());//本月合格点数
|
||
summaryAC.Add("TotalOneOKRate", TotalOneOKRateAC.ToString());//本月累计合格点数
|
||
GvFf.SummaryData = summaryAC;
|
||
|
||
|
||
foreach (Model.CheckStatisc cs in StatisticsListFF)
|
||
{
|
||
if (cs.CheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.OneOKRate = Math.Round((double)cs.OKNum / (double)cs.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.OneOKRate = "0%";
|
||
}
|
||
if (cs.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
cs.TotalOneOKRate = Math.Round((double)cs.TotalOKNum / (double)cs.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
cs.TotalOneOKRate = "0%";
|
||
}
|
||
CheckNumFF += cs.CheckNum;
|
||
TotalCheckNumFF += cs.TotalCheckNum;
|
||
OKNumFF += cs.OKNum;
|
||
TotalOKNumFF += cs.TotalOKNum;
|
||
}
|
||
if (CheckNumFF != 0)//被除数不能为零
|
||
{
|
||
OneOKRateFF = Math.Round((double)OKNumFF / (double)CheckNumFF * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRateFF = "0";
|
||
}
|
||
if (TotalCheckNumFF != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRateFF = Math.Round((double)TotalOKNumFF / (double)TotalCheckNumFF * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRateFF = "0";
|
||
}
|
||
//检验批统计:消防
|
||
|
||
this.GvXf.DataSource = StatisticsListFF;
|
||
this.GvXf.DataBind();
|
||
//合计
|
||
JObject summaryFF = new JObject();
|
||
summaryFF.Add("WorkName", "合计");
|
||
|
||
summaryFF.Add("CheckNum", CheckNumFF.ToString()); //当前检查点数
|
||
summaryFF.Add("TotalCheckNum", TotalCheckNumFF.ToString());//累计点数
|
||
|
||
summaryFF.Add("OKNum", OKNumFF.ToString());//当前合格点数
|
||
summaryFF.Add("TotalOKNum", TotalOKNumFF.ToString());//累计合格点数
|
||
|
||
summaryFF.Add("OneOKRate", OneOKRateFF.ToString());//本月合格点数
|
||
summaryFF.Add("TotalOneOKRate", TotalOneOKRateFF.ToString());//本月累计合格点数
|
||
|
||
GvXf.SummaryData = summaryFF;
|
||
|
||
}
|
||
|
||
if (InspectionDataInspectionData != null)
|
||
{
|
||
var list = new List<Model.CheckStatisc>();
|
||
|
||
|
||
int CheckNum = 0;//本月检查点数
|
||
int TotalCheckNum = 0;//累计检查点数
|
||
|
||
int OKNum = 0;//本月检查合格点数
|
||
int TotalOKNum = 0;//累计检查合格点数
|
||
|
||
string Quantity1Sum = String.Empty;//本月检查合格点数/本月检查点数
|
||
string Quantity2Sum = String.Empty;//累计检查合格点数/累计检查点数
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity4Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in InspectionDataInspectionData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
string IsOnceQualified = row["IsOnceQualified"].ToString();
|
||
DateTime? InspectionDate = Funs.GetNewDateTime(row["InspectionDate"].ToString());
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity4Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity4Dic.Add(UnitId, 0);
|
||
}
|
||
if (InspectionDate.HasValue && InspectionDate.Value >= startDate && InspectionDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
if (IsOnceQualified == "1")
|
||
{
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
if (IsOnceQualified == "1")
|
||
{
|
||
Quantity4Dic[UnitId] = Quantity4Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
foreach (var item in units21)
|
||
{
|
||
|
||
|
||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||
checkStatisc.Id = Guid.NewGuid().ToString();
|
||
checkStatisc.ReportId = ReportId;
|
||
checkStatisc.WorkName = item.UnitName;
|
||
if (Quantity4Dic.ContainsKey(item.UnitId))
|
||
{
|
||
checkStatisc.CheckNum = Quantity1Dic[item.UnitId];
|
||
checkStatisc.TotalCheckNum = Quantity2Dic[item.UnitId];
|
||
checkStatisc.OKNum = Quantity3Dic[item.UnitId]; ;
|
||
checkStatisc.TotalOKNum = Quantity4Dic[item.UnitId]; ;
|
||
|
||
}
|
||
if (checkStatisc.CheckNum != 0)//被除数不能为零
|
||
{
|
||
checkStatisc.OneOKRate = Math.Round((double)checkStatisc.OKNum / (double)checkStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
checkStatisc.OneOKRate = "0%";
|
||
}
|
||
|
||
if (checkStatisc.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
checkStatisc.TotalOneOKRate = Math.Round((double)checkStatisc.TotalOKNum / (double)checkStatisc.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
checkStatisc.TotalOneOKRate = "0%";
|
||
}
|
||
//如果是修改,查询表中数据
|
||
|
||
if (cqmsremarksDic.ContainsKey(item.UnitName + "10"))
|
||
{
|
||
checkStatisc.Remarks = cqmsremarksDic[item.UnitName + "10"];
|
||
}
|
||
list.Add(checkStatisc);
|
||
|
||
CheckNum += checkStatisc.CheckNum;
|
||
TotalCheckNum += checkStatisc.TotalCheckNum;
|
||
|
||
OKNum += checkStatisc.OKNum;
|
||
TotalOKNum += checkStatisc.TotalOKNum;
|
||
|
||
|
||
}
|
||
|
||
gvInspectionDataInspection.DataSource = list;
|
||
gvInspectionDataInspection.DataBind();
|
||
|
||
if (CheckNum != 0)//被除数不能为零
|
||
{
|
||
Quantity1Sum = Math.Round((double)OKNum / (double)CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
Quantity1Sum = "0%";
|
||
}
|
||
if (TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
Quantity2Sum = Math.Round((double)TotalOKNum / (double)TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
Quantity2Sum = "0%";
|
||
}
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
summary.Add("CheckNum", CheckNum.ToString());
|
||
summary.Add("OKNum", OKNum.ToString());
|
||
summary.Add("OneOKRate", Quantity1Sum.ToString());
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());
|
||
summary.Add("TotalOneOKRate", Quantity2Sum.ToString());
|
||
|
||
gvInspectionDataInspection.SummaryData = summary;
|
||
}
|
||
|
||
if (pressureInspectionData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
|
||
|
||
int Quantity0Sum = 0;
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in pressureInspectionData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
int ActualNumber = Funs.GetNewIntOrZero(row["ActualNumber"].ToString());
|
||
int PressurePipeNumber = Funs.GetNewIntOrZero(row["PressurePipeNumber"].ToString());
|
||
DateTime? ReportTime = Funs.GetNewDateTime(row["ReportTime"].ToString());
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
|
||
if (ReportTime.HasValue && ReportTime.Value >= startDate && ReportTime.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + PressurePipeNumber;
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + ActualNumber;
|
||
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + PressurePipeNumber;
|
||
|
||
}
|
||
foreach (var item in units21)
|
||
{
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
model.TotalNoBackCount = 0;//总数
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.MonthsCount = Quantity1Dic[item.UnitId];
|
||
model.ProjectCount = Quantity2Dic[item.UnitId];
|
||
model.TotalNoBackCount = Quantity3Dic[item.UnitId];//总数
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (cqmsremarksDic.ContainsKey(item.UnitName + "11"))
|
||
{
|
||
model.Remarks = cqmsremarksDic[item.UnitName + "11"];
|
||
}
|
||
list.Add(model);
|
||
Quantity0Sum += model.TotalNoBackCount.Value;
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
|
||
}
|
||
gvPressureInspection.DataSource = list;
|
||
gvPressureInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("TotalNoBackCount", Quantity0Sum.ToString());//总数
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvPressureInspection.SummaryData = summary;
|
||
}
|
||
|
||
if (pipingInspectionData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int Quantity0Sum = 0;
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in pipingInspectionData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
int IssuedReportNumber = Funs.GetNewIntOrZero(row["IssuedReportNumber"].ToString());
|
||
int PackageNumber = Funs.GetNewIntOrZero(row["PackageNumber"].ToString());
|
||
DateTime? ReportTime = Funs.GetNewDateTime(row["ReportTime"].ToString());
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
|
||
if (ReportTime.HasValue && ReportTime.Value >= startDate && ReportTime.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + PackageNumber;
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + IssuedReportNumber;
|
||
|
||
}
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + IssuedReportNumber;
|
||
|
||
}
|
||
foreach (var item in units21)
|
||
{
|
||
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.TotalNoBackCount = 0;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.TotalNoBackCount = Quantity1Dic[item.UnitId];
|
||
model.MonthsCount = Quantity2Dic[item.UnitId];
|
||
model.ProjectCount = Quantity3Dic[item.UnitId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (cqmsremarksDic.ContainsKey(item.UnitName + "11"))
|
||
{
|
||
model.Remarks = cqmsremarksDic[item.UnitName + "11"];
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity0Sum += model.TotalNoBackCount.Value;
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
|
||
}
|
||
gvPipingInspection.DataSource = list;
|
||
gvPipingInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("TotalNoBackCount", Quantity0Sum.ToString());
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvPipingInspection.SummaryData = summary;
|
||
|
||
}
|
||
|
||
if (specialInspectionData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int Quantity0Sum = 0;
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in specialInspectionData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
int SunNumber = Funs.GetNewIntOrZero(row["SunNumber"].ToString());
|
||
int MonitoringReportNumber = Funs.GetNewIntOrZero(row["MonitoringReportNumber"].ToString());
|
||
DateTime? ReportTime = Funs.GetNewDateTime(row["ReportTime"].ToString());
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
|
||
if (ReportTime.HasValue && ReportTime.Value >= startDate && ReportTime.Value <= endDate)
|
||
{
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + MonitoringReportNumber;
|
||
}
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + SunNumber;
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + MonitoringReportNumber;
|
||
|
||
}
|
||
foreach (var item in units21)
|
||
{
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.TotalNoBackCount = 0;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.TotalNoBackCount = Quantity1Dic[item.UnitId];
|
||
model.MonthsCount = Quantity2Dic[item.UnitId];
|
||
model.ProjectCount = Quantity3Dic[item.UnitId];
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (cqmsremarksDic.ContainsKey(item.UnitName + "13"))
|
||
{
|
||
model.Remarks = cqmsremarksDic[item.UnitName + "13"];
|
||
}
|
||
list.Add(model);
|
||
Quantity0Sum += model.TotalNoBackCount.Value;
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
|
||
}
|
||
gvSpecialInspection.DataSource = list;
|
||
gvSpecialInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("TotalNoBackCount", Quantity0Sum.ToString());//总数
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());//本月完成监检数量
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());//累计完成监检数量
|
||
|
||
gvSpecialInspection.SummaryData = summary;
|
||
}
|
||
|
||
if (ncrManagementInspectionData != null)
|
||
{
|
||
List<Model.NCRReportStatisc> StatisticsList = new List<Model.NCRReportStatisc>();
|
||
|
||
|
||
int CurrentPeriodOkNumSum = 0;
|
||
int OKNumSum = 0;
|
||
int CheckNumSum = 0;
|
||
string OKRateSum = string.Empty;
|
||
|
||
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
DateTime projectStartDate = Convert.ToDateTime("2000-01-01");
|
||
if (project != null && project.StartDate != null)
|
||
{
|
||
projectStartDate = project.StartDate.Value;
|
||
}
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in ncrManagementInspectionData.Rows)
|
||
{
|
||
string ImplementationFrontState = row["ImplementationFrontState"].ToString();
|
||
DateTime? IssuedDate = Funs.GetNewDateTime(row["IssuedDate"].ToString());
|
||
string ReceiveUnit = row["ReceiveUnit"].ToString();
|
||
string[] unitids = ReceiveUnit.Split(',');
|
||
foreach (string UnitId in unitids)
|
||
{
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
|
||
if (IssuedDate.HasValue && IssuedDate.Value >= startDate && IssuedDate.Value <= endDate)
|
||
{
|
||
if (ImplementationFrontState == "已闭合")
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
if (ImplementationFrontState == "已闭合")
|
||
{
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
}
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1;
|
||
}
|
||
}
|
||
foreach (var item in units)
|
||
{
|
||
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
||
NCRStatisc.Id = Guid.NewGuid().ToString();
|
||
NCRStatisc.WorkName = item.UnitName;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
NCRStatisc.CurrentPeriodOkNum = Quantity1Dic[item.UnitId];
|
||
NCRStatisc.OKNum = Quantity2Dic[item.UnitId];
|
||
NCRStatisc.CheckNum = Quantity3Dic[item.UnitId];
|
||
}
|
||
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
||
{
|
||
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
NCRStatisc.OKRate = "0%";
|
||
}
|
||
|
||
StatisticsList.Add(NCRStatisc);
|
||
|
||
CurrentPeriodOkNumSum += NCRStatisc.CurrentPeriodOkNum;
|
||
OKNumSum += NCRStatisc.OKNum;
|
||
CheckNumSum += NCRStatisc.CheckNum;
|
||
|
||
}
|
||
|
||
if (CheckNumSum != 0)//被除数不能为零
|
||
{
|
||
OKRateSum = Math.Round((double)OKNumSum / (double)CheckNumSum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OKRateSum = "0%";
|
||
}
|
||
|
||
this.gvNcrManagementInspection.DataSource = StatisticsList;
|
||
this.gvNcrManagementInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
summary.Add("CurrentPeriodOkNum", CurrentPeriodOkNumSum.ToString());
|
||
summary.Add("OKNum", OKNumSum.ToString());
|
||
summary.Add("CheckNum", CheckNumSum.ToString());
|
||
summary.Add("OKRate", OKRateSum.ToString());
|
||
|
||
gvNcrManagementInspection.SummaryData = summary;
|
||
}
|
||
|
||
if (qualityInspectionData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
int ClosedCountSum = 0;
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in qualityInspectionData.Rows)
|
||
{
|
||
string UnitId = row["UnitId"].ToString();
|
||
DateTime? CheckDate = Funs.GetNewDateTime(row["CheckDate"].ToString());
|
||
string State = row["State"].ToString();
|
||
|
||
if (!Quantity1Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity1Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity2Dic.Add(UnitId, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(UnitId))
|
||
{
|
||
Quantity3Dic.Add(UnitId, 0);
|
||
}
|
||
|
||
if (CheckDate.HasValue && CheckDate.Value >= startDate && CheckDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[UnitId] = Quantity1Dic[UnitId] + 1;
|
||
|
||
}
|
||
Quantity2Dic[UnitId] = Quantity2Dic[UnitId] + 1;
|
||
if (State == "7")
|
||
{
|
||
Quantity3Dic[UnitId] = Quantity3Dic[UnitId] + 1;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
foreach (var item in units21)
|
||
{
|
||
|
||
var ClosedCount = 0;
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
ClosedCount = Quantity3Dic[item.UnitId];//已关闭数量
|
||
model.MonthsCount = Quantity1Dic[item.UnitId];
|
||
model.ProjectCount = Quantity2Dic[item.UnitId];
|
||
if (model.ProjectCount.Value > 0)
|
||
{
|
||
model.RectificationRate = (100.0 * (ClosedCount / model.ProjectCount.Value)).ToString("#0.00") + "%";
|
||
}
|
||
else
|
||
{
|
||
model.RectificationRate = "0.00%";
|
||
}
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "1");
|
||
if (NewModel != null)
|
||
{
|
||
//model.RectificationRate = NewModel.RectificationRate;
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
ClosedCountSum += ClosedCount;
|
||
|
||
i++;
|
||
}
|
||
gvQualityInspection.DataSource = list;
|
||
gvQualityInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
if (Quantity2Sum > 0)
|
||
{
|
||
summary.Add("RectificationRate", (100.00 * (ClosedCountSum / Quantity2Sum)).ToString("#0.00") + "%");
|
||
}
|
||
else
|
||
{
|
||
summary.Add("RectificationRate", "0.00%");
|
||
}
|
||
gvQualityInspection.SummaryData = summary;
|
||
|
||
}
|
||
|
||
if (specialCheckData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in specialCheckData.Rows)
|
||
{
|
||
string CheckType = row["CheckType"].ToString();
|
||
DateTime? CheckDate = Funs.GetNewDateTime(row["CheckDate"].ToString());
|
||
|
||
if (!Quantity1Dic.ContainsKey(CheckType))
|
||
{
|
||
Quantity1Dic.Add(CheckType, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(CheckType))
|
||
{
|
||
Quantity2Dic.Add(CheckType, 0);
|
||
}
|
||
|
||
if (CheckDate.HasValue && CheckDate.Value >= startDate && CheckDate.Value <= endDate)
|
||
{
|
||
Quantity1Dic[CheckType] = Quantity1Dic[CheckType] + 1;
|
||
|
||
}
|
||
Quantity2Dic[CheckType] = Quantity2Dic[CheckType] + 1;
|
||
|
||
|
||
}
|
||
|
||
//加载检查类别
|
||
var lists = BLL.JointCheckService.GetCheckTypeList();
|
||
foreach (var item in lists)
|
||
{
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.Value;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
if (Quantity1Dic.ContainsKey(item.Value))
|
||
{
|
||
model.MonthsCount = Quantity1Dic[item.Value];
|
||
model.ProjectCount = Quantity2Dic[item.Value];
|
||
}
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (cqmsremarksDic.ContainsKey(item.Value + "2"))
|
||
{
|
||
model.Remarks = cqmsremarksDic[item.Value + "2"];
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
|
||
}
|
||
|
||
gvSpecialCheck.DataSource = list;
|
||
gvSpecialCheck.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvSpecialCheck.SummaryData = summary;
|
||
}
|
||
|
||
if (fileReportData != null)
|
||
{
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
int Quantity3Sum = 0;
|
||
int Quantity4Sum = 0;
|
||
|
||
|
||
Dictionary<string, int> Quantity1Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity2Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity3Dic = new Dictionary<string, int>();
|
||
Dictionary<string, int> Quantity4Dic = new Dictionary<string, int>();
|
||
foreach (DataRow row in fileReportData.Rows)
|
||
{
|
||
string SendUnit = row["SendUnit"].ToString();
|
||
string IsReply = row["IsReply"].ToString();
|
||
string RetrunWuhuangCopies = row["RetrunWuhuangCopies"].ToString();
|
||
DateTime? ReceiveDate = Funs.GetNewDateTime(row["ReceiveDate"].ToString());
|
||
|
||
if (!Quantity1Dic.ContainsKey(SendUnit))
|
||
{
|
||
Quantity1Dic.Add(SendUnit, 0);
|
||
}
|
||
if (!Quantity2Dic.ContainsKey(SendUnit))
|
||
{
|
||
Quantity2Dic.Add(SendUnit, 0);
|
||
}
|
||
if (!Quantity3Dic.ContainsKey(SendUnit))
|
||
{
|
||
Quantity3Dic.Add(SendUnit, 0);
|
||
}
|
||
if (!Quantity4Dic.ContainsKey(SendUnit))
|
||
{
|
||
Quantity4Dic.Add(SendUnit, 0);
|
||
}
|
||
if (IsReply == "1" || IsReply == "True" || IsReply == "true")
|
||
{
|
||
Quantity1Dic[SendUnit] = Quantity1Dic[SendUnit] + 1;
|
||
|
||
|
||
if (ReceiveDate.HasValue && ReceiveDate.Value >= startDate && ReceiveDate.Value <= endDate)
|
||
{
|
||
Quantity2Dic[SendUnit] = Quantity2Dic[SendUnit] + 1;
|
||
if (!string.IsNullOrEmpty(RetrunWuhuangCopies))
|
||
{
|
||
Quantity3Dic[SendUnit] = Quantity3Dic[SendUnit] + 1;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(RetrunWuhuangCopies))
|
||
{
|
||
Quantity4Dic[SendUnit] = Quantity4Dic[SendUnit] + 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
foreach (var item in units)
|
||
{
|
||
var query = from c in db.Comprehensive_DataReceivingDoc
|
||
join u in db.Base_Unit on c.SendUnit equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.SendUnit == item.UnitId
|
||
select new
|
||
{
|
||
c.ReceiveDate,
|
||
c.ProjectId,
|
||
c.IsReply,
|
||
c.RetrunWuhuangCopies,
|
||
u.UnitId,
|
||
u.UnitName
|
||
};
|
||
var AllList = query.Where(x => x.IsReply == true).ToList();//项目数
|
||
//本月数
|
||
var monethCount = query.Where(x => x.IsReply == true && (x.ReceiveDate >= Convert.ToDateTime(startDate) && x.ReceiveDate <= Convert.ToDateTime(endDate)));
|
||
var yzCount = query.Where(x => x.IsReply == true && x.RetrunWuhuangCopies != null && (x.ReceiveDate >= Convert.ToDateTime(startDate) && x.ReceiveDate <= Convert.ToDateTime(endDate)));//本月业主/ 监理返回数量
|
||
int totalReturnCount = query.Where(x => x.IsReply == true && x.RetrunWuhuangCopies != null).Count();//总的已返回数量
|
||
var NoBackCount = AllList.Count() - totalReturnCount;//累计未返回数量
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = 0;
|
||
model.ProjectCount = 0;
|
||
model.MonthsBackCount = 0;
|
||
model.TotalNoBackCount = 0;
|
||
if (Quantity1Dic.ContainsKey(item.UnitId))
|
||
{
|
||
model.MonthsCount = Quantity2Dic[item.UnitId];
|
||
model.ProjectCount = Quantity1Dic[item.UnitId];
|
||
model.MonthsBackCount = Quantity3Dic[item.UnitId];
|
||
model.TotalNoBackCount = Quantity1Dic[item.UnitId] - Quantity4Dic[item.UnitId];
|
||
}
|
||
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "3");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += model.MonthsCount.Value;
|
||
Quantity2Sum += model.ProjectCount.Value;
|
||
Quantity3Sum += model.MonthsBackCount.Value;
|
||
Quantity4Sum += model.TotalNoBackCount.Value;
|
||
i++;
|
||
}
|
||
gvFileReport.DataSource = list;
|
||
gvFileReport.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
summary.Add("MonthsBackCount", Quantity3Sum.ToString());
|
||
summary.Add("TotalNoBackCount", Quantity4Sum.ToString());
|
||
|
||
gvFileReport.SummaryData = summary;
|
||
|
||
}
|
||
//3.1 加载一般施工方案审批情况
|
||
//loadGeneralPlanApproval(objType);
|
||
|
||
//3.2 加载危大工程方案审批情况
|
||
//loadMajorPlanApproval(objType);
|
||
|
||
//3.3 质量控制点或检验试验计划(ITP)情况
|
||
//loadInspectionTestPlan(objType);
|
||
|
||
//4 加载设计交底管理情况
|
||
// loadDesignDetailsApprove(objType);
|
||
|
||
//5 加载图纸会审管理情况
|
||
// loadReviewDrawings(objType);
|
||
|
||
//6 加载设计变更管理情况
|
||
//loadDesignChangeOrder();
|
||
|
||
//7.1 加载合格焊工管理情况
|
||
//loadPassWelder();
|
||
|
||
//7.3 加载无损检测管理
|
||
//loadProcessControl_NondestructiveTest_New();
|
||
|
||
//8 设备报验管理Grid11
|
||
//LoadInspectionEquipment(objType);
|
||
|
||
//加载9.计量器具报验管理情况
|
||
//loadMeasuringInspection(objType);
|
||
//加载10.现场质量共检数据
|
||
|
||
//loadInspectionDataInspection(objType);
|
||
//加载11.压力管道监检情况
|
||
//loadPressureInspection(objType);
|
||
//加载12.管道试压包管理情况
|
||
//loadPipingInspection(objType);
|
||
//加载13.特种设备监检情况
|
||
//loadSpecialInspection(objType);
|
||
////加载14.NCR管理情况
|
||
//loadNcrManagementInspection(objType);
|
||
|
||
//加载15.质量巡检情况
|
||
//loadQualityInspection(objType);
|
||
//加载16.质量专项检查情况
|
||
//loadSpecialCheck(objType);
|
||
//加载17.质量文件上报情况
|
||
//loadFileReport(objType);
|
||
}
|
||
#endregion
|
||
|
||
#region 时间选择事件
|
||
/// <summary>
|
||
/// 开始时间选择事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void txtStartDate_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim()))
|
||
{
|
||
string url = Request.Url.ToString();
|
||
if (url.Contains("?"))
|
||
{
|
||
url = Request.Url.ToString().Substring(0, Request.Url.ToString().LastIndexOf('?'));
|
||
}
|
||
Response.Redirect(url + "?startdate=" + txtStartDate.Text + "&enddate=" + txtEndDate.Text);
|
||
}
|
||
}
|
||
|
||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
|
||
{
|
||
if (Funs.GetNewDateTime(this.txtStartDate.Text.Trim()) > Funs.GetNewDateTime(this.txtEndDate.Text.Trim()))
|
||
{
|
||
Alert.ShowInTop("开始时间不能大于结束时间!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
PageContext.RegisterStartupScript("refresh();");
|
||
}
|
||
}
|
||
|
||
protected void btnLoad_Click(object sender, EventArgs e)
|
||
{
|
||
if (AddOrUpdate == "update")
|
||
{
|
||
// lodAllGrid("1");
|
||
objType = "1";
|
||
RegisterAsyncTask(new PageAsyncTask(lodAllGrid));
|
||
PageContext.RegisterStartupScript("rehiden();");
|
||
}
|
||
else
|
||
{
|
||
// lodAllGrid("0");
|
||
objType = "0";
|
||
RegisterAsyncTask(new PageAsyncTask(lodAllGrid));
|
||
PageContext.RegisterStartupScript("rehiden();");
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 本月质量目标管理情况 Grid1方法
|
||
protected void btnAddGrid1_Click(object sender, EventArgs e)
|
||
{
|
||
Grid1.Hidden = false;
|
||
|
||
JArray teamGroupData = Grid1.GetMergedData();
|
||
List<JObject> list = new List<JObject>();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//values.Add("Id", teamGroupRow.Value<string>("id"));
|
||
list.Add(values);
|
||
}
|
||
JObject defaultObj = new JObject
|
||
{ { "Id",Guid.NewGuid() },
|
||
{ "ReportId", ReportId },
|
||
{ "ProStage", "" },
|
||
{ "ProDescribe",""},
|
||
{ "TargetValue", "" },
|
||
{ "MonthPer","" },
|
||
{ "Remarks", "" },
|
||
{ "SortId","" },
|
||
{ "Delete1", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) }
|
||
};
|
||
list.Add(defaultObj);
|
||
Grid1.DataSource = list;
|
||
Grid1.DataBind();
|
||
|
||
//SaveMethod();
|
||
}
|
||
|
||
protected void Grid1_PreDataBound(object sender, EventArgs e)
|
||
{
|
||
// 设置LinkButtonField的点击客户端事件
|
||
LinkButtonField deleteField = Grid1.FindColumn("Delete1") as LinkButtonField;
|
||
deleteField.OnClientClick = GetDeleteScriptGrid1();
|
||
}
|
||
/// <summary>
|
||
/// 删除提示
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private string GetDeleteScriptGrid1()
|
||
{
|
||
return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty);
|
||
}
|
||
#endregion
|
||
async Task<DataTable> loadRemarksDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
if (objType == "1")
|
||
{
|
||
string strSql = @"select UnitOrMajor,ReType, Remarks from Report_Construction_Plan
|
||
where ReportId='" + ReportId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
}
|
||
else
|
||
{
|
||
return null;
|
||
}
|
||
});
|
||
}
|
||
|
||
#region 3.1一般施工方案审批情况 Grid2方法
|
||
/// <summary>
|
||
/// 加载一般施工审批情况
|
||
/// </summary>
|
||
void loadGeneralPlanApproval(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var generalPlanUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in generalPlanUnits)
|
||
{
|
||
|
||
var query = from c in db.Comprehensive_GeneralPlanApproval
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
|
||
{
|
||
c.ApprovalDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.CompileDate
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.ApprovalDate >= Convert.ToDateTime(startDate) && x.ApprovalDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.UnitName;
|
||
model.Quantity1 = monethCount.Count();
|
||
model.Quantity2 = AllList.Count();
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.UnitName && x.ReType == "0");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
i++;
|
||
}
|
||
Grid2.DataSource = list;
|
||
Grid2.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
|
||
Grid2.SummaryData = summary;
|
||
}
|
||
|
||
|
||
async Task<DataTable> loadGeneralPlanApprovalDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select ApprovalDate,
|
||
ProjectId,
|
||
UnitId,
|
||
CompileDate from Comprehensive_GeneralPlanApproval
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 3.2 危大工程方案审批情况 Grid3方法
|
||
/// <summary>
|
||
/// 加载一般施工审批情况
|
||
/// </summary>
|
||
void loadMajorPlanApproval(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
int Quantity3Sum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var majorPlanUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in majorPlanUnits)
|
||
{
|
||
|
||
var query = from c in db.Comprehensive_MajorPlanApproval
|
||
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
|
||
{
|
||
c.ApprovalDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.ExpertReviewMan,
|
||
c.IsReview,
|
||
c.CompileDate
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.ApprovalDate >= Convert.ToDateTime(startDate) && x.ApprovalDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.UnitName;
|
||
model.Quantity1 = monethCount.Count();
|
||
model.Quantity2 = AllList.Count();
|
||
model.Quantity3 = AllList.Where(x => x.IsReview == true).ToList().Count();
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.UnitName && x.ReType == "1");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
Quantity3Sum += Convert.ToInt32(model.Quantity3);
|
||
i++;
|
||
}
|
||
Grid3.DataSource = list;
|
||
Grid3.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
summary.Add("Quantity3", Quantity3Sum.ToString());
|
||
Grid3.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> loadMajorPlanApprovalDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select ApprovalDate,
|
||
ProjectId,
|
||
UnitId,IsReview,
|
||
CompileDate from Comprehensive_MajorPlanApproval
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
#region 3.3 质量控制点或检验试验计划(ITP)情况 Grid4方法
|
||
/// <summary>
|
||
/// 加载一般施工审批情况
|
||
/// </summary>
|
||
void loadInspectionTestPlan(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有专业
|
||
|
||
|
||
|
||
foreach (var item in CNProfessionals)
|
||
{
|
||
|
||
var query = from c in db.Inspection_Test_Plan
|
||
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.CNProfessionalId == item.CNProfessionalId
|
||
select new
|
||
|
||
{
|
||
c.ApprovalDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.CreateDate
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.CreateDate >= Convert.ToDateTime(startDate) && x.CreateDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.ProfessionalName;
|
||
model.Quantity1 = monethCount.Count();
|
||
model.Quantity2 = AllList.Count();
|
||
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.ProfessionalName && x.ReType == "2");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
|
||
i++;
|
||
}
|
||
Grid4.DataSource = list;
|
||
Grid4.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid4.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> loadInspectionTestPlanDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select ApprovalDate,
|
||
ProjectId,
|
||
CNProfessionalId,
|
||
CreateDate from Inspection_Test_Plan
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 4 设计交底管理情况 Grid5方法
|
||
/// <summary>
|
||
/// 加载一般施工审批情况
|
||
/// </summary>
|
||
void loadDesignDetailsApprove(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有专业
|
||
//var CNProfessionals = from x in db.Base_CNProfessional
|
||
// where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId
|
||
// && x.CNProfessionalId != BLL.Const.ComprehensiveId
|
||
// orderby x.SortIndex
|
||
// select new
|
||
// {
|
||
// x.CNProfessionalId,
|
||
// x.ProfessionalName
|
||
// };
|
||
|
||
|
||
foreach (var item in CNProfessionals)
|
||
{
|
||
|
||
var query = from c in db.Comprehensive_DesignDetails
|
||
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.CNProfessionalId == item.CNProfessionalId
|
||
//&& c.Status == "3"
|
||
select new
|
||
|
||
{
|
||
c.Status,
|
||
c.CompileDate,
|
||
c.ProjectId,
|
||
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.ProfessionalName;
|
||
model.Quantity1 = monethCount.Count();
|
||
model.Quantity2 = AllList.Count();
|
||
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.ProfessionalName && x.ReType == "3");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
|
||
i++;
|
||
}
|
||
Grid5.DataSource = list;
|
||
Grid5.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid5.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> loadDesignDetailsApproveDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select Status,
|
||
ProjectId,
|
||
CNProfessionalId,
|
||
CompileDate from Comprehensive_DesignDetails
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 5 图纸会审管理情况 Grid6方法
|
||
/// <summary>
|
||
/// 加载一图纸会审管理情况
|
||
/// </summary>
|
||
void loadReviewDrawings(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有专业
|
||
//var CNProfessionals = from x in db.Base_CNProfessional
|
||
// where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId
|
||
// && x.CNProfessionalId != BLL.Const.ComprehensiveId
|
||
// orderby x.SortIndex
|
||
// select new
|
||
// {
|
||
// x.CNProfessionalId,
|
||
// x.ProfessionalName
|
||
// };
|
||
|
||
|
||
foreach (var item in CNProfessionals)
|
||
{
|
||
|
||
var query = from c in db.Comprehensive_ReviewDrawings
|
||
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.CNProfessionalId == item.CNProfessionalId
|
||
//&& c.Status == "3"
|
||
select new
|
||
|
||
{
|
||
c.Status,
|
||
c.ReviewDate,
|
||
c.ProjectId,
|
||
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.ReviewDate >= Convert.ToDateTime(startDate) && x.ReviewDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.ProfessionalName;
|
||
model.Quantity1 = monethCount.Count();
|
||
model.Quantity2 = AllList.Count();
|
||
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.ProfessionalName && x.ReType == "4");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
|
||
i++;
|
||
}
|
||
Grid6.DataSource = list;
|
||
Grid6.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
Grid6.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> loadReviewDrawingsDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select Status,
|
||
ProjectId,
|
||
CNProfessionalId,
|
||
ReviewDate from Comprehensive_ReviewDrawings
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 6 设计变更管理情况 Grid7方法
|
||
/// <summary>
|
||
/// 加载设计变更管理情况
|
||
/// </summary>
|
||
void loadDesignChangeOrder()
|
||
{
|
||
int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0;
|
||
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||
List<Model.CheckStatisc> StatisticsList = new List<Model.CheckStatisc>();
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
if (project != null)
|
||
{
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
}
|
||
int i = 1;
|
||
var cNProfessionals = from x in db.Base_CNProfessional
|
||
where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId
|
||
&& x.CNProfessionalId != BLL.Const.ComprehensiveId && x.CNProfessionalId != BLL.Const.CNProfessionalHSEId
|
||
orderby x.SortIndex
|
||
select x;
|
||
foreach (var item in cNProfessionals)
|
||
{
|
||
//专业下所有集合
|
||
List<Model.Comprehensive_DesignChangeOrder> totalManagementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, projectStartDate, DateTime.Now);
|
||
//专业下当期集合
|
||
List<Model.Comprehensive_DesignChangeOrder> managementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, startDate, endDate);
|
||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||
checkStatisc.Num = i;
|
||
checkStatisc.WorkName = item.ProfessionalName;
|
||
checkStatisc.CheckNum = managementList.Count();
|
||
checkStatisc.TotalCheckNum = totalManagementList.Count();
|
||
checkStatisc.OKNum = managementList.Count(x => x.ApprovalDate != null);
|
||
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.ApprovalDate != null);
|
||
checkStatisc.OneOKRate = managementList.Count(x => x.ImplementationFrontState == "已完成").ToString(); //当期完成数
|
||
checkStatisc.TotalOneOKRate = totalManagementList.Count(x => x.ImplementationFrontState == "已完成").ToString(); //累计完成数
|
||
|
||
StatisticsList.Add(checkStatisc);
|
||
Quantity1Sum += checkStatisc.CheckNum;
|
||
Quantity2Sum += checkStatisc.TotalCheckNum;
|
||
Quantity3Sum += checkStatisc.OKNum;
|
||
Quantity4Sum += checkStatisc.TotalOKNum;
|
||
Quantity5Sum += Convert.ToInt32(checkStatisc.OneOKRate);
|
||
Quantity6Sum += Convert.ToInt32(checkStatisc.TotalOneOKRate);
|
||
}
|
||
|
||
Grid7.DataSource = StatisticsList;
|
||
Grid7.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
summary.Add("CheckNum", Quantity1Sum.ToString());
|
||
summary.Add("TotalCheckNum", Quantity2Sum.ToString());
|
||
summary.Add("OKNum", Quantity3Sum.ToString());
|
||
summary.Add("TotalOKNum", Quantity4Sum.ToString());
|
||
summary.Add("OneOKRate", Quantity5Sum.ToString());
|
||
summary.Add("TotalOneOKRate", Quantity6Sum.ToString());
|
||
Grid7.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> loadDesignChangeOrderDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select ImplementationFrontState,
|
||
ProjectId,
|
||
CNProfessionalId,
|
||
IssuedDate,ApprovalDate from Comprehensive_DesignChangeOrder
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 7.1 合格焊工管理情况 Grid8方法
|
||
/// <summary>
|
||
/// 加载合格焊工管理情况
|
||
/// </summary>
|
||
void loadPassWelder()
|
||
{
|
||
int Quantity1Sum = 0, Quantity2Sum = 0, Quantity3Sum = 0, Quantity4Sum = 0, Quantity5Sum = 0, Quantity6Sum = 0, Quantity7Sum = 0, Quantity8Sum = 0;
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59"));
|
||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||
List<Model.PassWelderStatisc> StatisticsList = new List<Model.PassWelderStatisc>();
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
if (project != null)
|
||
{
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
}
|
||
int i = 1;
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var passWelderUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2).ToList();
|
||
foreach (var item in passWelderUnits)
|
||
{
|
||
var query = from c in db.Comprehensive_InspectionPerson
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
join cn in db.Base_CNProfessional on c.CNProfessionalId equals cn.CNProfessionalId into cnJoin
|
||
from cn in cnJoin.DefaultIfEmpty()
|
||
join p in db.Base_Post on c.PostId equals p.PostId into postJoin
|
||
from p in postJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
{
|
||
c.InspectionPersonId,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.PersonName,
|
||
c.ApprovalTime,
|
||
cn.ProfessionalName,
|
||
p.PostName
|
||
|
||
};
|
||
|
||
//单位下所有集合
|
||
// List<Model.BS_Welder> totalWelderList = BLL.PersonManageService.GetWelderListByUnitId(this.CurrUser.LoginProjectId, item.UnitId);
|
||
//List<Model.BS_Welder> welderList = BLL.PersonManageService.GetWelderListByUnitIdAndDate(this.CurrUser.LoginProjectId, item.UnitId, startDate, endDate);
|
||
var totalWelderList = query.ToList();
|
||
var welderList = query
|
||
.Where(x => (x.ApprovalTime >= Convert.ToDateTime(startDate) && x.ApprovalTime <= Convert.ToDateTime(endDate)));
|
||
Model.PassWelderStatisc passWelderStatisc = new Model.PassWelderStatisc();
|
||
passWelderStatisc.Num = i;
|
||
passWelderStatisc.UnitName = item.UnitName;
|
||
passWelderStatisc.PipeMountGuard = welderList.Count(x => x.ProfessionalName == "管道" && x.PostName == "焊工");
|
||
passWelderStatisc.PipeTotal = totalWelderList.Count(x => x.ProfessionalName == "管道" && x.PostName == "焊工");
|
||
passWelderStatisc.SteelStructureMountGuard = welderList.Count(x => x.ProfessionalName == "土建" && x.PostName == "焊工");
|
||
passWelderStatisc.SteelStructureTotal = totalWelderList.Count(x => x.ProfessionalName == "土建" && x.PostName == "焊工");
|
||
passWelderStatisc.EquipmentMountGuard = welderList.Count(x => x.ProfessionalName == "设备" && x.PostName == "焊工");
|
||
passWelderStatisc.EquipmentTotal = totalWelderList.Count(x => x.ProfessionalName == "设备" && x.PostName == "焊工");
|
||
passWelderStatisc.OtherMountGuard = welderList.Count(x => x.ProfessionalName != "管道" && x.ProfessionalName != "土建" && x.ProfessionalName != "设备" && x.PostName == "焊工");
|
||
passWelderStatisc.OtherTotal = totalWelderList.Count(x => x.ProfessionalName != "管道" && x.ProfessionalName != "土建" && x.ProfessionalName != "设备" && x.PostName == "焊工");
|
||
StatisticsList.Add(passWelderStatisc);
|
||
i++;
|
||
Quantity1Sum += passWelderStatisc.PipeMountGuard;
|
||
Quantity2Sum += passWelderStatisc.PipeTotal;
|
||
Quantity3Sum += passWelderStatisc.SteelStructureMountGuard;
|
||
Quantity4Sum += passWelderStatisc.SteelStructureTotal;
|
||
Quantity5Sum += passWelderStatisc.EquipmentMountGuard;
|
||
Quantity6Sum += passWelderStatisc.EquipmentTotal;
|
||
Quantity7Sum += passWelderStatisc.OtherMountGuard;
|
||
Quantity8Sum += passWelderStatisc.OtherTotal;
|
||
}
|
||
|
||
Grid8.DataSource = StatisticsList;
|
||
Grid8.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitName", "合计");
|
||
summary.Add("PipeMountGuard", Quantity1Sum.ToString());
|
||
summary.Add("PipeTotal", Quantity2Sum.ToString());
|
||
summary.Add("SteelStructureMountGuard", Quantity3Sum.ToString());
|
||
summary.Add("SteelStructureTotal", Quantity4Sum.ToString());
|
||
summary.Add("EquipmentMountGuard", Quantity5Sum.ToString());
|
||
summary.Add("EquipmentTotal", Quantity6Sum.ToString());
|
||
summary.Add("OtherMountGuard", Quantity7Sum.ToString());
|
||
summary.Add("OtherTotal", Quantity8Sum.ToString());
|
||
Grid8.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> loadPassWelderDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select InspectionPersonId,UnitId,ApprovalTime,ProfessionalName,PostName
|
||
from Comprehensive_InspectionPerson a left join Base_CNProfessional b on a.CNProfessionalId=b.CNProfessionalId
|
||
left join Base_Post c on a.PostId=c.PostId
|
||
where a.ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 7.2 PQR/WPS报验情况 Grid9方法
|
||
protected void btnAddGrid9_Click(object sender, EventArgs e)
|
||
{
|
||
Grid9.Hidden = false;
|
||
|
||
JArray teamGroupData = Grid9.GetMergedData();
|
||
List<JObject> list = new List<JObject>();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//values.Add("Id", teamGroupRow.Value<string>("id"));
|
||
list.Add(values);
|
||
}
|
||
JObject defaultObj = new JObject
|
||
{ { "Id",Guid.NewGuid() },
|
||
{ "ReportId", ReportId },
|
||
{ "ReType", "2" },
|
||
{ "UnitOrMajor",""},
|
||
{ "Quantity1", "" },
|
||
{ "Quantity2","" },
|
||
{ "Quantity3", "" },
|
||
{ "Quantity4","" },
|
||
{ "Remarks", "" },
|
||
{ "Delete9", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", GetDeleteScriptGrid9(), IconHelper.GetResolvedIconUrl(Icon.Delete)) }
|
||
};
|
||
list.Add(defaultObj);
|
||
Grid9.DataSource = list;
|
||
Grid9.DataBind();
|
||
|
||
//SaveMethod();
|
||
}
|
||
|
||
protected void Grid9_PreDataBound(object sender, EventArgs e)
|
||
{
|
||
// 设置LinkButtonField的点击客户端事件
|
||
LinkButtonField deleteField = Grid9.FindColumn("Delete9") as LinkButtonField;
|
||
deleteField.OnClientClick = GetDeleteScriptGrid9();
|
||
}
|
||
/// <summary>
|
||
/// 删除提示
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private string GetDeleteScriptGrid9()
|
||
{
|
||
return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, Grid9.GetDeleteSelectedRowsReference(), String.Empty);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 为grid9合计行
|
||
/// </summary>
|
||
void OutPutSummaryGrid9()
|
||
{
|
||
DataTable source = ObjectToTable(Grid9.DataSource);
|
||
int Quantity1Total = 0, Quantity2Total = 0, Quantity3Total = 0, Quantity4Total = 0;
|
||
if (source != null)
|
||
{
|
||
foreach (DataRow row in source.Rows)
|
||
{
|
||
Quantity1Total += Convert.ToInt32(row["Quantity1"]);
|
||
Quantity2Total += Convert.ToInt32(row["Quantity2"]);
|
||
Quantity3Total += Convert.ToInt32(row["Quantity3"]);
|
||
Quantity4Total += Convert.ToInt32(row["Quantity4"]);
|
||
}
|
||
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Total.ToString());
|
||
summary.Add("Quantity2", Quantity2Total.ToString());
|
||
summary.Add("Quantity3", Quantity3Total.ToString());
|
||
summary.Add("Quantity4", Quantity4Total.ToString());
|
||
Grid9.SummaryData = summary;
|
||
}
|
||
|
||
}
|
||
|
||
public static DataTable ObjectToTable(object obj)
|
||
{
|
||
try
|
||
{
|
||
Type t;
|
||
if (obj.GetType().IsGenericType)
|
||
{
|
||
t = obj.GetType().GetGenericTypeDefinition();
|
||
}
|
||
else
|
||
{
|
||
t = obj.GetType();
|
||
}
|
||
if (t == typeof(List<>) ||
|
||
t == typeof(IEnumerable<>))
|
||
{
|
||
DataTable dt = new DataTable();
|
||
IEnumerable<object> lstenum = obj as IEnumerable<object>;
|
||
if (lstenum.Count() > 0)
|
||
{
|
||
var ob1 = lstenum.GetEnumerator();
|
||
ob1.MoveNext();
|
||
foreach (var item in ob1.Current.GetType().GetProperties())
|
||
{
|
||
dt.Columns.Add(new DataColumn() { ColumnName = item.Name });
|
||
}
|
||
//数据
|
||
foreach (var item in lstenum)
|
||
{
|
||
DataRow row = dt.NewRow();
|
||
foreach (var sub in item.GetType().GetProperties())
|
||
{
|
||
row[sub.Name] = sub.GetValue(item, null);
|
||
}
|
||
dt.Rows.Add(row);
|
||
}
|
||
return dt;
|
||
}
|
||
}
|
||
else if (t == typeof(DataTable))
|
||
{
|
||
return (DataTable)obj;
|
||
}
|
||
else //(t==typeof(Object))
|
||
{
|
||
DataTable dt = new DataTable();
|
||
foreach (var item in obj.GetType().GetProperties())
|
||
{
|
||
dt.Columns.Add(new DataColumn() { ColumnName = item.Name });
|
||
}
|
||
DataRow row = dt.NewRow();
|
||
foreach (var item in obj.GetType().GetProperties())
|
||
{
|
||
row[item.Name] = item.GetValue(obj, null);
|
||
}
|
||
dt.Rows.Add(row);
|
||
return dt;
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
}
|
||
return null;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 7.3 无损检测管理 Grid10方法
|
||
void loadProcessControl_NondestructiveTest_New()
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(string.Format(this.txtStartDate.Text.Trim()));
|
||
DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59"));
|
||
var list = new List<Model.ProcessControl_NondestructiveTest_New>();
|
||
//加载所有施工分包单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var nondestructiveTestUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2).ToList();
|
||
|
||
int? totalNum0 = 0, totalNum1 = 0;//拍片数量合计
|
||
|
||
|
||
foreach (var item in nondestructiveTestUnits)
|
||
{
|
||
int? num0 = 0, num1 = 0;//拍片数量小计
|
||
|
||
var query = from c in db.ProcessControl_NondestructiveTest_New
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
&& c.CreateDate >= startDate && c.CreateDate <= endDate
|
||
orderby c.CreateDate descending
|
||
|
||
select new
|
||
|
||
{
|
||
c.CreateDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.ProfessionalName,
|
||
c.MonthQuantity,
|
||
c.TotalQuantity,
|
||
c.MonthRate,
|
||
c.TotalRate
|
||
};
|
||
if (query.ToList().Count > 0)
|
||
{
|
||
//加载工艺管道
|
||
var gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "工艺管道");
|
||
var model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "工艺管道";
|
||
|
||
if (gygdModel != null)
|
||
{
|
||
model.MonthQuantity = gygdModel.MonthQuantity;
|
||
model.TotalQuantity = gygdModel.TotalQuantity;
|
||
model.MonthRate = gygdModel.MonthRate + "%";
|
||
model.TotalRate = gygdModel.TotalRate + "%";
|
||
#region 小计和合计
|
||
//小计
|
||
num0 += gygdModel.MonthQuantity;
|
||
num1 += gygdModel.TotalQuantity;
|
||
|
||
//合计
|
||
totalNum0 += gygdModel.MonthQuantity;
|
||
totalNum1 += gygdModel.TotalQuantity;
|
||
|
||
#endregion
|
||
list.Add(model);
|
||
}
|
||
else
|
||
{
|
||
model.MonthQuantity = 0;
|
||
model.TotalQuantity = 0;
|
||
model.MonthRate = "0%";
|
||
model.TotalRate = "0%";
|
||
list.Add(model);
|
||
}
|
||
|
||
|
||
|
||
|
||
//地管
|
||
gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "地管");
|
||
model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "地管";
|
||
|
||
if (gygdModel != null)
|
||
{
|
||
model.MonthQuantity = gygdModel.MonthQuantity;
|
||
model.TotalQuantity = gygdModel.TotalQuantity;
|
||
model.MonthRate = gygdModel.MonthRate + "%";
|
||
model.TotalRate = gygdModel.TotalRate + "%";
|
||
#region 小计和合计
|
||
//小计
|
||
num0 += gygdModel.MonthQuantity;
|
||
num1 += gygdModel.TotalQuantity;
|
||
|
||
//合计
|
||
totalNum0 += gygdModel.MonthQuantity;
|
||
totalNum1 += gygdModel.TotalQuantity;
|
||
|
||
#endregion
|
||
list.Add(model);
|
||
}
|
||
else
|
||
{
|
||
model.MonthQuantity = 0;
|
||
model.TotalQuantity = 0;
|
||
model.MonthRate = "0%";
|
||
model.TotalRate = "0%";
|
||
list.Add(model);
|
||
}
|
||
|
||
|
||
//非标
|
||
gygdModel = query.FirstOrDefault(x => x.ProfessionalName == "非标");
|
||
model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "非标";
|
||
|
||
if (gygdModel != null)
|
||
{
|
||
model.MonthQuantity = gygdModel.MonthQuantity;
|
||
model.TotalQuantity = gygdModel.TotalQuantity;
|
||
model.MonthRate = gygdModel.MonthRate + "%";
|
||
model.TotalRate = gygdModel.TotalRate + "%";
|
||
#region 小计和合计
|
||
//小计
|
||
num0 += gygdModel.MonthQuantity;
|
||
num1 += gygdModel.TotalQuantity;
|
||
|
||
//合计
|
||
totalNum0 += gygdModel.MonthQuantity;
|
||
totalNum1 += gygdModel.TotalQuantity;
|
||
|
||
#endregion
|
||
list.Add(model);
|
||
}
|
||
else
|
||
{
|
||
model.MonthQuantity = 0;
|
||
model.TotalQuantity = 0;
|
||
model.MonthRate = "0%";
|
||
model.TotalRate = "0%";
|
||
list.Add(model);
|
||
}
|
||
//小计
|
||
model = new Model.ProcessControl_NondestructiveTest_New();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.CreateMan = item.UnitName;//用作存储施工单位名称
|
||
model.ProfessionalName = "小计";
|
||
model.MonthQuantity = num0;
|
||
model.TotalQuantity = num1;
|
||
model.MonthRate = "";
|
||
model.TotalRate = "";
|
||
list.Add(model);
|
||
}
|
||
}
|
||
if (list.Count == 0)
|
||
{
|
||
Grid10.Hidden = true;
|
||
hidWsjcgl.Hidden = false;
|
||
}
|
||
else
|
||
{
|
||
Grid10.Hidden = false;
|
||
hidWsjcgl.Hidden = true;
|
||
Grid10.DataSource = list;
|
||
Grid10.DataBind();
|
||
|
||
//合计
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("CreateMan", "合计");
|
||
summary.Add("MonthQuantity", totalNum0.ToString());
|
||
summary.Add("TotalQuantity", totalNum1.ToString());
|
||
|
||
Grid10.SummaryData = summary;
|
||
}
|
||
}
|
||
|
||
async Task<DataTable> loadProcessControl_NondestructiveTest_NewDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59"));
|
||
|
||
string strSql = @"select UnitId,ProfessionalName,MonthQuantity,TotalQuantity,MonthRate,TotalRate
|
||
from ProcessControl_NondestructiveTest_New
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' and CreateDate >='" + startDate + "' and CreateDate <='" + endDate + "'";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region 8 设备报验管理情况 Grid11方法
|
||
/// <summary>
|
||
/// 加载一般施工审批情况
|
||
/// </summary>
|
||
void LoadInspectionEquipment(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_Construction_Plan>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var inspectionEquipmentUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in inspectionEquipmentUnits)
|
||
{
|
||
var query = from c in db.Comprehensive_InspectionEquipment
|
||
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
|
||
//&& c.Status == "3"
|
||
|
||
select new
|
||
|
||
{
|
||
c.SamplingResult,//1合格 2不合格
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.InspectionDate
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.InspectionDate >= Convert.ToDateTime(startDate) && x.InspectionDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_Construction_Plan model = new Model.Report_Construction_Plan();
|
||
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.UnitOrMajor = item.UnitName;
|
||
model.Quantity1 = monethCount.Count();
|
||
model.Quantity2 = AllList.Count();
|
||
//验收合格率
|
||
var UnqualifiedCount = AllList.Where(x => x.SamplingResult == "1").ToList().Count;//合格的数量
|
||
if (UnqualifiedCount == AllList.Count() && AllList.Count() != 0)
|
||
{
|
||
model.QuaRate = "100%";
|
||
}
|
||
else if (UnqualifiedCount == 0 && AllList.Count() == 0)
|
||
{
|
||
model.QuaRate = "0%";
|
||
}
|
||
else
|
||
{
|
||
var Qualificationrate = (Convert.ToDouble(UnqualifiedCount) / Convert.ToDouble(AllList.Count)) * 100;
|
||
model.QuaRate = Qualificationrate.ToString("0.00") + "%";
|
||
}
|
||
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.UnitName && x.ReType == "6");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
|
||
i++;
|
||
}
|
||
Grid11.DataSource = list;
|
||
Grid11.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("UnitOrMajor", "合计");
|
||
summary.Add("Quantity1", Quantity1Sum.ToString());
|
||
summary.Add("Quantity2", Quantity2Sum.ToString());
|
||
|
||
Grid11.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> LoadInspectionEquipmentDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59"));
|
||
|
||
string strSql = @"select UnitId,InspectionDate,SamplingResult
|
||
from Comprehensive_InspectionEquipment
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新增按钮显示文本框
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAddGrid11_Click(object sender, EventArgs e)
|
||
{
|
||
Form19.Hidden = false;
|
||
}
|
||
#endregion
|
||
|
||
#region 9.计量器具报验管理情况 gvMeasuringInspection方法
|
||
/// <summary>
|
||
/// 计量器具报验管理情况
|
||
/// </summary>
|
||
void loadMeasuringInspection(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var measuringInspectionUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in measuringInspectionUnits)
|
||
{
|
||
var query = from c in db.Comprehensive_InspectionMachine
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId && c.InspectionType.Equals("计量")
|
||
select new
|
||
{
|
||
c.InspectionDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.InspectionDate >= Convert.ToDateTime(startDate) && x.InspectionDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = monethCount.Count();
|
||
model.ProjectCount = AllList.Count();
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "9");
|
||
if (NewModel != null)
|
||
{
|
||
model.RectificationRate = NewModel.RectificationRate;
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
i++;
|
||
}
|
||
gvMeasuringInspection.DataSource = list;
|
||
gvMeasuringInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvMeasuringInspection.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> cqmsRemarksDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
if (objType == "1")
|
||
{
|
||
string strSql = @"select ContentName,ReType, Remarks from Report_CQMS_MonthReportItem
|
||
where ReportId='" + ReportId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
}
|
||
else
|
||
{
|
||
return null;
|
||
}
|
||
});
|
||
}
|
||
|
||
async Task<DataTable> LoadMeasuringInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(string.Format("{0:yyyy-MM-dd HH:mm:ss}", this.txtEndDate.Text.Trim() + " 23:59:59"));
|
||
|
||
string strSql = @"select UnitId,InspectionDate
|
||
from Comprehensive_InspectionMachine
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' and InspectionType='计量'";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 10.现场质量共检数据 gvInspectionDataInspection方法
|
||
/// <summary>
|
||
/// 现场质量共检数据
|
||
/// </summary>
|
||
void loadInspectionDataInspection(string objType)
|
||
{
|
||
CheckLotBindStatisc("CV");//检验批统计:土建
|
||
CheckLotBindStatisc("EQ");//检验批统计:设备
|
||
CheckLotBindStatisc("PP");//检验批统计:管道
|
||
CheckLotBindStatisc("EL");//检验批统计:电气
|
||
CheckLotBindStatisc("IN");//检验批统计:仪表
|
||
CheckLotBindStatisc("AC");//检验批统计:反腐
|
||
CheckLotBindStatisc("FF");//检验批统计:消防
|
||
|
||
#region 现场质量共检数据合计
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.CheckStatisc>();
|
||
int i = 1;
|
||
|
||
int CheckNum = 0;//本月检查点数
|
||
int TotalCheckNum = 0;//累计检查点数
|
||
|
||
int OKNum = 0;//本月检查合格点数
|
||
int TotalOKNum = 0;//累计检查合格点数
|
||
|
||
string Quantity1Sum = String.Empty;//本月检查合格点数/本月检查点数
|
||
string Quantity2Sum = String.Empty;//累计检查合格点数/累计检查点数
|
||
|
||
var inspectionUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
//var cqmsDetail = from c in db.View_CQMS_InspectionManagementDetail
|
||
// join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
// from u in unitJoin.DefaultIfEmpty()
|
||
// select new
|
||
// {
|
||
// c.InspectionDate,
|
||
// c.ProjectId,
|
||
// u.UnitId,
|
||
// u.UnitName,
|
||
// c.IsOnceQualified
|
||
// };
|
||
var cqmsList = from c in db.ProcessControl_InspectionManagement
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
select new
|
||
{
|
||
c.InspectionDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.IsOnceQualified
|
||
};
|
||
foreach (var item in inspectionUnits)
|
||
{
|
||
var query = from x in cqmsList
|
||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == item.UnitId
|
||
select new
|
||
{
|
||
x.InspectionDate,
|
||
x.ProjectId,
|
||
x.UnitId,
|
||
x.UnitName,
|
||
x.IsOnceQualified
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.InspectionDate >= Convert.ToDateTime(startDate) && x.InspectionDate <= Convert.ToDateTime(endDate)));
|
||
|
||
|
||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||
checkStatisc.Id = Guid.NewGuid().ToString();
|
||
checkStatisc.ReportId = ReportId;
|
||
checkStatisc.WorkName = item.UnitName;
|
||
checkStatisc.CheckNum = monethCount.Count();
|
||
checkStatisc.TotalCheckNum = AllList.Count();
|
||
checkStatisc.OKNum = monethCount.Count(x => x.IsOnceQualified == null || x.IsOnceQualified == true);
|
||
checkStatisc.TotalOKNum = AllList.Count(x => x.IsOnceQualified == null || x.IsOnceQualified == true);
|
||
|
||
if (checkStatisc.CheckNum != 0)//被除数不能为零
|
||
{
|
||
checkStatisc.OneOKRate = Math.Round((double)checkStatisc.OKNum / (double)checkStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
checkStatisc.OneOKRate = "0%";
|
||
}
|
||
|
||
if (checkStatisc.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
checkStatisc.TotalOneOKRate = Math.Round((double)checkStatisc.TotalOKNum / (double)checkStatisc.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
checkStatisc.TotalOneOKRate = "0%";
|
||
}
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "10");
|
||
if (NewModel != null)
|
||
{
|
||
checkStatisc.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(checkStatisc);
|
||
|
||
CheckNum += checkStatisc.CheckNum;
|
||
TotalCheckNum += checkStatisc.TotalCheckNum;
|
||
|
||
OKNum += checkStatisc.OKNum;
|
||
TotalOKNum += checkStatisc.TotalOKNum;
|
||
|
||
i++;
|
||
}
|
||
|
||
gvInspectionDataInspection.DataSource = list;
|
||
gvInspectionDataInspection.DataBind();
|
||
|
||
if (CheckNum != 0)//被除数不能为零
|
||
{
|
||
Quantity1Sum = Math.Round((double)OKNum / (double)CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
Quantity1Sum = "0%";
|
||
}
|
||
if (TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
Quantity2Sum = Math.Round((double)TotalOKNum / (double)TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
Quantity2Sum = "0%";
|
||
}
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
summary.Add("CheckNum", CheckNum.ToString());
|
||
summary.Add("OKNum", OKNum.ToString());
|
||
summary.Add("OneOKRate", Quantity1Sum.ToString());
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());
|
||
summary.Add("TotalOneOKRate", Quantity2Sum.ToString());
|
||
|
||
gvInspectionDataInspection.SummaryData = summary;
|
||
#endregion
|
||
}
|
||
async Task<DataTable> loadInspectionDataInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select UnitId,IsOnceQualified, InspectionDate from View_CQMS_InspectionManagementDetail
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
public void CheckLotBindStatisc(string cNProfessionalCode)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
|
||
DateTime projectStartDate = Convert.ToDateTime("2015-01-01");
|
||
List<Model.CheckStatisc> StatisticsList = new List<Model.CheckStatisc>();
|
||
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
|
||
int CheckNum = 0;
|
||
int TotalCheckNum = 0;
|
||
|
||
int OKNum = 0;
|
||
int TotalOKNum = 0;
|
||
|
||
string OneOKRate = String.Empty;
|
||
string TotalOneOKRate = String.Empty;
|
||
|
||
|
||
if (project != null)
|
||
{
|
||
if (project.StartDate != null)
|
||
{
|
||
projectStartDate = Convert.ToDateTime(project.StartDate);
|
||
}
|
||
}
|
||
//int i = 1;
|
||
string cNProfessionalId = (from x in db.Base_CNProfessional where x.CNProfessionalCode == cNProfessionalCode select x.CNProfessionalId).FirstOrDefault();
|
||
|
||
List<string> workNames = new List<string>();
|
||
//专业下所有集合
|
||
List<Model.View_MonthReport_InspectionManagement> totalManagementList = BLL.InspectionManagementService.getViewMonthReportInspectionManagementByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, cNProfessionalId, projectStartDate, endDate, false);
|
||
//专业下当期集合
|
||
List<Model.View_MonthReport_InspectionManagement> managementList = BLL.InspectionManagementService.getViewMonthReportInspectionManagementByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, cNProfessionalId, startDate, endDate, false);
|
||
workNames = totalManagementList.Select(x => x.UnitWorkId).DefaultIfEmpty().Distinct()?.ToList();
|
||
|
||
foreach (string item in workNames)
|
||
{
|
||
Model.WBS_UnitWork ins = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item);
|
||
if (ins != null)
|
||
{
|
||
Model.CheckStatisc checkStatisc = new Model.CheckStatisc();
|
||
checkStatisc.Id = Guid.NewGuid().ToString();
|
||
checkStatisc.WorkName = ins.UnitWorkName;
|
||
|
||
checkStatisc.CheckNum = managementList.Count(x => x.UnitWorkId == item);
|
||
checkStatisc.TotalCheckNum = totalManagementList.Count(x => x.UnitWorkId == item);
|
||
|
||
checkStatisc.OKNum = managementList.Count(x => x.UnitWorkId == item && (x.IsOnceQualified == null || x.IsOnceQualified == true));
|
||
checkStatisc.TotalOKNum = totalManagementList.Count(x => x.UnitWorkId == item && (x.IsOnceQualified == null || x.IsOnceQualified == true));
|
||
|
||
if (checkStatisc.CheckNum != 0)//被除数不能为零
|
||
{
|
||
checkStatisc.OneOKRate = Math.Round((double)checkStatisc.OKNum / (double)checkStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
checkStatisc.OneOKRate = "0%";
|
||
}
|
||
|
||
if (checkStatisc.TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
checkStatisc.TotalOneOKRate = Math.Round((double)checkStatisc.TotalOKNum / (double)checkStatisc.TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
checkStatisc.TotalOneOKRate = "0%";
|
||
}
|
||
|
||
StatisticsList.Add(checkStatisc);
|
||
|
||
CheckNum += checkStatisc.CheckNum;
|
||
TotalCheckNum += checkStatisc.TotalCheckNum;
|
||
|
||
OKNum += checkStatisc.OKNum;
|
||
TotalOKNum += checkStatisc.TotalOKNum;
|
||
}
|
||
}
|
||
|
||
if (CheckNum != 0)//被除数不能为零
|
||
{
|
||
OneOKRate = Math.Round((double)OKNum / (double)CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OneOKRate = "0";
|
||
}
|
||
if (TotalCheckNum != 0)//被除数不能为零
|
||
{
|
||
TotalOneOKRate = Math.Round((double)TotalOKNum / (double)TotalCheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
TotalOneOKRate = "0";
|
||
}
|
||
|
||
//检验批统计:土建
|
||
if (cNProfessionalCode == "CV")
|
||
{
|
||
this.gvTj.DataSource = StatisticsList;
|
||
this.gvTj.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
gvTj.SummaryData = summary;
|
||
|
||
}
|
||
//检验批统计:设备
|
||
if (cNProfessionalCode == "EQ")
|
||
{
|
||
this.GvSb.DataSource = StatisticsList;
|
||
this.GvSb.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
GvSb.SummaryData = summary;
|
||
}
|
||
//检验批统计:管道
|
||
if (cNProfessionalCode == "PP")
|
||
{
|
||
this.GvGD.DataSource = StatisticsList;
|
||
this.GvGD.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
GvGD.SummaryData = summary;
|
||
}
|
||
//检验批统计:电气
|
||
if (cNProfessionalCode == "EL")
|
||
{
|
||
this.GvDq.DataSource = StatisticsList;
|
||
this.GvDq.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
GvDq.SummaryData = summary;
|
||
}
|
||
//检验批统计:仪表
|
||
if (cNProfessionalCode == "IN")
|
||
{
|
||
this.GvYb.DataSource = StatisticsList;
|
||
this.GvYb.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
GvYb.SummaryData = summary;
|
||
}
|
||
//检验批统计:防腐
|
||
if (cNProfessionalCode == "AC")
|
||
{
|
||
this.GvFf.DataSource = StatisticsList;
|
||
this.GvFf.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
GvFf.SummaryData = summary;
|
||
}
|
||
//检验批统计:消防
|
||
if (cNProfessionalCode == "FF")
|
||
{
|
||
this.GvXf.DataSource = StatisticsList;
|
||
this.GvXf.DataBind();
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
|
||
summary.Add("CheckNum", CheckNum.ToString()); //当前检查点数
|
||
summary.Add("TotalCheckNum", TotalCheckNum.ToString());//累计点数
|
||
|
||
summary.Add("OKNum", OKNum.ToString());//当前合格点数
|
||
summary.Add("TotalOKNum", TotalOKNum.ToString());//累计合格点数
|
||
|
||
summary.Add("OneOKRate", OneOKRate.ToString());//本月合格点数
|
||
summary.Add("TotalOneOKRate", TotalOneOKRate.ToString());//本月累计合格点数
|
||
|
||
GvXf.SummaryData = summary;
|
||
}
|
||
}
|
||
|
||
|
||
async Task<DataTable> CheckLotBindStatiscDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select a.UnitWorkId,UnitWorkName,cNProfessionalCode,IsOnceQualified,InspectionDate from View_MonthReport_InspectionManagement a
|
||
left join WBS_UnitWork b on a.UnitWorkId =b.UnitWorkId
|
||
left join Base_CNProfessional c on a.CNProfessionalId= c.CNProfessionalId
|
||
where a.ProjectId='" + this.CurrUser.LoginProjectId + "' order by cNProfessionalCode,UnitWorkName";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 11.压力管道监检情况 gvPressureInspection方法
|
||
/// <summary>
|
||
/// 压力管道监检情况
|
||
/// </summary>
|
||
void loadPressureInspection(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity0Sum = 0;
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var pressureUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in pressureUnits)
|
||
{
|
||
var query = from c in db.Comprehensive_PressurePipe
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.Projctid == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
{
|
||
c.ReportTime,
|
||
c.Projctid,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.ActualNumber,
|
||
c.PressurePipeNumber
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.ReportTime >= Convert.ToDateTime(startDate) && x.ReportTime <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = Convert.ToInt32(monethCount.Sum(o => o.PressurePipeNumber));
|
||
model.ProjectCount = Convert.ToInt32(AllList.Sum(o => o.PressurePipeNumber));
|
||
model.TotalNoBackCount = Convert.ToInt32(monethCount.Sum(o => o.ActualNumber));//总数
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "11");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
Quantity0Sum += Convert.ToInt32(AllList.Sum(o => o.ActualNumber));
|
||
Quantity1Sum += Convert.ToInt32(monethCount.Sum(o => o.PressurePipeNumber));
|
||
Quantity2Sum += Convert.ToInt32(AllList.Sum(o => o.PressurePipeNumber));
|
||
i++;
|
||
}
|
||
gvPressureInspection.DataSource = list;
|
||
gvPressureInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("TotalNoBackCount", Quantity0Sum.ToString());//总数
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvPressureInspection.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> LoadPressureInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select UnitId, PressurePipeNumber,ActualNumber, ReportTime from Comprehensive_PressurePipe
|
||
where Projctid='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 12.管道试压包管理情况 gvPipingInspection方法
|
||
/// <summary>
|
||
/// 管道试压包管理情况
|
||
/// </summary>
|
||
void loadPipingInspection(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity0Sum = 0;
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var pipingUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in pipingUnits)
|
||
{
|
||
var query = from c in db.Comprehensive_PressurePipe
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.Projctid == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
{
|
||
c.ReportTime,
|
||
c.Projctid,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.PackageNumber,
|
||
c.IssuedReportNumber
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.ReportTime >= Convert.ToDateTime(startDate) && x.ReportTime <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.TotalNoBackCount = Convert.ToInt32(monethCount.Sum(o => o.PackageNumber));
|
||
model.MonthsCount = Convert.ToInt32(monethCount.Sum(o => o.IssuedReportNumber));
|
||
model.ProjectCount = Convert.ToInt32(AllList.Sum(o => o.IssuedReportNumber));
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "11");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity0Sum += Convert.ToInt32(monethCount.Sum(o => o.PackageNumber));
|
||
Quantity1Sum += Convert.ToInt32(monethCount.Sum(o => o.IssuedReportNumber));
|
||
Quantity2Sum += Convert.ToInt32(AllList.Sum(o => o.IssuedReportNumber));
|
||
i++;
|
||
}
|
||
gvPipingInspection.DataSource = list;
|
||
gvPipingInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("TotalNoBackCount", Quantity0Sum.ToString());
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvPipingInspection.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> LoadPipingInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
string strSql = @"select UnitId, PackageNumber,IssuedReportNumber, ReportTime from Comprehensive_PressurePipe
|
||
where Projctid='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 13.特种设备监检情况 gvSpecialInspection方法
|
||
/// <summary>
|
||
/// 特种设备监检情况
|
||
/// </summary>
|
||
void loadSpecialInspection(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity0Sum = 0;
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var specialUnits = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in specialUnits)
|
||
{
|
||
var query = from c in db.Comprehensive_SpecialEquipment
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
{
|
||
c.ReportTime,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.SunNumber,
|
||
c.MonitoringReportNumber
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.ReportTime >= Convert.ToDateTime(startDate) && x.ReportTime <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.TotalNoBackCount = Convert.ToInt32(AllList.Sum(o => o.SunNumber));
|
||
model.MonthsCount = Convert.ToInt32(monethCount.Sum(o => o.MonitoringReportNumber));
|
||
model.ProjectCount = Convert.ToInt32(AllList.Sum(o => o.MonitoringReportNumber));
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "13");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
Quantity0Sum += Convert.ToInt32(AllList.Sum(o => o.SunNumber));
|
||
Quantity1Sum += Convert.ToInt32(monethCount.Sum(o => o.MonitoringReportNumber));
|
||
Quantity2Sum += Convert.ToInt32(AllList.Sum(o => o.MonitoringReportNumber));
|
||
i++;
|
||
}
|
||
gvSpecialInspection.DataSource = list;
|
||
gvSpecialInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("TotalNoBackCount", Quantity0Sum.ToString());//总数
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());//本月完成监检数量
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());//累计完成监检数量
|
||
|
||
gvSpecialInspection.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> LoadSpecialInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select UnitId, SunNumber,MonitoringReportNumber, ReportTime from Comprehensive_SpecialEquipment
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 14.NCR管理情况 gvNcrManagementInspection方法
|
||
/// <summary>
|
||
/// NCR管理情况
|
||
/// </summary>
|
||
void loadNcrManagementInspection(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
List<Model.NCRReportStatisc> StatisticsList = new List<Model.NCRReportStatisc>();
|
||
int i = 1;
|
||
|
||
int CurrentPeriodOkNumSum = 0;
|
||
int OKNumSum = 0;
|
||
int CheckNumSum = 0;
|
||
string OKRateSum = string.Empty;
|
||
|
||
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||
DateTime projectStartDate = Convert.ToDateTime("2000-01-01");
|
||
if (project != null && project.StartDate != null)
|
||
{
|
||
projectStartDate = project.StartDate.Value;
|
||
}
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitType == BLL.Const.ProjectUnitType_2
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var ncrUnits = units.ToList();
|
||
|
||
foreach (var item in ncrUnits)
|
||
{
|
||
|
||
var query = from c in db.Comprehensive_NCRManagement
|
||
join u in db.Base_Unit on c.SendUnit equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.ReceiveUnit.Contains(item.UnitId)
|
||
select new
|
||
{
|
||
c.NCRManagementId,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.IssuedDate,
|
||
c.Status,
|
||
c.ImplementationFrontState,
|
||
};
|
||
|
||
var AllList = query.ToList();
|
||
var unitNCRStatic = query
|
||
.Where(x => (x.IssuedDate >= Convert.ToDateTime(startDate) && x.IssuedDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.NCRReportStatisc NCRStatisc = new Model.NCRReportStatisc();
|
||
NCRStatisc.Id = Guid.NewGuid().ToString();
|
||
NCRStatisc.WorkName = item.UnitName;
|
||
|
||
NCRStatisc.CurrentPeriodOkNum = unitNCRStatic.Where(x => x.ImplementationFrontState == "已闭合").Count();
|
||
NCRStatisc.OKNum = AllList.Where(x => x.ImplementationFrontState == "已闭合").Count();
|
||
|
||
NCRStatisc.CheckNum = AllList.Count();
|
||
|
||
if (NCRStatisc.CheckNum != 0)//被除数不能为零
|
||
{
|
||
NCRStatisc.OKRate = Math.Round((double)NCRStatisc.OKNum / (double)NCRStatisc.CheckNum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
NCRStatisc.OKRate = "0%";
|
||
}
|
||
|
||
StatisticsList.Add(NCRStatisc);
|
||
|
||
CurrentPeriodOkNumSum += NCRStatisc.CurrentPeriodOkNum;
|
||
OKNumSum += NCRStatisc.OKNum;
|
||
CheckNumSum += NCRStatisc.CheckNum;
|
||
i++;
|
||
}
|
||
|
||
if (CheckNumSum != 0)//被除数不能为零
|
||
{
|
||
OKRateSum = Math.Round((double)OKNumSum / (double)CheckNumSum * 100, 2) + "%";//保留两位小数、后四舍五入
|
||
}
|
||
else
|
||
{
|
||
OKRateSum = "0%";
|
||
}
|
||
|
||
this.gvNcrManagementInspection.DataSource = StatisticsList;
|
||
this.gvNcrManagementInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("WorkName", "合计");
|
||
summary.Add("CurrentPeriodOkNum", CurrentPeriodOkNumSum.ToString());
|
||
summary.Add("OKNum", OKNumSum.ToString());
|
||
summary.Add("CheckNum", CheckNumSum.ToString());
|
||
summary.Add("OKRate", OKRateSum.ToString());
|
||
|
||
gvNcrManagementInspection.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> LoadNcrManagementInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select ReceiveUnit,ImplementationFrontState, IssuedDate from Comprehensive_NCRManagement
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 15.质量巡检情况 gvQualityInspection方法
|
||
/// <summary>
|
||
/// 加载质量巡检情况
|
||
/// </summary>
|
||
void loadQualityInspection(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
int ClosedCountSum = 0;
|
||
//加载所有单位
|
||
//var units = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1)
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var unitLists = units.Where(x => x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1).ToList();
|
||
foreach (var item in unitLists)
|
||
{
|
||
var query = from c in db.Check_CheckControl
|
||
join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId
|
||
select new
|
||
{
|
||
c.CheckDate,
|
||
c.ProjectId,
|
||
u.UnitId,
|
||
u.UnitName,
|
||
c.State
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.CheckDate >= Convert.ToDateTime(startDate) && x.CheckDate <= Convert.ToDateTime(endDate)));
|
||
var ClosedCount = query.Where(x => x.State == "7");//已关闭数量
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = monethCount.Count();
|
||
model.ProjectCount = AllList.Count();
|
||
if (AllList.Count() > 0)
|
||
{
|
||
model.RectificationRate = (100.0 * (ClosedCount.Count() / AllList.Count())).ToString("#0.00") + "%";
|
||
}
|
||
else
|
||
{
|
||
model.RectificationRate = "0.00%";
|
||
}
|
||
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "1");
|
||
if (NewModel != null)
|
||
{
|
||
//model.RectificationRate = NewModel.RectificationRate;
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
ClosedCountSum += ClosedCount.Count();
|
||
|
||
i++;
|
||
}
|
||
gvQualityInspection.DataSource = list;
|
||
gvQualityInspection.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
if (Quantity2Sum > 0)
|
||
{
|
||
summary.Add("RectificationRate", (100.00 * (ClosedCountSum / Quantity2Sum)).ToString("#0.00") + "%");
|
||
}
|
||
else
|
||
{
|
||
summary.Add("RectificationRate", "0.00%");
|
||
}
|
||
gvQualityInspection.SummaryData = summary;
|
||
}
|
||
async Task<DataTable> LoadQualityInspectionDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select UnitId,State, CheckDate from Check_CheckControl
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 16.质量专项检查情况 gvSpecialCheck方法
|
||
/// <summary>
|
||
/// 加载质量专项检查情况
|
||
/// </summary>
|
||
void loadSpecialCheck(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
|
||
//加载检查类别
|
||
var lists = BLL.JointCheckService.GetCheckTypeList();
|
||
foreach (var item in lists)
|
||
{
|
||
var query = from c in db.Check_JointCheck
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.CheckType == item.Key.ToString()
|
||
select new
|
||
{
|
||
c.CheckDate,
|
||
c.ProjectId,
|
||
c.CheckType
|
||
};
|
||
var AllList = query.ToList();
|
||
var monethCount = query
|
||
.Where(x => (x.CheckDate >= Convert.ToDateTime(startDate) && x.CheckDate <= Convert.ToDateTime(endDate)));
|
||
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.Value;
|
||
model.MonthsCount = monethCount.Count();
|
||
model.ProjectCount = AllList.Count();
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.Value && x.ReType == "2");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
i++;
|
||
}
|
||
|
||
gvSpecialCheck.DataSource = list;
|
||
gvSpecialCheck.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
|
||
gvSpecialCheck.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> loadSpecialCheckDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select CheckType, CheckDate from Check_JointCheck
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 17.质量文件上报情况 gvFileReport方法
|
||
/// <summary>
|
||
/// 加载质量文件上报情况
|
||
/// </summary>
|
||
void loadFileReport(string objType)
|
||
{
|
||
DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
|
||
DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
|
||
var list = new List<Model.Report_CQMS_MonthReportItem>();
|
||
int i = 1;
|
||
|
||
int Quantity1Sum = 0;
|
||
int Quantity2Sum = 0;
|
||
int Quantity3Sum = 0;
|
||
int Quantity4Sum = 0;
|
||
//加载所有单位
|
||
//var sendUnits = from x in db.Project_ProjectUnit
|
||
// join y in db.Base_Unit on x.UnitId equals y.UnitId
|
||
// where x.ProjectId == this.CurrUser.LoginProjectId
|
||
// orderby y.UnitCode
|
||
// select new { x.UnitId, y.UnitName };
|
||
var unitLists = units.ToList();
|
||
foreach (var item in unitLists)
|
||
{
|
||
var query = from c in db.Comprehensive_DataReceivingDoc
|
||
join u in db.Base_Unit on c.SendUnit equals u.UnitId into unitJoin
|
||
from u in unitJoin.DefaultIfEmpty()
|
||
where c.ProjectId == this.CurrUser.LoginProjectId && c.SendUnit == item.UnitId
|
||
select new
|
||
{
|
||
c.ReceiveDate,
|
||
c.ProjectId,
|
||
c.IsReply,
|
||
c.RetrunWuhuangCopies,
|
||
u.UnitId,
|
||
u.UnitName
|
||
};
|
||
var AllList = query.Where(x => x.IsReply == true).ToList();//项目数
|
||
//本月数
|
||
var monethCount = query.Where(x => x.IsReply == true && (x.ReceiveDate >= Convert.ToDateTime(startDate) && x.ReceiveDate <= Convert.ToDateTime(endDate)));
|
||
var yzCount = query.Where(x => x.IsReply == true && x.RetrunWuhuangCopies != null && (x.ReceiveDate >= Convert.ToDateTime(startDate) && x.ReceiveDate <= Convert.ToDateTime(endDate)));//本月业主/ 监理返回数量
|
||
int totalReturnCount = query.Where(x => x.IsReply == true && x.RetrunWuhuangCopies != null).Count();//总的已返回数量
|
||
var NoBackCount = AllList.Count() - totalReturnCount;//累计未返回数量
|
||
Model.Report_CQMS_MonthReportItem model = new Model.Report_CQMS_MonthReportItem();
|
||
model.Id = Guid.NewGuid().ToString();
|
||
model.ContentName = item.UnitName;
|
||
model.MonthsCount = monethCount.Count();
|
||
model.ProjectCount = AllList.Count();
|
||
model.MonthsBackCount = yzCount.Count();
|
||
model.TotalNoBackCount = NoBackCount;
|
||
model.ReportId = ReportId;
|
||
//如果是修改,查询表中数据
|
||
if (objType == "1")
|
||
{
|
||
var NewModel = db.Report_CQMS_MonthReportItem.FirstOrDefault(x => x.ReportId == ReportId && x.ContentName == item.UnitName && x.ReType == "3");
|
||
if (NewModel != null)
|
||
{
|
||
model.Remarks = NewModel.Remarks;
|
||
}
|
||
}
|
||
list.Add(model);
|
||
|
||
Quantity1Sum += monethCount.Count();
|
||
Quantity2Sum += AllList.Count();
|
||
Quantity3Sum += yzCount.Count();
|
||
Quantity4Sum += NoBackCount;
|
||
i++;
|
||
}
|
||
gvFileReport.DataSource = list;
|
||
gvFileReport.DataBind();
|
||
|
||
//合计
|
||
JObject summary = new JObject();
|
||
summary.Add("ContentName", "合计");
|
||
summary.Add("MonthsCount", Quantity1Sum.ToString());
|
||
summary.Add("ProjectCount", Quantity2Sum.ToString());
|
||
summary.Add("MonthsBackCount", Quantity3Sum.ToString());
|
||
summary.Add("TotalNoBackCount", Quantity4Sum.ToString());
|
||
|
||
gvFileReport.SummaryData = summary;
|
||
}
|
||
|
||
async Task<DataTable> loadFileReportDt()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
|
||
string strSql = @"select SendUnit, ReceiveDate ,IsReply,RetrunWuhuangCopies from Comprehensive_DataReceivingDoc
|
||
where ProjectId='" + this.CurrUser.LoginProjectId + "' ";
|
||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, null);
|
||
return dt;
|
||
});
|
||
}
|
||
#endregion
|
||
|
||
#region 18.本月质量问题处理情况
|
||
#region gvRowMaterialProblem 事件
|
||
/// <summary>
|
||
/// 增加原材料问题
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnRowMaterialProblem_Click(object sender, EventArgs e)
|
||
{
|
||
gvRowMaterialProblem.Hidden = false;
|
||
|
||
JArray teamGroupData = gvRowMaterialProblem.GetMergedData();
|
||
List<JObject> list = new List<JObject>();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//values.Add("Id", teamGroupRow.Value<string>("id"));
|
||
list.Add(values);
|
||
}
|
||
JObject defaultObj = new JObject
|
||
{ { "RowMaterialProblemId",Guid.NewGuid().ToString() },
|
||
{ "ReportId", ReportId },
|
||
{ "UnitId", "" },
|
||
{ "ProblemDesrioption",""},
|
||
{ "TreatmentMeasures", "" },
|
||
{ "ProcessingResults","" },
|
||
{ "Remark", "" },
|
||
{ "delRowMaterialProblem", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", GetDeleteRowMaterialProblem(), IconHelper.GetResolvedIconUrl(Icon.Delete)) }
|
||
};
|
||
list.Add(defaultObj);
|
||
gvRowMaterialProblem.DataSource = list;
|
||
gvRowMaterialProblem.DataBind();
|
||
|
||
//SaveMethod();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定数据前事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void gvRowMaterialProblem_PreDataBound(object sender, EventArgs e)
|
||
{
|
||
// 设置LinkButtonField的点击客户端事件
|
||
LinkButtonField deleteField = gvRowMaterialProblem.FindColumn("delRowMaterialProblem") as LinkButtonField;
|
||
deleteField.OnClientClick = GetDeleteRowMaterialProblem();
|
||
}
|
||
/// <summary>
|
||
/// 删除提示
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private string GetDeleteRowMaterialProblem()
|
||
{
|
||
return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, gvRowMaterialProblem.GetDeleteSelectedRowsReference(), String.Empty);
|
||
}
|
||
#endregion
|
||
|
||
#region gvConstructionProblems 事件
|
||
/// <summary>
|
||
/// 增加施工过程问题
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAddConstructionProblems_Click(object sender, EventArgs e)
|
||
{
|
||
gvConstructionProblems.Hidden = false;
|
||
|
||
JArray teamGroupData = gvConstructionProblems.GetMergedData();
|
||
List<JObject> list = new List<JObject>();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//values.Add("Id", teamGroupRow.Value<string>("id"));
|
||
list.Add(values);
|
||
}
|
||
JObject defaultObj = new JObject
|
||
{ { "ConstructionProblemsId",Guid.NewGuid() },
|
||
{ "ReportId", ReportId },
|
||
{ "UnitId", "" },
|
||
{ "ProblemDesrioption",""},
|
||
{ "TreatmentMeasures", "" },
|
||
{ "ProcessingResults","" },
|
||
{ "Remark", "" },
|
||
{ "delConstructionProblems", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", GetDeleteConstructionProblems(), IconHelper.GetResolvedIconUrl(Icon.Delete)) }
|
||
};
|
||
list.Add(defaultObj);
|
||
gvConstructionProblems.DataSource = list;
|
||
gvConstructionProblems.DataBind();
|
||
|
||
//SaveMethod();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定数据前事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void gvConstructionProblems_PreDataBound(object sender, EventArgs e)
|
||
{
|
||
// 设置LinkButtonField的点击客户端事件
|
||
LinkButtonField deleteField = gvConstructionProblems.FindColumn("delConstructionProblems") as LinkButtonField;
|
||
deleteField.OnClientClick = GetDeleteConstructionProblems();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除提示
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private string GetDeleteConstructionProblems()
|
||
{
|
||
return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, gvConstructionProblems.GetDeleteSelectedRowsReference(), String.Empty);
|
||
}
|
||
#endregion
|
||
#endregion
|
||
|
||
#region 19.下月质量控制重点
|
||
/// <summary>
|
||
/// gvNextQualityControl加载前事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void gvNextQualityControl_PreDataBound(object sender, EventArgs e)
|
||
{
|
||
// 设置LinkButtonField的点击客户端事件
|
||
LinkButtonField deleteField = gvNextQualityControl.FindColumn("delNextQualityControl") as LinkButtonField;
|
||
deleteField.OnClientClick = GetDeleteNextQualityControl();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 增加
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAddNextControl_Click(object sender, EventArgs e)
|
||
{
|
||
gvNextQualityControl.Hidden = false;
|
||
|
||
JArray teamGroupData = gvNextQualityControl.GetMergedData();
|
||
List<JObject> list = new List<JObject>();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//values.Add("Id", teamGroupRow.Value<string>("id"));
|
||
list.Add(values);
|
||
}
|
||
JObject defaultObj = new JObject
|
||
{ { "NextQualityControlId",Guid.NewGuid().ToString() },
|
||
{ "ReportId", ReportId },
|
||
{ "NextQualityControlContent", "" },
|
||
{ "delNextQualityControl", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", GetDeleteNextQualityControl(), IconHelper.GetResolvedIconUrl(Icon.Delete)) }
|
||
};
|
||
list.Add(defaultObj);
|
||
gvNextQualityControl.DataSource = list;
|
||
gvNextQualityControl.DataBind();
|
||
|
||
//SaveMethod();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除提示
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private string GetDeleteNextQualityControl()
|
||
{
|
||
return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, gvNextQualityControl.GetDeleteSelectedRowsReference(), String.Empty);
|
||
}
|
||
#endregion
|
||
|
||
#region 23.施工照片
|
||
protected void filePhoto_FileSelected(object sender, EventArgs e)
|
||
{
|
||
string fileUrl = "~/upload/MonthReport/";
|
||
if (filePhoto.HasFile)
|
||
{
|
||
string fileName = filePhoto.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto.SaveAs(Server.MapPath(fileUrl + fileName));
|
||
|
||
imgPhoto.ImageUrl = fileUrl + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto.Reset();
|
||
}
|
||
|
||
if (filePhoto2.HasFile)
|
||
{
|
||
string fileName = filePhoto2.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto2.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto2.SaveAs(Server.MapPath(fileUrl + fileName));
|
||
|
||
imgPhoto2.ImageUrl = fileUrl + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto2.Reset();
|
||
}
|
||
|
||
if (filePhoto3.HasFile)
|
||
{
|
||
string fileName = filePhoto3.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto3.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto3.SaveAs(Server.MapPath(fileUrl + fileName));
|
||
|
||
imgPhoto3.ImageUrl = fileUrl + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto3.Reset();
|
||
}
|
||
|
||
if (filePhoto4.HasFile)
|
||
{
|
||
string fileName = filePhoto4.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto4.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto4.SaveAs(Server.MapPath(fileUrl + fileName));
|
||
|
||
imgPhoto4.ImageUrl = fileUrl + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto4.Reset();
|
||
}
|
||
|
||
if (filePhoto5.HasFile)
|
||
{
|
||
string fileName = filePhoto5.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto5.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto5.SaveAs(Server.MapPath(fileUrl + fileName));
|
||
|
||
imgPhoto5.ImageUrl = fileUrl + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto5.Reset();
|
||
}
|
||
|
||
if (filePhoto6.HasFile)
|
||
{
|
||
string fileName = filePhoto6.ShortFileName;
|
||
if (!ValidateFileType(fileName))
|
||
{
|
||
// 清空文件上传控件
|
||
filePhoto6.Reset();
|
||
ShowNotify("无效的文件类型!");
|
||
return;
|
||
}
|
||
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
|
||
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
|
||
|
||
filePhoto6.SaveAs(Server.MapPath(fileUrl + fileName));
|
||
|
||
imgPhoto6.ImageUrl = fileUrl + fileName;
|
||
|
||
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
|
||
filePhoto6.Reset();
|
||
}
|
||
|
||
//SaveMethod();
|
||
}
|
||
#endregion
|
||
|
||
#region 保存
|
||
/// <summary>
|
||
/// 保存按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(this.txtPeriod.Text.Trim()))
|
||
{
|
||
ShowNotify("周期不能为空!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.txtAre0.Text.Length > 2000)
|
||
{
|
||
ShowNotify("设计质量情况字符长度不能大于2000!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.txtAre1.Text.Length > 2000)
|
||
{
|
||
ShowNotify("采购质量情况字符长度不能大于2000!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.txtAre2.Text.Length > 2000)
|
||
{
|
||
ShowNotify("施工质量情况字符长度不能大于2000!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.txtAre20.Text.Length > 2000)
|
||
{
|
||
ShowNotify("项目质量体系审核字符长度不能大于2000!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.txtAre21.Text.Length > 2000)
|
||
{
|
||
ShowNotify("类似项目管理经验教训应对措施及跟踪字符长度不能大于2000!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (this.txtAre22.Text.Length > 2000)
|
||
{
|
||
ShowNotify("附件字符长度不能大于2000!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
SaveMethod();
|
||
|
||
//ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||
//PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||
|
||
//Model.Report_WeekAndMonthReport_New weekAndMonthReport = WeekAndMonthReportNewService.Detail(this.ReportId);
|
||
//if (weekAndMonthReport != null)
|
||
//{
|
||
// if (weekAndMonthReport.SortId != null)
|
||
// {
|
||
// this.txtPeriod.Text = Convert.ToString(weekAndMonthReport.SortId);
|
||
// }
|
||
// if (weekAndMonthReport.StartDate != null)
|
||
// {
|
||
// this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.StartDate);
|
||
// }
|
||
// if (weekAndMonthReport.EndDate != null)
|
||
// {
|
||
// this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.EndDate);
|
||
// }
|
||
//}
|
||
//AddOrUpdate = "update";
|
||
|
||
//#region 加载本月质量目标管理情况
|
||
//detailsGrid1.Clear();
|
||
//detailsGrid1 = (from x in db.Report_CqmsTarget
|
||
// where x.ReportId == this.ReportId
|
||
// orderby x.SortId
|
||
// select x).ToList();
|
||
//if (detailsGrid1.Count > 0)
|
||
//{
|
||
// Grid1.Hidden = false;
|
||
// Grid1.DataSource = detailsGrid1;
|
||
// Grid1.DataBind();
|
||
//}
|
||
|
||
//#endregion
|
||
|
||
//#region 加载7.2 PQR/WPS报验情况
|
||
//var detailsGrid9 = (from x in db.Report_Construction_Plan
|
||
// where x.ReportId == ReportId && x.ReType == "5"
|
||
// select x).ToList();
|
||
//if (detailsGrid9.Count > 0)
|
||
//{
|
||
// Grid9.Hidden = false;
|
||
// Grid9.DataSource = detailsGrid9;
|
||
// Grid9.DataBind();
|
||
//}
|
||
//if (!string.IsNullOrEmpty(Request.Params["view"]))
|
||
//{
|
||
// //查看页面
|
||
// Button4.Hidden = true;
|
||
// Button3.Hidden = true;
|
||
// //合计
|
||
// OutPutSummaryGrid9();
|
||
// Grid1.FindColumn("Delete1").Hidden = true;
|
||
// Grid9.FindColumn("Delete9").Hidden = true;
|
||
//}
|
||
//#endregion
|
||
|
||
//#region 加载18.本月质量问题处理情况
|
||
////(1)原材料问题
|
||
//rowMaterialProblemLists.Clear();
|
||
//rowMaterialProblemLists = (from x in db.Report_RowMaterialProblem
|
||
// where x.ReportId == this.ReportId
|
||
// select x).ToList();
|
||
//if (rowMaterialProblemLists.Count > 0)
|
||
//{
|
||
// gvRowMaterialProblem.Hidden = false;
|
||
// gvRowMaterialProblem.DataSource = rowMaterialProblemLists;
|
||
// gvRowMaterialProblem.DataBind();
|
||
//}
|
||
////(2)施工过程问题
|
||
//constructionProblemsLists.Clear();
|
||
//constructionProblemsLists = (from x in db.Report_ConstructionProblems
|
||
// where x.ReportId == this.ReportId
|
||
// select x).ToList();
|
||
//if (constructionProblemsLists.Count > 0)
|
||
//{
|
||
// gvConstructionProblems.Hidden = false;
|
||
// gvConstructionProblems.DataSource = constructionProblemsLists;
|
||
// gvConstructionProblems.DataBind();
|
||
//}
|
||
//#endregion
|
||
|
||
//#region 加载19.下月质量控制重点
|
||
//nextQualityControlLists.Clear();
|
||
//nextQualityControlLists = (from x in db.Report_NextQualityControl
|
||
// where x.ReportId == this.ReportId
|
||
// select x).ToList();
|
||
//if (nextQualityControlLists.Count > 0)
|
||
//{
|
||
// gvNextQualityControl.Hidden = false;
|
||
// gvNextQualityControl.DataSource = nextQualityControlLists;
|
||
// gvNextQualityControl.DataBind();
|
||
//}
|
||
//#endregion
|
||
|
||
//#region 加载文本框内容
|
||
//var txtReportList = db.Report_TextBoxContent.Where(x => x.ReportId == ReportId).ToList();
|
||
//if (txtReportList.Count > 0)
|
||
//{
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "0") != null)
|
||
// {
|
||
// txtAre0.Text = txtReportList.FirstOrDefault(x => x.ContentType == "0").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "1") != null)
|
||
// {
|
||
// txtAre1.Text = txtReportList.FirstOrDefault(x => x.ContentType == "1").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "2") != null)
|
||
// {
|
||
// txtAre2.Text = txtReportList.FirstOrDefault(x => x.ContentType == "2").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "20") != null)
|
||
// {
|
||
// txtAre20.Text = txtReportList.FirstOrDefault(x => x.ContentType == "20").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "21") != null)
|
||
// {
|
||
// txtAre21.Text = txtReportList.FirstOrDefault(x => x.ContentType == "21").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "22") != null)
|
||
// {
|
||
// txtAre22.Text = txtReportList.FirstOrDefault(x => x.ContentType == "22").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "8") != null)
|
||
// {
|
||
// txtAre8.Text = txtReportList.FirstOrDefault(x => x.ContentType == "8").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "23-1") != null)
|
||
// {
|
||
// imgPhoto.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ImageUrl;
|
||
// txtPhotoContent1.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "23-2") != null)
|
||
// {
|
||
// imgPhoto2.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ImageUrl;
|
||
// txtPhotoContent2.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "23-3") != null)
|
||
// {
|
||
// imgPhoto3.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ImageUrl;
|
||
// txtPhotoContent3.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "23-4") != null)
|
||
// {
|
||
// imgPhoto4.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ImageUrl;
|
||
// txtPhotoContent4.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "23-5") != null)
|
||
// {
|
||
// imgPhoto5.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ImageUrl;
|
||
// txtPhotoContent5.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ContentText;
|
||
// }
|
||
// if (txtReportList.FirstOrDefault(x => x.ContentType == "23-6") != null)
|
||
// {
|
||
// imgPhoto6.ImageUrl = "~/" + txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ImageUrl;
|
||
// txtPhotoContent6.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ContentText;
|
||
// }
|
||
//}
|
||
//#endregion
|
||
|
||
////加载所有grid
|
||
//lodAllGrid("1");
|
||
}
|
||
|
||
private void SaveMethod()
|
||
{
|
||
Model.Report_WeekAndMonthReport_New report = new Model.Report_WeekAndMonthReport_New();
|
||
report.Id = ReportId;
|
||
report.ProjectId = this.CurrUser.LoginProjectId;
|
||
report.ReportType = "1";//1.月报,2-周报
|
||
if (!string.IsNullOrEmpty(this.txtPeriod.Text.Trim()))
|
||
{
|
||
try
|
||
{
|
||
report.SortId = this.txtPeriod.Text.Trim();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
ScriptManager.RegisterStartupScript(this, typeof(string), "_alert", "alert('周期输入格式不正确,请重新输入!')", true);
|
||
return;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtStartDate.Text))
|
||
{
|
||
report.StartDate = Convert.ToDateTime(this.txtStartDate.Text);
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtEndDate.Text))
|
||
{
|
||
report.EndDate = Convert.ToDateTime(this.txtEndDate.Text);
|
||
}
|
||
report.CreateDate = DateTime.Now;
|
||
report.CreateMan = CurrUser.UserId;
|
||
bool save = false;
|
||
if (AddOrUpdate == "add")
|
||
{
|
||
save = true;
|
||
WeekAndMonthReportNewService.Insert(report);
|
||
}
|
||
else
|
||
{
|
||
save = true;
|
||
WeekAndMonthReportNewService.Update(report);
|
||
}
|
||
#region 删除所有子表
|
||
//本月质量目标管理情况
|
||
//CqmsTargetService.Delete(ReportId);
|
||
|
||
//所有文本框表
|
||
//TextBoxContentService.Delete(ReportId);
|
||
|
||
//删除施工方案及检验试验计划审批情况
|
||
//BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId);
|
||
|
||
// 15.质量巡检情况 16.质量专项检查情况 17.质量文件上报情况
|
||
//BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId);
|
||
//18.本月质量问题处理情况(1)原材料问题
|
||
//BLL.RowMaterialProblemService.DeleteRowMaterialProbleByReportId(ReportId);
|
||
//18.本月质量问题处理情况(2)施工过程问题
|
||
//BLL.ConstructionProblemsService.DeleteConstructionProblemsByReportId(ReportId);
|
||
//19.下月质量控制重点
|
||
//BLL.NextQualityControlService.DeleteNextQualityControlByReportId(ReportId);
|
||
|
||
#endregion
|
||
|
||
#region 保存所有子表
|
||
|
||
|
||
|
||
|
||
//保存本月质量目标管理情况
|
||
saveTarget();
|
||
|
||
//保存文本框
|
||
saveTxtContent();
|
||
|
||
|
||
//保存3.1一般施工方案审批情况
|
||
saveYbsgfa();
|
||
|
||
//保存3.2危大工程方案审批情况
|
||
saveWdgcfa();
|
||
|
||
//保存3.2质量控制点或检验试验计划(ITP)情况
|
||
saveJysyjh();
|
||
|
||
//保存4 设计交底管理情况
|
||
saveSjjd();
|
||
|
||
//保存4图纸会审管理情况
|
||
saveTzhs();
|
||
|
||
//保存7.2PQR/WPS报验情况
|
||
savePqrWps();
|
||
|
||
//保存8 设备材料报验管理情况
|
||
saveSbclBy();
|
||
|
||
//保存9.计量器具报验管理情况
|
||
saveMeasuringInspection();
|
||
//保存10.现场质量共检数据
|
||
saveTjInspection();
|
||
saveSbInspection();
|
||
saveGDInspection();
|
||
saveDQInspection();
|
||
saveYBInspection();
|
||
saveFFInspection();
|
||
saveXFInspection();
|
||
saveInspectionDataInspection();
|
||
//保存11.压力管道监检情况
|
||
savePressureInspection();
|
||
//保存12.管道试压包管理情况
|
||
savePipingInspection();
|
||
//保存13.特种设备监检情况
|
||
saveSpecialInspection();
|
||
//保存14.NCR管理情况
|
||
saveNcrManagementInspection();
|
||
|
||
//保存15.质量巡检情况
|
||
saveQualityInspection();
|
||
//保存16.质量专项检查情况
|
||
saveSpecialCheck();
|
||
//保存17.质量文件上报情况
|
||
saveFileReport();
|
||
//保存18.(1)原材料问题
|
||
saveRowMaterialProblem();
|
||
//保存18.(2)施工过程问题
|
||
saveConstructionProblems();
|
||
//保存19.下月质量控制重点
|
||
saveNextQualityControl();
|
||
|
||
////保存23.施工照片
|
||
//saveImages();
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
|
||
if (save)
|
||
{
|
||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
|
||
#region 保存本月质量目标管理情况
|
||
void saveTarget()
|
||
{
|
||
List<Model.Report_CqmsTarget> detailLists = new List<Model.Report_CqmsTarget>();
|
||
JArray teamGroupData = Grid1.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CqmsTarget newDetail = new Model.Report_CqmsTarget
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ProStage = values.Value<string>("ProStage"),
|
||
ProDescribe = values.Value<string>("ProDescribe"),
|
||
TargetValue = values.Value<string>("TargetValue"),
|
||
MonthPer = values.Value<string>("MonthPer"),
|
||
Remarks = values.Value<string>("Remarks"),
|
||
SortId = rowIndex + 1
|
||
};
|
||
//if (Grid1.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid1.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
try
|
||
{
|
||
var result = db.Report_CqmsTarget.Where(a => a.ReportId == ReportId);
|
||
db.Report_CqmsTarget.DeleteAllOnSubmit(result);
|
||
if (detailLists.Count > 0)
|
||
{
|
||
//CqmsTargetService.Delete(ReportId);//本月质量目标管理情况
|
||
db.Report_CqmsTarget.InsertAllOnSubmit(detailLists);
|
||
}
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 保存PQR/WPS报验情况
|
||
void savePqrWps()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid9.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "5",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
Quantity3 = Funs.GetNewIntOrZero(values.Value<string>("Quantity3")),
|
||
Quantity4 = Funs.GetNewIntOrZero(values.Value<string>("Quantity4")),
|
||
Remarks = values.Value<string>("Remarks"),
|
||
};
|
||
//if (Grid9.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid9.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "5");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 保存施工方案及检验试验计划审批情况
|
||
/// <summary>
|
||
/// 3.1保存一般施工方案审批情况
|
||
/// </summary>
|
||
void saveYbsgfa()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid2.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "0",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (Grid2.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid2.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "0");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 3.2保存危大工程方案审批情况
|
||
/// </summary>
|
||
void saveWdgcfa()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid3.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "1",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
Quantity3 = Funs.GetNewIntOrZero(values.Value<string>("Quantity3")),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (Grid3.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid3.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "1");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 3.3 质量控制点或检验试验计划(ITP)情况
|
||
/// </summary>
|
||
void saveJysyjh()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid4.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "2",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (Grid4.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid4.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "2");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 保存4.设计交底管理情况
|
||
/// <summary>
|
||
/// 保存设计交底管理情况
|
||
/// </summary>
|
||
void saveSjjd()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid5.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "3",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (Grid5.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid5.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "3");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 保存图纸会审
|
||
/// <summary>
|
||
/// 保存图纸会审
|
||
/// </summary>
|
||
void saveTzhs()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid6.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "4",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (Grid6.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid6.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "4");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 保存设备材料报验管理情况
|
||
/// <summary>
|
||
/// 保存设备材料报验管理情况
|
||
/// </summary>
|
||
void saveSbclBy()
|
||
{
|
||
List<Model.Report_Construction_Plan> detailLists = new List<Model.Report_Construction_Plan>();
|
||
JArray teamGroupData = Grid11.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "6",
|
||
UnitOrMajor = values.Value<string>("UnitOrMajor"),
|
||
Quantity1 = Funs.GetNewIntOrZero(values.Value<string>("Quantity1")),
|
||
Quantity2 = Funs.GetNewIntOrZero(values.Value<string>("Quantity2")),
|
||
QuaRate = values.Value<string>("QuaRate"),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (Grid11.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = Grid11.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId, "6");
|
||
db.Report_Construction_Plan.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 保存文本框内容
|
||
/// <summary>
|
||
/// 保存文本框内容
|
||
/// </summary>
|
||
void saveTxtContent()
|
||
{
|
||
var txtContentList = new List<Model.Report_TextBoxContent>();
|
||
#region 给实体赋值
|
||
var model0 = new Model.Report_TextBoxContent();
|
||
model0.Id = SQLHelper.GetNewID();
|
||
model0.ReportId = ReportId;
|
||
model0.ContentType = "0";
|
||
model0.ContentText = txtAre0.Text;
|
||
txtContentList.Add(model0);
|
||
|
||
var model1 = new Model.Report_TextBoxContent();
|
||
model1.Id = SQLHelper.GetNewID();
|
||
model1.ReportId = ReportId;
|
||
model1.ContentType = "1";
|
||
model1.ContentText = txtAre1.Text;
|
||
txtContentList.Add(model1);
|
||
|
||
var model2 = new Model.Report_TextBoxContent();
|
||
model2.Id = SQLHelper.GetNewID();
|
||
model2.ReportId = ReportId;
|
||
model2.ContentType = "2";
|
||
model2.ContentText = txtAre2.Text;
|
||
txtContentList.Add(model2);
|
||
|
||
var model20 = new Model.Report_TextBoxContent();
|
||
model20.Id = SQLHelper.GetNewID();
|
||
model20.ReportId = ReportId;
|
||
model20.ContentType = "20";
|
||
model20.ContentText = txtAre20.Text;
|
||
txtContentList.Add(model20);
|
||
|
||
var model21 = new Model.Report_TextBoxContent();
|
||
model21.Id = SQLHelper.GetNewID();
|
||
model21.ReportId = ReportId;
|
||
model21.ContentType = "21";
|
||
model21.ContentText = txtAre21.Text;
|
||
txtContentList.Add(model21);
|
||
|
||
var model22 = new Model.Report_TextBoxContent();
|
||
model22.Id = SQLHelper.GetNewID();
|
||
model22.ReportId = ReportId;
|
||
model22.ContentType = "22";
|
||
model22.ContentText = txtAre22.Text;
|
||
txtContentList.Add(model22);
|
||
|
||
//如果8设备材料报验管理情况点击了增加按钮,则添加文本框内容
|
||
var model8 = new Model.Report_TextBoxContent();
|
||
model8.Id = SQLHelper.GetNewID();
|
||
model8.ReportId = ReportId;
|
||
model8.ContentType = "8";
|
||
model8.ContentText = txtAre8.Text;
|
||
txtContentList.Add(model8);
|
||
#endregion
|
||
try
|
||
{
|
||
var result = db.Report_TextBoxContent.Where(a => a.ReportId == ReportId).ToList();
|
||
db.Report_TextBoxContent.DeleteAllOnSubmit(result);
|
||
//TextBoxContentService.Delete(ReportId);
|
||
db.Report_TextBoxContent.InsertAllOnSubmit(txtContentList);
|
||
db.SubmitChanges();
|
||
|
||
//保存23.施工照片
|
||
saveImages();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 9.计量器具报验管理情况
|
||
void saveMeasuringInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvMeasuringInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "9",
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
//RectificationRate = values.Value<string>("RectificationRate"),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (gvMeasuringInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvMeasuringInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "9");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 10.现场质量共检数据
|
||
void saveTjInspection() //检验批统计:土建
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvTj.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-1",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (gvTj.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvTj.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-1");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
void saveSbInspection() //检验批统计:设备
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = GvSb.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-2",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (GvSb.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = GvSb.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-2");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
void saveGDInspection() //检验批统计:管道
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = GvGD.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-3",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (GvGD.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = GvGD.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-3");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
void saveDQInspection() //检验批统计:电气
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = GvDq.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-4",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (GvDq.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = GvDq.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-4");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
void saveYBInspection() //检验批统计:仪表
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = GvYb.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-5",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (GvYb.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = GvYb.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-5");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
void saveFFInspection() //检验批统计:防腐
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = GvFf.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-6",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (GvFf.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = GvFf.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-6");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
void saveXFInspection() //检验批统计:消防
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = GvXf.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10-7",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
Remarks = values.Value<string>("TotalOneOKRate"),//本月累计合格点数
|
||
};
|
||
//if (GvXf.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = GvXf.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10-7");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
void saveInspectionDataInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvInspectionDataInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "10",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")), //当前检查点数
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalCheckNum")),//累计点数
|
||
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),//当前合格点数
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalOKNum")),//累计合格点数
|
||
|
||
RectificationRate = values.Value<string>("OneOKRate"),//本月合格点数
|
||
TotationRate = values.Value<string>("TotalOneOKRate"),
|
||
Remarks = values.Value<string>("Remarks"),//本月累计合格点数
|
||
|
||
};
|
||
////if (gvInspectionDataInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
////{
|
||
//// newDetail.Id = gvInspectionDataInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
////}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "10");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 11.压力管道监检情况
|
||
void savePressureInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvPressureInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "11",
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalNoBackCount")),
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
//RectificationRate = values.Value<string>("RectificationRate"),
|
||
Remarks = values.Value<string>("Remarks"),
|
||
};
|
||
//if (gvPressureInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvPressureInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "11");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 12.管道试压包管理情况
|
||
void savePipingInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvPipingInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "12",
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalNoBackCount")),
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
//RectificationRate = values.Value<string>("RectificationRate"),
|
||
Remarks = values.Value<string>("Remarks"),
|
||
};
|
||
//if (gvPipingInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvPipingInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "12");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 13.特种设备监检情况
|
||
void saveSpecialInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvSpecialInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "13",
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalNoBackCount")),
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
//RectificationRate = values.Value<string>("RectificationRate"),
|
||
Remarks = values.Value<string>("Remarks"),
|
||
};
|
||
//if (gvSpecialInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvSpecialInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "13");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 14.NCR管理情况
|
||
void saveNcrManagementInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvNcrManagementInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "14",
|
||
ContentName = values.Value<string>("WorkName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("CurrentPeriodOkNum")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("OKNum")),
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("CheckNum")),
|
||
RectificationRate = values.Value<string>("OKRate"),
|
||
};
|
||
//if (gvNcrManagementInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvNcrManagementInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "14");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 15.质量巡检情况
|
||
/// <summary>
|
||
/// 15.质量巡检情况
|
||
/// </summary>
|
||
void saveQualityInspection()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvQualityInspection.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "1",
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
RectificationRate = values.Value<string>("RectificationRate"),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (gvQualityInspection.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvQualityInspection.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "1");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 16.质量专项检查情况
|
||
/// <summary>
|
||
/// 16.质量专项检查情况
|
||
/// </summary>
|
||
void saveSpecialCheck()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvSpecialCheck.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "2",
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
Remarks = values.Value<string>("Remarks")
|
||
};
|
||
//if (gvSpecialCheck.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvSpecialCheck.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "2");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 17.质量文件上报情况
|
||
/// <summary>
|
||
/// 17.质量文件上报情况
|
||
/// </summary>
|
||
void saveFileReport()
|
||
{
|
||
List<Model.Report_CQMS_MonthReportItem> detailLists = new List<Model.Report_CQMS_MonthReportItem>();
|
||
JArray teamGroupData = gvFileReport.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_CQMS_MonthReportItem newDetail = new Model.Report_CQMS_MonthReportItem
|
||
{
|
||
//Id = values.Value<string>("Id"),
|
||
Id = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
ReType = "3",
|
||
ContentName = values.Value<string>("ContentName"),
|
||
MonthsCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsCount")),
|
||
ProjectCount = Funs.GetNewIntOrZero(values.Value<string>("ProjectCount")),
|
||
MonthsBackCount = Funs.GetNewIntOrZero(values.Value<string>("MonthsBackCount")),
|
||
TotalNoBackCount = Funs.GetNewIntOrZero(values.Value<string>("TotalNoBackCount"))
|
||
};
|
||
//if (gvFileReport.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.Id = gvFileReport.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.Report_CQMS_MonthReportItemService.DeleteReportItemByReportId(ReportId, "3");
|
||
db.Report_CQMS_MonthReportItem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 18.本月质量问题处理情况
|
||
/// <summary>
|
||
/// (1)原材料问题
|
||
/// </summary>
|
||
void saveRowMaterialProblem()
|
||
{
|
||
List<Model.Report_RowMaterialProblem> detailLists = new List<Model.Report_RowMaterialProblem>();
|
||
JArray teamGroupData = gvRowMaterialProblem.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_RowMaterialProblem newDetail = new Model.Report_RowMaterialProblem
|
||
{
|
||
//RowMaterialProblemId = values.Value<string>("RowMaterialProblemId"),
|
||
RowMaterialProblemId = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
UnitId = values.Value<string>("UnitId"),
|
||
ProblemDesrioption = values.Value<string>("ProblemDesrioption"),
|
||
TreatmentMeasures = values.Value<string>("TreatmentMeasures"),
|
||
ProcessingResults = values.Value<string>("ProcessingResults"),
|
||
Remark = values.Value<string>("Remark")
|
||
};
|
||
//if (gvRowMaterialProblem.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.RowMaterialProblemId = gvRowMaterialProblem.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.RowMaterialProblemService.DeleteRowMaterialProbleByReportId(ReportId);
|
||
db.Report_RowMaterialProblem.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// (2)施工过程问题
|
||
/// </summary>
|
||
void saveConstructionProblems()
|
||
{
|
||
List<Model.Report_ConstructionProblems> detailLists = new List<Model.Report_ConstructionProblems>();
|
||
JArray teamGroupData = gvConstructionProblems.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_ConstructionProblems newDetail = new Model.Report_ConstructionProblems
|
||
{
|
||
//ConstructionProblemsId = values.Value<string>("ConstructionProblemsId"),
|
||
ConstructionProblemsId = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
UnitId = values.Value<string>("UnitId"),
|
||
ProblemDesrioption = values.Value<string>("ProblemDesrioption"),
|
||
TreatmentMeasures = values.Value<string>("TreatmentMeasures"),
|
||
ProcessingResults = values.Value<string>("ProcessingResults"),
|
||
Remark = values.Value<string>("Remark")
|
||
};
|
||
//if (gvConstructionProblems.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.ConstructionProblemsId = gvConstructionProblems.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.ConstructionProblemsService.DeleteConstructionProblemsByReportId(ReportId);
|
||
db.Report_ConstructionProblems.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 19.下月质量控制重点
|
||
/// <summary>
|
||
/// 下月质量控制重点
|
||
/// </summary>
|
||
void saveNextQualityControl()
|
||
{
|
||
List<Model.Report_NextQualityControl> detailLists = new List<Model.Report_NextQualityControl>();
|
||
JArray teamGroupData = gvNextQualityControl.GetMergedData();
|
||
foreach (JObject teamGroupRow in teamGroupData)
|
||
{
|
||
JObject values = teamGroupRow.Value<JObject>("values");
|
||
//int rowIndex = teamGroupRow.Value<int>("index");
|
||
Model.Report_NextQualityControl newDetail = new Model.Report_NextQualityControl
|
||
{
|
||
//NextQualityControlId = values.Value<string>("NextQualityControlId"),
|
||
NextQualityControlId = SQLHelper.GetNewID(),
|
||
ReportId = ReportId,
|
||
NextQualityControlContent = values.Value<string>("NextQualityControlContent")
|
||
};
|
||
//if (gvNextQualityControl.Rows[rowIndex].DataKeys.Length > 0)
|
||
//{
|
||
// newDetail.NextQualityControlId = gvNextQualityControl.Rows[rowIndex].DataKeys[0].ToString();
|
||
//}
|
||
detailLists.Add(newDetail);
|
||
}
|
||
if (detailLists.Count > 0)
|
||
{
|
||
try
|
||
{
|
||
BLL.NextQualityControlService.DeleteNextQualityControlByReportId(ReportId);
|
||
db.Report_NextQualityControl.InsertAllOnSubmit(detailLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 23.施工照片
|
||
void saveImages()
|
||
{
|
||
var ImageLists = new List<Model.Report_TextBoxContent>();
|
||
var imgage1 = new Model.Report_TextBoxContent();
|
||
imgage1.Id = SQLHelper.GetNewID();
|
||
imgage1.ReportId = ReportId;
|
||
imgage1.ContentType = "23-1";
|
||
imgage1.ContentText = txtPhotoContent1.Text;
|
||
imgage1.ImageUrl = imgPhoto.ImageUrl.Substring(imgPhoto.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage1);
|
||
|
||
var imgage2 = new Model.Report_TextBoxContent();
|
||
imgage2.Id = SQLHelper.GetNewID();
|
||
imgage2.ReportId = ReportId;
|
||
imgage2.ContentType = "23-2";
|
||
imgage2.ContentText = txtPhotoContent2.Text;
|
||
imgage2.ImageUrl = imgPhoto2.ImageUrl.Substring(imgPhoto2.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage2);
|
||
|
||
var imgage3 = new Model.Report_TextBoxContent();
|
||
imgage3.Id = SQLHelper.GetNewID();
|
||
imgage3.ReportId = ReportId;
|
||
imgage3.ContentType = "23-3";
|
||
imgage3.ContentText = txtPhotoContent3.Text;
|
||
imgage3.ImageUrl = imgPhoto3.ImageUrl.Substring(imgPhoto3.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage3);
|
||
|
||
var imgage4 = new Model.Report_TextBoxContent();
|
||
imgage4.Id = SQLHelper.GetNewID();
|
||
imgage4.ReportId = ReportId;
|
||
imgage4.ContentType = "23-4";
|
||
imgage4.ContentText = txtPhotoContent4.Text;
|
||
imgage4.ImageUrl = imgPhoto4.ImageUrl.Substring(imgPhoto4.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage4);
|
||
|
||
var imgage5 = new Model.Report_TextBoxContent();
|
||
imgage5.Id = SQLHelper.GetNewID();
|
||
imgage5.ReportId = ReportId;
|
||
imgage5.ContentType = "23-5";
|
||
imgage5.ContentText = txtPhotoContent5.Text;
|
||
imgage5.ImageUrl = imgPhoto5.ImageUrl.Substring(imgPhoto5.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage5);
|
||
|
||
var imgage6 = new Model.Report_TextBoxContent();
|
||
imgage6.Id = SQLHelper.GetNewID();
|
||
imgage6.ReportId = ReportId;
|
||
imgage6.ContentType = "23-6";
|
||
imgage6.ContentText = txtPhotoContent6.Text;
|
||
imgage6.ImageUrl = imgPhoto6.ImageUrl.Substring(imgPhoto6.ImageUrl.IndexOf("/") + 1);
|
||
ImageLists.Add(imgage6);
|
||
|
||
try
|
||
{
|
||
db.Report_TextBoxContent.InsertAllOnSubmit(ImageLists);
|
||
db.SubmitChanges();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
protected void Text_TextChanged(object sender, EventArgs e)
|
||
{
|
||
//SaveMethod();
|
||
}
|
||
|
||
protected override object LoadPageStateFromPersistenceMedium()
|
||
{
|
||
return Session["_ViewState"];
|
||
}
|
||
|
||
protected override void SavePageStateToPersistenceMedium(object viewState)
|
||
{
|
||
Session["_ViewState"] = viewState;
|
||
}
|
||
|
||
protected void btnClose_Click(object sender, EventArgs e)
|
||
{
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||
}
|
||
}
|
||
} |