Merge branch 'master' of http://47.104.102.122:3000/panhf/CNCEC_SUBQHSE_WUHUAN
This commit is contained in:
@@ -418,13 +418,14 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
var lists = BLL.JointCheckService.GetDriverPlanByProjectId(this.CurrUser.LoginProjectId);
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("质量专项检查模版.xlsx", "质量专项检查.xlsx");
|
||||
newUrl = uploadfilepath.Replace("质量专项检查模版.xls", "质量专项检查.xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -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;
|
||||
using System.Web.UI;
|
||||
@@ -230,6 +231,152 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.ConTechnologyDisclosureTempUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_ConTechnologyDisclosure
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (this.drpProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == this.drpProfessionalId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtCode.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.DisclosureCode.Contains(this.txtCode.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.UnitId);
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("施工技术交底管理模板.xls", "施工技术交底管理.xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 1;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DisclosureCode);//交底文件编号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DisclosureName);//交底施工方案
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitId))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
|
||||
}
|
||||
cell.SetCellValue(unitName);//交底负责单位
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DisclosureMan);//交底人
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DisclosureDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.DisclosureDate) : "");//交底日期
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWork = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWork = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWork);//单位工程
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.AttendMan);//参加人员
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
|
||||
+9
@@ -111,6 +111,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Hidden="true" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -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.CQMS.Comprehensive
|
||||
@@ -320,5 +321,226 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.CQMS_DataReceivingDocTempUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_DataReceivingDoc
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (!string.IsNullOrEmpty(this.stxtFileCode.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.FileCode.Contains(stxtFileCode.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.stxtFileName.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.FileName.Contains(this.stxtFileName.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.RemarkCode);
|
||||
if (lists != null)
|
||||
{
|
||||
string projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
newUrl = uploadfilepath.Replace("资料收发文登记记录导入模板", "资料收发文登记记录(" + projectName + "" + DateTime.Now.ToString("yyyyMMdd") + ")");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 3;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReceiveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ReceiveDate) : "");//日期
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.FileCode);//文件号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.FileName);//文件名称
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.FileType);//文件类别
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.SendUnit))
|
||||
{
|
||||
unitName = BLL.UnitService.GetUnitNameByUnitId(item.SendUnit);
|
||||
}
|
||||
cell.SetCellValue(unitName);//发件单位
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SendMan);//发件人
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Copies.HasValue ? item.Copies.ToString() : "");//份数
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DocumentHandler);//文件处理人
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SendDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.SendDate) : "");//发出日期
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
string receiveUnitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.ReceiveUnit))
|
||||
{
|
||||
receiveUnitName = ConvertCarryUnit(item.ReceiveUnit);
|
||||
}
|
||||
cell.SetCellValue(receiveUnitName);//接收单位
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReceiveMan);//接收人
|
||||
|
||||
cell = row.CreateCell(12);
|
||||
cell.CellStyle = cellStyle;
|
||||
string isR = string.Empty;
|
||||
if (item.IsReply.HasValue)
|
||||
{
|
||||
if (item.IsReply == true)
|
||||
{
|
||||
isR = "是";
|
||||
}
|
||||
else if (item.IsReply == false)
|
||||
{
|
||||
isR = "否";
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(isR);//是否需回复
|
||||
|
||||
cell = row.CreateCell(13);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ReturnWuhuangDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ReturnWuhuangDate) : "");//返回五环日期
|
||||
|
||||
cell = row.CreateCell(14);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RetrunWuhuangCopies.HasValue ? item.RetrunWuhuangCopies.ToString() : "");//返回五环份数
|
||||
|
||||
cell = row.CreateCell(15);
|
||||
cell.CellStyle = cellStyle;
|
||||
string issueToUnitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.IssueToUnit))
|
||||
{
|
||||
issueToUnitName = ConvertCarryUnit(item.IssueToUnit);
|
||||
}
|
||||
cell.SetCellValue(issueToUnitName);//下发至单位
|
||||
|
||||
cell = row.CreateCell(16);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.IssueCopies.HasValue ? item.IssueCopies.ToString() : "");//下发份数
|
||||
|
||||
cell = row.CreateCell(17);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.IssueUnitReceiver);//下发单位接收人
|
||||
|
||||
cell = row.CreateCell(18);
|
||||
cell.CellStyle = cellStyle;
|
||||
string isO = string.Empty;
|
||||
if (item.IsOnFile.HasValue)
|
||||
{
|
||||
if (item.IsOnFile == true)
|
||||
{
|
||||
isO = "是";
|
||||
}
|
||||
else if (item.IsOnFile == false)
|
||||
{
|
||||
isO = "否";
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(isO);//是否存档
|
||||
|
||||
cell = row.CreateCell(19);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.RemarkCode);//标志编号
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 2; i < ir; i++)
|
||||
{
|
||||
string row0 = pds.Rows[i][0].ToString();
|
||||
if (string.IsNullOrEmpty(row0))
|
||||
@@ -263,7 +263,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
string row9 = pds.Rows[i][9].ToString();
|
||||
if (string.IsNullOrEmpty(row9))
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "发出日期" + "," + "此项为必填项!" + "|";
|
||||
result += (i + 2).ToString() + "," + "上报日期" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -273,7 +273,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "发出日期" + "," + "格式错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "上报日期" + "," + "格式错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
var unit = units.Where(x => x.UnitName == u.Trim()).FirstOrDefault();
|
||||
if (unit == null)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "接收单位" + "," + "[" + u.Trim() + "]不存在!" + "|";
|
||||
result += (i + 2).ToString() + "," + "上报接收单位" + "," + "[" + u.Trim() + "]不存在!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 2; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_DataReceivingDoc oldViewInfo = new Model.Comprehensive_DataReceivingDoc();
|
||||
var cn = cns.Where(y => y.ProfessionalName == pds.Rows[i][4].ToString().Trim()).FirstOrDefault();
|
||||
|
||||
@@ -60,10 +60,10 @@
|
||||
<Items>
|
||||
<f:FormRow ColumnWidths="33% 67%">
|
||||
<Items>
|
||||
<f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="发出日期" ID="txtSendDate"
|
||||
<f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="上报日期" ID="txtSendDate"
|
||||
LabelAlign="Right" LabelWidth="130px">
|
||||
</f:DatePicker>
|
||||
<f:DropDownList ID="drpReceiveUnit" runat="server" Label="接收单位" EnableCheckBoxSelect="true" EnableMultiSelect="true" AutoSelectFirstItem="false" LabelAlign="Right" LabelWidth="130px"></f:DropDownList>
|
||||
<f:DropDownList ID="drpReceiveUnit" runat="server" Label="上报接收单位" EnableCheckBoxSelect="true" EnableMultiSelect="true" AutoSelectFirstItem="false" LabelAlign="Right" LabelWidth="130px"></f:DropDownList>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
@@ -115,6 +115,13 @@
|
||||
</f:GroupPanel>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtRemarkCode" runat="server" Label="标志编号" Required="true" ShowRedStar="true" LabelAlign="Right" LabelWidth="130px"></f:TextBox>
|
||||
<f:Label ID="Label1" runat="server"></f:Label>
|
||||
<f:Label ID="Label3" runat="server"></f:Label>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<%--<f:FormRow>
|
||||
<Items>
|
||||
<f:Panel ID="Panel2" ShowHeader="false" ShowBorder="false" Layout="Column" CssClass="" runat="server">
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtIssueCopies.Readonly = true;
|
||||
this.txtIssueUnitReceiver.Readonly = true;
|
||||
this.rblIsOnFile.Readonly = true;
|
||||
this.txtRemarkCode.Readonly = true;
|
||||
//this.drpAudit.Readonly = true;
|
||||
//this.btnAttach.Enabled = false;
|
||||
}
|
||||
@@ -152,6 +153,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.rblIsOnFile.SelectedValue = "false";
|
||||
}
|
||||
}
|
||||
this.txtRemarkCode.Text = dataReceivingDoc.RemarkCode;
|
||||
|
||||
//var currApprove = DataReceivingDocApproveService.GetCurrentApprove(dataReceivingDoc.DataReceivingDocId);
|
||||
//if (currApprove != null)
|
||||
@@ -210,6 +212,13 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var q = Funs.DB.Comprehensive_DataReceivingDoc.FirstOrDefault(x => x.RemarkCode == this.txtRemarkCode.Text.Trim() && (x.DataReceivingDocId != this.DataReceivingDocId || (this.DataReceivingDocId == null && x.DataReceivingDocId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("标志编号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.Comprehensive_DataReceivingDoc dataReceivingDoc = new Model.Comprehensive_DataReceivingDoc();
|
||||
dataReceivingDoc.ProjectId = this.CurrUser.LoginProjectId;
|
||||
dataReceivingDoc.FileCode = this.txtFileCode.Text.Trim();
|
||||
@@ -265,6 +274,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
dataReceivingDoc.IsOnFile = Convert.ToBoolean(this.rblIsOnFile.SelectedValue);
|
||||
}
|
||||
dataReceivingDoc.RemarkCode = this.txtRemarkCode.Text.Trim();
|
||||
//if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
//{
|
||||
// dataReceivingDoc.AuditMan = drpAudit.SelectedValue;
|
||||
|
||||
@@ -264,6 +264,33 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rblIsOnFile;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemarkCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtRemarkCode;
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
/// <summary>
|
||||
/// Label3 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label3;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
@@ -242,33 +243,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
//public string ConvertState(object value)
|
||||
//{
|
||||
// var status = 0;
|
||||
// int.TryParse(value.ToString(), out status);
|
||||
|
||||
// if (status == 0)
|
||||
// {
|
||||
// return "待审核";
|
||||
// }
|
||||
// else if (status == 1)
|
||||
// {
|
||||
// return "合格";
|
||||
// }
|
||||
// else if (status == 2)
|
||||
// {
|
||||
// return "驳回";
|
||||
// }
|
||||
// else if (status == 3)
|
||||
// {
|
||||
// return "重报";
|
||||
// }
|
||||
// return "待审核";
|
||||
//}
|
||||
|
||||
|
||||
|
||||
#region 格式化字符串
|
||||
public static string ConvertState(object Status)
|
||||
{
|
||||
if (Status != null)
|
||||
@@ -297,8 +272,182 @@ namespace FineUIPro.Web.Comprehensive
|
||||
|
||||
return "编制";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.InspectionEquipmentTempUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_InspectionEquipment
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (this.sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == this.sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.stxtInspectionName.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.InspectionName.Contains(this.stxtInspectionName.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.InspectionDate >= Funs.GetNewDateTime(txtStarTime.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.InspectionDate <= Funs.GetNewDateTime(txtEndTime.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.UnitId);
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("设备材料报验模板.xls", "设备材料报验.xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 1;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(item.UnitId));//报验单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionCode);//报验编号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.EquipmentNO);//设备位号
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
cell.SetCellValue(cnp.ProfessionalName);//专业
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.SetCellValue(string.Empty);//专业
|
||||
}
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionName);//名称
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Specifications);//规格(范围)
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Supplier);//供货厂商
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Counts);//本次数量
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Unit);//单位
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SamplingCount);//本次抽检数量
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
string r = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.SamplingResult))
|
||||
{
|
||||
if (item.SamplingResult == "1")
|
||||
{
|
||||
r = "合格";
|
||||
}
|
||||
else if (item.SamplingResult == "2")
|
||||
{
|
||||
r = "不合格";
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(r);//本次抽检结果
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.InspectionDate) : "");//报验日期
|
||||
|
||||
cell = row.CreateCell(12);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.UsedPlace);//拟使用部位
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
+37
-30
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class InspectionEquipment
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive {
|
||||
|
||||
|
||||
public partial class InspectionEquipment {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolSearch 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar ToolSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpUnitId 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpUnitId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// stxtInspectionName 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox stxtInspectionName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtStarTime 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtStarTime;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label1 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Label Label1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtEndTime 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DatePicker txtEndTime;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +119,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +128,16 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtStatus 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label txtStatus;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// lbtnFileUrl 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnFileUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
@@ -211,7 +218,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
@@ -220,7 +227,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -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.Comprehensive
|
||||
{
|
||||
@@ -295,5 +296,186 @@ namespace FineUIPro.Web.Comprehensive
|
||||
|
||||
return "编制";
|
||||
}
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.InspectionMachineTempUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_InspectionMachine
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (this.sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == this.sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (sdrpCNProfessional.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == this.sdrpCNProfessional.SelectedValue);
|
||||
}
|
||||
if (sdrpType.SelectedValue != "")
|
||||
{
|
||||
lists = lists.Where(x => x.InspectionType == this.sdrpType.SelectedValue);
|
||||
}
|
||||
lists = lists.OrderBy(x => x.UnitId);
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("机具报验模板.xls", "机具报验.xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 1;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(item.UnitId));//报验单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionMachineCode);//报验编号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionMachineName);//名称
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionType);//类型
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.SpecificationModel);//规格型号
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.NextTestDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.NextTestDate) : "");//下次检验日期
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.TestCycle);//检验周期
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
string isV = string.Empty;
|
||||
if(item.IsVerification.HasValue)
|
||||
{
|
||||
if (item.IsVerification==true)
|
||||
{
|
||||
isV = "是";
|
||||
}
|
||||
else if(item.IsVerification == false)
|
||||
{
|
||||
isV = "否";
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(isV);//是否在校验期内
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.InspectionDate) : "");//报验日期
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
string isO = string.Empty;
|
||||
if (item.IsOnSite.HasValue)//是否在场
|
||||
{
|
||||
if (item.IsOnSite == true)
|
||||
{
|
||||
isO = "是";
|
||||
}
|
||||
else if (item.IsOnSite == false)
|
||||
{
|
||||
isO = "否";
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(isO);//是否在校验期内
|
||||
|
||||
cell = row.CreateCell(11);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.UnitsCount.HasValue ? item.UnitsCount.ToString() : "");//台数
|
||||
|
||||
cell = row.CreateCell(12);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.LeaveDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.LeaveDate) : "");//离场时间
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+35
-28
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class InspectionMachine
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive {
|
||||
|
||||
|
||||
public partial class InspectionMachine {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolSearch 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar ToolSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpUnitId 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpUnitId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpCNProfessional 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpCNProfessional;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpType 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpType;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,16 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +128,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtStatus 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +137,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label txtStatus;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// lbtnFileUrl 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnFileUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Icon="PackageIn" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
@@ -363,6 +364,167 @@ namespace FineUIPro.Web.Comprehensive
|
||||
return "编制";
|
||||
}
|
||||
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.InspectionPersonTempUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_InspectionPerson
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (this.sdrpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.UnitId == this.sdrpUnitId.SelectedValue);
|
||||
}
|
||||
if (sdrpPost.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.PostId == this.sdrpPost.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.stxtPersonName.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.PersonName.Contains(this.stxtPersonName.Text.Trim()));
|
||||
}
|
||||
lists = lists.OrderBy(x => x.UnitId);
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("人员报验模板.xls", "人员报验.xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 1;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(BLL.UnitService.GetUnitNameByUnitId(item.UnitId));//报验单位
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.InspectionPersonCode);//报验编号
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
string unitWork = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.UnitWorkId))
|
||||
{
|
||||
unitWork = ConvertUnitWork(item.UnitWorkId);
|
||||
}
|
||||
cell.SetCellValue(unitWork);//单位工程名称
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
string postName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(item.PostId))
|
||||
{
|
||||
var post = BLL.PostService.GetPostById(item.PostId);
|
||||
if (post!=null)
|
||||
{
|
||||
postName = post.PostName;
|
||||
}
|
||||
}
|
||||
cell.SetCellValue(postName);//工种
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.PersonName);//姓名
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.CertificateNumber);//证书编号
|
||||
|
||||
cell = row.CreateCell(7);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.QualifiedProjectCode);//合格项目代号(级别)
|
||||
|
||||
cell = row.CreateCell(8);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ValidityDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ValidityDate) : "");//有效期
|
||||
|
||||
cell = row.CreateCell(9);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.ApprovalTime.HasValue ? string.Format("{0:yyyy-MM-dd}", item.ApprovalTime) : "");//批准时间
|
||||
|
||||
cell = row.CreateCell(10);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.DepartureTime.HasValue ? string.Format("{0:yyyy-MM-dd}", item.DepartureTime) : "");//离场时间
|
||||
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,11 @@
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive
|
||||
{
|
||||
|
||||
|
||||
public partial class InspectionPerson
|
||||
{
|
||||
|
||||
namespace FineUIPro.Web.Comprehensive {
|
||||
|
||||
|
||||
public partial class InspectionPerson {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolSearch 控件。
|
||||
/// </summary>
|
||||
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar ToolSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpUnitId 控件。
|
||||
/// </summary>
|
||||
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpUnitId;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// sdrpPost 控件。
|
||||
/// </summary>
|
||||
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList sdrpPost;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// stxtPersonName 控件。
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox stxtPersonName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSearch;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
@@ -112,7 +110,16 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
@@ -121,7 +128,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Label2 控件。
|
||||
/// </summary>
|
||||
@@ -130,7 +137,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// txtStatus 控件。
|
||||
/// </summary>
|
||||
@@ -139,7 +146,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label txtStatus;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// lbtnFileUrl 控件。
|
||||
/// </summary>
|
||||
@@ -148,7 +155,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtnFileUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarText1 控件。
|
||||
/// </summary>
|
||||
@@ -157,7 +164,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarText ToolbarText1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ddlPageSize 控件。
|
||||
/// </summary>
|
||||
@@ -166,7 +173,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList ddlPageSize;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
@@ -175,7 +182,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window2 控件。
|
||||
/// </summary>
|
||||
@@ -184,7 +191,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window2;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Window3 控件。
|
||||
/// </summary>
|
||||
@@ -193,7 +200,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window3;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WindowAtt 控件。
|
||||
/// </summary>
|
||||
@@ -202,7 +209,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window WindowAtt;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
@@ -211,7 +218,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
@@ -220,7 +227,7 @@ namespace FineUIPro.Web.Comprehensive
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Hidden="true" Icon="PackageIn" runat="server" OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -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;
|
||||
using System.Web.UI;
|
||||
@@ -202,7 +203,134 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("TrainingRecordsDataIn.aspx", "导入 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = Const.TrainingRecordsTempUrl;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
|
||||
var lists = (from x in Funs.DB.Comprehensive_TrainingRecords
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x);
|
||||
if (drpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
lists = lists.Where(x => x.CNProfessionalId == drpCNProfessionalId.SelectedValue);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtTrainingContents.Text.Trim()))
|
||||
{
|
||||
lists = lists.Where(x => x.TrainingContents.Contains(this.txtTrainingContents.Text.Trim()));
|
||||
}
|
||||
if (lists != null)
|
||||
{
|
||||
newUrl = uploadfilepath.Replace("培训记录模板.xls", "培训记录.xls");
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
// 第一步:读取文件流
|
||||
NPOI.SS.UserModel.IWorkbook workbook;
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
|
||||
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||
}
|
||||
// 创建单元格样式
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
|
||||
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
NPOI.SS.UserModel.ICell cell;
|
||||
int i = 1;
|
||||
foreach (var item in lists)
|
||||
{
|
||||
// 第二步:创建新数据行
|
||||
row = sheet.CreateRow(i);
|
||||
// 添加数据
|
||||
cell = row.CreateCell(0);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.TrainingContents);//培训内容
|
||||
|
||||
cell = row.CreateCell(1);
|
||||
cell.CellStyle = cellStyle;
|
||||
string proName = string.Empty;
|
||||
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
|
||||
if (cnp != null)
|
||||
{
|
||||
proName = cnp.ProfessionalName;
|
||||
}
|
||||
cell.SetCellValue(proName);//专业
|
||||
|
||||
cell = row.CreateCell(2);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.TrainingObject);//培训对象
|
||||
|
||||
cell = row.CreateCell(3);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.TrainingAddress);//培训地点
|
||||
|
||||
cell = row.CreateCell(4);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Hours.HasValue ? item.Hours.ToString() : "");//课时(小时)
|
||||
|
||||
cell = row.CreateCell(5);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.KeynoteSpeaker);//主讲人
|
||||
|
||||
cell = row.CreateCell(6);
|
||||
cell.CellStyle = cellStyle;
|
||||
cell.SetCellValue(item.Remark);//备注
|
||||
i++;
|
||||
}
|
||||
// 第三步:写入文件流
|
||||
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
workbook.Write(stream);
|
||||
workbook.Close();
|
||||
}
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
Response.Clear();
|
||||
Response.ContentType = "application/x-zip-compressed";
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
Response.TransmitFile(newUrl, 0, fileSize);
|
||||
Response.Flush();
|
||||
Response.Close();
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
|
||||
@@ -102,6 +102,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnOut;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
|
||||
public void BindGrid()
|
||||
{
|
||||
string strSql = @"select Id, Sortid, StartDate, EndDate, ProjectId
|
||||
string strSql = @"select Id, Sortid, StartDate, EndDate, ProjectId,ReportType
|
||||
from Report_WeekAndMonthReport_New C
|
||||
where C.ProjectId = @ProjectId";
|
||||
where C.ReportType='1' AND C.ProjectId = @ProjectId";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
@@ -129,7 +129,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.CQWeekReportNewMenuId);
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.MonthReportNewMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
|
||||
@@ -2755,6 +2755,7 @@ namespace FineUIPro.Web.CQMS.ManageReportNew
|
||||
Model.Report_WeekAndMonthReport_New report = new Model.Report_WeekAndMonthReport_New();
|
||||
report.Id = ReportId;
|
||||
report.ProjectId = this.CurrUser.LoginProjectId;
|
||||
report.ReportType = "1";//1.月报,2-周报
|
||||
if (!string.IsNullOrEmpty(this.txtPeriod.Text.Trim()))
|
||||
{
|
||||
try
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WeekReport.aspx.cs" Inherits="FineUIPro.Web.CQMS.ManageReportNew.WeekReport" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>项目质量周报(新)</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
|
||||
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" IsFluid="true" CssClass="blockpanel" ShowBorder="true" ShowHeader="false" runat="server" EnableCollapse="true" SortField="StartDate"
|
||||
DataIDField="Id" SortDirection="DESC" BoxFlex="1" AllowCellEditing="true"
|
||||
DataKeyNames="Id" EnableColumnLines="true" ClicksToEdit="2" AllowSorting="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
|
||||
OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableRowDoubleClickEvent="true"
|
||||
AllowFilters="true" EnableTextSelection="True">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnNew" Icon="Add" EnablePostBack="true"
|
||||
runat="server" OnClick="btnNew_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblPageIndex" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:RenderField Width="180px" ColumnID="SortId" DataField="SortId"
|
||||
FieldType="String" HeaderText="周期" TextAlign="Center" HeaderTextAlign="Center" >
|
||||
</f:RenderField>
|
||||
<f:TemplateField ColumnID="ReportId" Width="100px" HeaderText="时间段" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label41" runat="server" Text='<%# ConvertDate(Eval("Id")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
</Listeners>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
<f:Window ID="Window1" Title="编辑项目质量周报" Hidden="true" EnableIFrame="true" EnableMaximize="true"
|
||||
Target="Parent" EnableResize="false" runat="server" IsModal="true" OnClose="Window1_Close"
|
||||
Width="1300px" Height="620px">
|
||||
</f:Window>
|
||||
<f:Menu ID="Menu1" runat="server">
|
||||
<Items>
|
||||
<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click" Hidden="true">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuView" EnablePostBack="true" runat="server" Text="查看" Icon="ApplicationViewIcons"
|
||||
OnClick="btnMenuView_Click">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
|
||||
Text="导出" Icon="Printer" OnClick="btnPrinter_Click" EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Icon="Delete" Text="删除" ConfirmText="确定删除当前数据?"
|
||||
OnClick="btnMenuDel_Click" Hidden="true">
|
||||
</f:MenuButton>
|
||||
</Items>
|
||||
</f:Menu>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var menuID = '<%= Menu1.ClientID %>';
|
||||
|
||||
// 返回false,来阻止浏览器右键菜单
|
||||
function onRowContextMenu(event, rowId) {
|
||||
F(menuID).show(); //showAt(event.pageX, event.pageY);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.ManageReportNew {
|
||||
|
||||
|
||||
public partial class WeekReport {
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// Panel1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Panel Panel1;
|
||||
|
||||
/// <summary>
|
||||
/// Grid1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// btnNew 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
|
||||
/// <summary>
|
||||
/// Label41 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label Label41;
|
||||
|
||||
/// <summary>
|
||||
/// Window1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Window Window1;
|
||||
|
||||
/// <summary>
|
||||
/// Menu1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Menu Menu1;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuModify 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuModify;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuView 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuView;
|
||||
|
||||
/// <summary>
|
||||
/// btnPrinter 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnPrinter;
|
||||
|
||||
/// <summary>
|
||||
/// btnMenuDel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.MenuButton btnMenuDel;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user