2023-09-07

This commit is contained in:
2023-09-07 16:38:56 +08:00
parent c4aecfbcaf
commit 36c40ea33c
9 changed files with 580 additions and 60 deletions
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
@@ -445,6 +446,122 @@ namespace FineUIPro.Web.HJGL.RepairAndExpand
}
}
protected void btnPrint_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable("Table1");
dt.Columns.Add("ProjectName", typeof(String));
dt.Columns.Add("CH_CheckUnit", typeof(String));
dt.Columns.Add("WorkAreaName", typeof(String));
dt.Columns.Add("CH_TrustUnit", typeof(String));
dt.Columns.Add("CH_TrustMan", typeof(String));
dt.Columns.Add("CH_TrustCode", typeof(String));
dt.Columns.Add("WorkAreaCode", typeof(String));
dt.Columns.Add("CH_NDTCriteria", typeof(String));
dt.Columns.Add("CH_WeldMethod", typeof(String));
dt.Columns.Add("CH_AcceptGrade", typeof(String));
dt.Columns.Add("CH_NDTMethod", typeof(String));
dt.Columns.Add("CH_SlopeType", typeof(String));
dt.Columns.Add("CH_NDTRate", typeof(String));
DataRow dr = dt.NewRow();
if (this.tvControlItem.SelectedNode == null)
{
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
return;
}
string reportId = this.tvControlItem.SelectedNode.NodeID;
// Model.View_Batch_BatchTrust trust = BLL.Batch_BatchTrustService.GetBatchTrustViewByPointBatchId(this.tvControlItem.SelectedNodeID);
// Model.HJGL_Batch_PointBatch batch = BLL.PointBatchService.GetPointBatchById(this.tvControlItem.SelectedNodeID);
// var trust = BLL.Batch_BatchTrustService.GetBatchTrustViewByPointBatchId(reportId);
var trust = BLL.Batch_BatchTrustService.GetBatchTrustViewById(this.tvControlItem.SelectedNodeID);
if (trust != null)
{
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
dr["ProjectName"] = projectName;
if (!string.IsNullOrEmpty(trust.NDEUnit))
{
dr["CH_CheckUnit"] = BLL.UnitService.GetUnitNameByUnitId(trust.NDEUnit).ToString();
}
if (!string.IsNullOrEmpty(trust.TrustBatchCode))
{
dr["CH_TrustCode"] = trust.TrustBatchCode;
}
/* if (!string.IsNullOrEmpty(trust.CH_NDTCriteria))
{
dr["CH_NDTCriteria"] = trust.CH_NDTCriteria;
}*/
if (!string.IsNullOrEmpty(trust.DetectionTypeCode))
{
dr["CH_NDTMethod"] = trust.DetectionTypeCode;
}
if (!string.IsNullOrEmpty(trust.DetectionRateId))
{
var list = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId);
if (list != null)
{
dr["CH_NDTRate"] = list.DetectionRateCode;
}
}
var PworkArea = Funs.DB.WBS_UnitWork.FirstOrDefault(x => x.UnitWorkId == trust.UnitWorkId);
if (PworkArea != null)
{
//var cel = recordSheet.GetRow(3).CreateCell(1);
//cel.SetCellValue(PworkArea.WorkAreaCode);
//cel.CellStyle = styleCenter;
dr["WorkAreaName"] = PworkArea.UnitWorkName;
dr["WorkAreaCode"] = PworkArea.UnitWorkCode;
}
dt.Rows.Add(dr);
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("TrustBatchId", trust.TrustBatchId);
keyValuePairs.Add("totalUnit", "赛鼎工程有限公司");
var unitcheck = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
if (unitcheck != null && !string.IsNullOrEmpty(unitcheck.UnitId))
{
keyValuePairs.Add("supUnit", BLL.UnitService.GetUnitNameByUnitId(unitcheck.UnitId).ToString());
}
BLL.FastReportService.ResetData();
BLL.FastReportService.AddFastreportTable(dt);
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
// Session["Table"] = dt;
// Session["CH_TrustID"] = reportId;
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\管道焊口返修委托单NoPic.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../../Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
else
{
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
return;
}
}
/*
protected void btnPrint_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
@@ -480,6 +597,7 @@ namespace FineUIPro.Web.HJGL.RepairAndExpand
// return;
//}
}
*/
#region
/// <summary>