|
|
|
@@ -151,7 +151,7 @@ namespace FineUIPro.Web.HJGL.TrustManage
|
|
|
|
|
var days = (from x in Funs.DB.CH_Trust
|
|
|
|
|
where x.InstallationId == e.Node.ParentNode.NodeID.Split('|')[1]
|
|
|
|
|
&& x.CH_TrustUnit == e.Node.ParentNode.ParentNode.NodeID
|
|
|
|
|
&& x.CH_TrustDate >= startDate && x.CH_TrustDate < endDate
|
|
|
|
|
&& x.CH_TrustDate >= startDate && x.CH_TrustDate < endDate && x.CH_TrustType == "1"
|
|
|
|
|
orderby x.CH_TrustDate
|
|
|
|
|
select x.CH_TrustDate).Distinct();
|
|
|
|
|
foreach (var day in days)
|
|
|
|
@@ -173,7 +173,7 @@ namespace FineUIPro.Web.HJGL.TrustManage
|
|
|
|
|
var trusts = from x in Funs.DB.CH_Trust
|
|
|
|
|
where x.InstallationId.ToString() == e.Node.ParentNode.ParentNode.NodeID.Split('|')[1]
|
|
|
|
|
&& x.CH_TrustUnit == e.Node.ParentNode.ParentNode.ParentNode.NodeID
|
|
|
|
|
&& x.CH_TrustDate == Convert.ToDateTime(e.Node.NodeID.Split('|')[3])
|
|
|
|
|
&& x.CH_TrustDate == Convert.ToDateTime(e.Node.NodeID.Split('|')[3]) && x.CH_TrustType=="1"
|
|
|
|
|
orderby x.CH_TrustCode
|
|
|
|
|
select x;
|
|
|
|
|
foreach (var trust in trusts)
|
|
|
|
@@ -647,7 +647,7 @@ namespace FineUIPro.Web.HJGL.TrustManage
|
|
|
|
|
|
|
|
|
|
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
|
|
|
|
keyValuePairs.Add("CH_TrustID", reportId);
|
|
|
|
|
keyValuePairs.Add("totalUnit", "中国成达工程有限公司");
|
|
|
|
|
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());
|
|
|
|
@@ -852,7 +852,7 @@ namespace FineUIPro.Web.HJGL.TrustManage
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(2).SetCellValue("中国成达工程有限公司");
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(2).SetCellValue("中国天辰工程有限公司");
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
@@ -873,7 +873,444 @@ namespace FineUIPro.Web.HJGL.TrustManage
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(2).SetCellValue("中国成达工程有限公司");
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(2).SetCellValue("中国天辰工程有限公司");
|
|
|
|
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(7).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// for (int i = 0; i < tb.Rows.Count; i++)
|
|
|
|
|
// {
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(0).SetCellValue("" + (i + 1));
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(1).SetCellValue(tb.Rows[i]["ISO_IsoNo"] != null ? tb.Rows[i]["ISO_IsoNo"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(2).SetCellValue(tb.Rows[i]["ISO_IsoNumber"] != null ? tb.Rows[i]["ISO_IsoNumber"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(3).SetCellValue(tb.Rows[i]["JOT_JointNo"] != null ? tb.Rows[i]["JOT_JointNo"].ToString() : "");
|
|
|
|
|
// //recordSheet.GetRow(7 + i).GetCell(4).SetCellValue(tb.Rows[i]["ISO_IsoNumber"] != null ? tb.Rows[i]["ISO_IsoNumber"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(7).SetCellValue(tb.Rows[i]["STE_Name1"] != null ? tb.Rows[i]["STE_Name1"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(6).SetCellValue(tb.Rows[i]["JOT_JointDesc"] != null ? tb.Rows[i]["JOT_JointDesc"].ToString() : "");
|
|
|
|
|
|
|
|
|
|
// string WED_Name = "";
|
|
|
|
|
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code1"].ToString()))
|
|
|
|
|
// WED_Name += tb.Rows[i]["WED_Code1"].ToString();
|
|
|
|
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code2"].ToString()) && WED_Name != tb.Rows[i]["WED_Code2"].ToString())
|
|
|
|
|
// WED_Name += " " + tb.Rows[i]["WED_Code2"].ToString();
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(5).SetCellValue(WED_Name);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected void btnPrint1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// string reportId = this.tvControlItem.SelectedNode.NodeID;
|
|
|
|
|
// var trust = BLL.TrustManageEditService.GetCH_TrustByID(reportId);
|
|
|
|
|
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;
|
|
|
|
|
var trust = BLL.TrustManageEditService.GetCH_TrustByID(reportId);
|
|
|
|
|
if (trust != null)
|
|
|
|
|
{
|
|
|
|
|
string varValue = string.Empty;
|
|
|
|
|
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(trust.InstallationId);
|
|
|
|
|
|
|
|
|
|
dr["ProjectName"] = projectName;
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
{
|
|
|
|
|
dr["CH_CheckUnit"] = BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustMan))
|
|
|
|
|
{
|
|
|
|
|
dr["CH_TrustMan"] = BLL.UserService.GetUserNameByUserId(trust.CH_TrustMan);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustCode))
|
|
|
|
|
{
|
|
|
|
|
dr["CH_TrustCode"] = trust.CH_TrustCode;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTCriteria))
|
|
|
|
|
{
|
|
|
|
|
dr["CH_NDTCriteria"] = trust.CH_NDTCriteria;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_WeldMethod))
|
|
|
|
|
{
|
|
|
|
|
var type = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(trust.CH_WeldMethod);
|
|
|
|
|
|
|
|
|
|
if (type != null)
|
|
|
|
|
{
|
|
|
|
|
dr["CH_WeldMethod"] = type.WeldingMethodName;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_AcceptGrade))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var list = BLL.TrustManageEditService.GetAcceptGradeList();
|
|
|
|
|
var grade = list.FirstOrDefault(x => x.Value == trust.CH_AcceptGrade);
|
|
|
|
|
if (grade != null)
|
|
|
|
|
{
|
|
|
|
|
dr["CH_AcceptGrade"] = grade.Text;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
|
|
|
|
{
|
|
|
|
|
var type = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
|
|
|
|
|
|
|
|
|
|
if (type != null)
|
|
|
|
|
{
|
|
|
|
|
dr["CH_NDTMethod"] = type.DetectionTypeName;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTRate))
|
|
|
|
|
{
|
|
|
|
|
var list = BLL.Base_DetectionRateService.GetNDTRateNameList();
|
|
|
|
|
var rate = list.FirstOrDefault(x => x.Value == trust.CH_NDTRate);
|
|
|
|
|
if (rate != null)
|
|
|
|
|
{
|
|
|
|
|
dr["CH_NDTRate"] = rate.Text;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_SlopeType))
|
|
|
|
|
{
|
|
|
|
|
var type = BLL.Base_GrooveTypeService.GetGrooveTypeByGrooveTypeId(trust.CH_SlopeType);
|
|
|
|
|
if (type != null)
|
|
|
|
|
{
|
|
|
|
|
dr["CH_SlopeType"] = type.GrooveTypeName;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string strSql = @"SELECT *
|
|
|
|
|
FROM dbo.View_CH_TrustItem jot
|
|
|
|
|
WHERE CH_TrustID=@CH_TrustID";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
listStr.Add(new SqlParameter("@CH_TrustID", tvControlItem.SelectedNodeID));
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
if (tb.Rows.Count > 0 && tb.Rows[0]["WorkAreaId"] != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var PworkArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == tb.Rows[0]["WorkAreaId"].ToString());
|
|
|
|
|
if (PworkArea != null)
|
|
|
|
|
{
|
|
|
|
|
//var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
//cel.SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
//cel.CellStyle = styleCenter;
|
|
|
|
|
dr["WorkAreaName"] = PworkArea.WorkAreaName;
|
|
|
|
|
dr["WorkAreaCode"] = PworkArea.WorkAreaCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dt.Rows.Add(dr);
|
|
|
|
|
|
|
|
|
|
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
|
|
|
|
keyValuePairs.Add("CH_TrustID", reportId);
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
{
|
|
|
|
|
keyValuePairs.Add("CheckUnit", BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
{
|
|
|
|
|
keyValuePairs.Add("ConUnit", BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BLL.Common.FastReport.ResetData();
|
|
|
|
|
BLL.Common.FastReport.AddFastreportTable(dt);
|
|
|
|
|
BLL.Common.FastReport.AddFastreportParameter(keyValuePairs);
|
|
|
|
|
|
|
|
|
|
// Session["Table"] = dt;
|
|
|
|
|
// Session["CH_TrustID"] = reportId;
|
|
|
|
|
string initTemplatePath = "";
|
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
var sysSet = Funs.DB.Project_Sys_Set.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.SetId == "3").FirstOrDefault();
|
|
|
|
|
if (sysSet != null && sysSet.IsAuto.HasValue && sysSet.IsAuto.Value)
|
|
|
|
|
{
|
|
|
|
|
initTemplatePath = "File\\Fastreport\\设备焊口检测委托单NoPic.frx";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
initTemplatePath = "File\\Fastreport\\设备焊口检测委托单.frx";
|
|
|
|
|
}
|
|
|
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("./Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//if (trust != null)
|
|
|
|
|
//{
|
|
|
|
|
// string varValue = string.Empty;
|
|
|
|
|
// var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
// var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(trust.InstallationId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// recordSheet.GetRow(1).CreateCell(8).SetCellValue(projectName.ToString());
|
|
|
|
|
// recordSheet.GetRow(1).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
// //recordSheet.GetRow(1).CreateCell(8).SetCellValue(installation.InstallationName);
|
|
|
|
|
// //recordSheet.GetRow(1).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
// {
|
|
|
|
|
// // recordSheet.AddMergedRegion(new CellRangeAddress(2, 2, 1, 2));
|
|
|
|
|
// var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
// cel.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustMan))
|
|
|
|
|
// {
|
|
|
|
|
// var cel = recordSheet.GetRow(3).CreateCell(5);
|
|
|
|
|
// cel.SetCellValue(BLL.UserService.GetUserNameByUserId(trust.CH_TrustMan));
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustCode))
|
|
|
|
|
// {
|
|
|
|
|
// var cel = recordSheet.GetRow(3).CreateCell(7);
|
|
|
|
|
// cel.SetCellValue(trust.CH_TrustCode);
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_NDTCriteria))
|
|
|
|
|
// {
|
|
|
|
|
// var cel = recordSheet.GetRow(4).CreateCell(7);
|
|
|
|
|
// cel.SetCellValue(trust.CH_NDTCriteria);
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_WeldMethod))
|
|
|
|
|
// {
|
|
|
|
|
// var type = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(trust.CH_WeldMethod);
|
|
|
|
|
|
|
|
|
|
// var cel = recordSheet.GetRow(5).CreateCell(5);
|
|
|
|
|
// if (type != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(type.WeldingMethodName);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_AcceptGrade))
|
|
|
|
|
// {
|
|
|
|
|
// var list = BLL.TrustManageEditService.GetAcceptGradeList();
|
|
|
|
|
// var grade = list.FirstOrDefault(x => x.Value == trust.CH_AcceptGrade);
|
|
|
|
|
// var cel = recordSheet.GetRow(5).CreateCell(7);
|
|
|
|
|
// if (grade != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(grade.Text);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
|
|
|
|
// {
|
|
|
|
|
// var type = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
|
|
|
|
|
// var cel = recordSheet.GetRow(6).CreateCell(1);
|
|
|
|
|
|
|
|
|
|
// if (type != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(type.DetectionTypeName);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_NDTRate))
|
|
|
|
|
// {
|
|
|
|
|
// var list = BLL.Base_DetectionRateService.GetNDTRateNameList();
|
|
|
|
|
// var rate = list.FirstOrDefault(x => x.Value == trust.CH_NDTRate);
|
|
|
|
|
// var cel = recordSheet.GetRow(6).CreateCell(7);
|
|
|
|
|
// if (rate != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(rate.Text);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_SlopeType))
|
|
|
|
|
// {
|
|
|
|
|
// var type = BLL.Base_GrooveTypeService.GetGrooveTypeByGrooveTypeId(trust.CH_SlopeType);
|
|
|
|
|
// var cel = recordSheet.GetRow(6).CreateCell(5);
|
|
|
|
|
// if (type != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(type.GrooveTypeName);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// string strSql = @"SELECT *
|
|
|
|
|
// FROM dbo.View_CH_TrustItem jot
|
|
|
|
|
// WHERE CH_TrustID=@CH_TrustID";
|
|
|
|
|
// List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
// listStr.Add(new SqlParameter("@CH_TrustID", tvControlItem.SelectedNodeID));
|
|
|
|
|
// SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
// if (tb.Rows.Count > 0 && tb.Rows[0]["WorkAreaId"] != null)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// var PworkArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == tb.Rows[0]["WorkAreaId"].ToString());
|
|
|
|
|
// if (PworkArea != null)
|
|
|
|
|
// {
|
|
|
|
|
// //var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
// //cel.SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
// //cel.CellStyle = styleCenter;
|
|
|
|
|
|
|
|
|
|
// recordSheet.GetRow(2).CreateCell(8).SetCellValue(PworkArea.WorkAreaName);
|
|
|
|
|
// recordSheet.GetRow(2).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
// recordSheet.GetRow(4).CreateCell(1).SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
// recordSheet.GetRow(4).GetCell(1).CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (tb.Rows.Count > 16)
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.ShiftRows(9, 28, tb.Rows.Count - 16);
|
|
|
|
|
// for (int j = 0; j < tb.Rows.Count - 16; j++)
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.CopyRow(8 + j, 9 + j);
|
|
|
|
|
// }
|
|
|
|
|
// var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
|
|
|
|
|
// if (unit != null && !string.IsNullOrEmpty(unit.UnitId))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(2).SetCellValue("中国天辰工程有限公司");
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).CreateCell(7).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
|
|
|
|
|
// if (unit != null && !string.IsNullOrEmpty(unit.UnitId))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(2).SetCellValue("中国天辰工程有限公司");
|
|
|
|
|
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
// {
|
|
|
|
@@ -945,266 +1382,267 @@ namespace FineUIPro.Web.HJGL.TrustManage
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnPrint1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string reportId = this.tvControlItem.SelectedNode.NodeID;
|
|
|
|
|
var trust = BLL.TrustManageEditService.GetCH_TrustByID(reportId);
|
|
|
|
|
if (trust != null)
|
|
|
|
|
{
|
|
|
|
|
string varValue = string.Empty;
|
|
|
|
|
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(trust.InstallationId);
|
|
|
|
|
|
|
|
|
|
//protected void btnPrint1_Click(object sender, EventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// string reportId = this.tvControlItem.SelectedNode.NodeID;
|
|
|
|
|
// var trust = BLL.TrustManageEditService.GetCH_TrustByID(reportId);
|
|
|
|
|
// if (trust != null)
|
|
|
|
|
// {
|
|
|
|
|
// string varValue = string.Empty;
|
|
|
|
|
// var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
|
|
|
|
// var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(trust.InstallationId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
// 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);
|
|
|
|
|
// 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("管道焊口检测委托单");
|
|
|
|
|
// 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));
|
|
|
|
|
// // recordSheet.AddMergedRegion(new CellRangeAddress(0, 0, 8, 9));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recordSheet.GetRow(1).CreateCell(8).SetCellValue(projectName.ToString());
|
|
|
|
|
recordSheet.GetRow(1).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
//recordSheet.GetRow(1).CreateCell(8).SetCellValue(installation.InstallationName);
|
|
|
|
|
//recordSheet.GetRow(1).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
{
|
|
|
|
|
// recordSheet.AddMergedRegion(new CellRangeAddress(2, 2, 1, 2));
|
|
|
|
|
var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
cel.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustMan))
|
|
|
|
|
{
|
|
|
|
|
var cel = recordSheet.GetRow(3).CreateCell(5);
|
|
|
|
|
cel.SetCellValue(BLL.UserService.GetUserNameByUserId(trust.CH_TrustMan));
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustCode))
|
|
|
|
|
{
|
|
|
|
|
var cel = recordSheet.GetRow(3).CreateCell(7);
|
|
|
|
|
cel.SetCellValue(trust.CH_TrustCode);
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTCriteria))
|
|
|
|
|
{
|
|
|
|
|
var cel = recordSheet.GetRow(4).CreateCell(7);
|
|
|
|
|
cel.SetCellValue(trust.CH_NDTCriteria);
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_WeldMethod))
|
|
|
|
|
{
|
|
|
|
|
var type = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(trust.CH_WeldMethod);
|
|
|
|
|
// recordSheet.GetRow(1).CreateCell(8).SetCellValue(projectName.ToString());
|
|
|
|
|
// recordSheet.GetRow(1).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
// //recordSheet.GetRow(1).CreateCell(8).SetCellValue(installation.InstallationName);
|
|
|
|
|
// //recordSheet.GetRow(1).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
// {
|
|
|
|
|
// // recordSheet.AddMergedRegion(new CellRangeAddress(2, 2, 1, 2));
|
|
|
|
|
// var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
// cel.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustMan))
|
|
|
|
|
// {
|
|
|
|
|
// var cel = recordSheet.GetRow(3).CreateCell(5);
|
|
|
|
|
// cel.SetCellValue(BLL.UserService.GetUserNameByUserId(trust.CH_TrustMan));
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustCode))
|
|
|
|
|
// {
|
|
|
|
|
// var cel = recordSheet.GetRow(3).CreateCell(7);
|
|
|
|
|
// cel.SetCellValue(trust.CH_TrustCode);
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_NDTCriteria))
|
|
|
|
|
// {
|
|
|
|
|
// var cel = recordSheet.GetRow(4).CreateCell(7);
|
|
|
|
|
// cel.SetCellValue(trust.CH_NDTCriteria);
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_WeldMethod))
|
|
|
|
|
// {
|
|
|
|
|
// var type = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(trust.CH_WeldMethod);
|
|
|
|
|
|
|
|
|
|
var cel = recordSheet.GetRow(5).CreateCell(5);
|
|
|
|
|
if (type != null)
|
|
|
|
|
{
|
|
|
|
|
cel.SetCellValue(type.WeldingMethodName);
|
|
|
|
|
}
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
// var cel = recordSheet.GetRow(5).CreateCell(5);
|
|
|
|
|
// if (type != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(type.WeldingMethodName);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_AcceptGrade))
|
|
|
|
|
{
|
|
|
|
|
var list = BLL.TrustManageEditService.GetAcceptGradeList();
|
|
|
|
|
var grade = list.FirstOrDefault(x => x.Value == trust.CH_AcceptGrade);
|
|
|
|
|
var cel = recordSheet.GetRow(5).CreateCell(7);
|
|
|
|
|
if (grade != null)
|
|
|
|
|
{
|
|
|
|
|
cel.SetCellValue(grade.Text);
|
|
|
|
|
}
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
|
|
|
|
{
|
|
|
|
|
var type = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
|
|
|
|
|
var cel = recordSheet.GetRow(6).CreateCell(1);
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_AcceptGrade))
|
|
|
|
|
// {
|
|
|
|
|
// var list = BLL.TrustManageEditService.GetAcceptGradeList();
|
|
|
|
|
// var grade = list.FirstOrDefault(x => x.Value == trust.CH_AcceptGrade);
|
|
|
|
|
// var cel = recordSheet.GetRow(5).CreateCell(7);
|
|
|
|
|
// if (grade != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(grade.Text);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
|
|
|
|
// {
|
|
|
|
|
// var type = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
|
|
|
|
|
// var cel = recordSheet.GetRow(6).CreateCell(1);
|
|
|
|
|
|
|
|
|
|
if (type != null)
|
|
|
|
|
{
|
|
|
|
|
cel.SetCellValue(type.DetectionTypeName);
|
|
|
|
|
}
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
// if (type != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(type.DetectionTypeName);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_NDTRate))
|
|
|
|
|
{
|
|
|
|
|
var list = BLL.Base_DetectionRateService.GetNDTRateNameList();
|
|
|
|
|
var rate = list.FirstOrDefault(x => x.Value == trust.CH_NDTRate);
|
|
|
|
|
var cel = recordSheet.GetRow(6).CreateCell(7);
|
|
|
|
|
if (rate != null)
|
|
|
|
|
{
|
|
|
|
|
cel.SetCellValue(rate.Text);
|
|
|
|
|
}
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_NDTRate))
|
|
|
|
|
// {
|
|
|
|
|
// var list = BLL.Base_DetectionRateService.GetNDTRateNameList();
|
|
|
|
|
// var rate = list.FirstOrDefault(x => x.Value == trust.CH_NDTRate);
|
|
|
|
|
// var cel = recordSheet.GetRow(6).CreateCell(7);
|
|
|
|
|
// if (rate != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(rate.Text);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_SlopeType))
|
|
|
|
|
{
|
|
|
|
|
var type = BLL.Base_GrooveTypeService.GetGrooveTypeByGrooveTypeId(trust.CH_SlopeType);
|
|
|
|
|
var cel = recordSheet.GetRow(6).CreateCell(5);
|
|
|
|
|
if (type != null)
|
|
|
|
|
{
|
|
|
|
|
cel.SetCellValue(type.GrooveTypeName);
|
|
|
|
|
}
|
|
|
|
|
cel.CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_SlopeType))
|
|
|
|
|
// {
|
|
|
|
|
// var type = BLL.Base_GrooveTypeService.GetGrooveTypeByGrooveTypeId(trust.CH_SlopeType);
|
|
|
|
|
// var cel = recordSheet.GetRow(6).CreateCell(5);
|
|
|
|
|
// if (type != null)
|
|
|
|
|
// {
|
|
|
|
|
// cel.SetCellValue(type.GrooveTypeName);
|
|
|
|
|
// }
|
|
|
|
|
// cel.CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
string strSql = @"SELECT *
|
|
|
|
|
FROM dbo.View_CH_TrustItem jot
|
|
|
|
|
WHERE CH_TrustID=@CH_TrustID";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
listStr.Add(new SqlParameter("@CH_TrustID", tvControlItem.SelectedNodeID));
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
if (tb.Rows.Count > 0 && tb.Rows[0]["WorkAreaId"] != null)
|
|
|
|
|
{
|
|
|
|
|
// string strSql = @"SELECT *
|
|
|
|
|
// FROM dbo.View_CH_TrustItem jot
|
|
|
|
|
// WHERE CH_TrustID=@CH_TrustID";
|
|
|
|
|
// List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
// listStr.Add(new SqlParameter("@CH_TrustID", tvControlItem.SelectedNodeID));
|
|
|
|
|
// SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
// if (tb.Rows.Count > 0 && tb.Rows[0]["WorkAreaId"] != null)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
var PworkArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == tb.Rows[0]["WorkAreaId"].ToString());
|
|
|
|
|
if (PworkArea != null)
|
|
|
|
|
{
|
|
|
|
|
//var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
//cel.SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
//cel.CellStyle = styleCenter;
|
|
|
|
|
// var PworkArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == tb.Rows[0]["WorkAreaId"].ToString());
|
|
|
|
|
// if (PworkArea != null)
|
|
|
|
|
// {
|
|
|
|
|
// //var cel = recordSheet.GetRow(3).CreateCell(1);
|
|
|
|
|
// //cel.SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
// //cel.CellStyle = styleCenter;
|
|
|
|
|
|
|
|
|
|
recordSheet.GetRow(2).CreateCell(8).SetCellValue(PworkArea.WorkAreaName);
|
|
|
|
|
recordSheet.GetRow(2).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
recordSheet.GetRow(4).CreateCell(1).SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
recordSheet.GetRow(4).GetCell(1).CellStyle = styleCenter;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// recordSheet.GetRow(2).CreateCell(8).SetCellValue(PworkArea.WorkAreaName);
|
|
|
|
|
// recordSheet.GetRow(2).GetCell(8).CellStyle = styleCenter;
|
|
|
|
|
// recordSheet.GetRow(4).CreateCell(1).SetCellValue(PworkArea.WorkAreaCode);
|
|
|
|
|
// recordSheet.GetRow(4).GetCell(1).CellStyle = styleCenter;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tb.Rows.Count > 16)
|
|
|
|
|
{
|
|
|
|
|
recordSheet.ShiftRows(9, 28, tb.Rows.Count - 16);
|
|
|
|
|
for (int j = 0; j < tb.Rows.Count - 16; j++)
|
|
|
|
|
{
|
|
|
|
|
recordSheet.CopyRow(8 + j, 9 + j);
|
|
|
|
|
}
|
|
|
|
|
var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
|
|
|
|
|
if (unit != null && !string.IsNullOrEmpty(unit.UnitId))
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
// if (tb.Rows.Count > 16)
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.ShiftRows(9, 28, tb.Rows.Count - 16);
|
|
|
|
|
// for (int j = 0; j < tb.Rows.Count - 16; j++)
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.CopyRow(8 + j, 9 + j);
|
|
|
|
|
// }
|
|
|
|
|
// var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
|
|
|
|
|
// if (unit != null && !string.IsNullOrEmpty(unit.UnitId))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(2).SetCellValue("中国成达工程有限公司");
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
// }
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(2).SetCellValue("中国天辰工程有限公司");
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(20 + tb.Rows.Count - 16).CreateCell(7).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
// }
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20 + tb.Rows.Count - 16).CreateCell(7).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
|
|
|
|
|
if (unit != null && !string.IsNullOrEmpty(unit.UnitId))
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(20).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == trust.ProjectId && x.UnitType == Const.ProjectUnitType_3);
|
|
|
|
|
// if (unit != null && !string.IsNullOrEmpty(unit.UnitId))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(0).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(unit.UnitId).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
recordSheet.GetRow(20).GetCell(2).SetCellValue("中国成达工程有限公司");
|
|
|
|
|
// }
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(2).SetCellValue("中国天辰工程有限公司");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(20).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_TrustUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(5).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_TrustUnit).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(20).GetCell(7).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
// if (!string.IsNullOrEmpty(trust.CH_CheckUnit))
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(20).GetCell(7).SetCellValue(BLL.UnitService.GetUnitNameByUnitId(trust.CH_CheckUnit).ToString());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < tb.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
recordSheet.GetRow(8 + i).GetCell(0).SetCellValue("" + (i + 1));
|
|
|
|
|
recordSheet.GetRow(8 + i).GetCell(1).SetCellValue(tb.Rows[i]["ISO_IsoNo"] != null ? tb.Rows[i]["ISO_IsoNo"].ToString() : "");
|
|
|
|
|
//recordSheet.GetRow(8 + i).GetCell(2).SetCellValue(tb.Rows[i]["ISO_IsoNumber"] != null ? tb.Rows[i]["ISO_IsoNumber"].ToString() : "");
|
|
|
|
|
recordSheet.GetRow(8 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"] != null ? tb.Rows[i]["JOT_JointNo"].ToString() : "");
|
|
|
|
|
//recordSheet.GetRow(7 + i).GetCell(4).SetCellValue(tb.Rows[i]["ISO_IsoNumber"] != null ? tb.Rows[i]["ISO_IsoNumber"].ToString() : "");
|
|
|
|
|
recordSheet.GetRow(8 + i).GetCell(7).SetCellValue(tb.Rows[i]["STE_Name1"] != null ? tb.Rows[i]["STE_Name1"].ToString() : "");
|
|
|
|
|
recordSheet.GetRow(8 + i).GetCell(6).SetCellValue(tb.Rows[i]["JOT_JointDesc"] != null ? tb.Rows[i]["JOT_JointDesc"].ToString() : "");
|
|
|
|
|
// }
|
|
|
|
|
// for (int i = 0; i < tb.Rows.Count; i++)
|
|
|
|
|
// {
|
|
|
|
|
// try
|
|
|
|
|
// {
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(0).SetCellValue("" + (i + 1));
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(1).SetCellValue(tb.Rows[i]["ISO_IsoNo"] != null ? tb.Rows[i]["ISO_IsoNo"].ToString() : "");
|
|
|
|
|
// //recordSheet.GetRow(8 + i).GetCell(2).SetCellValue(tb.Rows[i]["ISO_IsoNumber"] != null ? tb.Rows[i]["ISO_IsoNumber"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(2).SetCellValue(tb.Rows[i]["JOT_JointNo"] != null ? tb.Rows[i]["JOT_JointNo"].ToString() : "");
|
|
|
|
|
// //recordSheet.GetRow(7 + i).GetCell(4).SetCellValue(tb.Rows[i]["ISO_IsoNumber"] != null ? tb.Rows[i]["ISO_IsoNumber"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(7).SetCellValue(tb.Rows[i]["STE_Name1"] != null ? tb.Rows[i]["STE_Name1"].ToString() : "");
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(6).SetCellValue(tb.Rows[i]["JOT_JointDesc"] != null ? tb.Rows[i]["JOT_JointDesc"].ToString() : "");
|
|
|
|
|
|
|
|
|
|
string WED_Name = "";
|
|
|
|
|
if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code1"].ToString()))
|
|
|
|
|
WED_Name += tb.Rows[i]["WED_Code1"].ToString();
|
|
|
|
|
// string WED_Name = "";
|
|
|
|
|
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code1"].ToString()))
|
|
|
|
|
// WED_Name += tb.Rows[i]["WED_Code1"].ToString();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code2"].ToString()) && WED_Name != tb.Rows[i]["WED_Code2"].ToString())
|
|
|
|
|
WED_Name += " " + tb.Rows[i]["WED_Code2"].ToString();
|
|
|
|
|
recordSheet.GetRow(8 + i).GetCell(5).SetCellValue(WED_Name);
|
|
|
|
|
// if (!string.IsNullOrEmpty(tb.Rows[i]["WED_Code2"].ToString()) && WED_Name != tb.Rows[i]["WED_Code2"].ToString())
|
|
|
|
|
// WED_Name += " " + tb.Rows[i]["WED_Code2"].ToString();
|
|
|
|
|
// recordSheet.GetRow(8 + i).GetCell(5).SetCellValue(WED_Name);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
// }
|
|
|
|
|
// catch (Exception)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
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)));
|
|
|
|
|
// 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
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 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
|
|
|
|
|
// {
|
|
|
|
|
// Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|