1155 lines
		
	
	
		
			53 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			1155 lines
		
	
	
		
			53 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using System;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data;
 | 
						|
using System.Data.SqlClient;
 | 
						|
using System.Linq;
 | 
						|
using Newtonsoft.Json.Linq;
 | 
						|
using System.IO;
 | 
						|
using NPOI.XSSF.UserModel;
 | 
						|
using NPOI.SS.UserModel;
 | 
						|
using System.Runtime.Serialization;
 | 
						|
 | 
						|
namespace FineUIPro.Web.HJGL.WeldingManage
 | 
						|
{
 | 
						|
    public partial class JointInfo : PageBase
 | 
						|
    {
 | 
						|
        #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.InitTreeMenu();//加载树
 | 
						|
                //显示列
 | 
						|
                Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.UserId, "Joint");
 | 
						|
                if (c != null)
 | 
						|
                {
 | 
						|
                    this.GetShowColumn(c.Columns);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 加载树装置-单位-工作区
 | 
						|
        /// <summary>
 | 
						|
        /// 加载树
 | 
						|
        /// </summary>
 | 
						|
        private void InitTreeMenu()
 | 
						|
        {
 | 
						|
            this.tvControlItem.Nodes.Clear();
 | 
						|
            TreeNode rootNode = new TreeNode();
 | 
						|
            rootNode.Text = "装置-单位-工作区";
 | 
						|
            rootNode.NodeID = "0";
 | 
						|
            rootNode.Expanded = true;
 | 
						|
            this.tvControlItem.Nodes.Add(rootNode);
 | 
						|
            ////装置
 | 
						|
            var pInstallation = (from x in Funs.DB.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
 | 
						|
            ////区域
 | 
						|
            var pWorkArea = (from x in Funs.DB.ProjectData_WorkArea where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
 | 
						|
            ////单位
 | 
						|
            var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
 | 
						|
 | 
						|
            var workAreaIdList = (from x in BLL.Funs.DB.PW_IsoInfo
 | 
						|
                                  where x.ProjectId == this.CurrUser.LoginProjectId && x.ISO_IsoNo.Contains(this.txtIsono.Text.Trim())
 | 
						|
                                  orderby x.ISO_IsoNo
 | 
						|
                                  select x.WorkAreaId).Distinct().ToList();
 | 
						|
            pWorkArea = pWorkArea.Where(x => workAreaIdList.Contains(x.WorkAreaId)).OrderBy(x => x.WorkAreaCode).ToList();
 | 
						|
            pInstallation = (from x in pInstallation
 | 
						|
                             join y in pWorkArea on x.InstallationId equals y.InstallationId
 | 
						|
                             select x).Distinct().ToList();
 | 
						|
            pUnits = (from x in pUnits
 | 
						|
                      join y in pWorkArea on x.UnitId equals y.UnitId
 | 
						|
                      select x).Distinct().ToList();
 | 
						|
            this.BindNodes(rootNode, pInstallation, pWorkArea, pUnits);
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 绑定树节点
 | 
						|
        #region 绑定树节点
 | 
						|
        /// <summary>
 | 
						|
        ///  绑定树节点
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="node"></param>
 | 
						|
        private void BindNodes(TreeNode node, List<Model.Project_Installation> pInstallation, List<Model.ProjectData_WorkArea> pWorkArea, List<Model.Project_ProjectUnit> pUnits)
 | 
						|
        {
 | 
						|
            if (string.IsNullOrEmpty(node.ToolTip))
 | 
						|
            {
 | 
						|
                List<Model.Project_Installation> installations = pInstallation;
 | 
						|
                var pUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
 | 
						|
                if (pUnit != null && pUnit.UnitType != Const.ProjectUnitType_1 && pUnit.UnitType != Const.ProjectUnitType_5)
 | 
						|
                {
 | 
						|
                    installations = (from x in pInstallation
 | 
						|
                                     join y in pWorkArea on x.InstallationId equals y.InstallationId
 | 
						|
                                     where y.UnitId == this.CurrUser.UnitId
 | 
						|
                                     orderby x.InstallationId
 | 
						|
                                     select x).Distinct().ToList();
 | 
						|
                }
 | 
						|
 | 
						|
                foreach (var q in installations)
 | 
						|
                {
 | 
						|
                    TreeNode newNode = new TreeNode();
 | 
						|
                    newNode.NodeID = q.InstallationId;
 | 
						|
                    newNode.Text = q.InstallationName;
 | 
						|
                    newNode.ToolTip = "装置";
 | 
						|
                    newNode.Expanded = true;
 | 
						|
                    node.Nodes.Add(newNode);
 | 
						|
                    this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else if (node.ToolTip == "装置")
 | 
						|
            {
 | 
						|
                List<Model.Project_ProjectUnit> units = null;
 | 
						|
                var pUnitDepth = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
 | 
						|
                if (pUnitDepth == null || pUnitDepth.UnitType == Const.ProjectUnitType_1 || pUnitDepth.UnitType == Const.ProjectUnitType_5)
 | 
						|
                {
 | 
						|
                    units = (from x in pUnits
 | 
						|
                             join y in pWorkArea on x.UnitId equals y.UnitId
 | 
						|
                             where y.InstallationId == node.NodeID && x.UnitType == Const.ProjectUnitType_2
 | 
						|
                             select x).ToList();
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    units = (from x in pUnits
 | 
						|
                             join y in pWorkArea on x.UnitId equals y.UnitId
 | 
						|
                             where y.InstallationId == node.NodeID && x.UnitType == Const.ProjectUnitType_2 && x.UnitId == this.CurrUser.UnitId
 | 
						|
                             select x).ToList();
 | 
						|
                }
 | 
						|
 | 
						|
                units = units.OrderBy(x => x.InTime).Distinct().ToList();
 | 
						|
                foreach (var q in units)
 | 
						|
                {
 | 
						|
                    var unit = BLL.UnitService.GetUnitByUnitId(q.UnitId);
 | 
						|
                    if (unit != null)
 | 
						|
                    {
 | 
						|
                        TreeNode newNode = new TreeNode();
 | 
						|
                        newNode.Text = unit.UnitName;
 | 
						|
                        newNode.NodeID = q.UnitId + "|" + node.NodeID;
 | 
						|
                        newNode.ToolTip = "单位";
 | 
						|
                        node.Nodes.Add(newNode);
 | 
						|
                        this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else if (node.ToolTip == "单位")
 | 
						|
            {
 | 
						|
                var workAreas = (from x in pWorkArea
 | 
						|
                                 where x.InstallationId == node.ParentNode.NodeID && x.UnitId == node.NodeID.Split('|')[0]
 | 
						|
                                 select x);
 | 
						|
                workAreas = workAreas.OrderByDescending(x => x.WorkAreaCode);
 | 
						|
                foreach (var q in workAreas)
 | 
						|
                {
 | 
						|
                    int a = (from x in BLL.Funs.DB.PW_IsoInfo where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == node.NodeID.Split('|')[0] && x.WorkAreaId == q.WorkAreaId && x.Is_Standard== true  select x).Count();
 | 
						|
                    TreeNode newNode1 = new TreeNode();
 | 
						|
                    newNode1.Text = q.WorkAreaCode + "【" + a.ToString() + "非标管线】";
 | 
						|
                    newNode1.NodeID = q.WorkAreaId+ "_NoStandard";
 | 
						|
                    newNode1.EnableExpandEvent = true;
 | 
						|
                    newNode1.ToolTip = "区域非标管线";
 | 
						|
                    node.Nodes.Add(newNode1);
 | 
						|
                    int b = (from x in BLL.Funs.DB.PW_IsoInfo where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == node.NodeID.Split('|')[0] && x.WorkAreaId == q.WorkAreaId && x.Is_Standard != true select x).Count();
 | 
						|
                    TreeNode newNode2 = new TreeNode();
 | 
						|
                    newNode2.Text = q.WorkAreaCode + "【" + b.ToString() + "标准管线】";
 | 
						|
                    newNode2.NodeID = q.WorkAreaId+ "_Standard";
 | 
						|
                    newNode2.EnableExpandEvent = true;
 | 
						|
                    newNode2.ToolTip = "区域标准管线";
 | 
						|
                    node.Nodes.Add(newNode2);
 | 
						|
                    this.BindNodes(newNode1, pInstallation, pWorkArea, pUnits);
 | 
						|
                    this.BindNodes(newNode2, pInstallation, pWorkArea, pUnits);
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else if (node.ToolTip == "区域非标管线")
 | 
						|
            {
 | 
						|
                TreeNode newNode = new TreeNode();
 | 
						|
                newNode.Text = "非标管线";
 | 
						|
                newNode.NodeID = "非标管线";
 | 
						|
                node.Nodes.Add(newNode);
 | 
						|
            }
 | 
						|
            else if (node.ToolTip == "区域标准管线")
 | 
						|
            {
 | 
						|
                TreeNode newNode = new TreeNode();
 | 
						|
                newNode.Text = "标准管线";
 | 
						|
                newNode.NodeID = "标准管线";
 | 
						|
                node.Nodes.Add(newNode);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 树展开事件
 | 
						|
        /// <summary>
 | 
						|
        /// 树展开事件
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
 | 
						|
        {
 | 
						|
            IQueryable<Model.PW_IsoInfo> isoInfo = from x in Funs.DB.PW_IsoInfo
 | 
						|
                          where x.ProjectId == this.CurrUser.LoginProjectId && x.WorkAreaId == e.Node.NodeID.Split('_')[0]                
 | 
						|
                          orderby x.ISO_IsoNo
 | 
						|
                          select x;
 | 
						|
            string a = this.txtIsono.Text.Trim();
 | 
						|
            if (!string.IsNullOrEmpty(a))
 | 
						|
            {
 | 
						|
                isoInfo = isoInfo.Where(x => x.ISO_IsoNo.Contains(a));
 | 
						|
            }
 | 
						|
 | 
						|
            if (e.Node.ToolTip == "区域非标管线")
 | 
						|
            {
 | 
						|
                e.Node.Nodes.Clear();
 | 
						|
                var getS = isoInfo.Where(x => x.Is_Standard == true).OrderBy(x => x.ISO_IsoNo);          
 | 
						|
                foreach (var item in getS)
 | 
						|
                {
 | 
						|
                    var jotCount = Funs.DB.PW_JointInfo.Where(x => x.ISO_ID == item.ISO_ID).Count();
 | 
						|
                    TreeNode newNode = new TreeNode();
 | 
						|
                    if (!String.IsNullOrEmpty(item.ISO_Sheet))
 | 
						|
                    {
 | 
						|
                        newNode.Text = item.ISO_IsoNo + "(" + item.ISO_Sheet + ")";
 | 
						|
                    }
 | 
						|
                    else
 | 
						|
                    {
 | 
						|
                        newNode.Text = item.ISO_IsoNo;
 | 
						|
                    }
 | 
						|
                    newNode.Text += "【" + jotCount.ToString() + "焊口】";
 | 
						|
                    newNode.ToolTip = "管线(页数)【焊口数】";
 | 
						|
                    newNode.NodeID = item.ISO_ID;
 | 
						|
                    newNode.EnableClickEvent = true;
 | 
						|
                    e.Node.Nodes.Add(newNode);
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else if (e.Node.ToolTip == "区域标准管线")
 | 
						|
            {
 | 
						|
                e.Node.Nodes.Clear();
 | 
						|
                var getNS = isoInfo.Where(x => x.Is_Standard == false).OrderBy(x => x.ISO_IsoNo);
 | 
						|
                foreach (var item in getNS)
 | 
						|
                {
 | 
						|
                    var jotCount = Funs.DB.PW_JointInfo.Where(x => x.ISO_ID == item.ISO_ID).Count();
 | 
						|
                    TreeNode newNode = new TreeNode();
 | 
						|
                    if (!String.IsNullOrEmpty(item.ISO_Sheet))
 | 
						|
                    {
 | 
						|
                        newNode.Text = item.ISO_IsoNo + "(" + item.ISO_Sheet + ")";
 | 
						|
                    }
 | 
						|
                    else
 | 
						|
                    {
 | 
						|
                        newNode.Text = item.ISO_IsoNo;
 | 
						|
                    }
 | 
						|
 | 
						|
                    newNode.Text += "【" + jotCount.ToString() + "焊口】";
 | 
						|
                    newNode.ToolTip =  "管线(页数)【焊口数】";
 | 
						|
                    newNode.NodeID = item.ISO_ID;
 | 
						|
                    newNode.EnableClickEvent = true;
 | 
						|
                    e.Node.Nodes.Add(newNode);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 点击TreeView
 | 
						|
        /// <summary>
 | 
						|
        /// 点击TreeView
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
 | 
						|
        {
 | 
						|
            var p = Funs.DB.PW_IsoInfo.Where(x => x.ISO_ID == this.tvControlItem.SelectedNodeID).FirstOrDefault();
 | 
						|
            if (p != null)
 | 
						|
            {
 | 
						|
                if (p.Is_Standard)
 | 
						|
                {
 | 
						|
                    this.Grid1.FindColumn("DetectionRateValue").Hidden = false;
 | 
						|
                    this.Grid1.FindColumn("DetectionTypeName").Hidden = false;
 | 
						|
                    this.Grid1.FindColumn("WallBoard").Hidden = false;
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    this.Grid1.FindColumn("DetectionRateValue").Hidden = true;
 | 
						|
                    this.Grid1.FindColumn("DetectionTypeName").Hidden = true;
 | 
						|
                    this.Grid1.FindColumn("WallBoard").Hidden = true;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            this.BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 数据绑定
 | 
						|
        /// <summary>
 | 
						|
        /// 数据绑定
 | 
						|
        /// </summary>
 | 
						|
        private void BindGrid()
 | 
						|
        {
 | 
						|
            string strSql = @"SELECT jointInfo.JOT_ID, 
 | 
						|
                                    jointInfo.ProjectId, 
 | 
						|
                                    jointInfo.JOT_JointNo, 
 | 
						|
                                    jointInfo.is_hj, 
 | 
						|
                                    jointInfo.JointStatusName, 
 | 
						|
                                    jointInfo.JOT_TrustFlagName, 
 | 
						|
                                    jointInfo.JOT_CheckFlagName, 
 | 
						|
                                    jointInfo.ISO_ID, 
 | 
						|
                                    jointInfo.ISO_IsoNo, 
 | 
						|
                                    jointInfo.WorkAreaId, 
 | 
						|
                                    jointInfo.WorkAreaCode, 
 | 
						|
                                    jointInfo.JOT_WeldDate, 
 | 
						|
                                    jointInfo.JOT_DailyReportNo, 
 | 
						|
                                    jointInfo.STE_Name1, 
 | 
						|
                                    jointInfo.STE_Name2, 
 | 
						|
                                    jointInfo.Component1, 
 | 
						|
                                    jointInfo.Component2, 
 | 
						|
                                    jointInfo.WED_Code1, 
 | 
						|
                                    jointInfo.WED_Name1, 
 | 
						|
                                    jointInfo.WED_Code2, 
 | 
						|
                                    jointInfo.WED_Name2, 
 | 
						|
                                    jointInfo.JOT_JointDesc, 
 | 
						|
                                    jointInfo.JOT_Dia, 
 | 
						|
                                    jointInfo.JOT_Size, 
 | 
						|
                                    jointInfo.JOT_Sch, 
 | 
						|
                                    jointInfo.JOT_FactSch, 
 | 
						|
                                    jointInfo.GrooveTypeName, 
 | 
						|
                                    jointInfo.JOTY_ID, 
 | 
						|
                                    jointInfo.WeldTypeName, 
 | 
						|
                                    jointInfo.WME_ID, 
 | 
						|
                                    jointInfo.WeldingMethodName, 
 | 
						|
                                    jointInfo.WeldSilk, 
 | 
						|
                                    jointInfo.WeldMat, 
 | 
						|
                                    jointInfo.WLO_Code, 
 | 
						|
                                    jointInfo.WeldingLocationName, 
 | 
						|
                                    jointInfo.JOT_DoneDin, 
 | 
						|
                                    jointInfo.JOT_PrepareTemp, 
 | 
						|
                                    jointInfo.JOT_JointAttribute, 
 | 
						|
                                    jointInfo.JOT_CellTemp, 
 | 
						|
                                    jointInfo.JOT_LastTemp, 
 | 
						|
                                    jointInfo.JOT_HeartNo1, 
 | 
						|
                                    jointInfo.JOT_HeartNo2, 
 | 
						|
                                    jointInfo.PointDate, 
 | 
						|
                                    jointInfo.PointNo, 
 | 
						|
                                    jointInfo.CH_TrustCode, 
 | 
						|
                                    jointInfo.CH_TrustDate, 
 | 
						|
                                    jointInfo.JOT_FaceCheckResult, 
 | 
						|
                                    jointInfo.JOT_FaceCheckDate, 
 | 
						|
                                    jointInfo.JOT_FaceChecker,  
 | 
						|
                                    detectionRate.DetectionRateValue,
 | 
						|
                                    jointInfo.IS_Proess, 
 | 
						|
                                    jointInfo.JOT_BelongPipe, 
 | 
						|
                                    jointInfo.JOT_Electricity, 
 | 
						|
                                    detectionType.DetectionTypeName,
 | 
						|
                                    jointInfo.JOT_Voltage, 
 | 
						|
                                    jointInfo.JOT_ProessDate, 
 | 
						|
                                    jointInfo.JOT_HotRpt, 
 | 
						|
                                    jointInfo.Extend_Length,
 | 
						|
                                    jointInfo.JOT_Remark"
 | 
						|
                            + @" from View_JointInfo as jointInfo "
 | 
						|
                            + @" LEFT JOIN Base_DetectionRate AS detectionRate ON detectionRate.DetectionRateId = jointInfo.DetectionRateId"
 | 
						|
                          + @" LEFT JOIN Base_DetectionType AS detectionType ON detectionType.DetectionTypeId = jointInfo.DetectionTypeId"
 | 
						|
                            + @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId";
 | 
						|
            List<SqlParameter> listStr = new List<SqlParameter>
 | 
						|
            {
 | 
						|
                new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
 | 
						|
                new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
 | 
						|
            };
 | 
						|
            if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
 | 
						|
            {
 | 
						|
                strSql += " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo";
 | 
						|
                listStr.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
 | 
						|
            }
 | 
						|
            SqlParameter[] parameter = listStr.ToArray();
 | 
						|
            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						|
            tb.Columns.Add("index",typeof(System.Int16));
 | 
						|
            foreach(DataRow row in tb.Rows)
 | 
						|
            {
 | 
						|
                try
 | 
						|
                {
 | 
						|
                    row["index"] = int.Parse(System.Text.RegularExpressions.Regex.Replace(row["JOT_JointNo"].ToString(), @"[^0-9]+", ""));
 | 
						|
                }
 | 
						|
                catch (Exception e)
 | 
						|
                {
 | 
						|
                    row["index"] = 0;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            // 2.获取当前分页数据
 | 
						|
            //var table = this.GetPagedDataTable(Grid1, tb1);
 | 
						|
            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>
 | 
						|
        /// Grid双击事件
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
 | 
						|
        {
 | 
						|
            if (GetButtonPower(Const.BtnModify))
 | 
						|
            { 
 | 
						|
                PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("JointInfoEdit.aspx?JOT_ID={0}", Grid1.SelectedRowID, "编辑 - ")));
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 增加焊口信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnNew_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (GetButtonPower(Const.BtnAdd))
 | 
						|
            {
 | 
						|
                var isoInfo = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(tvControlItem.SelectedNodeID);
 | 
						|
                if (isoInfo != null)
 | 
						|
                {
 | 
						|
                    PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("JointInfoEdit.aspx?ISO_ID={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    Alert.ShowInTop("请先选择管线!", MessageBoxIcon.Warning);
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 批量增加焊口信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnBatchAdd_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (GetButtonPower(Const.BtnAdd))
 | 
						|
            {
 | 
						|
                var isoInfo = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(tvControlItem.SelectedNodeID);
 | 
						|
                if (isoInfo != null)
 | 
						|
                {
 | 
						|
                    PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("JointInfoBatchEdit.aspx?ISO_ID={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    Alert.ShowInTop("请先选择管线!", MessageBoxIcon.Warning);
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 焊口信息编辑
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnMenuEdit_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (GetButtonPower(Const.BtnModify))
 | 
						|
            {
 | 
						|
                if (Grid1.SelectedRowIndexArray.Length == 0)
 | 
						|
                {
 | 
						|
                    Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
                PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("JointInfoEdit.aspx?JOT_ID={0}", Grid1.SelectedRowID, "维护 - ")));
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 删除按钮
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnMenuDelete_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (GetButtonPower(Const.BtnDelete))
 | 
						|
            {
 | 
						|
                if (Grid1.SelectedRowIndexArray.Length == 0)
 | 
						|
                {
 | 
						|
                    Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
 | 
						|
                bool isShow = true;
 | 
						|
                if (Grid1.SelectedRowIndexArray.Length > 1)
 | 
						|
                {
 | 
						|
                    isShow = false;
 | 
						|
                }
 | 
						|
                foreach (int rowIndex in Grid1.SelectedRowIndexArray)
 | 
						|
                {
 | 
						|
                    string rowID = Grid1.DataKeys[rowIndex][0].ToString();
 | 
						|
                    if (judgementDelete(rowID, isShow))
 | 
						|
                    {
 | 
						|
                        BLL.PW_JointInfoService.DeleteJointInfo(rowID);
 | 
						|
                        //BLL.Sys_LogService.AddLog(BLL.Const.System_7, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除焊口信息");
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                ShowNotify("删除成功!", MessageBoxIcon.Success);
 | 
						|
                this.BindGrid();
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region  报表打印
 | 
						|
        /// <summary>
 | 
						|
        ///  报表打印
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnPrint_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            string isoId = this.tvControlItem.SelectedNodeID;
 | 
						|
            var q = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(isoId);
 | 
						|
            
 | 
						|
            if (q != null)
 | 
						|
            {
 | 
						|
                if (printType.SelectedValue == "0")  //焊接工作记录
 | 
						|
                {
 | 
						|
                    string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
 | 
						|
                    //模板文件
 | 
						|
                    string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/焊接管道记录.xlsx";
 | 
						|
                    //导出文件
 | 
						|
                    string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
 | 
						|
                    if (!Directory.Exists(filePath))
 | 
						|
                    {
 | 
						|
                        Directory.CreateDirectory(filePath);
 | 
						|
                    }
 | 
						|
                    string ReportFileName = filePath + "out.xlsx";
 | 
						|
 | 
						|
                    FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
 | 
						|
                    XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
 | 
						|
 | 
						|
 | 
						|
                    XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接工作记录");
 | 
						|
 | 
						|
                    recordSheet.GetRow(0).GetCell(0).SetCellValue(q.ISO_IsoNo);
 | 
						|
                    var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
 | 
						|
                    var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
 | 
						|
                    recordSheet.GetRow(0).GetCell(10).SetCellValue(install.InstallationName);
 | 
						|
                    recordSheet.GetRow(2).GetCell(10).SetCellValue(workArea.WorkAreaName);
 | 
						|
 | 
						|
 | 
						|
                    string strSql = @"SELECT jointInfo.JOT_ID, 
 | 
						|
                                    jointInfo.ProjectId, 
 | 
						|
                                    jointInfo.JOT_JointNo, 
 | 
						|
                                    jointInfo.is_hj, 
 | 
						|
                                    jointInfo.JointStatusName, 
 | 
						|
                                    jointInfo.JOT_TrustFlagName, 
 | 
						|
                                    jointInfo.JOT_CheckFlagName, 
 | 
						|
                                    jointInfo.ISO_ID, 
 | 
						|
                                    jointInfo.ISO_IsoNo, 
 | 
						|
                                    jointInfo.ISO_IsoNumber,
 | 
						|
                                    jointInfo.WorkAreaId, 
 | 
						|
                                    jointInfo.WorkAreaCode, 
 | 
						|
                                    jointInfo.JOT_WeldDate, 
 | 
						|
                                    jointInfo.JOT_DailyReportNo, 
 | 
						|
                                    jointInfo.STE_Name1, 
 | 
						|
                                    jointInfo.STE_Name2, 
 | 
						|
                                    jointInfo.Component1, 
 | 
						|
                                    jointInfo.Component2, 
 | 
						|
                                    jointInfo.WED_Code1, 
 | 
						|
                                    jointInfo.WED_Name1, 
 | 
						|
                                    jointInfo.WED_Code2, 
 | 
						|
                                    jointInfo.WED_Name2, 
 | 
						|
                                    jointInfo.JOT_JointDesc, 
 | 
						|
                                    jointInfo.JOT_Dia, 
 | 
						|
                                    jointInfo.JOT_Size, 
 | 
						|
                                    jointInfo.JOT_Sch, 
 | 
						|
                                    jointInfo.JOT_FactSch, 
 | 
						|
                                    jointInfo.GrooveTypeName, 
 | 
						|
                                    jointInfo.JOTY_ID, 
 | 
						|
                                    jointInfo.WeldTypeName, 
 | 
						|
                                    jointInfo.WME_ID, 
 | 
						|
                                    jointInfo.WeldingMethodName, 
 | 
						|
                                    jointInfo.WeldSilk, 
 | 
						|
                                    jointInfo.WeldMat, 
 | 
						|
                                    jointInfo.WLO_Code, 
 | 
						|
                                    jointInfo.WeldingLocationName, 
 | 
						|
                                    jointInfo.JOT_DoneDin, 
 | 
						|
                                    jointInfo.JOT_PrepareTemp, 
 | 
						|
                                    jointInfo.JOT_JointAttribute, 
 | 
						|
                                    jointInfo.JOT_CellTemp, 
 | 
						|
                                    jointInfo.JOT_LastTemp, 
 | 
						|
                                    jointInfo.JOT_HeartNo1, 
 | 
						|
                                    jointInfo.JOT_HeartNo2, 
 | 
						|
                                    jointInfo.PointDate, 
 | 
						|
                                    jointInfo.PointNo, 
 | 
						|
                                    jointInfo.CH_TrustCode, 
 | 
						|
                                    jointInfo.CH_TrustDate, 
 | 
						|
                                    jointInfo.JOT_FaceCheckResult, 
 | 
						|
                                    jointInfo.JOT_FaceCheckDate, 
 | 
						|
                                    jointInfo.JOT_FaceChecker, 
 | 
						|
                                    jointInfo.IS_Proess, 
 | 
						|
                                    jointInfo.JOT_BelongPipe, 
 | 
						|
                                    jointInfo.JOT_Electricity, 
 | 
						|
                                    jointInfo.JOT_Voltage, 
 | 
						|
                                    jointInfo.JOT_ProessDate, 
 | 
						|
                                    jointInfo.JOT_HotRpt, 
 | 
						|
                                    jointInfo.JOT_Remark,jointInfo.JOT_Location"
 | 
						|
                                    + @" from View_JointInfo as jointInfo "
 | 
						|
                                    + @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId order by JOT_JointNo ";
 | 
						|
                    List<SqlParameter> listStr = new List<SqlParameter>
 | 
						|
                {
 | 
						|
                    new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
 | 
						|
                    new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
 | 
						|
                };
 | 
						|
 | 
						|
                    SqlParameter[] parameter = listStr.ToArray();
 | 
						|
                    DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						|
                    //if (tb.Rows.Count > 27)
 | 
						|
                    //{
 | 
						|
                    //   // for (int i = 0; i < (tb.Rows.Count - 24) % 30; i++)
 | 
						|
                    //        for (int j = 0; j < tb.Rows.Count - 27; j++)
 | 
						|
                    //        {
 | 
						|
                    //            recordSheet.GetRow(6).CopyRowTo(7 + j);
 | 
						|
                    //        }
 | 
						|
                    //}
 | 
						|
 | 
						|
                    if (tb.Rows.Count > 12)
 | 
						|
                    {
 | 
						|
                        recordSheet.ShiftRows(7, 34, tb.Rows.Count - 12);
 | 
						|
                        for (int j = 0; j < tb.Rows.Count - 12; j++)
 | 
						|
                        {
 | 
						|
                            recordSheet.CopyRow(6 + j, 7 + j);
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    for (int i = 0; i < tb.Rows.Count; i++)
 | 
						|
                    {
 | 
						|
                        try
 | 
						|
                        {
 | 
						|
                            string WED_Name = "";
 | 
						|
                            if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name1"].ToString()))
 | 
						|
                                WED_Name += tb.Rows[i]["WED_Name1"].ToString();
 | 
						|
 | 
						|
                            if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name2"].ToString()))
 | 
						|
                                WED_Name += "  " + tb.Rows[i]["WED_Name1"].ToString();
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(0).SetCellValue(WED_Name);
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(1).SetCellValue(tb.Rows[i]["ISO_IsoNo"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(3).SetCellValue(tb.Rows[i]["JOT_JointDesc"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(4).SetCellValue(tb.Rows[i]["STE_Name1"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(5).SetCellValue(tb.Rows[i]["ISO_IsoNumber"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(6).SetCellValue(tb.Rows[i]["JOT_HotRpt"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(7).SetCellValue(tb.Rows[i]["WeldingMethodName"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(8).SetCellValue(tb.Rows[i]["JOT_Location"].ToString());
 | 
						|
 | 
						|
 | 
						|
                            if (!string.IsNullOrEmpty(tb.Rows[i]["JOT_WeldDate"].ToString()))
 | 
						|
                            {
 | 
						|
                                DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy-MM-DD HH:mm:ss.000");
 | 
						|
                                DateTime dateTime = DateTime.Parse(tb.Rows[i]["JOT_WeldDate"].ToString());
 | 
						|
 | 
						|
                                recordSheet.GetRow(5 + i).GetCell(10).SetCellValue(dateTime.Month);
 | 
						|
                                recordSheet.GetRow(5 + i).GetCell(11).SetCellValue(dateTime.Day);
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                        catch (Exception)
 | 
						|
                        {
 | 
						|
 | 
						|
                        }
 | 
						|
 | 
						|
                    }
 | 
						|
 | 
						|
                    using (FileStream filess = File.OpenWrite(ReportFileName))
 | 
						|
                    {
 | 
						|
                        hssfworkbook.Write(filess);
 | 
						|
                    }
 | 
						|
                    //PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
 | 
						|
 | 
						|
                    FileInfo filet = new FileInfo(ReportFileName);
 | 
						|
                    Response.Clear();
 | 
						|
                    Response.Charset = "GB2312";
 | 
						|
                    Response.ContentEncoding = System.Text.Encoding.UTF8;
 | 
						|
                    // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
 | 
						|
                    Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接工作记录_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
 | 
						|
                    // 添加头信息,指定文件大小,让浏览器能够显示下载进度
 | 
						|
                    Response.AddHeader("Content-Length", filet.Length.ToString());
 | 
						|
                    // 指定返回的是一个不能被客户端读取的流,必须被下载
 | 
						|
                    Response.ContentType = "application/ms-excel";
 | 
						|
                    // 把文件流发送到客户端
 | 
						|
                    Response.WriteFile(filet.FullName);
 | 
						|
                    // 停止页面的执行
 | 
						|
                    Response.End();
 | 
						|
                }
 | 
						|
                else // 焊接工艺评定
 | 
						|
                {
 | 
						|
                    string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
 | 
						|
                    //模板文件
 | 
						|
                    string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/管道焊接工艺检查记录.xlsx";
 | 
						|
                    //导出文件
 | 
						|
                    string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
 | 
						|
                    if (!Directory.Exists(filePath))
 | 
						|
                    {
 | 
						|
                        Directory.CreateDirectory(filePath);
 | 
						|
                    }
 | 
						|
                    string ReportFileName = filePath + "out.xlsx";
 | 
						|
 | 
						|
                    FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
 | 
						|
                    XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
 | 
						|
 | 
						|
 | 
						|
                    XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接工艺检查记录");
 | 
						|
 | 
						|
                    var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
 | 
						|
                    var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
 | 
						|
                    recordSheet.GetRow(0).GetCell(12).SetCellValue("工程名称:"+install.InstallationName);
 | 
						|
                    recordSheet.GetRow(1).GetCell(12).SetCellValue("单位工程名称:" + workArea.WorkAreaName);
 | 
						|
 | 
						|
 | 
						|
                    string strSql = @"SELECT jointInfo.JOT_ID, 
 | 
						|
                                    jointInfo.ProjectId, 
 | 
						|
                                    jointInfo.JOT_JointNo, 
 | 
						|
                                    jointInfo.is_hj, 
 | 
						|
                                    jointInfo.JointStatusName, 
 | 
						|
                                    jointInfo.JOT_TrustFlagName, 
 | 
						|
                                    jointInfo.JOT_CheckFlagName, 
 | 
						|
                                    jointInfo.ISO_ID, 
 | 
						|
                                    jointInfo.ISO_IsoNo, 
 | 
						|
                                    jointInfo.ISO_IsoNumber,
 | 
						|
                                    jointInfo.WorkAreaId, 
 | 
						|
                                    jointInfo.WorkAreaCode, 
 | 
						|
                                    jointInfo.JOT_WeldDate, 
 | 
						|
                                    jointInfo.JOT_DailyReportNo, 
 | 
						|
                                    jointInfo.STE_Name1, 
 | 
						|
                                    jointInfo.STE_Name2, 
 | 
						|
                                    jointInfo.Component1, 
 | 
						|
                                    jointInfo.Component2, 
 | 
						|
                                    jointInfo.WED_Code1, 
 | 
						|
                                    jointInfo.WED_Name1, 
 | 
						|
                                    jointInfo.WED_Code2, 
 | 
						|
                                    jointInfo.WED_Name2, 
 | 
						|
                                    jointInfo.JOT_JointDesc, 
 | 
						|
                                    jointInfo.JOT_Dia, 
 | 
						|
                                    jointInfo.JOT_Size, 
 | 
						|
                                    jointInfo.JOT_Sch, 
 | 
						|
                                    jointInfo.JOT_FactSch, 
 | 
						|
                                    jointInfo.GrooveTypeName, 
 | 
						|
                                    jointInfo.JOTY_ID, 
 | 
						|
                                    jointInfo.WeldTypeName, 
 | 
						|
                                    jointInfo.WME_ID, 
 | 
						|
                                    jointInfo.WeldingMethodName, 
 | 
						|
                                    jointInfo.WeldSilk, 
 | 
						|
                                    jointInfo.WeldMat, 
 | 
						|
                                    jointInfo.WLO_Code, 
 | 
						|
                                    jointInfo.WeldingLocationName, 
 | 
						|
                                    jointInfo.JOT_DoneDin, 
 | 
						|
                                    jointInfo.JOT_PrepareTemp, 
 | 
						|
                                    jointInfo.JOT_JointAttribute, 
 | 
						|
                                    jointInfo.JOT_CellTemp, 
 | 
						|
                                    jointInfo.JOT_LastTemp, 
 | 
						|
                                    jointInfo.JOT_HeartNo1, 
 | 
						|
                                    jointInfo.JOT_HeartNo2, 
 | 
						|
                                    jointInfo.PointDate, 
 | 
						|
                                    jointInfo.PointNo, 
 | 
						|
                                    jointInfo.CH_TrustCode, 
 | 
						|
                                    jointInfo.CH_TrustDate, 
 | 
						|
                                    jointInfo.JOT_FaceCheckResult, 
 | 
						|
                                    jointInfo.JOT_FaceCheckDate, 
 | 
						|
                                    jointInfo.JOT_FaceChecker, 
 | 
						|
                                    jointInfo.IS_Proess, 
 | 
						|
                                    jointInfo.JOT_BelongPipe, 
 | 
						|
                                    jointInfo.JOT_Electricity, 
 | 
						|
                                    jointInfo.JOT_Voltage, 
 | 
						|
                                    jointInfo.JOT_ProessDate, 
 | 
						|
                                    jointInfo.JOT_HotRpt, 
 | 
						|
                                    jointInfo.JOT_Remark,jointInfo.JOT_Location"
 | 
						|
                                    + @" from View_JointInfo as jointInfo "
 | 
						|
                                    + @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId order by JOT_JointNo ";
 | 
						|
                    List<SqlParameter> listStr = new List<SqlParameter>
 | 
						|
                {
 | 
						|
                    new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
 | 
						|
                    new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
 | 
						|
                };
 | 
						|
 | 
						|
                    SqlParameter[] parameter = listStr.ToArray();
 | 
						|
                    DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | 
						|
                    //if (tb.Rows.Count > 27)
 | 
						|
                    //{
 | 
						|
                    //   // for (int i = 0; i < (tb.Rows.Count - 24) % 30; i++)
 | 
						|
                    //        for (int j = 0; j < tb.Rows.Count - 27; j++)
 | 
						|
                    //        {
 | 
						|
                    //            recordSheet.GetRow(6).CopyRowTo(7 + j);
 | 
						|
                    //        }
 | 
						|
                    //}
 | 
						|
 | 
						|
                    if (tb.Rows.Count > 12)
 | 
						|
                    {
 | 
						|
                        recordSheet.ShiftRows(7, 34, tb.Rows.Count - 12);
 | 
						|
                        for (int j = 0; j < tb.Rows.Count - 12; j++)
 | 
						|
                        {
 | 
						|
                            recordSheet.CopyRow(6 + j, 7 + j);
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    for (int i = 0; i < tb.Rows.Count; i++)
 | 
						|
                    {
 | 
						|
                        try
 | 
						|
                        {
 | 
						|
                            string WED_Code = "";
 | 
						|
                            if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code1"].ToString()))
 | 
						|
                                WED_Code += tb.Rows[i]["WED_Code1"].ToString();
 | 
						|
 | 
						|
                            if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code2"].ToString()))
 | 
						|
                                WED_Code += "  " + tb.Rows[i]["WED_Code2"].ToString();
 | 
						|
                            
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(0).SetCellValue(tb.Rows[i]["ISO_IsoNo"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(1).SetCellValue("");
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(4).SetCellValue(WED_Code);
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(5).SetCellValue("");
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(6).SetCellValue("");
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(7).SetCellValue("");
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(8).SetCellValue(tb.Rows[i]["WeldingMethodName"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(9).SetCellValue(tb.Rows[i]["JOT_Electricity"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(10).SetCellValue(tb.Rows[i]["JOT_Voltage"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(11).SetCellValue("");
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(13).SetCellValue(tb.Rows[i]["JOT_PrepareTemp"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(14).SetCellValue(tb.Rows[i]["JOT_CellTemp"].ToString());
 | 
						|
                            recordSheet.GetRow(5 + i).GetCell(15).SetCellValue(tb.Rows[i]["JOT_LastTemp"].ToString());
 | 
						|
                            if (!string.IsNullOrEmpty(tb.Rows[i]["JOT_FaceCheckDate"].ToString()))
 | 
						|
                            {
 | 
						|
                                DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy-MM-DD HH:mm:ss.000");
 | 
						|
                                DateTime dateTime = DateTime.Parse(tb.Rows[i]["JOT_FaceCheckDate"].ToString());
 | 
						|
 | 
						|
                                recordSheet.GetRow(5 + i).GetCell(16).SetCellValue(dateTime.ToShortDateString()); 
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                        catch (Exception)
 | 
						|
                        {
 | 
						|
 | 
						|
                        }
 | 
						|
 | 
						|
                    }
 | 
						|
 | 
						|
                    using (FileStream filess = File.OpenWrite(ReportFileName))
 | 
						|
                    {
 | 
						|
                        hssfworkbook.Write(filess);
 | 
						|
                    }
 | 
						|
                    //PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
 | 
						|
 | 
						|
                    FileInfo filet = new FileInfo(ReportFileName);
 | 
						|
                    Response.Clear();
 | 
						|
                    Response.Charset = "GB2312";
 | 
						|
                    Response.ContentEncoding = System.Text.Encoding.UTF8;
 | 
						|
                    // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
 | 
						|
                    Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接工艺检查记录_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
 | 
						|
                    // 添加头信息,指定文件大小,让浏览器能够显示下载进度
 | 
						|
                    Response.AddHeader("Content-Length", filet.Length.ToString());
 | 
						|
                    // 指定返回的是一个不能被客户端读取的流,必须被下载
 | 
						|
                    Response.ContentType = "application/ms-excel";
 | 
						|
                    // 把文件流发送到客户端
 | 
						|
                    Response.WriteFile(filet.FullName);
 | 
						|
                    // 停止页面的执行
 | 
						|
                    Response.End();
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("请选择管线!", MessageBoxIcon.Warning);
 | 
						|
                return;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 关闭弹出窗口及刷新页面
 | 
						|
        /// <summary>
 | 
						|
        /// 关闭弹出窗口
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | 
						|
        {
 | 
						|
           // this.InitTreeMenu();//加载树
 | 
						|
            this.BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 查询
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void TextBox_TextChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            this.BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 查询
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void Tree_TextChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            this.InitTreeMenu();
 | 
						|
            this.BindGrid();
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 判断是否可删除
 | 
						|
        /// <summary>
 | 
						|
        /// 判断是否可以删除
 | 
						|
        /// </summary>
 | 
						|
        /// <returns></returns>
 | 
						|
        private bool judgementDelete(string id, bool isShow)
 | 
						|
        {
 | 
						|
            string content = string.Empty;
 | 
						|
            var jot = Funs.DB.PW_JointInfo.FirstOrDefault(x => x.JOT_ID == id);
 | 
						|
            if (jot != null)
 | 
						|
            {
 | 
						|
                if (!string.IsNullOrEmpty(jot.DReportID))
 | 
						|
                {
 | 
						|
                    var dr = Funs.DB.BO_WeldReportMain.FirstOrDefault(x => x.DReportID == jot.DReportID);
 | 
						|
                    if (dr != null)
 | 
						|
                    {
 | 
						|
                        content = "日报:"+dr.JOT_DailyReportNo+ "使用了该焊口,不能删除!";
 | 
						|
                    }
 | 
						|
                }                           
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                content = "删除焊口不存在!";
 | 
						|
            }
 | 
						|
            if (string.IsNullOrEmpty(content))
 | 
						|
            {
 | 
						|
                return true;
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                if (isShow)
 | 
						|
                {
 | 
						|
                    Alert.ShowInTop(content, MessageBoxIcon.Error);
 | 
						|
                }
 | 
						|
                return false;
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 导出焊口信息        
 | 
						|
        /// <summary>
 | 
						|
        /// 导出焊口初始信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnOut2_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            var iso = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(this.tvControlItem.SelectedNodeID);
 | 
						|
            if (iso != null)
 | 
						|
            {
 | 
						|
                PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("JointInfoOut.aspx?ISO_ID={0}", this.tvControlItem.SelectedNodeID, "导出 - ")));
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Alert.ShowInTop("请先选择一条管线!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 选择要显示列
 | 
						|
        /// <summary>
 | 
						|
        /// 选择显示列
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void btnSelectColumn_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("JointShowColumn.aspx", "显示列 - ")));
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 显示列
 | 
						|
        protected void Window4_Close(object sender, WindowCloseEventArgs e)
 | 
						|
        {
 | 
						|
            this.BindGrid();
 | 
						|
            //显示列
 | 
						|
            Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.UserId, "Joint");
 | 
						|
            if (c != null)
 | 
						|
            {
 | 
						|
                this.GetShowColumn(c.Columns);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 显示的列
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="column"></param>
 | 
						|
        private void GetShowColumn(string column)
 | 
						|
        {
 | 
						|
            if (!string.IsNullOrEmpty(column))
 | 
						|
            {
 | 
						|
                this.Grid1.Columns[1].Hidden = true;
 | 
						|
                this.Grid1.Columns[2].Hidden = true;
 | 
						|
                this.Grid1.Columns[3].Hidden = true;
 | 
						|
                this.Grid1.Columns[4].Hidden = true;
 | 
						|
                this.Grid1.Columns[5].Hidden = true;
 | 
						|
                this.Grid1.Columns[6].Hidden = true;
 | 
						|
                this.Grid1.Columns[7].Hidden = true;
 | 
						|
                this.Grid1.Columns[8].Hidden = true;
 | 
						|
                this.Grid1.Columns[9].Hidden = true;
 | 
						|
                this.Grid1.Columns[10].Hidden = true;
 | 
						|
                this.Grid1.Columns[11].Hidden = true;
 | 
						|
                this.Grid1.Columns[12].Hidden = true;
 | 
						|
                this.Grid1.Columns[13].Hidden = true;
 | 
						|
                this.Grid1.Columns[14].Hidden = true;
 | 
						|
                this.Grid1.Columns[15].Hidden = true;
 | 
						|
                this.Grid1.Columns[16].Hidden = true;
 | 
						|
                this.Grid1.Columns[17].Hidden = true;
 | 
						|
                this.Grid1.Columns[18].Hidden = true;
 | 
						|
                this.Grid1.Columns[19].Hidden = true;
 | 
						|
                this.Grid1.Columns[20].Hidden = true;
 | 
						|
                this.Grid1.Columns[21].Hidden = true;
 | 
						|
                this.Grid1.Columns[22].Hidden = true;
 | 
						|
                this.Grid1.Columns[23].Hidden = true;
 | 
						|
                this.Grid1.Columns[24].Hidden = true;
 | 
						|
                this.Grid1.Columns[25].Hidden = true;
 | 
						|
                this.Grid1.Columns[26].Hidden = true;
 | 
						|
                this.Grid1.Columns[27].Hidden = true;
 | 
						|
                this.Grid1.Columns[28].Hidden = true;
 | 
						|
                this.Grid1.Columns[29].Hidden = true;
 | 
						|
                this.Grid1.Columns[30].Hidden = true;
 | 
						|
                this.Grid1.Columns[31].Hidden = true;
 | 
						|
                this.Grid1.Columns[32].Hidden = true;
 | 
						|
                this.Grid1.Columns[33].Hidden = true;
 | 
						|
                this.Grid1.Columns[34].Hidden = true;
 | 
						|
                this.Grid1.Columns[35].Hidden = true;
 | 
						|
                this.Grid1.Columns[36].Hidden = true;
 | 
						|
                this.Grid1.Columns[37].Hidden = true;
 | 
						|
                this.Grid1.Columns[38].Hidden = true;
 | 
						|
                this.Grid1.Columns[39].Hidden = true;
 | 
						|
                this.Grid1.Columns[40].Hidden = true;
 | 
						|
                this.Grid1.Columns[41].Hidden = true;
 | 
						|
                this.Grid1.Columns[42].Hidden = true;
 | 
						|
                this.Grid1.Columns[43].Hidden = true;
 | 
						|
                this.Grid1.Columns[44].Hidden = true;
 | 
						|
                this.Grid1.Columns[45].Hidden = true;
 | 
						|
 | 
						|
                List<string> columns = column.Split(',').ToList();
 | 
						|
                foreach (var item in columns)
 | 
						|
                {
 | 
						|
                    this.Grid1.Columns[Convert.ToInt32(item)].Hidden = false;
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 获取按钮权限
 | 
						|
        /// <summary>
 | 
						|
        /// 获取按钮权限
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="button"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        private bool GetButtonPower(string button)
 | 
						|
        {
 | 
						|
            return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_JointInfoMenuId, button);
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region 查询
 | 
						|
        /// <summary>
 | 
						|
        /// 查询
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="sender"></param>
 | 
						|
        /// <param name="e"></param>
 | 
						|
        protected void txtJOT_JointNo_TextChanged(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            BindGrid();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        protected void btnQR_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            string strCode = "WeldedJoint$" + Grid1.SelectedRowID;
 | 
						|
            PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?JOT_ID={0}&strCode={1}", Grid1.SelectedRowID, strCode), "二维码查看", 400, 400));
 | 
						|
        }
 | 
						|
 | 
						|
        protected void betDel_Click(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (GetButtonPower(Const.BtnDelete))
 | 
						|
            {
 | 
						|
                var getMess = PW_JointInfoService.DelAllJots(this.CurrUser.LoginProjectId, this.tvControlItem.SelectedNodeID, this.txtJOT_JointNo.Text.Trim());
 | 
						|
                if (getMess != null)
 | 
						|
                {
 | 
						|
                    if (getMess.code == 1)
 | 
						|
                    {
 | 
						|
                        this.InitTreeMenu();//加载树
 | 
						|
                        this.BindGrid();//加载树
 | 
						|
                        ShowNotify(getMess.message, MessageBoxIcon.Success);
 | 
						|
                    }
 | 
						|
                    else
 | 
						|
                    {
 | 
						|
                        Alert.ShowInTop(getMess.message, MessageBoxIcon.Success);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |