651 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			651 lines
		
	
	
		
			28 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								using System.IO;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using Model;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.HJGL.HotProcessHard
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class HardTrust : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 定义项
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 硬度委托主键
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string HardTrustID
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["HardTrustID"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["HardTrustID"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加载页面
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                GetButtonPower();
							 | 
						|||
| 
								 | 
							
								                this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
							 | 
						|||
| 
								 | 
							
								                this.HardTrustID = string.Empty;
							 | 
						|||
| 
								 | 
							
								                this.InitTreeMenu();//加载树
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 获取按钮权限
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取按钮权限
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="button"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        private void GetButtonPower()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (Request.Params["value"] == "0")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_HotHardManageEditMenuId);
							 | 
						|||
| 
								 | 
							
								            if (buttonList.Count() > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnAdd))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnNew.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnSave))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnEdit.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnDelete))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnDelete.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #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
							 | 
						|||
| 
								 | 
							
								                                  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);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <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)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    TreeNode newNode1 = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                    newNode1.Text = q.WorkAreaCode;
							 | 
						|||
| 
								 | 
							
								                    newNode1.NodeID = q.WorkAreaId + "|" + node.NodeID;
							 | 
						|||
| 
								 | 
							
								                    newNode1.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                    newNode1.ToolTip = "区域";
							 | 
						|||
| 
								 | 
							
								                    node.Nodes.Add(newNode1);
							 | 
						|||
| 
								 | 
							
								                    this.BindNodes(newNode1, pInstallation, pWorkArea, pUnits);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (node.ToolTip == "区域")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                List<Model.HJGL_Hard_Trust> trustLists = new List<Model.HJGL_Hard_Trust>();
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtSearchNo.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    trustLists = (from x in Funs.DB.HJGL_Hard_Trust where x.HardTrustNo.Contains(this.txtSearchNo.Text.Trim()) && x.InstallationId == node.NodeID.Split('|')[2] && x.HardTrustUnit == node.NodeID.Split('|')[1] && x.WorkAreaId == node.NodeID.Split('|')[0] orderby x.HardTrustNo select x).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    trustLists = (from x in Funs.DB.HJGL_Hard_Trust where x.InstallationId == node.NodeID.Split('|')[2] && x.HardTrustUnit == node.NodeID.Split('|')[1] && x.WorkAreaId == node.NodeID.Split('|')[0] orderby x.HardTrustNo select x).ToList();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (var item in trustLists)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    TreeNode newNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                    newNode.Text = item.HardTrustNo;
							 | 
						|||
| 
								 | 
							
								                    newNode.NodeID = item.HardTrustID;
							 | 
						|||
| 
								 | 
							
								                    newNode.ToolTip = item.HardTrustNo;
							 | 
						|||
| 
								 | 
							
								                    newNode.CommandName = "委托单号";
							 | 
						|||
| 
								 | 
							
								                    newNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                    node.Nodes.Add(newNode);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 点击TreeView
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 点击TreeView
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_HotHardManageEditMenuId);
							 | 
						|||
| 
								 | 
							
								            if (this.tvControlItem.SelectedNode.CommandName == "建筑工程" || this.tvControlItem.SelectedNode.CommandName == "安装工程")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.btnNew.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                this.btnEdit.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                this.btnDelete.Hidden = true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (this.tvControlItem.SelectedNode.CommandName == "单位工程")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnAdd))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnNew.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                this.btnEdit.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                this.btnDelete.Hidden = true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (this.tvControlItem.SelectedNode.CommandName == "委托单号")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.btnNew.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnSave))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnEdit.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (buttonList.Contains(BLL.Const.BtnDelete))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.btnDelete.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            this.HardTrustID = tvControlItem.SelectedNodeID;
							 | 
						|||
| 
								 | 
							
								            this.BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 数据绑定
							 | 
						|||
| 
								 | 
							
								        protected void TextBox_TextChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 数据绑定
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void BindGrid()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.SetTextTemp();
							 | 
						|||
| 
								 | 
							
								            this.PageInfoLoad(); ///页面输入提交信息
							 | 
						|||
| 
								 | 
							
								            string strSql = string.Empty;
							 | 
						|||
| 
								 | 
							
								            List<SqlParameter> listStr = new List<SqlParameter>();
							 | 
						|||
| 
								 | 
							
								            if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.CommandName == "委托单号")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                strSql = @"SELECT * ,(CASE WHEN IsPass=1 THEN '合格' WHEN IsPass=0 THEN '不合格' WHEN IsPass IS NULL THEN '待检测' END) AS checkResult
							 | 
						|||
| 
								 | 
							
								                           FROM dbo.View_HJGL_Hard_TrustItem
							 | 
						|||
| 
								 | 
							
								                           WHERE HardTrustID=@HardTrustID";
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@HardTrustID", this.HardTrustID));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtISO_IsoNo.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += @" and ISO_IsoNo like @ISO_IsoNo ";
							 | 
						|||
| 
								 | 
							
								                    listStr.Add(new SqlParameter("@ISO_IsoNo", "%" + this.txtISO_IsoNo.Text.Trim() + "%"));
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += @" and 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);
							 | 
						|||
| 
								 | 
							
								                // 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();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加载页面输入提交信息
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面输入提交信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void PageInfoLoad()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.SimpleForm1.Reset(); ///重置所有字段
							 | 
						|||
| 
								 | 
							
								            var trust = Funs.DB.View_HJGL_Hard_Trust.FirstOrDefault(x => x.HardTrustID == this.HardTrustID);
							 | 
						|||
| 
								 | 
							
								            if (trust != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.txtHardTrustUnit.Text = BLL.UnitService.GetUnitNameByUnitId(trust.HardTrustUnit);
							 | 
						|||
| 
								 | 
							
								                this.txtCheckUnit.Text = BLL.UnitService.GetUnitNameByUnitId(trust.CheckUnit);
							 | 
						|||
| 
								 | 
							
								                this.txtHardTrustNo.Text = trust.HardTrustNo;
							 | 
						|||
| 
								 | 
							
								                if (trust.HardTrustDate != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.txtHardTrustDate.Text = string.Format("{0:yyyy-MM-dd}", trust.HardTrustDate);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                this.txtHardnessRate.Text = trust.HardnessRate;
							 | 
						|||
| 
								 | 
							
								                this.txtStandards.Text = trust.Standards;
							 | 
						|||
| 
								 | 
							
								                this.txtCheckName.Text = trust.CheckName;
							 | 
						|||
| 
								 | 
							
								                this.txtAcceptStandard.Text = trust.AcceptStandard;
							 | 
						|||
| 
								 | 
							
								                //this.txtInspectionNum.Text = trust.InspectionNum;
							 | 
						|||
| 
								 | 
							
								                //this.txtCheckNum.Text = trust.CheckNum;
							 | 
						|||
| 
								 | 
							
								                //this.txtTestWeldNum.Text = trust.TestWeldNum;
							 | 
						|||
| 
								 | 
							
								                //this.txtSendee.Text = trust.Sendee;
							 | 
						|||
| 
								 | 
							
								                //this.txtDetectionTime.Text = trust.DetectionTimeStr;
							 | 
						|||
| 
								 | 
							
								                //this.txtHardnessMethod.Text = trust.HardnessMethod;
							 | 
						|||
| 
								 | 
							
								                //this.txtCheckUnit.Text = trust.CheckUnitName;
							 | 
						|||
| 
								 | 
							
								                //this.txtHardTrustMan.Text = trust.HardTrustManName;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 情况
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void SetTextTemp()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.txtHardTrustNo.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								            this.txtHardTrustDate.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								            this.txtHardnessRate.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								            this.txtStandards.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								            this.txtCheckName.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								            this.txtAcceptStandard.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #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 btnNew_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_HotHardManageEditMenuId, Const.BtnAdd))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.ToolTip == "区域")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.SetTextTemp();
							 | 
						|||
| 
								 | 
							
								                    string window = String.Format("HardTrustEdit.aspx?WorkAreaId={0}&UnitId={1}&InstallationId={2}", tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNodeID.Split('|')[1], tvControlItem.SelectedNodeID.Split('|')[2], "新增 - ");
							 | 
						|||
| 
								 | 
							
								                    PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.hdHardTrustID.ClientID)
							 | 
						|||
| 
								 | 
							
								                      + Window1.GetShowReference(window));
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ShowNotify("请选择区域!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 编辑硬度委托
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 编辑硬度委托
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnEdit_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_HotHardManageEditMenuId, Const.BtnSave))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (this.tvControlItem.SelectedNode != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.HJGL_Hard_Trust trust = BLL.Hard_TrustService.GetHardTrustById(this.tvControlItem.SelectedNodeID);
							 | 
						|||
| 
								 | 
							
								                    if (trust != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        string window = String.Format("HardTrustEdit.aspx?HardTrustID={0}", this.HardTrustID, "编辑 - ");
							 | 
						|||
| 
								 | 
							
								                        PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.hdHardTrustID.ClientID)
							 | 
						|||
| 
								 | 
							
								                          + Window1.GetShowReference(window));
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        ShowNotify("请至少选择一条记录", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ShowNotify("请至少选择一条记录", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 删除硬度委托
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 删除硬度委托
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnDelete_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_HotHardManageEditMenuId, Const.BtnDelete))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (this.tvControlItem.SelectedNode != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.HJGL_Hard_Trust trust = BLL.Hard_TrustService.GetHardTrustById(this.tvControlItem.SelectedNodeID);
							 | 
						|||
| 
								 | 
							
								                    if (trust != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        var hardTrustItems = BLL.Hard_TrustItemService.GetHardTrustItemByHardTrustId(this.HardTrustID);
							 | 
						|||
| 
								 | 
							
								                        foreach (var hardTrustItem in hardTrustItems)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            ////更新热处理委托明细的口已做硬度委托
							 | 
						|||
| 
								 | 
							
								                            //Model.HJGL_HotProess_TrustItem hotProessTrustItem = BLL.HotProessTrustItemService.GetHotProessTrustItemById(hardTrustItem.HotProessTrustItemId);
							 | 
						|||
| 
								 | 
							
								                            //if (hotProessTrustItem != null)
							 | 
						|||
| 
								 | 
							
								                            //{
							 | 
						|||
| 
								 | 
							
								                            //    hotProessTrustItem.IsTrust = null;
							 | 
						|||
| 
								 | 
							
								                            //    BLL.HotProessTrustItemService.UpdateHotProessTrustItem(hotProessTrustItem);
							 | 
						|||
| 
								 | 
							
								                            //}
							 | 
						|||
| 
								 | 
							
								                            ////删除硬度报告记录
							 | 
						|||
| 
								 | 
							
								                            //BLL.Hard_ReportService.DeleteHard_ReportsByHardTrustItemID(hardTrustItem.HardTrustItemID);
							 | 
						|||
| 
								 | 
							
								                            if (hardTrustItem.IsPass != null)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                ShowNotify("已生成硬度检测报告,不能删除!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                                return;
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        foreach (var hardTrustItem in hardTrustItems)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            //更新热处理委托明细的口已做硬度委托
							 | 
						|||
| 
								 | 
							
								                            Model.HJGL_HotProess_TrustItem hotProessTrustItem = BLL.HotProessTrustItemService.GetHotProessTrustItemById(hardTrustItem.HotProessTrustItemId);
							 | 
						|||
| 
								 | 
							
								                            if (hotProessTrustItem != null)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                hotProessTrustItem.IsTrust = null;
							 | 
						|||
| 
								 | 
							
								                                BLL.HotProessTrustItemService.UpdateHotProessTrustItem(hotProessTrustItem);
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        BLL.Hard_TrustItemService.DeleteHardTrustItemById(this.HardTrustID);
							 | 
						|||
| 
								 | 
							
								                        BLL.Hard_TrustService.DeleteHardTrustById(this.HardTrustID);
							 | 
						|||
| 
								 | 
							
								                        //BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Resources.Lan.DeleteHardTrust);
							 | 
						|||
| 
								 | 
							
								                        Alert.ShowInTop("删除成功!", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								                        this.InitTreeMenu();
							 | 
						|||
| 
								 | 
							
								                        this.Grid1.DataSource = null;
							 | 
						|||
| 
								 | 
							
								                        this.Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								                        this.SetTextTemp();
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        ShowNotify("请选择要删除的记录", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ShowNotify("请选择要删除的记录", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 关闭弹出窗口及刷新页面
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 关闭弹出窗口
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Window1_Close(object sender, WindowCloseEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.HardTrustID = this.hdHardTrustID.Text;
							 | 
						|||
| 
								 | 
							
								            this.BindGrid();
							 | 
						|||
| 
								 | 
							
								            //this.InitTreeMenu();
							 | 
						|||
| 
								 | 
							
								            this.hdHardTrustID.Text = string.Empty;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 查询
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Tree_TextChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.InitTreeMenu();
							 | 
						|||
| 
								 | 
							
								            //this.BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 打印
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnPrint_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(this.HardTrustID))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            var trust = Funs.DB.View_HJGL_Hard_Trust.FirstOrDefault(x => x.HardTrustID == this.HardTrustID);
							 | 
						|||
| 
								 | 
							
								            if (trust != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string varValue = string.Empty;
							 | 
						|||
| 
								 | 
							
								                var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
							 | 
						|||
| 
								 | 
							
								                var TrustItem = Funs.DB.HJGL_Hard_TrustItem.FirstOrDefault(x=>x.HardTrustID==this.HardTrustID);
							 | 
						|||
| 
								 | 
							
								                var jointInfo = BLL.PW_JointInfoService.GetJointInfoByJotID(TrustItem.WeldJointId);
							 | 
						|||
| 
								 | 
							
								                var iso = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(jointInfo.ISO_ID);
							 | 
						|||
| 
								 | 
							
								                var PworkArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == iso.WorkAreaId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(PworkArea.InstallationId);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                int Count = Funs.DB.View_HJGL_Hard_TrustItem.Where(x => x.HardTrustID == this.HardTrustID).Count();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("HardTrustID", HardTrustID);
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("HardTrustNo", trust.HardTrustNo); 
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("CheckName", trust.CheckName  );
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("Standards", trust.Standards);
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("AcceptStandard", trust.AcceptStandard);
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("HardnessRate", trust.HardnessRate);
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("InstallName", installation.InstallationName);
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("pointCount", Count.ToString()); 
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("unitName1", BLL.UnitService.GetUnitNameByUnitId(trust.HardTrustUnit));
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("unitName2","" );
							 | 
						|||
| 
								 | 
							
								                var punit1 = ProjectUnitService.GetProjectUnitListByProjectIdUnitType(this.CurrUser.LoginProjectId, Const.ProjectUnitType_3);
							 | 
						|||
| 
								 | 
							
								                if (punit1.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var supUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == punit1[0].UnitId);
							 | 
						|||
| 
								 | 
							
								                    if (supUnit != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        keyValuePairs["unitName2"] = supUnit.UnitName;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                
							 | 
						|||
| 
								 | 
							
								                var punit = ProjectUnitService.GetProjectUnitListByProjectIdUnitType(this.CurrUser.LoginProjectId, Const.ProjectUnitType_4);
							 | 
						|||
| 
								 | 
							
								                if (punit.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var supUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == punit[0].UnitId);
							 | 
						|||
| 
								 | 
							
								                    if (supUnit != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        keyValuePairs["unitName3"] = supUnit.UnitName;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                } 
							 | 
						|||
| 
								 | 
							
								                keyValuePairs.Add("unitName4", BLL.UnitService.GetUnitNameByUnitId(trust.CheckUnit));
							 | 
						|||
| 
								 | 
							
								                BLL.Common.FastReportService.ResetData(); 
							 | 
						|||
| 
								 | 
							
								                BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                string initTemplatePath = "";
							 | 
						|||
| 
								 | 
							
								                string rootPath = Server.MapPath("~/");
							 | 
						|||
| 
								 | 
							
								                var sysSet = Funs.DB.Project_Sys_Set.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.SetId == "3").FirstOrDefault();
							 | 
						|||
| 
								 | 
							
								                if (sysSet != null && sysSet.IsAuto.HasValue && sysSet.IsAuto.Value)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    initTemplatePath = "File\\Fastreport\\硬度检测委托单NoPic.frx";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    initTemplatePath = "File\\Fastreport\\硬度检测委托单.frx";
							 | 
						|||
| 
								 | 
							
								                } 
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (File.Exists(rootPath + initTemplatePath))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |