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
@@ -3847,34 +3847,94 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
var getInfo =BLL.Sys_UserService.GetSingtrueImageUrl(info?.Auditer);
string sql = @" SELECT
WeldSilkId,
a.PipelineCode,
e.WorkAreaCode,
a.WeldJointCode,
a.Specification,
a.Material1Code,
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=
(SELECT TOP 1 bt.TrustBatchItemId FROM dbo.Batch_BatchTrustItem bt WHERE bt.WeldJointId=a.WeldJointId)) 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
";
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,
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 =
((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
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,10 +4655,23 @@ 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(dr["NdeReportNo"].ToString());
}
else
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);
}
else
{
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 0, 1));
ws.AddMergedRegion(new CellRangeAddress(dataIndex, dataIndex, 3, 4));
@@ -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));
@@ -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">