feat: 完善材料管理与焊接业务功能

This commit is contained in:
2026-08-06 15:33:11 +08:00
parent e418b60fdb
commit 1de898812e
49 changed files with 2566 additions and 555 deletions
@@ -138,7 +138,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
Model.ResponeData responeData = new Model.ResponeData();
List<string> result = new List<string>();
bool includeBatch = ckIncludeBatch.Checked;
int minColumnCount = includeBatch ? 7 : 5;
int minColumnCount = includeBatch ? 8 : 6;
matList.Clear();
if (count < minColumnCount)
@@ -159,8 +159,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
string unitworkId = string.Empty;
unitworkId = Request.Params["UnitWorkId"];
string PipeArea = string.Empty;//管线划分 1工厂预制 2现场施工
if (pds[i].A != null && !string.IsNullOrEmpty(pds[i].A.ToString()))
{
string pipelineCode = pds[i].A.ToString();
@@ -168,7 +166,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (pipeline.Count() > 0)
{
item.PipelineId = pipeline.First().PipelineId;
PipeArea = pipeline.First().PipeArea;
}
else
{
@@ -182,6 +179,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
result.Add((i + 2) + "Line, [管线号] 不能为空</br>");
}
// 材料用途由 Excel 显式填写,不再从所属管线区域推断。
object pipeAreaValue = includeBatch ? pds[i].H : pds[i].F;
item.PipeArea = GetPipeArea(pipeAreaValue == null ? null : pipeAreaValue.ToString());
if (string.IsNullOrEmpty(item.PipeArea))
{
result.Add("第" + (i + 2).ToString() + "行, [材料用途] 必须填写“工厂预制”或“现场安装”</br>");
}
if (pds[i].C != null && !string.IsNullOrEmpty(pds[i].C.ToString()))
{
@@ -264,7 +269,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
result.Add((i + 2) + "Line, [数量] 不能为空</br>");
}
if (PipeArea == "1")
if (item.PipeArea == PipelineService.PipeArea_SHOP)
{
if (pds[i].B != null && !string.IsNullOrEmpty(pds[i].B.ToString()))
{
@@ -280,8 +285,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
var model = includeBatch
? matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents)
: matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode2 == item.MaterialCode2 && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents);
? matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents && x.PipeArea == item.PipeArea)
: matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode2 == item.MaterialCode2 && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents && x.PipeArea == item.PipeArea);
if (model.Count() == 0)
{
matList.Add(item);
@@ -517,6 +522,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
&& x.WeldJointId == item.WeldJointId
&& x.PipelineId == item.PipelineId
&& x.PrefabricatedComponents == item.PrefabricatedComponents
&& x.PipeArea == item.PipeArea
&& (string.IsNullOrEmpty(item.MaterialCode) || x.MaterialCode == item.MaterialCode)
select x;
if (pipeLineMat.Count() == 0 || pipeLineMat == null)
@@ -537,5 +543,23 @@ namespace FineUIPro.Web.HJGL.WeldingManage
BLL.HJGL_PipelineComponentService.SyncPipelineComponentByMatId(item.PipeLineMatId);
}
}
/// <summary>
/// 将导入模板中的材料用途转换为数据库编码。
/// </summary>
private static string GetPipeArea(string value)
{
string text = value == null ? string.Empty : value.Trim();
if (string.Equals(text, "工厂预制", StringComparison.OrdinalIgnoreCase))
{
return PipelineService.PipeArea_SHOP;
}
if (string.Equals(text, "现场安装", StringComparison.OrdinalIgnoreCase)
|| string.Equals(text, "现场施工", StringComparison.OrdinalIgnoreCase))
{
return PipelineService.PipeArea_FIELD;
}
return null;
}
}
}