1
This commit is contained in:
@@ -432,6 +432,7 @@
|
||||
<Compile Include="HJGL\LeakVacuum\LeakVacuumAuditService.cs" />
|
||||
<Compile Include="HJGL\LeakVacuum\LeakVacuumEditService.cs" />
|
||||
<Compile Include="HJGL\LeakVacuum\LV_ItemEndCheckService.cs" />
|
||||
<Compile Include="HJGL\NDT\Batch_NDEImportService.cs" />
|
||||
<Compile Include="HJGL\NDT\Batch_NDEItemService.cs" />
|
||||
<Compile Include="HJGL\NDT\Batch_NDEService.cs" />
|
||||
<Compile Include="HJGL\PersonManage\CheckerService.cs" />
|
||||
|
||||
@@ -3553,6 +3553,17 @@ namespace BLL
|
||||
/// </summary>
|
||||
public const string NDTBatchTemplateUrl = "File\\Excel\\DataIn\\管道焊口检测结果通知单导入模板.xlsx";
|
||||
|
||||
/// <summary>
|
||||
/// 检测结果批量导入空白模板
|
||||
/// </summary>
|
||||
public const string NDTBatchUnitImportTemplateUrl = "File\\Excel\\DataIn\\检测结果导入模板.xlsx";
|
||||
|
||||
/// <summary>
|
||||
/// 管道焊接接头报检/检查记录打印模板
|
||||
/// </summary>
|
||||
public const string WeldAppearanceCheckReportTemplateUrl =
|
||||
"File\\Fastreport\\管道焊接接头报检\\检查记录.frx";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 初始化上传路径
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位工程级检测结果导入行
|
||||
/// </summary>
|
||||
public class UnitWorkNDEImportItem
|
||||
{
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
public string TrustBatchId { get; set; }
|
||||
|
||||
public string TrustBatchCode { get; set; }
|
||||
|
||||
public string TrustBatchItemId { get; set; }
|
||||
|
||||
public string PipelineCode { get; set; }
|
||||
|
||||
public string WeldJointCode { get; set; }
|
||||
|
||||
public string WelderCode { get; set; }
|
||||
|
||||
public int TotalFilm { get; set; }
|
||||
|
||||
public int PassFilm { get; set; }
|
||||
|
||||
public string CheckResult { get; set; }
|
||||
|
||||
public string CheckResultText { get; set; }
|
||||
|
||||
public string JudgeGrade { get; set; }
|
||||
|
||||
public string CheckDefects { get; set; }
|
||||
|
||||
public string CheckDefectsText { get; set; }
|
||||
|
||||
public string RepairLocation { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
|
||||
public DateTime? FilmDate { get; set; }
|
||||
|
||||
public DateTime? ReportDate { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单位工程级检测结果批量导入
|
||||
/// </summary>
|
||||
public static class Batch_NDEImportService
|
||||
{
|
||||
/// <summary>
|
||||
/// 一次性保存检测单主表、明细和委托检测状态
|
||||
/// </summary>
|
||||
public static void Import(string projectId, string unitWorkId, string personId, IList<UnitWorkNDEImportItem> importItems)
|
||||
{
|
||||
if (importItems == null || importItems.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException("没有可导入的数据!");
|
||||
}
|
||||
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
bool isValidUnitWork = db.WBS_UnitWork.Any(x => x.UnitWorkId == unitWorkId
|
||||
&& x.ProjectId == projectId
|
||||
&& x.SuperUnitWork == null);
|
||||
if (!isValidUnitWork)
|
||||
{
|
||||
throw new InvalidOperationException("单位工程不存在或不属于当前项目!");
|
||||
}
|
||||
|
||||
List<string> trustBatchIds = importItems.Select(x => x.TrustBatchId).Distinct().ToList();
|
||||
List<string> trustBatchItemIds = importItems.Select(x => x.TrustBatchItemId).Distinct().ToList();
|
||||
|
||||
List<Model.HJGL_Batch_BatchTrust> trusts = db.HJGL_Batch_BatchTrust
|
||||
.Where(x => trustBatchIds.Contains(x.TrustBatchId)
|
||||
&& x.ProjectId == projectId
|
||||
&& x.UnitWorkId == unitWorkId)
|
||||
.ToList();
|
||||
if (trusts.Count != trustBatchIds.Count)
|
||||
{
|
||||
throw new InvalidOperationException("导入数据包含不属于当前单位工程的委托单,请重新审核文件!");
|
||||
}
|
||||
|
||||
if (trustBatchItemIds.Count != importItems.Count)
|
||||
{
|
||||
throw new InvalidOperationException("导入数据包含重复的委托明细,请重新审核文件!");
|
||||
}
|
||||
|
||||
List<Model.HJGL_Batch_BatchTrustItem> trustItems = db.HJGL_Batch_BatchTrustItem
|
||||
.Where(x => trustBatchItemIds.Contains(x.TrustBatchItemId)
|
||||
&& trustBatchIds.Contains(x.TrustBatchId))
|
||||
.ToList();
|
||||
if (trustItems.Count != trustBatchItemIds.Count
|
||||
|| importItems.Any(x => !trustItems.Any(y => y.TrustBatchItemId == x.TrustBatchItemId
|
||||
&& y.TrustBatchId == x.TrustBatchId)))
|
||||
{
|
||||
throw new InvalidOperationException("导入数据包含无效的委托明细,请重新审核文件!");
|
||||
}
|
||||
|
||||
List<string> importedTrustBatchIds = db.HJGL_Batch_NDE
|
||||
.Where(x => trustBatchIds.Contains(x.TrustBatchId))
|
||||
.Select(x => x.TrustBatchId)
|
||||
.ToList();
|
||||
if (importedTrustBatchIds.Count > 0)
|
||||
{
|
||||
string codes = string.Join("、", importItems
|
||||
.Where(x => importedTrustBatchIds.Contains(x.TrustBatchId))
|
||||
.Select(x => x.TrustBatchCode)
|
||||
.Distinct());
|
||||
throw new InvalidOperationException("委托单[" + codes + "]已存在检测结果,不能重复导入!");
|
||||
}
|
||||
|
||||
List<Model.HJGL_Batch_NDE> ndeList = new List<Model.HJGL_Batch_NDE>();
|
||||
List<Model.HJGL_Batch_NDEItem> ndeItemList = new List<Model.HJGL_Batch_NDEItem>();
|
||||
DateTime submitDate = DateTime.Now;
|
||||
|
||||
foreach (IGrouping<string, UnitWorkNDEImportItem> group in importItems.GroupBy(x => x.TrustBatchId))
|
||||
{
|
||||
Model.HJGL_Batch_BatchTrust trust = trusts.First(x => x.TrustBatchId == group.Key);
|
||||
string ndeId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_NDE));
|
||||
|
||||
// 检测流水号沿用检测单编辑页的委托编号转换规则。
|
||||
string ndeCode = trust.TrustType == "R"
|
||||
? trust.TrustBatchCode.Replace("-FXWT-", "-FXJC-")
|
||||
: trust.TrustBatchCode.Replace("-WT-", "-JC-");
|
||||
ndeList.Add(new Model.HJGL_Batch_NDE
|
||||
{
|
||||
NDEID = ndeId,
|
||||
TrustBatchId = trust.TrustBatchId,
|
||||
ProjectId = projectId,
|
||||
UnitId = trust.UnitId,
|
||||
UnitWorkId = unitWorkId,
|
||||
NDEUnit = trust.NDEUnit,
|
||||
NDECode = ndeCode,
|
||||
NDEMan = personId
|
||||
});
|
||||
|
||||
foreach (UnitWorkNDEImportItem importItem in group)
|
||||
{
|
||||
ndeItemList.Add(new Model.HJGL_Batch_NDEItem
|
||||
{
|
||||
NDEItemID = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_NDEItem)),
|
||||
NDEID = ndeId,
|
||||
TrustBatchItemId = importItem.TrustBatchItemId,
|
||||
DetectionTypeId = trust.DetectionTypeId,
|
||||
TotalFilm = importItem.TotalFilm,
|
||||
PassFilm = importItem.PassFilm,
|
||||
CheckResult = importItem.CheckResult,
|
||||
JudgeGrade = importItem.JudgeGrade,
|
||||
CheckDefects = importItem.CheckDefects,
|
||||
RepairLocation = importItem.RepairLocation,
|
||||
Remark = importItem.Remark,
|
||||
FilmDate = importItem.FilmDate,
|
||||
ReportDate = importItem.ReportDate,
|
||||
SubmitDate = submitDate
|
||||
});
|
||||
}
|
||||
|
||||
trust.IsCheck = true;
|
||||
}
|
||||
|
||||
// 同一 DataContext 只提交一次,保证主表、明细和委托状态要么全部成功,要么全部失败。
|
||||
db.HJGL_Batch_NDE.InsertAllOnSubmit(ndeList);
|
||||
db.HJGL_Batch_NDEItem.InsertAllOnSubmit(ndeItemList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ namespace BLL
|
||||
/// 分页查询焊缝外观检测记录。
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID。</param>
|
||||
/// <param name="checkCode">检测编号。</param>
|
||||
/// <param name="pipelineCode">管线号查询条件。</param>
|
||||
/// <param name="weldJointCode">焊口号查询条件。</param>
|
||||
/// <param name="qualified">合格状态,1为合格,0为不合格,空为全部。</param>
|
||||
@@ -20,7 +21,7 @@ namespace BLL
|
||||
/// <param name="pageSize">每页记录数。</param>
|
||||
/// <returns>外观检测记录及总记录数。</returns>
|
||||
public static Tuple<List<Model.WeldAppearanceCheckItem>, int> GetList(string projectId,
|
||||
string pipelineCode, string weldJointCode, string qualified, int pageIndex, int pageSize)
|
||||
string checkCode, string pipelineCode, string weldJointCode, string qualified, int pageIndex, int pageSize)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var query = from c in db.HJGL_WeldAppearanceCheck
|
||||
@@ -30,6 +31,10 @@ namespace BLL
|
||||
where string.IsNullOrEmpty(projectId) || c.ProjectId == projectId
|
||||
select new { c, w, CheckPersonName = p == null ? string.Empty : p.PersonName };
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(checkCode))
|
||||
{
|
||||
query = query.Where(x => x.c.CheckCode == checkCode);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(pipelineCode))
|
||||
{
|
||||
query = query.Where(x => x.w.PipelineCode.Contains(pipelineCode));
|
||||
@@ -71,10 +76,93 @@ namespace BLL
|
||||
InterpassTemperature = x.c.InterpassTemperature,
|
||||
CreateTime = x.c.CreateTime
|
||||
}).ToList();
|
||||
PopulateReportFields(data);
|
||||
PopulateAttachUrls(data);
|
||||
return Tuple.Create(data, total);
|
||||
}
|
||||
|
||||
private static void PopulateReportFields(List<Model.WeldAppearanceCheckItem> data)
|
||||
{
|
||||
List<string> weldJointIds = data.Select(x => x.WeldJointId).Distinct().ToList();
|
||||
if (weldJointIds.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var details = Funs.DB.View_HJGL_WeldJoint
|
||||
.Where(x => weldJointIds.Contains(x.WeldJointId))
|
||||
.Select(x => new
|
||||
{
|
||||
x.WeldJointId,
|
||||
x.UnitWorkId,
|
||||
x.UnitWorkName,
|
||||
x.WelderCode,
|
||||
x.Specification,
|
||||
x.MaterialCode,
|
||||
x.WeldingLocationCode,
|
||||
x.WeldingMethodCode,
|
||||
x.WeldingRod,
|
||||
x.WeldingRodCode,
|
||||
x.WeldingWire,
|
||||
x.WeldingWireCode
|
||||
}).ToList();
|
||||
|
||||
List<string> consumablesIds = details
|
||||
.SelectMany(x => new[] { x.WeldingWire, x.WeldingRod })
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var consumablesById = new Dictionary<string, string>();
|
||||
if (consumablesIds.Count > 0)
|
||||
{
|
||||
consumablesById = Funs.DB.Base_Consumables
|
||||
.Where(x => consumablesIds.Contains(x.ConsumablesId))
|
||||
.ToDictionary(x => x.ConsumablesId, x => x.ConsumablesName);
|
||||
}
|
||||
|
||||
foreach (Model.WeldAppearanceCheckItem item in data)
|
||||
{
|
||||
var detail = details.FirstOrDefault(x => x.WeldJointId == item.WeldJointId);
|
||||
if (detail == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
item.UnitWorkId = detail.UnitWorkId;
|
||||
item.UnitWorkName = detail.UnitWorkName;
|
||||
item.WelderCode = detail.WelderCode;
|
||||
item.Specification = detail.Specification;
|
||||
item.MaterialCode = detail.MaterialCode;
|
||||
item.WeldingLocation = detail.WeldingLocationCode;
|
||||
item.WeldingMethodCode = detail.WeldingMethodCode;
|
||||
item.WeldingRodCode = detail.WeldingRodCode;
|
||||
item.WeldingWireCode = detail.WeldingWireCode;
|
||||
string wireName;
|
||||
string rodName;
|
||||
consumablesById.TryGetValue(detail.WeldingWire ?? string.Empty, out wireName);
|
||||
consumablesById.TryGetValue(detail.WeldingRod ?? string.Empty, out rodName);
|
||||
// 焊材牌号使用焊丝、焊条在耗材基础表中的名称,按既有报表口径以“+”合并并去重。
|
||||
item.WeldingMaterial = string.Join("+", new[] { wireName, rodName }
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x)).Distinct());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询当前项目可用于筛选和打印的检测编号。
|
||||
/// </summary>
|
||||
/// <param name="projectId">项目ID。</param>
|
||||
/// <returns>检测编号列表。</returns>
|
||||
public static List<string> GetCheckCodes(string projectId)
|
||||
{
|
||||
return Funs.DB.HJGL_WeldAppearanceCheck
|
||||
.Where(x => (string.IsNullOrEmpty(projectId) || x.ProjectId == projectId)
|
||||
&& x.CheckCode != null && x.CheckCode != string.Empty)
|
||||
.Select(x => x.CheckCode)
|
||||
.Distinct()
|
||||
.OrderByDescending(x => x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询当前项目中已焊接的焊口。
|
||||
/// </summary>
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Report ScriptLanguage="CSharp" ReportInfo.Created="2026-08-20" ReportInfo.Modified="2026-08-20" ReportInfo.CreatorVersion="2017.1.16.0">
|
||||
<Dictionary>
|
||||
<TableDataSource Name="Data" ReferenceName="Data" DataType="System.Int32" Enabled="true">
|
||||
<Column Name="RowNumber" DataType="System.Int32"/>
|
||||
<Column Name="PipelineCode" DataType="System.String"/>
|
||||
<Column Name="WeldJointCode" DataType="System.String"/>
|
||||
<Column Name="WelderCode" DataType="System.String"/>
|
||||
<Column Name="Specification" DataType="System.String"/>
|
||||
<Column Name="MaterialCode" DataType="System.String"/>
|
||||
<Column Name="WeldingLocation" DataType="System.String"/>
|
||||
<Column Name="WeldingMethodCode" DataType="System.String"/>
|
||||
<Column Name="WeldingMaterial" DataType="System.String"/>
|
||||
<Column Name="ItemCode" DataType="System.String"/>
|
||||
<Column Name="BatchCode" DataType="System.String"/>
|
||||
<Column Name="Remark" DataType="System.String"/>
|
||||
</TableDataSource>
|
||||
<Parameter Name="ProjectName" DataType="System.String"/>
|
||||
<Parameter Name="CheckCode" DataType="System.String"/>
|
||||
<Parameter Name="NDTMethod" DataType="System.String"/>
|
||||
<Parameter Name="InspectionCount" DataType="System.String"/>
|
||||
<Parameter Name="DetectionRate" DataType="System.String"/>
|
||||
</Dictionary>
|
||||
<ReportPage Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" LeftMargin="20" TopMargin="15" RightMargin="20" BottomMargin="15">
|
||||
<PageHeaderBand Name="PageHeader1" Width="971.46" Height="128.52" PrintOn="FirstPage, LastPage, OddPages, EvenPages, RepeatedBand, SinglePage">
|
||||
<TextObject Name="TextStandard" Width="170.1" Height="35.91" Text="SH/T 3543—G402" VertAlign="Center" Font="楷体, 11pt"/>
|
||||
<TextObject Name="TextTitle" Left="170.1" Width="500.85" Height="35.91" Text="管道焊接接头报检/检查记录" HorzAlign="Center" VertAlign="Center" Font="楷体, 18pt, style=Bold"/>
|
||||
<TextObject Name="TextProject" Left="670.95" Width="300.51" Height="35.91" Text="工程名称:[ProjectName]" HorzAlign="Right" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextCheckCodeLabel" Top="35.91" Width="155.93" Height="34.02" Border.Lines="All" Text="报检/检查记录编号" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextCheckCode" Left="155.93" Top="35.91" Width="330.75" Height="34.02" Border.Lines="All" Text="[CheckCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextMethodLabel" Left="486.68" Top="35.91" Width="119.07" Height="34.02" Border.Lines="All" Text="无损检测方法" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextMethod" Left="605.75" Top="35.91" Width="63.5" Height="34.02" Border.Lines="All" Text="[NDTMethod]" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextCountLabel" Left="669.25" Top="35.91" Width="94.5" Height="34.02" Border.Lines="All" Text="报检数量" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextCount" Left="763.75" Top="35.91" Width="66.15" Height="34.02" Border.Lines="All" Text="[InspectionCount]个" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextRateLabel" Left="829.9" Top="35.91" Width="85.05" Height="34.02" Border.Lines="All" Text="检测比例" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="TextRate" Left="914.95" Top="35.91" Width="56.51" Height="34.02" Border.Lines="All" Text="[DetectionRate]%" HorzAlign="Center" VertAlign="Center" Font="楷体, 10.5pt"/>
|
||||
<TextObject Name="HeaderRowNumber" Top="69.93" Width="30" Height="58.59" Border.Lines="All" Text="序号" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderPipeline" Left="30" Top="69.93" Width="145" Height="58.59" Border.Lines="All" Text="管道编号/单线号/管段号" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderWeldJoint" Left="175" Top="69.93" Width="55" Height="58.59" Border.Lines="All" Text="焊口 编号" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderWelder" Left="230" Top="69.93" Width="60" Height="58.59" Border.Lines="All" Text="焊工 代号" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderSpecification" Left="290" Top="69.93" Width="85" Height="58.59" Border.Lines="All" Text="规格 mm" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderMaterial" Left="375" Top="69.93" Width="100" Height="58.59" Border.Lines="All" Text="材质" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderLocation" Left="475" Top="69.93" Width="55" Height="58.59" Border.Lines="All" Text="焊接 位置" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderMethod" Left="530" Top="69.93" Width="70" Height="58.59" Border.Lines="All" Text="焊接方法" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderWeldingMaterial" Left="600" Top="69.93" Width="90" Height="58.59" Border.Lines="All" Text="焊材牌号" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderItemCode" Left="690" Top="69.93" Width="60" Height="58.59" Border.Lines="All" Text="物料代码" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderBatchCode" Left="750" Top="69.93" Width="60" Height="58.59" Border.Lines="All" Text="炉批号" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
<TextObject Name="HeaderRemark" Left="810" Top="69.93" Width="161.46" Height="58.59" Border.Lines="All" Text="备注" HorzAlign="Center" VertAlign="Center" Font="楷体, 9pt"/>
|
||||
</PageHeaderBand>
|
||||
<DataBand Name="Data1" Top="132.52" Width="971.46" Height="36.86" DataSource="Data">
|
||||
<TextObject Name="DataRowNumber" Width="30" Height="36.86" Border.Lines="All" Text="[Data.RowNumber]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataPipeline" Left="30" Width="145" Height="36.86" Border.Lines="All" Text="[Data.PipelineCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataWeldJoint" Left="175" Width="55" Height="36.86" Border.Lines="All" Text="[Data.WeldJointCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataWelder" Left="230" Width="60" Height="36.86" Border.Lines="All" Text="[Data.WelderCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataSpecification" Left="290" Width="85" Height="36.86" Border.Lines="All" Text="[Data.Specification]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataMaterial" Left="375" Width="100" Height="36.86" Border.Lines="All" Text="[Data.MaterialCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataLocation" Left="475" Width="55" Height="36.86" Border.Lines="All" Text="[Data.WeldingLocation]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataMethod" Left="530" Width="70" Height="36.86" Border.Lines="All" Text="[Data.WeldingMethodCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataWeldingMaterial" Left="600" Width="90" Height="36.86" Border.Lines="All" Text="[Data.WeldingMaterial]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataItemCode" Left="690" Width="60" Height="36.86" Border.Lines="All" Text="[Data.ItemCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataBatchCode" Left="750" Width="60" Height="36.86" Border.Lines="All" Text="[Data.BatchCode]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
<TextObject Name="DataRemark" Left="810" Width="161.46" Height="36.86" Border.Lines="All" Text="[Data.Remark]" HorzAlign="Center" VertAlign="Center" Font="楷体, 8.5pt"/>
|
||||
</DataBand>
|
||||
<ReportSummaryBand Name="ReportSummary1" Top="173.38" Width="971.46" Height="75.6" KeepWithData="true">
|
||||
<TextObject Name="SignTeam" Width="242.87" Height="75.6" Border.Lines="All" Text="施工班组长: 日期:" VertAlign="Center" Font="宋体, 10.5pt" Padding="10, 2, 2, 2"/>
|
||||
<TextObject Name="SignQuality" Left="242.87" Width="242.86" Height="75.6" Border.Lines="All" Text="质量检查员: 日期:" VertAlign="Center" Font="宋体, 10.5pt" Padding="10, 2, 2, 2"/>
|
||||
<TextObject Name="SignContractor" Left="485.73" Width="242.86" Height="75.6" Border.Lines="All" Text="总包代表: 日期:" VertAlign="Center" Font="宋体, 10.5pt" Padding="10, 2, 2, 2"/>
|
||||
<TextObject Name="SignOwner" Left="728.59" Width="242.87" Height="75.6" Border.Lines="All" Text="业主代表: 日期:" VertAlign="Center" Font="宋体, 10.5pt" Padding="10, 2, 2, 2"/>
|
||||
</ReportSummaryBand>
|
||||
</ReportPage>
|
||||
</Report>
|
||||
@@ -1626,6 +1626,7 @@
|
||||
<Content Include="HJGL\NDT\NDTBatchAudit.aspx" />
|
||||
<Content Include="HJGL\NDT\NDTBatchEdit.aspx" />
|
||||
<Content Include="HJGL\NDT\NDTBatchImport.aspx" />
|
||||
<Content Include="HJGL\NDT\NDTBatchUnitImport.aspx" />
|
||||
<Content Include="HJGL\NDT\RepairNotice.aspx" />
|
||||
<Content Include="HJGL\PersonManage\CheckerItem.aspx" />
|
||||
<Content Include="HJGL\PersonManage\CheckerItemEdit.aspx" />
|
||||
@@ -3660,6 +3661,7 @@
|
||||
<Content Include="File\Word\HSSE\工程停工令.doc" />
|
||||
<Content Include="File\Word\HSSE\专项检查.doc" />
|
||||
<Content Include="File\Excel\DataIn\WBS定制导入模板.xls" />
|
||||
<Content Include="File\Excel\DataIn\检测结果导入模板.xlsx" />
|
||||
<Content Include="File\Word\HSSE\安全日志.doc" />
|
||||
<Content Include="File\Word\PHTGL\合同评审、审批表.docx" />
|
||||
<Content Include="File\Word\PHTGL\招标文件审批表.docx" />
|
||||
@@ -3705,6 +3707,7 @@
|
||||
<Content Include="File\Fastreport\JGZL\管道无损检测结果汇总表.frx" />
|
||||
<Content Include="File\Fastreport\JGZL\管道材料材质标识检查记录.frx" />
|
||||
<Content Include="File\Fastreport\JGZL\管道焊接工作记录.frx" />
|
||||
<Content Include="File\Fastreport\管道焊接接头报检\检查记录.frx" />
|
||||
<Content Include="File\Fastreport\JGZL\管道系统压力试验条件确认记录.frx" />
|
||||
<Content Include="File\Fastreport\JGZL\管道系统压力试验记录.frx" />
|
||||
<Content Include="File\Fastreport\JGZL\管道试压包尾项清单.frx" />
|
||||
@@ -10934,6 +10937,13 @@
|
||||
<Compile Include="HJGL\NDT\NDTBatchImport.aspx.designer.cs">
|
||||
<DependentUpon>NDTBatchImport.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HJGL\NDT\NDTBatchUnitImport.aspx.cs">
|
||||
<DependentUpon>NDTBatchUnitImport.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HJGL\NDT\NDTBatchUnitImport.aspx.designer.cs">
|
||||
<DependentUpon>NDTBatchUnitImport.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HJGL\NDT\RepairNotice.aspx.cs">
|
||||
<DependentUpon>RepairNotice.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
@@ -89,12 +89,11 @@
|
||||
<f:Button ID="btnQuery" ToolTip="查询" Icon="SystemSearch" Text="查询"
|
||||
EnablePostBack="true" OnClick="btnQuery_Click" runat="server">
|
||||
</f:Button>
|
||||
<f:Button ID="btnPrint" Text="打印" Icon="Printer" runat="server"
|
||||
OnClick="btnPrint_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnMatImport" Text="材料导入" ToolTip="材料导入" Icon="PackageIn" runat="server" OnClick="btnMatImport_Click">
|
||||
</f:Button>
|
||||
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -734,73 +734,6 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
|
||||
#endregion
|
||||
|
||||
#region 报表打印
|
||||
/// <summary>
|
||||
/// 报表打印
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
string pipelineId = this.tvControlItem.SelectedNodeID;
|
||||
var q = BLL.PipelineService.GetPipelineByPipelineId(pipelineId);
|
||||
|
||||
if (q != null)
|
||||
{
|
||||
var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId select x).Count();
|
||||
var weldJotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipelineId && x.WeldingDailyId != null select x).Count();
|
||||
if (jotCount == weldJotCount)
|
||||
{
|
||||
string varValue = string.Empty;
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (project != null)
|
||||
{
|
||||
varValue = project.ProjectName;
|
||||
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(q.UnitWorkId);
|
||||
if (unitWork != null)
|
||||
{
|
||||
varValue = varValue + "|" + unitWork.UnitWorkName;
|
||||
}
|
||||
}
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@IsoId", pipelineId));
|
||||
listStr.Add(new SqlParameter("@Flag", "0"));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = BLL.SQLHelper.GetDataTableRunProc("HJGL_spJointWorkRecordNew", parameter);
|
||||
string page = Funs.GetPagesCountByPageSize(11, 16, tb.Rows.Count).ToString();
|
||||
|
||||
|
||||
varValue = varValue + "|" + page;
|
||||
|
||||
if (!string.IsNullOrEmpty(varValue))
|
||||
{
|
||||
varValue = HttpUtility.UrlEncodeUnicode(varValue);
|
||||
}
|
||||
if (tb.Rows.Count <= 11)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport2Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReport1Id, pipelineId, varValue, this.CurrUser.LoginProjectId)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请选择焊接完成管线!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ShowNotify("请选择管线!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 关闭弹出窗口及刷新页面
|
||||
/// <summary>
|
||||
/// 关闭弹出窗口
|
||||
@@ -951,47 +884,17 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
//var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
//var workArea = BLL.Project_WorkAreaService.GetProject_WorkAreaByWorkAreaId(this.tvControlItem.SelectedNodeID);
|
||||
//if (iso != null)
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("JointInfoOut.aspx?PipelineId={0}", this.tvControlItem.SelectedNodeID, "导出 - ")));
|
||||
//}
|
||||
//else if (workArea != null)
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("JointInfoOut.aspx?WorkAreaId={0}", this.tvControlItem.SelectedNodeID, "导出 - ")));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Alert.ShowInTop("请选择"PipelineOrArea, MessageBoxIcon.Warning);
|
||||
//}
|
||||
Response.ClearContent();
|
||||
string filename = Funs.GetNewFileName();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("材料信息表" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
Response.ContentType = "application/excel";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
this.Grid1.PageSize = 500;
|
||||
this.BindGrid1(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
Response.Write(GetGridTableHtml(Grid1));
|
||||
Response.End();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出焊口初始信息
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut2_Click(object sender, EventArgs e)
|
||||
{
|
||||
//var iso = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
//if (iso != null)
|
||||
//{
|
||||
// Response.ClearContent();
|
||||
// string filename = Funs.GetNewFileName();
|
||||
// Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(Resources.Lan.WeldingJointInfo + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
// Response.ContentType = "application/excel";
|
||||
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
// this.Grid1.PageSize = 100000;
|
||||
// this.BindGrid();
|
||||
// Response.Write(GetGridTableHtml(Grid1));
|
||||
// Response.End();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Alert.ShowInTop("请选择"PipelinetFirst, MessageBoxIcon.Warning);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出方法btnMatImport_Click
|
||||
@@ -1046,9 +949,6 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
this.BindGrid2(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 管线材料导入
|
||||
|
||||
/// <summary>
|
||||
@@ -1123,5 +1023,7 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,15 +176,6 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnQuery;
|
||||
|
||||
/// <summary>
|
||||
/// btnPrint 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnPrint;
|
||||
|
||||
/// <summary>
|
||||
/// btnMatImport 控件。
|
||||
/// </summary>
|
||||
@@ -194,6 +185,15 @@ namespace FineUIPro.Web.HJGL.DataImport
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnMatImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// TabStrip1 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
<f:Toolbar ID="Toolbar6" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:Button ID="btnUnitWorkImport" Text="检测结果导入" ToolTip="选中单位工程后批量导入检测结果"
|
||||
Icon="ApplicationGet" runat="server" Hidden="true" OnClick="btnUnitWorkImport_Click" />
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Items>
|
||||
<f:Tree ID="tvControlItem" ShowHeader="false" Title="检测单节点树" OnNodeCommand="tvControlItem_NodeCommand"
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace FineUIPro.Web.HJGL.NDT
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnEdit.Hidden = false;
|
||||
this.btnUnitWorkImport.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnAuditing))
|
||||
{
|
||||
@@ -1073,5 +1074,27 @@ namespace FineUIPro.Web.HJGL.NDT
|
||||
ShowNotify("请选择委托单号!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单位工程级批量导入检测结果
|
||||
/// </summary>
|
||||
protected void btnUnitWorkImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_NDTBatchMenuId, Const.BtnSave))
|
||||
{
|
||||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.tvControlItem.SelectedNode == null || this.tvControlItem.SelectedNode.CommandName != "单位工程")
|
||||
{
|
||||
ShowNotify("请先选中单位工程节点!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string window = string.Format("NDTBatchUnitImport.aspx?unitWorkId={0}&type={1}",
|
||||
Server.UrlEncode(this.tvControlItem.SelectedNodeID), Server.UrlEncode(this.Type));
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(window));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-2
@@ -7,10 +7,12 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HJGL.NDT {
|
||||
namespace FineUIPro.Web.HJGL.NDT
|
||||
{
|
||||
|
||||
|
||||
public partial class NDTBatch {
|
||||
public partial class NDTBatch
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
@@ -102,6 +104,24 @@ namespace FineUIPro.Web.HJGL.NDT {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtSearchCode;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar6 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar6;
|
||||
|
||||
/// <summary>
|
||||
/// btnUnitWorkImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnUnitWorkImport;
|
||||
|
||||
/// <summary>
|
||||
/// tvControlItem 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NDTBatchUnitImport.aspx.cs" Inherits="FineUIPro.Web.HJGL.NDT.NDTBatchUnitImport" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>检测结果导入</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" ToolbarAlign="Left" runat="server">
|
||||
<Items>
|
||||
<f:Label ID="lblUnitWork" Label="单位工程" LabelWidth="80px" runat="server" />
|
||||
<f:ToolbarFill runat="server" />
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="下载模板"
|
||||
ToolTip="下载空白检测结果导入模板" OnClick="btnDownLoad_Click"
|
||||
EnablePostBack="true" EnableAjax="false" />
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:FileUpload ID="fuAttachUrl" runat="server" Label="导入文件" LabelWidth="80px"
|
||||
EmptyText="选择要导入的 .xlsx 文件" />
|
||||
<f:ToolbarFill runat="server" />
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" Text="审核并预览"
|
||||
ToolTip="校验导入文件并预览" OnClick="btnAudit_Click" />
|
||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="提交导入"
|
||||
ToolTip="提交当前预览数据" OnClick="btnSave_Click" />
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
|
||||
runat="server" Height="520px" DataKeyNames="TrustBatchItemId" DataIDField="TrustBatchItemId"
|
||||
AllowColumnLocking="true" EnableColumnLines="true" AllowPaging="true" PageSize="100"
|
||||
EnableTextSelection="true" OnPageIndexChange="Grid1_PageIndexChange">
|
||||
<Columns>
|
||||
<f:RenderField Width="60px" DataField="RowNumber" HeaderText="序号"
|
||||
HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="180px" DataField="TrustBatchCode" HeaderText="委托编号"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="180px" DataField="PipelineCode" HeaderText="管线号"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="120px" DataField="WeldJointCode" HeaderText="检件焊口号"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="100px" DataField="WelderCode" HeaderText="焊工号"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="90px" DataField="TotalFilm" HeaderText="检测总数"
|
||||
HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="80px" DataField="PassFilm" HeaderText="合格数"
|
||||
HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="90px" DataField="CheckResultText" HeaderText="是否合格"
|
||||
HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="90px" DataField="JudgeGrade" HeaderText="评定级别"
|
||||
HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="140px" DataField="CheckDefectsText" HeaderText="缺陷"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="140px" DataField="RepairLocation" HeaderText="返修位置"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="180px" DataField="Remark" HeaderText="备注"
|
||||
HeaderTextAlign="Center" TextAlign="Left" />
|
||||
<f:RenderField Width="110px" DataField="FilmDate" HeaderText="检测日期"
|
||||
FieldType="Date" Renderer="Date" HeaderTextAlign="Center" TextAlign="Center" />
|
||||
<f:RenderField Width="110px" DataField="ReportDate" HeaderText="报告日期"
|
||||
FieldType="Date" Renderer="Date" HeaderTextAlign="Center" TextAlign="Center" />
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,496 @@
|
||||
using BLL;
|
||||
using MiniExcelLibs;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.NDT
|
||||
{
|
||||
public partial class NDTBatchUnitImport : PageBase
|
||||
{
|
||||
private static readonly string[] TemplateColumns =
|
||||
{
|
||||
"序号", "委托编号", "管线号", "检件焊口号", "焊工号", "检测总数",
|
||||
"合格数", "是否合格", "评定级别", "缺陷", "返修位置", "备注",
|
||||
"检测日期", "报告日期"
|
||||
};
|
||||
|
||||
private string UnitWorkId
|
||||
{
|
||||
get { return Convert.ToString(ViewState["UnitWorkId"]); }
|
||||
set { ViewState["UnitWorkId"] = value; }
|
||||
}
|
||||
|
||||
private string NDTType
|
||||
{
|
||||
get { return Convert.ToString(ViewState["NDTType"]); }
|
||||
set { ViewState["NDTType"] = value; }
|
||||
}
|
||||
|
||||
private string ImportCacheKey
|
||||
{
|
||||
get { return Convert.ToString(ViewState["ImportCacheKey"]); }
|
||||
set { ViewState["ImportCacheKey"] = value; }
|
||||
}
|
||||
|
||||
private List<UnitWorkNDEImportItem> ImportItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return Session[ImportCacheKey] as List<UnitWorkNDEImportItem>
|
||||
?? new List<UnitWorkNDEImportItem>();
|
||||
}
|
||||
set { Session[ImportCacheKey] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
UnitWorkId = Request.QueryString["unitWorkId"];
|
||||
NDTType = Request.QueryString["type"];
|
||||
ImportCacheKey = "NDTBatchUnitImport_" + Guid.NewGuid().ToString("N");
|
||||
ImportItems = new List<UnitWorkNDEImportItem>();
|
||||
|
||||
WBS_UnitWork unitWork = Funs.DB.WBS_UnitWork.FirstOrDefault(x =>
|
||||
x.UnitWorkId == UnitWorkId
|
||||
&& x.ProjectId == CurrUser.LoginProjectId
|
||||
&& x.SuperUnitWork == null);
|
||||
if (unitWork == null)
|
||||
{
|
||||
btnAudit.Enabled = false;
|
||||
btnSave.Enabled = false;
|
||||
btnDownLoad.Enabled = false;
|
||||
ShowNotify("单位工程不存在或不属于当前项目!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
lblUnitWork.Text = unitWork.UnitWorkCode + " " + unitWork.UnitWorkName;
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnDownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
string templatePath = Server.MapPath("~/" + Const.NDTBatchUnitImportTemplateUrl.Replace("\\", "/"));
|
||||
if (!File.Exists(templatePath))
|
||||
{
|
||||
ShowNotify("检测结果导入模板不存在,请联系管理员!", MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
FileInfo info = new FileInfo(templatePath);
|
||||
Response.ClearContent();
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("检测结果导入模板.xlsx", System.Text.Encoding.UTF8));
|
||||
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
Response.AddHeader("Content-Length", info.Length.ToString());
|
||||
Response.TransmitFile(templatePath, 0, info.Length);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
}
|
||||
|
||||
protected void btnAudit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!fuAttachUrl.HasFile)
|
||||
{
|
||||
ShowNotify("请选择要导入的 Excel 文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string extension = Path.GetExtension(fuAttachUrl.FileName).ToLowerInvariant();
|
||||
if (extension != ".xlsx")
|
||||
{
|
||||
ShowNotify("只能导入 .xlsx 文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string uploadDirectory = Path.Combine(rootPath, Const.ExcelUrl);
|
||||
if (!Directory.Exists(uploadDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(uploadDirectory);
|
||||
}
|
||||
|
||||
string filePath = Path.Combine(uploadDirectory, Funs.GetNewFileName() + extension);
|
||||
try
|
||||
{
|
||||
fuAttachUrl.PostedFile.SaveAs(filePath);
|
||||
DataTable table = MiniExcel.QueryAsDataTable(filePath, useHeaderRow: true);
|
||||
List<string> errors;
|
||||
List<UnitWorkNDEImportItem> importItems = ParseImportItems(table, out errors);
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
ImportItems = new List<UnitWorkNDEImportItem>();
|
||||
BindGrid();
|
||||
ShowErrors(errors);
|
||||
return;
|
||||
}
|
||||
|
||||
ImportItems = importItems;
|
||||
BindGrid();
|
||||
ShowNotify("审核完成,共 " + importItems.Count + " 条,请确认后提交导入!", MessageBoxIcon.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ImportItems = new List<UnitWorkNDEImportItem>();
|
||||
BindGrid();
|
||||
ShowNotify("读取导入文件失败:" + ex.Message, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.HJGL_NDTBatchMenuId, Const.BtnSave))
|
||||
{
|
||||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
List<UnitWorkNDEImportItem> importItems = ImportItems;
|
||||
if (importItems.Count == 0)
|
||||
{
|
||||
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Batch_NDEImportService.Import(CurrUser.LoginProjectId, UnitWorkId, CurrUser.PersonId, importItems);
|
||||
Session.Remove(ImportCacheKey);
|
||||
ShowNotify("成功导入 " + importItems.Count + " 条检测结果!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify("导入失败:" + ex.Message, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
private List<UnitWorkNDEImportItem> ParseImportItems(DataTable table, out List<string> errors)
|
||||
{
|
||||
errors = new List<string>();
|
||||
List<UnitWorkNDEImportItem> result = new List<UnitWorkNDEImportItem>();
|
||||
if (table == null || table.Rows.Count == 0)
|
||||
{
|
||||
errors.Add("导入数据为空!");
|
||||
return result;
|
||||
}
|
||||
|
||||
List<string> missingColumns = TemplateColumns.Where(x => !table.Columns.Contains(x)).ToList();
|
||||
if (missingColumns.Count > 0)
|
||||
{
|
||||
errors.Add("导入 Excel 格式错误,缺少列:" + string.Join("、", missingColumns));
|
||||
return result;
|
||||
}
|
||||
|
||||
List<View_Batch_BatchTrustItem> trustItems = GetUnitWorkTrustItems();
|
||||
Dictionary<string, View_Batch_BatchTrust> trustMap = Funs.DB.View_Batch_BatchTrust
|
||||
.Where(x => x.ProjectId == CurrUser.LoginProjectId && x.UnitWorkId == UnitWorkId)
|
||||
.ToList()
|
||||
.Where(IsCurrentNDTType)
|
||||
.GroupBy(x => Normalize(x.TrustBatchCode))
|
||||
.ToDictionary(x => x.Key, x => x.First());
|
||||
HashSet<string> importedTrustBatchIds = new HashSet<string>(Funs.DB.HJGL_Batch_NDE
|
||||
.Where(x => x.ProjectId == CurrUser.LoginProjectId && x.UnitWorkId == UnitWorkId)
|
||||
.Select(x => x.TrustBatchId)
|
||||
.ToList());
|
||||
Dictionary<string, Base_Defect> defectMap = Funs.DB.Base_Defect
|
||||
.ToList()
|
||||
.GroupBy(x => Normalize(x.DefectName))
|
||||
.ToDictionary(x => x.Key, x => x.First());
|
||||
HashSet<string> rowKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
for (int index = 0; index < table.Rows.Count; index++)
|
||||
{
|
||||
DataRow row = table.Rows[index];
|
||||
int excelRowNumber = index + 2;
|
||||
string trustBatchCode = GetCellValue(row, "委托编号");
|
||||
string pipelineCode = GetCellValue(row, "管线号");
|
||||
string weldJointCode = GetCellValue(row, "检件焊口号");
|
||||
string totalFilmText = GetCellValue(row, "检测总数");
|
||||
string passFilmText = GetCellValue(row, "合格数");
|
||||
string filmDateText = GetCellValue(row, "检测日期");
|
||||
string reportDateText = GetCellValue(row, "报告日期");
|
||||
|
||||
if (string.IsNullOrEmpty(trustBatchCode)
|
||||
&& string.IsNullOrEmpty(pipelineCode)
|
||||
&& string.IsNullOrEmpty(weldJointCode)
|
||||
&& string.IsNullOrEmpty(totalFilmText)
|
||||
&& string.IsNullOrEmpty(passFilmText)
|
||||
&& string.IsNullOrEmpty(filmDateText)
|
||||
&& string.IsNullOrEmpty(reportDateText))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int errorCount = errors.Count;
|
||||
int sequence = index + 1;
|
||||
string sequenceText = GetCellValue(row, "序号");
|
||||
if (!string.IsNullOrEmpty(sequenceText)
|
||||
&& (!int.TryParse(sequenceText, out sequence) || sequence <= 0))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:序号必须为大于 0 的整数");
|
||||
}
|
||||
|
||||
View_Batch_BatchTrust trust = null;
|
||||
if (string.IsNullOrEmpty(trustBatchCode) || !trustMap.TryGetValue(Normalize(trustBatchCode), out trust))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:委托编号[" + trustBatchCode + "]不属于当前单位工程");
|
||||
}
|
||||
else if (importedTrustBatchIds.Contains(trust.TrustBatchId))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:委托编号[" + trustBatchCode + "]已存在检测结果,不能重复导入");
|
||||
}
|
||||
|
||||
View_Batch_BatchTrustItem trustItem = null;
|
||||
if (trust != null)
|
||||
{
|
||||
trustItem = trustItems.FirstOrDefault(x =>
|
||||
x.TrustBatchId == trust.TrustBatchId
|
||||
&& Normalize(x.PipelineCode) == Normalize(pipelineCode)
|
||||
&& Normalize(x.WeldJointCode) == Normalize(weldJointCode));
|
||||
if (trustItem == null)
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:管线[" + pipelineCode + "]焊口[" + weldJointCode + "]不存在于该委托单");
|
||||
}
|
||||
}
|
||||
|
||||
string welderCode = GetCellValue(row, "焊工号");
|
||||
if (trustItem != null && !string.IsNullOrEmpty(welderCode)
|
||||
&& Normalize(trustItem.WelderCode) != Normalize(welderCode))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:焊工号[" + welderCode + "]与委托明细不一致");
|
||||
}
|
||||
|
||||
int totalFilm;
|
||||
if (!int.TryParse(totalFilmText, out totalFilm) || totalFilm <= 0)
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:检测总数必须为大于 0 的整数");
|
||||
}
|
||||
|
||||
int passFilm;
|
||||
if (!int.TryParse(passFilmText, out passFilm) || passFilm < 0)
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:合格数必须为不小于 0 的整数");
|
||||
}
|
||||
else if (totalFilm > 0 && passFilm > totalFilm)
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:合格数不能大于检测总数");
|
||||
}
|
||||
|
||||
string checkResultText = GetCellValue(row, "是否合格");
|
||||
string checkResult = ConvertCheckResult(checkResultText);
|
||||
if (string.IsNullOrEmpty(checkResult))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:是否合格只能填写“合格”或“不合格”");
|
||||
}
|
||||
|
||||
string judgeGrade = ConvertJudgeGrade(GetCellValue(row, "评定级别"));
|
||||
if (judgeGrade == null)
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:评定级别只能填写Ⅰ、Ⅱ、Ⅲ、Ⅳ、Ⅴ或1-5");
|
||||
}
|
||||
|
||||
string defectText = GetCellValue(row, "缺陷");
|
||||
List<string> defectIds = new List<string>();
|
||||
if (!string.IsNullOrEmpty(defectText))
|
||||
{
|
||||
foreach (string defectName in SplitDefects(defectText))
|
||||
{
|
||||
Base_Defect defect;
|
||||
if (!defectMap.TryGetValue(Normalize(defectName), out defect))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:缺陷[" + defectName + "]不存在");
|
||||
}
|
||||
else
|
||||
{
|
||||
defectIds.Add(Convert.ToString(defect.DefectId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string rowKey = Normalize(trustBatchCode) + "|" + Normalize(pipelineCode) + "|" + Normalize(weldJointCode);
|
||||
if (!rowKeys.Add(rowKey))
|
||||
{
|
||||
errors.Add("第" + excelRowNumber + "行:同一委托、管线和焊口在文件中重复");
|
||||
}
|
||||
|
||||
// 两个日期均为非必填列;兼容 Excel 日期单元格、序列值和常见日期文本。
|
||||
DateTime? filmDate = ParseOptionalDate(row, "检测日期", excelRowNumber, errors);
|
||||
DateTime? reportDate = ParseOptionalDate(row, "报告日期", excelRowNumber, errors);
|
||||
|
||||
if (errors.Count == errorCount && trust != null && trustItem != null)
|
||||
{
|
||||
result.Add(new UnitWorkNDEImportItem
|
||||
{
|
||||
RowNumber = sequence,
|
||||
TrustBatchId = trust.TrustBatchId,
|
||||
TrustBatchCode = trust.TrustBatchCode,
|
||||
TrustBatchItemId = trustItem.TrustBatchItemId,
|
||||
PipelineCode = trustItem.PipelineCode,
|
||||
WeldJointCode = trustItem.WeldJointCode,
|
||||
WelderCode = trustItem.WelderCode,
|
||||
TotalFilm = totalFilm,
|
||||
PassFilm = passFilm,
|
||||
CheckResult = checkResult,
|
||||
CheckResultText = checkResultText == "是" ? "合格" : checkResultText == "否" ? "不合格" : checkResultText,
|
||||
JudgeGrade = judgeGrade,
|
||||
CheckDefects = string.Join(",", defectIds.Distinct()),
|
||||
CheckDefectsText = defectText,
|
||||
RepairLocation = GetCellValue(row, "返修位置"),
|
||||
Remark = GetCellValue(row, "备注"),
|
||||
FilmDate = filmDate,
|
||||
ReportDate = reportDate
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (result.Count == 0 && errors.Count == 0)
|
||||
{
|
||||
errors.Add("导入数据为空!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<View_Batch_BatchTrustItem> GetUnitWorkTrustItems()
|
||||
{
|
||||
return Funs.DB.View_Batch_BatchTrustItem
|
||||
.Where(x => x.ProjectId == CurrUser.LoginProjectId && x.UnitWorkId == UnitWorkId && x.PipelineCode !=null)
|
||||
.ToList()
|
||||
.Where(IsCurrentNDTType)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private bool IsCurrentNDTType(View_Batch_BatchTrustItem item)
|
||||
{
|
||||
return NDTType == "R" ? item.TrustType == "R" : string.IsNullOrEmpty(item.TrustType);
|
||||
}
|
||||
|
||||
private bool IsCurrentNDTType(View_Batch_BatchTrust item)
|
||||
{
|
||||
return NDTType == "R" ? item.TrustType == "R" : string.IsNullOrEmpty(item.TrustType);
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
List<UnitWorkNDEImportItem> items = ImportItems;
|
||||
Grid1.RecordCount = items.Count;
|
||||
Grid1.DataSource = items.Skip(Grid1.PageIndex * Grid1.PageSize).Take(Grid1.PageSize).ToList();
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
private void ShowErrors(IEnumerable<string> errors)
|
||||
{
|
||||
Alert alert = new Alert
|
||||
{
|
||||
Message = string.Join("<br/>", errors.Distinct().Select(HttpUtility.HtmlEncode)),
|
||||
Target = Target.Self
|
||||
};
|
||||
alert.Show();
|
||||
}
|
||||
|
||||
private static string GetCellValue(DataRow row, string columnName)
|
||||
{
|
||||
return Convert.ToString(row[columnName]).Replace("\n", "").Replace("\t", "").Replace("\r", "").Trim();
|
||||
}
|
||||
|
||||
private static DateTime? ParseOptionalDate(DataRow row, string columnName, int excelRowNumber, ICollection<string> errors)
|
||||
{
|
||||
object rawValue = row[columnName];
|
||||
string value = Convert.ToString(rawValue).Trim();
|
||||
if (rawValue == null || rawValue == DBNull.Value || string.IsNullOrEmpty(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (rawValue is DateTime)
|
||||
{
|
||||
return ((DateTime)rawValue).Date;
|
||||
}
|
||||
|
||||
double oaDate;
|
||||
if (double.TryParse(value, out oaDate))
|
||||
{
|
||||
try
|
||||
{
|
||||
return DateTime.FromOADate(oaDate).Date;
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// 无效序列值继续按日期文本处理,最终给出统一提示。
|
||||
}
|
||||
}
|
||||
|
||||
DateTime date;
|
||||
if (DateTime.TryParse(value, out date))
|
||||
{
|
||||
return date.Date;
|
||||
}
|
||||
|
||||
errors.Add("第" + excelRowNumber + "行:" + columnName + "格式错误,应填写有效日期");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string Normalize(string value)
|
||||
{
|
||||
return (value ?? string.Empty).Replace(" ", string.Empty).Trim().ToUpperInvariant();
|
||||
}
|
||||
|
||||
private static string ConvertCheckResult(string value)
|
||||
{
|
||||
if (value == "合格" || value == "是")
|
||||
{
|
||||
return "1";
|
||||
}
|
||||
if (value == "不合格" || value == "否")
|
||||
{
|
||||
return "2";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string ConvertJudgeGrade(string value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case "": return string.Empty;
|
||||
case "Ⅰ":
|
||||
case "1": return "Ⅰ";
|
||||
case "Ⅱ":
|
||||
case "2": return "Ⅱ";
|
||||
case "Ⅲ":
|
||||
case "3": return "Ⅲ";
|
||||
case "Ⅳ":
|
||||
case "4": return "Ⅳ";
|
||||
case "Ⅴ":
|
||||
case "5": return "Ⅴ";
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<string> SplitDefects(string value)
|
||||
{
|
||||
return value.Split(new[] { ',', ',', '、', ';', ';' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => x.Trim())
|
||||
.Where(x => !string.IsNullOrEmpty(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.HJGL.NDT
|
||||
{
|
||||
public partial class NDTBatchUnitImport
|
||||
{
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
protected global::FineUIPro.Label lblUnitWork;
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,11 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar runat="server">
|
||||
<Items>
|
||||
<f:DropDownList ID="ddlCheckCode" runat="server" Label="检测编号" Width="300px"
|
||||
LabelWidth="80px" EnableEdit="true" AutoSelectFirstItem="false"
|
||||
EmptyText="请选择检测编号">
|
||||
<f:ListItem Text="全部" Value="" />
|
||||
</f:DropDownList>
|
||||
<f:TextBox ID="txtPipelineCode" runat="server" Label="管线号" Width="250px"
|
||||
LabelWidth="70px" />
|
||||
<f:TextBox ID="txtWeldJointCode" runat="server" Label="焊口号" Width="220px"
|
||||
@@ -41,6 +46,8 @@
|
||||
<f:Button ID="btnQuery" runat="server" Text="查询" Icon="SystemSearch"
|
||||
OnClick="btnQuery_Click" />
|
||||
<f:ToolbarFill runat="server" />
|
||||
<f:Button ID="btnPrint" runat="server" Text="打印" Icon="Printer"
|
||||
OnClick="btnPrint_Click" />
|
||||
<f:Button ID="btnNew" runat="server" Text="新增" Icon="Add"
|
||||
OnClick="btnNew_Click" />
|
||||
<f:Button ID="btnEdit" runat="server" Text="修改" Icon="Pencil"
|
||||
@@ -52,6 +59,7 @@
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RowNumberField Width="60px" HeaderText="序号" TextAlign="Center" />
|
||||
<f:RenderField Width="210px" DataField="CheckCode" HeaderText="检测编号" />
|
||||
<f:RenderField Width="220px" DataField="PipelineCode" HeaderText="管线号" />
|
||||
<f:RenderField Width="130px" DataField="WeldJointCode" HeaderText="焊口号" />
|
||||
<f:RenderField Width="100px" DataField="QualifiedText" HeaderText="外观是否合格"
|
||||
@@ -81,6 +89,9 @@
|
||||
<f:Window ID="Window1" Title="焊缝外观检测" Hidden="true" EnableIFrame="true"
|
||||
EnableMaximize="true" Target="Top" runat="server" OnClose="Window1_Close" IsModal="true"
|
||||
Width="760px" Height="560px" />
|
||||
<f:Window ID="Window2" Title="打印预览" Hidden="true" EnableIFrame="true"
|
||||
EnableMaximize="true" Target="Top" EnableResize="false" runat="server"
|
||||
IsModal="true" Width="1100px" Height="700px" />
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var gridImageSelector = '#<%= Grid1.ClientID %> img.img';
|
||||
@@ -107,6 +118,7 @@
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
@@ -8,18 +11,37 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack) BindGrid();
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BindCheckCodes();
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
private void BindCheckCodes()
|
||||
{
|
||||
foreach (string checkCode in WeldAppearanceCheckService.GetCheckCodes(CurrUser.LoginProjectId))
|
||||
{
|
||||
ddlCheckCode.Items.Add(new FineUIPro.ListItem(checkCode, checkCode));
|
||||
}
|
||||
}
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
var result = WeldAppearanceCheckService.GetList(CurrUser.LoginProjectId, txtPipelineCode.Text.Trim(),
|
||||
txtWeldJointCode.Text.Trim(), ddlQualified.SelectedValue, Grid1.PageIndex, Grid1.PageSize);
|
||||
var result = GetCurrentPageData();
|
||||
Grid1.RecordCount = result.Item2;
|
||||
Grid1.DataSource = result.Item1;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
private Tuple<List<Model.WeldAppearanceCheckItem>, int> GetCurrentPageData()
|
||||
{
|
||||
return WeldAppearanceCheckService.GetList(CurrUser.LoginProjectId,
|
||||
(ddlCheckCode.SelectedValue ?? string.Empty).Trim(),
|
||||
txtPipelineCode.Text.Trim(), txtWeldJointCode.Text.Trim(), ddlQualified.SelectedValue,
|
||||
Grid1.PageIndex, Grid1.PageSize);
|
||||
}
|
||||
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) { Grid1.PageIndex = e.NewPageIndex; BindGrid(); }
|
||||
protected void btnQuery_Click(object sender, EventArgs e) { Grid1.PageIndex = 0; BindGrid(); }
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e) { BindGrid(); }
|
||||
@@ -61,6 +83,100 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
string checkCode = (ddlCheckCode.SelectedValue ?? string.Empty).Trim();
|
||||
if (string.IsNullOrEmpty(checkCode))
|
||||
{
|
||||
Alert.ShowInTop("请选择检测编号!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!HasPower(Const.BtnPrint))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var printResult = WeldAppearanceCheckService.GetList(CurrUser.LoginProjectId, checkCode,
|
||||
txtPipelineCode.Text.Trim(), txtWeldJointCode.Text.Trim(), ddlQualified.SelectedValue,
|
||||
0, int.MaxValue);
|
||||
List<Model.WeldAppearanceCheckItem> printItems = printResult.Item1;
|
||||
if (printItems.Count == 0)
|
||||
{
|
||||
Alert.ShowInTop("当前筛选条件没有可打印的焊口记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
DataTable reportData = CreateReportData(printItems);
|
||||
var parameters = new Dictionary<string, string>
|
||||
{
|
||||
{ "ProjectName", ProjectService.GetProjectNameByProjectId(CurrUser.LoginProjectId) },
|
||||
{ "CheckCode", checkCode },
|
||||
{ "NDTMethod", "RT" },
|
||||
// 报检数量使用本次实际打印的焊口总数,不包含版式补齐的空行。
|
||||
{ "InspectionCount", printItems.Count.ToString() },
|
||||
{ "DetectionRate", string.Empty }
|
||||
};
|
||||
|
||||
FastReportService.ResetData();
|
||||
FastReportService.AddFastreportTable(reportData);
|
||||
FastReportService.AddFastreportParameter(parameters);
|
||||
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.WeldAppearanceCheckReportTemplateUrl;
|
||||
if (File.Exists(rootPath + initTemplatePath))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(string.Format(
|
||||
"~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("打印模板不存在!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private static DataTable CreateReportData(List<Model.WeldAppearanceCheckItem> items)
|
||||
{
|
||||
var table = new DataTable("Data");
|
||||
table.Columns.Add("RowNumber", typeof(int));
|
||||
table.Columns.Add("PipelineCode", typeof(string));
|
||||
table.Columns.Add("WeldJointCode", typeof(string));
|
||||
table.Columns.Add("WelderCode", typeof(string));
|
||||
table.Columns.Add("Specification", typeof(string));
|
||||
table.Columns.Add("MaterialCode", typeof(string));
|
||||
table.Columns.Add("WeldingLocation", typeof(string));
|
||||
table.Columns.Add("WeldingMethodCode", typeof(string));
|
||||
table.Columns.Add("WeldingMaterial", typeof(string));
|
||||
table.Columns.Add("ItemCode", typeof(string));
|
||||
table.Columns.Add("BatchCode", typeof(string));
|
||||
table.Columns.Add("Remark", typeof(string));
|
||||
|
||||
const int regularPageRowCount = 14;
|
||||
const int lastPageRowCount = 12;
|
||||
int reportRowCount = items.Count <= lastPageRowCount
|
||||
? lastPageRowCount
|
||||
: lastPageRowCount + (int)Math.Ceiling((items.Count - lastPageRowCount)
|
||||
/ (decimal)regularPageRowCount) * regularPageRowCount;
|
||||
for (int i = 0; i < reportRowCount; i++)
|
||||
{
|
||||
if (i < items.Count)
|
||||
{
|
||||
Model.WeldAppearanceCheckItem item = items[i];
|
||||
// 明细字段严格对应检查表模板;物料代码和炉批号当前业务无来源,保持空白待签填。
|
||||
table.Rows.Add(i + 1, item.PipelineCode, item.WeldJointCode, item.WelderCode,
|
||||
item.Specification, item.MaterialCode, item.WeldingLocation, item.WeldingMethodCode,
|
||||
item.WeldingMaterial, string.Empty, string.Empty, item.Remark);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 普通页显示14行、末页显示12行,不足部分补空行,使签字区紧跟末页数据区。
|
||||
table.Rows.Add(i + 1, string.Empty, string.Empty, string.Empty, string.Empty,
|
||||
string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
|
||||
string.Empty, string.Empty);
|
||||
}
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
private void OpenSelectedRecord()
|
||||
{
|
||||
if (!EnsureSelected() || !HasPower(Const.BtnModify)) return;
|
||||
|
||||
@@ -50,6 +50,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// ddlCheckCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlCheckCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtPipelineCode 控件。
|
||||
/// </summary>
|
||||
@@ -86,6 +95,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnQuery;
|
||||
|
||||
/// <summary>
|
||||
/// btnPrint 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnPrint;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
@@ -130,5 +148,14 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,16 @@ namespace Model
|
||||
public string WeldJointId { get; set; }
|
||||
public string PipelineCode { get; set; }
|
||||
public string WeldJointCode { get; set; }
|
||||
public string UnitWorkId { get; set; }
|
||||
public string UnitWorkName { get; set; }
|
||||
public string WelderCode { get; set; }
|
||||
public string Specification { get; set; }
|
||||
public string MaterialCode { get; set; }
|
||||
public string WeldingLocation { get; set; }
|
||||
public string WeldingMethodCode { get; set; }
|
||||
public string WeldingRodCode { get; set; }
|
||||
public string WeldingWireCode { get; set; }
|
||||
public string WeldingMaterial { get; set; }
|
||||
public bool IsQualified { get; set; }
|
||||
public string QualifiedText { get; set; }
|
||||
public string CheckPerson { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user