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.IO ;
using System.Linq ;
using System.Web.UI.WebControls ;
namespace FineUIPro.Web.HJGL.TestPackageManage
{
public partial class TestPackageManageAudit : PageBase
{
#region 定 义 项
/// <summary>
2025-04-14 15:31:57 +08:00
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return ( string ) ViewState [ "ProjectId" ] ;
}
set
{
ViewState [ "ProjectId" ] = value ;
}
}
/// <summary>
2025-04-07 17:43:30 +08:00
/// 试压包主键
/// </summary>
public string PTP_ID
{
get
{
return ( string ) ViewState [ "PTP_ID" ] ;
}
set
{
ViewState [ "PTP_ID" ] = value ;
}
}
/// <summary>
/// 未通过数
/// </summary>
public int Count
{
get
{
return ( int ) ViewState [ "Count" ] ;
}
set
{
ViewState [ "Count" ] = value ;
}
}
/// <summary>
/// 管线集合
/// </summary>
private List < Model . View_TestPackageManageAudit > isoInfos = new List < Model . View_TestPackageManageAudit > ( ) ;
public int Count1 = 0 ;
public int Count2 = 0 ;
public int Count3 = 0 ;
public int Count4 = 0 ;
#endregion
#region 加 载
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
2025-04-14 15:31:57 +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 . InitDropDownList ( ) ;
this . ucTree . UnitId = this . CurrUser . UnitId ;
this . ucTree . ProjectId = this . ProjectId ;
if ( ! string . IsNullOrEmpty ( this . CurrUser . LoginProjectId ) )
{
this . panelLeftRegion . Hidden = true ;
////权限按钮方法
//this.GetButtonPower();
}
2025-04-07 17:43:30 +08:00
this . txtReportDate . Text = string . Format ( "{0:yyyy-MM}" , DateTime . Now ) ;
this . InitTreeMenu ( ) ;
}
}
2025-04-14 15:31:57 +08:00
private void InitDropDownList ( )
{
BLL . UserService . InitUserDropDownList ( this . drpPTP_Auditer , this . ProjectId , true ) ; //审核人
}
/// <summary>
/// 公司级树加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void changeTree ( object sender , EventArgs e )
{
this . ProjectId = this . ucTree . ProjectId ;
this . InitDropDownList ( ) ;
//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 15:31:57 +08:00
if ( string . IsNullOrEmpty ( this . ProjectId ) )
{
return ;
}
2025-04-07 17:43:30 +08:00
if ( ! string . IsNullOrEmpty ( this . txtReportDate . Text . Trim ( ) ) )
{
DateTime ? startTime = Funs . GetNewDateTime ( this . txtReportDate . Text . Trim ( ) ) ;
DateTime ? endTime = startTime . HasValue ? startTime . Value . AddMonths ( 1 ) : System . DateTime . Now ;
this . tvControlItem . Nodes . Clear ( ) ;
TreeNode rootNode = new TreeNode ( ) ;
rootNode . Text = "单位-装置-月份" ;
rootNode . NodeID = "0" ;
rootNode . Expanded = true ;
this . tvControlItem . Nodes . Add ( rootNode ) ;
List < Model . Base_Unit > units = null ;
var unit = BLL . ProjectUnitService . GetProjectUnitById ( this . CurrUser . UnitId ) ;
if ( unit = = null | | unit . UnitType = = BLL . Const . ProjectUnitType_1 | | unit . UnitType = = BLL . Const . ProjectUnitType_3 )
{
2025-04-14 15:31:57 +08:00
if ( BLL . WorkAreaService . IsSupervisor ( this . CurrUser . UnitId , this . ProjectId ) )
2025-04-07 17:43:30 +08:00
{
units = ( from x in Funs . DB . Base_Unit
join y in Funs . DB . ProjectData_WorkArea on x . UnitId equals y . UnitId
2025-04-14 15:31:57 +08:00
where ( x . UnitId = = this . CurrUser . UnitId | | y . SupervisorUnitId = = this . CurrUser . UnitId ) & & y . ProjectId = = this . ProjectId
2025-04-07 17:43:30 +08:00
select x ) . Distinct ( ) . ToList ( ) ;
}
else
{
2025-04-14 15:31:57 +08:00
units = BLL . UnitService . GetUnitByProjectIdUnitTypeList ( this . ProjectId , "2" ) ;
2025-04-07 17:43:30 +08:00
}
}
else
{
units = ( from x in Funs . DB . Base_Unit where x . UnitId = = this . CurrUser . UnitId select x ) . ToList ( ) ;
}
List < Model . TP_TestPackage > testPackageLists = new List < Model . TP_TestPackage > ( ) ; ///试压包
if ( ! this . txtReportDate . Hidden )
{
testPackageLists = ( from x in Funs . DB . TP_TestPackage
2025-04-14 15:31:57 +08:00
where x . ProjectId = = this . ProjectId & & x . PTP_TableDate > = startTime & & x . PTP_TableDate < endTime
2025-04-07 17:43:30 +08:00
select x ) . ToList ( ) ;
}
if ( units ! = null )
{
foreach ( var item in units )
{
TreeNode rootUnitNode = new TreeNode ( ) ; //定义根节点
rootUnitNode . Text = item . UnitName ;
rootUnitNode . NodeID = item . UnitId ;
rootUnitNode . Expanded = true ;
rootUnitNode . ToolTip = "施工单位" ;
rootNode . Nodes . Add ( rootUnitNode ) ;
var lists = testPackageLists . Where ( x = > x . BSU_ID = = item . UnitId ) . ToList ( ) ;
this . BindNodes ( rootUnitNode , lists ) ;
}
}
else
{
Alert . ShowInTop ( "请先增加施工单位!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "请选择试压月份!" , MessageBoxIcon . Warning ) ;
return ;
}
}
#endregion
#region 绑 定 树 节 点
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
private void BindNodes ( TreeNode node , List < Model . TP_TestPackage > testPackageLists )
{
if ( node . ToolTip = = "施工单位" )
{
var installId = ( from x in testPackageLists select x . InstallationId ) . Distinct ( ) ;
if ( installId . Count ( ) > 0 )
{
var install = from x in Funs . DB . Project_Installation where installId . Contains ( x . InstallationId ) orderby x . InstallationCode select x ;
foreach ( var q in install )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = q . InstallationCode + q . InstallationName ;
newNode . NodeID = q . InstallationId + "|" + node . NodeID ; ;
newNode . ToolTip = "装置" ;
newNode . Expanded = true ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , testPackageLists ) ;
}
}
}
else if ( node . ToolTip = = "装置" )
{
string installationId = Funs . GetStrListByStr ( node . NodeID , '|' ) [ 0 ] ;
var listMonth = ( from x in testPackageLists
where x . InstallationId = = installationId & & x . BSU_ID = = node . ParentNode . NodeID
select string . Format ( "{0:yyyy-MM}" , x . PTP_TableDate ) ) . Distinct ( ) ;
foreach ( var item in listMonth )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = item ;
newNode . NodeID = item + "|" + node . NodeID ; ;
newNode . ToolTip = "月份" ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , testPackageLists ) ;
}
}
else if ( node . ToolTip = = "月份" )
{
string installationId = Funs . GetStrListByStr ( node . ParentNode . NodeID , '|' ) [ 0 ] ;
var days = ( from x in testPackageLists
where x . InstallationId = = installationId & & x . BSU_ID = = node . ParentNode . ParentNode . NodeID
orderby x . PTP_TableDate descending
select x . PTP_TableDate ) . Distinct ( ) ;
foreach ( var item in days )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = string . Format ( "{0:yyyy-MM-dd}" , item ) ;
newNode . NodeID = item . ToString ( ) + "|" + node . NodeID ; ;
newNode . ToolTip = "日期" ;
node . Nodes . Add ( newNode ) ;
this . BindNodes ( newNode , testPackageLists ) ;
}
}
else if ( node . ToolTip = = "日期" )
{
string installationId = Funs . GetStrListByStr ( node . ParentNode . ParentNode . NodeID , '|' ) [ 0 ] ;
var dReports = from x in testPackageLists
where x . InstallationId = = installationId & & x . BSU_ID = = node . ParentNode . ParentNode . ParentNode . NodeID
& & x . PTP_TableDate = = Funs . GetNewDateTime ( node . Text )
orderby x . PTP_TestPackageNo descending
select x ;
foreach ( var item in dReports )
{
TreeNode newNode = new TreeNode ( ) ;
if ( ! string . IsNullOrEmpty ( item . PTP_TestPackageNo ) )
{
newNode . Text = item . PTP_TestPackageNo ;
}
else
{
newNode . Text = "未知" ;
}
if ( ! item . PTP_AduditDate . HasValue | | string . IsNullOrEmpty ( item . PTP_Auditer ) )
{
newNode . Text = "<font color='#FF7575'>" + newNode . Text + "</font>" ;
node . Text = "<font color='#FF7575'>" + node . Text + "</font>" ;
node . ParentNode . Text = "<font color='#FF7575'>" + node . ParentNode . Text + "</font>" ;
}
newNode . NodeID = item . PTP_ID ;
newNode . EnableClickEvent = true ;
node . Nodes . Add ( newNode ) ;
}
}
}
#endregion
#region 查 询 Tree
protected void Tree_TextChanged ( object sender , EventArgs e )
{
this . InitTreeMenu ( ) ;
}
#endregion
#region 点 击 树 节 点
/// <summary>
/// 点击树节点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand ( object sender , TreeCommandEventArgs e )
{
this . PTP_ID = this . tvControlItem . SelectedNodeID ;
if ( ! string . IsNullOrEmpty ( this . PTP_ID ) )
{
var testPackage = BLL . TestPackageManageEditService . GetTP_TestPackageByID ( PTP_ID ) ;
if ( testPackage ! = null )
{
if ( ! string . IsNullOrEmpty ( testPackage . BSU_ID ) )
{
this . txtUnitName . Text = BLL . UnitService . GetUnitNameByUnitId ( testPackage . BSU_ID ) ;
}
if ( ! string . IsNullOrEmpty ( testPackage . InstallationId ) )
{
this . txtInstallationName . Text = BLL . Project_InstallationService . GetInstallationByInstallationId ( testPackage . InstallationId ) . InstallationName ;
}
this . txtPTP_TightnessTestTime . Text = testPackage . PTP_TightnessTestTime ;
this . txtPTP_TestPackageNo . Text = testPackage . PTP_TestPackageNo ;
if ( ! string . IsNullOrEmpty ( testPackage . PTP_Modifier ) )
{
this . txtPTP_ModifierName . Text = BLL . UserService . GetUserNameByUserId ( testPackage . PTP_Modifier ) ;
}
this . txtPTP_LeakageTestService . Text = testPackage . PTP_LeakageTestService ;
this . txtPTP_TestPackageName . Text = testPackage . PTP_TestPackageName ;
this . txtPTP_ModifyDate . Text = testPackage . PTP_ModifyDate . HasValue ? string . Format ( "{0:yyyy-MM-dd}" , testPackage . PTP_ModifyDate ) : "" ;
this . txtPTP_LeakageTestPressure . Text = testPackage . PTP_LeakageTestPressure ;
this . txtPTP_TestHeat . Text = testPackage . PTP_TestHeat ;
this . txtPTP_TestPackageCode . Text = testPackage . PTP_TestPackageCode ;
this . txtPTP_TightnessTestTemp . Text = testPackage . PTP_TightnessTestTemp ;
this . txtPTP_TestService . Text = testPackage . PTP_TestService ;
this . txtPTP_TestAmbientTemp . Text = testPackage . PTP_TestAmbientTemp ;
this . txtPTP_VacuumTestService . Text = testPackage . PTP_VacuumTestService ;
if ( ! string . IsNullOrEmpty ( testPackage . PTP_TestType ) )
{
this . txtPTP_TestTypeName . Text = BLL . Base_PressureService . GetPressureByPressureId ( testPackage . PTP_TestType ) . PressureName ;
}
this . txtPTP_TestMediumTemp . Text = testPackage . PTP_TestMediumTemp ;
this . txtPTP_VacuumTestPressure . Text = testPackage . PTP_VacuumTestPressure ;
this . txtPTP_AllowSeepage . Text = testPackage . PTP_AllowSeepage ;
this . txtPTP_TestPressure . Text = testPackage . PTP_TestPressure ;
this . txtPTP_OperationMedium . Text = testPackage . PTP_OperationMedium ;
this . txtPTP_FactSeepage . Text = testPackage . PTP_FactSeepage ;
this . txtPTP_TestPressureTemp . Text = testPackage . PTP_TestPressureTemp ;
this . txtPTP_PurgingMedium . Text = testPackage . PTP_PurgingMedium ;
if ( ! string . IsNullOrEmpty ( testPackage . PTP_Tabler ) )
{
this . txtPTP_TablerName . Text = BLL . UserService . GetUserNameByUserId ( testPackage . PTP_Tabler ) ;
}
this . txtPTP_TestPressureTime . Text = testPackage . PTP_TestPressureTime ;
this . txtPTP_CleaningMedium . Text = testPackage . PTP_CleaningMedium ;
this . txtPTP_TableDate . Text = testPackage . PTP_TableDate . HasValue ? string . Format ( "{0:yyyy-MM-dd}" , testPackage . PTP_TableDate ) : "" ;
this . txtPTP_TightnessTest . Text = testPackage . PTP_TightnessTest ;
this . txtPTP_Remark . Text = testPackage . PTP_Remark ;
if ( ! string . IsNullOrEmpty ( testPackage . PTP_Auditer ) )
{
this . drpPTP_Auditer . SelectedValue = testPackage . PTP_Auditer ;
}
else
{
this . drpPTP_Auditer . SelectedValue = this . CurrUser . UserId ;
}
if ( testPackage . PTP_AduditDate . HasValue )
{
this . btnCancelAudit . Hidden = false ;
this . btnAudit . Hidden = true ;
this . txtPTP_AduditDate . Text = String . Format ( "{0:yyyy-MM-dd}" , testPackage . PTP_AduditDate ) ;
}
else
{
this . btnCancelAudit . Hidden = true ;
this . btnAudit . Hidden = false ;
this . txtPTP_AduditDate . Text = String . Format ( "{0:yyyy-MM-dd}" , DateTime . Now ) ;
}
isoInfos . Clear ( ) ;
isoInfos = BLL . TestPackageManageAuditService . GetTestPackageManageAuditByPTP_ID ( PTP_ID ) ;
if ( isoInfos . Count > 0 )
{
this . Grid1 . DataSource = isoInfos ;
this . Grid1 . DataBind ( ) ;
}
}
}
}
#endregion
#region 审 核
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click ( object sender , EventArgs e )
{
if ( this . GetButtonPower ( BLL . Const . BtnAuditing ) )
{
if ( ! string . IsNullOrEmpty ( this . PTP_ID ) )
{
var updateTestPackage = BLL . TestPackageManageEditService . GetTP_TestPackageByID ( this . PTP_ID ) ;
if ( updateTestPackage ! = null )
{
if ( Count = = 0 )
{
if ( ! string . IsNullOrEmpty ( this . txtPTP_AduditDate . Text ) & & this . drpPTP_Auditer . SelectedValue ! = BLL . Const . _Null & & ! string . IsNullOrEmpty ( this . drpPTP_Auditer . SelectedValue ) )
{
updateTestPackage . PTP_AduditDate = Funs . GetNewDateTime ( this . txtPTP_AduditDate . Text ) ;
updateTestPackage . PTP_Auditer = this . drpPTP_Auditer . SelectedValue ;
BLL . TestPackageManageAuditService . AuditTP_TestPackage ( updateTestPackage ) ;
ShowNotify ( "审核完成!" , MessageBoxIcon . Success ) ;
this . btnCancelAudit . Hidden = false ;
this . btnAudit . Hidden = true ;
}
else
{
Alert . ShowInTop ( "请填写审核人和审核日期!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "管线未全部通过不允许审核操作!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "请选择要审核的单据!" , MessageBoxIcon . Warning ) ;
return ;
}
}
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
#endregion
#region 取 消 审 核
/// <summary>
/// 取消审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCancelAudit_Click ( object sender , EventArgs e )
{
if ( this . GetButtonPower ( BLL . Const . BtnCancelAuditing ) )
{
if ( ! string . IsNullOrEmpty ( this . PTP_ID ) )
{
var updateTestPackage = BLL . TestPackageManageEditService . GetTP_TestPackageByID ( PTP_ID ) ;
if ( updateTestPackage ! = null )
{
updateTestPackage . PTP_Auditer = null ;
updateTestPackage . PTP_AduditDate = null ;
BLL . TestPackageManageAuditService . AuditTP_TestPackage ( updateTestPackage ) ;
ShowNotify ( "取消审核完成!" , MessageBoxIcon . Success ) ;
this . btnAudit . Hidden = false ;
this . btnCancelAudit . Hidden = true ;
}
}
}
else
{
Alert . ShowInTop ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
#endregion
#region 查 看 焊 口 信 息
/// <summary>
/// 查看焊口信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnJointInfoView_Click ( object sender , EventArgs e )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录" , MessageBoxIcon . Warning ) ;
return ;
}
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "ShowJointInfoView.aspx?ISO_ID={0}" , Grid1 . SelectedRowID , "编辑 - " ) ) ) ;
}
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick ( object sender , GridRowClickEventArgs e )
{
btnJointInfoView_Click ( null , null ) ;
}
#endregion
#region Grid行绑定事件
/// <summary>
/// Grid行绑定事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDataBound ( object sender , GridRowEventArgs e )
{
//Count = 0;
//int Count1 = 0, Count2 = 0, Count3 = 0, Count4 = 0;
foreach ( var item in isoInfos )
{
if ( item . ISO_ID = = e . RowID )
{
decimal Rate = 0 ;
int? isoInfoCount = item . IsoInfoCount ; //总焊口
int? isoInfoCountT = item . IsoInfoCountT ; //完成总焊口
int? countS = item . CountS ; //合格数
int? countU = item . CountU ; //不合格数
bool convertible = decimal . TryParse ( item . NDTR_Rate , out Rate ) ; //应检测比例
decimal? Ratio = item . RatioC ; //对接实际检测比例
decimal? RatioJ = item . RatioCJ ; //承插实际检测比例
if ( isoInfoCount > isoInfoCountT ) //未焊完
{
Count1 + = 1 ;
e . RowCssClass = "color1" ;
}
else if ( Rate > Ratio & & Rate > RatioJ ) //已焊完,未达检测比例
{
Count2 + = 1 ;
e . RowCssClass = "color2" ;
}
else if ( countU > 0 ) ////已焊完,已达检测比例,但有不合格
{
Count3 + = 1 ;
e . RowCssClass = "color3" ;
}
else //已通过
{
Count4 + = 1 ;
e . RowCssClass = "color4" ;
}
}
}
Count = Count1 + Count2 + Count3 ;
this . lab1 . Text = Count1 . ToString ( ) ;
this . lab2 . Text = Count2 . ToString ( ) ;
this . lab3 . Text = Count3 . ToString ( ) ;
this . lab4 . Text = Count4 . ToString ( ) ;
}
#endregion
#region 获 取 按 钮 权 限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private bool GetButtonPower ( string button )
{
2025-04-14 15:31:57 +08:00
return BLL . CommonService . GetAllButtonPowerList ( this . ProjectId , this . CurrUser . UserId , BLL . Const . HJGL_TestPackageManageAuditMenuId , button ) ;
2025-04-07 17:43:30 +08:00
}
#endregion
protected void btnPrint_Click ( object sender , EventArgs e )
{
if ( ! string . IsNullOrEmpty ( this . PTP_ID ) )
{
var updateTestPackage = BLL . TestPackageManageEditService . GetTP_TestPackageByID ( this . PTP_ID ) ;
if ( updateTestPackage ! = null )
{
if ( Count = = 0 )
{
string initTemplatePath = "" ;
string rootPath = Server . MapPath ( "~/" ) ;
BLL . Common . FastReportService . ResetData ( ) ;
switch ( printType . SelectedValue )
{
case "0" : // 试压包管线清单
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var ids = string . Join ( "," , iosList . Select ( x = > x . UnitId ) . ToList ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
var unitNames = BLL . UnitService . getUnitNamesUnitIds ( ids ) ;
var myNames = BLL . UnitService . getUnitNamesUnitIds ( this . CurrUser . UnitId ) ;
keyValuePairs . Add ( "InstallationName" , install . InstallationName ) ;
keyValuePairs . Add ( "workAreaName" , workArea . WorkAreaName ) ;
keyValuePairs . Add ( "UnitNames" , unitNames ) ;
keyValuePairs . Add ( "TestPackageNo" , updateTestPackage . PTP_TestPackageNo ) ;
keyValuePairs . Add ( "EPCPC" , myNames ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
DataTable dt = new DataTable ( ) ;
dt . TableName = "Data" ;
dt . Columns . Add ( "ISO_IsoNo" ) ;
dt . Columns . Add ( "ISO_DesignPress" ) ;
dt . Columns . Add ( "ISO_TestPress" ) ;
dt . Columns . Add ( "ISO_DesignTemperature" ) ;
dt . Columns . Add ( "Index" ) ;
for ( int i = 0 ; i < iosList . Count ; i + + )
{
var newrow = dt . NewRow ( ) ;
newrow [ "Index" ] = i + 1 ;
newrow [ "ISO_IsoNo" ] = iosList [ i ] . ISO_IsoNo ;
newrow [ "ISO_DesignPress" ] = iosList [ i ] . ISO_DesignPress ;
newrow [ "ISO_TestPress" ] = iosList [ i ] . ISO_TestPress ;
newrow [ "ISO_DesignTemperature" ] = iosList [ i ] . ISO_DesignTemperature ;
dt . Rows . Add ( newrow ) ;
}
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压包管线清单.frx" ;
}
}
break ;
case "1" : // 管道焊接工作记录
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
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 ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string strSql = @ "SELECT '' WED_Code,
jointInfo . JOT_JointNo ,
jointInfo . ISO_IsoNo ,
jointInfo . JOT_JointDesc ,
jointInfo . STE_Name1 ,
jointInfo . WeldingLocationName ,
jointInfo . WeldingMethodName , jointInfo . JOT_Location ,
jointInfo . JOT_WeldDate , jointInfo . WED_Code1 , jointInfo . WED_Code2 "
+ @" from View_JointInfo as jointInfo "
+ @" WHERE jointInfo.ProjectId= @projectId " ;
List < SqlParameter > listStr = new List < SqlParameter >
{
2025-04-14 15:31:57 +08:00
new SqlParameter ( "@projectId" , this . ProjectId ) ,
2025-04-07 17:43:30 +08:00
} ;
strSql + = "AND jointInfo.ISO_ID in ('" + isoIds + "') order by jointInfo.ISO_ID ,JOT_JointNo " ;
SqlParameter [ ] parameter5 = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter5 ) ;
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_Code1" ] . ToString ( ) ) )
WED_Name + = tb . Rows [ i ] [ "WED_Code1" ] . ToString ( ) ;
if ( ! string . IsNullOrEmpty ( tb . Rows [ i ] [ "WED_Code2" ] . ToString ( ) ) )
WED_Name + = "," + tb . Rows [ i ] [ "WED_Code1" ] . ToString ( ) ;
tb . Rows [ i ] [ "WED_Code" ] = WED_Name ;
}
}
BLL . Common . FastReportService . AddFastreportTable ( tb ) ;
initTemplatePath = "File\\Fastreport\\试压管道焊接工作记录.frx" ;
}
}
break ;
case "2" : // 管道无损检测结果汇总表
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoNos = string . Join ( "','" , iosList . Select ( x = > x . ISO_IsoNo ) . ToArray ( ) ) ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
var unitIds = string . Join ( "','" , iosList . Select ( x = > x . UnitId ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
var unitNames = BLL . UnitService . getUnitNamesUnitIds ( unitIds ) ;
keyValuePairs . Add ( "installName" , install . InstallationName ) ;
keyValuePairs . Add ( "workAreaName" , workArea . WorkAreaName ) ;
keyValuePairs . Add ( "WorkAreaCode" , workArea . WorkAreaCode ) ;
keyValuePairs . Add ( "UnitName2" , unitNames ) ;
if ( ! string . IsNullOrEmpty ( q . PipingClassId ) )
{
var PipingClass = BLL . Base_PipingClassService . GetPipingClassByPipingClassId ( q . PipingClassId ) ;
if ( PipingClass ! = null )
{
keyValuePairs . Add ( "ISOLevel" , PipingClass . PipingClassName ) ;
}
}
keyValuePairs . Add ( "isoCode" , isoNos ) ;
string sqlNDTCriteria = @ "select distinct CH_NDTCriteria from CH_Trust a
left join CH_TrustItem b on a . CH_TrustID = b . CH_TrustID
left join PW_JointInfo c on b . JOT_ID = c . JOT_ID
where c . ISO_ID in ( ' " + isoIds + " ' ) ";
DataTable tbNDTCriteria = SQLHelper . GetDataTableRunText ( sqlNDTCriteria , null ) ;
if ( tbNDTCriteria ! = null )
{
string NDTCriteria = "" ;
foreach ( DataRow row in tbNDTCriteria . Rows )
{
NDTCriteria + = row [ "CH_NDTCriteria" ] . ToString ( ) + "," ;
}
keyValuePairs . Add ( "CH_NDTCriteria" , NDTCriteria . TrimEnd ( ',' ) ) ;
}
string sqlStr = @ " select detectionType.DetectionTypeCode, weldType.WeldTypeName, checkItem.CHT_CheckResult,
sum ( checkItem . CHT_TotalFilm ) as TotalFilm , sum ( checkItem . CHT_PassFilm ) as PassFilm , sum ( checkItem . CHT_TotalFilm - checkItem . CHT_PassFilm ) as NoPassFilm , count ( distinct jointInfo . JOT_ID ) as jotNum
from PW_JointInfo jointInfo left join Base_WeldType as weldType on weldType . WeldTypeId = jointInfo . JOTY_ID
left join dbo . CH_TrustItem as trustItem on trustItem . JOT_ID = jointInfo . JOT_ID
left join dbo . CH_Trust as trust on trust . CH_TrustID = trustItem . CH_TrustID
left join dbo . Base_DetectionType as detectionType on trust . CH_NDTMethod = detectionType . DetectionTypeId
left join TP_IsoList on TP_IsoList . ISO_ID = jointInfo . ISO_ID
LEFT JOIN dbo . CH_CheckItem as checkItem ON trustItem . JOT_ID = checkItem . JOT_ID
where weldType . WeldTypeName in ( ' 对 接 ',' 角 焊 缝 ' ) and TP_IsoList . PTP_ID = ' "+this.PTP_ID+@" '
group by weldType . WeldTypeName , detectionType . DetectionTypeCode , checkItem . CHT_CheckResult ";
DataTable dt0 = SQLHelper . GetDataTableRunText ( sqlStr , null ) ;
2025-04-14 15:31:57 +08:00
var Unit1 = BLL . UnitService . GetUnitByProjectIdUnitTypeList ( this . ProjectId , BLL . Const . ProjectUnitType_3 ) ;
2025-04-07 17:43:30 +08:00
if ( Unit1 ! = null )
{
var unitNames1 = string . Join ( "," , Unit1 . Select ( x = > x . UnitName ) . ToArray ( ) ) ;
keyValuePairs . Add ( "UnitName1" , unitNames1 ) ;
}
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
DataTable dt1 = new DataTable ( ) ;
dt1 . TableName = "Customers" ;
dt1 . Columns . Add ( "detectType" ) ;
dt1 . Columns . Add ( "jot1" ) ;
dt1 . Columns . Add ( "pic1" ) ;
dt1 . Columns . Add ( "jot2" ) ;
dt1 . Columns . Add ( "pic2" ) ;
dt1 . Columns . Add ( "jot3" ) ;
dt1 . Columns . Add ( "pic3" ) ;
dt1 . Columns . Add ( "jot4" ) ;
dt1 . Columns . Add ( "pic4" ) ;
var newrow = dt1 . NewRow ( ) ;
newrow [ "detectType" ] = "RT" ;
int jot1 = 0 ;
int pic1 = 0 ;
int jot2 = 0 ;
int pic2 = 0 ;
int jot3 = 0 ;
int pic3 = 0 ;
int jot4 = 0 ;
int pic4 = 0 ;
DataRow [ ] rows = dt0 . Select ( "DetectionTypeCode='RT'" ) ;
foreach ( var row in rows )
{
var WeldTypeName = row [ "WeldTypeName" ] . ToString ( ) ;
switch ( WeldTypeName )
{
case "对接" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot1 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic1 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot3 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic3 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
case "角焊缝" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot2 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic2 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot4 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic4 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
}
}
if ( jot1 > 0 )
{
newrow [ "jot1" ] = jot1 ;
}
if ( pic1 > 0 )
{
newrow [ "pic1" ] = pic1 ;
}
if ( jot1 > 0 )
{
newrow [ "jot2" ] = jot2 ;
}
if ( pic1 > 0 )
{
newrow [ "pic2" ] = pic2 ;
}
if ( jot3 > 0 )
{
newrow [ "jot3" ] = jot3 ;
}
if ( pic3 > 0 )
{
newrow [ "pic3" ] = pic3 ;
}
if ( jot4 > 0 )
{
newrow [ "jot4" ] = jot4 ;
}
if ( pic4 > 0 )
{
newrow [ "pic4" ] = pic4 ;
}
dt1 . Rows . Add ( newrow ) ;
newrow = dt1 . NewRow ( ) ;
newrow [ "detectType" ] = "UT" ;
jot1 = 0 ;
pic1 = 0 ;
jot2 = 0 ;
pic2 = 0 ;
jot3 = 0 ;
pic3 = 0 ;
jot4 = 0 ;
pic4 = 0 ;
rows = dt0 . Select ( "DetectionTypeCode='UT'" ) ;
foreach ( var row in rows )
{
var WeldTypeName = row [ "WeldTypeName" ] . ToString ( ) ;
switch ( WeldTypeName )
{
case "对接" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot1 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic1 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot3 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic3 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
case "角焊缝" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot2 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic2 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot4 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic4 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
}
}
if ( jot1 > 0 )
{
newrow [ "jot1" ] = jot1 ;
}
if ( pic1 > 0 )
{
newrow [ "pic1" ] = pic1 ;
}
if ( jot1 > 0 )
{
newrow [ "jot2" ] = jot2 ;
}
if ( pic1 > 0 )
{
newrow [ "pic2" ] = pic2 ;
}
if ( jot3 > 0 )
{
newrow [ "jot3" ] = jot3 ;
}
if ( pic3 > 0 )
{
newrow [ "pic3" ] = pic3 ;
}
if ( jot4 > 0 )
{
newrow [ "jot4" ] = jot4 ;
}
if ( pic4 > 0 )
{
newrow [ "pic4" ] = pic4 ;
}
dt1 . Rows . Add ( newrow ) ;
newrow = dt1 . NewRow ( ) ;
newrow [ "detectType" ] = "MT" ;
jot1 = 0 ;
pic1 = 0 ;
jot2 = 0 ;
pic2 = 0 ;
jot3 = 0 ;
pic3 = 0 ;
jot4 = 0 ;
pic4 = 0 ;
rows = dt0 . Select ( "DetectionTypeCode='MT'" ) ;
foreach ( var row in rows )
{
var WeldTypeName = row [ "WeldTypeName" ] . ToString ( ) ;
switch ( WeldTypeName )
{
case "对接" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot1 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic1 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot3 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic3 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
case "角焊缝" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot2 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic2 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot4 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic4 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
}
}
if ( jot1 > 0 )
{
newrow [ "jot1" ] = jot1 ;
}
if ( pic1 > 0 )
{
newrow [ "pic1" ] = pic1 ;
}
if ( jot1 > 0 )
{
newrow [ "jot2" ] = jot2 ;
}
if ( pic1 > 0 )
{
newrow [ "pic2" ] = pic2 ;
}
if ( jot3 > 0 )
{
newrow [ "jot3" ] = jot3 ;
}
if ( pic3 > 0 )
{
newrow [ "pic3" ] = pic3 ;
}
if ( jot4 > 0 )
{
newrow [ "jot4" ] = jot4 ;
}
if ( pic4 > 0 )
{
newrow [ "pic4" ] = pic4 ;
}
dt1 . Rows . Add ( newrow ) ;
newrow = dt1 . NewRow ( ) ;
newrow [ "detectType" ] = "PT" ;
jot1 = 0 ;
pic1 = 0 ;
jot2 = 0 ;
pic2 = 0 ;
jot3 = 0 ;
pic3 = 0 ;
jot4 = 0 ;
pic4 = 0 ;
rows = dt0 . Select ( "DetectionTypeCode='PT'" ) ;
foreach ( var row in rows )
{
var WeldTypeName = row [ "WeldTypeName" ] . ToString ( ) ;
switch ( WeldTypeName )
{
case "对接" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot1 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic1 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot3 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic3 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
case "角焊缝" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot2 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic2 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot4 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic4 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
}
}
if ( jot1 > 0 )
{
newrow [ "jot1" ] = jot1 ;
}
if ( pic1 > 0 )
{
newrow [ "pic1" ] = pic1 ;
}
if ( jot1 > 0 )
{
newrow [ "jot2" ] = jot2 ;
}
if ( pic1 > 0 )
{
newrow [ "pic2" ] = pic2 ;
}
if ( jot3 > 0 )
{
newrow [ "jot3" ] = jot3 ;
}
if ( pic3 > 0 )
{
newrow [ "pic3" ] = pic3 ;
}
if ( jot4 > 0 )
{
newrow [ "jot4" ] = jot4 ;
}
if ( pic4 > 0 )
{
newrow [ "pic4" ] = pic4 ;
}
dt1 . Rows . Add ( newrow ) ;
newrow = dt1 . NewRow ( ) ;
newrow [ "detectType" ] = "TOFD" ;
jot1 = 0 ;
pic1 = 0 ;
jot2 = 0 ;
pic2 = 0 ;
jot3 = 0 ;
pic3 = 0 ;
jot4 = 0 ;
pic4 = 0 ;
rows = dt0 . Select ( "DetectionTypeCode='TOFD'" ) ;
foreach ( var row in rows )
{
var WeldTypeName = row [ "WeldTypeName" ] . ToString ( ) ;
switch ( WeldTypeName )
{
case "对接" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot1 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic1 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot3 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic3 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
case "角焊缝" :
{
var CHT_CheckResult = row [ "CHT_CheckResult" ] . ToString ( ) ;
switch ( CHT_CheckResult )
{
case "合格" :
jot2 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic2 + = int . Parse ( row [ "PassFilm" ] . ToString ( ) ) ;
break ;
case "不合格" :
jot4 + = int . Parse ( row [ "jotNum" ] . ToString ( ) ) ;
pic4 + = int . Parse ( row [ "NoPassFilm" ] . ToString ( ) ) ;
break ;
}
}
break ;
}
}
if ( jot1 > 0 )
{
newrow [ "jot1" ] = jot1 ;
}
if ( pic1 > 0 )
{
newrow [ "pic1" ] = pic1 ;
}
if ( jot1 > 0 )
{
newrow [ "jot2" ] = jot2 ;
}
if ( pic1 > 0 )
{
newrow [ "pic2" ] = pic2 ;
}
if ( jot3 > 0 )
{
newrow [ "jot3" ] = jot3 ;
}
if ( pic3 > 0 )
{
newrow [ "pic3" ] = pic3 ;
}
if ( jot4 > 0 )
{
newrow [ "jot4" ] = jot4 ;
}
if ( pic4 > 0 )
{
newrow [ "pic4" ] = pic4 ;
}
dt1 . Rows . Add ( newrow ) ;
newrow = dt1 . NewRow ( ) ;
newrow [ "detectType" ] = "" ;
dt1 . Rows . Add ( newrow ) ;
BLL . Common . FastReportService . AddFastreportTable ( dt1 ) ;
string sql3 = @ "select ISO_IsoNumber,JOT_JointNo,welder.WED_Code JOT_CellWelder,CHT_CheckCode,
case when e . CH_NDTMethod = ' 296 add43 - e979 - 4 cf3 - b13e - a68bb00a75d2 ' or e . CH_NDTMethod = ' a5e9c1bb - 1f ad - 4e65 - 82 bf - 03003 cc56ab4 ' then c . CHT_CheckResult end as CHT_CheckResult1 ,
case when e . CH_NDTMethod = ' 296 add43 - e979 - 4 cf3 - b13e - a68bb00a75d2 ' or e . CH_NDTMethod = ' a5e9c1bb - 1f ad - 4e65 - 82 bf - 03003 cc56ab4 ' then c . CHT_CheckNo end as CHT_CheckNo1 ,
case when e . CH_NDTMethod = ' c1a39a7f - 141f - 4243 - a23d - 34f 4 c9026d5f ' or e . CH_NDTMethod = ' 2460 a5e3 - b5fb - 40d 6 - 942e-3092d dc11a72 ' then c . CHT_CheckResult end as CHT_CheckResult2 ,
case when e . CH_NDTMethod = ' c1a39a7f - 141f - 4243 - a23d - 34f 4 c9026d5f ' or e . CH_NDTMethod = ' 2460 a5e3 - b5fb - 40d 6 - 942e-3092d dc11a72 ' then c . CHT_CheckNo end as CHT_CheckNo2
from PW_JointInfo a
left join PW_IsoInfo b on a . ISO_ID = b . ISO_ID
left join CH_CheckItem c on c . JOT_ID = a . JOT_ID
left join CH_Check d on c . CHT_CheckID = d . CHT_CheckID
left join CH_Trust e on d . CH_TrustID = e . CH_TrustID
left join BS_Welder as welder on welder . WED_ID = JOT_CellWelder
where a . ISO_ID in ( ' " + isoIds + " ' ) ";
DataTable dt = SQLHelper . GetDataTableRunText ( sql3 , null ) ;
dt . TableName = "DataTable2" ;
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压管道无损检测结果汇总表.frx" ;
}
}
break ;
case "3" : // 弹簧支/吊架安装检验记录
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
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 ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string sql3 = @ "select ISO_IsoNo from
PW_IsoInfo
where ISO_ID in ( ' " + isoIds + " ' ) ";
DataTable dt = SQLHelper . GetDataTableRunText ( sql3 , null ) ;
dt . TableName = "Table1" ;
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压弹簧支吊架安装检验记录.frx" ;
}
}
break ;
case "4" : // 滑动/固定管托安装检验
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
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 ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string sql3 = @ "select ISO_IsoNo from
PW_IsoInfo
where ISO_ID in ( ' " + isoIds + " ' ) ";
DataTable dt = SQLHelper . GetDataTableRunText ( sql3 , null ) ;
dt . TableName = "Table1" ;
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压滑动固定管托安装检验.frx" ;
}
}
break ;
case "5" : // 管道补偿器安装检验记录
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
var unitIds = string . Join ( "','" , iosList . Select ( x = > x . UnitId ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
var unitNames = BLL . UnitService . getUnitNamesUnitIds ( unitIds ) ;
keyValuePairs . Add ( "installName" , install . InstallationName ) ;
keyValuePairs . Add ( "workAreaName" , workArea . WorkAreaName ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
DataTable dt = new DataTable ( ) ;
dt . Columns . Add ( "ISO_IsoNo" ) ;
dt . TableName = "DataTable2" ;
foreach ( var item in iosList )
{
var newrow = dt . NewRow ( ) ;
newrow [ "ISO_IsoNo" ] = item . ISO_IsoNo ;
dt . Rows . Add ( newrow ) ;
}
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压管道补偿器安装检验记录.frx" ;
}
}
break ;
case "6" : // 管道试压后安装、焊接及检验检查表
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
keyValuePairs . Add ( "packageNum" , updateTestPackage . PTP_TestPackageNo ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string sql = @ "select b.ISO_IsoNo,a.JOT_JointNo,c.WED_Code WED_Code1,d.WED_Code WED_Code2 from PW_JointInfo a left join PW_IsoInfo b on a.ISO_ID=b.ISO_ID
left join BS_Welder c on a . JOT_CellWelder = c . WED_ID
left join BS_Welder d on a . JOT_CellWelder = d . WED_ID where a . ISO_ID in ( ' " + isoIds + " ' ) ";
DataTable dt = SQLHelper . GetDataTableRunText ( sql , null ) ;
dt . TableName = "DataTable2" ;
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压管道试压后安装焊接及检验检查表.frx" ;
}
}
break ;
case "7" : // 管道系统压力试验记录
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var q = iosList [ 0 ] ;
var isoIds = string . Join ( "','" , iosList . Select ( x = > x . ISO_ID ) . ToArray ( ) ) ;
var unitIds = string . Join ( "','" , iosList . Select ( x = > x . UnitId ) . ToArray ( ) ) ;
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
var workArea = BLL . WorkAreaService . getWorkAreaByWorkAreaId ( q . WorkAreaId ) ;
var install = BLL . Project_InstallationService . GetInstallationByInstallationId ( workArea . InstallationId ) ;
var unitNames = BLL . UnitService . getUnitNamesUnitIds ( unitIds ) ;
keyValuePairs . Add ( "installName" , install . InstallationName ) ;
keyValuePairs . Add ( "workAreaName" , workArea . WorkAreaName ) ; ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string sql = @ "select ISO_IsoNo, ISO_DesignPress,ISO_DesignTemperature,ISO_TestTemperature,ISO_TestPress,b.MediumName
from PW_IsoInfo a left join Base_TestMedium b on a . MaterialId = b . TestMediumId where a . ISO_ID in ( ' " + isoIds + " ' ) ";
DataTable dt = SQLHelper . GetDataTableRunText ( sql , null ) ;
dt . TableName = "DataTable2" ;
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\试压管道系统压力试验记录.frx" ;
}
}
break ;
case "8" : //管道无损检测数量统计表
{
var iosList = BLL . TestPackageManageEditService . GetIsoInfosByPTP_ID ( this . PTP_ID ) ;
if ( iosList . Count > 0 )
{
var workarea = WorkAreaService . getWorkAreaByWorkAreaId ( iosList [ 0 ] . WorkAreaId ) ;
//var q = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
string varValue = string . Empty ;
2025-04-14 15:31:57 +08:00
var projectName = BLL . ProjectService . GetProjectNameByProjectId ( this . ProjectId ) ;
2025-04-07 17:43:30 +08:00
var installation = BLL . Project_InstallationService . GetInstallationByInstallationId ( workarea . InstallationId ) ;
2025-04-14 15:31:57 +08:00
//var workarea = WorkAreaService.GetWorkAreaByProjectIdAndInstalltionIdAndUnitId(this.ProjectId, q.InstallationId, q.UnitId);
2025-04-07 17:43:30 +08:00
Dictionary < string , string > keyValuePairs = new Dictionary < string , string > ( ) ;
keyValuePairs . Add ( "projectName" , projectName ) ;
keyValuePairs . Add ( "install" , installation ! = null ? installation . InstallationName : "" ) ;
keyValuePairs . Add ( "workarea" , workarea ! = null ? workarea . WorkAreaName : "" ) ;
var jotList = Funs . DB . PW_JointInfo . Where ( x = > x . ISO_ID = = iosList [ 0 ] . ISO_ID ) . ToList ( ) ;
if ( jotList . Count > 0 )
{
var trustItem = TrustManageEditService . GetCH_TrustItemByJOT_ID ( jotList [ 0 ] . JOT_ID ) ;
if ( trustItem . Count > 0 )
{
var trust = TrustManageEditService . GetCH_TrustByID ( trustItem [ 0 ] . CH_TrustID ) ;
if ( trust ! = null )
{
keyValuePairs . Add ( "CH_NDTCriteria" , trust . CH_NDTCriteria ) ; //检测标志
var unitName = BLL . UnitService . GetUnitNameByUnitId ( trust . CH_TrustUnit ) ;
keyValuePairs . Add ( "conUnit" , unitName ) ;
}
}
}
var supUnitList = UnitService . GetUnitByProjectIdUnitTypeList ( workarea . ProjectId , Const . ProjectUnitType_3 ) ;
string supUnitName = "" ;
foreach ( var unit in supUnitList )
{
supUnitName + = unit . UnitName + "," ;
}
keyValuePairs . Add ( "supUnit" , supUnitName ) ;
BLL . Common . FastReportService . ResetData ( ) ;
BLL . Common . FastReportService . AddFastreportParameter ( keyValuePairs ) ;
string strSql = @ " select jointInfo.ISO_ID,weldType.WeldTypeName , detectionType.DetectionTypeCode, COUNT( distinct jointInfo.JOT_ID) as num from PW_JointInfo jointInfo left join Base_WeldType as weldType on weldType.WeldTypeId=jointInfo.JOTY_ID
left join dbo . CH_TrustItem as trustItem on trustItem . JOT_ID = jointInfo . JOT_ID
left join dbo . CH_Trust as trust on trust . CH_TrustID = trustItem . CH_TrustID
left join dbo . Base_DetectionType as detectionType on trust . CH_NDTMethod = detectionType . DetectionTypeId
left join TP_IsoList on TP_IsoList . ISO_ID = jointInfo . ISO_ID
LEFT JOIN dbo . CH_CheckItem as checkItem ON trustItem . JOT_ID = checkItem . JOT_ID
where TP_IsoList . PTP_ID = @PTP_ID
group by weldType . WeldTypeName , detectionType . DetectionTypeCode , jointInfo . ISO_ID ";
List < SqlParameter > listpar = new List < SqlParameter >
{
new SqlParameter ( "@PTP_ID" , this . PTP_ID )
} ;
DataTable dt2 = SQLHelper . GetDataTableRunText ( strSql , listpar . ToArray ( ) ) ;
DataTable dt = new DataTable ( ) ;
dt . Columns . Add ( "ISO_IsoNo" ) ;
dt . Columns . Add ( "DetectionRateValue" ) ;
dt . Columns . Add ( "ALL1" ) ;
dt . Columns . Add ( "RT1" ) ;
dt . Columns . Add ( "UT1" ) ;
dt . Columns . Add ( "MT1" ) ;
dt . Columns . Add ( "PT1" ) ;
dt . Columns . Add ( "TOFD1" ) ;
dt . Columns . Add ( "ALL2" ) ;
dt . Columns . Add ( "RT2" ) ;
dt . Columns . Add ( "UT2" ) ;
dt . Columns . Add ( "MT2" ) ;
dt . Columns . Add ( "PT2" ) ;
dt . Columns . Add ( "TOFD2" ) ;
dt . Columns . Add ( "ALL3" ) ;
dt . Columns . Add ( "RT3" ) ;
dt . Columns . Add ( "UT3" ) ;
dt . Columns . Add ( "MT3" ) ;
dt . Columns . Add ( "PT3" ) ;
dt . Columns . Add ( "TOFD3" ) ;
dt . Columns . Add ( "ALL4" ) ;
dt . Columns . Add ( "RT4" ) ;
dt . Columns . Add ( "UT4" ) ;
dt . Columns . Add ( "MT4" ) ;
dt . Columns . Add ( "PT4" ) ;
dt . Columns . Add ( "TOFD4" ) ;
if ( dt ! = null )
{
dt . TableName = "Table1" ;
}
foreach ( var item in iosList )
{
var newRow = dt . NewRow ( ) ;
newRow [ "ISO_IsoNo" ] = item . ISO_IsoNo ;
var detectionRate = Funs . DB . Base_DetectionRate . Where ( x = > x . DetectionRateId = = item . DetectionRateId ) . FirstOrDefault ( ) ;
if ( detectionRate ! = null )
{
newRow [ "DetectionRateValue" ] = detectionRate . DetectionRateValue ;
}
DataRow [ ] rows = dt2 . Select ( "ISO_ID = '" + item . ISO_ID + "'" ) ;
int total1 = 0 ;
int RT1 = 0 ;
int UT1 = 0 ;
int MT1 = 0 ;
int PT1 = 0 ;
int TOFD1 = 0 ;
int total2 = 0 ;
int RT2 = 0 ;
int UT2 = 0 ;
int MT2 = 0 ;
int PT2 = 0 ;
int TOFD2 = 0 ;
foreach ( var item1 in rows )
{
var WeldTypeName = item1 [ "WeldTypeName" ] . ToString ( ) ;
switch ( WeldTypeName )
{
case "对接" :
total1 + = int . Parse ( item1 [ "num" ] . ToString ( ) ) ;
{
string DetectionTypeCode = item1 [ "DetectionTypeCode" ] . ToString ( ) ;
switch ( DetectionTypeCode )
{
case "RT" :
RT1 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "UT" :
UT1 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "MT" :
MT1 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "PT" :
PT1 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "TOFD" :
TOFD1 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
}
}
break ;
case "角焊缝" :
total2 + = int . Parse ( item1 [ "num" ] . ToString ( ) ) ;
{
string DetectionTypeCode = item1 [ "DetectionTypeCode" ] . ToString ( ) ;
switch ( DetectionTypeCode )
{
case "RT" :
RT2 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "UT" :
UT2 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "MT" :
MT2 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "PT" :
PT2 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
case "TOFD" :
TOFD2 + = int . Parse ( newRow [ "num" ] . ToString ( ) ) ;
break ;
}
}
break ;
}
}
newRow [ "ALL1" ] = total1 ;
newRow [ "RT1" ] = RT1 ;
newRow [ "UT1" ] = UT1 ;
newRow [ "MT1" ] = MT1 ;
newRow [ "PT1" ] = PT1 ;
newRow [ "TOFD1" ] = TOFD1 ;
newRow [ "ALL2" ] = total2 ;
newRow [ "RT2" ] = RT2 ;
newRow [ "UT2" ] = UT2 ;
newRow [ "MT2" ] = MT2 ;
newRow [ "PT2" ] = PT2 ;
newRow [ "TOFD2" ] = TOFD2 ;
dt . Rows . Add ( newRow ) ;
}
BLL . Common . FastReportService . AddFastreportTable ( dt ) ;
initTemplatePath = "File\\Fastreport\\管道无损检测数量统计表.frx" ;
}
}
break ;
}
if ( File . Exists ( rootPath + initTemplatePath ) )
{
PageContext . RegisterStartupScript ( Window6 . GetShowReference ( String . Format ( "../TrustManage/Fastreport.aspx?ReportPath={0}" , rootPath + initTemplatePath ) ) ) ;
}
}
else
{
Alert . ShowInTop ( "管线未全部通过不允许打印操作!" , MessageBoxIcon . Warning ) ;
return ;
}
}
else
{
Alert . ShowInTop ( "请选择要打印的单据!" , MessageBoxIcon . Warning ) ;
return ;
}
}
}
}
}