fix(hjgl): 修复焊口打印与防腐数据处理

This commit is contained in:
2026-08-13 16:58:22 +08:00
parent 5160dde702
commit 0fb67e2006
6 changed files with 50 additions and 33 deletions
@@ -0,0 +1,2 @@
ALTER TABLE HJGL_WeldAppearanceCheck DROP CONSTRAINT FK_HJGL_WeldAppearanceCheck_WeldJoint;
ALTER TABLE HJGL_Pipeline ALTER COLUMN PaintId nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL;
@@ -137,9 +137,9 @@ namespace BLL
/// <summary> /// <summary>
/// 按材料编码获取防腐检查记录 /// 按材料编码获取防腐检查记录
/// </summary> /// </summary>
public static List<Model.AntiCorrosionCheckRecordItem> GetAntiCorrosionChecksByMaterialCode(string materialCode, string projectId) public static List<Model.AntiCorrosionCheckRecordItem> GetAntiCorrosionChecksByMaterialCode(string barCode, string projectId)
{ {
return PreWeldInspectionService.GetAntiCorrosionChecksByMaterialCode(materialCode, projectId); return PreWeldInspectionService.GetAntiCorrosionChecksByMaterialCode(barCode, projectId);
} }
/// <summary> /// <summary>
/// 按焊口获取防腐检查记录列表 /// 按焊口获取防腐检查记录列表
@@ -604,18 +604,20 @@ namespace BLL
/// <summary> /// <summary>
/// 按材料编码获取防腐记录列表 /// 按材料编码获取防腐记录列表
/// </summary> /// </summary>
public static List<Model.AntiCorrosionCheckRecordItem> GetAntiCorrosionChecksByMaterialCode(string materialCode, string projectId) public static List<Model.AntiCorrosionCheckRecordItem> GetAntiCorrosionChecksByMaterialCode(string barCode, string projectId)
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
var query = from r in db.HJGL_AntiCorrosionCheckRecord var query = from r in db.HJGL_AntiCorrosionCheckRecord
join m in db.HJGL_MaterialCodeLib on r.MaterialCode equals m.MaterialCode into materialJoin join m in db.HJGL_MaterialCodeLib on r.MaterialCode equals m.MaterialCode into materialJoin
from m in materialJoin.DefaultIfEmpty() 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 join paint in db.Tw_PaintCodeDict on r.PaintId equals paint.Id into paintJoin
from paint in paintJoin.DefaultIfEmpty() from paint in paintJoin.DefaultIfEmpty()
join person in db.Person_Persons on r.CheckPerson equals person.PersonId into personJoin join person in db.Person_Persons on r.CheckPerson equals person.PersonId into personJoin
from person in personJoin.DefaultIfEmpty() from person in personJoin.DefaultIfEmpty()
where r.MaterialCode == materialCode && (string.IsNullOrEmpty(projectId) || r.ProjectId == projectId) where code.BarCode == barCode && (string.IsNullOrEmpty(projectId) || r.ProjectId == projectId)
orderby r.CheckTime descending orderby r.CheckTime descending
select new Model.AntiCorrosionCheckRecordItem select new Model.AntiCorrosionCheckRecordItem
{ {
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="12/29/2021 10:56:08" ReportInfo.Modified="06/15/2026 15:26:16" ReportInfo.CreatorVersion="2017.1.16.0"> <Report ScriptLanguage="CSharp" ReportInfo.Created="12/29/2021 10:56:08" ReportInfo.Modified="08/13/2026 14:02:48" ReportInfo.CreatorVersion="2017.1.16.0">
<ScriptText>using System; <ScriptText>using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -99,7 +99,7 @@ namespace FastReport
} }
</ScriptText> </ScriptText>
<Dictionary> <Dictionary>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaXj7MTwVWd+W15ZHXWbvUTygn/8kT7Dd8PAtwcQdvSWlUEyCU1xPvJPbQKwTsqQwLM+O2fcBJVGvSTxsXNEsa1vy5JNdjQE5XXU2qh41PMt4c4Lp/j2o5C6htb8mS4/JfQOgej7CCf0JujCt3dJ+YxUa4vt7plmc6JvUw8qm4mg5"/> <MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaXj7MTwVWd+W15ZHXWbvUTygn/8kT7Dd8PAtwcQdvSWlUEyCU1xPvJPbQKwTsqQwLM+O2fcBJVGvSTxsXNEsa1vy5JNdjQE5XXU2qh41PMt4c4Lp/j2o5C6htb8mS4/JfQOgej7CCf0JujCt3dJ+YxUOMu7iilLzhukxbIErde2Y"/>
<TableDataSource Name="Table1" ReferenceName="Table1" DataType="System.Int32" Enabled="true"> <TableDataSource Name="Table1" ReferenceName="Table1" DataType="System.Int32" Enabled="true">
<Column Name="pipelineCode" DataType="System.String" PropName="PipelineComponentId"/> <Column Name="pipelineCode" DataType="System.String" PropName="PipelineComponentId"/>
<Column Name="Mat" DataType="System.String" PropName="PipelineComponentCode"/> <Column Name="Mat" DataType="System.String" PropName="PipelineComponentCode"/>
@@ -108,6 +108,7 @@ namespace FastReport
<Column Name="SortIndex" DataType="System.String" PropName="PipelineId"/> <Column Name="SortIndex" DataType="System.String" PropName="PipelineId"/>
<Column Name="PipelineCode" DataType="System.String"/> <Column Name="PipelineCode" DataType="System.String"/>
<Column Name="WeldJointPoint" DataType="System.String" PropName="Column"/> <Column Name="WeldJointPoint" DataType="System.String" PropName="Column"/>
<Column Name="PaintCode" DataType="System.String"/>
</TableDataSource> </TableDataSource>
<TableDataSource Name="Data" ReferenceName="Data.Data" DataType="System.Int32" Enabled="true"> <TableDataSource Name="Data" ReferenceName="Data.Data" DataType="System.Int32" Enabled="true">
<Column Name="CH_TrustID" DataType="System.String"/> <Column Name="CH_TrustID" DataType="System.String"/>
@@ -140,26 +141,29 @@ namespace FastReport
</Dictionary> </Dictionary>
<ReportPage Name="Page1" PaperWidth="80" PaperHeight="42" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" MirrorMargins="true"> <ReportPage Name="Page1" PaperWidth="80" PaperHeight="42" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" MirrorMargins="true">
<PageHeaderBand Name="PageHeader1" Width="302.4"/> <PageHeaderBand Name="PageHeader1" Width="302.4"/>
<DataBand Name="Data1" Top="2.7" Width="302.4" Height="158.76" Guides="198.45" DataSource="Table1" Columns.Count="1"> <DataBand Name="Data1" Top="1.61" Width="302.4" Height="158.76" Guides="198.45" DataSource="Table1" Columns.Count="1">
<TableObject Name="Table2" Left="3.78" Top="3.78" Width="294.84" Height="151.2" Border.Lines="All"> <TableObject Name="Table2" Left="3.78" Top="3.78" Width="275.94" Height="151.2" Border.Lines="All">
<TableColumn Name="Column3" Width="128.51"/> <TableColumn Name="Column3" Width="109.61"/>
<TableColumn Name="Column1" Width="166.33"/> <TableColumn Name="Column1" Width="166.33"/>
<TableRow Name="Row1" Height="37.8"> <TableRow Name="Row1" Height="60.48">
<TableCell Name="Cell23" Text="管线号:[Table1.pipelineCode]" VertAlign="Center" Font="宋体, 11pt" ColSpan="2"/> <TableCell Name="Cell23" VertAlign="Center" Font="宋体, 11pt">
<TableCell Name="Cell1" VertAlign="Center" Font="体, 11pt"/> <TextObject Name="Text1" Left="9.45" Top="9.45" Width="94.5" Height="56.7" Text="[Table1.SortIndex]#" HorzAlign="Center" VertAlign="Center" Font="体, 28pt, style=Bold"/>
</TableRow>
<TableRow Name="Row2" Height="37.8">
<TableCell Name="Cell24" Text="规格:[Table1.Spec]" VertAlign="Center" Font="宋体, 11pt"/>
<TableCell Name="Cell6" Text="材质:[Table1.Mat]" VertAlign="Center" Font="宋体, 11pt"/>
</TableRow>
<TableRow Name="Row5" Height="75.6">
<TableCell Name="Cell35">
<BarcodeObject Name="Barcode1" Left="22.68" Width="83.16" Height="75.6" AutoSize="false" Text="https://sggl.sedin.com.cn/StaticPage/HJGL/index.html?id=[Table1.WeldJointId]&amp;weldjoint=1" ShowText="false" AllowExpressions="true" Barcode="QR Code" Barcode.ErrorCorrection="L" Barcode.Encoding="UTF8" Barcode.QuietZone="true"/>
<TextObject Name="Text2" Left="103.95" Top="56.7" Width="406.35" Height="18.9" Text="[Table1.WeldJointPoint]" VertAlign="Center" Font="黑体, 6pt"/>
</TableCell> </TableCell>
<TableCell Name="Cell36" VertAlign="Center" Font="宋体, 11pt"> <TableCell Name="Cell1" Text="管线号:[Table1.pipelineCode]" VertAlign="Center" Font="宋体, 11pt"/>
<TextObject Name="Text1" Left="9.45" Width="151.2" Height="56.7" Text="[Table1.SortIndex]#" VertAlign="Center" Font="黑体, 36pt, style=Bold"/> </TableRow>
<TableRow Name="Row2" Height="30.24">
<TableCell Name="Cell24" VertAlign="Center" Font="宋体, 11pt">
<BarcodeObject Name="Barcode1" Left="13.23" Width="92.61" Height="85.05" AutoSize="false" Text="https://sggl.sedin.com.cn/StaticPage/HJGL/index.html?id=[Table1.WeldJointId]&amp;weldjoint=1" ShowText="false" AllowExpressions="true" Barcode="QR Code" Barcode.ErrorCorrection="L" Barcode.Encoding="UTF8" Barcode.QuietZone="true"/>
</TableCell> </TableCell>
<TableCell Name="Cell6" Text="规格:[Table1.Spec]" VertAlign="Center" Font="宋体, 11pt"/>
</TableRow>
<TableRow Name="Row6" Height="37.8">
<TableCell Name="Cell37"/>
<TableCell Name="Cell38" Text="材质:[Table1.Mat]" VertAlign="Center" Font="宋体, 11pt"/>
</TableRow>
<TableRow Name="Row5" Height="22.68">
<TableCell Name="Cell35"/>
<TableCell Name="Cell36" Text="防腐等级:[Table1.PaintCode]" VertAlign="Center" Font="宋体, 11pt"/>
</TableRow> </TableRow>
</TableObject> </TableObject>
</DataBand> </DataBand>
@@ -802,7 +802,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (!string.IsNullOrEmpty(col30)) if (!string.IsNullOrEmpty(col30))
{ {
// AF列为非必填项,只有填写时才按防腐字典校验并回填字典ID // AF列为非必填项,只有填写时才按防腐字典校验并回填字典ID
var paint = getPaintCodeDict.FirstOrDefault(x => !string.IsNullOrEmpty(x.PaintCode) && x.PaintCode.Contains(col30)); // LINQ to SQL 不支持翻译 string.IsNullOrEmptyAF 已确认非空,直接按字典编码精确匹配。
var paint = getPaintCodeDict.FirstOrDefault(x => x.PaintCode == col30);
if (paint == null) if (paint == null)
{ {
result.Add("第" + (i + 1).ToString() + "行," + "防腐等级" + "【" + col30 + "】不存在!" + "|"); result.Add("第" + (i + 1).ToString() + "行," + "防腐等级" + "【" + col30 + "】不存在!" + "|");
@@ -1422,14 +1422,22 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{ {
BLL.FastReportService.ResetData(); BLL.FastReportService.ResetData();
var result = Funs.DB.View_HJGL_WeldJoint.Where(x => jointids.Contains(x.WeldJointId)).Select(x => new // 防腐等级维护在管线上,打印时由焊口关联管线,再通过防腐字典取得显示代码。
var result = (from weldJoint in Funs.DB.View_HJGL_WeldJoint
where jointids.Contains(weldJoint.WeldJointId)
join pipeline in Funs.DB.HJGL_Pipeline on weldJoint.PipelineId equals pipeline.PipelineId into pipelineGroup
from pipeline in pipelineGroup.DefaultIfEmpty()
join paint in Funs.DB.Tw_PaintCodeDict on pipeline.PaintId equals paint.Id into paintGroup
from paint in paintGroup.DefaultIfEmpty()
select new
{ {
pipelineCode = x.PipelineCode, pipelineCode = weldJoint.PipelineCode,
Mat = x.MaterialCode, Mat = weldJoint.MaterialCode,
WeldJointId = x.WeldJointId, WeldJointId = weldJoint.WeldJointId,
Spec = x.Specification, Spec = weldJoint.Specification,
SortIndex = x.WeldJointCode.Replace(x.PipelineCode + "/", ""), SortIndex = weldJoint.WeldJointCode.Replace(weldJoint.PipelineCode + "/", ""),
WeldJointPoint=x.WeldJointPoint WeldJointPoint = weldJoint.WeldJointPoint,
PaintCode = paint == null ? string.Empty : paint.PaintCode
}).OrderBy(x => x.pipelineCode).ThenBy(x => x.SortIndex).ToList(); }).OrderBy(x => x.pipelineCode).ThenBy(x => x.SortIndex).ToList();
var tb = LINQToDataTable(result); var tb = LINQToDataTable(result);
if (tb != null && tb.Rows.Count > 0) if (tb != null && tb.Rows.Count > 0)