feat: 完善材料管理与焊接业务功能
This commit is contained in:
@@ -10,7 +10,7 @@ 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)
|
||||
@@ -27,7 +27,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
this.drpPipeArea.DataSource = BLL.PipelineService.GetPipeArea();
|
||||
this.drpPipeArea.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpPipeArea);
|
||||
this.InitTreeMenu();
|
||||
this.InitTreeMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
rootNode1.Text = "建筑工程";
|
||||
rootNode1.CommandName = "建筑工程";
|
||||
rootNode1.Selectable = false;
|
||||
rootNode1.EnableCheckBox = false;
|
||||
this.tvControlItem.Nodes.Add(rootNode1);
|
||||
|
||||
TreeNode rootNode2 = new TreeNode();
|
||||
@@ -51,6 +52,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
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();
|
||||
@@ -121,7 +123,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.EnableExpandEvent = true;
|
||||
tn1.EnableClickEvent = true;
|
||||
tn1.EnableCheckBox = false;
|
||||
// 单位工程复选框表示“当前筛选条件下的全部管线”,不能只依赖已加载的分页节点。
|
||||
tn1.EnableCheckBox = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
@@ -183,7 +186,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.EnableExpandEvent = true;
|
||||
tn2.EnableClickEvent = true;
|
||||
tn2.EnableCheckBox = false;
|
||||
// 单位工程复选框表示“当前筛选条件下的全部管线”,不能只依赖已加载的分页节点。
|
||||
tn2.EnableCheckBox = true;
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
{
|
||||
@@ -206,6 +210,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <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);
|
||||
@@ -261,12 +273,18 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
#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,CAST(WeldJointCode as int) as WeldJointCodeInt
|
||||
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> { };
|
||||
|
||||
@@ -309,7 +327,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
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);
|
||||
@@ -412,58 +430,19 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
ShowNotify("请选择工艺规程编制单位!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
|
||||
|
||||
// BindGrid() 上一次请求中的赋值不会保留到本次回发,按钮处理前重新查询当前筛选结果。
|
||||
BindGrid();
|
||||
if (GridWeldJointIdList.Any())
|
||||
{
|
||||
var jotList = from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == tvControlItem.SelectedNodeID && x.JointAttribute == drpJointAttribute.SelectedValue 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
AutoInputWeldJoints(GridWeldJointIdList);
|
||||
BindGrid();
|
||||
ShowNotify("该管线焊口已完成自动录入!", MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("当前筛选条件下没有可自动录入的焊口!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
protected void btnAutoInput2_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -473,64 +452,23 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return;
|
||||
}
|
||||
TreeNode[] nodes = tvControlItem.GetCheckedNodes();
|
||||
if (nodes.Length > 0)
|
||||
var pipelineIds = new List<string>();
|
||||
foreach (TreeNode node in nodes)
|
||||
{
|
||||
foreach (TreeNode node in nodes)
|
||||
if (node.CommandName == "管线")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(node.NodeID))
|
||||
{
|
||||
var jotList = from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == node.NodeID && x.JointAttribute == drpJointAttribute.SelectedValue 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(node.NodeID)) pipelineIds.Add(node.NodeID);
|
||||
}
|
||||
// BindGrid();
|
||||
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
|
||||
@@ -539,6 +477,69 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
/// <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))
|
||||
|
||||
Reference in New Issue
Block a user