608 lines
27 KiB
C#
608 lines
27 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
{
|
|
public partial class WeldingConDate : PageBase
|
|
{
|
|
public int pageSize = PipelineService.pageSize;
|
|
public List<string> GridWeldJointIdList { get; set; }
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, true);
|
|
///焊接属性
|
|
this.drpJointAttribute.DataTextField = "Text";
|
|
this.drpJointAttribute.DataValueField = "Value";
|
|
this.drpJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttribute();
|
|
this.drpJointAttribute.DataBind();
|
|
///管线划分
|
|
this.drpPipeArea.DataTextField = "Text";
|
|
this.drpPipeArea.DataValueField = "Value";
|
|
this.drpPipeArea.DataSource = BLL.PipelineService.GetPipeArea();
|
|
this.drpPipeArea.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpPipeArea);
|
|
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;
|
|
rootNode1.EnableCheckBox = false;
|
|
this.tvControlItem.Nodes.Add(rootNode1);
|
|
|
|
TreeNode rootNode2 = new TreeNode();
|
|
rootNode2.NodeID = "2";
|
|
rootNode2.Text = "安装工程";
|
|
rootNode2.CommandName = "安装工程";
|
|
rootNode2.Expanded = true;
|
|
rootNode2.EnableCheckBox = false;
|
|
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
|
|
orderby x.UnitWorkCode
|
|
select x).ToList();
|
|
|
|
List<Model.WBS_UnitWork> unitWork1 = null;
|
|
List<Model.WBS_UnitWork> unitWork2 = null;
|
|
|
|
//// 当前为施工单位,只能操作本单位的数据
|
|
//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
|
|
//{
|
|
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
|
|
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
|
//}
|
|
string pipeAreasql = string.Empty;
|
|
if (this.drpPipeArea.SelectedValue != BLL.Const._Null)
|
|
{
|
|
pipeAreasql += " AND PipeArea='" + this.drpPipeArea.SelectedValue + "'";
|
|
}
|
|
if (unitWork1.Count() > 0)
|
|
{
|
|
foreach (var q in unitWork1)
|
|
{
|
|
int a = 0;
|
|
if (ckNOEdit.Checked)
|
|
{
|
|
string strSql = "SELECT distinct PipelineCode FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL AND UnitWorkId =@UnitWorkId AND WPQId IS NULL" + pipeAreasql;
|
|
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
|
|
{
|
|
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();
|
|
}
|
|
|
|
}
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn1 = new TreeNode();
|
|
tn1.NodeID = q.UnitWorkId;
|
|
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
tn1.EnableExpandEvent = true;
|
|
tn1.EnableClickEvent = true;
|
|
// 单位工程复选框表示“当前筛选条件下的全部管线”,不能只依赖已加载的分页节点。
|
|
tn1.EnableCheckBox = true;
|
|
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)
|
|
{
|
|
int a = 0;
|
|
if (ckNOEdit.Checked)
|
|
{
|
|
string strSql = "SELECT distinct PipelineCode FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL AND UnitWorkId =@UnitWorkId AND WPQId IS NULL" + pipeAreasql;
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
|
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
|
|
{
|
|
strSql += " and PipelineCode=@PipelineCode ";
|
|
listStr.Add(new SqlParameter("@PipelineCode", "" + this.txtPipelineCode.Text.Trim() + ""));
|
|
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
System.Data.DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
a = dt.Rows.Count;
|
|
|
|
}
|
|
else
|
|
{
|
|
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
|
|
&& 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()) && x.PipeArea == this.drpPipeArea.SelectedValue
|
|
select x).Count();
|
|
}
|
|
}
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
TreeNode tn2 = new TreeNode();
|
|
tn2.NodeID = q.UnitWorkId;
|
|
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
|
//if (q.UnitWorkId == this.hdUnitWorkId.Text)
|
|
//{
|
|
// tn2.Expanded = true;
|
|
//}
|
|
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
|
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
|
tn2.EnableExpandEvent = true;
|
|
tn2.EnableClickEvent = true;
|
|
// 单位工程复选框表示“当前筛选条件下的全部管线”,不能只依赖已加载的分页节点。
|
|
tn2.EnableCheckBox = true;
|
|
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)
|
|
{
|
|
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
|
{
|
|
e.Node.Nodes.Clear();
|
|
BindNodes(e.Node);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 单位工程节点允许勾选;不展开分页子节点,批量自动录入时会按当前筛选条件重新查询全部管线。
|
|
/// </summary>
|
|
protected void tvControlItem_NodeCheck(object sender, TreeCheckEventArgs e)
|
|
{
|
|
// FineUI 会处理父子节点的视觉状态,这里不强制勾选未加载的子节点,避免分页节点遗漏。
|
|
}
|
|
private void BindNodes(TreeNode node)
|
|
{
|
|
BLL.PipelineService.BindTreeNodes(node, ckNOEdit.Checked, this.txtPipelineCode.Text.Trim(), this.CurrUser.LoginProjectId, pageSize, this.drpPipeArea.SelectedValue);
|
|
}
|
|
#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)
|
|
{
|
|
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
|
|
{
|
|
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
|
{
|
|
|
|
if (tvControlItem.SelectedNode.CommandName == "管线")
|
|
{
|
|
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;
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
private void BindGrid()
|
|
{
|
|
GridWeldJointIdList = new List<string>();
|
|
if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
|
|
{
|
|
return;
|
|
|
|
}
|
|
string strSql = @"SELECT WeldJointId,WeldJointCode,PipelineId,PipelineCode,JointAttribute,
|
|
IsWelding,IsHotProessStr,Material1Code,Material2Code,WeldTypeCode,
|
|
Specification,HeartNo1,HeartNo2,Size,Dia,DNDia,Thickness,GrooveTypeCode,
|
|
WeldingMethodCode,WeldingWireCode,WeldingRodCode,WeldingDate,WeldingDailyCode,
|
|
BackingWelderCode,CoverWelderCode,MediumCode ,PreTemperature,JointArea,WPQCode,Remark,TRY_CAST(WeldJointCode AS INT) AS WeldJointCodeInt
|
|
FROM View_HJGL_WeldJoint WHERE IsTwoJoint IS NULL ";
|
|
List<SqlParameter> listStr = new List<SqlParameter> { };
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
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";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(drpJointAttribute.SelectedValue))
|
|
{
|
|
strSql += " AND JointAttribute =@JointAttribute";
|
|
|
|
listStr.Add(new SqlParameter("@JointAttribute", drpJointAttribute.SelectedValue));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
System.Data.DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
GridWeldJointIdList = dt.AsEnumerable().Select(row => row.Field<string>("WeldJointId")).ToList();
|
|
// 2.获取当前分页数据
|
|
Grid1.RecordCount = dt.Rows.Count;
|
|
var table = this.GetPagedDataTable(Grid1, dt);
|
|
Grid1.DataSource = table;
|
|
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)
|
|
{
|
|
if (this.drpUnit.SelectedValue == BLL.Const._Null)
|
|
{
|
|
ShowNotify("请选择工艺规程编制单位!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
|
|
// BindGrid() 上一次请求中的赋值不会保留到本次回发,按钮处理前重新查询当前筛选结果。
|
|
BindGrid();
|
|
if (GridWeldJointIdList.Any())
|
|
{
|
|
AutoInputWeldJoints(GridWeldJointIdList);
|
|
BindGrid();
|
|
ShowNotify("该管线焊口已完成自动录入!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("当前筛选条件下没有可自动录入的焊口!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
protected void btnAutoInput2_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnit.SelectedValue == BLL.Const._Null)
|
|
{
|
|
ShowNotify("请选择工艺规程编制单位!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
TreeNode[] nodes = tvControlItem.GetCheckedNodes();
|
|
var pipelineIds = new List<string>();
|
|
foreach (TreeNode node in nodes)
|
|
{
|
|
if (node.CommandName == "管线")
|
|
{
|
|
if (!string.IsNullOrEmpty(node.NodeID)) pipelineIds.Add(node.NodeID);
|
|
}
|
|
else if (node.CommandName != null && node.CommandName.Split('|').Length == 2)
|
|
{
|
|
// 单位工程节点覆盖全部分页数据,不能只取树上当前已经展开的叶子节点。
|
|
pipelineIds.AddRange(GetPipelineIdsByUnitWork(node.NodeID));
|
|
}
|
|
}
|
|
pipelineIds = pipelineIds.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
|
if (pipelineIds.Count > 0)
|
|
{
|
|
AutoInputWeldJoints(GetAutoInputWeldJoints(pipelineIds));
|
|
ShowNotify("该管线焊口已完成自动录入!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请勾选需要自动录入的管线!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按当前树筛选条件查询单位工程下的全部管线,覆盖分页和未展开节点。
|
|
/// </summary>
|
|
private List<string> GetPipelineIdsByUnitWork(string unitWorkId)
|
|
{
|
|
var query = Funs.DB.HJGL_Pipeline.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == unitWorkId);
|
|
if (this.drpPipeArea.SelectedValue != BLL.Const._Null)
|
|
{
|
|
query = query.Where(x => x.PipeArea == this.drpPipeArea.SelectedValue);
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
|
|
{
|
|
query = query.Where(x => x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()));
|
|
}
|
|
if (ckNOEdit.Checked)
|
|
{
|
|
query = query.Where(p => Funs.DB.HJGL_WeldJoint.Any(w => w.PipelineId == p.PipelineId && w.IsTwoJoint == null && w.WPQId == null));
|
|
}
|
|
return query.Select(x => x.PipelineId).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// “全部”表示不增加焊口属性条件;预制口和安装口仍按选择值精确筛选。
|
|
/// </summary>
|
|
private List<string> GetAutoInputWeldJoints(IEnumerable<string> pipelineIds)
|
|
{
|
|
var ids = pipelineIds.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
|
var query = Funs.DB.HJGL_WeldJoint.Where(x => ids.Contains(x.PipelineId));
|
|
if (!string.IsNullOrEmpty(drpJointAttribute.SelectedValue))
|
|
{
|
|
query = query.Where(x => x.JointAttribute == drpJointAttribute.SelectedValue);
|
|
}
|
|
return query.Select(x=>x.WeldJointId).ToList();
|
|
}
|
|
|
|
private void AutoInputWeldJoints(List<string> weldJoints)
|
|
{
|
|
foreach (var weldJointId in weldJoints)
|
|
{
|
|
|
|
List<Model.View_HJGL_WPQ> wpqList = BLL.WPQListServiceService.GetMatchWPQ(WeldJointService.GetWeldJointByWeldJointId(weldJointId), this.CurrUser.LoginProjectId, drpUnit.SelectedValue);
|
|
Model.HJGL_WeldJoint newJot = new Model.HJGL_WeldJoint { WeldJointId = weldJointId };
|
|
if (wpqList != null && wpqList.Count > 0)
|
|
{
|
|
// 优先匹配 GTAW+SMAW 的焊评,保持原有业务优先级。
|
|
var match = wpqList.FirstOrDefault(x => x.WeldingMethodId == "feb1234c-a538-476f-99ac-7b3ab15997c1") ?? wpqList.First();
|
|
Model.WPQ_WPQList wps = BLL.WPQListServiceService.GetWPQById(match.WPQId);
|
|
if (wps != null)
|
|
{
|
|
newJot.WPQId = wps.WPQId;
|
|
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);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
//if (BLL.WeldTaskService.GetWeldTaskByWeldJointId(Grid1.SelectedRowID) != null) //已下任务单,不可修改数据
|
|
//{
|
|
// Alert.ShowInTop("该焊口已生成焊接任务单,不能编辑!", MessageBoxIcon.Warning);
|
|
// return;
|
|
//}
|
|
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();
|
|
}
|
|
|
|
}
|
|
}
|