1174 lines
54 KiB
C#
1174 lines
54 KiB
C#
using BLL;
|
|
using NPOI.SS.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
{
|
|
public partial class JotTwoDesign : PageBase
|
|
{
|
|
public int pageSize = 20;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
Funs.FineUIPleaseSelect(DropTwoJointType, "请选择");
|
|
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, true);
|
|
this.InitTreeMenu();//加载树
|
|
|
|
}
|
|
}
|
|
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
|
|
#region 加载树装置-单位-工作区
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
|
|
TreeNode rootNode1 = new TreeNode();
|
|
rootNode1.NodeID = "1";
|
|
rootNode1.Text = "建筑工程";
|
|
rootNode1.CommandName = "建筑工程";
|
|
rootNode1.Selectable = false;
|
|
this.tvControlItem.Nodes.Add(rootNode1);
|
|
|
|
TreeNode rootNode2 = new TreeNode();
|
|
rootNode2.NodeID = "2";
|
|
rootNode2.Text = "安装工程";
|
|
rootNode2.CommandName = "安装工程";
|
|
rootNode2.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode2);
|
|
|
|
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
// 获取当前用户所在单位
|
|
var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
|
|
|
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
|
|
select x).ToList();
|
|
|
|
List<Model.WBS_UnitWork> unitWork1 = null;
|
|
List<Model.WBS_UnitWork> unitWork2 = null;
|
|
|
|
//// 当前为施工单位,只能操作本单位的数据
|
|
//if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
|
|
//{
|
|
// unitWork1 = (from x in unitWorkList
|
|
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
|
|
// select x).ToList();
|
|
// unitWork2 = (from x in unitWorkList
|
|
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
|
|
// select x).ToList();
|
|
//}
|
|
//else
|
|
//{
|
|
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
|
|
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
|
//}
|
|
|
|
if (unitWork1.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork1)
|
|
{
|
|
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn1 = new TreeNode();
|
|
tn1.NodeID = q.UnitWorkId;
|
|
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
tn1.EnableClickEvent = true;
|
|
tn1.EnableExpandEvent = true;
|
|
rootNode1.Nodes.Add(tn1);
|
|
if (a > 0)
|
|
{
|
|
// BindNodes(tn1);
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
tn1.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
if (unitWork2.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork2)
|
|
{
|
|
int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x).Count();
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn2 = new TreeNode();
|
|
tn2.NodeID = q.UnitWorkId;
|
|
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
if (q.UnitWorkId == this.hdUnitWorkId.Text)
|
|
{
|
|
tn2.Expanded = true;
|
|
}
|
|
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
tn2.EnableClickEvent = true;
|
|
tn2.EnableExpandEvent = true;
|
|
rootNode2.Nodes.Add(tn2);
|
|
if (a > 0)
|
|
{
|
|
// BindNodes(tn1);
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载管线...";
|
|
newNode.NodeID = "加载管线...";
|
|
tn2.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
private void BindNodes(TreeNode node)
|
|
{
|
|
List<Model.HJGL_Pipeline> pipeline = new List<Model.HJGL_Pipeline>();
|
|
pipeline = (from x in Funs.DB.HJGL_Pipeline
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID
|
|
&& x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())
|
|
orderby x.PipelineCode
|
|
select x).ToList();
|
|
var hJGL_WeldJoints = (from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
|
|
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
|
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
|
if (pageindex <= pageCount)
|
|
{
|
|
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
|
|
|
foreach (var item in pipeline)
|
|
{
|
|
//var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == true select x).Count();
|
|
//var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == true && x.WeldingDailyId != null select x).Count();
|
|
//TreeNode newNode = new TreeNode();
|
|
//if (jotCount > weldJotCount)
|
|
//{
|
|
// newNode.Text = "<font color='#EE0000'>" + item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】" + "</font>";
|
|
//}
|
|
//else
|
|
//{
|
|
// newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
|
//}
|
|
|
|
var jotCount = (from x in hJGL_WeldJoints where x.PipelineId == item.PipelineId && x.IsTwoJoint == true select x).Count();
|
|
var AuditCount = (from x in hJGL_WeldJoints where x.PipelineId == item.PipelineId && x.IsTwoJoint == true && x.AuditDate != null select x).Count();
|
|
TreeNode newNode = new TreeNode();
|
|
|
|
//if (jotCount == AuditCount) //全部审核
|
|
//{
|
|
// newNode.Text = "<font color='#00FF00'>" + item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】" + "</font>";
|
|
|
|
//}
|
|
//else if (AuditCount == 0) //全部未审核
|
|
//{
|
|
// newNode.Text = "<font color='#FF0000'>" + item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】" + "</font>";
|
|
|
|
//}
|
|
//else //部分审核
|
|
//{
|
|
// newNode.Text = "<font color='#B9B925'>" + item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】" + "</font>";
|
|
|
|
//}
|
|
newNode.Text = item.PipelineCode + "【" + jotCount.ToString() + " " + "焊口" + "】";
|
|
newNode.ToolTip = "管线号【焊口数】";
|
|
newNode.NodeID = item.PipelineId;
|
|
newNode.EnableClickEvent = true;
|
|
node.Nodes.Add(newNode);
|
|
}
|
|
if (pageindex < pageCount)
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = "加载";
|
|
newNode.NodeID = SQLHelper.GetNewID();
|
|
newNode.CommandName = "加载";
|
|
newNode.Icon = Icon.ArrowDown;
|
|
newNode.EnableClickEvent = true;
|
|
node.Nodes.Add(newNode);
|
|
}
|
|
}
|
|
}
|
|
|
|
#region 点击TreeView
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
this.hdUnitWorkId.Text = string.Empty;
|
|
|
|
if (e.CommandName == "加载")
|
|
{
|
|
string CommandName = e.Node.ParentNode.CommandName;
|
|
e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]);
|
|
TreeNode treeNode = e.Node.ParentNode;
|
|
treeNode.Nodes.Remove(e.Node);
|
|
BindNodes(e.Node.ParentNode);
|
|
}
|
|
else
|
|
{
|
|
if (pipeline != null)
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
|
this.BindGrid();
|
|
}
|
|
else
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
|
NoAuditBindGrid();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
|
{
|
|
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
|
{
|
|
e.Node.Nodes.Clear();
|
|
BindNodes(e.Node);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT WeldJointId,WeldJointCode,PipelineId,PipelineCode,JointAttribute,TwoJointType,
|
|
ComponentsCode1,ComponentsCode2,IsWelding,IsHotProessStr,Material1Code,Material2Code,
|
|
WeldTypeCode,Specification,HeartNo1,HeartNo2,Size,Dia,Thickness,GrooveTypeCode,
|
|
WeldingMethodCode,WeldingWireCode,WeldingRodCode,WeldingDate,WeldingDailyCode,
|
|
BackingWelderCode,CoverWelderCode,MediumCode ,PreTemperature,JointArea,WPQCode,Remark,
|
|
(CASE WHEN AuditDate IS NOT NULL THEN '已审核' ELSE '未审核' END) AS IsAudit,
|
|
subMan.PersonName AS SubmitMan,auditMan.PersonName AS AuditMan,AuditDate,auditMan2.PersonName AS AuditMan2,AuditDate2
|
|
FROM View_HJGL_WeldJoint
|
|
LEFT JOIN dbo.Person_Persons auditMan ON auditMan.PersonId=View_HJGL_WeldJoint.AuditMan
|
|
LEFT JOIN dbo.Person_Persons auditMan2 ON auditMan2.PersonId=View_HJGL_WeldJoint.AuditMan2
|
|
LEFT JOIN dbo.Person_Persons subMan ON subMan.PersonId=View_HJGL_WeldJoint.SubmitMan
|
|
WHERE IsTwoJoint = 1";
|
|
List<SqlParameter> listStr = new List<SqlParameter> { };
|
|
|
|
strSql += " AND PipelineId =@PipelineId";
|
|
listStr.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID));
|
|
|
|
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WeldJointCode LIKE @WeldJointCode";
|
|
listStr.Add(new SqlParameter("@WeldJointCode", "%" + this.txtWeldJointCode.Text.Trim() + "%"));
|
|
}
|
|
if (DropTwoJointType.SelectedValue != BLL.Const._Null)
|
|
{
|
|
strSql += " AND TwoJointType = @TwoJointType";
|
|
listStr.Add(new SqlParameter("@TwoJointType", DropTwoJointType.SelectedValue));
|
|
}
|
|
if (rbIsAudit.SelectedValue != "2")
|
|
{
|
|
if (rbIsAudit.SelectedValue == "0")
|
|
{
|
|
strSql += " and AuditDate is null";
|
|
}
|
|
else
|
|
{
|
|
strSql += " and AuditDate is not null";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtAuditDate.Text.Trim()))
|
|
{
|
|
strSql += " AND CONVERT(VARCHAR(20),AuditDate,23) =@AuditDate";
|
|
listStr.Add(new SqlParameter("@AuditDate", this.txtAuditDate.Text.Trim()));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
decimal? d = 0;
|
|
var SizeSum = tb.AsEnumerable().Select(x => x.Field<decimal?>("Size") ?? d).Sum();
|
|
lbSize.Text = SizeSum.ToString();
|
|
// 2.获取当前分页数据
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
private void NoAuditBindGrid()
|
|
{
|
|
string strSql = @"SELECT WeldJointId,WeldJointCode,PipelineId,PipelineCode,JointAttribute,TwoJointType,
|
|
ComponentsCode1,ComponentsCode2,IsWelding,IsHotProessStr,Material1Code,Material2Code,
|
|
WeldTypeCode,Specification,HeartNo1,HeartNo2,Size,Dia,Thickness,GrooveTypeCode,
|
|
WeldingMethodCode,WeldingWireCode,WeldingRodCode,WeldingDate,WeldingDailyCode,
|
|
BackingWelderCode,CoverWelderCode,MediumCode ,PreTemperature,JointArea,WPQCode,Remark,
|
|
(CASE WHEN AuditDate IS NOT NULL THEN '已审核' ELSE '未审核' END) AS IsAudit,
|
|
subMan.PersonName AS SubmitMan,auditMan.PersonName AS AuditMan,AuditDate
|
|
FROM View_HJGL_WeldJoint
|
|
LEFT JOIN dbo.Person_Persons auditMan ON auditMan.PersonId=View_HJGL_WeldJoint.AuditMan
|
|
LEFT JOIN dbo.Person_Persons subMan ON subMan.PersonId=View_HJGL_WeldJoint.SubmitMan
|
|
WHERE IsTwoJoint = 1";
|
|
List<SqlParameter> listStr = new List<SqlParameter> { };
|
|
|
|
strSql += " AND UnitWorkId =@UnitWorkId";
|
|
listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID));
|
|
|
|
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
|
|
{
|
|
strSql += " AND WeldJointCode LIKE @WeldJointCode";
|
|
listStr.Add(new SqlParameter("@WeldJointCode", "%" + this.txtWeldJointCode.Text.Trim() + "%"));
|
|
}
|
|
if (DropTwoJointType.SelectedValue != BLL.Const._Null)
|
|
{
|
|
strSql += " AND TwoJointType = @TwoJointType";
|
|
listStr.Add(new SqlParameter("@TwoJointType", DropTwoJointType.SelectedValue));
|
|
}
|
|
if (rbIsAudit.SelectedValue != "2")
|
|
{
|
|
if (rbIsAudit.SelectedValue == "0")
|
|
{
|
|
strSql += " and AuditDate is null";
|
|
}
|
|
else
|
|
{
|
|
strSql += " and AuditDate is not null";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtAuditDate.Text.Trim()))
|
|
{
|
|
strSql += " AND CONVERT(VARCHAR(20),AuditDate,23) =@AuditDate";
|
|
listStr.Add(new SqlParameter("@AuditDate", this.txtAuditDate.Text.Trim()));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
var SizeSum = tb.AsEnumerable().Select(x => x.Field<decimal>("Size")).Sum();
|
|
lbSize.Text = SizeSum.ToString();
|
|
// 2.获取当前分页数据
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
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)
|
|
{
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
this.hdUnitWorkId.Text = string.Empty;
|
|
if (pipeline != null)
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
|
this.BindGrid();
|
|
}
|
|
else
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
|
NoAuditBindGrid();
|
|
}
|
|
|
|
|
|
}
|
|
#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 (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(Grid1.SelectedRowID) != null) //已下任务单,不可修改数据
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointView.aspx?WeldJointId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?WeldJointId={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <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.PersonId, Const.HJGL_JotTwoDesignMenuId, Const.BtnAdd))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?PipelineId={0}&&IsTwoJoint=1", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 批量增加焊口信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnBatchAdd_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_JotTwoDesignMenuId, Const.BtnAdd))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointBatchEdit.aspx?PipelineId={0}&&IsTwoJoint=1", this.tvControlItem.SelectedNodeID, "新增 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 自动录入
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAutoInput_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnit.SelectedValue == BLL.Const._Null)
|
|
{
|
|
ShowNotify("请选择工艺规程编制单位!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
|
|
{
|
|
var jotList = from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == tvControlItem.SelectedNodeID && x.WPQId == null && x.IsTwoJoint == true select x;
|
|
if (jotList.Count() > 0)
|
|
{
|
|
foreach (var jot in jotList)
|
|
{
|
|
List<Model.View_HJGL_WPQ> wpqList = BLL.WPQListServiceService.GetMatchWPQ(jot, this.CurrUser.LoginProjectId, drpUnit.SelectedValue);
|
|
if (wpqList != null)
|
|
{
|
|
Model.HJGL_WeldJoint newJot = WeldJointService.GetWeldJointByWeldJointId(jot.WeldJointId);
|
|
Model.WPQ_WPQList wps = new Model.WPQ_WPQList();
|
|
var a = wpqList.FirstOrDefault(x => x.WeldingMethodId == "feb1234c-a538-476f-99ac-7b3ab15997c1"); //优先匹配GTAW+SMAW的焊评
|
|
if (a == null)
|
|
{
|
|
wps = BLL.WPQListServiceService.GetWPQById(wpqList.First().WPQId);
|
|
}
|
|
else
|
|
{
|
|
wps = BLL.WPQListServiceService.GetWPQById(a.WPQId);
|
|
}
|
|
|
|
newJot.WPQId = wps.WPQId;
|
|
newJot.WeldJointId = jot.WeldJointId;
|
|
newJot.WeldingRod = wps.WeldingRod;
|
|
newJot.WeldingWire = wps.WeldingWire;
|
|
newJot.WeldingMethodId = wps.WeldingMethodId;
|
|
newJot.GrooveTypeId = wps.GrooveType;
|
|
newJot.PreTemperature = wps.PreTemperature;
|
|
newJot.IsHotProess = wps.IsHotProess;
|
|
newJot.MatchableWPQ = string.Join(",", wpqList.Select(x => x.WPQCode));
|
|
BLL.WeldJointService.UpdateConWeldJoint(newJot);
|
|
}
|
|
}
|
|
}
|
|
BindGrid();
|
|
ShowNotify("该管线焊口已完成自动录入!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 焊口信息编辑
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(Grid1.SelectedRowID) != null) //已下任务单,不可修改数据
|
|
{
|
|
Alert.ShowInTop("该焊口已生成焊接任务单,不能编辑!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?WeldJointId={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnAudit_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnAuditing))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string[] weldJointIdList = Grid1.SelectedRowIDArray;
|
|
foreach (string jot in weldJointIdList)
|
|
{
|
|
BLL.WeldJointService.UpdateJointAudit(jot, CurrUser.PersonId, DateTime.Now);
|
|
}
|
|
ShowNotify("所选口审核成功!", MessageBoxIcon.Success);
|
|
BindGrid();
|
|
//string weldJointIdList = string.Join("|", Grid1.SelectedRowIDArray);
|
|
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TwoJointAudit.aspx?WeldJointIdList={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnAudit2_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnAuditing))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string[] weldJointIdList = Grid1.SelectedRowIDArray;
|
|
foreach (string jot in weldJointIdList)
|
|
{
|
|
BLL.WeldJointService.UpdateJointAudit2(jot, CurrUser.PersonId, DateTime.Now);
|
|
}
|
|
ShowNotify("所选口审核成功!", MessageBoxIcon.Success);
|
|
BindGrid();
|
|
//string weldJointIdList = string.Join("|", Grid1.SelectedRowIDArray);
|
|
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TwoJointAudit.aspx?WeldJointIdList={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnCancelAudit_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnAuditing))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string[] weldJointIdList = Grid1.SelectedRowIDArray;
|
|
foreach (string jot in weldJointIdList)
|
|
{
|
|
BLL.WeldJointService.UpdateJointAudit(jot, null, null);
|
|
}
|
|
ShowNotify("已取消所选口的审核!", MessageBoxIcon.Success);
|
|
BindGrid();
|
|
//string weldJointIdList = string.Join("|", Grid1.SelectedRowIDArray);
|
|
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TwoJointAudit.aspx?WeldJointIdList={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void btnCancelAudit2_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnAuditing))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string[] weldJointIdList = Grid1.SelectedRowIDArray;
|
|
foreach (string jot in weldJointIdList)
|
|
{
|
|
BLL.WeldJointService.UpdateJointAudit2(jot, null, null);
|
|
}
|
|
ShowNotify("已取消所选口的审核!", MessageBoxIcon.Success);
|
|
BindGrid();
|
|
//string weldJointIdList = string.Join("|", Grid1.SelectedRowIDArray);
|
|
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TwoJointAudit.aspx?WeldJointIdList={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 焊口信息插入
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuInsert_Click(object sender, EventArgs e)
|
|
{
|
|
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_JotTwoDesignMenuId, BLL.Const.BtnModify))
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointEdit.aspx?WeldJointId={0}&Type=add", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 焊口信息查看
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnView_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WeldJointView.aspx?WeldJointId={0}", Grid1.SelectedRowID, "维护 - ")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_JotTwoDesignMenuId, 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.WeldJointService.DeleteWeldJointById(rowID);
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
//BLL.Sys_LogService.AddLog(BLL.Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_WeldJointMenuId, Const.BtnDelete, rowID);
|
|
}
|
|
}
|
|
this.InitTreeMenu();//加载树
|
|
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 pipelineId = this.tvControlItem.SelectedNodeID;
|
|
var q = BLL.PipelineService.GetPipelineByPipelineId(pipelineId);
|
|
|
|
if (q != null)
|
|
{
|
|
var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId select x).Count();
|
|
var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId && x.WeldingDailyId != null select x).Count();
|
|
if (jotCount == weldJotCount)
|
|
{
|
|
string varValue = string.Empty;
|
|
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
|
if (project != null)
|
|
{
|
|
varValue = project.ProjectName;
|
|
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(q.UnitWorkId);
|
|
if (unitWork != null)
|
|
{
|
|
varValue = varValue + "|" + unitWork.UnitWorkName;
|
|
}
|
|
}
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@IsoId", pipelineId));
|
|
listStr.Add(new SqlParameter("@Flag", "0"));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter);
|
|
string page = Funs.GetPagesCountByPageSize(11, 16, tb.Rows.Count).ToString();
|
|
|
|
|
|
varValue = varValue + "|" + page;
|
|
|
|
if (!string.IsNullOrEmpty(varValue))
|
|
{
|
|
varValue = HttpUtility.UrlEncodeUnicode(varValue);
|
|
}
|
|
if (tb.Rows.Count <= 11)
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
|
}
|
|
else
|
|
{
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport2Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择焊接完成管线!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
ShowNotify("请选择管线!", 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();
|
|
}
|
|
|
|
protected void btnTreeFind_Click(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;
|
|
if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(id) != null)
|
|
{
|
|
content = "该焊口已生成焊接任务单,不能删除!";
|
|
}
|
|
//if (!string.IsNullOrEmpty(BLL.WeldJointService.GetWeldJointByWeldJointId(id).WeldingDailyId))
|
|
//{
|
|
// content = "该焊口已焊接,不能删除!";
|
|
//}
|
|
//if (BLL.Funs.DB.HJGL_HotProess_TrustItem.FirstOrDefault(x => x.WeldJointId == id) != null)
|
|
//{
|
|
// content = "热处理已经使用了该焊口,不能删除!";
|
|
//}
|
|
|
|
if (string.IsNullOrEmpty(content))
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
if (isShow)
|
|
{
|
|
Alert.ShowInTop(content, MessageBoxIcon.Error);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出焊口信息
|
|
/// 导出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
string rootPath = Server.MapPath("~/");
|
|
string initTemplatePath = string.Empty;
|
|
string uploadfilepath = string.Empty;
|
|
string newUrl = string.Empty;
|
|
string filePath = string.Empty;
|
|
initTemplatePath = Const.JotTwoDesignTemplateUrl;
|
|
uploadfilepath = rootPath + initTemplatePath;
|
|
string constructionLogId = this.tvControlItem.SelectedNodeID;
|
|
Model.SGGLDB db = Funs.DB;
|
|
var workEfficiencys = from x in db.ZHGL_ConstructionLogWorkEfficiency
|
|
where x.ConstructionLogId == constructionLogId
|
|
select x;
|
|
var persons = from x in db.ZHGL_ConstructionLogPerson
|
|
where x.ConstructionLogId == constructionLogId
|
|
select x;
|
|
var machines = from x in db.ZHGL_ConstructionLogMachine
|
|
where x.ConstructionLogId == constructionLogId
|
|
select x;
|
|
if (this.Grid1.Rows.Count > 0)
|
|
{
|
|
newUrl = uploadfilepath.Replace(".xlsx", "(" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ")" + ".xlsx");
|
|
File.Copy(uploadfilepath, newUrl);
|
|
// 第一步:读取文件流
|
|
NPOI.SS.UserModel.IWorkbook workbook;
|
|
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
|
{
|
|
workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
|
}
|
|
// 创建单元格样式
|
|
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
|
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
|
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
|
cellStyle0.WrapText = true;
|
|
var font = workbook.CreateFont();
|
|
font.FontHeightInPoints = 11;
|
|
font.IsBold = false;
|
|
cellStyle0.SetFont(font);
|
|
// 第二步:创建新数据行
|
|
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
|
int rowCount = 2;
|
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
|
{
|
|
NPOI.SS.UserModel.IRow row1 = sheet.CreateRow(rowCount);
|
|
NPOI.SS.UserModel.ICell cell;
|
|
cell = row1.CreateCell(0);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue((i + 1).ToString());
|
|
cell = row1.CreateCell(1);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[2].ToString());
|
|
cell = row1.CreateCell(2);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[3].ToString());
|
|
cell = row1.CreateCell(3);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[4].ToString());
|
|
cell = row1.CreateCell(4);
|
|
cell.CellStyle = cellStyle0;
|
|
string date1 = this.Grid1.Rows[i].Values[5].ToString();
|
|
if (!string.IsNullOrEmpty(date1))
|
|
{
|
|
date1 = string.Format("{0:yyyy-MM-dd}", Funs.GetNewDateTime(date1));
|
|
}
|
|
cell.SetCellValue(date1);
|
|
cell = row1.CreateCell(5);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[6].ToString());
|
|
cell = row1.CreateCell(6);
|
|
cell.CellStyle = cellStyle0;
|
|
string date2 = this.Grid1.Rows[i].Values[7].ToString();
|
|
if (!string.IsNullOrEmpty(date2))
|
|
{
|
|
date2 = string.Format("{0:yyyy-MM-dd}", Funs.GetNewDateTime(date2));
|
|
}
|
|
cell.SetCellValue(date2);
|
|
cell = row1.CreateCell(7);
|
|
cell.CellStyle = cellStyle0;
|
|
string weldJointCode = string.Empty;
|
|
var weldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(this.Grid1.Rows[i].RowID);
|
|
if (weldJoint != null)
|
|
{
|
|
weldJointCode = weldJoint.WeldJointCode;
|
|
}
|
|
cell.SetCellValue(weldJointCode);
|
|
cell = row1.CreateCell(8);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[10].ToString());
|
|
cell = row1.CreateCell(9);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[11].ToString());
|
|
cell = row1.CreateCell(10);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[12].ToString());
|
|
cell = row1.CreateCell(11);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[13].ToString());
|
|
cell = row1.CreateCell(12);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[14].ToString());
|
|
cell = row1.CreateCell(13);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[15].ToString());
|
|
cell = row1.CreateCell(14);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[16].ToString());
|
|
cell = row1.CreateCell(15);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[17].ToString());
|
|
cell = row1.CreateCell(16);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[18].ToString());
|
|
cell = row1.CreateCell(17);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[20].ToString());
|
|
cell = row1.CreateCell(18);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[21].ToString());
|
|
cell = row1.CreateCell(19);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[22].ToString());
|
|
cell = row1.CreateCell(20);
|
|
cell.CellStyle = cellStyle0;
|
|
cell.SetCellValue(this.Grid1.Rows[i].Values[27].ToString());
|
|
rowCount++;
|
|
}
|
|
|
|
|
|
|
|
|
|
// 第三步:写入文件流
|
|
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
|
{
|
|
workbook.Write(stream);
|
|
workbook.Close();
|
|
}
|
|
|
|
|
|
|
|
|
|
string fileName = Path.GetFileName(newUrl);
|
|
FileInfo info = new FileInfo(newUrl);
|
|
long fileSize = info.Length;
|
|
Response.Clear();
|
|
Response.ContentType = "application/x-zip-compressed";
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
Response.AddHeader("Content-Length", fileSize.ToString());
|
|
Response.TransmitFile(newUrl, 0, fileSize);
|
|
Response.Flush();
|
|
Response.Close();
|
|
File.Delete(newUrl);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("无数据可导出!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 导出焊口初始信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnOut2_Click(object sender, EventArgs e)
|
|
{
|
|
//var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
//if (iso != null)
|
|
//{
|
|
// Response.ClearContent();
|
|
// string filename = Funs.GetNewFileName();
|
|
// Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(Resources.Lan.WeldingJointInfo + filename, System.Text.Encoding.UTF8) + ".xls");
|
|
// Response.ContentType = "application/excel";
|
|
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
// this.Grid1.PageSize = 100000;
|
|
// this.BindGrid();
|
|
// Response.Write(GetGridTableHtml(Grid1));
|
|
// Response.End();
|
|
//}
|
|
//else
|
|
//{
|
|
// Alert.ShowInTop("请选择"PipelinetFirst, MessageBoxIcon.Warning);
|
|
//}
|
|
}
|
|
#endregion
|
|
|
|
#region 选择要显示列
|
|
/// <summary>
|
|
/// 选择显示列
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSelectColumn_Click(object sender, EventArgs e)
|
|
{
|
|
//((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[0];
|
|
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.PersonId, "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;
|
|
//((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[0].Hidden = true;
|
|
//((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[1].Hidden = true;
|
|
//((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[2].Hidden = true;
|
|
//((FineUIPro.GroupField)this.Grid1.Columns[1]).Columns[3].Hidden = true;
|
|
this.Grid1.Columns[2].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[0].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[1].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[2].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[3].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[4].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[5].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[6].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[7].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[2]).Columns[8].Hidden = true;
|
|
this.Grid1.Columns[3].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[0].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[1].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[2].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[3].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[4].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[5].Hidden = true;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[3]).Columns[6].Hidden = true;
|
|
this.Grid1.Columns[4].Hidden = true;
|
|
List<string> columns = column.Split(',').ToList();
|
|
foreach (var item in columns)
|
|
{
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
if (item.Length == 1)
|
|
{
|
|
this.Grid1.Columns[Convert.ToInt32(item)].Hidden = false;
|
|
}
|
|
else
|
|
{
|
|
int c1 = Convert.ToInt32(item.Substring(0, 1));
|
|
int c2 = Convert.ToInt32(item.Substring(1, 1));
|
|
this.Grid1.Columns[c1].Hidden = false;
|
|
((FineUIPro.GroupField)this.Grid1.Columns[c1]).Columns[c2].Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void rbIsAudit_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
this.hdUnitWorkId.Text = string.Empty;
|
|
if (pipeline != null)
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
|
this.BindGrid();
|
|
}
|
|
else
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
|
NoAuditBindGrid();
|
|
}
|
|
}
|
|
|
|
protected void txtAuditDate_TextChanged(object sender, EventArgs e)
|
|
{
|
|
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
|
this.hdUnitWorkId.Text = string.Empty;
|
|
if (pipeline != null)
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
|
this.BindGrid();
|
|
}
|
|
else
|
|
{
|
|
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID;
|
|
NoAuditBindGrid();
|
|
}
|
|
}
|
|
}
|
|
} |