784 lines
35 KiB
C#
784 lines
35 KiB
C#
using Aspose.Words;
|
|
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.JGZL
|
|
{
|
|
public partial class InsulationAcceptanceRecord : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string InsulationAcceptanceRecordId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["InsulationAcceptanceRecordId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["InsulationAcceptanceRecordId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目Id
|
|
/// </summary>
|
|
private string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义集合
|
|
/// </summary>
|
|
private static List<Model.JGZL_InsulationAcceptanceRecordItem> items = new List<Model.JGZL_InsulationAcceptanceRecordItem>();
|
|
#endregion
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
//this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
|
|
this.drpProjectId.DataTextField = "ProjectCode";
|
|
this.drpProjectId.DataValueField = "ProjectId";
|
|
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
this.drpProjectId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpProjectId);
|
|
|
|
this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId;
|
|
this.InitTreeMenu();//加载树
|
|
this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue;
|
|
this.ProjectId = this.tvControlItem.SelectedNodeID;
|
|
DataInfo();
|
|
//this.BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
private void DataInfo()
|
|
{
|
|
items.Clear();
|
|
this.InsulationAcceptanceRecordId = string.Empty;
|
|
this.txtHeatInsulationArea.Text = string.Empty;
|
|
this.txtInsulationStructure.Text = string.Empty;
|
|
//this.txtAcceptanceConclusion.Text = string.Empty;
|
|
if (!string.IsNullOrEmpty(this.ProjectId))
|
|
{
|
|
var report = BLL.InsulationAcceptanceRecordService.GetInsulationAcceptanceRecordByProjectId(this.ProjectId);
|
|
if (report != null)
|
|
{
|
|
this.InsulationAcceptanceRecordId = report.InsulationAcceptanceRecordId;
|
|
this.txtHeatInsulationArea.Text = report.HeatInsulationArea;
|
|
this.txtInsulationStructure.Text = report.InsulationStructure;
|
|
//this.txtAcceptanceConclusion.Text = report.AcceptanceConclusion;
|
|
|
|
items = BLL.InsulationAcceptanceRecordItemService.GetItemsByInsulationAcceptanceRecordId(this.InsulationAcceptanceRecordId);
|
|
this.Grid1.DataSource = items;
|
|
this.Grid1.DataBind();
|
|
}
|
|
else
|
|
{
|
|
InitItemData();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载默认明细
|
|
/// </summary>
|
|
private void InitItemData()
|
|
{
|
|
items.Clear();
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem.CheckCode = "1";
|
|
newItem.CheckItem = "原材料符合设计及有关规范要求,具有出厂质量证明文件及复验报告";
|
|
newItem.CheckResult = "合格";
|
|
items.Add(newItem);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem2 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem2.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem2.CheckCode = "2";
|
|
newItem2.CheckItem = "设备、管道按规定进行了压力试验,防腐涂层完毕";
|
|
newItem2.CheckResult = "合格";
|
|
items.Add(newItem2);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem3 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem3.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem3.CheckCode = "3";
|
|
newItem3.CheckItem = "具有工序交接记录";
|
|
newItem3.CheckResult = "合格";
|
|
items.Add(newItem3);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem4 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem4.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem4.CheckCode = "4";
|
|
newItem4.CheckItem = "管支、托架处的隔热层结构不影响活动面的自由伸缩";
|
|
newItem4.CheckResult = "合格";
|
|
items.Add(newItem4);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem5 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem5.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem5.CheckCode = "5";
|
|
newItem5.CheckItem = "成型制品同层错缝、内外层压缝,伸缩缝留置正确,嵌缝充填或粘贴紧密、厚度偏差符合规范规定";
|
|
newItem5.CheckResult = "合格";
|
|
items.Add(newItem5);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem6 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem6.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem6.CheckCode = "6";
|
|
newItem6.CheckItem = "缠裹材料同层靠紧,内外层缠裹方向相反,接缝错开,厚度偏差符合规范规定";
|
|
newItem6.CheckResult = "合格";
|
|
items.Add(newItem6);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem7 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem7.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem7.CheckCode = "7";
|
|
newItem7.CheckItem = "散状材料和浇注材料,填充密实、均匀,厚度偏差符合规范规定";
|
|
newItem7.CheckResult = "合格";
|
|
items.Add(newItem7);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem8 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem8.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem8.CheckCode = "8";
|
|
newItem8.CheckItem = "粘贴于隔热层上,无脱落和鼓包现象,表面平整,厚度符合规范规定";
|
|
newItem8.CheckResult = "合格";
|
|
items.Add(newItem8);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem9 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem9.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem9.CheckCode = "9";
|
|
newItem9.CheckItem = "金属保护层应压边,搭接缝、表面平整度符合规范规定,无脱壳和凹凸不平";
|
|
newItem9.CheckResult = "合格";
|
|
items.Add(newItem9);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem10 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem10.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem10.CheckCode = "10";
|
|
newItem10.CheckItem = "卷材保护层应紧贴表面,无褶皱和开裂";
|
|
newItem10.CheckResult = "合格";
|
|
items.Add(newItem10);
|
|
|
|
Model.JGZL_InsulationAcceptanceRecordItem newItem11 = new Model.JGZL_InsulationAcceptanceRecordItem();
|
|
newItem11.InsulationAcceptanceRecordItemId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecordItem));
|
|
newItem11.CheckCode = "11";
|
|
newItem11.CheckItem = "抹面保护层应平整、光滑,端部棱角整齐,无显著裂纹,表面平整度符合规范规定";
|
|
newItem11.CheckResult = "合格";
|
|
items.Add(newItem11);
|
|
|
|
this.Grid1.DataSource = items;
|
|
this.Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 加载树项目
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "项目";
|
|
rootNode.ToolTip = "项目";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
|
|
{
|
|
projects = projects.Where(e => e.ProjectId == this.drpProjectId.SelectedValue).ToList();
|
|
}
|
|
foreach (var item in projects)
|
|
{
|
|
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
|
rootProjectNode.Text = item.ProjectCode;
|
|
rootProjectNode.NodeID = item.ProjectId;
|
|
rootProjectNode.EnableClickEvent = true;
|
|
rootProjectNode.Expanded = true;
|
|
rootProjectNode.ToolTip = item.ProjectName;
|
|
rootProjectNode.CommandName = "项目名称";
|
|
rootNode.Nodes.Add(rootProjectNode);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 点击TreeView
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
if (this.tvControlItem.SelectedNodeID != "0")
|
|
{
|
|
this.ProjectId = this.tvControlItem.SelectedNodeID;
|
|
DataInfo();
|
|
//this.BindGrid();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
//private void BindGrid()
|
|
//{
|
|
// string strSql = @"SELECT * from JGZL_InsulationAcceptanceRecord where 1=1";
|
|
// List<SqlParameter> listStr = new List<SqlParameter>();
|
|
// if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
// {
|
|
// strSql += " AND ProjectId = @ProjectId";
|
|
// listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID));
|
|
// }
|
|
// SqlParameter[] parameter = listStr.ToArray();
|
|
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
// // 2.获取当前分页数据
|
|
// Grid1.RecordCount = tb.Rows.Count;
|
|
// //tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
// var table = this.GetPagedDataTable(Grid1, tb);
|
|
// Grid1.DataSource = table;
|
|
// Grid1.DataBind();
|
|
//}
|
|
#endregion
|
|
|
|
#region 分页排序
|
|
#region 页索引改变事件
|
|
/// <summary>
|
|
/// 页索引改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
//{
|
|
// BindGrid();
|
|
//}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
//{
|
|
// BindGrid();
|
|
//}
|
|
#endregion
|
|
|
|
#region 分页选择下拉改变事件
|
|
/// <summary>
|
|
/// 分页选择下拉改变事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
//{
|
|
// Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
// BindGrid();
|
|
//}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region 查询
|
|
///<summary>
|
|
///查询
|
|
///</summary>
|
|
///<param name="sender"></param>
|
|
///<param name="e"></param>
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.ProjectId = this.drpProjectId.SelectedValue;
|
|
this.InitTreeMenu();
|
|
this.tvControlItem.SelectedNodeID = this.ProjectId;
|
|
DataInfo();
|
|
//BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
//this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 打印
|
|
/// <summary>
|
|
/// 打印
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
string projectId = this.tvControlItem.SelectedNodeID;
|
|
|
|
if (projectId != null)
|
|
{
|
|
//if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
|
|
//{
|
|
string initTemplatePath = "";
|
|
string rootPath = Server.MapPath("~/");
|
|
BLL.Common.FastReportService.ResetData();
|
|
|
|
var report = BLL.InsulationAcceptanceRecordService.GetInsulationAcceptanceRecordById(this.InsulationAcceptanceRecordId);
|
|
if (report != null)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
dt.TableName = "MainData";
|
|
dt.Columns.Add("ProjectName");
|
|
dt.Columns.Add("HeatInsulationArea");
|
|
dt.Columns.Add("InsulationStructure");
|
|
dt.Columns.Add("AcceptanceConclusion");
|
|
dt.Columns.Add("CompileDate");
|
|
|
|
var newRow = dt.NewRow();
|
|
newRow["ProjectName"] = BLL.Base_ProjectService.GetProjectByProjectId(report.ProjectId).ProjectName;
|
|
newRow["HeatInsulationArea"] = report.HeatInsulationArea;
|
|
newRow["InsulationStructure"] = report.InsulationStructure;
|
|
newRow["AcceptanceConclusion"] = report.AcceptanceConclusion;
|
|
string CompileDate = string.Format("{0:yyyy年MM月dd日}", report.CompileDate);
|
|
newRow["CompileDate"] = CompileDate;
|
|
dt.Rows.Add(newRow);
|
|
BLL.Common.FastReportService.AddFastreportTable(dt);
|
|
|
|
var itemList = BLL.InsulationAcceptanceRecordItemService.GetItemsByInsulationAcceptanceRecordId(this.InsulationAcceptanceRecordId);
|
|
if (itemList.Count > 0)
|
|
{
|
|
//DataTable itemdt = new DataTable();
|
|
//itemdt.TableName = "Data";
|
|
//itemdt.Columns.Add("CheckCode");
|
|
//itemdt.Columns.Add("CheckItem");
|
|
//itemdt.Columns.Add("CheckResult");
|
|
|
|
//foreach (var item in itemList)
|
|
//{
|
|
// var newRow2 = itemdt.NewRow();
|
|
// newRow2["CheckCode"] = item.CheckCode;
|
|
// newRow2["CheckItem"] = item.CheckItem;
|
|
// newRow2["CheckResult"] = item.CheckResult;
|
|
// itemdt.Rows.Add(newRow2);
|
|
//}
|
|
//BLL.Common.FastReportService.AddFastreportTable(itemdt);
|
|
|
|
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
|
keyValuePairs.Add("CheckResult1", itemList.Where(x => x.CheckCode == "1").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult2", itemList.Where(x => x.CheckCode == "2").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult3", itemList.Where(x => x.CheckCode == "3").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult4", itemList.Where(x => x.CheckCode == "4").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult5", itemList.Where(x => x.CheckCode == "5").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult6", itemList.Where(x => x.CheckCode == "6").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult7", itemList.Where(x => x.CheckCode == "7").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult8", itemList.Where(x => x.CheckCode == "8").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult9", itemList.Where(x => x.CheckCode == "9").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult10", itemList.Where(x => x.CheckCode == "10").FirstOrDefault().CheckResult);
|
|
keyValuePairs.Add("CheckResult11", itemList.Where(x => x.CheckCode == "11").FirstOrDefault().CheckResult);
|
|
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请先保存数据!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
initTemplatePath = "File\\Fastreport\\JGZL\\隔热工程质量验收记录.frx";
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
{
|
|
PageContext.RegisterStartupScript(WindowPrint.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
}
|
|
//}
|
|
//else
|
|
//{
|
|
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
|
// return;
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 维护
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void btnAdd_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
// {
|
|
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InsulationAcceptanceRecordEdit.aspx?projectId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 双击编辑
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
//{
|
|
// if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_InsulationAcceptanceRecordMenuId, BLL.Const.BtnModify))
|
|
// {
|
|
// if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
// {
|
|
// if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
|
|
// {
|
|
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InsulationAcceptanceRecordEdit.aspx?insulationAcceptanceRecordId={0}", this.Grid1.SelectedRowID, "编辑 - ")));
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 右键编辑
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_InsulationAcceptanceRecordMenuId, BLL.Const.BtnModify))
|
|
// {
|
|
// if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
// {
|
|
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InsulationAcceptanceRecordEdit.aspx?insulationAcceptanceRecordId={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 右键删除
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_InsulationAcceptanceRecordMenuId, Const.BtnDelete))
|
|
// {
|
|
// if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
// {
|
|
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
|
// return;
|
|
// }
|
|
|
|
// bool isShow = true;
|
|
// if (Grid1.SelectedRowIndexArray.Length > 1)
|
|
// {
|
|
// isShow = false;
|
|
// }
|
|
// bool isDelete = false;
|
|
// foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
// {
|
|
// string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
// if (judgementDelete(rowID, isShow))
|
|
// {
|
|
// isDelete = true;
|
|
// BLL.InsulationAcceptanceRecordItemService.DeleteItemByInsulationAcceptanceRecordId(rowID);
|
|
// BLL.InsulationAcceptanceRecordService.DeleteInsulationAcceptanceRecordById(rowID);
|
|
// BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除隔热工程质量验收记录");
|
|
// }
|
|
// }
|
|
// if (isDelete)
|
|
// {
|
|
// ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
// }
|
|
// this.BindGrid();
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
// }
|
|
//}
|
|
|
|
#region 判断是否可删除
|
|
/// <summary>
|
|
/// 判断是否可以删除
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
//private bool judgementDelete(string id, bool isShow)
|
|
//{
|
|
// string content = string.Empty;
|
|
|
|
// if (string.IsNullOrEmpty(content))
|
|
// {
|
|
// return true;
|
|
// }
|
|
// else
|
|
// {
|
|
// if (isShow)
|
|
// {
|
|
// Alert.ShowInTop(content, MessageBoxIcon.Error);
|
|
// }
|
|
// return false;
|
|
// }
|
|
//}
|
|
#endregion
|
|
#endregion
|
|
|
|
#region 关闭弹出窗口及刷新页面
|
|
/// <summary>
|
|
/// 关闭弹出窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
//{
|
|
// this.InitTreeMenu();//加载树
|
|
// this.BindGrid();
|
|
//}
|
|
#endregion
|
|
|
|
#region 保存
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_InsulationAcceptanceRecordMenuId, Const.BtnSave))
|
|
{
|
|
Model.JGZL_InsulationAcceptanceRecord newReport = new Model.JGZL_InsulationAcceptanceRecord();
|
|
newReport.HeatInsulationArea = this.txtHeatInsulationArea.Text.Trim();
|
|
newReport.InsulationStructure = this.txtInsulationStructure.Text.Trim();
|
|
//newReport.AcceptanceConclusion = this.txtAcceptanceConclusion.Text.Trim();
|
|
if (!string.IsNullOrEmpty(this.InsulationAcceptanceRecordId))
|
|
{
|
|
newReport.InsulationAcceptanceRecordId = this.InsulationAcceptanceRecordId;
|
|
BLL.InsulationAcceptanceRecordService.UpdateInsulationAcceptanceRecord(newReport);
|
|
}
|
|
else
|
|
{
|
|
newReport.ProjectId = this.ProjectId;
|
|
newReport.CompileMan = this.CurrUser.UserId;
|
|
newReport.CompileDate = DateTime.Now;
|
|
newReport.InsulationAcceptanceRecordId = SQLHelper.GetNewID(typeof(Model.JGZL_InsulationAcceptanceRecord));
|
|
this.InsulationAcceptanceRecordId = newReport.InsulationAcceptanceRecordId;
|
|
BLL.InsulationAcceptanceRecordService.AddInsulationAcceptanceRecord(newReport);
|
|
}
|
|
saveItem();
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
//PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存明细
|
|
/// </summary>
|
|
void saveItem()
|
|
{
|
|
BLL.InsulationAcceptanceRecordItemService.DeleteItemByInsulationAcceptanceRecordId(this.InsulationAcceptanceRecordId);
|
|
//List<Model.JGZL_InsulationAcceptanceRecordItem> detailLists = new List<Model.JGZL_InsulationAcceptanceRecordItem>();
|
|
JArray teamGroupData = Grid1.GetMergedData();
|
|
foreach (JObject teamGroupRow in teamGroupData)
|
|
{
|
|
JObject values = teamGroupRow.Value<JObject>("values");
|
|
int rowIndex = teamGroupRow.Value<int>("index");
|
|
Model.JGZL_InsulationAcceptanceRecordItem newDetail = new Model.JGZL_InsulationAcceptanceRecordItem
|
|
{
|
|
InsulationAcceptanceRecordItemId = values.Value<string>("InsulationAcceptanceRecordItemId"),
|
|
InsulationAcceptanceRecordId = this.InsulationAcceptanceRecordId,
|
|
CheckCode = values.Value<string>("CheckCode"),
|
|
CheckItem = values.Value<string>("CheckItem"),
|
|
CheckResult = values.Value<string>("CheckResult")
|
|
};
|
|
BLL.InsulationAcceptanceRecordItemService.AddInsulationAcceptanceRecordItem(newDetail);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出按钮
|
|
/// 导出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
string rootPath = Server.MapPath("~/");
|
|
string initTemplatePath = string.Empty;
|
|
string uploadfilepath = string.Empty;
|
|
string newUrl = string.Empty;
|
|
string filePath = string.Empty;
|
|
|
|
string projectId = this.tvControlItem.SelectedNodeID;
|
|
if (!string.IsNullOrEmpty(projectId))
|
|
{
|
|
initTemplatePath = Const.JGZL_InsulationAcceptanceRecordUrl;
|
|
uploadfilepath = rootPath + initTemplatePath;
|
|
|
|
newUrl = uploadfilepath.Replace("隔热工程质量验收记录导出模板", "隔热工程质量验收记录");
|
|
if (File.Exists(newUrl))
|
|
{
|
|
File.Delete(newUrl);
|
|
}
|
|
File.Copy(uploadfilepath, newUrl);
|
|
Document doc = new Aspose.Words.Document(uploadfilepath);
|
|
|
|
Bookmark projectName = doc.Range.Bookmarks["ProjectName"];
|
|
if (projectName != null)
|
|
{
|
|
projectName.Text = BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName;
|
|
}
|
|
Bookmark heatInsulationArea = doc.Range.Bookmarks["HeatInsulationArea"];
|
|
if (heatInsulationArea != null)
|
|
{
|
|
heatInsulationArea.Text = this.txtHeatInsulationArea.Text;
|
|
}
|
|
Bookmark insulationStructure = doc.Range.Bookmarks["InsulationStructure"];
|
|
if (insulationStructure != null)
|
|
{
|
|
insulationStructure.Text = this.txtInsulationStructure.Text;
|
|
}
|
|
//Bookmark acceptanceConclusion = doc.Range.Bookmarks["AcceptanceConclusion"];
|
|
//if (acceptanceConclusion != null)
|
|
//{
|
|
// acceptanceConclusion.Text = this.txtAcceptanceConclusion.Text;
|
|
//}
|
|
|
|
|
|
var itemList = BLL.InsulationAcceptanceRecordItemService.GetItemsByInsulationAcceptanceRecordId(this.InsulationAcceptanceRecordId);
|
|
if (itemList.Count > 0)
|
|
{
|
|
Bookmark checkResult1 = doc.Range.Bookmarks["CheckResult1"];
|
|
if (checkResult1 != null)
|
|
{
|
|
checkResult1.Text = itemList.Where(x => x.CheckCode == "1").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult2 = doc.Range.Bookmarks["CheckResult2"];
|
|
if (checkResult2 != null)
|
|
{
|
|
checkResult2.Text = itemList.Where(x => x.CheckCode == "2").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult3 = doc.Range.Bookmarks["CheckResult3"];
|
|
if (checkResult3 != null)
|
|
{
|
|
checkResult3.Text = itemList.Where(x => x.CheckCode == "3").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult4 = doc.Range.Bookmarks["CheckResult4"];
|
|
if (checkResult4 != null)
|
|
{
|
|
checkResult4.Text = itemList.Where(x => x.CheckCode == "4").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult5 = doc.Range.Bookmarks["CheckResult5"];
|
|
if (checkResult5 != null)
|
|
{
|
|
checkResult5.Text = itemList.Where(x => x.CheckCode == "5").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult6 = doc.Range.Bookmarks["CheckResult6"];
|
|
if (checkResult6 != null)
|
|
{
|
|
checkResult6.Text = itemList.Where(x => x.CheckCode == "6").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult7 = doc.Range.Bookmarks["CheckResult7"];
|
|
if (checkResult7 != null)
|
|
{
|
|
checkResult7.Text = itemList.Where(x => x.CheckCode == "7").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult8 = doc.Range.Bookmarks["CheckResult8"];
|
|
if (checkResult8 != null)
|
|
{
|
|
checkResult8.Text = itemList.Where(x => x.CheckCode == "8").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult9 = doc.Range.Bookmarks["CheckResult9"];
|
|
if (checkResult9 != null)
|
|
{
|
|
checkResult9.Text = itemList.Where(x => x.CheckCode == "9").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult10 = doc.Range.Bookmarks["CheckResult10"];
|
|
if (checkResult10 != null)
|
|
{
|
|
checkResult10.Text = itemList.Where(x => x.CheckCode == "10").FirstOrDefault().CheckResult;
|
|
}
|
|
Bookmark checkResult11 = doc.Range.Bookmarks["CheckResult11"];
|
|
if (checkResult11 != null)
|
|
{
|
|
checkResult11.Text = itemList.Where(x => x.CheckCode == "11").FirstOrDefault().CheckResult;
|
|
}
|
|
}
|
|
doc.Save(newUrl);
|
|
|
|
string fileName = Path.GetFileName(newUrl);
|
|
FileInfo info = new FileInfo(newUrl);
|
|
long fileSize = info.Length;
|
|
Response.Clear();
|
|
Response.ContentType = "application/x-zip-compressed";
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
Response.AddHeader("Content-Length", fileSize.ToString());
|
|
Response.TransmitFile(newUrl, 0, fileSize);
|
|
Response.Flush();
|
|
Response.Close();
|
|
File.Delete(newUrl);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |