2022-09-05 16:36:31 +08:00
using BLL ;
2023-02-20 21:59:35 +08:00
using Microsoft.Office.Interop.Word ;
2022-09-05 16:36:31 +08:00
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Data.SqlClient ;
using System.Linq ;
2024-06-19 18:52:56 +08:00
using System.Text ;
2022-09-05 16:36:31 +08:00
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class WeldingConDate : PageBase
{
2023-02-16 17:19:08 +08:00
public int pageSize = PipelineService . pageSize ;
2022-09-05 16:36:31 +08:00
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
2023-08-25 23:55:32 +08:00
BLL . UnitService . InitUnitByProjectIdUnitTypeDropDownList ( drpUnit , this . CurrUser . LoginProjectId , Const . ProjectUnitType_2 , true ) ;
2023-10-25 23:30:52 +08:00
///焊接属性
this . drpJointAttribute . DataTextField = "Text" ;
this . drpJointAttribute . DataValueField = "Value" ;
this . drpJointAttribute . DataSource = BLL . DropListService . HJGL_JointAttribute ( ) ;
this . drpJointAttribute . DataBind ( ) ;
2023-11-22 17:10:54 +08:00
///管线划分
this . drpPipeArea . DataTextField = "Text" ;
this . drpPipeArea . DataValueField = "Value" ;
this . drpPipeArea . DataSource = BLL . PipelineService . GetPipeArea ( ) ;
this . drpPipeArea . DataBind ( ) ;
Funs . FineUIPleaseSelect ( this . drpPipeArea ) ;
2022-09-05 16:36:31 +08:00
this . InitTreeMenu ( ) ;
}
}
#region 加 载 树 装 置 - 单 位 - 工 作 区
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu ( )
{
this . tvControlItem . Nodes . Clear ( ) ;
TreeNode rootNode1 = new TreeNode ( ) ;
rootNode1 . NodeID = "1" ;
rootNode1 . Text = "建筑工程" ;
rootNode1 . CommandName = "建筑工程" ;
2022-09-18 23:22:47 +08:00
rootNode1 . Selectable = false ;
2022-09-05 16:36:31 +08:00
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-22 17:10:54 +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
//}
2023-11-22 17:10:54 +08:00
string pipeAreasql = string . Empty ;
if ( this . drpPipeArea . SelectedValue ! = BLL . Const . _Null )
{
pipeAreasql + = " AND PipeArea='" + this . drpPipeArea . SelectedValue + "'" ;
}
2022-09-05 16:36:31 +08:00
if ( unitWork1 . Count ( ) > 0 )
{
foreach ( var q in unitWork1 )
{
2023-02-20 21:59:35 +08:00
int a = 0 ;
if ( ckNOEdit . Checked )
{
2023-11-22 17:10:54 +08:00
string strSql = "SELECT distinct PipelineCode FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL AND UnitWorkId =@UnitWorkId AND WPQId IS NULL" + pipeAreasql ;
2023-02-20 21:59:35 +08:00
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@UnitWorkId" , q . UnitWorkId ) ) ;
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
System . Data . DataTable dt = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
a = dt . Rows . Count ;
}
else
{
2023-11-22 17:10:54 +08:00
if ( this . drpPipeArea . SelectedValue = = BLL . Const . _Null )
{
a = ( from x in Funs . DB . HJGL_Pipeline where x . ProjectId = = this . CurrUser . LoginProjectId & & x . UnitWorkId = = q . UnitWorkId select x ) . Count ( ) ;
}
else
{
a = ( from x in Funs . DB . HJGL_Pipeline where x . ProjectId = = this . CurrUser . LoginProjectId & & x . UnitWorkId = = q . UnitWorkId & & x . PipeArea = = this . drpPipeArea . SelectedValue select x ) . Count ( ) ;
}
2023-02-20 21:59:35 +08:00
}
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 ;
2023-02-16 17:19:08 +08:00
tn1 . CommandName = 1 + "|" + Funs . GetEndPageNumber ( a , pageSize ) ;
2022-09-05 16:36:31 +08:00
tn1 . EnableExpandEvent = true ;
2023-02-16 17:19:08 +08:00
tn1 . EnableClickEvent = true ;
2024-06-19 18:52:56 +08:00
tn1 . EnableCheckBox = false ;
2022-09-05 16:36:31 +08:00
rootNode1 . Nodes . Add ( tn1 ) ;
if ( a > 0 )
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = "加载管线..." ;
newNode . NodeID = "加载管线..." ;
tn1 . Nodes . Add ( newNode ) ;
}
}
}
if ( unitWork2 . Count ( ) > 0 )
{
foreach ( var q in unitWork2 )
{
2023-02-20 21:59:35 +08:00
int a = 0 ;
if ( ckNOEdit . Checked )
{
2023-11-22 17:10:54 +08:00
string strSql = "SELECT distinct PipelineCode FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL AND UnitWorkId =@UnitWorkId AND WPQId IS NULL" + pipeAreasql ;
2023-02-20 21:59:35 +08:00
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@UnitWorkId" , q . UnitWorkId ) ) ;
2023-11-28 18:53:48 +08:00
if ( ! string . IsNullOrEmpty ( this . txtPipelineCode . Text . Trim ( ) ) )
{
strSql + = " and PipelineCode=@PipelineCode " ;
listStr . Add ( new SqlParameter ( "@PipelineCode" , "" + this . txtPipelineCode . Text . Trim ( ) + "" ) ) ;
}
2023-02-20 21:59:35 +08:00
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
System . Data . DataTable dt = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
a = dt . Rows . Count ;
}
else
{
2023-11-22 17:10:54 +08:00
if ( this . drpPipeArea . SelectedValue = = BLL . Const . _Null )
{
a = ( from x in Funs . DB . HJGL_Pipeline
2023-02-20 21:59:35 +08:00
where x . ProjectId = = this . CurrUser . LoginProjectId & & x . UnitWorkId = = q . UnitWorkId
& & x . PipelineCode . Contains ( this . txtPipelineCode . Text . Trim ( ) )
select x ) . Count ( ) ;
2023-11-22 17:10:54 +08:00
}
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 ( ) ) & & x . PipeArea = = this . drpPipeArea . SelectedValue
select x ) . Count ( ) ;
}
2023-02-20 21:59:35 +08:00
}
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 ( ) + "】" + "管线" ;
2023-02-16 17:19:08 +08:00
//if (q.UnitWorkId == this.hdUnitWorkId.Text)
//{
// tn2.Expanded = true;
//}
2023-10-25 19:44:10 +08:00
tn2 . ToolTip = "施工单位:" + unitNamesUnitIds ;
2023-02-16 17:19:08 +08:00
tn2 . CommandName = 1 + "|" + Funs . GetEndPageNumber ( a , pageSize ) ;
2022-09-05 16:36:31 +08:00
tn2 . EnableExpandEvent = true ;
2023-02-16 17:19:08 +08:00
tn2 . EnableClickEvent = true ;
2024-06-19 18:52:56 +08:00
tn2 . EnableCheckBox = false ;
2022-09-05 16:36:31 +08:00
rootNode2 . Nodes . Add ( tn2 ) ;
if ( a > 0 )
{
// BindNodes(tn2);
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = "加载管线..." ;
newNode . NodeID = "加载管线..." ;
tn2 . Nodes . Add ( newNode ) ;
}
}
}
}
protected void tvControlItem_TreeNodeExpanded ( object sender , TreeNodeEventArgs e )
{
2023-02-16 17:19:08 +08:00
if ( e . Node . Nodes [ 0 ] . NodeID = = "加载管线..." )
2022-09-05 16:36:31 +08:00
{
2023-02-16 17:19:08 +08:00
e . Node . Nodes . Clear ( ) ;
BindNodes ( e . Node ) ;
2022-09-05 16:36:31 +08:00
}
2023-11-22 17:10:54 +08:00
2023-02-16 17:19:08 +08:00
}
private void BindNodes ( TreeNode node )
{
2023-11-22 17:10:54 +08:00
BLL . PipelineService . BindTreeNodes ( node , ckNOEdit . Checked , this . txtPipelineCode . Text . Trim ( ) , this . CurrUser . LoginProjectId , pageSize , this . drpPipeArea . SelectedValue ) ;
2022-09-05 16:36:31 +08:00
}
#endregion
protected void btnTreeFind_Click ( object sender , EventArgs e )
{
this . InitTreeMenu ( ) ;
}
#region 点 击 TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand ( object sender , TreeCommandEventArgs e )
{
2023-02-16 17:19:08 +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 ) ;
}
else
2022-09-05 16:36:31 +08:00
{
2023-02-16 17:19:08 +08:00
if ( ! string . IsNullOrEmpty ( this . tvControlItem . SelectedNodeID ) )
2022-09-05 16:36:31 +08:00
{
2023-11-22 17:10:54 +08:00
2023-02-20 21:59:35 +08:00
if ( tvControlItem . SelectedNode . CommandName = = "管线" )
2023-02-16 17:19:08 +08:00
{
2023-02-20 21:59:35 +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 if ( tvControlItem . SelectedNode . CommandName . Split ( '|' ) . Count ( ) = = 2 )
{
this . hdUnitWorkId . Text = this . tvControlItem . SelectedNode . NodeID ;
2023-02-16 17:19:08 +08:00
this . BindGrid ( ) ;
}
2022-09-05 16:36:31 +08:00
}
}
2023-11-22 17:10:54 +08:00
2022-09-05 16:36:31 +08:00
}
#endregion
#region 数 据 绑 定
private void BindGrid ( )
{
string strSql = @ "SELECT WeldJointId,WeldJointCode,PipelineId,PipelineCode,JointAttribute,
IsWelding , IsHotProessStr , Material1Code , Material2Code , WeldTypeCode ,
2023-02-16 17:19:08 +08:00
Specification , HeartNo1 , HeartNo2 , Size , Dia , DNDia , Thickness , GrooveTypeCode ,
2022-09-05 16:36:31 +08:00
WeldingMethodCode , WeldingWireCode , WeldingRodCode , WeldingDate , WeldingDailyCode ,
BackingWelderCode , CoverWelderCode , MediumCode , PreTemperature , JointArea , WPQCode , Remark
FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL ";
List < SqlParameter > listStr = new List < SqlParameter > { } ;
2023-02-20 21:59:35 +08:00
if ( tvControlItem . SelectedNode . CommandName = = "管线" )
{
strSql + = " AND PipelineId =@PipelineId" ;
listStr . Add ( new SqlParameter ( "@PipelineId" , tvControlItem . SelectedNodeID ) ) ;
}
else if ( tvControlItem . SelectedNode . CommandName . Split ( '|' ) . Count ( ) = = 2 )
{
strSql + = " AND UnitWorkId =@UnitWorkId" ;
listStr . Add ( new SqlParameter ( "@UnitWorkId" , tvControlItem . SelectedNodeID ) ) ;
}
2022-09-05 16:36:31 +08:00
if ( ! string . IsNullOrEmpty ( this . txtWeldJointCode . Text . Trim ( ) ) )
{
strSql + = " AND WeldJointCode LIKE @WeldJointCode" ;
listStr . Add ( new SqlParameter ( "@WeldJointCode" , "%" + this . txtWeldJointCode . Text . Trim ( ) + "%" ) ) ;
}
if ( rbInput . SelectedValue ! = "0" )
{
if ( rbInput . SelectedValue = = "1" ) // 示录入
{
strSql + = " AND WPQId IS NULL" ;
}
else
{
strSql + = " AND WPQId IS NOT NULL" ;
}
}
2023-10-25 23:30:52 +08:00
if ( ! string . IsNullOrEmpty ( drpJointAttribute . SelectedValue ) )
{
strSql + = " AND JointAttribute =@JointAttribute" ;
listStr . Add ( new SqlParameter ( "@JointAttribute" , drpJointAttribute . SelectedValue ) ) ;
}
2022-09-05 16:36:31 +08:00
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
2023-02-20 21:59:35 +08:00
System . Data . DataTable dt = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
2022-09-05 16:36:31 +08:00
// 2.获取当前分页数据
Grid1 . RecordCount = dt . Rows . Count ;
var table = this . GetPagedDataTable ( Grid1 , dt ) ;
2023-02-20 21:59:35 +08:00
Grid1 . DataSource = table ;
2022-09-05 16:36:31 +08:00
Grid1 . DataBind ( ) ;
}
#endregion
protected void Grid1_RowDataBound ( object sender , GridRowEventArgs e )
{
// DataRowView row = e.DataItem as DataRowView;
string jotid = Grid1 . DataKeys [ e . RowIndex ] [ 0 ] . ToString ( ) ;
var jot = Funs . DB . HJGL_WeldJoint . FirstOrDefault ( x = > x . WeldJointId = = jotid ) ;
if ( jot ! = null & & ! string . IsNullOrEmpty ( jot . MatchableWPQ ) )
{
int wpqNum = jot . MatchableWPQ . Split ( ',' ) . Count ( ) ;
if ( wpqNum > 1 )
{
e . RowCssClass = "color1" ;
}
}
}
#region 分 页 排 序
#region 页 索 引 改 变 事 件
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange ( object sender , GridPageEventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 排 序
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
protected void TextBox_TextChanged ( object sender , EventArgs e )
{
this . BindGrid ( ) ;
}
#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_WeldJointMenuId , BLL . Const . BtnModify ) )
{
if ( BLL . WeldTaskService . GetWeldTaskByWeldJointId ( Grid1 . SelectedRowID ) ! = null ) //已下任务单,不可修改数据
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WeldJointView.aspx?WeldJointId={0}&flag=2" , Grid1 . SelectedRowID , "编辑 - " ) ) ) ;
}
else
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WeldJointEdit.aspx?WeldJointId={0}&flag=2" , Grid1 . SelectedRowID , "编辑 - " ) ) ) ;
}
}
else
{
ShowNotify ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
/// <summary>
/// 自动录入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAutoInput_Click ( object sender , EventArgs e )
{
2023-11-23 18:52:01 +08:00
if ( this . drpUnit . SelectedValue = = BLL . Const . _Null )
{
ShowNotify ( "请选择工艺规程编制单位!" , MessageBoxIcon . Warning ) ;
return ;
}
2022-09-05 16:36:31 +08:00
if ( ! string . IsNullOrEmpty ( tvControlItem . SelectedNodeID ) )
{
2023-11-22 17:10:54 +08:00
var jotList = from x in Funs . DB . HJGL_WeldJoint where x . PipelineId = = tvControlItem . SelectedNodeID & & x . JointAttribute = = drpJointAttribute . SelectedValue select x ;
2022-09-05 16:36:31 +08:00
if ( jotList . Count ( ) > 0 )
{
foreach ( var jot in jotList )
{
2023-11-22 17:10:54 +08:00
List < Model . View_HJGL_WPQ > wpqList = BLL . WPQListServiceService . GetMatchWPQ ( jot , this . CurrUser . LoginProjectId , drpUnit . SelectedValue ) ;
2023-11-22 16:06:58 +08:00
Model . HJGL_WeldJoint newJot = new Model . HJGL_WeldJoint ( ) ;
2022-09-05 16:36:31 +08:00
if ( wpqList ! = null )
{
2023-11-24 18:29:30 +08:00
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 ) ;
}
2022-09-05 16:36:31 +08:00
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 ) ) ;
2023-11-22 17:10:54 +08:00
2022-09-05 16:36:31 +08:00
}
2023-11-22 16:06:58 +08:00
else
{
newJot . WPQId = null ;
newJot . WeldJointId = jot . WeldJointId ;
newJot . WeldingRod = null ;
newJot . WeldingWire = null ;
newJot . WeldingMethodId = null ;
newJot . GrooveTypeId = null ;
newJot . PreTemperature = null ;
newJot . IsHotProess = null ;
newJot . MatchableWPQ = null ;
}
BLL . WeldJointService . UpdateConWeldJoint ( newJot ) ;
2022-09-05 16:36:31 +08:00
}
}
BindGrid ( ) ;
ShowNotify ( "该管线焊口已完成自动录入!" , MessageBoxIcon . Success ) ;
}
}
2024-06-19 18:52:56 +08:00
protected void btnAutoInput2_Click ( object sender , EventArgs e )
{
if ( this . drpUnit . SelectedValue = = BLL . Const . _Null )
{
ShowNotify ( "请选择工艺规程编制单位!" , MessageBoxIcon . Warning ) ;
return ;
}
TreeNode [ ] nodes = tvControlItem . GetCheckedNodes ( ) ;
if ( nodes . Length > 0 )
{
foreach ( TreeNode node in nodes )
{
if ( ! string . IsNullOrEmpty ( node . NodeID ) )
{
2024-06-20 10:13:31 +08:00
var jotList = from x in Funs . DB . HJGL_WeldJoint where x . PipelineId = = node . NodeID & & x . JointAttribute = = drpJointAttribute . SelectedValue select x ;
2024-06-19 18:52:56 +08:00
if ( jotList . Count ( ) > 0 )
{
foreach ( var jot in jotList )
{
List < Model . View_HJGL_WPQ > wpqList = BLL . WPQListServiceService . GetMatchWPQ ( jot , this . CurrUser . LoginProjectId , drpUnit . SelectedValue ) ;
Model . HJGL_WeldJoint newJot = new Model . HJGL_WeldJoint ( ) ;
if ( wpqList ! = null )
{
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 ) ) ;
}
else
{
newJot . WPQId = null ;
newJot . WeldJointId = jot . WeldJointId ;
newJot . WeldingRod = null ;
newJot . WeldingWire = null ;
newJot . WeldingMethodId = null ;
newJot . GrooveTypeId = null ;
newJot . PreTemperature = null ;
newJot . IsHotProess = null ;
newJot . MatchableWPQ = null ;
}
BLL . WeldJointService . UpdateConWeldJoint ( newJot ) ;
}
}
}
}
// BindGrid();
ShowNotify ( "该管线焊口已完成自动录入!" , MessageBoxIcon . Success ) ;
}
else
{
ShowNotify ( "请勾选需要自动录入的管线!" , MessageBoxIcon . Warning ) ;
}
}
2022-09-05 16:36:31 +08:00
protected void btnEdit_Click ( object sender , EventArgs e )
{
if ( BLL . CommonService . GetAllButtonPowerList ( this . CurrUser . LoginProjectId , this . CurrUser . PersonId , BLL . Const . HJGL_WeldJointMenuId , BLL . Const . BtnModify ) )
{
if ( BLL . WeldTaskService . GetWeldTaskByWeldJointId ( Grid1 . SelectedRowID ) ! = null ) //已下任务单,不可修改数据
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WeldJointView.aspx?WeldJointId={0}&flag=2" , Grid1 . SelectedRowID , "编辑 - " ) ) ) ;
}
else
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WeldJointEdit.aspx?WeldJointId={0}&flag=2" , Grid1 . SelectedRowID , "编辑 - " ) ) ) ;
}
}
else
{
ShowNotify ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
/// <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_WeldJointMenuId , BLL . Const . BtnModify ) )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录" , MessageBoxIcon . Warning ) ;
return ;
}
2023-11-24 18:29:30 +08:00
//if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(Grid1.SelectedRowID) != null) //已下任务单,不可修改数据
//{
// Alert.ShowInTop("该焊口已生成焊接任务单,不能编辑!", MessageBoxIcon.Warning);
// return;
//}
2022-09-05 16:36:31 +08:00
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WeldJointEdit.aspx?WeldJointId={0}&flag=2" , Grid1 . SelectedRowID , "维护 - " ) ) ) ;
}
else
{
ShowNotify ( "您没有这个权限,请与管理员联系!" , MessageBoxIcon . Warning ) ;
}
}
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}&flag=2" , Grid1 . SelectedRowID , "维护 - " ) ) ) ;
}
#endregion
protected void Window1_Close ( object sender , WindowCloseEventArgs e )
{
this . BindGrid ( ) ;
}
}
}