xinjiang/SGGL/FineUIPro.Web/HJGL/WeldingManage/PipelineManage.aspx.cs

825 lines
33 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class PipelineManage : PageBase
{
public string treeNodeId
{
get
{
return (string)ViewState["treeNodeId"];
}
set
{
ViewState["treeNodeId"] = value;
}
}
public string unitId
{
get
{
return (string)ViewState["unitId"];
}
set
{
ViewState["unitId"] = value;
}
}
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
BLL.Base_TestMediumService.InitMediumDropDownList(this.drpSer, true);//介质
BLL.Base_DetectionTypeService.InitDetectionTypeDropDownList(this.drpNDT, true);//探伤类型
BLL.Base_MaterialService.InitMaterialDropDownList(this.drpSteId, true,this.CurrUser.LoginProjectId);//材质
ListItem[] lis = new ListItem[3];
lis[0] = new ListItem("- 请选择 -", "");
lis[1] = new ListItem("是","1");
lis[2] = new ListItem("否", "0");
this.drpIsStanded.DataValueField = "Value";
this.drpIsStanded.DataTextField = "Text";
this.drpIsStanded.DataSource = lis;
this.drpIsStanded.DataBind();
this.drpIsStanded.SelectedIndex = 0;
this.InitTreeMenu();//加载树
//显示列
Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.UserId, "Iso");
if (c != null)
{
this.GetShowColumn(c.Columns);
}
}
}
#endregion
#region --
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
TreeNode rootNode = new TreeNode();
rootNode.Text = "装置-单位-工作区";
rootNode.NodeID = "0";
rootNode.Expanded = true;
this.tvControlItem.Nodes.Add(rootNode);
////装置
var pInstallation = (from x in Funs.DB.Project_Installation where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
////区域
var pWorkArea = (from x in Funs.DB.ProjectData_WorkArea where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
////单位
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
if (!string.IsNullOrEmpty(this.txtWorkArea.Text))
{
pWorkArea = pWorkArea.Where(x => x.WorkAreaCode.Contains(this.txtWorkArea.Text.Trim())).OrderBy(x => x.WorkAreaCode).ToList();
pInstallation = (from x in pInstallation
join y in pWorkArea on x.InstallationId equals y.InstallationId
select x).Distinct().ToList();
pUnits = (from x in pUnits
join y in pWorkArea on x.UnitId equals y.UnitId
select x).Distinct().ToList();
}
this.BindNodes(rootNode, pInstallation, pWorkArea, pUnits);
}
#endregion
#region
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
private void BindNodes(TreeNode node, List<Model.Project_Installation> pInstallation, List<Model.ProjectData_WorkArea> pWorkArea, List<Model.Project_ProjectUnit> pUnits)
{
if (string.IsNullOrEmpty(node.ToolTip))
{
List<Model.Project_Installation> installations = pInstallation;
var pUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
if (pUnit != null && pUnit.UnitType != Const.ProjectUnitType_1 && pUnit.UnitType != Const.ProjectUnitType_5)
{
installations = (from x in pInstallation
join y in pWorkArea on x.InstallationId equals y.InstallationId
where y.UnitId == this.CurrUser.UnitId
orderby x.InstallationId
select x).Distinct().ToList();
}
foreach (var q in installations)
{
TreeNode newNode = new TreeNode();
newNode.NodeID = q.InstallationId;
newNode.Text = q.InstallationName;
newNode.ToolTip = "装置";
newNode.Expanded = true;
node.Nodes.Add(newNode);
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
}
}
else if (node.ToolTip == "装置")
{
List<Model.Project_ProjectUnit> units = null;
var pUnitDepth = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
if (pUnitDepth == null || pUnitDepth.UnitType == Const.ProjectUnitType_1 || pUnitDepth.UnitType == Const.ProjectUnitType_5)
{
units = (from x in pUnits
join y in pWorkArea on x.UnitId equals y.UnitId
where y.InstallationId == node.NodeID && x.UnitType == Const.ProjectUnitType_2
select x).ToList();
}
else
{
units = (from x in pUnits
join y in pWorkArea on x.UnitId equals y.UnitId
where y.InstallationId == node.NodeID && x.UnitType == Const.ProjectUnitType_2 && x.UnitId == this.CurrUser.UnitId
select x).ToList();
}
units = units.OrderBy(x => x.InTime).Distinct().ToList();
foreach (var q in units)
{
var unit = BLL.UnitService.GetUnitByUnitId(q.UnitId);
if (unit != null)
{
TreeNode newNode = new TreeNode();
newNode.Text = unit.UnitName;
newNode.NodeID = q.UnitId + "|" + node.NodeID;
newNode.ToolTip = "单位";
node.Nodes.Add(newNode);
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
}
}
}
else if (node.ToolTip == "单位")
{
var workAreas = (from x in pWorkArea
where x.InstallationId == node.ParentNode.NodeID && x.UnitId == node.NodeID.Split('|')[0]
select x);
workAreas = workAreas.OrderByDescending(x => x.WorkAreaCode);
foreach (var q in workAreas)
{
int a = (from x in BLL.Funs.DB.PW_IsoInfo where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitId == node.NodeID.Split('|')[0] && x.WorkAreaId == q.WorkAreaId select x).Count();
TreeNode newNode = new TreeNode();
newNode.Text = q.WorkAreaCode + "【" + a.ToString() + "】管线";
newNode.NodeID = q.WorkAreaId;
newNode.EnableClickEvent = true;
newNode.ToolTip = "区域";
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)
{
this.unitId = e.Node.ParentNode.NodeID.Split('|')[0];
treeNodeId = e.NodeID;
this.BindGrid(e.NodeID);
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid(string treeNodeId="")
{
string strSql = @"SELECT iso.ISO_ID,
iso.ProjectId,
iso.ISO_IsoNo,
iso.UnitId,
unit.UnitName,
iso.TestMediumId,
testMedium.MediumName,
iso.DetectionRateId,
detectionRate.DetectionRateValue,
iso.DetectionTypeId,
detectionType.DetectionTypeName,
iso.WorkAreaId,
workArea.WorkAreaCode,
iso.ISO_SysNo,
iso.ISO_SubSysNo,
iso.ISO_CwpNo,
iso.ISO_IsoNumber,
iso.ISO_Rev,
iso.ISO_Sheet,
iso.ISO_PipeQty,
iso.ISO_Paint,
iso.ISO_Insulator,
iso.MaterialId,
material.MaterialType,
iso.ISO_Executive,
iso.ISO_Modifier,
iso.ISO_ModifyDate,
iso.ISO_Creator,
iso.ISO_CreateDate,
iso.ISO_DesignPress,
iso.ISO_DesignTemperature,
iso.ISO_TestPress,
iso.ISO_TestTemperature,
iso.ISO_NDTClass,
iso.ISO_PTRate,
case when iso.Is_Standard=1 then '是'else '否' end as Is_Standard,
iso.PipingClassId,
pipingClass.PipingClassName,
iso.ISO_PTClass,
(CASE WHEN iso.ISO_IfPickling='True' THEN '是' ELSE '否' END) AS ISO_IfPickling,
(CASE WHEN iso.ISO_IfChasing='True' THEN '是' ELSE '否' END) AS ISO_IfChasing,
iso.ISO_Remark"
+ @" FROM PW_IsoInfo AS iso"
+ @" LEFT JOIN Base_Unit AS unit ON unit.UnitId = iso.UnitId"
+ @" LEFT JOIN Base_TestMedium AS testMedium ON testMedium.TestMediumId = iso.TestMediumId"
+ @" LEFT JOIN Base_DetectionRate AS detectionRate ON detectionRate.DetectionRateId = iso.DetectionRateId"
+ @" LEFT JOIN Base_DetectionType AS detectionType ON detectionType.DetectionTypeId = iso.DetectionTypeId"
+ @" LEFT JOIN ProjectData_WorkArea AS workArea ON workArea.WorkAreaId = iso.WorkAreaId"
+ @" LEFT JOIN Base_Material AS material ON material.MaterialId = iso.MaterialId"
+ @" LEFT JOIN Base_PipingClass AS pipingClass ON pipingClass.PipingClassId = iso.PipingClassId"
+ @" WHERE iso.ProjectId=@ProjectId";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(treeNodeId))
{
strSql += " AND workArea.WorkAreaId=@treeNodeId ";
listStr.Add(new SqlParameter("@treeNodeId", treeNodeId));
}
if (!string.IsNullOrEmpty(unitId))
{
strSql += " AND iso.UnitId=@unitId ";
listStr.Add(new SqlParameter("@unitId", unitId));
}
if (!string.IsNullOrEmpty(this.drpIsStanded.SelectedValue))
{
strSql += " AND iso.Is_Standard=@Is_Standard ";
listStr.Add(new SqlParameter("@Is_Standard", this.drpIsStanded.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
{
strSql += " AND iso.ISO_IsoNo LIKE @ISO_IsoNo";
listStr.Add(new SqlParameter("@ISO_IsoNo", "%" + this.txtIsoNo.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.drpSer.SelectedValue) && this.drpSer.SelectedValue != BLL.Const._Null)
{
strSql += " AND iso.TestMediumId = @TestMediumId";
listStr.Add(new SqlParameter("@TestMediumId", this.drpSer.SelectedValue));
}
if (!string.IsNullOrEmpty(this.drpNDT.SelectedValue) && this.drpNDT.SelectedValue != BLL.Const._Null)
{
strSql += " AND iso.DetectionTypeId = @DetectionTypeId";
listStr.Add(new SqlParameter("@DetectionTypeId", this.drpNDT.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtIso_IsoNumber.Text.Trim()))
{
strSql += " AND iso.ISO_IsoNumber LIKE @isoNumber";
listStr.Add(new SqlParameter("@isoNumber", "%" + this.txtIso_IsoNumber.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(this.drpSteId.SelectedValue) && this.drpSteId.SelectedValue != BLL.Const._Null)
{
strSql += " AND iso.MaterialId = @MaterialId";
listStr.Add(new SqlParameter("@MaterialId", this.drpSteId.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtISO_Specification.Text.Trim()))
{
strSql += " AND iso.ISO_Specification LIKE @ISO_Specification";
listStr.Add(new SqlParameter("@ISO_Specification", "%" + this.txtISO_Specification.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);
//this.OutputSummaryData(tb); ///取合计值
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 计算合计
/// </summary>
//private void OutputSummaryData(DataTable tb)
//{
// decimal count2 = 0;//总达因数
// int count3 = 0;//总焊口数
// for (int i = 0; i < tb.Rows.Count; i++)
// {
// count2 += Funs.GetNewDecimalOrZero(tb.Rows[i]["ISO_TotalDin"].ToString());
// count3 += Funs.GetNewIntOrZero(tb.Rows[i]["ISO_JointQty"].ToString());
// }
// JObject summary = new JObject();
// summary.Add("ISO_IsoNo", "合计:");
// summary.Add("ISO_TotalDin", count2);
// summary.Add("ISO_JointQty", count3);
// Grid1.SummaryData = summary;
//}
#endregion
#region
#region
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid(this.treeNodeId);
}
#endregion
#region
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region
/// <summary>
/// 分页选择下拉改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
#endregion
#endregion
#region 线
/// <summary>
/// Grid双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
if (GetButtonPower(Const.BtnModify))
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipelineManageEdit.aspx?ISO_ID={0}", Grid1.SelectedRowID, "编辑 - ")));
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(treeNodeId))
{
BindGrid(treeNodeId);
}
}
/// <summary>
/// 增加管线信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
if (GetButtonPower(Const.BtnAdd))
{
var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(tvControlItem.SelectedNodeID);
if (workArea != null)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipelineManageEdit.aspx?workAreaId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
}
else
{
ShowNotify("请先选择区域!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 管线信息编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (GetButtonPower(Const.BtnModify))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipelineManageEdit.aspx?ISO_ID={0}", Grid1.SelectedRowID, "维护 - ")));
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 删除按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (GetButtonPower(Const.BtnDelete))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
return;
}
bool isShow = true;
string isoRes = string.Empty;
if (Grid1.SelectedRowIndexArray.Length > 1)
{
isShow = false;
}
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
if (judgementDelete(rowID, isShow))
{
Model.PW_IsoInfo q = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(rowID);
if (q != null)
{
if (!BLL.PW_JointInfoService.IsExistJointInfoWeld(rowID))
{
BLL.PW_JointInfoService.DeleteJointInfoByIsoId(rowID);
//var tP_IsoList = (from x in BLL.Funs.DB.TP_IsoList where x.ISO_ID == q.ISO_ID select x).FirstOrDefault();
//if (tP_IsoList != null)
//{
// BLL.Funs.DB.TP_IsoList.DeleteOnSubmit(tP_IsoList);
// BLL.Funs.DB.SubmitChanges();
//}
BLL.PW_IsoInfoService.DeleteIsoInfo(rowID);
}
else
{
if (string.IsNullOrEmpty(isoRes))
{
isoRes = q.ISO_IsoNo;
}
else
{
isoRes += "," + q.ISO_IsoNo;
}
}
}
}
}
if (!string.IsNullOrEmpty(isoRes))
{
Alert.ShowInTop("管线" + isoRes + "存在焊口的焊接信息!", MessageBoxIcon.Warning);
}
else
{
// ShowNotify("删除成功!", MessageBoxIcon.Success);
}
if (!string.IsNullOrEmpty(treeNodeId))
{
this.BindGrid(treeNodeId);
}
else
{
this.BindGrid();
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
this.BindGrid();
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Tree_TextChanged(object sender, EventArgs e)
{
this.InitTreeMenu();
this.BindGrid();
}
#endregion
#region
/// <summary>
/// 判断是否可以删除
/// </summary>
/// <returns></returns>
private bool judgementDelete(string id, bool isShow)
{
string content = string.Empty;
string jotInfo = string.Empty;
var q = from x in Funs.DB.PW_JointInfo where x.ISO_ID == id && x.DReportID != null select x;
if (q.Count() > 0)
{
foreach (var item in q)
{
jotInfo += "焊口号:" + item.JOT_JointNo;
var dr = Funs.DB.BO_WeldReportMain.FirstOrDefault(x => x.DReportID == item.DReportID);
if (dr != null)
{
jotInfo += ";焊接日报号:" + dr.JOT_DailyReportNo;
}
}
content = "该管线已焊焊口!" + jotInfo;
}
if (BLL.AItemEndCheckService.IsExistAItemEndCheck(id))
{
content = "A项尾工已经使用了该管线不能删除";
}
if (BLL.BItemEndCheckService.IsExistBItemEndCheck(id))
{
content = "B项尾工已经使用了该管线不能删除";
}
if (string.IsNullOrEmpty(content))
{
return true;
}
else
{
if (isShow)
{
Alert.ShowInTop(content, MessageBoxIcon.Error);
}
return false;
}
}
#endregion
#region
/// <summary>
/// 选择显示列
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSelectColumn_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("PipelineShowColumn.aspx", "显示列 - ")));
}
/// <summary>
/// 关闭显示列弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
this.BindGrid();
//显示列
Model.Sys_UserShowColumns c = BLL.UserShowColumnsService.GetColumnsByUserId(this.CurrUser.UserId, "Iso");
if (c != null)
{
this.GetShowColumn(c.Columns);
}
}
#endregion
#region
/// <summary>
/// 显示的列
/// </summary>
/// <param name="column"></param>
private void GetShowColumn(string column)
{
if (!string.IsNullOrEmpty(column))
{
this.Grid1.Columns[1].Hidden = true;
this.Grid1.Columns[2].Hidden = true;
this.Grid1.Columns[3].Hidden = true;
this.Grid1.Columns[4].Hidden = true;
this.Grid1.Columns[5].Hidden = true;
this.Grid1.Columns[6].Hidden = true;
this.Grid1.Columns[7].Hidden = true;
this.Grid1.Columns[8].Hidden = true;
this.Grid1.Columns[9].Hidden = true;
this.Grid1.Columns[10].Hidden = true;
this.Grid1.Columns[11].Hidden = true;
this.Grid1.Columns[12].Hidden = true;
this.Grid1.Columns[13].Hidden = true;
this.Grid1.Columns[14].Hidden = true;
this.Grid1.Columns[15].Hidden = true;
this.Grid1.Columns[16].Hidden = true;
this.Grid1.Columns[17].Hidden = true;
this.Grid1.Columns[18].Hidden = true;
this.Grid1.Columns[19].Hidden = true;
this.Grid1.Columns[20].Hidden = true;
this.Grid1.Columns[21].Hidden = true;
this.Grid1.Columns[22].Hidden = true;
this.Grid1.Columns[23].Hidden = true;
this.Grid1.Columns[24].Hidden = true;
this.Grid1.Columns[25].Hidden = true;
this.Grid1.Columns[26].Hidden = true;
this.Grid1.Columns[27].Hidden = true;
this.Grid1.Columns[28].Hidden = true;
this.Grid1.Columns[29].Hidden = true;
this.Grid1.Columns[30].Hidden = true;
this.Grid1.Columns[31].Hidden = true;
this.Grid1.Columns[32].Hidden = true;
this.Grid1.Columns[33].Hidden = true;
this.Grid1.Columns[34].Hidden = true;
this.Grid1.Columns[35].Hidden = true;
this.Grid1.Columns[36].Hidden = true;
this.Grid1.Columns[37].Hidden = true;
this.Grid1.Columns[38].Hidden = true;
this.Grid1.Columns[39].Hidden = true;
this.Grid1.Columns[40].Hidden = true;
List<string> columns = column.Split(',').ToList();
foreach (var item in columns)
{
this.Grid1.Columns[Convert.ToInt32(item)].Hidden = false;
}
}
}
#endregion
#region
/// <summary>
/// 获取总达因数
/// </summary>
/// <param name="isoId"></param>
/// <returns></returns>
public static string ConvertTotalDin(object isoId)
{
if (isoId != null)
{
var sizeSum = (from x in Funs.DB.PW_JointInfo where x.ISO_ID == isoId.ToString() select x.JOT_Size).Sum();
if (sizeSum != null)
{
return sizeSum.ToString();
}
}
return null;
}
/// <summary>
/// 获取总焊口数
/// </summary>
/// <param name="isoId"></param>
/// <returns></returns>
public static string ConvertJointQty(object isoId)
{
if (isoId != null)
{
var jotCount = (from x in Funs.DB.PW_JointInfo where x.ISO_ID == isoId.ToString() select x).Count();
if (jotCount != null)
{
return jotCount.ToString();
}
}
return null;
}
/// <summary>
/// 根据管线主键获取试压包编号
/// </summary>
/// <param name="iso_id"></param>
/// <returns></returns>
public static string ConvertTestPackageNo(object iso_id)
{
if (iso_id != null)
{
//var testPackage = (from x in Funs.DB.TP_TestPackage
// join y in Funs.DB.TP_IsoList on x.PTP_ID equals y.PTP_ID
// join z in Funs.DB.PW_IsoInfo on y.ISO_ID equals z.ISO_ID
// where z.ISO_ID == iso_id.ToString()
// select x.PTP_TestPackageCode).FirstOrDefault();
//return testPackage;
return null;
}
return null;
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private bool GetButtonPower(string button)
{
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_PipelineManageMenuId, button);
}
#endregion
protected void btnPrint_Click(object sender, EventArgs e)
{
var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(tvControlItem.SelectedNodeID);
if (workArea != null)
{
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
//var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
keyValuePairs.Add("ProjecctName", project.ProjectName);//单元名称
keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);//单位工程名称
String strSql1 = @"SELECT * from View_PipeWeldingCheckTotalTrust where ProjectId=@projectId and WorkAreaId=@workAreaId order by ISO_IsoNo";
List<SqlParameter> listStr1 = new List<SqlParameter>
{
new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
new SqlParameter("@workAreaId", this.tvControlItem.SelectedNodeID),
};
SqlParameter[] parameter1 = listStr1.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql1, parameter1);
BLL.Common.FastReportService.ResetData();
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
tb.TableName = "View_PipeWeldingCheckTotalTrust";
BLL.Common.FastReportService.AddFastreportTable(tb);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\管道焊口检测总委托单.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
else
{
ShowNotify("请先选择区域!", MessageBoxIcon.Warning);
}
}
}
}