feat: 完善焊接质量检查和材料管理
补齐焊前专项审核和焊缝外观检测流程,统一质检查询、附件处理与材料明细导出,提升业务数据追溯和组件匹配使用效率。
This commit is contained in:
@@ -728,7 +728,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按当前材料区域导出所选单位工程下全部部分已焊接组件。
|
||||
/// 按当前材料区域导出所选单位工程下全部组件。
|
||||
/// </summary>
|
||||
protected void btnExportPartialComponents_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -748,24 +748,40 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
drpWarehouse.SelectedValue);
|
||||
if (!components.Any())
|
||||
{
|
||||
ShowNotify("当前单位工程和区域下没有部分已焊接组件!", MessageBoxIcon.Warning);
|
||||
ShowNotify("当前单位工程和区域下没有可导出的组件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var exportData = components.Select(x => new
|
||||
// 列顺序保持未焊口数后追加未焊达因量、材料编码、数量,便于后续导入使用;每个材料编码单独导出一行。
|
||||
var exportData = components.SelectMany(x =>
|
||||
{
|
||||
单位工程 = x.UnitWorkName,
|
||||
区域 = x.PipeAreaText,
|
||||
管线号 = x.PipelineCode,
|
||||
预制组件号 = x.PrefabricatedComponents,
|
||||
总焊口数 = x.TotalWeldJointCount,
|
||||
已焊口数 = x.WeldedWeldJointCount,
|
||||
未焊口数 = x.UnweldedWeldJointCount,
|
||||
组件匹配率 = x.ComponentMatchRateString
|
||||
List<string> materialCodes = SplitExportValues(x.MaterialCode);
|
||||
List<string> materialQuantities = SplitExportValues(x.MaterialQuantity);
|
||||
int materialRowCount = Math.Max(materialCodes.Count, materialQuantities.Count);
|
||||
if (materialRowCount == 0)
|
||||
{
|
||||
materialRowCount = 1;
|
||||
}
|
||||
|
||||
return Enumerable.Range(0, materialRowCount).Select(index => new
|
||||
{
|
||||
单位工程 = x.UnitWorkName,
|
||||
区域 = x.PipeAreaText,
|
||||
管线号 = x.PipelineCode,
|
||||
预制组件号 = x.PrefabricatedComponents,
|
||||
总焊口数 = x.TotalWeldJointCount,
|
||||
已焊口数 = x.WeldedWeldJointCount,
|
||||
未焊口数 = x.UnweldedWeldJointCount,
|
||||
未焊达因量 = x.UnweldedDin ?? 0,
|
||||
材料编码 = index < materialCodes.Count ? materialCodes[index] : string.Empty,
|
||||
数量 = index < materialQuantities.Count ? materialQuantities[index] : string.Empty,
|
||||
组件匹配率 = x.ComponentMatchRateString,
|
||||
组件状态 = GetComponentStatus(x.TotalWeldJointCount, x.UnweldedWeldJointCount)
|
||||
});
|
||||
}).ToList();
|
||||
|
||||
string areaText = PipeArea == PipelineService.PipeArea_SHOP ? "工厂预制" : "现场安装";
|
||||
string fileName = GetSafeFileName(unitWork.UnitWorkName) + "_" + areaText + "_部分已焊组件_" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx";
|
||||
string fileName = GetSafeFileName(unitWork.UnitWorkName) + "_" + areaText + "_全部组件_" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx";
|
||||
string tempDirectory = Path.Combine(Funs.RootPath, @"File\Excel\Temp");
|
||||
Directory.CreateDirectory(tempDirectory);
|
||||
string filePath = Path.Combine(tempDirectory, Guid.NewGuid().ToString("N") + ".xlsx");
|
||||
@@ -794,6 +810,29 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return safeFileName;
|
||||
}
|
||||
|
||||
private static List<string> SplitExportValues(string values)
|
||||
{
|
||||
return string.IsNullOrEmpty(values)
|
||||
? new List<string>()
|
||||
: values.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => x.Trim())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static string GetComponentStatus(int totalWeldJointCount, int unweldedWeldJointCount)
|
||||
{
|
||||
// 以总焊口数和未焊口数判断组件进度:全部未焊为未开始、无未焊口为已完成,其余为进行中。
|
||||
if (unweldedWeldJointCount == totalWeldJointCount)
|
||||
{
|
||||
return "未开始";
|
||||
}
|
||||
if (unweldedWeldJointCount == 0)
|
||||
{
|
||||
return "已完成";
|
||||
}
|
||||
return "进行中";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按树节点获取可加入本次匹配的管线。单位工程节点会展开到其下所有试压包,再套用当前仓库和页面筛选条件。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user