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