fix(clgl): 完善共享材料匹配与材料编码维护

正确处理零数量共用材料与主编码确认,避免库存重复占用并保证材料编码编辑可定位原记录。
This commit is contained in:
2026-10-28 20:21:07 +08:00
parent 43175f564b
commit ffc0a1516c
7 changed files with 184 additions and 70 deletions
+71 -20
View File
@@ -365,22 +365,20 @@ namespace BLL
string jointAttribute = GetJointAttributeByPipeArea(pipeArea);
bool filterByPipeArea = !string.IsNullOrEmpty(jointAttribute);
if (filterByPipeArea)
{
// 页面用途以材料表 PipeArea 为准,工厂/现场只能匹配相应类型的焊口。
pipeLineMatQuery = pipeLineMatQuery.Where(x => x.PipeLineMat.PipeArea == pipeArea
&& x.WeldJoint != null
&& x.WeldJoint.JointAttribute == jointAttribute);
}
var allPipeLineMats = pipeLineMatQuery.ToList();
var continuationComponentKeys = new HashSet<string>(allPipeLineMats
// 共用来源按完整组件确定,当前页面只展示所选用途的材料。
var areaPipeLineMats = allPipeLineMats
.Where(x => !filterByPipeArea || (x.PipeLineMat.PipeArea == pipeArea
&& x.WeldJoint != null && x.WeldJoint.JointAttribute == jointAttribute))
.ToList();
var continuationComponentKeys = new HashSet<string>(areaPipeLineMats
.Where(x => x.WeldJoint != null && !string.IsNullOrEmpty(x.WeldJoint.WeldingDailyId))
.Select(x => GetComponentKey(x.PipeLineMat.PipelineId, x.PipeLineMat.PrefabricatedComponents)));
// 页面匹配只展示并消耗尚未焊接的焊口材料;不传区域的旧调用保留原查询行为。
var pipeLineMats = allPipeLineMats
.Where(x => (x.PipeLineMat.Number ?? 0) > 0)
var pipeLineMats = areaPipeLineMats
.Where(x => x.PipeLineMat.Number > 0m || (x.PipeLineMat.Number == 0m
&& x.WeldJoint != null && string.IsNullOrEmpty(x.WeldJoint.WeldingDailyId)))
.Where(x => !filterByPipeArea || (x.WeldJoint != null && x.WeldJoint.WeldingDailyId == null))
.ToList();
@@ -508,13 +506,67 @@ namespace BLL
orderedMaterials.AddRange(orderedPipelineMaterials[id].Where(x => !addedMaterialIds.Contains(x.PipeLineMatId)));
}
results = GetMatMatchOutput(orderedMaterials, warehouseCode, projectId, usesMaterialBatchNumber);
// 零数量行只引用来源,不进入库存分配,避免选错主编码或影响正数量材料的选码顺序。
var positiveMaterials = GetMatMatchOutput(orderedMaterials.Where(x => x.NeedNum > 0m).ToList(),
warehouseCode, projectId, usesMaterialBatchNumber).ToDictionary(x => x.PipeLineMatId);
results = orderedMaterials;
var sharedMaterials = results.Where(x => x.NeedNum == 0m).ToList();
if (sharedMaterials.Any())
{
var taskWeldJointIds = new HashSet<string>(
from task in db.HJGL_WeldTask
join joint in db.HJGL_WeldJoint on task.WeldJointId equals joint.WeldJointId
where pipelineIds.Contains(joint.PipelineId)
select task.WeldJointId);
var joints = allPipeLineMats.Where(x => x.WeldJoint != null)
.Select(x => x.WeldJoint).GroupBy(x => x.WeldJointId).Select(x => x.First()).ToList();
var sharedSources = PipelineMatService.GetSharedMaterialSources(
allPipeLineMats.Select(x => x.PipeLineMat).ToList(), joints);
foreach (var material in sharedMaterials)
{
material.MatchNum = 0m;
material.MatchMaterialCode = null;
material.HeatNo = null;
material.BatchNo = null;
HJGL_PipeLineMat source;
if (sharedSources.TryGetValue(material.PipeLineMatId, out source))
{
material.SharedSourcePipeLineMatId = source.PipeLineMatId;
var sourceJoint = joints.First(x => x.WeldJointId == source.WeldJointId);
Tw_PipeMatMatchOutput sourceMatch;
if (taskWeldJointIds.Contains(source.WeldJointId) || !string.IsNullOrEmpty(sourceJoint.WeldingDailyId))
{
material.MatchMaterialCode = source.MaterialCode;
}
else if (positiveMaterials.TryGetValue(source.PipeLineMatId, out sourceMatch) && sourceMatch.MatchRate >= 1m)
{
material.MatchMaterialCode = sourceMatch.MatchMaterialCode;
}
}
material.MatchRate = string.IsNullOrEmpty(material.MatchMaterialCode) ? 0m : 1m;
material.MatchRateString = material.MatchRate == 1m ? "100%" : "0%";
}
var sharedCodes = sharedMaterials.Where(x => !string.IsNullOrEmpty(x.MatchMaterialCode))
.Select(x => x.MatchMaterialCode).Distinct().ToList();
var sharedLibs = db.HJGL_MaterialCodeLib.Where(x => sharedCodes.Contains(x.MaterialCode))
.ToList().GroupBy(x => x.MaterialCode).ToDictionary(x => x.Key, x => x.First());
foreach (var material in sharedMaterials.Where(x => !string.IsNullOrEmpty(x.MatchMaterialCode)))
{
HJGL_MaterialCodeLib lib;
if (sharedLibs.TryGetValue(material.MatchMaterialCode, out lib))
{
material.HeatNo = lib.HeatNo;
material.BatchNo = lib.BatchNo;
}
}
}
// 组件匹配率以当前区域剩余未焊口的材料需求为口径,并回填到每条明细供表格合并展示。
foreach (var componentGroup in results.GroupBy(x => new { x.PipelineId, x.PrefabricatedComponents }))
{
decimal needNum = componentGroup.Sum(x => x.NeedNum) ?? 0;
decimal matchNum = componentGroup.Sum(x => x.MatchNum) ?? 0;
decimal componentMatchRate = needNum > 0 ? matchNum / needNum : 0;
decimal componentMatchRate = needNum > 0 ? matchNum / needNum : (componentGroup.All(x => x.MatchRate >= 1m) ? 1m : 0m);
string componentMatchRateString = Math.Round(componentMatchRate * 100, 2).ToString() + "%";
foreach (var item in componentGroup)
{
@@ -530,7 +582,7 @@ namespace BLL
/// 获取单位工程下当前区域的组件导出汇总。
/// 每个组件返回一行;未焊达因量按未焊口统计,材料信息按当前区域组件材料明细统计。
/// </summary>
public static List<Tw_PartialWeldedComponentOutput> GetPartialWeldedComponents(string projectId, string unitWorkId, string pipeArea, string warehouseCode)
public static List<Tw_PartialWeldedComponentOutput> GetPartialWeldedComponents(string projectId, string unitWorkId, string pipeArea, string warehouseCode, Dictionary<string, List<string>> priorityWeldJoints = null)
{
string jointAttribute = GetJointAttributeByPipeArea(pipeArea);
if (string.IsNullOrEmpty(projectId) || string.IsNullOrEmpty(unitWorkId) || string.IsNullOrEmpty(jointAttribute))
@@ -584,9 +636,8 @@ namespace BLL
var weldJoints = group.GroupBy(x => x.WeldJointId).Select(x => x.First()).ToList();
int weldedCount = weldJoints.Count(x => !string.IsNullOrEmpty(x.WeldingDailyId));
int totalCount = weldJoints.Count;
// 材料编码优先采用匹配页面使用的 MaterialCode2,数量按当前区域组件材料明细汇总。
// 全部导出保留零数量和空编码行,避免共用材料对应的焊口明细丢失。
var materialGroups = group
.Where(x => (x.Number ?? 0) > 0)
.Select(x => new
{
WeldJointId = x.WeldJointId,
@@ -595,7 +646,6 @@ namespace BLL
MaterialCode = GetExportMaterialCode(x.MaterialCode, x.MaterialCode2, materialCodeLibByMaterialCode),
Quantity = x.Number ?? 0
})
.Where(x => !string.IsNullOrEmpty(x.MaterialCode))
.GroupBy(x => new { x.MaterialCode, x.WeldJointId, x.WeldJointCode, x.WeldJointDin })
.OrderBy(x => x.Key.WeldJointCode)
.ThenBy(x => x.Key.MaterialCode)
@@ -639,7 +689,7 @@ namespace BLL
// 导出匹配率复用页面匹配规则,保证区域、未焊口及续作组件优先级完全一致。
var pipelineIds = componentExports.Select(x => x.PipelineId).Distinct().ToList();
var matchOutputs = GetPipeMatMatch(projectId, pipelineIds, warehouseCode, null, pipeArea);
var matchOutputs = GetPipeMatMatch(projectId, pipelineIds, warehouseCode, priorityWeldJoints, pipeArea);
var componentRates = matchOutputs
.GroupBy(x => GetComponentKey(x.PipelineId, x.PrefabricatedComponents))
.ToDictionary(x => x.Key, x => x.First().ComponentMatchRate ?? 0);
@@ -699,6 +749,7 @@ namespace BLL
{
decimal needNum = (decimal)group.Sum(item => item.NeedNum);
decimal matchNum = (decimal)group.Sum(item => item.MatchNum);
decimal matchRate = needNum > 0 ? matchNum / needNum : (group.All(x => x.NeedNum == 0m && x.MatchRate >= 1m) ? 1m : 0m);
return new Tw_PipeMatchOutput
{
PipelineId = group.Key.PipelineId,
@@ -706,8 +757,8 @@ namespace BLL
UnitWorkName = group.Key.UnitWorkName,
SumNeedNum = needNum,
SumMatchNum = matchNum,
MatchRate = matchNum > 0 && needNum > 0 ? matchNum / needNum : 0,
MatchRateString = Math.Round(matchNum / needNum * 100, 2).ToString() + "%"
MatchRate = matchRate,
MatchRateString = Math.Round(matchRate * 100, 2).ToString() + "%"
};
})
.ToList();
@@ -7,7 +7,53 @@ namespace BLL
public static class PipelineMatService
{
/// <summary>
/// 按焊口编号顺序,先左后右校准零数量材料的主编码。
/// 查找零数量材料在同管线、同预制组件内直接相邻的正数量来源。
/// </summary>
internal static Dictionary<string, HJGL_PipeLineMat> GetSharedMaterialSources(
List<HJGL_PipeLineMat> materials, List<HJGL_WeldJoint> joints)
{
var sources = new Dictionary<string, HJGL_PipeLineMat>();
var componentMaterials = materials
.Where(x => !string.IsNullOrWhiteSpace(x.PrefabricatedComponents))
.GroupBy(x => new { x.PipelineId, x.PrefabricatedComponents });
foreach (var component in componentMaterials)
{
var jointIds = component.Select(x => x.WeldJointId).Distinct().ToList();
var orderedJoints = joints
.Where(x => x.PipelineId == component.Key.PipelineId && jointIds.Contains(x.WeldJointId))
.OrderBy(x => x.WeldJointCode)
.ToList();
foreach (var material in component.Where(x => x.Number == 0m && !string.IsNullOrEmpty(x.MaterialCode2)))
{
int jointIndex = orderedJoints.FindIndex(x => x.WeldJointId == material.WeldJointId);
HJGL_PipeLineMat source = null;
// 先固定实际用量来源,不能因前一口尚未确认主编码而改借后一口。
if (jointIndex > 0)
{
string previousJointId = orderedJoints[jointIndex - 1].WeldJointId;
source = component.FirstOrDefault(x => x.WeldJointId == previousJointId
&& x.MaterialCode2 == material.MaterialCode2 && x.Number > 0m);
}
if (source == null && jointIndex >= 0 && jointIndex < orderedJoints.Count - 1)
{
string nextJointId = orderedJoints[jointIndex + 1].WeldJointId;
source = component.FirstOrDefault(x => x.WeldJointId == nextJointId
&& x.MaterialCode2 == material.MaterialCode2 && x.Number > 0m);
}
if (source != null)
{
sources.Add(material.PipeLineMatId, source);
}
}
}
return sources;
}
/// <summary>
/// 在同管线、同预制组件内按焊口编号顺序,先左后右校准零数量材料的主编码。
/// </summary>
public static int CalibrateSharedMaterialCodes(string pipelineId)
{
@@ -15,23 +61,13 @@ namespace BLL
var materials = db.HJGL_PipeLineMat.Where(x => x.PipelineId == pipelineId).ToList();
var joints = db.HJGL_WeldJoint.Where(x => x.PipelineId == pipelineId)
.OrderBy(x => x.WeldJointCode).ToList();
var sources = GetSharedMaterialSources(materials, joints);
int count = 0;
foreach (var material in materials.Where(x => x.Number == 0m))
foreach (var material in materials.Where(x => x.Number == 0m && sources.ContainsKey(x.PipeLineMatId)))
{
int jointIndex = joints.FindIndex(x => x.WeldJointId == material.WeldJointId);
HJGL_PipeLineMat source = null;
if (jointIndex > 0)
{
source = materials.FirstOrDefault(x => x.WeldJointId == joints[jointIndex - 1].WeldJointId
&& x.MaterialCode2 == material.MaterialCode2 && x.MaterialCode != null);
}
if (source == null && jointIndex < joints.Count - 1)
{
source = materials.FirstOrDefault(x => x.WeldJointId == joints[jointIndex + 1].WeldJointId
&& x.MaterialCode2 == material.MaterialCode2 && x.MaterialCode != null);
}
if (source != null)
HJGL_PipeLineMat source = sources[material.PipeLineMatId];
if (!string.IsNullOrWhiteSpace(source.MaterialCode))
{
material.MaterialCode = source.MaterialCode;
count++;
@@ -140,10 +176,21 @@ namespace BLL
public static int UpdateMaterialCodeByMatchOutputs(IEnumerable<Model.Tw_PipeMatMatchOutput> matchedMaterials)
{
Model.SGGLDB db = Funs.DB;
var materials = matchedMaterials.ToList();
var pipelineIds = materials.Where(x => x != null).Select(x => x.PipelineId).Distinct().ToList();
var fixedWeldJointIds = new HashSet<string>(db.HJGL_WeldJoint
.Where(x => pipelineIds.Contains(x.PipelineId) && x.WeldingDailyId != null && x.WeldingDailyId != "")
.Select(x => x.WeldJointId));
fixedWeldJointIds.UnionWith(from task in db.HJGL_WeldTask
join joint in db.HJGL_WeldJoint on task.WeldJointId equals joint.WeldJointId
where pipelineIds.Contains(joint.PipelineId)
select task.WeldJointId);
int count = 0;
foreach (var item in matchedMaterials)
// 先保存实际用量,再确认共用行;已下任务或已焊的主编码不能被本轮匹配改写。
foreach (var item in materials.OrderBy(x => x != null && x.NeedNum == 0m))
{
if (item == null || string.IsNullOrEmpty(item.PipeLineMatId) || string.IsNullOrEmpty(item.MatchMaterialCode))
if (item == null || item.MatchRate != 1m || string.IsNullOrEmpty(item.PipeLineMatId)
|| string.IsNullOrEmpty(item.MatchMaterialCode))
{
continue;
}
@@ -153,6 +200,18 @@ namespace BLL
{
continue;
}
if (fixedWeldJointIds.Contains(pipeLineMat.WeldJointId))
{
continue;
}
if (item.NeedNum == 0m)
{
var source = db.HJGL_PipeLineMat.FirstOrDefault(x => x.PipeLineMatId == item.SharedSourcePipeLineMatId);
if (source == null || source.MaterialCode != item.MatchMaterialCode)
{
continue;
}
}
pipeLineMat.MaterialCode = item.MatchMaterialCode;
count++;
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="2026-05-18" ReportInfo.Modified="06/25/2026 14:44:48" ReportInfo.CreatorVersion="2017.1.16.0">
<Report ScriptLanguage="CSharp" ReportInfo.Created="2026-05-18" ReportInfo.Modified="10/15/2026 17:30:47" ReportInfo.CreatorVersion="2017.1.16.0">
<Dictionary>
<TableDataSource Name="Table1" ReferenceName="Table1" DataType="System.Int32" Enabled="true">
<Column Name="Id" DataType="System.String"/>
@@ -17,10 +17,10 @@
</TableDataSource>
</Dictionary>
<ReportPage Name="Page1" PaperWidth="80" PaperHeight="30" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0">
<DataBand Name="Data1" Width="302.4" Height="100" DataSource="Table1">
<DataBand Name="Data1" Width="302.4" Height="113.4" DataSource="Table1">
<TextObject Name="TextMaterialNameSpec" Left="5.67" Top="1.89" Width="291.06" Height="15.12" Text="[Table1.MaterialName] [Table1.MaterialSpec]" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt, style=Bold"/>
<BarcodeObject Name="Barcode1" Left="11.34" Top="20.79" Width="279.72" Height="52.92" AutoSize="false" Text="[Table1.BarCode]" ShowText="false" AllowExpressions="true" Barcode="PDF417" Barcode.AspectRatio="0.5" Barcode.Columns="0" Barcode.Rows="0" Barcode.CodePage="437" Barcode.CompactionMode="Auto" Barcode.ErrorCorrection="Auto" Barcode.PixelSize="2, 8"/>
<TextObject Name="TextCodeHeatBatch" Left="5.67" Top="86.94" Width="291.06" Height="17.01" Text="[Table1.Code] [Table1.HeatNo] [Table1.BatchNo]" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
<TextObject Name="TextCodeHeatBatch" Left="5.67" Top="77.49" Width="291.06" Height="35.91" Text="[Table1.Code] [Table1.HeatNo] [Table1.BatchNo]" HorzAlign="Center" VertAlign="Center" Font="宋体, 11pt"/>
</DataBand>
</ReportPage>
</Report>
@@ -159,7 +159,7 @@ namespace FineUIPro.Web.HJGL.BaseInfo
////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
if (GetButtonPower(Const.BtnModify))
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialCodeLibEdit.aspx?MaterialCode={0}", Grid1.SelectedRowID, "编辑 - ")));
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialCodeLibEdit.aspx?MaterialCode={0}", System.Web.HttpUtility.UrlEncode(Grid1.SelectedRowID), "编辑 - ")));
}
else
@@ -73,7 +73,7 @@ namespace FineUIPro.Web.HJGL.BaseInfo
Model.HJGL_MaterialCodeLib newLib = new Model.HJGL_MaterialCodeLib
{
MaterialCode = generatedMaterialCode,
MaterialCode = string.IsNullOrEmpty(materialCode) ? generatedMaterialCode : materialCode,
HeatNo = heatNo,
BatchNo = batchNo,
MaterialName = this.txtMaterialName.Text.Trim(),
@@ -593,34 +593,32 @@ namespace FineUIPro.Web.HJGL.WeldingManage
private HashSet<string> GetConfirmedPipeLineMatIds(IEnumerable<Tw_PipeMatMatchOutput> materialDetails)
{
// 已反写材料主编码的唯一可信来源是 HJGL_PipeLineMat.MaterialCode。
var pipeLineMatIds = materialDetails == null
? new List<string>()
: materialDetails
.Where(x => x != null && !string.IsNullOrEmpty(x.PipeLineMatId))
.Select(x => x.PipeLineMatId)
.Distinct()
.ToList();
var details = materialDetails == null
? new List<Tw_PipeMatMatchOutput>()
: materialDetails.Where(x => x != null).ToList();
var pipeLineMatIds = details
.SelectMany(x => new[] { x.PipeLineMatId, x.SharedSourcePipeLineMatId })
.Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
if (!pipeLineMatIds.Any())
{
return new HashSet<string>();
}
bool usesMaterialBatchNumber = BLL.Project_SysSetService.UsesMaterialBatchNumber(this.CurrUser.LoginProjectId);
var confirmedIds = usesMaterialBatchNumber
? Funs.DB.HJGL_PipeLineMat
.Where(x => pipeLineMatIds.Contains(x.PipeLineMatId) && x.MaterialCode != null && x.MaterialCode != "")
.Select(x => x.PipeLineMatId)
.ToList()
: Funs.DB.HJGL_PipeLineMat
.Where(x => pipeLineMatIds.Contains(x.PipeLineMatId)
&& x.MaterialCode != null
&& x.MaterialCode != ""
&& x.MaterialCode2 != null
&& x.MaterialCode2 != ""
&& x.MaterialCode == x.MaterialCode2)
.Select(x => x.PipeLineMatId)
.ToList();
return new HashSet<string>(confirmedIds);
var confirmedCodes = Funs.DB.HJGL_PipeLineMat
.Where(x => pipeLineMatIds.Contains(x.PipeLineMatId) && x.MaterialCode != null && x.MaterialCode != "")
.Where(x => usesMaterialBatchNumber || (x.MaterialCode2 != null && x.MaterialCode2 != "" && x.MaterialCode == x.MaterialCode2))
.Select(x => new { x.PipeLineMatId, x.MaterialCode })
.ToList().ToDictionary(x => x.PipeLineMatId, x => x.MaterialCode);
// 所有材料必须本轮满配;共用行自身和实际用量来源还须已保存本轮主编码。
return new HashSet<string>(details
.Where(x => x.MatchRate == 1m && !string.IsNullOrEmpty(x.PipeLineMatId)
&& confirmedCodes.ContainsKey(x.PipeLineMatId)
&& (x.NeedNum != 0m || (!string.IsNullOrEmpty(x.SharedSourcePipeLineMatId)
&& confirmedCodes.ContainsKey(x.SharedSourcePipeLineMatId)
&& confirmedCodes[x.PipeLineMatId] == x.MatchMaterialCode
&& confirmedCodes[x.SharedSourcePipeLineMatId] == x.MatchMaterialCode)))
.Select(x => x.PipeLineMatId));
}
/// <summary>
@@ -632,7 +630,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
bool usesMaterialBatchNumber = BLL.Project_SysSetService.UsesMaterialBatchNumber(this.CurrUser.LoginProjectId);
string confirmedText = usesMaterialBatchNumber ? "已反写材料主编码" : "材料编码与主编码一致";
Alert.ShowInTop("1、管线绿色为匹配率100%,明细绿色为" + confirmedText + ",红色为匹配率小于100%,蓝色为手动优先焊口。<br/>2、库存匹配顺序为手动优先焊口、存在已焊口的续作组件、其他未开工组件。<br/>3、一个焊口可能对应多条材料明细,该焊口全部有效明细已确认后才允许一键生成任务单。<br/>4、请先在施工基础信息录入中匹配 WPS,确保焊接方法不为空;焊口属性须与工厂预制或现场安装一致,且未生成任务单、焊接日报或焊前准备记录", "说明", MessageBoxIcon.Information);
Alert.ShowInTop("1、管线绿色为匹配率100%,明细绿色为本轮满配且" + confirmedText + ",红色为匹配率小于100%,蓝色为手动优先焊口。<br/>2、库存匹配顺序为手动优先焊口、存在已焊口的续作组件、其他未开工组件。<br/>3、数量为0的共用材料按同管线、同预制组件内的焊口顺序,优先引用前一口的同编码正数量材料;前一口没有对应材料才查后一口。共用材料不重复扣库存,匹配主编码随“保存匹配结果”一起保存。<br/>4、只有匹配率100%的材料才能保存为已确认结果。同一焊口的全部材料均满配且已保存主编码,共用材料来源匹配成功,且焊口已进行焊前准备、匹配焊评后才能生成任务单。", "说明", MessageBoxIcon.Information);
}
/// <summary>
@@ -724,7 +722,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
this.CurrUser.LoginProjectId,
unitWork.UnitWorkId,
PipeArea,
drpWarehouse.SelectedValue);
drpWarehouse.SelectedValue,
GetPriorityWeldJointList());
if (!components.Any())
{
ShowNotify("当前单位工程和区域下没有可导出的组件!", MessageBoxIcon.Warning);
@@ -1075,11 +1074,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
// 生成任务单按 Grid2 勾选管线批量取焊口,不再要求用户在 Grid1 明细逐条勾选。
var selectedPipelineIds = Grid2.SelectedRowIDArray;
RefreshMatchResult();
Grid2.SelectedRowIDArray = selectedPipelineIds;
string failureReason;
var selectedWeldJointIds = GetTaskWeldJointIdsFromSelectedPipelines(out failureReason);
if (!selectedWeldJointIds.Any())
{
ShowNotify(failureReason, MessageBoxIcon.Warning);
BindMaterialDetail();
ShowNotify(failureReason + "请同时检查零数量共用材料的匹配结果!", MessageBoxIcon.Warning);
return;
}
@@ -1235,8 +1238,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
var materialDetails = GetNoTaskMaterialDetails()
// 生成任务单只校验参与匹配的有效材料明细,零用量材料不参与焊口材料齐套判断。
.Where(x => selectedPipelineIds.Contains(x.PipelineId) && !string.IsNullOrEmpty(x.WeldJointId) && (x.NeedNum ?? 0) > 0)
.Where(x => selectedPipelineIds.Contains(x.PipelineId) && !string.IsNullOrEmpty(x.WeldJointId) && x.NeedNum >= 0m)
.ToList();
return GetTaskWeldJointIdsFromMaterialDetails(materialDetails, out failureReason);
}
@@ -1256,7 +1258,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
materialDetails = materialDetails
.Where(x => x != null && !string.IsNullOrEmpty(x.WeldJointId) && (x.NeedNum ?? 0) > 0)
.Where(x => x != null && !string.IsNullOrEmpty(x.WeldJointId) && x.NeedNum >= 0m)
.ToList();
if (!materialDetails.Any())
{
+2
View File
@@ -12,6 +12,8 @@ namespace Model
{
public string Id { get; set; }
public string PipeLineMatId { get; set; }
/// <summary>零数量共用材料对应的正数量材料行。</summary>
public string SharedSourcePipeLineMatId { get; set; }
public string PipelineId { get; set; }
public string PipelineCode { get; set; }
public string UnitWorkId { get; set; }