20251028
This commit is contained in:
@@ -10,6 +10,7 @@ using System.IO;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using System.Threading;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.WeldingReport
|
||||
{
|
||||
@@ -37,7 +38,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport
|
||||
//单位
|
||||
// var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
|
||||
// if (unit != null && unit.UnitTypeId == BLL.Const.ProjectUnitType_2)
|
||||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UnitId != Const.hfnbdId)
|
||||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UserId != Const.hfnbdId)
|
||||
{
|
||||
//BLL.UnitService.InitSubUnitNameDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
|
||||
//this.drpUnit.SelectedValue = this.CurrUser.UnitId;
|
||||
@@ -118,6 +119,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
#region 分页、排序
|
||||
/// <summary>
|
||||
/// 改变索引事件
|
||||
/// </summary>
|
||||
@@ -149,6 +151,7 @@ namespace FineUIPro.Web.HJGL.WeldingReport
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 统计按钮事件
|
||||
/// <summary>
|
||||
@@ -449,5 +452,631 @@ namespace FineUIPro.Web.HJGL.WeldingReport
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 报表打印
|
||||
/// <summary>
|
||||
/// 报表打印
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
//string isoId = this.tvControlItem.SelectedNodeID;
|
||||
//var q = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(isoId);
|
||||
|
||||
//if (q != null)
|
||||
//{
|
||||
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && this.drpWorkArea.SelectedValue != "")
|
||||
{
|
||||
if (printType.SelectedValue == "0") //焊接工作记录
|
||||
{
|
||||
BLL.Common.FastReportService.ResetData();
|
||||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(this.drpWorkArea.SelectedValue);
|
||||
keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);
|
||||
keyValuePairs.Add("ProjectName", ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId));
|
||||
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
|
||||
string strSql = @"SELECT v.*,"
|
||||
+ @" ci.CHT_FilmDate as CHT_CheckDate,"
|
||||
+ @" c.CHT_CheckCode CHT_CheckCode,c.CHT_CheckID"
|
||||
+ @" FROM V_JOINTVIEW v left join CH_CheckItem ci on ci.JOT_ID=v.JOT_ID left join CH_Check c on ci.CHT_CheckID = c.CHT_CheckID WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>
|
||||
{
|
||||
new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||||
};
|
||||
if (this.drpWorkArea.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpWorkArea.SelectedValue))
|
||||
{
|
||||
strSql += " AND v.WorkAreaId =@workareaId";
|
||||
listStr.Add(new SqlParameter("@workareaId", this.drpWorkArea.SelectedValue));
|
||||
}
|
||||
|
||||
if (this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UserId != Const.hfnbdId)
|
||||
{
|
||||
strSql += " AND v.UnitId = @UnitId";
|
||||
listStr.Add(new SqlParameter("@UnitId", this.CurrUser.UnitId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtJointDesc.Text.Trim()))
|
||||
{
|
||||
strSql += " AND v.JOT_JointDesc LIKE @JOT_JointDesc";
|
||||
listStr.Add(new SqlParameter("@JOT_JointDesc", "%" + this.txtJointDesc.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtIsoNo.Text.Trim()))
|
||||
{
|
||||
strSql += " AND v.ISO_ISONO LIKE @isoNo";
|
||||
listStr.Add(new SqlParameter("@isoNo", "%" + this.txtIsoNo.Text.Trim() + "%"));
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
DataView dv = tb.DefaultView;//获取表视图
|
||||
dv.Sort = "WorkAreaCode,ISO_ISONO,JOT_JointNo ASC";
|
||||
tb = dv.ToTable();//转为表
|
||||
if (tb != null)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
dt.TableName = "Table1";
|
||||
dt.Columns.Add("ISO_IsoNo");
|
||||
dt.Columns.Add("JOT_JointNo");
|
||||
dt.Columns.Add("WED_Code2");
|
||||
dt.Columns.Add("JOT_JointDesc");
|
||||
dt.Columns.Add("STE_Name1");
|
||||
dt.Columns.Add("JOT_Location");
|
||||
dt.Columns.Add("WeldingMethodName");
|
||||
dt.Columns.Add("WeldMat");
|
||||
dt.Columns.Add("JOT_PrepareTemp");
|
||||
dt.Columns.Add("JOT_WeldDate");
|
||||
|
||||
DataRow[] rows = tb.DefaultView.ToTable().Select();
|
||||
foreach (var row in rows)
|
||||
{
|
||||
var newRow = dt.NewRow();
|
||||
newRow["ISO_IsoNo"] = row["ISO_ISONO"].ToString();
|
||||
newRow["JOT_JointNo"] = row["JOT_JointNo"].ToString();
|
||||
newRow["WED_Code2"] = row["JOT_FloorWelder"].ToString();
|
||||
newRow["JOT_JointDesc"] = row["JOT_JointDesc"].ToString();
|
||||
newRow["STE_Name1"] = row["STE_Name1"].ToString();
|
||||
newRow["JOT_Location"] = row["JOT_Location"].ToString();
|
||||
newRow["WeldingMethodName"] = row["WeldingMethodName"].ToString();
|
||||
newRow["WeldMat"] = row["WMT_Matname"].ToString();
|
||||
newRow["JOT_PrepareTemp"] = row["JOT_PrepareTemp"].ToString();
|
||||
newRow["JOT_WeldDate"] = string.Format("{0:yyyy-MM-dd}", row["JOT_WeldDate"]);
|
||||
dt.Rows.Add(newRow);
|
||||
}
|
||||
BLL.Common.FastReportService.AddFastreportTable(dt);
|
||||
}
|
||||
|
||||
|
||||
string initTemplatePath = "";
|
||||
string rootPath = Server.MapPath("~/");
|
||||
|
||||
initTemplatePath = "File\\Fastreport\\管道焊接工作记录.frx";
|
||||
|
||||
if (File.Exists(rootPath + initTemplatePath))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//else if (printType.SelectedValue == "1")// 焊接工艺评定
|
||||
//{
|
||||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||||
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
|
||||
// Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
// keyValuePairs.Add("ISO_IsoNo", q.ISO_IsoNo);
|
||||
// keyValuePairs.Add("install", install.InstallationName);
|
||||
// keyValuePairs.Add("workarea", workArea.WorkAreaName);
|
||||
// BLL.Common.FastReportService.ResetData();
|
||||
// BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
|
||||
|
||||
// string strSql = @"SELECT '' WED_Code,jointInfo.JOT_ID,
|
||||
// jointInfo.ProjectId,
|
||||
// jointInfo.JOT_JointNo,
|
||||
// jointInfo.is_hj,
|
||||
// jointInfo.JointStatusName,
|
||||
// jointInfo.JOT_TrustFlagName,
|
||||
// jointInfo.JOT_CheckFlagName,
|
||||
// jointInfo.ISO_ID,
|
||||
// jointInfo.ISO_IsoNo,
|
||||
// jointInfo.ISO_IsoNumber,
|
||||
// jointInfo.WorkAreaId,
|
||||
// jointInfo.WorkAreaCode,
|
||||
// jointInfo.JOT_WeldDate,
|
||||
// jointInfo.JOT_DailyReportNo,
|
||||
// jointInfo.STE_Name1,
|
||||
// jointInfo.STE_Name2,
|
||||
// jointInfo.Component1,
|
||||
// jointInfo.Component2,
|
||||
// jointInfo.WED_Code1,
|
||||
// jointInfo.WED_Name1,
|
||||
// jointInfo.WED_Code2,
|
||||
// jointInfo.WED_Name2,
|
||||
// jointInfo.JOT_JointDesc,
|
||||
// jointInfo.JOT_Dia,
|
||||
// jointInfo.JOT_Size,
|
||||
// jointInfo.JOT_Sch,
|
||||
// jointInfo.JOT_FactSch,
|
||||
// jointInfo.GrooveTypeName,
|
||||
// jointInfo.JOTY_ID,
|
||||
// jointInfo.WeldTypeName,
|
||||
// jointInfo.WME_ID,
|
||||
// jointInfo.WeldingMethodName,
|
||||
// jointInfo.WeldSilk,
|
||||
// jointInfo.WeldMat,
|
||||
// jointInfo.WLO_Code,
|
||||
// jointInfo.WeldingLocationName,
|
||||
// jointInfo.JOT_DoneDin,
|
||||
// jointInfo.JOT_PrepareTemp,
|
||||
// jointInfo.JOT_JointAttribute,
|
||||
// jointInfo.JOT_CellTemp,
|
||||
// jointInfo.JOT_LastTemp,
|
||||
// jointInfo.JOT_HeartNo1,
|
||||
// jointInfo.JOT_HeartNo2,
|
||||
// jointInfo.PointDate,
|
||||
// jointInfo.PointNo,
|
||||
// jointInfo.CH_TrustCode,
|
||||
// jointInfo.CH_TrustDate,
|
||||
// jointInfo.JOT_FaceCheckResult,
|
||||
// jointInfo.JOT_FaceCheckDate,
|
||||
// jointInfo.JOT_FaceChecker,
|
||||
// jointInfo.IS_Proess,
|
||||
// jointInfo.JOT_BelongPipe,
|
||||
// jointInfo.JOT_Electricity,
|
||||
// jointInfo.JOT_Voltage,
|
||||
// jointInfo.JOT_ProessDate,
|
||||
// jointInfo.JOT_HotRpt,
|
||||
// jointInfo.JOT_Remark,jointInfo.JOT_Location"
|
||||
// + @" from View_JointInfo as jointInfo "
|
||||
// + @" WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId ";
|
||||
// List<SqlParameter> listStr = new List<SqlParameter>
|
||||
//{
|
||||
// new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||||
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
|
||||
//};
|
||||
// if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
|
||||
// {
|
||||
// strSql += " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo";
|
||||
// listStr.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(this.dpIsHj.SelectedValue))
|
||||
// {
|
||||
// strSql += " AND jointInfo.is_hj = @is_hj";
|
||||
// listStr.Add(new SqlParameter("@is_hj", this.dpIsHj.SelectedValue));
|
||||
// }
|
||||
// strSql += " order by JOT_JointNo ";
|
||||
// SqlParameter[] parameter = listStr.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
// //if (tb.Rows.Count > 27)
|
||||
// //{
|
||||
// // // for (int i = 0; i < (tb.Rows.Count - 24) % 30; i++)
|
||||
// // for (int j = 0; j < tb.Rows.Count - 27; j++)
|
||||
// // {
|
||||
// // recordSheet.GetRow(6).CopyRowTo(7 + j);
|
||||
// // }
|
||||
// //}
|
||||
|
||||
// //if (tb.Rows.Count > 12)
|
||||
// //{
|
||||
// // recordSheet.ShiftRows(7, 34, tb.Rows.Count - 12);
|
||||
// // for (int j = 0; j < tb.Rows.Count - 12; j++)
|
||||
// // {
|
||||
// // recordSheet.CopyRow(6 + j, 7 + j);
|
||||
// // }
|
||||
// //}
|
||||
// for (int i = 0; i < tb.Rows.Count; i++)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// string WED_Code = "";
|
||||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code1"].ToString()))
|
||||
// WED_Code += tb.Rows[i]["WED_Code1"].ToString();
|
||||
|
||||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code2"].ToString()))
|
||||
// WED_Code += " " + tb.Rows[i]["WED_Code2"].ToString();
|
||||
// tb.Rows[i]["WED_Code"] = WED_Code;
|
||||
// //recordSheet.GetRow(5 + i).GetCell(0).SetCellValue(tb.Rows[i]["ISO_IsoNo"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(1).SetCellValue("");
|
||||
// //recordSheet.GetRow(5 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(4).SetCellValue(WED_Code);
|
||||
// //recordSheet.GetRow(5 + i).GetCell(5).SetCellValue("");
|
||||
// //recordSheet.GetRow(5 + i).GetCell(6).SetCellValue("");
|
||||
// //recordSheet.GetRow(5 + i).GetCell(7).SetCellValue("");
|
||||
// //recordSheet.GetRow(5 + i).GetCell(8).SetCellValue(tb.Rows[i]["WeldingMethodName"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(9).SetCellValue(tb.Rows[i]["JOT_Electricity"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(10).SetCellValue(tb.Rows[i]["JOT_Voltage"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(11).SetCellValue("");
|
||||
// //recordSheet.GetRow(5 + i).GetCell(13).SetCellValue(tb.Rows[i]["JOT_PrepareTemp"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(14).SetCellValue(tb.Rows[i]["JOT_CellTemp"].ToString());
|
||||
// //recordSheet.GetRow(5 + i).GetCell(15).SetCellValue(tb.Rows[i]["JOT_LastTemp"].ToString());
|
||||
// //if (!string.IsNullOrEmpty(tb.Rows[i]["JOT_FaceCheckDate"].ToString()))
|
||||
// //{
|
||||
// // DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy-MM-DD HH:mm:ss.000");
|
||||
// // DateTime dateTime = DateTime.Parse(tb.Rows[i]["JOT_FaceCheckDate"].ToString());
|
||||
|
||||
// // recordSheet.GetRow(5 + i).GetCell(16).SetCellValue(dateTime.ToShortDateString());
|
||||
// //}
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// tb.TableName = "Table1";
|
||||
// BLL.Common.FastReportService.AddFastreportTable(tb);
|
||||
|
||||
// string initTemplatePath = "";
|
||||
// string rootPath = Server.MapPath("~/");
|
||||
|
||||
// initTemplatePath = "File\\Fastreport\\管道焊接工艺检查记录.frx";
|
||||
|
||||
// if (File.Exists(rootPath + initTemplatePath))
|
||||
// {
|
||||
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
//else if (printType.SelectedValue == "2")// 焊接工艺评定
|
||||
//{
|
||||
// Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
// keyValuePairs.Add("ISO_IsoNo", q.ISO_IsoNo);
|
||||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||||
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
|
||||
// var project = BLL.ProjectService.GetProjectByProjectId(q.ProjectId);
|
||||
// keyValuePairs.Add("ProjecctName", project.ProjectName);//工程名称
|
||||
// keyValuePairs.Add("InstallationName", install.InstallationName);
|
||||
// keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);//单位工程名称
|
||||
// keyValuePairs.Add("ISOName", q.ISO_IsoNumber);//设备名称
|
||||
// keyValuePairs.Add("ISO_Specification", q.ISO_Specification);//设备规格
|
||||
// var material = Base_MaterialService.GetMaterialByMaterialId(q.MaterialId);
|
||||
// keyValuePairs.Add("MaterialCode", material.MaterialCode);//设备材质
|
||||
|
||||
// String strSql1 = @"SELECT '' WED_Code, jointInfo.JOT_JointNo,--焊缝位置/焊缝编号
|
||||
// '' WED_Name,--焊工姓名 或钢印号
|
||||
// jointInfo.JOT_JointDesc,--焊缝规格mm
|
||||
// jointInfo.JOT_PrepareTemp, --预热温度 ℃
|
||||
// jointInfo.JOT_Electricity, --焊接电流 A
|
||||
// jointInfo.JOT_Voltage, --焊接电压 V
|
||||
// jointInfo.JOT_ID,
|
||||
// jointInfo.ProjectId,
|
||||
// jointInfo.JOT_WeldDate, -- 焊接日期
|
||||
// jointInfo.WeldingMethodName,
|
||||
// jointInfo.WeldSilk,
|
||||
// WED_Name1,WED_Name2,WED_Code1,WED_Code2
|
||||
// from View_JointInfo as jointInfo WHERE jointInfo.ProjectId= @projectId AND jointInfo.ISO_ID=@isoId ";
|
||||
|
||||
|
||||
// List<SqlParameter> listStr1 = new List<SqlParameter>
|
||||
//{
|
||||
// new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||||
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
|
||||
//};
|
||||
// if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
|
||||
// {
|
||||
// strSql1 += " AND jointInfo.JOT_JointNo LIKE @JOT_JointNo";
|
||||
// listStr1.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(this.dpIsHj.SelectedValue))
|
||||
// {
|
||||
// strSql1 += " AND jointInfo.is_hj = @is_hj";
|
||||
// listStr1.Add(new SqlParameter("@is_hj", this.dpIsHj.SelectedValue));
|
||||
// }
|
||||
// strSql1 += " order by JOT_JointNo ";
|
||||
|
||||
// SqlParameter[] parameter1 = listStr1.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
||||
// if (tb.Rows.Count > 0)
|
||||
// {
|
||||
|
||||
// keyValuePairs.Add("WeldingMethodName", tb.Rows[0]["WeldingMethodName"].ToString());//焊接方法
|
||||
// keyValuePairs.Add("WeldSilk", tb.Rows[0]["WeldSilk"].ToString());//焊接材料
|
||||
// }
|
||||
// for (int i = 0; i < tb.Rows.Count; i++)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// string WED_Name = "";
|
||||
// string WED_Code = "";
|
||||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name1"].ToString()))
|
||||
// {
|
||||
// WED_Name += tb.Rows[i]["WED_Name1"].ToString();
|
||||
// WED_Code += tb.Rows[i]["WED_Code1"].ToString();
|
||||
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Name2"].ToString()))
|
||||
// {
|
||||
// WED_Name += "," + tb.Rows[i]["WED_Name2"].ToString();
|
||||
// WED_Code += "," + tb.Rows[i]["WED_Code2"].ToString();
|
||||
|
||||
// }
|
||||
// tb.Rows[i]["WED_Name"] = WED_Name;
|
||||
// tb.Rows[i]["WED_Code"] = WED_Code;
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
// BLL.Common.FastReportService.ResetData();
|
||||
// BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
|
||||
// tb.TableName = "Table1";
|
||||
// BLL.Common.FastReportService.AddFastreportTable(tb);
|
||||
|
||||
// string initTemplatePath = "";
|
||||
// string rootPath = Server.MapPath("~/");
|
||||
|
||||
// initTemplatePath = "File\\Fastreport\\设备焊接工作记录.frx";
|
||||
|
||||
// if (File.Exists(rootPath + initTemplatePath))
|
||||
// {
|
||||
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//else if (printType.SelectedValue == "3")
|
||||
//{
|
||||
|
||||
// string varValue = string.Empty;
|
||||
// var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
// var workarea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||||
// var installationName = BLL.Project_InstallationService.GetInstallationByInstallationId(workarea.InstallationId).InstallationName;
|
||||
// var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
|
||||
// string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||||
// //模板文件
|
||||
// string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/管道焊接接头报检检查记录.xlsx";
|
||||
// //导出文件
|
||||
// string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
||||
// if (!Directory.Exists(filePath))
|
||||
// {
|
||||
// Directory.CreateDirectory(filePath);
|
||||
// }
|
||||
// string ReportFileName = filePath + "out.xlsx";
|
||||
|
||||
// FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
||||
// XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
||||
|
||||
// ICellStyle styleCenter = hssfworkbook.CreateCellStyle();
|
||||
// styleCenter.VerticalAlignment = VerticalAlignment.Center;
|
||||
// styleCenter.Alignment = HorizontalAlignment.Center;
|
||||
// styleCenter.BorderLeft = BorderStyle.Thin;
|
||||
// styleCenter.BorderTop = BorderStyle.Thin;
|
||||
// styleCenter.BorderRight = BorderStyle.Thin;
|
||||
// styleCenter.BorderBottom = BorderStyle.Thin;
|
||||
// styleCenter.WrapText = true;
|
||||
// IFont font = styleCenter.GetFont(hssfworkbook);
|
||||
// // font.Color = 10;//颜色
|
||||
// font.FontHeightInPoints = 10;//字体高度(与excel中的字号一致)
|
||||
// styleCenter.SetFont(font);
|
||||
// XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接接头报检检查记录");
|
||||
|
||||
// // recordSheet.AddMergedRegion(new CellRangeAddress(0, 0, 8, 9));
|
||||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||||
|
||||
|
||||
// //recordSheet.GetRow(0).CreateCell(14).SetCellValue(projectName.ToString());
|
||||
// recordSheet.GetRow(0).CreateCell(14).SetCellValue(installationName);
|
||||
// recordSheet.GetRow(0).GetCell(14).CellStyle = styleCenter;
|
||||
// recordSheet.GetRow(2).CreateCell(14).SetCellValue(workarea.WorkAreaName);
|
||||
// recordSheet.GetRow(2).GetCell(14).CellStyle = styleCenter;
|
||||
// recordSheet.GetRow(2).CreateCell(1).SetCellValue(unitName);
|
||||
// recordSheet.GetRow(2).GetCell(1).CellStyle = styleCenter;
|
||||
// recordSheet.GetRow(3).GetCell(8).CellStyle = styleCenter;
|
||||
// //recordSheet.GetRow(2).CreateCell(7).SetCellValue(q.CHT_CheckCode);
|
||||
// recordSheet.GetRow(2).GetCell(7).CellStyle = styleCenter;
|
||||
// int i = 0;
|
||||
// List<Model.View_JointInfo> items = Funs.DB.View_JointInfo.Where(x => x.ISO_ID == q.ISO_ID).ToList();
|
||||
// var ndtt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(items[0].DetectionTypeId);
|
||||
// if (ndtt != null)
|
||||
// {
|
||||
// recordSheet.GetRow(3).CreateCell(8).SetCellValue(ndtt.DetectionTypeCode);
|
||||
|
||||
// }
|
||||
// recordSheet.GetRow(3).CreateCell(14).SetCellValue(items.Count + "个");
|
||||
// recordSheet.GetRow(3).GetCell(14).CellStyle = styleCenter;
|
||||
// if (items.Count > 11)
|
||||
// {
|
||||
// recordSheet.ShiftRows(17, 19, items.Count - 11);
|
||||
// for (int j = 0; j < items.Count - 11; j++)
|
||||
// {
|
||||
// recordSheet.CopyRow(16 + j, 17 + j);
|
||||
// }
|
||||
// recordSheet.GetRow(items.Count + 7).Height = recordSheet.GetRow(items.Count + 5).Height;
|
||||
// recordSheet.GetRow(items.Count + 6).Height = recordSheet.GetRow(items.Count + 5).Height;
|
||||
|
||||
// }
|
||||
|
||||
// foreach (var t in items)
|
||||
// {
|
||||
|
||||
|
||||
// if (q != null)
|
||||
// {
|
||||
// var dDetectionRate = Funs.DB.Base_DetectionRate.FirstOrDefault(x => x.DetectionRateId == q.DetectionRateId);
|
||||
// if (dDetectionRate != null)
|
||||
// {
|
||||
// recordSheet.GetRow(3).CreateCell(18).SetCellValue(dDetectionRate.DetectionRateValue + "%");
|
||||
// recordSheet.GetRow(3).GetCell(18).CellStyle = styleCenter;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// recordSheet.GetRow(i + 6).CreateCell(0).SetCellValue((i + 1) + "");
|
||||
// recordSheet.GetRow(i + 6).GetCell(0).CellStyle = styleCenter;
|
||||
// recordSheet.GetRow(i + 6).CreateCell(1).SetCellValue(q.ISO_IsoNo);
|
||||
// recordSheet.GetRow(i + 6).GetCell(1).CellStyle = styleCenter;
|
||||
// recordSheet.GetRow(i + 6).CreateCell(3).SetCellValue(t.JOT_JointNo);
|
||||
// recordSheet.GetRow(i + 6).GetCell(3).CellStyle = styleCenter;
|
||||
// string welderCode = t.WED_Code1;
|
||||
// if (!string.IsNullOrEmpty(t.WED_Code2))
|
||||
// {
|
||||
// if (!string.IsNullOrEmpty(welderCode))
|
||||
// {
|
||||
// if (welderCode != t.WED_Code2)
|
||||
// {
|
||||
// welderCode += "," + t.WED_Code2;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// welderCode = t.WED_Code2;
|
||||
// }
|
||||
// }
|
||||
// recordSheet.GetRow(i + 6).CreateCell(4).SetCellValue(welderCode);
|
||||
// recordSheet.GetRow(i + 6).GetCell(4).CellStyle = styleCenter;
|
||||
// #region 查找委托中的检测类型并赋给检测类型变量
|
||||
|
||||
|
||||
|
||||
// recordSheet.GetRow(i + 6).CreateCell(6).SetCellValue(t.JOT_JointDesc);
|
||||
// recordSheet.GetRow(i + 6).GetCell(6).CellStyle = styleCenter;
|
||||
// recordSheet.GetRow(i + 6).CreateCell(7).SetCellValue(t.STE_Name1);
|
||||
// recordSheet.GetRow(i + 6).GetCell(7).CellStyle = styleCenter;
|
||||
|
||||
// recordSheet.GetRow(i + 6).CreateCell(10).SetCellValue(t.JOT_Location);
|
||||
// recordSheet.GetRow(i + 6).GetCell(10).CellStyle = styleCenter;
|
||||
|
||||
// recordSheet.GetRow(i + 6).CreateCell(11).SetCellValue(t.WeldingMethodName);
|
||||
// recordSheet.GetRow(i + 6).GetCell(11).CellStyle = styleCenter;
|
||||
|
||||
// string weldMat = "";
|
||||
// if (!string.IsNullOrEmpty(t.JOT_WeldSilk))
|
||||
// {
|
||||
// var consumables = Funs.DB.Base_Consumables.FirstOrDefault(x => x.ConsumablesId == t.JOT_WeldSilk);
|
||||
// if (consumables != null)
|
||||
// {
|
||||
// weldMat = consumables.ConsumablesName;
|
||||
// }
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(t.JOT_WeldMat))
|
||||
// {
|
||||
// var consumables = Funs.DB.Base_Consumables.FirstOrDefault(x => x.ConsumablesId == t.JOT_WeldMat);
|
||||
// if (consumables != null)
|
||||
// {
|
||||
// if (!string.IsNullOrEmpty(weldMat))
|
||||
// {
|
||||
// weldMat += "," + consumables.ConsumablesName;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// weldMat = consumables.ConsumablesName;
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// recordSheet.GetRow(i + 6).CreateCell(12).SetCellValue(weldMat);
|
||||
// recordSheet.GetRow(i + 6).GetCell(12).CellStyle = styleCenter;
|
||||
|
||||
// if (t.JOT_PrepareTemp.HasValue)
|
||||
// {
|
||||
// recordSheet.GetRow(i + 6).CreateCell(14).SetCellValue(t.JOT_PrepareTemp.Value.ToString("##.#"));
|
||||
// recordSheet.GetRow(i + 6).GetCell(14).CellStyle = styleCenter;
|
||||
|
||||
// }
|
||||
// recordSheet.GetRow(i + 6).CreateCell(16).SetCellValue("合格");
|
||||
// recordSheet.GetRow(i + 6).GetCell(16).CellStyle = styleCenter;
|
||||
// #endregion
|
||||
// // checkItems.Add(checkItem);
|
||||
// i++;
|
||||
|
||||
// }
|
||||
// using (FileStream filess = File.OpenWrite(ReportFileName))
|
||||
// {
|
||||
// hssfworkbook.Write(filess);
|
||||
// }
|
||||
// //PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
|
||||
|
||||
// FileInfo filet = new FileInfo(ReportFileName);
|
||||
// Response.Clear();
|
||||
// Response.Charset = "GB2312";
|
||||
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
// // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
|
||||
// Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接接头报检检查记录_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
|
||||
// // 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
||||
// Response.AddHeader("Content-Length", filet.Length.ToString());
|
||||
// // 指定返回的是一个不能被客户端读取的流,必须被下载
|
||||
// Response.ContentType = "application/ms-excel";
|
||||
// // 把文件流发送到客户端
|
||||
// Response.WriteFile(filet.FullName);
|
||||
// // 停止页面的执行
|
||||
// Response.End();
|
||||
//}
|
||||
|
||||
//else if (printType.SelectedValue == "4")
|
||||
//{
|
||||
|
||||
// Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
// var workArea = BLL.WorkAreaService.getWorkAreaByWorkAreaId(q.WorkAreaId);
|
||||
// var install = BLL.Project_InstallationService.GetInstallationByInstallationId(workArea.InstallationId);
|
||||
// var project = BLL.ProjectService.GetProjectByProjectId(q.ProjectId);
|
||||
// keyValuePairs.Add("ProjecctName", project.ProjectName);//工程名称
|
||||
// keyValuePairs.Add("WorkAreaName", workArea.WorkAreaName);//单位工程名称
|
||||
|
||||
|
||||
// String strSql1 = @" select iso.ISO_IsoNo,jot.JOT_JointNo,PointCount,RequiredT,ActualT,RequestTime,ActualTime,ProessDate,RecordChartNo ,m.MaterialCode,JOT_JointDesc
|
||||
// from PW_JointInfo jot left join PW_IsoInfo iso on jot.ISO_ID=iso.ISO_ID
|
||||
// left join HJGL_HotProess_Report hot on jot.JOT_ID = hot.WeldJointId
|
||||
// left join Base_Material m on jot.MaterialId=m.MaterialId WHERE hot.WeldJointId is not null and jot.ProjectId= @projectId AND jot.ISO_ID=@isoId ";
|
||||
|
||||
|
||||
// List<SqlParameter> listStr1 = new List<SqlParameter>
|
||||
// {
|
||||
// new SqlParameter("@projectId", this.CurrUser.LoginProjectId),
|
||||
// new SqlParameter("@isoId", this.tvControlItem.SelectedNodeID),
|
||||
// };
|
||||
// if (!string.IsNullOrEmpty(this.txtJOT_JointNo.Text.Trim()))
|
||||
// {
|
||||
// strSql1 += " AND jot.JOT_JointNo LIKE @JOT_JointNo";
|
||||
// listStr1.Add(new SqlParameter("@JOT_JointNo", "%" + this.txtJOT_JointNo.Text.Trim() + "%"));
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(this.dpIsHj.SelectedValue))
|
||||
// {
|
||||
// strSql1 += " AND jot.is_hj = @is_hj";
|
||||
// listStr1.Add(new SqlParameter("@is_hj", this.dpIsHj.SelectedValue));
|
||||
// }
|
||||
// strSql1 += " order by JOT_JointNo ";
|
||||
|
||||
// SqlParameter[] parameter1 = listStr1.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
||||
|
||||
// BLL.Common.FastReportService.ResetData();
|
||||
// BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
|
||||
// tb.TableName = "Table1";
|
||||
// BLL.Common.FastReportService.AddFastreportTable(tb);
|
||||
|
||||
// string initTemplatePath = "";
|
||||
// string rootPath = Server.MapPath("~/");
|
||||
|
||||
// initTemplatePath = "File\\Fastreport\\管道焊接接头热处理报告.frx";
|
||||
|
||||
// if (File.Exists(rootPath + initTemplatePath))
|
||||
// {
|
||||
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
|
||||
// }
|
||||
|
||||
//}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Alert.ShowInTop("请选择管线!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请选择施工区域!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user