2023-06-29
This commit is contained in:
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.HotProcessHard
|
||||
@@ -578,5 +579,117 @@ namespace FineUIPro.Web.HJGL.HotProcessHard
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 打印
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
DataTable dt = new DataTable("Table1");
|
||||
dt.Columns.Add("ProjectName", typeof(String));
|
||||
dt.Columns.Add("WorkAreaName", typeof(String));
|
||||
dt.Columns.Add("HotProessTrustNo", typeof(String));
|
||||
dt.Columns.Add("CH_TrustMan", typeof(String));
|
||||
dt.Columns.Add("WorkAreaCode", typeof(String));
|
||||
dt.Columns.Add("JoinNum", typeof(String));
|
||||
|
||||
|
||||
|
||||
DataRow dr = dt.NewRow();
|
||||
if (string.IsNullOrEmpty(this.HotProessTrustId))
|
||||
{
|
||||
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var hotProessTrust = BLL.HotProess_TrustService.GetHotProessTrustById(HotProessTrustId);
|
||||
if (hotProessTrust != null)
|
||||
{
|
||||
string varValue = string.Empty;
|
||||
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
// var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(hotProessTrust.InstallationId);
|
||||
var PworkArea = Funs.DB.WBS_UnitWork .FirstOrDefault(x => x.UnitWorkId == hotProessTrust.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;
|
||||
|
||||
}
|
||||
dr["ProjectName"] = projectName;
|
||||
dr["HotProessTrustNo"] = hotProessTrust.HotProessTrustNo;
|
||||
|
||||
|
||||
string strSql = @" select PipelineCode as ISO_IsoNo ,WeldJointCode as JOT_JointNo,Specification as JOT_JointDesc,MaterialCode from dbo.View_HJGL_HotProess_TrustItem AS Trust
|
||||
WHERE Trust.HotProessTrustId=@HotProessTrustId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", hotProessTrust != null ? hotProessTrust.ProjectId : this.CurrUser.LoginProjectId));
|
||||
listStr.Add(new SqlParameter("@HotProessTrustId", this.HotProessTrustId));
|
||||
|
||||
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
|
||||
|
||||
|
||||
if (tb != null)
|
||||
{
|
||||
tb.TableName = "data";
|
||||
dr["JoinNum"] = tb.Rows.Count.ToString();
|
||||
|
||||
}
|
||||
|
||||
dt.Rows.Add(dr);
|
||||
|
||||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
keyValuePairs.Add("HotProessTrustId", HotProessTrustId);
|
||||
keyValuePairs.Add("totalUnit", "赛鼎工程有限公司");
|
||||
keyValuePairs.Add("ConUnit", "");
|
||||
keyValuePairs.Add("supUnit", "");
|
||||
var ConUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == hotProessTrust.UnitId);
|
||||
if (ConUnit != null)
|
||||
{
|
||||
keyValuePairs["ConUnit"] = ConUnit.UnitName;
|
||||
}
|
||||
var punit = ProjectUnitService.GetProjectUnitListByProjectIdUnitType(this.CurrUser.LoginProjectId, Const.ProjectUnitType_3);
|
||||
if (punit.Count > 0)
|
||||
{
|
||||
var supUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == punit[0].UnitId);
|
||||
if (supUnit != null)
|
||||
{
|
||||
keyValuePairs["supUnit"] = supUnit.UnitName;
|
||||
|
||||
}
|
||||
}
|
||||
BLL.FastReportService.ResetData();
|
||||
BLL.FastReportService.AddFastreportTable(dt);
|
||||
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user