feat(hjgl): 完善焊前检查和防腐检查流程
焊前检查需要同时覆盖下料、组对和防腐检查,并支持移动端查询与保存。 扩展焊前检查模型、服务和页面字段,补充检查结果、不合格原因、整改要求、 附件和防腐检查记录,便于按焊口和材料追溯检查过程。
This commit is contained in:
@@ -5,8 +5,6 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
@@ -14,7 +12,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
public partial class WeldMatMatch : PageBase
|
||||
{
|
||||
public int pageSize = PipelineService.pageSize;
|
||||
public static decimal Rate = 0;
|
||||
|
||||
public string WarehouseId
|
||||
{
|
||||
get
|
||||
@@ -26,6 +24,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
ViewState["WarehouseId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string PipeArea
|
||||
{
|
||||
get
|
||||
@@ -37,17 +36,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
ViewState["PipeArea"] = value;
|
||||
}
|
||||
}
|
||||
public string Line_No
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Line_No"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Line_No"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, string> dicSeclectPipeLine
|
||||
{
|
||||
get
|
||||
@@ -59,6 +48,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
ViewState["dicSeclectPipeLine"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Model.Tw_PipeMatMatchOutput> tw_PipeMatMatchOutputs
|
||||
{
|
||||
get
|
||||
@@ -106,7 +96,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
drpWarehouse.DataSource = BLL.TwInOutplanmasterService.GetWarehouseCode(this.CurrUser.LoginProjectId);
|
||||
drpWarehouse.DataBind();
|
||||
drpWarehouse_SelectedIndexChanged(null, null);
|
||||
; HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
|
||||
HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
|
||||
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
|
||||
dicSeclectPipeLine = new Dictionary<string, string>();
|
||||
priorityWeldJoints = new Dictionary<string, HashSet<string>>();
|
||||
@@ -123,6 +113,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
#region 加载树装置-单位-工作区
|
||||
|
||||
/// <summary>
|
||||
/// 加载树
|
||||
/// </summary>
|
||||
@@ -146,10 +137,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
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
|
||||
@@ -158,27 +145,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
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();
|
||||
//}
|
||||
|
||||
if (unitWork1.Count() > 0)
|
||||
{
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn1 = new TreeNode();
|
||||
@@ -201,8 +174,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
int a = GetUnitWorkTestPackagePipelineCount(q.UnitWorkId);
|
||||
// var NowComPipelineCode = PipelineService.GetNoComPipelinesByUnitWordId(q.UnitWorkId);
|
||||
//int a = NowComPipelineCode.Count();
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn2 = new TreeNode();
|
||||
tn2.NodeID = q.UnitWorkId;
|
||||
@@ -225,24 +196,17 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按分页方式向试压包节点追加管线子节点。
|
||||
/// </summary>
|
||||
/// <param name="node">需要加载管线的试压包树节点。</param>
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
//var NowComPipelineCode = PipelineService.GetNoComPipelinesByUnitWordId(node.NodeID);
|
||||
//if (!node.Text.Contains("|"))
|
||||
//{
|
||||
// node.Text += "|" + NowComPipelineCode.Count();
|
||||
|
||||
//}
|
||||
var pipeline = GetTestPackagePipelineList(node.NodeID);
|
||||
//pipeline= pipeline.Where(x => NowComPipelineCode.Contains(x.PipelineCode)).ToList();
|
||||
if (!node.Text.Contains("|"))
|
||||
{
|
||||
node.Text += "|" + pipeline.Count();
|
||||
|
||||
}
|
||||
int pageindex = int.Parse(node.CommandName.Split('|')[0]);
|
||||
int pageCount = int.Parse(node.CommandName.Split('|')[1]);
|
||||
@@ -251,10 +215,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList();
|
||||
foreach (var item in pipeline)
|
||||
{
|
||||
/*if (!NowComPipelineCode.Contains(item.PipelineCode))
|
||||
{
|
||||
continue;
|
||||
}*/
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = item.PipelineCode;
|
||||
newNode.NodeID = item.PipelineId;
|
||||
@@ -371,8 +331,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 按当前筛选条件重新加载左侧WBS管线树。
|
||||
/// </summary>
|
||||
@@ -383,7 +341,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
this.InitTreeMenu();
|
||||
}
|
||||
|
||||
#endregion 加载树装置-单位-工作区
|
||||
|
||||
#region 点击TreeView
|
||||
|
||||
/// <summary>
|
||||
/// 点击TreeView
|
||||
/// </summary>
|
||||
@@ -395,86 +356,29 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
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);
|
||||
e.Node.ParentNode.Nodes.Remove(e.Node);
|
||||
BindNodes(e.Node.ParentNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// this.BindGrid();
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion 点击TreeView
|
||||
|
||||
#region 数据绑定
|
||||
/// <summary>
|
||||
/// 绑定当前选中管线的材料汇总信息。
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT ISNULL(pipe.MaterialCode2, lib.Code) AS MaterialCode,
|
||||
ISNULL(lib.MaterialName, libCode.MaterialName) AS MaterialName,
|
||||
ISNULL(lib.MaterialUnit, libCode.MaterialUnit) AS MaterialUnit,
|
||||
ISNULL(lib.MaterialSpec, libCode.MaterialSpec) AS MaterialSpec,
|
||||
ISNULL(lib.MaterialMade, libCode.MaterialMade) AS MaterialMade,
|
||||
ISNULL(lib.MaterialDef, libCode.MaterialDef) AS MaterialDef,
|
||||
sum(pipe.Number)as Number ,
|
||||
'0' as MatchNum,'否' AS CheckState
|
||||
FROM dbo.HJGL_PipeLineMat pipe
|
||||
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
|
||||
LEFT JOIN dbo.HJGL_Pipeline line ON line.PipelineId = pipe.PipelineId
|
||||
OUTER APPLY (SELECT TOP 1 * FROM dbo.HJGL_MaterialCodeLib codeLib WHERE codeLib.ProjectId=line.ProjectId AND codeLib.Code=pipe.MaterialCode2 ORDER BY codeLib.MaterialCode) libCode
|
||||
WHERE PipelineId=@PipelineId
|
||||
group by ISNULL(pipe.MaterialCode2, lib.Code),
|
||||
ISNULL(lib.MaterialName, libCode.MaterialName),
|
||||
ISNULL(lib.MaterialUnit, libCode.MaterialUnit),
|
||||
ISNULL(lib.MaterialSpec, libCode.MaterialSpec),
|
||||
ISNULL(lib.MaterialMade, libCode.MaterialMade),
|
||||
ISNULL(lib.MaterialDef, libCode.MaterialDef) ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
// 2.获取当前分页数据
|
||||
Grid1.DataSource = dt;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// 绑定管线匹配汇总。重新匹配会刷新 Grid2,需要把用户原来勾选的管线恢复回来。
|
||||
/// </summary>
|
||||
/// <param name="keepSelectedPipelineIds">需要保留选中状态的管线ID</param>
|
||||
void BindGrid2(IEnumerable<string> keepSelectedPipelineIds = null)
|
||||
{
|
||||
//var result = tw_PipeMatMatchOutputs
|
||||
// .GroupBy(item => new { item.PipelineId, item.PipelineCode,item.UnitWorkName }) // 按 PipelineId 和 PipelineCode 分组
|
||||
// .Select(group => new
|
||||
// {
|
||||
// PipelineId = group.Key.PipelineId, // 当前组的 PipelineId
|
||||
// PipelineCode = group.Key.PipelineCode, // 当前组的 PipelineCode
|
||||
// UnitWorkName = group.Key.UnitWorkName, // 当前组的 UnitWorkName
|
||||
// AverageMatchRate = group.Average(item => item.MatchRate) // 计算平均 MatchRate
|
||||
// })
|
||||
// .ToList(); // 转换为 List
|
||||
|
||||
//// 如果需要将结果转换为自定义类型,可以这样做
|
||||
//List<Tw_PipeMatMatchOutput> output = result.Select(r => new Tw_PipeMatMatchOutput
|
||||
//{
|
||||
// PipelineId = r.PipelineId,
|
||||
// PipelineCode = r.PipelineCode,
|
||||
// UnitWorkName = r.UnitWorkName,
|
||||
// MatchRate = r.AverageMatchRate,
|
||||
// MatchRateString = Math.Round((decimal)r.AverageMatchRate * 100, 2).ToString() + "%"
|
||||
//}).ToList();
|
||||
var output = TwArrivalStatisticsService.GetPipeMatch(tw_PipeMatMatchOutputs);
|
||||
private void BindGrid2(IEnumerable<string> keepSelectedPipelineIds = null)
|
||||
{
|
||||
var output = TwArrivalStatisticsService.GetPipeMatch(tw_PipeMatMatchOutputs)
|
||||
// Grid2 默认展示按管线整体匹配率倒序,便于优先处理齐套率高的管线。
|
||||
.OrderByDescending(x => x.MatchRate ?? 0)
|
||||
.ThenBy(x => x.UnitWorkName)
|
||||
.ThenBy(x => x.PipelineCode)
|
||||
.ToList();
|
||||
Grid2.DataSource = output;
|
||||
Grid2.DataBind();
|
||||
/*if (output.Any())
|
||||
{
|
||||
Rate = Math.Round((decimal)output.Average(item => item.MatchRate) * 100, 2);
|
||||
lbRate.Text = "匹配率:" + Rate.ToString() + "%";
|
||||
}*/
|
||||
// “优先匹配选中焊口”会重新计算匹配结果,重新绑定后要继续保留原管线选中状态。
|
||||
var keepSelectedList = keepSelectedPipelineIds == null ? new List<string>() : keepSelectedPipelineIds.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
||||
var selectList = new List<string>();
|
||||
@@ -486,13 +390,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
Grid2.Rows[i].RowCssClass = "green";
|
||||
selectList.Add(model.PipelineId);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Grid2.Rows[i].RowCssClass = "red";
|
||||
}
|
||||
|
||||
}
|
||||
if (cbSelectCom.Checked)
|
||||
{
|
||||
@@ -508,9 +410,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// <summary>
|
||||
/// 绑定已加入匹配的管线列表,并标识正在出库中的管线。
|
||||
/// </summary>
|
||||
void BindGrid3()
|
||||
private void BindGrid3()
|
||||
{
|
||||
|
||||
Grid3.DataSource = dicSeclectPipeLine;
|
||||
Grid3.DataBind();
|
||||
for (int i = 0; i < Grid3.Rows.Count; i++)
|
||||
@@ -524,41 +425,29 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
Grid3.Rows[i].RowCssClass = "yellow";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 数据绑定
|
||||
|
||||
#region 表格事件
|
||||
/// <summary>
|
||||
/// 材料匹配明细行绑定事件,保留历史行样式扩展入口。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">Grid行绑定事件参数。</param>
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
// DataRowView row = e.DataItem as DataRowView;
|
||||
/* string code = Grid1.DataKeys[e.RowIndex][0].ToString();
|
||||
var num= decimal.Parse(Grid1.DataKeys[e.RowIndex][1].ToString()) ;
|
||||
bool istrue = HJGL_MaterialService.isInStockByMaterialCode(code,num,PipeArea, this.CurrUser.LoginProjectId);
|
||||
|
||||
if (istrue)
|
||||
{
|
||||
e.RowCssClass = "color1";
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定指定管线的材料匹配明细,设置行颜色、优先焊口选中状态和可生成任务单合计。
|
||||
/// 绑定 Grid2 当前选中管线的材料匹配明细,设置行颜色、优先焊口选中状态和可生成任务单合计。
|
||||
/// </summary>
|
||||
/// <param name="pipelineId">管线ID。</param>
|
||||
private void BindMaterialDetail(string pipelineId)
|
||||
private void BindMaterialDetail()
|
||||
{
|
||||
var selectedPipelineIds = Grid2.SelectedRowIDArray == null
|
||||
? new List<string>()
|
||||
: Grid2.SelectedRowIDArray.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
||||
if (!selectedPipelineIds.Any() && !string.IsNullOrEmpty(Grid2.SelectedRowID))
|
||||
{
|
||||
selectedPipelineIds.Add(Grid2.SelectedRowID);
|
||||
}
|
||||
|
||||
// 任务单只允许从未生成任务单的焊口材料中选择,避免重复生成焊接任务。
|
||||
var tb = GetNoTaskMaterialDetails()
|
||||
.Where(x => x.PipelineId == pipelineId)
|
||||
.Where(x => selectedPipelineIds.Contains(x.PipelineId))
|
||||
// 明细固定按管线号、预制组件号、焊口号、材料编码排序,便于同一焊口材料连续展示。
|
||||
.OrderBy(x => x.PipelineCode)
|
||||
.ThenBy(x => x.PrefabricatedComponents)
|
||||
@@ -614,7 +503,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
JObject summary = new JObject();
|
||||
summary.Add("PipelineCode", "合计");
|
||||
summary.Add("PrefabricatedComponents", "可生成任务单焊口数:");
|
||||
summary.Add("WeldJointCode", taskWeldJointCount.ToString());
|
||||
summary.Add("WeldJointCode", taskWeldJointCount.ToString());
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
|
||||
@@ -744,48 +633,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// <param name="e">Grid行点击事件参数。</param>
|
||||
protected void Grid2_RowClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
BindMaterialDetail(Grid2.SelectedRowID);
|
||||
|
||||
BindMaterialDetail();
|
||||
}
|
||||
/// <summary>
|
||||
/// 点击材料明细行时联动三维模型定位当前管线或单位工程。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">Grid行点击事件参数。</param>
|
||||
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
Model.Parameter3D parameter3D = new Model.Parameter3D();
|
||||
Model.ColorModel colorModel = new Model.ColorModel();
|
||||
colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
|
||||
parameter3D.ColorModel = colorModel;
|
||||
parameter3D.ButtonType = "3";
|
||||
if (this.tvControlItem.SelectedNode.CommandName == "单位工程")
|
||||
{
|
||||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
||||
|
||||
|
||||
}
|
||||
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
||||
{
|
||||
var modelpipe = PipelineService.GetPipelineByPipelineId(tvControlItem.SelectedNodeID);
|
||||
if (modelpipe != null && !string.IsNullOrEmpty(modelpipe.UnitWorkId))
|
||||
{
|
||||
bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(tvControlItem.SelectedNodeID, this.CurrUser.LoginProjectId);
|
||||
if (istrue)
|
||||
{
|
||||
Line_No = "/" + modelpipe.PipelineCode;
|
||||
}
|
||||
// parameter3D.Line_No = Line_No;
|
||||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(modelpipe.UnitWorkId);
|
||||
var pipecode = "/" + modelpipe.PipelineCode;
|
||||
parameter3D.TagNum = pipecode;
|
||||
}
|
||||
|
||||
}
|
||||
//ctlAuditFlow.Url_item = BLL.Project_SysSetService.GetAvevaNetUrl_Item(this.CurrUser.LoginProjectId) + parameter3D.ModelName;
|
||||
//ctlAuditFlow.data = parameter3D;
|
||||
//ctlAuditFlow.BindData();
|
||||
}
|
||||
/// <summary>
|
||||
/// 记录材料明细排序字段,并按当前选中管线重新绑定明细。
|
||||
/// </summary>
|
||||
@@ -795,86 +645,28 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
Grid1.SortDirection = e.SortDirection;
|
||||
Grid1.SortField = e.SortField;
|
||||
if (!string.IsNullOrEmpty(Grid2.SelectedRowID) && tw_PipeMatMatchOutputs != null && tw_PipeMatMatchOutputs.Any())
|
||||
if (tw_PipeMatMatchOutputs != null && tw_PipeMatMatchOutputs.Any())
|
||||
{
|
||||
BindMaterialDetail(Grid2.SelectedRowID);
|
||||
}
|
||||
else
|
||||
{
|
||||
BindGrid();
|
||||
BindMaterialDetail();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion 表格事件
|
||||
|
||||
#region 按钮事件
|
||||
|
||||
/// <summary>
|
||||
/// 刷新三维模型参数,按当前树节点定位单位工程或管线。
|
||||
/// 仓库切换后刷新当前仓库ID并重新加载左侧管线树。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">事件参数。</param>
|
||||
protected void btnrefresh_Click(object sender, EventArgs e)
|
||||
protected void drpWarehouse_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
Model.Parameter3D parameter3D = new Model.Parameter3D();
|
||||
Model.ColorModel colorModel = new Model.ColorModel();
|
||||
colorModel = BLL.Project_SysSetService.GetColorModel(this.CurrUser.LoginProjectId);
|
||||
parameter3D.ColorModel = colorModel;
|
||||
parameter3D.TagNum = "";
|
||||
parameter3D.ButtonType = "3";
|
||||
|
||||
if (this.tvControlItem.SelectedNode.CommandName == "单位工程")
|
||||
{
|
||||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(tvControlItem.SelectedNodeID);
|
||||
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == tvControlItem.SelectedNodeID && x.PipeArea == PipeArea && x.WarehouseId == WarehouseId
|
||||
orderby x.PipelineCode
|
||||
select x).ToList();
|
||||
List<string> pipelineList = new List<string>();
|
||||
foreach (var item in pipeline)
|
||||
{
|
||||
bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(item.PipelineId, this.CurrUser.LoginProjectId);
|
||||
if (istrue)
|
||||
{
|
||||
pipelineList.Add("/" + item.PipelineCode);
|
||||
}
|
||||
|
||||
}
|
||||
parameter3D.TagNum = string.Join(",", pipelineList);
|
||||
parameter3D.Line_No = string.Join(",", pipelineList);
|
||||
}
|
||||
else if (this.tvControlItem.SelectedNode.CommandName == "管线")
|
||||
{
|
||||
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = pipeline.UnitWorkId;
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
if (pipeline != null && !string.IsNullOrEmpty(pipeline.UnitWorkId))
|
||||
{
|
||||
bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(tvControlItem.SelectedNodeID, this.CurrUser.LoginProjectId);
|
||||
if (istrue)
|
||||
{
|
||||
Line_No = "/" + pipeline.PipelineCode;
|
||||
}
|
||||
//parameter3D.Line_No = Line_No;
|
||||
parameter3D.ModelName = HJGL_DataImportService.Getlatest3DModelNameByUnitWorkId(pipeline.UnitWorkId);
|
||||
var pipecode = "/" + pipeline.PipelineCode;
|
||||
parameter3D.TagNum = pipecode;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//ctlAuditFlow.Url_item = BLL.Project_SysSetService.GetAvevaNetUrl_Item(this.CurrUser.LoginProjectId) + parameter3D.ModelName;
|
||||
//ctlAuditFlow.data = parameter3D;
|
||||
//ctlAuditFlow.BindData();
|
||||
}
|
||||
|
||||
WarehouseId = Base_WarehouseService.GetWarehouseList(this.CurrUser.LoginProjectId)
|
||||
.Where(x => x.WarehouseId == drpWarehouse.SelectedValue || x.WarehouseName == drpWarehouse.SelectedValue)
|
||||
.Select(x => x.WarehouseId)
|
||||
.FirstOrDefault();
|
||||
this.InitTreeMenu();//加载树
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -896,20 +688,80 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将左侧勾选的管线加入本次材料匹配范围并刷新匹配结果。
|
||||
/// 按树节点获取可加入本次匹配的管线。单位工程节点会展开到其下所有试压包,再套用当前仓库、区域和页面筛选条件。
|
||||
/// </summary>
|
||||
/// <param name="node">左侧树节点。</param>
|
||||
/// <returns>符合材料匹配入口条件的管线列表。</returns>
|
||||
private List<Model.HJGL_Pipeline> GetMatchPipelinesByTreeNode(TreeNode node)
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
return new List<Model.HJGL_Pipeline>();
|
||||
}
|
||||
|
||||
if (node.CommandName == "管线")
|
||||
{
|
||||
var pipeline = PipelineService.GetPipelineByPipelineId(node.NodeID);
|
||||
return pipeline == null ? new List<Model.HJGL_Pipeline>() : new List<Model.HJGL_Pipeline> { pipeline };
|
||||
}
|
||||
|
||||
if (node.CommandName == "单位工程")
|
||||
{
|
||||
var testPackageIds = (from x in Funs.DB.PTP_TestPackage
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == node.NodeID
|
||||
select x.PTP_ID).ToList();
|
||||
|
||||
return testPackageIds
|
||||
.SelectMany(x => GetTestPackagePipelineList(x))
|
||||
.GroupBy(x => x.PipelineId)
|
||||
.Select(x => x.First())
|
||||
.OrderBy(x => x.PipelineCode)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(node.CommandName) && node.CommandName.Contains("|"))
|
||||
{
|
||||
return GetTestPackagePipelineList(node.NodeID);
|
||||
}
|
||||
|
||||
return new List<Model.HJGL_Pipeline>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将左侧勾选管线或当前选中主项/试压包下的管线加入本次材料匹配范围并刷新匹配结果。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">事件参数。</param>
|
||||
protected void btnAddPipelineMatchMat_Click(object sender, EventArgs e)
|
||||
{
|
||||
int addCount = 0;
|
||||
var selectNodes = tvControlItem.GetCheckedNodes();
|
||||
foreach (var node in selectNodes)
|
||||
{
|
||||
if (dicSeclectPipeLine.Where(x => x.Key == node.NodeID).Count() == 0 && node.CommandName == "管线")
|
||||
{
|
||||
dicSeclectPipeLine.Add(node.NodeID, node.Text);
|
||||
addCount++;
|
||||
}
|
||||
}
|
||||
|
||||
var selectedNodePipelines = GetMatchPipelinesByTreeNode(tvControlItem.SelectedNode);
|
||||
foreach (var pipeline in selectedNodePipelines)
|
||||
{
|
||||
if (pipeline != null && !dicSeclectPipeLine.ContainsKey(pipeline.PipelineId))
|
||||
{
|
||||
dicSeclectPipeLine.Add(pipeline.PipelineId, pipeline.PipelineCode);
|
||||
addCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (addCount == 0)
|
||||
{
|
||||
ShowNotify("未找到可新增的匹配管线!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshMatchResult();
|
||||
}
|
||||
|
||||
@@ -936,6 +788,18 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
RefreshMatchResult();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 匹配
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMatchMat_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
BindMaterialDetail();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 优先匹配选中焊口
|
||||
/// </summary>
|
||||
@@ -984,7 +848,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
RefreshMatchResult();
|
||||
Grid2.SelectedRowIDArray = keepSelectedPipelineIds.Distinct().ToArray();
|
||||
BindMaterialDetail(selectedPipelineId);
|
||||
BindMaterialDetail();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1015,21 +879,51 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return;
|
||||
}
|
||||
|
||||
var invalidMaterials = matchedMaterials
|
||||
.Where(x => string.IsNullOrEmpty(x.MatchMaterialCode) || (x.MatchRate ?? 0) < 1)
|
||||
.ToList();
|
||||
/* if (invalidMaterials.Any())
|
||||
{
|
||||
ShowNotify("存在未100%匹配的材料,不能反写材料主编码!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}*/
|
||||
|
||||
int count = BLL.PipelineMatService.UpdateMaterialCodeByMatchOutputs(matchedMaterials);
|
||||
ShowNotify("已保存材料主编码" + count.ToString() + "条!", MessageBoxIcon.Success);
|
||||
RefreshMatchResult();
|
||||
if (Grid2.SelectedRowIDArray.Any())
|
||||
{
|
||||
BindMaterialDetail(Grid2.SelectedRowIDArray.First());
|
||||
BindMaterialDetail();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除 Grid2 当前选中管线中已反写到管线材料表的材料主编码。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">事件参数。</param>
|
||||
protected void btnClearMaterialCode_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid2.SelectedRowIDArray == null || !Grid2.SelectedRowIDArray.Any())
|
||||
{
|
||||
ShowNotify("请先选择需要清除匹配结果的管线!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tw_PipeMatMatchOutputs == null || !tw_PipeMatMatchOutputs.Any())
|
||||
{
|
||||
RefreshMatchResult();
|
||||
}
|
||||
|
||||
var selectedPipelineIds = Grid2.SelectedRowIDArray.ToList();
|
||||
var pipeLineMatIds = tw_PipeMatMatchOutputs
|
||||
.Where(x => selectedPipelineIds.Contains(x.PipelineId))
|
||||
.Select(x => x.PipeLineMatId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
if (!pipeLineMatIds.Any())
|
||||
{
|
||||
ShowNotify("未找到需要清除的材料匹配明细!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
int count = BLL.PipelineMatService.ClearMaterialCodeByPipeLineMatIds(pipeLineMatIds);
|
||||
ShowNotify("已清除材料主编码" + count.ToString() + "条!", MessageBoxIcon.Success);
|
||||
RefreshMatchResult();
|
||||
if (Grid2.SelectedRowIDArray.Any())
|
||||
{
|
||||
BindMaterialDetail();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1066,7 +960,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
Grid3.DataSource = null;
|
||||
Grid3.DataBind();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1288,26 +1181,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return new HashSet<string>(GetTaskableWeldJointRows(weldJointIds).Select(x => x.WeldJointId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定管线范围内的优先匹配焊口集合。
|
||||
/// </summary>
|
||||
/// <param name="selectedPipelineIds">管线ID列表。</param>
|
||||
/// <returns>管线ID到优先焊口ID集合的映射。</returns>
|
||||
private Dictionary<string, HashSet<string>> GetPriorityWeldJointIds(List<string> selectedPipelineIds)
|
||||
{
|
||||
var result = new Dictionary<string, HashSet<string>>();
|
||||
var selectedPriority = priorityWeldJoints
|
||||
.Where(x => selectedPipelineIds.Contains(x.Key) && x.Value != null && x.Value.Any())
|
||||
.ToList();
|
||||
|
||||
foreach (var item in selectedPriority)
|
||||
{
|
||||
result[item.Key] = new HashSet<string>(item.Value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断焊材钢号类别是否能覆盖母材类别。
|
||||
/// </summary>
|
||||
@@ -1338,21 +1211,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return isCover;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 仓库切换后刷新当前仓库ID并重新加载左侧管线树。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">事件参数。</param>
|
||||
protected void drpWarehouse_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
WarehouseId = Base_WarehouseService.GetWarehouseList(this.CurrUser.LoginProjectId)
|
||||
.Where(x => x.WarehouseId == drpWarehouse.SelectedValue || x.WarehouseName == drpWarehouse.SelectedValue)
|
||||
.Select(x => x.WarehouseId)
|
||||
.FirstOrDefault();
|
||||
this.InitTreeMenu();//加载树
|
||||
}
|
||||
#endregion 按钮事件
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user