feat(hjgl):焊接日报增加导入功能
This commit is contained in:
@@ -405,6 +405,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
Grid1.DataSource = dt;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// 绑定管线匹配汇总。重新匹配会刷新 Grid2,需要把用户原来勾选的管线恢复回来。
|
||||
/// </summary>
|
||||
/// <param name="keepSelectedPipelineIds">需要保留选中状态的管线ID</param>
|
||||
void BindGrid2(IEnumerable<string> keepSelectedPipelineIds = null)
|
||||
{
|
||||
//var result = tw_PipeMatMatchOutputs
|
||||
@@ -435,6 +439,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
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>();
|
||||
for (int i = 0; i < Grid2.Rows.Count; i++)
|
||||
@@ -503,6 +508,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
private void BindMaterialDetail(string pipelineId)
|
||||
{
|
||||
// 任务单只允许从未生成任务单的焊口材料中选择,避免重复生成焊接任务。
|
||||
var tb = GetNoTaskMaterialDetails()
|
||||
.Where(x => x.PipelineId == pipelineId)
|
||||
.ToList();
|
||||
@@ -532,6 +538,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
Grid1.SelectedRowIDArray = selectList.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取还没有生成焊接任务单的材料匹配明细。
|
||||
/// </summary>
|
||||
private List<Tw_PipeMatMatchOutput> GetNoTaskMaterialDetails()
|
||||
{
|
||||
var matchOutputs = tw_PipeMatMatchOutputs ?? new List<Tw_PipeMatMatchOutput>();
|
||||
@@ -545,6 +554,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return matchOutputs;
|
||||
}
|
||||
|
||||
// HJGL_WeldTask 已存在的焊口不再显示到待生成任务单的材料明细里。
|
||||
var taskWeldJointIds = Funs.DB.HJGL_WeldTask
|
||||
.Where(x => weldJointIds.Contains(x.WeldJointId))
|
||||
.Select(x => x.WeldJointId)
|
||||
@@ -572,6 +582,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
private void RefreshMatchResult()
|
||||
{
|
||||
// 重新匹配库存会刷新管线汇总表,先暂存选择状态,绑定完成后再恢复。
|
||||
var keepSelectedPipelineIds = Grid2.SelectedRowIDArray == null ? new List<string>() : Grid2.SelectedRowIDArray.ToList();
|
||||
tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(
|
||||
this.CurrUser.LoginProjectId,
|
||||
@@ -756,6 +767,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return;
|
||||
}
|
||||
|
||||
// 页面上的焊口选择来自 Grid1 材料明细;Grid3 是左侧已加入匹配的管线列表。
|
||||
var selectedWeldJoints = new HashSet<string>();
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
@@ -781,6 +793,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
priorityWeldJoints.Remove(selectedPipelineId);
|
||||
}
|
||||
|
||||
// 优先焊口会触发重新匹配,当前管线也必须继续保持选中,方便后续生成任务单。
|
||||
var keepSelectedPipelineIds = Grid2.SelectedRowIDArray == null ? new List<string>() : Grid2.SelectedRowIDArray.ToList();
|
||||
if (!keepSelectedPipelineIds.Contains(selectedPipelineId))
|
||||
{
|
||||
@@ -865,6 +878,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
var weldingRods = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "2" select x;
|
||||
var weldingWires = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "1" select x;
|
||||
var selectedWeldJointIdList = selectedWeldJointIds.ToList();
|
||||
// 任务单按用户在材料匹配明细中勾选的焊口生成,不再按整条管线生成。
|
||||
var selectRowId = (from x in Funs.DB.View_HJGL_NoWeldJointFind
|
||||
where selectedWeldJointIdList.Contains(x.WeldJointId) && x.WeldingDailyId == null &&
|
||||
x.WeldTaskId == null && x.WeldingMethodCode != null
|
||||
@@ -873,6 +887,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
Dictionary<string, string> unitworkTaskCode = new Dictionary<string, string>();
|
||||
Dictionary<string, string> unitworkSerialNumber = new Dictionary<string, string>();
|
||||
Dictionary<int, string> matchPipeline = new Dictionary<int, string>();
|
||||
// 生成任务单仍保留管线在匹配结果中的排序,用于任务单列表按管线顺序展示。
|
||||
for (int rowIndex = 0; rowIndex < Grid2.Rows.Count; rowIndex++)
|
||||
{
|
||||
matchPipeline.Add(rowIndex + 1, Grid2.Rows[rowIndex].RowID);
|
||||
@@ -996,6 +1011,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从材料匹配明细 Grid1 中提取用户选中的焊口ID。
|
||||
/// </summary>
|
||||
private HashSet<string> GetSelectedWeldJointIdsFromGrid1()
|
||||
{
|
||||
var selectedWeldJointIds = new HashSet<string>();
|
||||
|
||||
Reference in New Issue
Block a user