2025-04-07 17:43:30 +08:00
using BLL ;
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Data.SqlClient ;
using System.Linq ;
using System.IO ;
using System.Runtime.Serialization ;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class JointInfo : PageBase
{
2025-04-14 09:53:19 +08:00
#region 定 义 项
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return ( string ) ViewState [ "ProjectId" ] ;
}
set
{
ViewState [ "ProjectId" ] = value ;
}
}
#endregion
2025-04-07 17:43:30 +08:00
#region 加 载
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
2025-04-14 09:53:19 +08:00
this . ProjectId = this . CurrUser . LoginProjectId ;
if ( ! string . IsNullOrEmpty ( Request . Params [ "projectId" ] ) & & Request . Params [ "projectId" ] ! = this . CurrUser . LoginProjectId )
{
this . ProjectId = Request . Params [ "projectId" ] ;
}
this . ucTree . UnitId = this . CurrUser . UnitId ;
this . ucTree . ProjectId = this . ProjectId ;
if ( ! string . IsNullOrEmpty ( this . ProjectId ) )
{
this . panelLeftRegion . Hidden = true ;
////权限按钮方法
//this.GetButtonPower();
}
2025-04-07 17:43:30 +08:00
this . ddlPageSize . SelectedValue = this . Grid1 . PageSize . ToString ( ) ;
this . InitTreeMenu ( ) ; //加载树
//显示列
Model . Sys_UserShowColumns c = BLL . UserShowColumnsService . GetColumnsByUserId ( this . CurrUser . UserId , "Joint" ) ;
if ( c ! = null )
{
this . GetShowColumn ( c . Columns ) ;
}
}
}
2025-04-14 09:53:19 +08:00
/// <summary>
/// 公司级树加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void changeTree ( object sender , EventArgs e )
{
this . ProjectId = this . ucTree . ProjectId ;
if ( string . IsNullOrEmpty ( this . CurrUser . LoginProjectId ) )
{
btnNew . Hidden = true ;
}
//this.GetButtonPower();
this . InitTreeMenu ( ) ;
}
2025-04-07 17:43:30 +08:00
#endregion
#region 加 载 树 装 置 - 单 位 - 工 作 区
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu ( )
{
2025-04-14 09:53:19 +08:00
if ( string . IsNullOrEmpty ( this . ProjectId ) )
{
return ;
}
2025-04-07 17:43:30 +08:00
this . tvControlItem . Nodes . Clear ( ) ;
TreeNode rootNode = new TreeNode ( ) ;
rootNode . Text = "装置-单位-工作区" ;
rootNode . NodeID = "0" ;
rootNode . Expanded = true ;
this . tvControlItem . Nodes . Add ( rootNode ) ;
////装置
2025-04-14 09:53:19 +08:00
var pInstallation = ( from x in Funs . DB . Project_Installation where x . ProjectId = = this . ProjectId select x ) . ToList ( ) ;
2025-04-07 17:43:30 +08:00
////区域
2025-04-14 09:53:19 +08:00
var pWorkArea = ( from x in Funs . DB . ProjectData_WorkArea where x . ProjectId = = this . ProjectId select x ) . ToList ( ) ;
2025-04-07 17:43:30 +08:00
////单位
2025-04-14 09:53:19 +08:00
var pUnits = ( from x in Funs . DB . Project_ProjectUnit where x . ProjectId = = this . ProjectId select x ) . ToList ( ) ;
2025-04-07 17:43:30 +08:00
var workAreaIdList = ( from x in BLL . Funs . DB . PW_IsoInfo
2025-04-14 09:53:19 +08:00
where x . ProjectId = = this . ProjectId & & x . ISO_IsoNo . Contains ( this . txtIsono . Text . Trim ( ) )
2025-04-07 17:43:30 +08:00
orderby x . ISO_IsoNo
select x . WorkAreaId ) . Distinct ( ) . ToList ( ) ;
pWorkArea = pWorkArea . Where ( x = > workAreaIdList . Contains ( x . WorkAreaId ) ) . OrderBy ( x = > x . WorkAreaCode ) . ToList ( ) ;
pInstallation = ( from x in pInstallation
join y in pWorkArea on x . InstallationId equals y . InstallationId
select x ) . Distinct ( ) . ToList ( ) ;
pUnits = ( from x in pUnits
join y in pWorkArea on x . UnitId equals y . UnitId
select x ) . Distinct ( ) . ToList ( ) ;
this . BindNodes ( rootNode , pInstallation , pWorkArea , pUnits ) ;
}
#endregion
#region 绑 定 树 节 点
#region 绑 定 树 节 点
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
private void BindNodes ( TreeNode node , List < Model . Project_Installation > pInstallation , List < Model . ProjectData_WorkArea > pWorkArea , List < Model . Project_ProjectUnit > pUnits )
{
if ( string . IsNullOrEmpty ( node . ToolTip ) )
{
List < Model . Project_Installation > installations = pInstallation ;
var pUnit = pUnits . FirstOrDefault ( x = > x . UnitId = = this . CurrUser . UnitId ) ;
if ( pUnit ! = null & & pUnit . UnitType ! = Const . ProjectUnitType_1 & & pUnit . UnitType ! = Const . ProjectUnitType_5 )
{
installations = ( from x in pInstallation
join y in pWorkArea on x . InstallationId equals y . InstallationId
where y . UnitId = = this . CurrUser . UnitId
orderby x . InstallationId
select x ) . Distinct ( ) . ToList ( ) ;
}
foreach ( var q in installations )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . NodeID = q . InstallationId ;
newNode . Text = q . InstallationName ;
newNode . ToolTip = "装置" ;
newNode . Expanded = true ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , pInstallation , pWorkArea , pUnits ) ;
}
}
else if ( node . ToolTip = = "装置" )
{
List < Model . Project_ProjectUnit > units = null ;
var pUnitDepth = pUnits . FirstOrDefault ( x = > x . UnitId = = this . CurrUser . UnitId ) ;
if ( pUnitDepth = = null | | pUnitDepth . UnitType = = Const . ProjectUnitType_1 | | pUnitDepth . UnitType = = Const . ProjectUnitType_5 )
{
units = ( from x in pUnits
join y in pWorkArea on x . UnitId equals y . UnitId
where y . InstallationId = = node . NodeID & & x . UnitType = = Const . ProjectUnitType_2
select x ) . ToList ( ) ;
}
else
{
units = ( from x in pUnits
join y in pWorkArea on x . UnitId equals y . UnitId
where y . InstallationId = = node . NodeID & & x . UnitType = = Const . ProjectUnitType_2 & & x . UnitId = = this . CurrUser . UnitId
select x ) . ToList ( ) ;
}
units = units . OrderBy ( x = > x . InTime ) . Distinct ( ) . ToList ( ) ;
foreach ( var q in units )
{
var unit = BLL . UnitService . GetUnitByUnitId ( q . UnitId ) ;
if ( unit ! = null )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = unit . UnitName ;
newNode . NodeID = q . UnitId + "|" + node . NodeID ;
newNode . ToolTip = "单位" ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , pInstallation , pWorkArea , pUnits ) ;
}
}
}
else if ( node . ToolTip = = "单位" )
{
var workAreas = ( from x in pWorkArea
where x . InstallationId = = node . ParentNode . NodeID & & x . UnitId = = node . NodeID . Split ( '|' ) [ 0 ]
select x ) ;
workAreas = workAreas . OrderByDescending ( x = > x . WorkAreaCode ) ;
foreach ( var q in workAreas )
{
2025-04-14 09:53:19 +08:00
int a = ( from x in BLL . Funs . DB . PW_IsoInfo where x . ProjectId = = this . ProjectId & & x . UnitId = = node . NodeID . Split ( '|' ) [ 0 ] & & x . WorkAreaId = = q . WorkAreaId & & x . Is_Standard = = true select x ) . Count ( ) ;
2025-04-07 17:43:30 +08:00
TreeNode newNode1 = new TreeNode ( ) ;
newNode1 . Text = q . WorkAreaCode + "【" + a . ToString ( ) + "非标管线】" ;
newNode1 . NodeID = q . WorkAreaId + "_NoStandard" ;
newNode1 . EnableExpandEvent = true ;
newNode1 . ToolTip = "区域非标管线" ;
node . Nodes . Add ( newNode1 ) ;
2025-04-14 09:53:19 +08:00
int b = ( from x in BLL . Funs . DB . PW_IsoInfo where x . ProjectId = = this . ProjectId & & x . UnitId = = node . NodeID . Split ( '|' ) [ 0 ] & & x . WorkAreaId = = q . WorkAreaId & & x . Is_Standard ! = true select x ) . Count ( ) ;
2025-04-07 17:43:30 +08:00
TreeNode newNode2 = new TreeNode ( ) ;
newNode2 . Text = q . WorkAreaCode + "【" + b . ToString ( ) + "标准管线】" ;
newNode2 . NodeID = q . WorkAreaId + "_Standard" ;
newNode2 . EnableExpandEvent = true ;
newNode2 . ToolTip = "区域标准管线" ;
node . Nodes . Add ( newNode2 ) ;
this . BindNodes ( newNode1 , pInstallation , pWorkArea , pUnits ) ;
this . BindNodes ( newNode2 , pInstallation , pWorkArea , pUnits ) ;
}
}
else if ( node . ToolTip = = "区域非标管线" )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = "非标管线" ;
newNode . NodeID = "非标管线" ;
node . Nodes . Add ( newNode ) ;
}
else if ( node . ToolTip = = "区域标准管线" )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = "标准管线" ;
newNode . NodeID = "标准管线" ;
node . Nodes . Add ( newNode ) ;
}
}
#endregion
#region 树 展 开 事 件
/// <summary>
/// 树展开事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_TreeNodeExpanded ( object sender , TreeNodeEventArgs e )
{
if ( e . Node . ToolTip = = "区域非标管线" )
{
e . Node . Nodes . Clear ( ) ;
List < Model . PW_IsoInfo > isoInfo = new List < Model . PW_IsoInfo > ( ) ;
isoInfo = ( from x in BLL . Funs . DB . PW_IsoInfo
2025-04-14 09:53:19 +08:00
where x . ProjectId = = this . ProjectId & & x . WorkAreaId = = e . Node . NodeID . Split ( '_' ) [ 0 ] & & x . Is_Standard = = true
2025-04-07 17:43:30 +08:00
& & x . ISO_IsoNo . Contains ( this . txtIsono . Text . Trim ( ) )
orderby x . ISO_IsoNo
select x ) . ToList ( ) ;
foreach ( var item in isoInfo )
{
var jotCount = ( from x in Funs . DB . PW_JointInfo where x . ISO_ID = = item . ISO_ID select x ) . Count ( ) ;
TreeNode newNode = new TreeNode ( ) ;
if ( ! String . IsNullOrEmpty ( item . ISO_Sheet ) )
{
newNode . Text = item . ISO_IsoNo + "(" + item . ISO_Sheet + ")" ;
}
else
{
newNode . Text = item . ISO_IsoNo ;
}
newNode . Text + = "【" + jotCount . ToString ( ) + "焊口】" ;
newNode . ToolTip = "管线(页数)【焊口数】" ;
newNode . NodeID = item . ISO_ID ;
newNode . EnableClickEvent = true ;
e . Node . Nodes . Add ( newNode ) ;
}
}
else if ( e . Node . ToolTip = = "区域标准管线" )
{
e . Node . Nodes . Clear ( ) ;
List < Model . PW_IsoInfo > isoInfo = new List < Model . PW_IsoInfo > ( ) ;
isoInfo = ( from x in BLL . Funs . DB . PW_IsoInfo
2025-04-14 09:53:19 +08:00
where x . ProjectId = = this . ProjectId & & x . WorkAreaId = = e . Node . NodeID . Split ( '_' ) [ 0 ] & & x . Is_Standard = = false
2025-04-07 17:43:30 +08:00
& & x . ISO_IsoNo . Contains ( this . txtIsono . Text . Trim ( ) )
orderby x . ISO_IsoNo
select x ) . ToList ( ) ;
foreach ( var item in isoInfo )
{
var jotCount = ( from x in Funs . DB . PW_JointInfo where x . ISO_ID = = item . ISO_ID select x ) . Count ( ) ;
TreeNode newNode = new TreeNode ( ) ;
if ( ! String . IsNullOrEmpty ( item . ISO_Sheet ) )
{
newNode . Text = item . ISO_IsoNo + "(" + item . ISO_Sheet + ")" ;
}
else
{
newNode . Text = item . ISO_IsoNo ;
}
newNode . Text + = "【" + jotCount . ToString ( ) + "焊口】" ;
newNode . ToolTip = "管线(页数)【焊口数】" ;
newNode . NodeID = item . ISO_ID ;
newNode . EnableClickEvent = true ;
e . Node . Nodes . Add ( newNode ) ;
}
}
}
#endregion
#endregion
#region 点 击 TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand ( object sender , TreeCommandEventArgs e )
{
var p = Funs . DB . PW_IsoInfo . Where ( x = > x . ISO_ID = = this . tvControlItem . SelectedNodeID ) . FirstOrDefault ( ) ;
if ( p ! = null & & p . Is_Standard . HasValue )
{
if ( p . Is_Standard . Value )
{
this . Grid1 . FindColumn ( "DetectionRateValue" ) . Hidden = false ;
this . Grid1 . FindColumn ( "DetectionTypeName" ) . Hidden = false ;
this . Grid1 . FindColumn ( "WallBoard" ) . Hidden = false ;
}
else
{
this . Grid1 . FindColumn ( "DetectionRateValue" ) . Hidden = true ;
this . Grid1 . FindColumn ( "DetectionTypeName" ) . Hidden = true ;
this . Grid1 . FindColumn ( "WallBoard" ) . Hidden = true ;
}
}
this . BindGrid ( ) ;
}
#endregion
#region 数 据 绑 定
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid ( )
{
string strSql = @"SELECT jointInfo.JOT_ID,
jointInfo.ProjectId,
jointInfo.JOT_JointNo,
jointInfo.is_hj,
jointInfo.JointStatusName,
jointInfo.JOT_TrustFlagName,
jointInfo.JOT_CheckFlagName,
jointInfo.ISO_ID,
jointInfo.ISO_IsoNo,
jointInfo.WorkAreaId,
jointInfo.WorkAreaCode,
jointInfo.JOT_WeldDate,
jointInfo.JOT_DailyReportNo,
jointInfo.STE_Name1,
jointInfo.STE_Name2,
jointInfo.Component1,
jointInfo.Component2,
jointInfo.WED_Code1,
jointInfo.WED_Name1,
jointInfo.WED_Code2,
jointInfo.WED_Name2,
jointInfo.JOT_JointDesc,
jointInfo.JOT_Dia,
jointInfo.JOT_Size,
jointInfo.JOT_Sch,
jointInfo.JOT_FactSch,
jointInfo.GrooveTypeName,
jointInfo.JOTY_ID,
jointInfo.WeldTypeName,
jointInfo.WME_ID,
jointInfo.WeldingMethodName,
jointInfo.WeldSilk,
jointInfo.WeldMat,
jointInfo.WLO_Code,
jointInfo.WeldingLocationName,
jointInfo.JOT_DoneDin,
jointInfo.JOT_PrepareTemp,
jointInfo.JOT_JointAttribute,
jointInfo.JOT_CellTemp,
jointInfo.JOT_LastTemp,
jointInfo.JOT_HeartNo1,
jointInfo.JOT_HeartNo2,
jointInfo.PointDate,
jointInfo.PointNo,
jointInfo.CH_TrustCode,
jointInfo.CH_TrustDate,
jointInfo.JOT_FaceCheckResult,
jointInfo.JOT_FaceCheckDate,
jointInfo.JOT_FaceChecker,
detectionRate.DetectionRateValue,
jointInfo.IS_Proess,
jointInfo.JOT_BelongPipe,
jointInfo.JOT_Electricity,
detectionType.DetectionTypeName,
jointInfo.JOT_Voltage,
jointInfo.JOT_ProessDate,
jointInfo.JOT_HotRpt,
jointInfo.Extend_Length,
(select top 1 CHT_CheckDate from CH_Check c left join CH_CheckItem ci on ci.CHT_CheckID=c.CHT_CheckID where ci.JOT_ID=jointInfo.JOT_ID order by CHT_CheckDate desc) as CHT_CheckDate,
(select top 1 CHT_CheckCode from CH_Check c left join CH_CheckItem ci on ci.CHT_CheckID=c.CHT_CheckID where ci.JOT_ID=jointInfo.JOT_ID order by CHT_CheckDate desc) as CHT_CheckCode,
jointInfo.JOT_Remark"
+ @" from View_JointInfo as jointInfo "
+ @" LEFT JOIN Base_DetectionRate AS detectionRate ON detectionRate.DetectionRateId = jointInfo.DetectionRateId"
+ @" LEFT JOIN Base_DetectionType AS detectionType ON detectionType.DetectionTypeId = jointInfo.DetectionTypeId"
+ @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId" ;
List < SqlParameter > listStr = new List < SqlParameter >
{
2025-04-14 09:53:19 +08:00
new SqlParameter ( "@projectId" , this . ProjectId ) ,
2025-04-07 17:43:30 +08:00
new SqlParameter ( "@isoId" , this . tvControlItem . SelectedNodeID ) ,
} ;
if ( ! string . IsNullOrEmpty ( this . txtJOT_JointNo . Text . Trim ( ) ) )
{
strSql + = " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo" ;
listStr . Add ( new SqlParameter ( "@JOT_JointNo" , "%" + this . txtJOT_JointNo . Text . Trim ( ) + "%" ) ) ;
}
if ( ! string . IsNullOrEmpty ( this . dpIsHj . SelectedValue ) )
{
strSql + = " AND jointInfo.is_hj = @is_hj" ;
listStr . Add ( new SqlParameter ( "@is_hj" , this . dpIsHj . SelectedValue ) ) ;
}
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
tb . Columns . Add ( "index" , typeof ( System . Int16 ) ) ;
foreach ( DataRow row in tb . Rows )
{
try
{
row [ "index" ] = int . Parse ( System . Text . RegularExpressions . Regex . Replace ( row [ "JOT_JointNo" ] . ToString ( ) , @"[^0-9]+" , "" ) ) ;
}
catch ( Exception e )
{
row [ "index" ] = 0 ;
}
}
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
Grid1 . RecordCount = tb . Rows . Count ;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this . GetPagedDataTable ( Grid1 , tb ) ;
Grid1 . DataSource = table ;
Grid1 . DataBind ( ) ;
}
#endregion
#region 分 页 排 序
#region 页 索 引 改 变 事 件
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange ( object sender , GridPageEventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 排 序
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort ( object sender , GridSortEventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 分 页 选 择 下 拉 改 变 事 件
/// <summary>
/// 分页选择下拉改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged ( object sender , EventArgs e )
{
Grid1 . PageSize = Convert . ToInt32 ( ddlPageSize . SelectedValue ) ;
BindGrid ( ) ;
}
#endregion
#endregion
#region 焊 口 信 息 维 护 事 件
/// <summary>
/// Grid双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick ( object sender , GridRowClickEventArgs e )
{
if ( GetButtonPower ( Const . BtnModify ) )
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "JointInfoEdit.aspx?JOT_ID={0}" , Grid1 . SelectedRowID , "编辑 - " ) ) ) ;
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
return ;
}
}
/// <summary>
/// 增加焊口信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click ( object sender , EventArgs e )
{
if ( GetButtonPower ( Const . BtnAdd ) )
{
var isoInfo = BLL . PW_IsoInfoService . GetIsoInfoByIsoInfoId ( tvControlItem . SelectedNodeID ) ;
if ( isoInfo ! = null )
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "JointInfoEdit.aspx?ISO_ID={0}" , this . tvControlItem . SelectedNodeID , "新增 - " ) ) ) ;
}
else
{
Alert . ShowInTop ( "请先选择管线!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
return ;
}
}
/// <summary>
/// 批量增加焊口信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnBatchAdd_Click ( object sender , EventArgs e )
{
if ( GetButtonPower ( Const . BtnAdd ) )
{
var isoInfo = BLL . PW_IsoInfoService . GetIsoInfoByIsoInfoId ( tvControlItem . SelectedNodeID ) ;
if ( isoInfo ! = null )
{
PageContext . RegisterStartupScript ( Window2 . GetShowReference ( String . Format ( "JointInfoBatchEdit.aspx?ISO_ID={0}" , this . tvControlItem . SelectedNodeID , "新增 - " ) ) ) ;
}
else
{
Alert . ShowInTop ( "请先选择管线!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
return ;
}
}
/// <summary>
/// 焊口信息编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click ( object sender , EventArgs e )
{
if ( GetButtonPower ( Const . BtnModify ) )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "JointInfoEdit.aspx?JOT_ID={0}" , Grid1 . SelectedRowID , "维护 - " ) ) ) ;
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
return ;
}
}
/// <summary>
/// 删除按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click ( object sender , EventArgs e )
{
if ( GetButtonPower ( Const . BtnDelete ) )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
bool isShow = true ;
if ( Grid1 . SelectedRowIndexArray . Length > 1 )
{
isShow = false ;
}
foreach ( int rowIndex in Grid1 . SelectedRowIndexArray )
{
string rowID = Grid1 . DataKeys [ rowIndex ] [ 0 ] . ToString ( ) ;
if ( this . CurrUser . UserId = = Const . sysglyId | | this . CurrUser . UserId = = Const . hfnbdId )
{
var HotHardItems = Funs . DB . HotHardItem . Where ( x = > x . JOT_ID = = rowID ) . ToList ( ) ;
Funs . DB . HotHardItem . DeleteAllOnSubmit ( HotHardItems ) ;
var CH_TrustItems = BLL . Funs . DB . CH_TrustItem . Where ( x = > x . JOT_ID = = rowID ) . ToList ( ) ;
Funs . DB . CH_TrustItem . DeleteAllOnSubmit ( CH_TrustItems ) ;
var CH_CheckItems = BLL . Funs . DB . CH_CheckItem . Where ( x = > x . JOT_ID = = rowID ) . ToList ( ) ;
Funs . DB . CH_CheckItem . DeleteAllOnSubmit ( CH_CheckItems ) ;
Funs . DB . SubmitChanges ( ) ;
}
else if ( judgementDelete ( rowID , isShow ) )
{
BLL . PW_JointInfoService . DeleteJointInfo ( rowID ) ;
2025-04-14 09:53:19 +08:00
//BLL.Sys_LogService.AddLog(BLL.Const.System_7, this.ProjectId, this.CurrUser.UserId, "删除焊口信息");
2025-04-07 17:43:30 +08:00
}
}
2025-04-14 09:53:19 +08:00
Project_HJGLData_HJGLService . StatisticalData ( this . ProjectId , Project_HJGLData_HJGLService . HJGLDateType . ArrivalFactor ) ;
2025-04-07 17:43:30 +08:00
//ShowNotify("删除成功!", MessageBoxIcon.Success);
this . BindGrid ( ) ;
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
#endregion
#region 报 表 打 印
/// <summary>
/// 报表打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrint_Click ( object sender , EventArgs e )
{
string isoId = this . tvControlItem . SelectedNodeID ;
var q = BLL . PW_IsoInfoService . GetIsoInfoByIsoInfoId ( isoId ) ;
if ( q ! = null )
{
if ( printType . SelectedValue = = "0" ) //焊接工作记录
{
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
keyValuePairs . Add ( "ISO_IsoNo" , q . ISO_IsoNo ) ;
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
keyValuePairs . Add ( "InstallationName" , install . InstallationName ) ;
keyValuePairs . Add ( "WorkAreaName" , workArea . WorkAreaName ) ;
2025-04-14 09:53:19 +08:00
keyValuePairs . Add ( "ProjectName" , ProjectService . GetProjectNameByProjectId ( this . ProjectId ) ) ;
2025-04-07 17:43:30 +08:00
BLL . Common . FastReportService . ResetData ( ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string strSql = @"SELECT '' WED_Name,'' JOT_WeldDate_Month,''JOT_WeldDate_Day,jointInfo.JOT_ID,
jointInfo.ProjectId,
jointInfo.JOT_JointNo,
jointInfo.is_hj,
jointInfo.JointStatusName,
jointInfo.JOT_TrustFlagName,
jointInfo.JOT_CheckFlagName,
jointInfo.ISO_ID,
jointInfo.ISO_IsoNo,
jointInfo.ISO_IsoNumber,
jointInfo.WorkAreaId,
jointInfo.WorkAreaCode,
jointInfo.JOT_WeldDate,
jointInfo.JOT_DailyReportNo,
jointInfo.STE_Name1,
jointInfo.STE_Name2,
jointInfo.Component1,
jointInfo.Component2,
jointInfo.WED_Code1,
jointInfo.WED_Name1,
jointInfo.WED_Code2,
jointInfo.WED_Name2,
jointInfo.JOT_JointDesc,
jointInfo.JOT_Dia,
jointInfo.JOT_Size,
jointInfo.JOT_Sch,
jointInfo.JOT_FactSch,
jointInfo.GrooveTypeName,
jointInfo.JOTY_ID,
jointInfo.WeldTypeName,
jointInfo.WME_ID,
jointInfo.WeldingMethodName,
jointInfo.WeldSilk,
jointInfo.WeldMat,
jointInfo.WLO_Code,
jointInfo.WeldingLocationName,
jointInfo.JOT_DoneDin,
jointInfo.JOT_PrepareTemp,
jointInfo.JOT_JointAttribute,
jointInfo.JOT_CellTemp,
jointInfo.JOT_LastTemp,
jointInfo.JOT_HeartNo1,
jointInfo.JOT_HeartNo2,
jointInfo.PointDate,
jointInfo.PointNo,
jointInfo.CH_TrustCode,
jointInfo.CH_TrustDate,
jointInfo.JOT_FaceCheckResult,
jointInfo.JOT_FaceCheckDate,
jointInfo.JOT_FaceChecker,
jointInfo.IS_Proess,
jointInfo.JOT_BelongPipe,
jointInfo.JOT_Electricity,
jointInfo.JOT_Voltage,
jointInfo.JOT_ProessDate,
jointInfo.JOT_HotRpt,
(case when ActualPrepareTemp is not null then cast(ActualPrepareTemp as nvarchar) else '/' end) as ActualPrepareTemp,
jointInfo.JOT_Remark,
jointInfo.JOT_Location,
(case when WeldSilk is not null and WeldMat is not null then WeldSilk+'/'+WeldMat
when WeldSilk is not null and WeldMat is null then WeldSilk
when WeldMat is not null and WeldSilk is null then WeldMat else '/' end )as WeldMaterial"
+ @" from View_JointInfo as jointInfo "
+ @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId " ;
List < SqlParameter > listStr = new List < SqlParameter >
{
2025-04-14 09:53:19 +08:00
new SqlParameter ( "@projectId" , this . ProjectId ) ,
2025-04-07 17:43:30 +08:00
new SqlParameter ( "@isoId" , this . tvControlItem . SelectedNodeID ) ,
} ;
if ( ! string . IsNullOrEmpty ( this . txtJOT_JointNo . Text . Trim ( ) ) )
{
strSql + = " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo" ;
listStr . Add ( new SqlParameter ( "@JOT_JointNo" , "%" + this . txtJOT_JointNo . Text . Trim ( ) + "%" ) ) ;
}
if ( ! string . IsNullOrEmpty ( this . dpIsHj . SelectedValue ) )
{
strSql + = " AND jointInfo.is_hj = @is_hj" ;
listStr . Add ( new SqlParameter ( "@is_hj" , this . dpIsHj . SelectedValue ) ) ;
}
strSql + = " order by JOT_JointNo " ;
SqlParameter [ ] parameter5 = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter5 ) ;
tb . Columns . Add ( "index" , typeof ( System . Int16 ) ) ;
foreach ( DataRow row in tb . Rows )
{
try
{
row [ "index" ] = int . Parse ( System . Text . RegularExpressions . Regex . Replace ( row [ "JOT_JointNo" ] . ToString ( ) , @"[^0-9]+" , "" ) ) ;
}
catch ( Exception ex )
{
row [ "index" ] = 0 ;
}
}
DataView dv = tb . DefaultView ; //获取表视图
dv . Sort = "index,JOT_JointNo ASC" ; //按照ID倒序排序
tb = dv . ToTable ( ) ; //转为表
if ( tb ! = null )
{
tb . TableName = "Table1" ;
for ( int i = 0 ; i < tb . Rows . Count ; i + + )
{
string WED_Name = "" ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Name1" ] . ToString ( ) ) )
WED_Name + = tb . Rows [ i ] [ "WED_Name1" ] . ToString ( ) ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Name2" ] . ToString ( ) ) )
WED_Name + = " " + tb . Rows [ i ] [ "WED_Name1" ] . ToString ( ) ;
tb . Rows [ i ] [ "WED_Name" ] = WED_Name ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "JOT_WeldDate" ] . ToString ( ) ) )
{
DateTimeFormat dateTimeFormat = new DateTimeFormat ( "yyyy-MM-DD HH:mm:ss.000" ) ;
DateTime dateTime = DateTime . Parse ( tb . Rows [ i ] [ "JOT_WeldDate" ] . ToString ( ) ) ;
tb . Rows [ i ] [ "JOT_WeldDate_Month" ] = dateTime . Month + "" ;
tb . Rows [ i ] [ "JOT_WeldDate_Day" ] = dateTime . Day + "" ;
}
}
}
BLL . Common . FastReportService . AddFastreportTable ( tb ) ;
string initTemplatePath = "" ;
string rootPath = Server . MapPath ( "~/" ) ;
initTemplatePath = "File\\Fastreport\\管道焊接工作记录.frx" ;
if ( File . Exists ( rootPath + initTemplatePath ) )
{
PageContext . RegisterStartupScript ( Window6 . GetShowReference ( String . Format ( "../TrustManage/Fastreport.aspx?ReportPath={0}" , rootPath + initTemplatePath ) ) ) ;
}
// string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
// //模板文件
// string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/焊接管道记录.xlsx";
// //导出文件
// string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
// if (!Directory.Exists(filePath))
// {
// Directory.CreateDirectory(filePath);
// }
// string ReportFileName = filePath + "out.xlsx";
// FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
// XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
// XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接工作记录");
// recordSheet.GetRow(0).GetCell(0).SetCellValue(q.ISO_IsoNo);
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
// recordSheet.GetRow(0).GetCell(10).SetCellValue(install.InstallationName);
// recordSheet.GetRow(2).GetCell(10).SetCellValue(workArea.WorkAreaName);
// string strSql = @"SELECT jointInfo.JOT_ID,
// jointInfo.ProjectId,
// jointInfo.JOT_JointNo,
// jointInfo.is_hj,
// jointInfo.JointStatusName,
// jointInfo.JOT_TrustFlagName,
// jointInfo.JOT_CheckFlagName,
// jointInfo.ISO_ID,
// jointInfo.ISO_IsoNo,
// jointInfo.ISO_IsoNumber,
// jointInfo.WorkAreaId,
// jointInfo.WorkAreaCode,
// jointInfo.JOT_WeldDate,
// jointInfo.JOT_DailyReportNo,
// jointInfo.STE_Name1,
// jointInfo.STE_Name2,
// jointInfo.Component1,
// jointInfo.Component2,
// jointInfo.WED_Code1,
// jointInfo.WED_Name1,
// jointInfo.WED_Code2,
// jointInfo.WED_Name2,
// jointInfo.JOT_JointDesc,
// jointInfo.JOT_Dia,
// jointInfo.JOT_Size,
// jointInfo.JOT_Sch,
// jointInfo.JOT_FactSch,
// jointInfo.GrooveTypeName,
// jointInfo.JOTY_ID,
// jointInfo.WeldTypeName,
// jointInfo.WME_ID,
// jointInfo.WeldingMethodName,
// jointInfo.WeldSilk,
// jointInfo.WeldMat,
// jointInfo.WLO_Code,
// jointInfo.WeldingLocationName,
// jointInfo.JOT_DoneDin,
// jointInfo.JOT_PrepareTemp,
// jointInfo.JOT_JointAttribute,
// jointInfo.JOT_CellTemp,
// jointInfo.JOT_LastTemp,
// jointInfo.JOT_HeartNo1,
// jointInfo.JOT_HeartNo2,
// jointInfo.PointDate,
// jointInfo.PointNo,
// jointInfo.CH_TrustCode,
// jointInfo.CH_TrustDate,
// jointInfo.JOT_FaceCheckResult,
// jointInfo.JOT_FaceCheckDate,
// jointInfo.JOT_FaceChecker,
// jointInfo.IS_Proess,
// jointInfo.JOT_BelongPipe,
// jointInfo.JOT_Electricity,
// jointInfo.JOT_Voltage,
// jointInfo.JOT_ProessDate,
// jointInfo.JOT_HotRpt,
// jointInfo.JOT_Remark,jointInfo.JOT_Location"
// + @" from View_JointInfo as jointInfo "
// + @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId order by JOT_JointNo ";
// List<SqlParameter> listStr = new List<SqlParameter>
//{
2025-04-14 09:53:19 +08:00
// new SqlParameter("@projectId", this.ProjectId),
2025-04-07 17:43:30 +08:00
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
//};
// SqlParameter[] parameter = listStr.ToArray();
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// //if (tb.Rows.Count > 27)
// //{
// // // for (int i = 0; i < (tb.Rows.Count - 24) % 30; i++)
// // for (int j = 0; j < tb.Rows.Count - 27; j++)
// // {
// // recordSheet.GetRow(6).CopyRowTo(7 + j);
// // }
// //}
// if (tb.Rows.Count > 12)
// {
// recordSheet.ShiftRows(7, 34, tb.Rows.Count - 12);
// for (int j = 0; j < tb.Rows.Count - 12; j++)
// {
// recordSheet.CopyRow(6 + j, 7 + j);
// }
// }
// for (int i = 0; i < tb.Rows.Count; i++)
// {
// try
// {
// string WED_Name = "";
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name1"].ToString()))
// WED_Name += tb.Rows[i]["WED_Name1"].ToString();
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name2"].ToString()))
// WED_Name += " " + tb.Rows[i]["WED_Name1"].ToString();
// recordSheet.GetRow(5 + i).GetCell(0).SetCellValue(WED_Name);
// recordSheet.GetRow(5 + i).GetCell(1).SetCellValue(tb.Rows[i]["ISO_IsoNo"].ToString());
// recordSheet.GetRow(5 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"].ToString());
// recordSheet.GetRow(5 + i).GetCell(3).SetCellValue(tb.Rows[i]["JOT_JointDesc"].ToString());
// recordSheet.GetRow(5 + i).GetCell(4).SetCellValue(tb.Rows[i]["STE_Name1"].ToString());
// recordSheet.GetRow(5 + i).GetCell(5).SetCellValue(tb.Rows[i]["ISO_IsoNumber"].ToString());
// recordSheet.GetRow(5 + i).GetCell(6).SetCellValue(tb.Rows[i]["JOT_HotRpt"].ToString());
// recordSheet.GetRow(5 + i).GetCell(7).SetCellValue(tb.Rows[i]["WeldingMethodName"].ToString());
// recordSheet.GetRow(5 + i).GetCell(8).SetCellValue(tb.Rows[i]["JOT_Location"].ToString());
// if (!string.IsNullOrEmpty(tb.Rows[i]["JOT_WeldDate"].ToString()))
// {
// DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy-MM-DD HH:mm:ss.000");
// DateTime dateTime = DateTime.Parse(tb.Rows[i]["JOT_WeldDate"].ToString());
// recordSheet.GetRow(5 + i).GetCell(10).SetCellValue(dateTime.Month);
// recordSheet.GetRow(5 + i).GetCell(11).SetCellValue(dateTime.Day);
// }
// }
// catch (Exception)
// {
// }
// }
// using (FileStream filess = File.OpenWrite(ReportFileName))
// {
// hssfworkbook.Write(filess);
// }
2025-04-14 09:53:19 +08:00
// //PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.ProjectId)));
2025-04-07 17:43:30 +08:00
// FileInfo filet = new FileInfo(ReportFileName);
// Response.Clear();
// Response.Charset = "GB2312";
// Response.ContentEncoding = System.Text.Encoding.UTF8;
// // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
// Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接工作记录_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
// // 添加头信息,指定文件大小,让浏览器能够显示下载进度
// Response.AddHeader("Content-Length", filet.Length.ToString());
// // 指定返回的是一个不能被客户端读取的流,必须被下载
// Response.ContentType = "application/ms-excel";
// // 把文件流发送到客户端
// Response.WriteFile(filet.FullName);
// // 停止页面的执行
// Response.End();
}
else if ( printType . SelectedValue = = "1" ) // 焊接工艺评定
{
//string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
////模板文件
//string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/管道焊接工艺检查记录.xlsx";
////导出文件
//string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
//if (!Directory.Exists(filePath))
//{
// Directory.CreateDirectory(filePath);
//}
//string ReportFileName = filePath + "out.xlsx";
//FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
//XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
//XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接工艺检查记录");
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
keyValuePairs . Add ( "ISO_IsoNo" , q . ISO_IsoNo ) ;
keyValuePairs . Add ( "install" , install . InstallationName ) ;
keyValuePairs . Add ( "workarea" , workArea . WorkAreaName ) ;
BLL . Common . FastReportService . ResetData ( ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string strSql = @"SELECT '' WED_Code,jointInfo.JOT_ID,
jointInfo.ProjectId,
jointInfo.JOT_JointNo,
jointInfo.is_hj,
jointInfo.JointStatusName,
jointInfo.JOT_TrustFlagName,
jointInfo.JOT_CheckFlagName,
jointInfo.ISO_ID,
jointInfo.ISO_IsoNo,
jointInfo.ISO_IsoNumber,
jointInfo.WorkAreaId,
jointInfo.WorkAreaCode,
jointInfo.JOT_WeldDate,
jointInfo.JOT_DailyReportNo,
jointInfo.STE_Name1,
jointInfo.STE_Name2,
jointInfo.Component1,
jointInfo.Component2,
jointInfo.WED_Code1,
jointInfo.WED_Name1,
jointInfo.WED_Code2,
jointInfo.WED_Name2,
jointInfo.JOT_JointDesc,
jointInfo.JOT_Dia,
jointInfo.JOT_Size,
jointInfo.JOT_Sch,
jointInfo.JOT_FactSch,
jointInfo.GrooveTypeName,
jointInfo.JOTY_ID,
jointInfo.WeldTypeName,
jointInfo.WME_ID,
jointInfo.WeldingMethodName,
jointInfo.WeldSilk,
jointInfo.WeldMat,
jointInfo.WLO_Code,
jointInfo.WeldingLocationName,
jointInfo.JOT_DoneDin,
jointInfo.JOT_PrepareTemp,
jointInfo.JOT_JointAttribute,
jointInfo.JOT_CellTemp,
jointInfo.JOT_LastTemp,
jointInfo.JOT_HeartNo1,
jointInfo.JOT_HeartNo2,
jointInfo.PointDate,
jointInfo.PointNo,
jointInfo.CH_TrustCode,
jointInfo.CH_TrustDate,
jointInfo.JOT_FaceCheckResult,
jointInfo.JOT_FaceCheckDate,
jointInfo.JOT_FaceChecker,
jointInfo.IS_Proess,
jointInfo.JOT_BelongPipe,
jointInfo.JOT_Electricity,
jointInfo.JOT_Voltage,
jointInfo.JOT_ProessDate,
jointInfo.JOT_HotRpt,
jointInfo.JOT_Remark,jointInfo.JOT_Location"
+ @" from View_JointInfo as jointInfo "
+ @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId " ;
List < SqlParameter > listStr = new List < SqlParameter >
{
2025-04-14 09:53:19 +08:00
new SqlParameter ( "@projectId" , this . ProjectId ) ,
2025-04-07 17:43:30 +08:00
new SqlParameter ( "@isoId" , this . tvControlItem . SelectedNodeID ) ,
} ;
if ( ! string . IsNullOrEmpty ( this . txtJOT_JointNo . Text . Trim ( ) ) )
{
strSql + = " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo" ;
listStr . Add ( new SqlParameter ( "@JOT_JointNo" , "%" + this . txtJOT_JointNo . Text . Trim ( ) + "%" ) ) ;
}
if ( ! string . IsNullOrEmpty ( this . dpIsHj . SelectedValue ) )
{
strSql + = " AND jointInfo.is_hj = @is_hj" ;
listStr . Add ( new SqlParameter ( "@is_hj" , this . dpIsHj . SelectedValue ) ) ;
}
strSql + = " order by JOT_JointNo " ;
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
//if (tb.Rows.Count > 27)
//{
// // for (int i = 0; i < (tb.Rows.Count - 24) % 30; i++)
// for (int j = 0; j < tb.Rows.Count - 27; j++)
// {
// recordSheet.GetRow(6).CopyRowTo(7 + j);
// }
//}
//if (tb.Rows.Count > 12)
//{
// recordSheet.ShiftRows(7, 34, tb.Rows.Count - 12);
// for (int j = 0; j < tb.Rows.Count - 12; j++)
// {
// recordSheet.CopyRow(6 + j, 7 + j);
// }
//}
for ( int i = 0 ; i < tb . Rows . Count ; i + + )
{
try
{
string WED_Code = "" ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Code1" ] . ToString ( ) ) )
WED_Code + = tb . Rows [ i ] [ "WED_Code1" ] . ToString ( ) ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Code2" ] . ToString ( ) ) )
WED_Code + = " " + tb . Rows [ i ] [ "WED_Code2" ] . ToString ( ) ;
tb . Rows [ i ] [ "WED_Code" ] = WED_Code ;
//recordSheet.GetRow(5 + i).GetCell(0).SetCellValue(tb.Rows[i]["ISO_IsoNo"].ToString());
//recordSheet.GetRow(5 + i).GetCell(1).SetCellValue("");
//recordSheet.GetRow(5 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"].ToString());
//recordSheet.GetRow(5 + i).GetCell(4).SetCellValue(WED_Code);
//recordSheet.GetRow(5 + i).GetCell(5).SetCellValue("");
//recordSheet.GetRow(5 + i).GetCell(6).SetCellValue("");
//recordSheet.GetRow(5 + i).GetCell(7).SetCellValue("");
//recordSheet.GetRow(5 + i).GetCell(8).SetCellValue(tb.Rows[i]["WeldingMethodName"].ToString());
//recordSheet.GetRow(5 + i).GetCell(9).SetCellValue(tb.Rows[i]["JOT_Electricity"].ToString());
//recordSheet.GetRow(5 + i).GetCell(10).SetCellValue(tb.Rows[i]["JOT_Voltage"].ToString());
//recordSheet.GetRow(5 + i).GetCell(11).SetCellValue("");
//recordSheet.GetRow(5 + i).GetCell(13).SetCellValue(tb.Rows[i]["JOT_PrepareTemp"].ToString());
//recordSheet.GetRow(5 + i).GetCell(14).SetCellValue(tb.Rows[i]["JOT_CellTemp"].ToString());
//recordSheet.GetRow(5 + i).GetCell(15).SetCellValue(tb.Rows[i]["JOT_LastTemp"].ToString());
//if (!string.IsNullOrEmpty(tb.Rows[i]["JOT_FaceCheckDate"].ToString()))
//{
// DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy-MM-DD HH:mm:ss.000");
// DateTime dateTime = DateTime.Parse(tb.Rows[i]["JOT_FaceCheckDate"].ToString());
// recordSheet.GetRow(5 + i).GetCell(16).SetCellValue(dateTime.ToShortDateString());
//}
}
catch ( Exception )
{
}
}
tb . TableName = "Table1" ;
BLL . Common . FastReportService . AddFastreportTable ( tb ) ;
string initTemplatePath = "" ;
string rootPath = Server . MapPath ( "~/" ) ;
initTemplatePath = "File\\Fastreport\\管道焊接工艺检查记录.frx" ;
if ( File . Exists ( rootPath + initTemplatePath ) )
{
PageContext . RegisterStartupScript ( Window6 . GetShowReference ( String . Format ( "../TrustManage/Fastreport.aspx?ReportPath={0}" , rootPath + initTemplatePath ) ) ) ;
//using (FileStream filess = File.OpenWrite(ReportFileName))
//{
// hssfworkbook.Write(filess);
//}
2025-04-14 09:53:19 +08:00
////PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.ProjectId)));
2025-04-07 17:43:30 +08:00
//FileInfo filet = new FileInfo(ReportFileName);
//Response.Clear();
//Response.Charset = "GB2312";
//Response.ContentEncoding = System.Text.Encoding.UTF8;
//// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
//Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接工艺检查记录_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
//// 添加头信息,指定文件大小,让浏览器能够显示下载进度
//Response.AddHeader("Content-Length", filet.Length.ToString());
//// 指定返回的是一个不能被客户端读取的流,必须被下载
//Response.ContentType = "application/ms-excel";
//// 把文件流发送到客户端
//Response.WriteFile(filet.FullName);
//// 停止页面的执行
//Response.End();
}
}
else if ( printType . SelectedValue = = "2" ) // 焊接工艺评定
{
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
keyValuePairs . Add ( "ISO_IsoNo" , q . ISO_IsoNo ) ;
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
var project = BLL . ProjectService . GetProjectByProjectId ( q . ProjectId ) ;
keyValuePairs . Add ( "ProjecctName" , project . ProjectName ) ; //工程名称
keyValuePairs . Add ( "InstallationName" , install . InstallationName ) ;
keyValuePairs . Add ( "WorkAreaName" , workArea . WorkAreaName ) ; //单位工程名称
keyValuePairs . Add ( "ISOName" , q . ISO_IsoNumber ) ; //设备名称
keyValuePairs . Add ( "ISO_Specification" , q . ISO_Specification ) ; //设备规格
var material = Base_MaterialService . GetMaterialByMaterialId ( q . MaterialId ) ;
keyValuePairs . Add ( "MaterialCode" , material . MaterialCode ) ; //设备材质
String strSql1 = @"SELECT '' WED_Code, jointInfo.JOT_JointNo,--焊缝位置/焊缝编号
'' WED_Name,--焊工姓名 或钢印号
jointInfo.JOT_JointDesc,--焊缝规格mm
jointInfo.JOT_PrepareTemp, --预热温度 ℃
jointInfo.JOT_Electricity, --焊接电流 A
jointInfo.JOT_Voltage, --焊接电压 V
jointInfo.JOT_ID,
jointInfo.ProjectId,
jointInfo.JOT_WeldDate, -- 焊接日期
jointInfo.WeldingMethodName,
jointInfo.WeldSilk,
WED_Name1,WED_Name2,WED_Code1,WED_Code2
from View_JointInfo as jointInfo WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId " ;
List < SqlParameter > listStr1 = new List < SqlParameter >
{
2025-04-14 09:53:19 +08:00
new SqlParameter ( "@projectId" , this . ProjectId ) ,
2025-04-07 17:43:30 +08:00
new SqlParameter ( "@isoId" , this . tvControlItem . SelectedNodeID ) ,
} ;
if ( ! string . IsNullOrEmpty ( this . txtJOT_JointNo . Text . Trim ( ) ) )
{
strSql1 + = " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo" ;
listStr1 . Add ( new SqlParameter ( "@JOT_JointNo" , "%" + this . txtJOT_JointNo . Text . Trim ( ) + "%" ) ) ;
}
if ( ! string . IsNullOrEmpty ( this . dpIsHj . SelectedValue ) )
{
strSql1 + = " AND jointInfo.is_hj = @is_hj" ;
listStr1 . Add ( new SqlParameter ( "@is_hj" , this . dpIsHj . SelectedValue ) ) ;
}
strSql1 + = " order by JOT_JointNo " ;
SqlParameter [ ] parameter1 = listStr1 . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql1 , parameter1 ) ;
if ( tb . Rows . Count > 0 )
{
keyValuePairs . Add ( "WeldingMethodName" , tb . Rows [ 0 ] [ "WeldingMethodName" ] . ToString ( ) ) ; //焊接方法
keyValuePairs . Add ( "WeldSilk" , tb . Rows [ 0 ] [ "WeldSilk" ] . ToString ( ) ) ; //焊接材料
}
for ( int i = 0 ; i < tb . Rows . Count ; i + + )
{
try
{
string WED_Name = "" ;
string WED_Code = "" ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Name1" ] . ToString ( ) ) )
{
WED_Name + = tb . Rows [ i ] [ "WED_Name1" ] . ToString ( ) ;
WED_Code + = tb . Rows [ i ] [ "WED_Code1" ] . ToString ( ) ;
}
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Name2" ] . ToString ( ) ) )
{
WED_Name + = "," + tb . Rows [ i ] [ "WED_Name2" ] . ToString ( ) ;
WED_Code + = "," + tb . Rows [ i ] [ "WED_Code2" ] . ToString ( ) ;
}
tb . Rows [ i ] [ "WED_Name" ] = WED_Name ;
tb . Rows [ i ] [ "WED_Code" ] = WED_Code ;
}
catch ( Exception )
{
}
}
BLL . Common . FastReportService . ResetData ( ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
tb . TableName = "Table1" ;
BLL . Common . FastReportService . AddFastreportTable ( tb ) ;
string initTemplatePath = "" ;
string rootPath = Server . MapPath ( "~/" ) ;
initTemplatePath = "File\\Fastreport\\设备焊接工作记录.frx" ;
if ( File . Exists ( rootPath + initTemplatePath ) )
{
PageContext . RegisterStartupScript ( Window6 . GetShowReference ( String . Format ( "../TrustManage/Fastreport.aspx?ReportPath={0}" , rootPath + initTemplatePath ) ) ) ;
}
}
}
else
{
Alert . ShowInTop ( "请选择管线!" , MessageBoxIcon . Warning ) ;
return ;
}
}
#endregion
#region 关 闭 弹 出 窗 口 及 刷 新 页 面
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close ( object sender , WindowCloseEventArgs e )
{
// this.InitTreeMenu();//加载树
this . BindGrid ( ) ;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged ( object sender , EventArgs e )
{
this . BindGrid ( ) ;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Tree_TextChanged ( object sender , EventArgs e )
{
this . InitTreeMenu ( ) ;
this . BindGrid ( ) ;
}
#endregion
#region 判 断 是 否 可 删 除
/// <summary>
/// 判断是否可以删除
/// </summary>
/// <returns></returns>
private bool judgementDelete ( string id , bool isShow )
{
string content = string . Empty ;
if ( BLL . HotProessManageEditService . GetHotProessByJOTID ( id ) . Count ( ) > 0 )
{
content = "热处理已经使用了该焊口,不能删除!" ;
}
if ( BLL . Funs . DB . CH_TrustItem . FirstOrDefault ( x = > x . JOT_ID = = id ) ! = null )
{
content = "无损委托已经使用了该焊口,不能删除!" ;
}
if ( BLL . Funs . DB . CH_CheckItem . FirstOrDefault ( x = > x . JOT_ID = = id ) ! = null )
{
content = "检测单已经使用了该焊口,不能删除!" ;
}
if ( string . IsNullOrEmpty ( content ) )
{
return true ;
}
else
{
if ( isShow )
{
Alert . ShowInTop ( content , MessageBoxIcon . Error ) ;
}
return false ;
}
}
#endregion
#region 导 出 焊 口 信 息
/// <summary>
/// 导出焊口初始信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut2_Click ( object sender , EventArgs e )
{
var iso = BLL . PW_IsoInfoService . GetIsoInfoByIsoInfoId ( this . tvControlItem . SelectedNodeID ) ;
if ( iso ! = null )
{
PageContext . RegisterStartupScript ( Window3 . GetShowReference ( String . Format ( "JointInfoOut.aspx?ISO_ID={0}" , this . tvControlItem . SelectedNodeID , "导出 - " ) ) ) ;
}
else
{
Alert . ShowInTop ( "请先选择一条管线!" , MessageBoxIcon . Warning ) ;
}
}
#endregion
#region 选 择 要 显 示 列
/// <summary>
/// 选择显示列
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSelectColumn_Click ( object sender , EventArgs e )
{
PageContext . RegisterStartupScript ( Window4 . GetShowReference ( String . Format ( "JointShowColumn.aspx" , "显示列 - " ) ) ) ;
}
#endregion
#region 显 示 列
protected void Window4_Close ( object sender , WindowCloseEventArgs e )
{
this . BindGrid ( ) ;
//显示列
Model . Sys_UserShowColumns c = BLL . UserShowColumnsService . GetColumnsByUserId ( this . CurrUser . UserId , "Joint" ) ;
if ( c ! = null )
{
this . GetShowColumn ( c . Columns ) ;
}
}
/// <summary>
/// 显示的列
/// </summary>
/// <param name="column"></param>
private void GetShowColumn ( string column )
{
if ( ! string . IsNullOrEmpty ( column ) )
{
this . Grid1 . Columns [ 1 ] . Hidden = true ;
this . Grid1 . Columns [ 2 ] . Hidden = true ;
this . Grid1 . Columns [ 3 ] . Hidden = true ;
this . Grid1 . Columns [ 4 ] . Hidden = true ;
this . Grid1 . Columns [ 5 ] . Hidden = true ;
this . Grid1 . Columns [ 6 ] . Hidden = true ;
this . Grid1 . Columns [ 7 ] . Hidden = true ;
this . Grid1 . Columns [ 8 ] . Hidden = true ;
this . Grid1 . Columns [ 9 ] . Hidden = true ;
this . Grid1 . Columns [ 10 ] . Hidden = true ;
this . Grid1 . Columns [ 11 ] . Hidden = true ;
this . Grid1 . Columns [ 12 ] . Hidden = true ;
this . Grid1 . Columns [ 13 ] . Hidden = true ;
this . Grid1 . Columns [ 14 ] . Hidden = true ;
this . Grid1 . Columns [ 15 ] . Hidden = true ;
this . Grid1 . Columns [ 16 ] . Hidden = true ;
this . Grid1 . Columns [ 17 ] . Hidden = true ;
this . Grid1 . Columns [ 18 ] . Hidden = true ;
this . Grid1 . Columns [ 19 ] . Hidden = true ;
this . Grid1 . Columns [ 20 ] . Hidden = true ;
this . Grid1 . Columns [ 21 ] . Hidden = true ;
this . Grid1 . Columns [ 22 ] . Hidden = true ;
this . Grid1 . Columns [ 23 ] . Hidden = true ;
this . Grid1 . Columns [ 24 ] . Hidden = true ;
this . Grid1 . Columns [ 25 ] . Hidden = true ;
this . Grid1 . Columns [ 26 ] . Hidden = true ;
this . Grid1 . Columns [ 27 ] . Hidden = true ;
this . Grid1 . Columns [ 28 ] . Hidden = true ;
this . Grid1 . Columns [ 29 ] . Hidden = true ;
this . Grid1 . Columns [ 30 ] . Hidden = true ;
this . Grid1 . Columns [ 31 ] . Hidden = true ;
this . Grid1 . Columns [ 32 ] . Hidden = true ;
this . Grid1 . Columns [ 33 ] . Hidden = true ;
this . Grid1 . Columns [ 34 ] . Hidden = true ;
this . Grid1 . Columns [ 35 ] . Hidden = true ;
this . Grid1 . Columns [ 36 ] . Hidden = true ;
this . Grid1 . Columns [ 37 ] . Hidden = true ;
this . Grid1 . Columns [ 38 ] . Hidden = true ;
this . Grid1 . Columns [ 39 ] . Hidden = true ;
this . Grid1 . Columns [ 40 ] . Hidden = true ;
this . Grid1 . Columns [ 41 ] . Hidden = true ;
this . Grid1 . Columns [ 42 ] . Hidden = true ;
this . Grid1 . Columns [ 43 ] . Hidden = true ;
this . Grid1 . Columns [ 44 ] . Hidden = true ;
this . Grid1 . Columns [ 45 ] . Hidden = true ;
this . Grid1 . Columns [ 46 ] . Hidden = true ;
this . Grid1 . Columns [ 47 ] . Hidden = true ;
List < string > columns = column . Split ( ',' ) . ToList ( ) ;
foreach ( var item in columns )
{
this . Grid1 . Columns [ Convert . ToInt32 ( item ) ] . Hidden = false ;
}
}
}
#endregion
#region 获 取 按 钮 权 限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private bool GetButtonPower ( string button )
{
2025-04-14 09:53:19 +08:00
return BLL . CommonService . GetAllButtonPowerList ( this . ProjectId , this . CurrUser . UserId , BLL . Const . HJGL_JointInfoMenuId , button ) ;
2025-04-07 17:43:30 +08:00
}
#endregion
#region 查 询
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtJOT_JointNo_TextChanged ( object sender , EventArgs e )
{
BindGrid ( ) ;
}
#endregion
protected void dpIsHj_SelectedIndexChanged ( object sender , EventArgs e )
{
BindGrid ( ) ;
}
}
}