11
This commit is contained in:
+159
-46
@@ -664,13 +664,20 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
Alert.ShowInTop("请选择打印报表!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID) )
|
||||
if (string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
Alert.ShowInTop("请选择试压包!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
CreateDataExcel(selectValArray);
|
||||
try
|
||||
{
|
||||
CreateDataExcel(selectValArray);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowNotify($"导出失败:{ex.Message}", MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
#region 绘画模版
|
||||
@@ -745,7 +752,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
ws.GetRow(rowIndex + 11).Height = 11 * 20;
|
||||
|
||||
ws.GetRow(rowIndex + 10).GetCell(1).SetCellValue("试压包号\r\nTest Package No.");
|
||||
ws.GetRow(rowIndex + 10).GetCell(4).SetCellValue("UG-130-FW-HT-0001");
|
||||
ws.GetRow(rowIndex + 10).GetCell(4).SetCellValue(this.tvControlItem.SelectedNode.Text);
|
||||
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 2, 4));
|
||||
ws.AddMergedRegion(new CellRangeAddress(rowIndex + 12, rowIndex + 13, 6, 7));
|
||||
@@ -3110,32 +3117,66 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
{
|
||||
var info = GetTestPackageInfo(this.tvControlItem.SelectedNodeID);
|
||||
|
||||
string sql = @" SELECT
|
||||
WeldSilkId,
|
||||
a.PipelineCode,
|
||||
e.WorkAreaCode,
|
||||
a.WeldJointCode,
|
||||
a.Specification,
|
||||
a.Material1Code,
|
||||
a.WeldingMethodCode,
|
||||
a.WeldingDate,
|
||||
a.WeldSilkCode,
|
||||
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
|
||||
left join Project_WorkArea as e on e.WorkAreaId=c.WorkAreaId
|
||||
WHERE Is_hjName='是' and b.PTP_ID=@PTPID and a.projectId=@projectId
|
||||
string sql = @" SELECT * FROM (
|
||||
SELECT
|
||||
b.PTP_ID,
|
||||
a.projectId,
|
||||
WeldSilkId,
|
||||
a.PipelineCode,
|
||||
a.WeldJointCode,
|
||||
a.Specification,
|
||||
a.MaterialCode,
|
||||
a.WeldingMethodCode,
|
||||
a.WeldingDate,
|
||||
(CASE WHEN a.WeldMatId IS NOT NULL AND a.WeldSilkId IS NOT NULL THEN a.WeldSilkId+'|'+ a.WeldMatId
|
||||
WHEN a.WeldMatId IS NOT NULL AND a.WeldSilkId IS NULL THEN a.WeldMatId
|
||||
WHEN a.WeldSilkId IS NOT NULL AND a.WeldMatId IS NULL THEN a.WeldSilkId
|
||||
ELSE '' END) AS WeldMaterial,
|
||||
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
|
||||
WHERE c.isAll=1
|
||||
UNION ALL
|
||||
SELECT
|
||||
b.PTP_ID,
|
||||
a.projectId,
|
||||
WeldSilkId,
|
||||
a.PipelineCode,
|
||||
a.WeldJointCode,
|
||||
a.Specification,
|
||||
a.MaterialCode,
|
||||
a.WeldingMethodCode,
|
||||
a.WeldingDate,
|
||||
(CASE WHEN a.WeldMatId IS NOT NULL AND a.WeldSilkId IS NOT NULL THEN a.WeldSilkId+'|'+ a.WeldMatId
|
||||
WHEN a.WeldMatId IS NOT NULL AND a.WeldSilkId IS NULL THEN a.WeldMatId
|
||||
WHEN a.WeldSilkId IS NOT NULL AND a.WeldMatId IS NULL THEN a.WeldSilkId
|
||||
ELSE '' END) AS WeldMaterial,
|
||||
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
|
||||
WHERE c.isAll=0 AND CHARINDEX(','+a.WeldJointCode+',',','+c.WeldJonintCode+',')>0
|
||||
|
||||
) AS T WHERE PTP_ID=@PTPID and projectId=@projectId
|
||||
";
|
||||
|
||||
SqlParameter[] parms = {
|
||||
@@ -3334,23 +3375,15 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
//规格mm
|
||||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["Specification"].ToString());
|
||||
//材质
|
||||
ws.GetRow(dataIndex).GetCell(6).SetCellValue(dr["Material1Code"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(6).SetCellValue(dr["MaterialCode"].ToString());
|
||||
//焊接位置
|
||||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["WeldingLocationCode"].ToString());
|
||||
//焊接方法
|
||||
ws.GetRow(dataIndex).GetCell(8).SetCellValue(dr["WeldingMethodCode"].ToString());
|
||||
//焊材牌号
|
||||
List<string> silkMats = new List<string>();
|
||||
if (!string.IsNullOrWhiteSpace(dr["WeldSilkCode"].ToString()))
|
||||
{
|
||||
silkMats.Add(dr["WeldSilkCode"].ToString());
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(dr["WeldMatCode"].ToString()))
|
||||
{
|
||||
silkMats.Add(dr["WeldMatCode"].ToString());
|
||||
}
|
||||
if (silkMats.Count > 0) silkMats = silkMats.GroupBy(x => x).Select(x => x.Key).ToList();
|
||||
ws.GetRow(dataIndex).GetCell(10).SetCellValue(string.Join("/", silkMats));
|
||||
|
||||
string silkMats = ConvertWeldMaterial(dr["WeldMaterial"].ToString());
|
||||
|
||||
ws.GetRow(dataIndex).GetCell(10).SetCellValue(silkMats);
|
||||
//实际预热温度
|
||||
ws.GetRow(dataIndex).GetCell(12).SetCellValue(dr["PrepareTemp"].ToString());
|
||||
//焊接日期
|
||||
@@ -3718,7 +3751,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
ws.GetRow(dataIndex).GetCell(5).SetCellValue(dr["totalNum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(7).SetCellValue(dr["Fnum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["WelderCode"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["Fnum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["totalNum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(13).SetCellValue(dr["NdeNum"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr["FNdeNum"].ToString());
|
||||
string a = string.IsNullOrEmpty(dr["NdeNum"].ToString())?"0": dr["NdeNum"].ToString();
|
||||
@@ -4812,8 +4845,8 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
ws.GetRow(dataIndex).GetCell(9).SetCellValue(dr["RTNDEReportNo"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(11).SetCellValue(dr["PTCheckResult"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(12).SetCellValue(dr["PTNDEReportNo"].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(14).SetCellValue(dr[""].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(15).SetCellValue(dr[""].ToString());
|
||||
ws.GetRow(dataIndex).GetCell(14).SetCellValue("");
|
||||
ws.GetRow(dataIndex).GetCell(15).SetCellValue("");
|
||||
ws.GetRow(dataIndex).GetCell(17).SetCellValue(dr["Remark"].ToString());
|
||||
j++;
|
||||
}
|
||||
@@ -6534,7 +6567,7 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
string fileName = "模版报表-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
|
||||
string fileName = "试压包报表-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
|
||||
string ReportFileName = filePath + fileName;
|
||||
|
||||
//XSSFWorkbook hssfworkbook = new XSSFWorkbook();
|
||||
@@ -6735,7 +6768,87 @@ namespace FineUIPro.Web.WeldingProcess.TestPackageManage
|
||||
|
||||
|
||||
#region 私有方法
|
||||
protected string ConvertWeldMaterial(object WeldMaterial)
|
||||
{
|
||||
string weldMaterial = string.Empty;
|
||||
string silkName = string.Empty;
|
||||
string fluxName = string.Empty;
|
||||
string matName = string.Empty;
|
||||
|
||||
if (WeldMaterial != null)
|
||||
{
|
||||
string[] wmts = WeldMaterial.ToString().Split('|');
|
||||
if (wmts.Count() > 0)
|
||||
{
|
||||
if (wmts.Count() == 1)
|
||||
{
|
||||
string[] silks = wmts[0].Split(',');
|
||||
if (silks.Count() > 1) // 焊丝
|
||||
{
|
||||
foreach (string s in silks)
|
||||
{
|
||||
var silk = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(s);
|
||||
if (!string.IsNullOrEmpty(silk.UserFlux))
|
||||
{
|
||||
fluxName = fluxName + silk.UserFlux + "/";
|
||||
silkName = silkName + silk.ConsumablesName + "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
silkName = silkName + silk.ConsumablesName + "/";
|
||||
}
|
||||
}
|
||||
|
||||
if (fluxName.Length > 0)
|
||||
{
|
||||
fluxName = fluxName.Substring(0, fluxName.Length - 1);
|
||||
weldMaterial = silkName + fluxName;
|
||||
}
|
||||
else
|
||||
{
|
||||
weldMaterial = silkName.Substring(0, silkName.Length - 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var mat = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(wmts[0]);
|
||||
weldMaterial = mat==null?"": mat.ConsumablesName;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
string[] silks = wmts[0].Split(',');
|
||||
foreach (string s in silks)
|
||||
{
|
||||
var silk = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(s);
|
||||
if (!string.IsNullOrEmpty(silk.UserFlux))
|
||||
{
|
||||
fluxName = fluxName + silk.UserFlux + "/";
|
||||
silkName = silkName + silk.ConsumablesName + "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
silkName = silkName + silk.ConsumablesName + "/";
|
||||
}
|
||||
}
|
||||
|
||||
var mat = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(wmts[1]);
|
||||
weldMaterial = silkName + mat.ConsumablesName;
|
||||
|
||||
if (fluxName.Length > 0)
|
||||
{
|
||||
fluxName = fluxName.Substring(0, fluxName.Length - 1);
|
||||
weldMaterial = silkName + mat.ConsumablesName + "/" + fluxName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return weldMaterial;
|
||||
}
|
||||
public static TestPackageInfoViewModel GetTestPackageInfo(string ptpId)
|
||||
{
|
||||
var result = (from a in Funs.DB.PTP_TestPackage
|
||||
|
||||
Reference in New Issue
Block a user