2024-05-08 10:02:08 +08:00
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Data.SqlClient ;
using System.Linq ;
2024-05-22 14:41:37 +08:00
using System.Web.ModelBinding ;
2024-05-22 22:57:06 +08:00
using System.Web.UI.DataVisualization.Charting ;
using System.Windows.Forms ;
2024-05-08 10:02:08 +08:00
using BLL ;
2024-05-22 20:36:40 +08:00
using Model ;
2024-05-08 10:02:08 +08:00
using Newtonsoft.Json.Linq ;
namespace FineUIPro.Web.WeldingProcess.TestPackageManage
{
public partial class TestPackageManageItemEdit : PageBase
{
#region 定 义 项
/// <summary>
/// 试压包主键
/// </summary>
public string PTP_ID
{
get
{
return ( string ) ViewState [ "PTP_ID" ] ;
}
set
{
ViewState [ "PTP_ID" ] = value ;
}
}
/// <summary>
/// 选择字符串
/// </summary>
public List < string > listSelects
{
get
{
return ( List < string > ) ViewState [ "listSelects" ] ;
}
set
{
ViewState [ "listSelects" ] = value ;
}
}
#endregion
#region 加 载 页 面
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
this . ddlPageSize . SelectedValue = this . Grid1 . PageSize . ToString ( ) ;
this . PTP_ID = Request . Params [ "PTP_ID" ] ;
List < Model . Base_Unit > units = new List < Model . Base_Unit > ( ) ;
var pUnit = BLL . Project_UnitService . GetProject_UnitByProjectIdUnitId ( this . CurrUser . LoginProjectId , this . CurrUser . UnitId ) ;
if ( pUnit = = null | | pUnit . UnitType = = BLL . Const . UnitType_1 | | pUnit . UnitType = = BLL . Const . UnitType_2
| | pUnit . UnitType = = BLL . Const . UnitType_3 | | pUnit . UnitType = = BLL . Const . UnitType_4 )
{
units = ( from x in Funs . DB . Base_Unit
join y in Funs . DB . Project_Unit on x . UnitId equals y . UnitId
where y . ProjectId = = this . CurrUser . LoginProjectId & & y . UnitType . Contains ( BLL . Const . UnitType_5 )
select x ) . ToList ( ) ;
}
else
{
units . Add ( BLL . Base_UnitService . GetUnit ( this . CurrUser . UnitId ) ) ;
}
///单位
this . drpUnit . DataTextField = "UnitName" ;
this . drpUnit . DataValueField = "UnitId" ;
this . drpUnit . DataSource = units ;
this . drpUnit . DataBind ( ) ;
Funs . FineUIPleaseSelect ( this . drpUnit ) ;
Funs . FineUIPleaseSelect ( this . drpInstallation ) ;
// 修改人
BLL . Project_UserService . InitProjectUserDropDownList ( drpModifier , true , this . CurrUser . LoginProjectId , Resources . Lan . PleaseSelect ) ;
// 建档人
BLL . Project_UserService . InitProjectUserDropDownList ( drpTabler , true , this . CurrUser . LoginProjectId , Resources . Lan . PleaseSelect ) ;
// 试压类型
BLL . Base_PressureService . InitPressureDropDownList ( drpTestType , true , Resources . Lan . PleaseSelect ) ;
// 材质
BLL . Base_MaterialService . InitMaterialDropDownList ( drpMaterial , true , Resources . Lan . PleaseSelect ) ;
// 介质
BLL . Base_MediumService . InitMediumDropDownList ( drpMedium , true , Resources . Lan . PleaseSelect ) ;
// 管线等级
BLL . Base_PipingClassService . InitPipingClassDropDownList ( drpPipingClass , true , Resources . Lan . PleaseSelect ) ;
listSelects = new List < string > ( ) ;
var list = ( from x in Funs . DB . PTP_PipelineList
where x . PTP_ID = = this . PTP_ID
select x ) . ToList ( ) ;
if ( list . Count ( ) > 0 )
{
foreach ( var infoRow in list )
{
listSelects . Add ( infoRow . PipelineId ) ;
}
}
this . PageInfoLoad ( ) ; ///加载页面
2024-05-22 14:41:37 +08:00
2024-05-08 10:02:08 +08:00
}
}
#endregion
#region 加 载 页 面 输 入 保 存 信 息
/// <summary>
/// 加载页面输入保存信息
/// </summary>
private void PageInfoLoad ( )
{
var testPackageManage = BLL . TestPackageManageEditService . GetTestPackageByID ( this . PTP_ID ) ;
if ( testPackageManage ! = null )
{
this . txtTestPackageNo . Text = testPackageManage . TestPackageNo ;
if ( ! string . IsNullOrEmpty ( testPackageManage . UnitId ) )
{
this . drpUnit . SelectedValue = testPackageManage . UnitId ;
}
if ( ! string . IsNullOrEmpty ( testPackageManage . InstallationId ) )
{
BLL . Project_InstallationService . InitInstallationDropDownList ( drpInstallation , true , this . CurrUser . LoginProjectId , testPackageManage . UnitId , Resources . Lan . PleaseSelect ) ;
drpInstallation . SelectedValue = testPackageManage . InstallationId ;
var install = this . drpInstallation . Items . FirstOrDefault ( x = > x . Value = = testPackageManage . InstallationId ) ;
if ( install ! = null )
{
BLL . Project_WorkAreaService . InitWorkAreaDropDownList ( drpWorkArea , true , this . CurrUser . LoginProjectId , drpInstallation . SelectedValue , drpUnit . SelectedValue , null , Resources . Lan . PleaseSelect ) ;
}
}
this . txtTestPackageName . Text = testPackageManage . TestPackageName ;
//this.txtTestPackageCode.Text = testPackageManage.TestPackageCode;
if ( ! string . IsNullOrEmpty ( testPackageManage . TestType ) )
{
this . drpTestType . SelectedValue = testPackageManage . TestType ;
}
this . txtTestService . Text = testPackageManage . TestService ;
this . txtTestHeat . Text = testPackageManage . TestHeat ;
this . txtTestAmbientTemp . Text = testPackageManage . TestAmbientTemp ;
this . txtTestMediumTemp . Text = testPackageManage . TestMediumTemp ;
this . txtVacuumTestService . Text = testPackageManage . VacuumTestService ;
this . txtVacuumTestPressure . Text = testPackageManage . VacuumTestPressure ;
this . txtTightnessTestTime . Text = testPackageManage . TightnessTestTime ;
this . txtTightnessTestTemp . Text = testPackageManage . TightnessTestTemp ;
this . txtTightnessTest . Text = testPackageManage . TightnessTest ;
this . txtTestPressure . Text = testPackageManage . TestPressure ;
this . txtTestPressureTemp . Text = testPackageManage . TestPressureTemp ;
this . txtTestPressureTime . Text = testPackageManage . TestPressureTime ;
this . txtOperationMedium . Text = testPackageManage . OperationMedium ;
this . txtPurgingMedium . Text = testPackageManage . PurgingMedium ;
this . txtCleaningMedium . Text = testPackageManage . CleaningMedium ;
this . txtLeakageTestService . Text = testPackageManage . LeakageTestService ;
this . txtLeakageTestPressure . Text = testPackageManage . LeakageTestPressure ;
this . txtAllowSeepage . Text = testPackageManage . AllowSeepage ;
this . txtFactSeepage . Text = testPackageManage . FactSeepage ;
this . txtModifyDate . Text = string . Format ( "{0:yyyy-MM-dd}" , testPackageManage . ModifyDate ) ;
if ( ! string . IsNullOrEmpty ( testPackageManage . Modifier ) )
{
this . drpModifier . SelectedValue = testPackageManage . Modifier ;
}
this . txtTableDate . Text = string . Format ( "{0:yyyy-MM-dd}" , testPackageManage . TableDate ) ;
if ( ! string . IsNullOrEmpty ( testPackageManage . Tabler ) )
{
this . drpTabler . SelectedValue = testPackageManage . Tabler ;
}
this . txtRemark . Text = testPackageManage . Remark ;
2024-05-22 20:36:40 +08:00
var items = Funs . DB . PTP_PipelineList . Where ( t = > t . PTP_ID = = testPackageManage . PTP_ID )
. Select ( t = > t . WorkAreaId ) . FirstOrDefault ( ) ;
if ( items ! = null )
{
drpWorkArea . SelectedValue = items ;
}
2024-05-08 10:02:08 +08:00
this . BindGrid ( ) ; ////初始化页面
this . ShowGridItem ( ) ;
}
else
{
this . txtModifyDate . Text = string . Format ( "{0:yyyy-MM-dd}" , System . DateTime . Now ) ;
this . txtTableDate . Text = string . Format ( "{0:yyyy-MM-dd}" , System . DateTime . Now ) ;
if ( this . CurrUser . UserId ! = BLL . Const . GlyId )
{
this . drpTabler . SelectedValue = this . CurrUser . UserId ;
this . drpModifier . SelectedValue = this . CurrUser . UserId ;
}
}
}
#endregion
#region 数 据 绑 定
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid ( )
{
2024-05-22 20:36:40 +08:00
string strSql = string . Empty ;
if ( string . IsNullOrEmpty ( this . PTP_ID ) )
{
strSql = @ "SELECT
IsoInfo . ProjectId , IsoInfo . WorkAreaId , WorkArea . WorkAreaCode , IsoInfo . PipelineId , IsoInfo . PipelineCode ,
IsoInfo . DesignPressure , IsoInfo . DesignTemperature , WorkArea . InstallationId , IsoInfo . UnitId ,
2024-05-23 01:05:28 +08:00
IsoInfo . TestPressure , IsoInfo . TestTemperature , bs . MediumName , IsoInfo . SingleNumber ,
' 全 部 ' as WeldJointCode
2024-05-22 20:36:40 +08:00
FROM dbo . Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO . Project_WorkArea AS WorkArea ON IsoInfo . WorkAreaId = WorkArea . WorkAreaId
LEFT JOIN dbo . Base_Medium AS bs ON bs . MediumId = IsoInfo . MediumId
2024-05-08 10:02:08 +08:00
WHERE IsoInfo . ProjectId = @ProjectId AND IsoInfo . UnitId = @UnitId
2024-05-22 21:36:20 +08:00
AND WorkArea . InstallationId = @InstallationId AND
IsoInfo . PipelineId not in (
select PipelineId from PTP_PipelineList where PipelineId = IsoInfo . PipelineId and
WorkAreaId = IsoInfo . WorkAreaId and isAll = 1
)
";
2024-05-22 20:36:40 +08:00
}
else
{
strSql = @ "SELECT
IsoInfo . ProjectId , IsoInfo . WorkAreaId , WorkArea . WorkAreaCode , IsoInfo . PipelineId , IsoInfo . PipelineCode ,
IsoInfo . DesignPressure , IsoInfo . DesignTemperature , WorkArea . InstallationId , IsoInfo . UnitId ,
IsoInfo . TestPressure , IsoInfo . TestTemperature , bs . MediumName , IsoInfo . SingleNumber ,
2024-05-23 01:05:28 +08:00
IsoList . isAll , ( case when ( isnull ( IsoList . WeldJonintCode , ' ' ) = ' ' ) then ' 全 部 ' else IsoList . WeldJonintCode end ) as WeldJointCode
2024-05-22 20:36:40 +08:00
FROM dbo . Pipeline_Pipeline AS IsoInfo
LEFT JOIN DBO . Project_WorkArea AS WorkArea ON IsoInfo . WorkAreaId = WorkArea . WorkAreaId
LEFT JOIN dbo . Base_Medium AS bs ON bs . MediumId = IsoInfo . MediumId
2024-05-23 11:20:42 +08:00
LEFT JOIN dbo . PTP_PipelineList AS IsoList ON IsoList . PipelineId = IsoInfo . PipelineId
and IsoInfo . WorkAreaId = IsoList . WorkAreaId and IsoList . PTP_ID = @PTP_ID
2024-05-22 20:36:40 +08:00
WHERE IsoInfo . ProjectId = @ProjectId AND IsoInfo . UnitId = @UnitId
AND WorkArea . InstallationId = @InstallationId ";
}
2024-05-08 10:02:08 +08:00
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@ProjectId" , this . CurrUser . LoginProjectId ) ) ;
2024-05-22 20:36:40 +08:00
2024-05-08 10:02:08 +08:00
listStr . Add ( new SqlParameter ( "@UnitId" , this . drpUnit . SelectedValue ) ) ;
listStr . Add ( new SqlParameter ( "@InstallationId" , this . drpInstallation . SelectedValue ) ) ;
2024-05-23 11:20:42 +08:00
if ( ! string . IsNullOrEmpty ( this . PTP_ID ) )
{
listStr . Add ( new SqlParameter ( "@PTP_ID" , this . PTP_ID ) ) ;
}
2024-05-22 20:36:40 +08:00
2024-05-08 10:02:08 +08:00
if ( this . drpWorkArea . SelectedValue ! = Const . _Null & & drpWorkArea . SelectedValue ! = null )
{
strSql + = " AND IsoInfo.WorkAreaId = @WorkAreaId" ;
listStr . Add ( new SqlParameter ( "@WorkAreaId" , this . drpWorkArea . SelectedValue ) ) ;
}
if ( this . drpPipingClass . SelectedValue ! = Const . _Null )
{
strSql + = " AND IsoInfo.PipingClassId = @PipingClassId" ;
listStr . Add ( new SqlParameter ( "@PipingClassId" , this . drpPipingClass . SelectedValue ) ) ;
}
if ( this . drpMedium . SelectedValue ! = Const . _Null )
{
strSql + = " AND IsoInfo.MediumId = @MediumId" ;
listStr . Add ( new SqlParameter ( "@MediumId" , this . drpMedium . SelectedValue ) ) ;
}
if ( this . drpMaterial . SelectedValue ! = Const . _Null )
{
strSql + = " AND IsoInfo.MainMaterialId = @MaterialId" ;
listStr . Add ( new SqlParameter ( "@MaterialId" , this . drpMaterial . SelectedValue ) ) ;
}
if ( txtDia . Text ! = "" )
{
strSql + = " AND (SELECT COUNT(*) FROM dbo.Pipeline_WeldJoint jot WHERE jot.PipelineId=IsoInfo.PipelineId AND jot.Dia >= @Dia)> 0" ;
listStr . Add ( new SqlParameter ( "@Dia" , Convert . ToDecimal ( txtDia . Text ) ) ) ;
}
//if (this.drpWorkArea.SelectedValueArray.Count() > 1 || (this.drpWorkArea.SelectedValueArray.Count() == 1 && this.drpWorkArea.SelectedValueArray[0] != BLL.Const._Null))
//{
// strSql += " AND (IsoInfo.WorkAreaId = '' ";
// int i = 0;
// foreach (var item in this.drpWorkArea.SelectedValueArray)
// {
// if (item != BLL.Const._Null)
// {
// strSql += " OR IsoInfo.WorkAreaId = @WorkAreaId" + i.ToString();
// listStr.Add(new SqlParameter("@WorkAreaId" + i.ToString(), item));
// i++;
// }
// }
// strSql += ")";
//}
//if (!string.IsNullOrEmpty(this.txtIsono.Text.Trim()))
//{
// strSql += " AND IsoInfo.PipelineCode LIKE @PipelineCode";
// listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtIsono.Text.Trim() + "%"));
//}
//if (this.ckSelect.Checked) ///只显示选中项
//{
// if (this.listSelects.Count() > 0)
// {
// strSql += " AND (ISO_IsoNo.ISO_ID = @ISO_ID ";
// listStr.Add(new SqlParameter("@ISO_ID", ""));
// int i = 0;
// foreach (var items in this.listSelects)
// {
// List<string> item = Funs.GetStrListByStr(items, '|');
// strSql += " OR ISO_IsoNo.ISO_ID = @ISO_ID" + i.ToString();
// listStr.Add(new SqlParameter("@ISO_ID" + i.ToString(), item[0].ToString()));
// i++;
// }
// strSql += ")";
// }
//}
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
2024-05-23 20:10:26 +08:00
if ( string . IsNullOrEmpty ( this . PTP_ID ) )
{
foreach ( DataRow dr in tb . Rows )
{
string pipelineId = dr [ "PipelineId" ] . ToString ( ) ;
string joinCodeList = dr [ "WeldJointCode" ] . ToString ( ) ;
int count = countWeldJointCode ( pipelineId ) ;
int baseCount = countBaseWeldJointCode ( pipelineId ) ;
if ( count = = baseCount )
{
dr . Delete ( ) ;
}
}
}
2024-05-08 10:02:08 +08:00
// 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 ( ) ;
2024-05-22 14:41:37 +08:00
2024-05-08 10:02:08 +08:00
}
2024-05-23 20:10:26 +08:00
private int countBaseWeldJointCode ( string pipelineId )
{
string sql = "select count(1) from Pipeline_WeldJoint where PipelineId=@PipelineId" ;
SqlParameter [ ] parameters = new SqlParameter [ ] {
new SqlParameter ( "@PipelineId" , pipelineId )
} ;
int count = SQLHelper . getIntValue ( sql , parameters ) ;
return count ;
}
private int countWeldJointCode ( string pipelineId )
{
string sql = @"select WeldJointCode=(stuff((select ','+ WeldJonintCode from PTP_PipelineList where PipelineId=@PipelineId and isALL=0 for xml path('')),1,1,''))" ;
SqlParameter [ ] parameters = new SqlParameter [ ] {
new SqlParameter ( "@PipelineId" , pipelineId )
} ;
string strCode = SQLHelper . GetStr ( sql , parameters ) ;
if ( ! string . IsNullOrEmpty ( strCode ) )
{
string [ ] arr = strCode . Split ( ',' ) ;
return arr = = null ? 0 : arr . Length ;
}
else
{
return 0 ;
}
}
2024-05-08 10:02:08 +08:00
/// <summary>
/// 对GV 赋值
/// </summary>
/// <param name="jointInfosSelectList"></param>
private void ShowGridItem ( )
{
for ( int i = 0 ; i < Grid1 . Rows . Count ; i + + )
{
Grid1 . Rows [ i ] . Values [ 0 ] = BLL . Const . _False ;
////操作焊接焊口信息
if ( listSelects . Count ( ) > 0 )
{
foreach ( var item in listSelects )
{
if ( item = = Grid1 . DataKeys [ i ] [ 0 ] . ToString ( ) )
{
Grid1 . Rows [ i ] . Values [ 0 ] = BLL . Const . _True ;
}
}
}
}
}
#endregion
#region 下 拉 框 联 动 事 件
/// <summary>
/// 单位下拉框变化事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpUnit_OnSelectedIndexChanged ( object sender , EventArgs e )
{
this . drpInstallation . Items . Clear ( ) ;
this . drpWorkArea . Items . Clear ( ) ;
BLL . Project_InstallationService . InitInstallationDropDownList ( drpInstallation , true , this . CurrUser . LoginProjectId , drpUnit . SelectedValue , Resources . Lan . PleaseSelect ) ;
Funs . FineUIPleaseSelect ( this . drpWorkArea ) ;
}
/// <summary>
/// 单位、装置下拉框变化事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpInstallation_OnSelectedIndexChanged ( object sender , EventArgs e )
{
BLL . Project_WorkAreaService . InitWorkAreaDropDownList ( drpWorkArea , true , this . CurrUser . LoginProjectId , drpInstallation . SelectedValue , drpUnit . SelectedValue , null , Resources . Lan . PleaseSelect ) ;
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
}
/// <summary>
/// 区域下拉框事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Find_OnSelectedIndexChanged ( object sender , EventArgs e )
{
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
2024-05-22 22:57:06 +08:00
2024-05-08 10:02:08 +08:00
}
#endregion
#region 分 页 排 序
#region 页 索 引 改 变 事 件
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange ( object sender , GridPageEventArgs e )
{
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
}
#endregion
#region 排 序
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort ( object sender , GridSortEventArgs e )
{
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
}
#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 ) ;
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
}
#endregion
#endregion
#region 试 压 包 保 存 事 件
/// <summary>
/// 编辑试压包
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click ( object sender , EventArgs e )
{
if ( CommonService . GetAllButtonPowerList ( this . CurrUser . LoginProjectId , this . CurrUser . UserId , Const . TestPackageManageEditMenuId , Const . BtnSave ) )
{
if ( BLL . TestPackageManageEditService . IsExistTestPackageCode ( this . txtTestPackageNo . Text , this . PTP_ID , this . CurrUser . LoginProjectId ) )
{
ShowNotify ( "试压包编号已存在,请重新录入!" , MessageBoxIcon . Warning ) ;
return ;
}
if ( string . IsNullOrEmpty ( this . txtTestPackageNo . Text ) | | this . drpUnit . SelectedValue = = BLL . Const . _Null | | this . drpTabler . SelectedValue = = BLL . Const . _Null
| | this . drpInstallation . SelectedValue = = BLL . Const . _Null | | string . IsNullOrEmpty ( this . txtTableDate . Text ) )
{
ShowNotify ( "必填项不能为空!" , MessageBoxIcon . Warning ) ;
return ;
}
this . CollectGridJointInfo ( ) ;
if ( this . listSelects . Count ( ) = = 0 )
{
ShowNotify ( "请选择管线号!" , MessageBoxIcon . Warning ) ;
return ;
}
var updatetrust = BLL . TestPackageManageEditService . GetTestPackageByID ( this . PTP_ID ) ;
if ( updatetrust ! = null & & updatetrust . AduditDate . HasValue )
{
ShowNotify ( "此施压包已审核不能修改!" , MessageBoxIcon . Warning ) ;
return ;
}
Model . PTP_TestPackage testPackage = new Model . PTP_TestPackage ( ) ;
testPackage . ProjectId = this . CurrUser . LoginProjectId ;
if ( this . drpInstallation . SelectedValue ! = BLL . Const . _Null )
{
testPackage . InstallationId = this . drpInstallation . SelectedValue ;
}
if ( this . drpUnit . SelectedValue ! = BLL . Const . _Null )
{
testPackage . UnitId = this . drpUnit . SelectedValue ;
}
testPackage . TestPackageNo = this . txtTestPackageNo . Text . Trim ( ) ;
testPackage . TestPackageName = this . txtTestPackageName . Text . Trim ( ) ;
testPackage . TestHeat = this . txtTestHeat . Text . Trim ( ) ;
testPackage . TestService = this . txtTestService . Text . Trim ( ) ;
if ( this . drpTestType . SelectedValue ! = BLL . Const . _Null )
{
testPackage . TestType = this . drpTestType . SelectedValue ;
}
if ( this . drpTabler . SelectedValue ! = BLL . Const . _Null )
{
testPackage . Tabler = this . drpTabler . SelectedValue ;
}
testPackage . TableDate = Funs . GetNewDateTime ( this . txtTableDate . Text ) ;
if ( this . drpModifier . SelectedValue ! = BLL . Const . _Null )
{
testPackage . Modifier = this . drpModifier . SelectedValue ;
}
testPackage . ModifyDate = Funs . GetNewDateTime ( this . txtModifyDate . Text ) ;
testPackage . Remark = this . txtRemark . Text . Trim ( ) ;
//testPackage.TestPackageCode = this.txtTestPackageCode.Text.Trim();
testPackage . TestAmbientTemp = this . txtTestAmbientTemp . Text . Trim ( ) ;
testPackage . TestMediumTemp = this . txtTestMediumTemp . Text . Trim ( ) ;
testPackage . TestPressure = this . txtTestPressure . Text . Trim ( ) ;
testPackage . TestPressureTemp = this . txtTestPressureTemp . Text . Trim ( ) ;
testPackage . TestPressureTime = this . txtTestPressureTime . Text . Trim ( ) ;
testPackage . TightnessTest = this . txtTightnessTest . Text . Trim ( ) ;
testPackage . TightnessTestTemp = this . txtTightnessTestTemp . Text . Trim ( ) ;
testPackage . TightnessTestTime = this . txtTightnessTestTime . Text . Trim ( ) ;
testPackage . LeakageTestService = this . txtLeakageTestService . Text . Trim ( ) ;
testPackage . LeakageTestPressure = this . txtLeakageTestPressure . Text . Trim ( ) ;
testPackage . VacuumTestService = this . txtVacuumTestService . Text . Trim ( ) ;
testPackage . VacuumTestPressure = this . txtVacuumTestPressure . Text . Trim ( ) ;
testPackage . OperationMedium = this . txtOperationMedium . Text . Trim ( ) ;
testPackage . PurgingMedium = this . txtPurgingMedium . Text . Trim ( ) ;
testPackage . CleaningMedium = this . txtCleaningMedium . Text . Trim ( ) ;
testPackage . AllowSeepage = this . txtAllowSeepage . Text . Trim ( ) ;
testPackage . FactSeepage = this . txtFactSeepage . Text . Trim ( ) ;
if ( ! string . IsNullOrEmpty ( this . PTP_ID ) )
{
testPackage . PTP_ID = this . PTP_ID ;
BLL . TestPackageManageEditService . UpdateTestPackage ( testPackage ) ;
//BLL.TestPackageManageEditService.DeleteTestPackage(PTP_ID);
BLL . Sys_LogService . AddLog ( BLL . Const . System_3 , this . CurrUser . LoginProjectId , this . CurrUser . UserId , Const . TestPackageManageEditMenuId , Const . BtnModify , this . PTP_ID ) ;
}
else
{
testPackage . PTP_ID = SQLHelper . GetNewID ( typeof ( Model . PTP_TestPackage ) ) ;
this . PTP_ID = testPackage . PTP_ID ;
BLL . TestPackageManageEditService . AddTestPackage ( testPackage ) ;
BLL . Sys_LogService . AddLog ( BLL . Const . System_3 , this . CurrUser . LoginProjectId , this . CurrUser . UserId , Const . TestPackageManageEditMenuId , Const . BtnAdd , this . PTP_ID ) ;
}
2024-05-22 20:36:40 +08:00
JArray teamGroupData = Grid1 . GetMergedData ( ) ;
2024-05-23 13:29:09 +08:00
if ( listSelects . Count > 0 )
{
BLL . TestPackageManageEditService . DeletePipelineListByPTP_ID ( testPackage . PTP_ID ) ;
}
2024-05-22 20:36:40 +08:00
foreach ( JObject teamGroupRow in teamGroupData )
2024-05-08 10:02:08 +08:00
{
2024-05-22 20:36:40 +08:00
string PipelineId = teamGroupRow [ "id" ] . ToString ( ) ;
string status = teamGroupRow . Value < string > ( "status" ) ;
2024-05-23 11:20:42 +08:00
2024-05-22 20:36:40 +08:00
if ( listSelects . Contains ( PipelineId ) )
{
JObject values = teamGroupRow . Value < JObject > ( "values" ) ;
2024-05-23 01:05:28 +08:00
string WeldJonintCodes = values . Value < string > ( "WeldJointCode" ) ;
2024-05-22 20:36:40 +08:00
string workAreaId = values . Value < string > ( "WorkAreaId" ) ;
2024-05-22 22:57:06 +08:00
if ( string . IsNullOrEmpty ( WeldJonintCodes ) )
WeldJonintCodes = "全部" ;
2024-05-23 11:20:42 +08:00
//处理剩下来的口
List < string > listJointCode = new List < string > ( ) ;
var tempData = Funs . DB . PTP_PipelineList . Where ( t = > t . PipelineId = = PipelineId & & t . IsAll = = false ) . Select ( t = > t . WeldJonintCode ) . ToList ( ) ;
foreach ( var item in tempData )
{
if ( ! string . IsNullOrEmpty ( item ) )
{
string [ ] arr = item . Split ( ',' ) ;
for ( int i = 0 ; i < arr . Length ; i + + )
{
listJointCode . Add ( arr [ i ] ) ;
}
}
}
if ( WeldJonintCodes = = "全部" & & listJointCode . Count > 0 )
{
var nextJointCode = Funs . DB . Pipeline_WeldJoint . Where ( t = > t . PipelineId = = PipelineId & & ! listJointCode . Contains ( t . WeldJointCode ) )
. Select ( t = > t . WeldJointCode ) . ToList ( ) . ToArray ( ) ;
WeldJonintCodes = String . Join ( "," , nextJointCode . ToArray ( ) ) ;
}
2024-05-22 20:36:40 +08:00
Model . PTP_PipelineList newitem = new Model . PTP_PipelineList ( ) ;
newitem . PTP_ID = this . PTP_ID ;
newitem . PipelineId = PipelineId ;
newitem . IsAll = WeldJonintCodes = = "全部" ? true : false ;
newitem . WeldJonintCode = WeldJonintCodes ;
newitem . WorkAreaId = workAreaId ;
BLL . TestPackageManageEditService . AddPipelineList ( newitem ) ;
}
2024-05-08 10:02:08 +08:00
}
ShowNotify ( "保存成功!" , MessageBoxIcon . Success ) ;
PageContext . RegisterStartupScript ( ActiveWindow . GetWriteBackValueReference ( this . PTP_ID )
+ ActiveWindow . GetHidePostBackReference ( ) ) ;
}
else
{
ShowNotify ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
return ;
}
}
#endregion
2024-05-22 14:41:37 +08:00
2024-05-08 10:02:08 +08:00
#region 收 集 Grid页面信息
/// <summary>
/// 收集Grid页面信息
/// </summary>
/// <returns></returns>
private void CollectGridJointInfo ( )
{
for ( int i = 0 ; i < Grid1 . Rows . Count ; i + + )
{
string rowID = Grid1 . DataKeys [ i ] [ 0 ] . ToString ( ) ;
CheckBoxField checkField = ( CheckBoxField ) Grid1 . FindColumn ( "ckbIsSelected" ) ;
if ( listSelects . Contains ( rowID ) )
{
listSelects . Remove ( rowID ) ;
}
if ( checkField . GetCheckedState ( i ) )
{
listSelects . Add ( rowID ) ;
}
}
2024-05-22 20:36:40 +08:00
2024-05-08 10:02:08 +08:00
}
#endregion
2024-05-22 14:41:37 +08:00
#region 绑 定 焊 口 信 息 Grid2列表
2024-05-23 01:05:28 +08:00
2024-05-22 20:36:40 +08:00
2024-05-22 14:41:37 +08:00
#endregion
2024-05-08 10:02:08 +08:00
#region Grid 明 细 操 作 事 件
/// <summary>
/// 全选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAllSelect_Click ( object sender , EventArgs e )
{
for ( int i = 0 ; i < Grid1 . Rows . Count ; i + + )
{
string rowID = Grid1 . DataKeys [ i ] [ 0 ] . ToString ( ) ;
if ( ! listSelects . Contains ( rowID ) )
{
listSelects . Add ( rowID ) ;
}
}
this . ShowGridItem ( ) ;
}
/// <summary>
/// 全不选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNoSelect_Click ( object sender , EventArgs e )
{
for ( int i = 0 ; i < Grid1 . Rows . Count ; i + + )
{
string rowID = Grid1 . DataKeys [ i ] [ 0 ] . ToString ( ) ;
if ( listSelects . Contains ( rowID ) )
{
listSelects . Remove ( rowID ) ;
}
}
this . ShowGridItem ( ) ;
}
#endregion
#region 管 线 查 询
/// <summary>
/// 管线查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtIsono_OnSelectedIndexChanged ( object sender , EventArgs e )
{
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
}
#endregion
#region 只 显 示 选 中 项
/// <summary>
/// 只显示选中项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ckSelect_OnCheckedChanged ( object sender , CheckedEventArgs e )
{
this . CollectGridJointInfo ( ) ;
this . BindGrid ( ) ;
this . ShowGridItem ( ) ;
}
2024-05-22 22:57:06 +08:00
2024-05-22 20:36:40 +08:00
2024-05-23 01:05:28 +08:00
#endregion
2024-05-22 20:36:40 +08:00
2024-05-08 10:02:08 +08:00
}
}