feat(hjgl): 完善焊接任务与质量管理流程

This commit is contained in:
2026-08-19 17:13:33 +08:00
parent 08792e0dc8
commit 679e9f6cec
68 changed files with 2481 additions and 1170 deletions
@@ -53,6 +53,7 @@ namespace BLL
WeldJointCode = x.w.WeldJointCode,
CuttingLength = x.c.CuttingLength,
GrooveForm = x.c.GrooveForm,
GrooveProcessType = x.c.GrooveProcessType,
GrooveAngle = x.c.GrooveAngle,
IsMaterialCodeBatchNoAccurate = x.c.IsMaterialCodeBatchNoAccurate,
IsMaterialQuantityAccurate = x.c.IsMaterialQuantityAccurate,
@@ -87,8 +88,6 @@ namespace BLL
{
var query = from f in db.HJGL_PreWeldFitupCheck
join w in db.HJGL_WeldJoint on f.WeldJointId equals w.WeldJointId
join g in db.Base_GrooveType on f.GrooveTypeId equals g.GrooveTypeId into grooveTypes
from g in grooveTypes.DefaultIfEmpty()
join p in db.Person_Persons on f.CheckPerson equals p.PersonId into persons
from p in persons.DefaultIfEmpty()
where string.IsNullOrEmpty(projectId) || f.ProjectId == projectId || w.ProjectId == projectId
@@ -96,7 +95,6 @@ namespace BLL
{
f,
w,
g,
CheckPersonName = p == null ? string.Empty : p.PersonName
};
@@ -120,17 +118,8 @@ namespace BLL
WeldJointId = x.f.WeldJointId,
PipelineCode = x.w.PipelineCode,
WeldJointCode = x.w.WeldJointCode,
GrooveTypeId = x.f.GrooveTypeId,
GrooveTypeCode = x.g == null ? string.Empty : x.g.GrooveTypeCode,
GrooveTypeName = x.g == null ? string.Empty : x.g.GrooveTypeName,
GrooveProcessType = x.f.GrooveProcessType,
GrooveAngle = x.f.GrooveAngle,
FitupGap = x.f.FitupGap,
Misalignment = x.f.Misalignment,
WeldReinforcement = x.f.WeldReinforcement,
WeldHeight = x.f.WeldHeight,
WeldWidth = x.f.WeldWidth,
SurfaceDefect = x.f.SurfaceDefect,
CheckPerson = x.f.CheckPerson,
CheckPersonName = x.CheckPersonName,
CheckTime = x.f.CheckTime,
@@ -218,6 +207,7 @@ namespace BLL
WeldJointCode = w.WeldJointCode,
CuttingLength = c.CuttingLength,
GrooveForm = c.GrooveForm,
GrooveProcessType = c.GrooveProcessType,
GrooveAngle = c.GrooveAngle,
IsMaterialCodeBatchNoAccurate = c.IsMaterialCodeBatchNoAccurate,
IsMaterialQuantityAccurate = c.IsMaterialQuantityAccurate,
@@ -293,6 +283,7 @@ namespace BLL
check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId;
check.CuttingLength = item.CuttingLength;
check.GrooveForm = item.GrooveForm;
check.GrooveProcessType = item.GrooveProcessType;
check.GrooveAngle = item.GrooveAngle;
check.IsMaterialCodeBatchNoAccurate = item.IsMaterialCodeBatchNoAccurate;
check.IsMaterialQuantityAccurate = item.IsMaterialQuantityAccurate;
@@ -381,11 +372,6 @@ namespace BLL
{
throw new ArgumentException("焊口ID不能为空。");
}
/* if (string.IsNullOrEmpty(item.GrooveTypeId))
{
throw new ArgumentException("坡口类型不能为空。");
}*/
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var weldJoint = db.HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
@@ -393,11 +379,6 @@ namespace BLL
{
throw new ArgumentException("未找到对应焊口。");
}
/* if (!db.Base_GrooveType.Any(x => x.GrooveTypeId == item.GrooveTypeId))
{
throw new ArgumentException("坡口类型不存在。");
}*/
var check = string.IsNullOrEmpty(item.FitupCheckId)
? null
: db.HJGL_PreWeldFitupCheck.FirstOrDefault(x => x.FitupCheckId == item.FitupCheckId);
@@ -413,15 +394,8 @@ namespace BLL
check.ProjectId = string.IsNullOrEmpty(item.ProjectId) ? weldJoint.ProjectId : item.ProjectId;
check.WeldJointId = item.WeldJointId;
//check.GrooveTypeId = item.GrooveTypeId;
check.GrooveProcessType = item.GrooveProcessType;
check.GrooveAngle = item.GrooveAngle;
check.FitupGap = item.FitupGap;
check.Misalignment = item.Misalignment;
check.WeldReinforcement = item.WeldReinforcement;
check.WeldHeight = item.WeldHeight;
check.WeldWidth = item.WeldWidth;
check.SurfaceDefect = item.SurfaceDefect;
check.CheckPerson = item.CheckPerson;
check.CheckTime = item.CheckTime ?? DateTime.Now;
check.CreateUser = item.CreateUser ?? item.CheckPerson;
@@ -430,10 +404,7 @@ namespace BLL
check.RectifyRequirement = item.RectifyRequirement;
check.Remark = item.Remark;
// 组对检查需要同步回写焊口主表,保证焊口基础信息保持最新
// weldJoint.GrooveTypeId = item.GrooveTypeId;
weldJoint.GrooveProcessType = item.GrooveProcessType;
weldJoint.GrooveAngle = item.GrooveAngle;
// 组对检查只同步组对间隙和错边量。
weldJoint.FitupGap = item.FitupGap;
weldJoint.Misalignment = item.Misalignment;
@@ -602,22 +573,37 @@ namespace BLL
}
/// <summary>
/// 按材料编码获取防腐记录列表
/// 按入库条码获取材料信息及防腐记录列表
/// </summary>
public static List<Model.AntiCorrosionCheckRecordItem> GetAntiCorrosionChecksByMaterialCode(string barCode, string projectId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var normalizedBarCode = string.IsNullOrWhiteSpace(barCode) ? string.Empty : barCode.Trim();
var barCodeMaterial = (from code in db.Tw_InputDetailBarCode
join m in db.HJGL_MaterialCodeLib on code.MaterialCode equals m.MaterialCode into materialJoin
from m in materialJoin.DefaultIfEmpty()
where code.BarCode == normalizedBarCode
select new
{
code.MaterialCode,
Material = m
}).FirstOrDefault();
if (barCodeMaterial == null)
{
return new List<Model.AntiCorrosionCheckRecordItem>();
}
// 先按条码解析材料,再查询检查记录;无检查记录时仍需返回一条材料基础信息供扫码录入使用。
var query = from r in db.HJGL_AntiCorrosionCheckRecord
join m in db.HJGL_MaterialCodeLib on r.MaterialCode equals m.MaterialCode into materialJoin
from m in materialJoin.DefaultIfEmpty()
join code in db.Tw_InputDetailBarCode on m.MaterialCode equals code.MaterialCode into barCodeJoin
from code in barCodeJoin.DefaultIfEmpty()
join paint in db.Tw_PaintCodeDict on r.PaintId equals paint.Id into paintJoin
from paint in paintJoin.DefaultIfEmpty()
join person in db.Person_Persons on r.CheckPerson equals person.PersonId into personJoin
from person in personJoin.DefaultIfEmpty()
where code.BarCode == barCode && (string.IsNullOrEmpty(projectId) || r.ProjectId == projectId)
where r.MaterialCode == barCodeMaterial.MaterialCode &&
(string.IsNullOrEmpty(projectId) || r.ProjectId == projectId)
orderby r.CheckTime descending
select new Model.AntiCorrosionCheckRecordItem
{
@@ -655,9 +641,29 @@ namespace BLL
CreateTime = r.CreateTime
};
var data = query.ToList();
if (data.Count == 0)
{
var material = barCodeMaterial.Material;
data.Add(new Model.AntiCorrosionCheckRecordItem
{
ProjectId = projectId,
MaterialCode = barCodeMaterial.MaterialCode,
MaterialName = material == null ? string.Empty : material.MaterialName,
MaterialSpec = material == null ? string.Empty : material.MaterialSpec,
MaterialMade = material == null ? string.Empty : material.MaterialMade,
MaterialDef = material == null ? string.Empty : material.MaterialDef,
MaterialUnit = material == null ? string.Empty : material.MaterialUnit,
HeatNo = material == null ? string.Empty : material.HeatNo,
BatchNo = material == null ? string.Empty : material.BatchNo,
Code = material == null ? string.Empty : material.Code
});
}
foreach (var item in data)
{
item.AttachUrl1 = GetInspectionAttachUrl(db, Const.Tw_AntiCorrosionCheckRecordMenuId, item.AntiCorrosionCheckId);
if (!string.IsNullOrEmpty(item.AntiCorrosionCheckId))
{
item.AttachUrl1 = GetInspectionAttachUrl(db, Const.Tw_AntiCorrosionCheckRecordMenuId, item.AntiCorrosionCheckId);
}
}
return data;
}