This commit is contained in:
李鹏飞 2024-10-22 21:13:56 +08:00
parent cb13fe481d
commit e680580417
25 changed files with 2099 additions and 312 deletions

Binary file not shown.

View File

@ -51,10 +51,6 @@
"$type": "Bookmark",
"Name": "ST:3:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"

Binary file not shown.

View File

@ -222,6 +222,10 @@ namespace BLL
/// 试压包导入模版文件原始的虚拟路径
/// </summary>
public const string HJGL_TestTemplateUrl = "File\\Excel\\试压包导入模版.xlsx";
/// <summary>
/// PMI委托导入模版
/// </summary>
public const string HJGL_PMITemplateUrl = "File\\Excel\\PMI委托导入模版.xlsx";
/// <summary>
/// PDMS导入模版文件原始的虚拟路径

View File

@ -2391,6 +2391,15 @@ namespace Resources {
}
}
/// <summary>
/// 查找类似 导入 的本地化字符串。
/// </summary>
internal static string Import {
get {
return ResourceManager.GetString("Import", resourceCulture);
}
}
/// <summary>
/// 查找类似 寸径 的本地化字符串。
/// </summary>

View File

@ -2769,4 +2769,8 @@
<value>Home Page</value>
<comment>首页</comment>
</data>
<data name="Import" xml:space="preserve">
<value>Import</value>
<comment>导入</comment>
</data>
</root>

View File

@ -2139,4 +2139,7 @@
<data name="RepairExpansionTrackingList" xml:space="preserve">
<value>返修扩探追踪清单</value>
</data>
<data name="Import" xml:space="preserve">
<value>导入</value>
</data>
</root>

View File

@ -2106,4 +2106,7 @@
<data name="HomePage" xml:space="preserve">
<value>首页</value>
</data>
<data name="Import" xml:space="preserve">
<value>导入</value>
</data>
</root>

View File

@ -1279,6 +1279,7 @@
<Content Include="WeldingProcess\CheckManage\SeeFilm.aspx" />
<Content Include="WeldingProcess\DataIn\DataIn.aspx" />
<Content Include="WeldingProcess\DataIn\DataInEdit.aspx" />
<Content Include="WeldingProcess\PMI\ImportError.aspx" />
<Content Include="WeldingProcess\PMI\PMIDelegation.aspx" />
<Content Include="WeldingProcess\PMI\PMIDelegationEdit.aspx" />
<Content Include="WeldingProcess\PMI\PMIDelegationReport.aspx" />
@ -5483,6 +5484,13 @@
<Compile Include="WeldingProcess\DataIn\DataInEdit.aspx.designer.cs">
<DependentUpon>DataInEdit.aspx</DependentUpon>
</Compile>
<Compile Include="WeldingProcess\PMI\ImportError.aspx.cs">
<DependentUpon>ImportError.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="WeldingProcess\PMI\ImportError.aspx.designer.cs">
<DependentUpon>ImportError.aspx</DependentUpon>
</Compile>
<Compile Include="WeldingProcess\PMI\PMIDelegation.aspx.cs">
<DependentUpon>PMIDelegation.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>

View File

@ -297,6 +297,10 @@
{
var wpsList = from x in Funs.DB.WPQ_WPQList where x.ProjectId == ((Model.Sys_User)Session["CurrUser"]).LoginProjectId select x;
var welderList = from x in Funs.DB.Welder_ProjectWelder where x.ProjectId == ((Model.Sys_User)Session["CurrUser"]).LoginProjectId select x;
if (wpsList==null)
{
return;
}
foreach (var wps in
wpsList)
{

View File

@ -33,7 +33,7 @@ namespace FineUIPro.Web.WeldingProcess.CheckManage
if (!string.IsNullOrEmpty(repairRecordId))
{
this.txtPipeCode.Text = jot.PipelineCode;
txtWeldJointCode.Text = jot.WeldJointCode;
txtWeldJointCode.Text = jot.WeldJointCode+repairRecord.RepairMark;
txtWelder.Text = jot.BackingWelderCode;
txtRepairLocation.Text = repairRecord.RepairLocation;
txtJudgeGrade.Text = ndeItem.JudgeGrade;
@ -657,11 +657,11 @@ namespace FineUIPro.Web.WeldingProcess.CheckManage
//}
db.Repair_RepairRecord.DeleteOnSubmit(repair);
db.SubmitChanges();
if (joint.WeldJointCode.Contains("P") || joint.WeldJointCode.Contains("S") || joint.WeldJointCode.Contains("R"))
{
Pipeline_WeldJointService.DeleteWeldJointById(joint.WeldJointId);
//if (joint.WeldJointCode.Contains("P") || joint.WeldJointCode.Contains("S") || joint.WeldJointCode.Contains("R"))
//{
// Pipeline_WeldJointService.DeleteWeldJointById(joint.WeldJointId);
}
//}
this.InitTreeMenu();//加载树
Alert.ShowInTop("删除成功!", MessageBoxIcon.Success);
}

View File

@ -212,61 +212,61 @@ namespace FineUIPro.Web.WeldingProcess.CheckManage
// 回写焊口号
var weldJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(q.WeldJointId);
//joint.WeldJointCode = newJointCode;
//joint.OldWeldJointCode = q.WeldJointCode;
//Funs.DB.SubmitChanges();
Model.Pipeline_WeldJoint newWeldJoint = new Model.Pipeline_WeldJoint
{
WeldJointId = SQLHelper.GetNewID(typeof(Model.Pipeline_WeldJoint)),
ProjectId = weldJoint.ProjectId,
PipelineId = weldJoint.PipelineId,
WeldJointCode = newJointCode,
WeldTypeId = weldJoint.WeldTypeId,
Material1Id = weldJoint.Material1Id,
Material2Id = weldJoint.Material2Id,
Thickness = weldJoint.Thickness,
Dia = weldJoint.Dia,
Size = weldJoint.Size,
JointAttribute = weldJoint.JointAttribute,
JointArea = weldJoint.JointArea,
WeldingMethodId = weldJoint.WeldingMethodId,
IsHotProess = weldJoint.IsHotProess,
WeldingLocationId = weldJoint.WeldingLocationId,
WeldMatId = weldJoint.WeldMatId,
WeldSilkId = weldJoint.WeldSilkId,
GrooveTypeId = weldJoint.GrooveTypeId,
PipeSegment = weldJoint.PipeSegment,
PipeAssembly1Id = weldJoint.PipeAssembly1Id,
PipeAssembly2Id = weldJoint.PipeAssembly2Id,
PipeAssemblyCount = weldJoint.PipeAssemblyCount,
HeartNo1 = weldJoint.HeartNo1,
HeartNo2 = weldJoint.HeartNo2,
LastTemp = weldJoint.LastTemp,
CellTemp = weldJoint.CellTemp,
PrepareTemp = weldJoint.PrepareTemp,
Electricity = weldJoint.Electricity,
Voltage = weldJoint.Voltage,
TestPackageNo = weldJoint.TestPackageNo,
WeldingDailyCode = weldJoint.WeldingDailyCode,
BackingWelderId = weldJoint.BackingWelderId,
CoverWelderId = weldJoint.CoverWelderId,
WeldingDailyId = weldJoint.WeldingDailyId,
PipingClassId = weldJoint.PipingClassId,
Specification = weldJoint.Specification,
DoneDin = weldJoint.DoneDin,
SystemNumber = weldJoint.SystemNumber,
Remark = weldJoint.Remark,
IsGoldJoint = weldJoint.IsGoldJoint,
IsPMI = weldJoint.IsPMI,
WPQId = weldJoint.WPQId,
DetectionType = weldJoint.DetectionType,
PageNum = weldJoint.PageNum,
ANSISCH = weldJoint.ANSISCH,
OldWeldJointCode = weldJoint.OldWeldJointCode,
/*var joint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(q.WeldJointId);
joint.WeldJointCode = newJointCode;
joint.OldWeldJointCode = q.WeldJointCode;
Funs.DB.SubmitChanges();*/
// Model.Pipeline_WeldJoint newWeldJoint = new Model.Pipeline_WeldJoint
// {
// WeldJointId = SQLHelper.GetNewID(typeof(Model.Pipeline_WeldJoint)),
// ProjectId = weldJoint.ProjectId,
// PipelineId = weldJoint.PipelineId,
// WeldJointCode = newJointCode,
// WeldTypeId = weldJoint.WeldTypeId,
// Material1Id = weldJoint.Material1Id,
// Material2Id = weldJoint.Material2Id,
// Thickness = weldJoint.Thickness,
// Dia = weldJoint.Dia,
// Size = weldJoint.Size,
// JointAttribute = weldJoint.JointAttribute,
// JointArea = weldJoint.JointArea,
// WeldingMethodId = weldJoint.WeldingMethodId,
// IsHotProess = weldJoint.IsHotProess,
// WeldingLocationId = weldJoint.WeldingLocationId,
// WeldMatId = weldJoint.WeldMatId,
// WeldSilkId = weldJoint.WeldSilkId,
// GrooveTypeId = weldJoint.GrooveTypeId,
// PipeSegment = weldJoint.PipeSegment,
// PipeAssembly1Id = weldJoint.PipeAssembly1Id,
// PipeAssembly2Id = weldJoint.PipeAssembly2Id,
// PipeAssemblyCount = weldJoint.PipeAssemblyCount,
// HeartNo1 = weldJoint.HeartNo1,
// HeartNo2 = weldJoint.HeartNo2,
// LastTemp = weldJoint.LastTemp,
// CellTemp = weldJoint.CellTemp,
// PrepareTemp = weldJoint.PrepareTemp,
// Electricity = weldJoint.Electricity,
// Voltage = weldJoint.Voltage,
// TestPackageNo = weldJoint.TestPackageNo,
// WeldingDailyCode = weldJoint.WeldingDailyCode,
// BackingWelderId = weldJoint.BackingWelderId,
// CoverWelderId = weldJoint.CoverWelderId,
// WeldingDailyId = weldJoint.WeldingDailyId,
// PipingClassId = weldJoint.PipingClassId,
// Specification = weldJoint.Specification,
// DoneDin = weldJoint.DoneDin,
// SystemNumber = weldJoint.SystemNumber,
// Remark = weldJoint.Remark,
// IsGoldJoint = weldJoint.IsGoldJoint,
// IsPMI = weldJoint.IsPMI,
// WPQId = weldJoint.WPQId,
// DetectionType = weldJoint.DetectionType,
// PageNum = weldJoint.PageNum,
// ANSISCH = weldJoint.ANSISCH,
// OldWeldJointCode = weldJoint.OldWeldJointCode,
};
string WeldJointId= BLL.Pipeline_WeldJointService.AddWeldJointRef(newWeldJoint);
// };
//string WeldJointId= BLL.Pipeline_WeldJointService.AddWeldJointRef(newWeldJoint);
newItem.ProjectId = q.ProjectId;
newItem.UnitId = q.UnitId;
@ -274,7 +274,7 @@ namespace FineUIPro.Web.WeldingProcess.CheckManage
newItem.WorkAreaId = q.WorkAreaId;
newItem.NoticeDate = DateTime.Now;
newItem.NDEItemID = ndeItemId;
newItem.WeldJointId = WeldJointId;
newItem.WeldJointId = q.WeldJointId;
newItem.DetectionTypeId = q.DetectionTypeId;
newItem.WelderId = q.BackingWelderId;
newItem.RepairLocation = q.RepairLocation;

View File

@ -0,0 +1,36 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ImportError.aspx.cs" Inherits="FineUIPro.Web.WeldingProcess.PMI.ImportError" %>
<!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>PMI导入错误日志</title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Grid1" runat="server" />
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="试压包导入错误日志" runat="server" EnableCollapse="false"
DataKeyNames="ID" EnableCheckBoxSelect="true" EnableMultiSelect="true" PageSize="100" AllowPaging="true">
<Columns>
<f:RowNumberField />
<f:RenderField ColumnID="batchNo" Width="160px" DataField="BatchNo" HeaderText="批次号" />
<f:RenderField ColumnID="TestPackageNo" MinWidth="80" DataField="TestPackageNo" HeaderText="委托编号" />
<f:RenderField ColumnID="UnitCode" MinWidth="80" DataField="UnitCode" HeaderText="单位代码" />
<f:RenderField ColumnID="InstallCode" MinWidth="80" DataField="InstallCode" HeaderText="装置编号" />
<f:RenderField ColumnID="AreaCode" MinWidth="80" DataField="AreaCode" HeaderText="区域" />
<f:RenderField ColumnID="PiplineCode" MinWidth="160" DataField="PiplineCode" HeaderText="管线号" />
<f:RenderField ColumnID="JointCode" MinWidth="200" DataField="JointCode" HeaderText="焊口编号" />
<f:TemplateField MinWidth="200" HeaderText="错误原因">
<ItemTemplate>
<asp:Label ID="lablRemark" runat="server" Text='<%#Eval("Remark") %>' ForeColor="Red"></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField ColumnID="CreatedTime" MinWidth="150" DataField="CreatedTime" HeaderText="导入时间" />
</Columns>
</f:Grid>
</form>
</body>
</html>

View File

@ -0,0 +1,29 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.WeldingProcess.PMI
{
public partial class ImportError : PageBase
{
string batchNo = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
this.batchNo = Request.Params["batchNo"];
if (!IsPostBack)
{
BindGrid();
}
}
void BindGrid()
{
var list = Funs.DB.PMI_ImportErrorLog.Where(t => t.BatchNo == batchNo).OrderBy(t => t.RowId).ToList();
this.Grid1.DataSource = list;
this.Grid1.DataBind();
}
}
}

View File

@ -0,0 +1,53 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.WeldingProcess.PMI
{
public partial class ImportError
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// lablRemark 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lablRemark;
}
}

View File

@ -38,8 +38,17 @@
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:HiddenField ID="hidFileName" runat="server"></f:HiddenField>
<f:HiddenField runat="server" ID="hdPMIDelegationId">
</f:HiddenField>
<f:FileUpload runat="server" ID="fileUpload" EmptyText="请选择要导入的Excel文件"
LabelWidth="50px" LabelAlign="Right" Width="300px">
</f:FileUpload>
<f:Button ID="btnImport" Icon="ApplicationEdit" runat="server" Text="<%$ Resources:Lan,Import %>" ToolTip="<%$ Resources:Lan,Import %>"
AjaxLoadingType="Mask" ShowAjaxLoadingMaskText="true" AjaxLoadingMaskText="正在校验并导入数据,请稍后!" OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="模板下载" ToolTip="模板下载" OnClick="btnDownLoad_Click">
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnNew" Text="<%$ Resources:Lan,Add %>" ToolTip="<%$ Resources:Lan,Add %>"
@ -180,7 +189,10 @@
EnableMaximize="true" Target="Parent" EnableResize="true" runat="server" OnClose="Window2_Close"
IsModal="true" Width="1090px" Height="660px">
</f:Window>
<f:Window ID="Window4" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="true" runat="server" IsModal="true" Width="1024px"
Height="620px">
</f:Window>
</form>
<script type="text/javascript">

View File

@ -11,6 +11,7 @@ using NPOI.HSSF.Util;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace FineUIPro.Web.WeldingProcess.PMI
{
@ -31,6 +32,16 @@ namespace FineUIPro.Web.WeldingProcess.PMI
ViewState["PMIDelegationId"] = value;
}
}
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static string errorInfos = string.Empty;
#endregion
#region
@ -814,6 +825,399 @@ namespace FineUIPro.Web.WeldingProcess.PMI
Response.End();
}
#region
/// <summary>
/// 模板下载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.HJGL_PMITemplateUrl;
string filePath = Const.HJGL_PMITemplateUrl;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
//PageContext.RegisterStartupScript(Confirm.GetShowReference("确定要下载焊工信息导入模板?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
#endregion
protected void btnImport_Click(object sender, EventArgs e)
{
string message = string.Empty;
errorInfos = string.Empty;
try
{
if (this.fileUpload.HasFile == false)
{
ShowNotify("请选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.fileUpload.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls" && IsXls != ".xlsx")
{
ShowNotify("只能选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
//指定上传文件名称
this.hidFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
//上传文件路径
string filePath = initFullPath + this.hidFileName.Text;
//文件上传服务器
this.fileUpload.PostedFile.SaveAs(filePath);
//文件上传服务器后的名称
string fileName = rootPath + initPath + this.hidFileName.Text;
//读取Excel
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out errorInfos, true);
//验证Excel读取是否有误
if (!string.IsNullOrEmpty(errorInfos))
{
ShowNotify(errorInfos, MessageBoxIcon.Warning);
return;
}
if (ds.Tables.Count > 0)
{
//定义错误集合实体类
var data = ValidateFieldsExcelData(ds.Tables[0]);
Funs.DB.PMI_ImportErrorLog.InsertAllOnSubmit(data.Item2);
Funs.DB.SubmitChanges();
//验证错误集合
if (data.Item1)
{
string batchNo = data.Item2.Select(t => t.BatchNo).Distinct().First();
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("ImportError.aspx?batchNo={0}", batchNo), "PMI导入错误日志"));
return;
}
//导入数据
List<PMI_Delegation> listPMIData = new List<PMI_Delegation>();
List<Model.PMI_DelegationDetails> listDetailData = new List<PMI_DelegationDetails>();
foreach (var item in data.Item2)
{
if (!listPMIData.Any(t => t.DelegationNo == item.DelegationNo))
{
List<PMI_DelegationDetails> ptpItemListData = new List<PMI_DelegationDetails>();
Model.PMI_Delegation model = new PMI_Delegation();
model.Id = SQLHelper.GetNewID(typeof(PMI_Delegation));
model.DelegationNo = item.DelegationNo;
model.UnitId = item.UnitId;
model.ProjectId = item.ProjectId;
model.InstallationId = item.InstallId;
model.DetectionStandard = "GB 50184-2011";
model.DelegationDate = DateTime.Now;
model.Tabler = this.CurrUser.UserId;
listPMIData.Add(model);
var itemData = data.Item2.Where(t => t.DelegationNo == item.DelegationNo).ToList();
foreach (var item2 in itemData)
{
var model2 = new PMI_DelegationDetails();
model2.PMIId = model.Id;
model2.JointId = item2.WeldJointId;
model2.WorkAreaId = item2.WorkAreaId;
model2.Id = SQLHelper.GetNewID(typeof(PMI_DelegationDetails));
listDetailData.Add(model2);
}
}
}
Funs.DB.PMI_Delegation.InsertAllOnSubmit(listPMIData);
Funs.DB.PMI_DelegationDetails.InsertAllOnSubmit(listDetailData);
//绑定表格
Funs.DB.SubmitChanges();
this.BindGrid();
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(this.PMIDelegationId) + ActiveWindow.GetHidePostBackReference());
}
else
{
ShowAlert("没有数据!", MessageBoxIcon.Warning);
return;
}
}
catch (Exception ex)
{
ShowAlert("'" + ex.Message + "'", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 验证Excle中的数据列是否符合要求
/// </summary>
private (bool, List<PMI_ImportErrorLog>) ValidateFieldsExcelData(DataTable dt)
{
var listData = new List<PMI_ImportErrorLog>();
bool flag = false;
int k = 0;
string batchNo = DateTime.Now.ToString("yyyyMMddHHmmss");
foreach (DataRow dr in dt.Rows)
{
var model = new PMI_ImportErrorLog();
k++;
string delegationNo = dr[0].ToString(); //委托单号
string untiCode = dr[1].ToString(); //单位编号
string installCode = dr[2].ToString(); //装置编号
string areaCode = dr[3].ToString(); //区域编号
string pipelineCode = dr[4].ToString(); //管线编号
string jointCode = dr[5].ToString(); //焊口列表逗号
model.Id = SQLHelper.GetNewID(typeof(PMI_ImportErrorLog));
model.DelegationNo = delegationNo;
model.UnitCode = untiCode;
model.InstallCode = installCode;
model.AreaCode = areaCode;
model.PiplineCode = pipelineCode;
model.JointCode = jointCode;
model.CreatedTime = DateTime.Now;
model.RowId = k;
model.UnitId = string.Empty;
model.InstallId = string.Empty;
model.WorkAreaId = string.Empty;
model.ProjectId = this.CurrUser.LoginProjectId;
model.PipelineId = string.Empty;
model.BatchNo = batchNo;
string errorMsg = string.Empty;
//验证是否为空
if (string.IsNullOrEmpty(delegationNo))
{
errorMsg += "试压包编号未填写 |";
}
if (string.IsNullOrEmpty(untiCode))
{
errorMsg += "试单位编号未填写 | ";
}
if (string.IsNullOrEmpty(installCode))
{
errorMsg += "装置编号未填写 | ";
}
if (string.IsNullOrEmpty(areaCode))
{
errorMsg += "区域编号未填写 | ";
}
if (string.IsNullOrEmpty(pipelineCode))
{
errorMsg += "管线号未填写 | ";
}
if (string.IsNullOrEmpty(jointCode))
{
errorMsg += "是否全部焊口未填写 | ";
}
//检查单位编号是否存在
var unitInfo = Funs.DB.Base_Unit.FirstOrDefault(t => t.UnitCode == model.UnitCode);
if (unitInfo == null)
{
errorMsg += "未知的单位编号 | ";
}
var installInfo = Funs.DB.Project_Installation.FirstOrDefault(t => t.InstallationCode == model.InstallCode);
if (installInfo == null)
{
errorMsg += "未知的装置编号 | ";
}
var areaInfo = Funs.DB.Project_WorkArea.FirstOrDefault(t => t.WorkAreaCode == model.AreaCode);
if (areaInfo == null)
{
errorMsg += "未知的区域编号 | ";
}
var isAnypipeline = Funs.DB.Pipeline_Pipeline.Any(t => t.PipelineCode == model.PiplineCode);
if (!isAnypipeline)
{
errorMsg += "未知的管线号 | ";
}
var isDelegationNo = Funs.DB.PMI_Delegation.Any(t => t.DelegationNo == model.DelegationNo);
if (isDelegationNo)
{
errorMsg += "该委托编号已存在 | ";
}
if (unitInfo != null && installInfo != null && areaInfo != null)
{
model.UnitId = unitInfo.UnitId;
model.WorkAreaId = areaInfo.WorkAreaId;
model.InstallId = installInfo.InstallationId;
var newPipelineInfo = Funs.DB.Pipeline_Pipeline.FirstOrDefault(t => t.UnitId == unitInfo.UnitId &&
t.InstallationId == installInfo.InstallationId && t.WorkAreaId == areaInfo.WorkAreaId &&
t.PipelineCode == model.PiplineCode);
if (newPipelineInfo == null)
{
errorMsg += "当前区域下不存在此管线号 | ";
model.PipelineId = string.Empty;
}
else
{
model.PipelineId = newPipelineInfo.PipelineId;
string pipelineError = CheckPipeline(this.CurrUser.LoginProjectId, unitInfo.UnitId, installInfo.InstallationId, newPipelineInfo.PipelineId);
if (!string.IsNullOrEmpty(pipelineError))
{
errorMsg += pipelineError;
}
else
{
var newWeldJointInfo = Funs.DB.Pipeline_WeldJoint.FirstOrDefault(t => t.PipelineId == newPipelineInfo.PipelineId && t.WeldJointCode == jointCode);
if (newWeldJointInfo == null)
{
errorMsg += "当前管线下不存在此焊口 | ";
model.WeldJointId = string.Empty;
}
else
{
model.WeldJointId = newWeldJointInfo.WeldJointId;
string weldJointError = CheckWeldJoint(newPipelineInfo.PipelineId, model.WeldJointId);
if (!string.IsNullOrEmpty(weldJointError))
{
errorMsg += weldJointError;
model.WeldJointId=string.Empty;
}
}
}
}
}
model.Remark = errorMsg;
if (!string.IsNullOrEmpty(model.Remark))
flag = true;
listData.Add(model);
}
return (flag, listData);
}
public string CheckPipeline(string ProjectId, string UnitId, string installId, string PipelineId)
{
string result = "";
//查询出来未达到PMI检测比例的数据
var pmiNocheckList = Funs.DB.View_PMIDetections
.Where(t => t.ProjectId == ProjectId
&& t.InstallationId == installId
&& t.UnitId == UnitId
&& (t.RateBys <= 2 && t.PMIBySNum <= 2) || (t.RateByf <= 2 && t.PMIByFNum <= 2))
.AsQueryable();
//排除已经委托过的
var listData = (from a in Funs.DB.PMI_Delegation.AsQueryable()
join
b in Funs.DB.PMI_DelegationDetails.AsQueryable() on
a.Id equals b.PMIId
select b.JointId
).Distinct().ToList();
//查询带有PMI处理且已经焊接过的管线数据
var iso = from a in Funs.DB.View_Pipeline_WeldJoint
where a.IsPMI == true && a.ProjectId == ProjectId && a.UnitId == UnitId
&& a.InstallationId == installId && (a.WeldingDailyId != "" && a.WeldingDailyId != null)
select new { a.PipelineId, a.PipelineCode, a.WorkAreaId, a.WeldJointCode, a.WeldJointId }
;
iso = from a in iso
join b in pmiNocheckList on a.PipelineId equals b.PipelineId
select new
{
a.PipelineId,
a.PipelineCode,
a.WorkAreaId,
a.WeldJointCode,
a.WeldJointId
};
if (listData.Count > 0)
{
iso = iso.Where(a => !listData.Contains(a.WeldJointId));
}
iso = iso.Where(a => a.PipelineId.Contains(PipelineId));
var isoList = iso.Select(x => x.PipelineId).Distinct().ToList();
if (isoList.Count ==0)
{
result = "该管线无法进行PMI委托 | ";
}
return result;
}
public string CheckWeldJoint(string PipelineId,string WeldJointId)
{
string result = "";
//未达标的活动S口
var pmiViewJointBy_S = (from a in Funs.DB.View_PMIDetections
join b in Funs.DB.Pipeline_WeldJoint
on a.PipelineId equals b.PipelineId
where b.JointAttribute == "活动S"
&& a.PipelineId == PipelineId
&& (b.WeldingDailyId != null && b.WeldingDailyId != "")
&& (a.RateBys > 2 || a.PMIBySNum > 2)
select b.WeldJointId)
.ToList();
//未达标的固定F口
var pmiViewJointBy_F = (from a in Funs.DB.View_PMIDetections
join b in Funs.DB.Pipeline_WeldJoint
on a.PipelineId equals b.PipelineId
where b.JointAttribute == "固定F"
&& a.PipelineId == PipelineId
&& (b.WeldingDailyId != null && b.WeldingDailyId != "")
&& (a.RateByf > 2 && a.PMIByFNum > 2)
select b.WeldJointId)
.ToList();
//排除已经选择过的焊口
var listData = (from a in Funs.DB.PMI_Delegation.AsQueryable()
join
b in Funs.DB.PMI_DelegationDetails.AsQueryable() on
a.Id equals b.PMIId
select b.JointId
).Distinct().ToList();
var query = Funs.DB.View_Pipeline_WeldJoint.Where(t => t.IsPMI == true
&& (t.WeldingDailyId != null && t.WeldingDailyId != "")
&& t.PipelineId == PipelineId);
if (listData.Count > 0)
{
query = query.Where(t => !listData.Contains(t.WeldJointId));
}
if (pmiViewJointBy_S.Count > 0)
{
query = query.Where(t => t.JointAttribute != "活动S");
}
if (pmiViewJointBy_F.Count > 0)
{
query = query.Where(t => t.JointAttribute != "固定F");
}
query = query.Where(t => t.WeldJointId == WeldJointId);
if (query.Count() == 0)
{
result = "该焊口无法进行PMI委托 | ";
}
return result;
}
#region
/// <summary>

View File

@ -95,6 +95,15 @@ namespace FineUIPro.Web.WeldingProcess.PMI
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hidFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hidFileName;
/// <summary>
/// hdPMIDelegationId 控件。
/// </summary>
@ -104,6 +113,33 @@ namespace FineUIPro.Web.WeldingProcess.PMI
/// </remarks>
protected global::FineUIPro.HiddenField hdPMIDelegationId;
/// <summary>
/// fileUpload 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fileUpload;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
@ -301,5 +337,14 @@ namespace FineUIPro.Web.WeldingProcess.PMI
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Window4 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window4;
}
}

View File

@ -3847,13 +3847,13 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
var getInfo =BLL.Sys_UserService.GetSingtrueImageUrl(info?.Auditer);
string sql = @" SELECT
WeldSilkId,
string sql = @" WITH cte as (SELECT WeldSilkId,
a.PipelineCode,
e.WorkAreaCode,
a.WeldJointCode,
a.Specification,
a.Material1Code,
a.DetectionType,
a.WeldingMethodCode,
a.WeldingDate,
a.WeldSilkCode,
@ -3863,18 +3863,78 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
a.CoverWelderCode,
a.ProjectName,
(select top 1 EnProjectName from Base_Project where ProjectId = b.ProjectId) as EnProjectName,
(select top 1 WorkAreaName from Project_WorkArea where WorkAreaId=c.WorkAreaId) as WorkAreaName,
(select top 1 EnWorkAreaName from Project_WorkArea where WorkAreaId=c.WorkAreaId) as EnWorkAreaName,
a.IsHotProess,(case a.IsHotProess when 1 then '是' else '否' end) as IsHotProessName,PrepareTemp,
WeldingLocationCode,a.WeldTypeCode,
(SELECT TOP 1 n.NDEReportNo FROM dbo.Batch_NDEItem n WHERE n.TrustBatchItemId=
(SELECT TOP 1 bt.TrustBatchItemId FROM dbo.Batch_BatchTrustItem bt WHERE bt.WeldJointId=a.WeldJointId)) AS NDEReportNo
FROM PTP_TestPackage as b inner join
(select top 1 WorkAreaName
from Project_WorkArea
where WorkAreaId = c.WorkAreaId) as WorkAreaName,
(select top 1 EnWorkAreaName
from Project_WorkArea
where WorkAreaId = c.WorkAreaId) as EnWorkAreaName,
a.IsHotProess,
(case a.IsHotProess when 1 then '是' else '否' end) as IsHotProessName,
PrepareTemp,
WeldingLocationCode,
a.WeldTypeCode,
(SELECT TOP 1 n.NDEReportNo
FROM dbo.Batch_NDEItem n
WHERE n.TrustBatchItemId =
((select top 1 TrustBatchItemId
from Batch_BatchTrustItem
left join Batch_PointBatchItem on Batch_BatchTrustItem.PointBatchItemId =
Batch_PointBatchItem.PointBatchItemId
where Batch_BatchTrustItem.WeldJointId = a.WeldJointId
and PointState = 1))) AS NDEReportNo
FROM PTP_TestPackage as b
inner join
PTP_PipelineList as c on b.PTP_ID = c.PTP_ID
inner join View_Pipeline_WeldJoint as a on c.PipelineId = a.PipelineId
inner join Project_WorkArea as e on e.WorkAreaId = c.WorkAreaId
WHERE Is_hjName='是' and b.PTP_ID=@PTPID and a.projectId=@projectId
";
WHERE Is_hjName = '是'
and b.PTP_ID = @PTPID
and a.projectId = @projectId
union all
SELECT WeldSilkId,
a.PipelineCode,
e.WorkAreaCode,
(a.WeldJointCode + isnull(repair.RepairMark, '')) as WeldJointCode,
a.Specification,
a.Material1Code,
a.DetectionType,
a.WeldingMethodCode,
a.WeldingDate,
a.WeldSilkCode,
a.WeldSilkName,
a.WeldMatCode,
a.BackingWelderCode,
a.CoverWelderCode,
a.ProjectName,
(select top 1 EnProjectName
from Base_Project
where ProjectId = b.ProjectId) as EnProjectName,
(select top 1 WorkAreaName
from Project_WorkArea
where WorkAreaId = c.WorkAreaId) as WorkAreaName,
(select top 1 EnWorkAreaName
from Project_WorkArea
where WorkAreaId = c.WorkAreaId) as EnWorkAreaName,
a.IsHotProess,
(case a.IsHotProess when 1 then '是' else '否' end) as IsHotProessName,
PrepareTemp,
WeldingLocationCode,
a.WeldTypeCode,
(SELECT TOP 1 n.NDEReportNo
FROM dbo.Batch_NDEItem n
WHERE n.TrustBatchItemId = repair.TrustBatchItemId) AS NDEReportNo
FROM PTP_TestPackage as b
inner join PTP_PipelineList as c on b.PTP_ID = c.PTP_ID
inner join View_Pipeline_WeldJoint as a on c.PipelineId = a.PipelineId
inner join Project_WorkArea as e on e.WorkAreaId = c.WorkAreaId
inner join View_Batch_PointBatchItem repair on repair.WeldJointId = a.WeldJointId
WHERE Is_hjName = '是'
and b.PTP_ID = @PTPID
and a.projectId = @projectId
and repair.PState = 3)
select * from cte order by PipelineCode,DetectionType,WeldJointCode ";
SqlParameter[] parms = {
new SqlParameter("@PTPID", this.tvControlItem.SelectedNodeID),
@ -3935,12 +3995,13 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.AddMergedRegion(region);
ws.GetRow(rowIndex).GetCell(11).SetCellValue($"工程名称:{info?.projectName}");
ws.GetRow(rowIndex).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 9.5, true, false);
ws.GetRow(rowIndex).Height = 23 * 20;
//行1
region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 14);
ws.AddMergedRegion(region);
ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue($"Project Name:{info?.enProjectName}");
ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 9.5, true, false);
ws.GetRow(rowIndex + 1).Height = 23 * 20;
//ws.GetRow(rowIndex + 1).Height = 25 * 20;
//ws.GetRow(rowIndex + 2).Height = 25 * 20;
@ -4076,8 +4137,11 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.GetRow(dataIndex).GetCell(4).SetCellValue(string.Join("/", welderStr));
//规格mm
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["Specification"].ToString());
ws.GetRow(dataIndex).GetCell(5).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 8, true, false);
//材质
ws.GetRow(dataIndex).GetCell(6).SetCellValue(dr["Material1Code"].ToString());
ws.GetRow(dataIndex).GetCell(6).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 8, true, false);
//焊接位置
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["WeldingLocationCode"].ToString());
//焊接方法
@ -4102,6 +4166,8 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["WeldingDate"].ToString());
//无损检查报告
ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr["NDEReportNo"].ToString());
ws.GetRow(dataIndex).GetCell(14).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 8, true, false);
}
j++;
ws.GetRow(dataIndex).Height = 20 * 20;
@ -4210,128 +4276,6 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
int pageIndex =1;
foreach (var pipelineId in PipelineIdList)
{
// string sql = @"
// WITH CTE_WeldJoints AS (SELECT PipelineId, WeldJointCode, JointAttribute, WelderCode, DetectionType,WeldJointId
// FROM View_Pipeline_WeldJoint
// WHERE DetectionType LIKE '%32617d42-24cb-4390-b115-d53c9c9e2c81%')
//select *
//from (select d.PipelineCode,
// (select MaterialCode from Base_Material as m where d.MainMaterialId = m.MaterialId) as MaterialCode,
// d.Specification,
// (select count(1)
// from CTE_WeldJoints as joint
// where joint.PipelineId = a.PipelineId) as jointCount, --当前管线的焊口总数
// (case
// when a.isAll = 1 then
// (select count(1)
// from CTE_WeldJoints as joint
// where joint.PipelineId = a.PipelineId
// and joint.JointAttribute = '固定F')
// else
// (select count(1)
// from CTE_WeldJoints as joint
// where joint.PipelineId = a.PipelineId
// and joint.JointAttribute = '固定'
// and CHARINDEX(',' + joint.WeldJointCode + ',', ',' + a.WeldJonintCode + '') > 0)
// end) as FjointCount, --当前管线的焊口的固定口总数
// c.WelderCode, --焊工号
// (case
// when a.isAll = 1 then
// (select count(1)
// from CTE_WeldJoints as vjoint
// where vjoint.PipelineId = a.PipelineId
// and vjoint.WelderCode = c.WelderCode)
// else
// (select count(1)
// from CTE_WeldJoints as vjoint
// where vjoint.PipelineId = a.PipelineId
// and CHARINDEX(',' + vjoint.WeldJointCode + ',', ',' + a.WeldJonintCode + '') > 0
// and vjoint.WelderCode = c.WelderCode)
// end) as WelderNum,
// (case
// when a.isAll = 1 then
// (select count(1)
// from Batch_NDEItem as nde
// inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join CTE_WeldJoints as joint
// ON joint.WeldJointId = trust.WeldJointId
// where joint.PipelineId = a.PipelineId
// and joint.WelderCode = c.WelderCode)
// else
// (select count(1)
// from Batch_NDEItem as nde
// inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join CTE_WeldJoints as joint
// ON joint.WeldJointId = trust.WeldJointId
// where joint.PipelineId = a.PipelineId
// and CHARINDEX(',' + joint.WeldJointCode + ',', ',' + a.WeldJonintCode + '') > 0
// and joint.WelderCode = c.WelderCode)
// end
// ) as NdeNum, --检测口数量
// (case
// when a.isAll = 1 then
// (select count(1)
// from Batch_NDEItem as nde
// inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join CTE_WeldJoints as joint
// ON joint.WeldJointId = trust.WeldJointId
// where joint.PipelineId = a.PipelineId
// and joint.JointAttribute = '固定F'
// and joint.WelderCode = c.WelderCode)
// else
// (select count(1)
// from Batch_NDEItem as nde
// inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join CTE_WeldJoints as joint
// ON joint.WeldJointId = trust.WeldJointId
// where joint.PipelineId = a.PipelineId
// and CHARINDEX(',' + joint.WeldJointCode + ',', ',' + a.WeldJonintCode + '') > 0
// and joint.JointAttribute = '固定F'
// and joint.WelderCode = c.WelderCode)
// end
// ) as FNdeNum, --检测固定口数量
// (
// case
// when a.isAll = 1 then
// (stuff((select ',' + nde.NDEReportNo
// from Batch_NDEItem as nde
// inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join CTE_WeldJoints as joint
// ON joint.WeldJointId = trust.WeldJointId
// where joint.PipelineId = a.PipelineId
// and joint.WelderCode = c.WelderCode
// FOR xml path ('')), 1, 1, ''))
// else
// (stuff((select ',' + nde.NDEReportNo
// from Batch_NDEItem as nde
// inner join Batch_BatchTrustItem as trust
// ON trust.TrustBatchItemId = nde.TrustBatchItemId
// inner join CTE_WeldJoints as joint
// ON joint.WeldJointId = trust.WeldJointId
// where joint.PipelineId = a.PipelineId
// and CHARINDEX(',' + joint.WeldJointCode + ',', ',' + a.WeldJonintCode + '') > 0
// and joint.WelderCode = c.WelderCode
// FOR xml path ( '' )), 1, 1, ''))
// end) as NdeReportNo
// from PTP_PipelineList as a
// inner join
// PTP_TestPackage as b on a.PTP_ID = b.PTP_ID
// inner join View_Pipeline_WeldJoint as c
// on c.PipelineId = a.PipelineId
// inner join Pipeline_Pipeline as d
// on c.PipelineId = d.PipelineId
// where b.PTP_ID = @PTPID
// and b.ProjectId = @projectId and a.PipelineId=@PipelineId
// AND c.WelderCode IS NOT NULL) as t where t.WelderNum >0
//group by t.PipelineCode, t.MaterialCode, t.Specification, t.jointCount, t.FjointCount, t.WelderCode, t.WelderNum,
// t.NdeNum, t.FNdeNum, t.NdeReportNo
//ORDER BY t.PipelineCode, t.MaterialCode, t.Specification, t.jointCount, t.FjointCount, t.WelderCode ";
string sql = @"
WITH CTE_WeldJoints AS (
SELECT PipelineId, WeldJointCode, JointAttribute, WelderCode, DetectionType, WeldJointId
@ -4401,12 +4345,12 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
var DetectionRateCode = (from x in Funs.DB.View_Pipeline_Pipeline
where x.PipelineId == pipelineId
select x.DetectionRateCode).FirstOrDefault();
//如果tb的行数不是8的倍数添加空白行至行数为8的倍数
//如果tb的行数不是6的倍数添加空白行至行数为8的倍数
// 计算需要添加的空白行数
int remainder = tb.Rows.Count % 8;
int remainder = tb.Rows.Count % 6;
if (remainder != 0)
{
int rowsToAdd = 8 - remainder; // 计算需要添加的行数
int rowsToAdd = 6 - remainder; // 计算需要添加的行数
for (int i = 0; i < rowsToAdd; i++)
{
tb.Rows.Add(tb.NewRow()); // 添加空白行
@ -4414,8 +4358,8 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
}
var tbNum = tb.Rows.Count;
var pageNum =
tbNum < 8 ? 1
: Math.Ceiling((float)(tbNum - 8) / 8) + 1;
tbNum < 6 ? 1
: Math.Ceiling((float)(tbNum - 6) / 6) + 1;
for (int i = 1; i <= pageNum; i++)
{
#region
@ -4508,16 +4452,16 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
if (i == 1)
{
dStart = 0;
dEnd = 8;
dEnd =6;
}
else
{
dStart = i == 2 ? 8 : ((i - 2) * 8) + 8;
dEnd = ((i - 1) * 8) + 8;
dStart = i == 2 ? 6 : ((i - 2) * 6) + 6;
dEnd = ((i - 1) * 6) + 6;
}
//这里创建行数据 17-16
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 7, rowIndex + 16, style, 0, 20, true);
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 7, rowIndex + 14, style, 0, 20, true);
#region
//设置表头部分
@ -4572,11 +4516,11 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
#endregion
for (int k = rowIndex + 7; k < rowIndex + 16; k++)
for (int k = rowIndex + 7; k < rowIndex + 14; k++)
{
ws.GetRow(k).Height = 18 * 30;
//小计行
if (k == rowIndex + 15)
if (k == rowIndex + 13)
{
ws.AddMergedRegion(new CellRangeAddress(k, k, 0, 1));
ws.AddMergedRegion(new CellRangeAddress(k, k, 3, 4));
@ -4601,12 +4545,13 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
int threeNum = 1;
int fourNum = 1;
int fiveNum = 1;
for (int k = 0; k < 8; k++)
for (int k = 0; k < 6; k++)
{
int dataIndex = dataTit + j;
if (pageTb.Rows.Count > k)
{
DataRow dr = pageTb.Rows[k];
ws.GetRow(dataIndex).Height= 24 * 20;
ws.GetRow(dataIndex).GetCell(0).SetCellValue(dr["PipelineCode"].ToString());
var PipelineCodeNum = pagelist.Count(x => x.PipelineCode == dr["PipelineCode"].ToString());
if (PipelineCodeNum > 1)
@ -4710,8 +4655,21 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
ws.GetRow(dataIndex).GetCell(17).SetCellValue($"{rate * 100}%");
}
}
string NdeReportNo = string.IsNullOrEmpty(dr["NdeReportNo"].ToString()) ? "" : dr["NdeReportNo"].ToString();
string[] NdeReportNoArr = NdeReportNo.Split(',');
if (NdeReportNoArr.Length > 1)
{
for (int m = 1; m < NdeReportNoArr.Length; m++)
{
NdeReportNoArr[m]= NdeReportNoArr[m].Substring(NdeReportNoArr[m].Length-4).ToString();
}
NdeReportNo= string.Join(",", NdeReportNoArr);
}
ws.GetRow(dataIndex).GetCell(20).SetCellValue(NdeReportNo);
ws.GetRow(dataIndex).GetCell(20).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 9, true, false);
ws.GetRow(dataIndex).GetCell(20).SetCellValue(dr["NdeReportNo"].ToString());
}
else
{
@ -4723,126 +4681,137 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
j++;
}
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("小计\r\nTotal");
ws.GetRow(rowIndex + 15).GetCell(5).SetCellValue(pagelist.FirstOrDefault().jointCount.ToString() );//
ws.GetRow(rowIndex + 15).GetCell(7).SetCellValue(pagelist.FirstOrDefault().FjointCount.ToString());//
ws.GetRow(rowIndex + 15).GetCell(11).SetCellValue(pagelist.Sum(x=>Convert.ToInt32(x.WelderNum)).ToString());//
ws.GetRow(rowIndex + 15).GetCell(13).SetCellValue(pagelist.Sum(x=>Convert.ToInt32(x.NdeNum)).ToString());//
ws.GetRow(rowIndex + 15).GetCell(15).SetCellValue(pagelist.Sum(x => Convert.ToInt32(x.FNdeNum)).ToString());//
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("小计\r\nTotal");
ws.GetRow(rowIndex + 13).GetCell(5).SetCellValue(pagelist.FirstOrDefault()?.jointCount?.ToString() );//
ws.GetRow(rowIndex + 13).GetCell(7).SetCellValue(pagelist.FirstOrDefault()?.FjointCount?.ToString());//
ws.GetRow(rowIndex + 13).GetCell(11).SetCellValue(pagelist.Sum(x=>Convert.ToInt32(x.WelderNum)).ToString());//
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(pagelist.Sum(x=>Convert.ToInt32(x.NdeNum)).ToString());//
ws.GetRow(rowIndex + 13).GetCell(15).SetCellValue(pagelist.Sum(x => Convert.ToInt32(x.FNdeNum)).ToString());//
var NdeNumSum = pagelist.Sum(x => Convert.ToInt32(x.NdeNum));
var WelderNumSum = pagelist.Sum(x => Convert.ToInt32(x.WelderNum));
if (WelderNumSum == 0)
{
ws.GetRow(rowIndex + 13).GetCell(17).SetCellValue("0%");
}
else
{
decimal rate = Math.Round((decimal.Parse(NdeNumSum.ToString()) / decimal.Parse(WelderNumSum.ToString())), 2);
ws.GetRow(rowIndex + 13).GetCell(17).SetCellValue($"{rate * 100}%");
}
ws.GetRow(rowIndex + 15).Height = 25 * 20;
ws.GetRow(rowIndex + 13).Height = 25 * 20;
#endregion
#region
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("备注\r\nRemark");
ws.GetRow(rowIndex + 16).GetCell(1).SetCellValue("焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints.");
ws.GetRow(rowIndex + 16).GetCell(1).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 1, 20));
ws.GetRow(rowIndex + 16).Height = 25 * 20;
ws.GetRow(rowIndex + 14).GetCell(0).SetCellValue("备注\r\nRemark");
ws.GetRow(rowIndex + 14).GetCell(1).SetCellValue("焊口位置与检测焊口见管道单线图与无损检测报告。\r\nPlease refer to Pipeline Iso-drawing and NDE Report for joints position and examined joints.");
ws.GetRow(rowIndex + 14).GetCell(1).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 14, rowIndex + 14, 1, 20));
ws.GetRow(rowIndex + 14).Height = 25 * 20;
style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
var style1 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 10.5, true, false);
var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Bottom, NPOI.SS.UserModel.HorizontalAlignment.Left, 10.5, true, false);
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 17, rowIndex + 23, style, 0, 20, true);
ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 15, rowIndex + 21, style, 0, 20, true);
ws.GetRow(rowIndex + 17).GetCell(20).CellStyle = style1;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 0, 3));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 4, 9));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 10, 16));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 17, rowIndex + 17, 17, 20));
ws.GetRow(rowIndex + 15).GetCell(20).CellStyle = style1;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 0, 3));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 4, 9));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 10, 16));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 15, rowIndex + 15, 17, 20));
if (!string.IsNullOrEmpty(getInfo.Item1) && !string.IsNullOrEmpty(getInfo.Item2))
{
switch (getInfo.Item2)
{
case "建设方":
InsertImage(hssfworkbook, ws, rowIndex + 20, 0, rowIndex + 20, 3, Server.MapPath(getInfo.Item1), 1, 1,1);
InsertImage(hssfworkbook, ws, rowIndex + 18, 0, rowIndex + 18, 3, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "总承包商":
InsertImage(hssfworkbook, ws, rowIndex + 20, 4, rowIndex + 20, 9, Server.MapPath(getInfo.Item1), 1, 1,1);
InsertImage(hssfworkbook, ws, rowIndex + 18, 4, rowIndex + 18, 9, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "监理":
InsertImage(hssfworkbook, ws, rowIndex + 20, 0, rowIndex + 20, 3, Server.MapPath(getInfo.Item1), 1, 1,1);
InsertImage(hssfworkbook, ws, rowIndex + 18, 0, rowIndex + 18, 3, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "检测":
InsertImage(hssfworkbook, ws, rowIndex + 19, 10, rowIndex + 19, 16, Server.MapPath(getInfo.Item1), 1, 1,1);
InsertImage(hssfworkbook, ws, rowIndex + 17, 10, rowIndex + 17, 16, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
case "施工":
InsertImage(hssfworkbook, ws, rowIndex + 20, 17, rowIndex + 20, 20, Server.MapPath(getInfo.Item1), 1, 1,1);
InsertImage(hssfworkbook, ws, rowIndex + 18, 17, rowIndex + 18, 20, Server.MapPath(getInfo.Item1), 1, 1,1);
break;
}
}
ws.GetRow(rowIndex + 17).GetCell(0).SetCellValue("建设/监理单位\r\nOwner/Supervision Contractor");
ws.GetRow(rowIndex + 17).GetCell(4).SetCellValue("总承包单位\r\nGeneral Contractor");
ws.GetRow(rowIndex + 17).GetCell(10).SetCellValue("检 测 单 位\r\nExamination Contractor");
ws.GetRow(rowIndex + 17).GetCell(17).SetCellValue("施 工 单 位\r\nConstruction Company");
ws.GetRow(rowIndex + 17).GetCell(0).CellStyle = ws.GetRow(rowIndex + 17).GetCell(4).CellStyle = ws.GetRow(rowIndex + 17).GetCell(10).CellStyle = ws.GetRow(rowIndex + 17).GetCell(17).CellStyle = style1;
ws.GetRow(rowIndex + 17).Height = 28 * 20;
ws.GetRow(rowIndex + 15).GetCell(0).SetCellValue("建设/监理单位\r\nOwner/Supervision Contractor");
ws.GetRow(rowIndex + 15).GetCell(4).SetCellValue("总承包单位\r\nGeneral Contractor");
ws.GetRow(rowIndex + 15).GetCell(10).SetCellValue("检 测 单 位\r\nExamination Contractor");
ws.GetRow(rowIndex + 15).GetCell(17).SetCellValue("施 工 单 位\r\nConstruction Company");
ws.GetRow(rowIndex + 15).GetCell(0).CellStyle = ws.GetRow(rowIndex + 15).GetCell(4).CellStyle = ws.GetRow(rowIndex + 15).GetCell(10).CellStyle = ws.GetRow(rowIndex + 15).GetCell(17).CellStyle = style1;
ws.GetRow(rowIndex + 15).Height = 28 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 0, 3));
ws.GetRow(rowIndex + 18).GetCell(0).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.GetRow(rowIndex + 18).Height = 25 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 0, 3));
ws.GetRow(rowIndex + 16).GetCell(0).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.GetRow(rowIndex + 16).Height = 25 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 4, 9));
ws.GetRow(rowIndex + 18).GetCell(4).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 4, 9));
ws.GetRow(rowIndex + 16).GetCell(4).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 10, 16));
ws.GetRow(rowIndex + 18).GetCell(10).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 10, 16));
ws.GetRow(rowIndex + 16).GetCell(10).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 16, rowIndex + 16, 17, 20));
ws.GetRow(rowIndex + 16).GetCell(17).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 18, rowIndex + 18, 17, 20));
ws.GetRow(rowIndex + 18).GetCell(17).SetCellValue("专业工程师\r\nDiscipline Engineer:");
ws.GetRow(rowIndex + 18).GetCell(17).SetCellValue("质量检查员:\r\nQuality Inspector:");
ws.GetRow(rowIndex + 18).Height = 25 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 20, rowIndex + 20, 17, 20));
ws.GetRow(rowIndex + 20).GetCell(17).SetCellValue("质量检查员:\r\nQuality Inspector:");
ws.GetRow(rowIndex + 20).GetCell(17).SetCellValue("制表:\r\nPrepared:");
ws.GetRow(rowIndex + 20).Height = 25 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 22, rowIndex + 22, 17, 20));
ws.GetRow(rowIndex + 22).GetCell(17).SetCellValue("制表:\r\nPrepared:");
ws.GetRow(rowIndex + 22).Height = 25 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 3));
ws.GetRow(rowIndex + 23).GetCell(0).SetCellValue("日期Date 年 月 日");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 0, 3));
ws.GetRow(rowIndex + 21).GetCell(0).SetCellValue("日期Date 年 月 日");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 4, 9));
ws.GetRow(rowIndex + 23).GetCell(4).SetCellValue("日期Date 年 月 日");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 4, 9));
ws.GetRow(rowIndex + 21).GetCell(4).SetCellValue("日期Date 年 月 日");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 10, 16));
ws.GetRow(rowIndex + 23).GetCell(10).SetCellValue("日期Date 年 月 日");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 10, 16));
ws.GetRow(rowIndex + 21).GetCell(10).SetCellValue("日期Date 年 月 日");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 23, rowIndex + 23, 17, 20));
ws.GetRow(rowIndex + 23).GetCell(17).SetCellValue("日期Date 年 月 日");
ws.GetRow(rowIndex + 23).Height = 25 * 20;
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 21, rowIndex + 21, 17, 20));
ws.GetRow(rowIndex + 21).GetCell(17).SetCellValue("日期Date 年 月 日");
ws.GetRow(rowIndex + 21).Height = 25 * 20;
ws.GetRow(rowIndex + 23).GetCell(0).CellStyle = ws.GetRow(rowIndex + 23).GetCell(4).CellStyle = ws.GetRow(rowIndex + 23).GetCell(10).CellStyle = ws.GetRow(rowIndex + 23).GetCell(17).CellStyle = style2;
ws.GetRow(rowIndex + 21).GetCell(0).CellStyle = ws.GetRow(rowIndex + 21).GetCell(4).CellStyle = ws.GetRow(rowIndex + 21).GetCell(10).CellStyle = ws.GetRow(rowIndex + 21).GetCell(17).CellStyle = style2;
ws.GetRow(rowIndex + 17).Height = 14 * 20;
ws.GetRow(rowIndex + 18).Height = 14 * 20;
ws.GetRow(rowIndex + 19).Height = 14 * 20;
ws.GetRow(rowIndex + 20).Height = 14 * 20;
ws.GetRow(rowIndex + 21).Height = 14 * 20;
ws.GetRow(rowIndex + 22).Height = 25 * 20;
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 18, rowIndex + 23, 0, 0), ws);
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 17, rowIndex + 17, 0, 20), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 3, 3), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 9, 9), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 16, 16), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 18, rowIndex + 22, 20, 20), ws);
RegionUtil.SetBorderTop(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 20), ws);
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 0), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 20, 20), ws);
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 0, 20), ws);
ws.GetRow(rowIndex + 20).Height = 25 * 20;
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 16, rowIndex + 21, 0, 0), ws);
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 15, rowIndex + 15, 0, 20), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 16, rowIndex + 20, 3, 3), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 16, rowIndex + 20, 9, 9), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 16, rowIndex + 20, 16, 16), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 16, rowIndex + 20, 20, 20), ws);
RegionUtil.SetBorderTop(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 0, 20), ws);
RegionUtil.SetBorderLeft(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 0, 0), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 20, 20), ws);
RegionUtil.SetBorderBottom(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 0, 20), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 3, 3), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 9, 9), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 23, rowIndex + 23, 16, 16), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 3, 3), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 9, 9), ws);
RegionUtil.SetBorderRight(1, new CellRangeAddress(rowIndex + 21, rowIndex + 21, 16, 16), ws);
#endregion
rowIndex = rowIndex + 24;
rowIndex = rowIndex + 22;
pageIndex++;
}
@ -5645,6 +5614,9 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
}
ws.GetRow(rowIndex + i).GetCell(20).SetCellValue(dr["NdeReportNo"].ToString());
ws.GetRow(rowIndex + i).GetCell(20).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 6, true, false, "Arial Unicode MS");
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 9, 10));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 11, 12));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 13, 14));
@ -5677,11 +5649,22 @@ ORDER BY d.PipelineCode, m.MaterialCode, d.Specification, c.WelderCode";
ws.AddMergedRegion(new CellRangeAddress(rowIndex + i, rowIndex + i, 17, 19));*/
}
ws.GetRow(rowIndex + 13).GetCell(0).SetCellValue("小计\nTotal");
ws.GetRow(rowIndex + 13).GetCell(5).SetCellValue(pagelist.FirstOrDefault().jointCount.ToString());//
ws.GetRow(rowIndex + 13).GetCell(7).SetCellValue(pagelist.FirstOrDefault().FjointCount.ToString());//
ws.GetRow(rowIndex + 13).GetCell(5).SetCellValue(pagelist.FirstOrDefault()?.jointCount.ToString());//
ws.GetRow(rowIndex + 13).GetCell(7).SetCellValue(pagelist.FirstOrDefault()?.FjointCount.ToString());//
ws.GetRow(rowIndex + 13).GetCell(11).SetCellValue(pagelist.Sum(x => Convert.ToInt32(x.WelderNum)).ToString());//
ws.GetRow(rowIndex + 13).GetCell(13).SetCellValue(pagelist.Sum(x => Convert.ToInt32(x.NdeNum)).ToString());//
ws.GetRow(rowIndex + 13).GetCell(15).SetCellValue(pagelist.Sum(x => Convert.ToInt32(x.FNdeNum)).ToString());//
var NdeNumSum = pagelist.Sum(x => Convert.ToInt32(x.NdeNum));
var WelderNumSum = pagelist.Sum(x => Convert.ToInt32(x.WelderNum));
if (WelderNumSum == 0)
{
ws.GetRow(rowIndex + 13).GetCell(17).SetCellValue("0%");
}
else
{
decimal rate = Math.Round((decimal.Parse(NdeNumSum.ToString()) / decimal.Parse(WelderNumSum.ToString())), 2);
ws.GetRow(rowIndex + 13).GetCell(17).SetCellValue($"{rate * 100}%");
}
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 0, 1));
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 13, rowIndex + 13, 3, 4));

View File

@ -48,7 +48,7 @@
<f:FileUpload runat="server" ID="fileUpload" EmptyText="请选择要导入的Excel文件"
LabelWidth="50px" LabelAlign="Right" Width="300px">
</f:FileUpload>
<f:Button ID="btnImport" Icon="ApplicationEdit" runat="server" Text="导入" ToolTip="试压包导入"
<f:Button ID="btnImport" Icon="ApplicationEdit" runat="server" Text="<%$ Resources:Lan,Import %>" ToolTip="试压包导入"
AjaxLoadingType="Mask" ShowAjaxLoadingMaskText="true" AjaxLoadingMaskText="正在校验并导入数据,请稍后!" OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="模板下载" ToolTip="模板下载" OnClick="btnDownLoad_Click">

View File

@ -326,7 +326,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
{
if (this.tvControlItem.SelectedNode != null)
{
string strSql = @"SELECT batchItem.TrustBatchItemId, pipe.PipelineCode,jot.Specification,jot.WeldJointCode,
string strSql = @"SELECT batchItem.TrustBatchItemId, pipe.PipelineCode,jot.Specification,(jot.WeldJointCode + COALESCE(RepairRecord.RepairMark, '') ) as WeldJointCode,
(CASE WHEN CoverWelder.WelderCode IS NOT NULL AND BackingWelder.WelderCode IS NOT NULL
THEN backingWelder.WelderCode + '/' + coverWelder.WelderCode
ELSE (ISNULL(coverWelder.WelderCode,'') + ISNULL(backingWelder.WelderCode,'')) END) AS WelderCode,
@ -343,6 +343,7 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage
LEFT JOIN Base_Material AS mat1 ON mat1.MaterialId = jot.Material1Id
LEFT JOIN Base_Material AS mat2 ON mat2.MaterialId = jot.Material2Id
LEFT JOIN Batch_PointBatchItem AS PointBatchItem ON PointBatchItem.PointBatchItemId=batchItem.PointBatchItemId
Left join Repair_RepairRecord RepairRecord on PointBatchItem.RepairRecordId =RepairRecord.RepairRecordId
WHERE batchItem.TrustBatchId=@TrustBatchId ";
List<SqlParameter> listStr = new List<SqlParameter>
{

View File

@ -250,7 +250,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
XSSFSheet reportModel = (XSSFSheet)hssfworkbook.GetSheet("Sheet1");
XSSFFont cs_content_Font1 = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
cs_content_Font1.FontName = "sans-serif";//字体
cs_content_Font1.FontName = "Arial";//字体
cs_content_Font1.FontHeightInPoints = 9; //字体大小
ICellStyle style = hssfworkbook.CreateCellStyle();
@ -260,6 +260,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
style.VerticalAlignment=NPOI.SS.UserModel.VerticalAlignment.Center;
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
cs_content_Font.FontName = "sans-serif";//字体
@ -269,6 +270,12 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
IDataFormat dataformat = hssfworkbook.CreateDataFormat();
ICellStyle styleDate = hssfworkbook.CreateCellStyle();
styleDate.SetFont(cs_content_Font1);
styleDate.BorderDiagonalLineStyle = NPOI.SS.UserModel.BorderStyle.Thin;
styleDate.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
styleDate.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
styleDate.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
styleDate.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
styleDate.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
styleDate.DataFormat = dataformat.GetFormat("yyyy-mm-dd");
// 排序
@ -296,7 +303,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue((row["Index"].ToString()).ToString());
reportModel.GetRow(rowIndex).GetCell(0).CellStyle = style; //将字体绑定到样式
reportModel.GetRow(rowIndex).Height= 30 * 20;
// 区域
if (reportModel.GetRow(rowIndex).GetCell(1) == null)
reportModel.GetRow(rowIndex).CreateCell(1);
@ -426,9 +433,22 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
// WeldingDate
if (reportModel.GetRow(rowIndex).GetCell(22) == null)
reportModel.GetRow(rowIndex).CreateCell(22);
reportModel.GetRow(rowIndex).GetCell(22).SetCellValue(row["WeldingDate"].ToString());
string weldingDateStr = row["WeldingDate"].ToString();
DateTime weldingDate;
if (DateTime.TryParse(weldingDateStr, out weldingDate))
{
reportModel.GetRow(rowIndex).GetCell(22).SetCellValue(weldingDate.ToString("yyyy-MM-dd"));
}
else
{
reportModel.GetRow(rowIndex).GetCell(22).SetCellValue(""); // 或者设置为其他默认值
}
reportModel.GetRow(rowIndex).GetCell(22).CellStyle = style;
// DetectionTypeCode
if (reportModel.GetRow(rowIndex).GetCell(23) == null)
reportModel.GetRow(rowIndex).CreateCell(23);
@ -462,7 +482,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
// IsHotProess
if (reportModel.GetRow(rowIndex).GetCell(28) == null)
reportModel.GetRow(rowIndex).CreateCell(28);
reportModel.GetRow(rowIndex).GetCell(28).SetCellValue(row["IsHotProess"].ToString());
reportModel.GetRow(rowIndex).GetCell(28).SetCellValue(row["HotReportCode"].ToString());
reportModel.GetRow(rowIndex).GetCell(28).CellStyle = style;
// HotReportCode
@ -489,13 +509,10 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport
reportModel.GetRow(rowIndex).GetCell(32).SetCellValue(row["WeldFlux"].ToString());
reportModel.GetRow(rowIndex).GetCell(32).CellStyle = style;
// Remark
if (reportModel.GetRow(rowIndex).GetCell(33) == null)
reportModel.GetRow(rowIndex).CreateCell(33);
reportModel.GetRow(rowIndex).GetCell(33).SetCellValue(row["Remark"].ToString());
reportModel.GetRow(rowIndex).GetCell(33).CellStyle = style;
#endregion
if ((int)(90 * (rowIndex) / totalNum) > percent)

File diff suppressed because it is too large Load Diff