增加进度计划编制导出功能
This commit is contained in:
parent
c13283b8e1
commit
a039bc13c7
|
|
@ -55,7 +55,7 @@ go
|
||||||
--GO
|
--GO
|
||||||
|
|
||||||
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
|
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)
|
||||||
VALUES('E23F0879-3E9F-4E7B-9A2D-EFF34798D629','进度计划设置','JDGL/Check/PlanSet.aspx',10,'0','Menu_JDGL',0,1,1)
|
VALUES('E23F0879-3E9F-4E7B-9A2D-EFF34798D629','进度计划编制','JDGL/Check/PlanSet.aspx',10,'0','Menu_JDGL',0,1,1)
|
||||||
GO
|
GO
|
||||||
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
INSERT INTO dbo.Sys_ButtonToMenu(ButtonToMenuId,MenuId,ButtonName,SortIndex)
|
||||||
VALUES('F5055103-6182-43E0-93EC-7DD7BEF2B71C','E23F0879-3E9F-4E7B-9A2D-EFF34798D629','保存',4)
|
VALUES('F5055103-6182-43E0-93EC-7DD7BEF2B71C','E23F0879-3E9F-4E7B-9A2D-EFF34798D629','保存',4)
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ namespace BLL
|
||||||
/// 获取模拟树表格
|
/// 获取模拟树表格
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static DataTable GetAllTreeDataTable(string projectId)
|
public static DataTable GetAllTreeDataTable(string projectId, string IsOut)
|
||||||
{
|
{
|
||||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||||
{
|
{
|
||||||
|
|
@ -260,7 +260,7 @@ namespace BLL
|
||||||
table.Columns.Add(new DataColumn("WBSType", typeof(String)));
|
table.Columns.Add(new DataColumn("WBSType", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
|
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
|
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("Weights", typeof(String)));
|
table.Columns.Add(new DataColumn("JDWeights", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("Unit", typeof(String)));
|
table.Columns.Add(new DataColumn("Unit", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("PlanProjectQuantity", typeof(String)));
|
table.Columns.Add(new DataColumn("PlanProjectQuantity", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("RealProjectQuantity", typeof(String)));
|
table.Columns.Add(new DataColumn("RealProjectQuantity", typeof(String)));
|
||||||
|
|
@ -271,14 +271,25 @@ namespace BLL
|
||||||
table.Columns.Add(new DataColumn("IsMileStone", typeof(bool)));
|
table.Columns.Add(new DataColumn("IsMileStone", typeof(bool)));
|
||||||
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
|
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
|
||||||
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
|
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
|
||||||
|
table.Columns.Add(new DataColumn("Code", typeof(String)));
|
||||||
if (getWBSs.Count() > 0)
|
if (getWBSs.Count() > 0)
|
||||||
{
|
{
|
||||||
List<Model.View_WBS> newList = new List<Model.View_WBS>();
|
List<Model.View_WBS> newList = new List<Model.View_WBS>();
|
||||||
var projectTypes = getWBSs.Where(x => x.WBSType == "ProjectType" && x.SupId == "0");
|
var projectTypes = getWBSs.Where(x => x.WBSType == "ProjectType" && x.SupId == "0");
|
||||||
|
int a = 1;
|
||||||
foreach (var item in projectTypes)
|
foreach (var item in projectTypes)
|
||||||
{
|
{
|
||||||
|
item.Code = a.ToString();
|
||||||
newList.Add(item);
|
newList.Add(item);
|
||||||
AddDetail(newList, getWBSs.ToList(), item.Id);
|
if (string.IsNullOrEmpty(IsOut))
|
||||||
|
{
|
||||||
|
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty);
|
||||||
|
}
|
||||||
|
a++;
|
||||||
}
|
}
|
||||||
DataRow row;
|
DataRow row;
|
||||||
foreach (Model.View_WBS item in newList)
|
foreach (Model.View_WBS item in newList)
|
||||||
|
|
@ -370,6 +381,7 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
row[17] = item.Code;
|
||||||
table.Rows.Add(row);
|
table.Rows.Add(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -377,13 +389,30 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id)
|
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode)
|
||||||
{
|
{
|
||||||
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
|
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
|
||||||
|
int b = 1;
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
|
item.Code = preCode + "." + b.ToString();
|
||||||
newList.Add(item);
|
newList.Add(item);
|
||||||
AddDetail(newList, oldList, item.Id);
|
AddDetail(newList, oldList, item.Id, item.Code);
|
||||||
|
b++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix)
|
||||||
|
{
|
||||||
|
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
|
||||||
|
int b = 1;
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
item.Code = preCode + "." + b.ToString();
|
||||||
|
item.Name = prefix + "...." + item.Name;
|
||||||
|
newList.Add(item);
|
||||||
|
AddDetail(newList, oldList, item.Id, item.Code, prefix + "....");
|
||||||
|
b++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3342,6 +3342,11 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string OpinionTemplateUrl = "File\\Excel\\DataOut\\策划评审意见收集汇总表.xlsx";
|
public const string OpinionTemplateUrl = "File\\Excel\\DataOut\\策划评审意见收集汇总表.xlsx";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 进度计划编制模板文件原始虚拟路径
|
||||||
|
/// </summary>
|
||||||
|
public const string JDPlanTemplateUrl = "File\\Excel\\DataOut\\进度计划编制.xls";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 初始化上传路径
|
#region 初始化上传路径
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -33,11 +33,17 @@
|
||||||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存"
|
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存"
|
||||||
OnClick="btnSave_Click">
|
OnClick="btnSave_Click">
|
||||||
</f:Button>
|
</f:Button>
|
||||||
|
<f:Button ID="btnOut" OnClick="btnOutExcel_Click" runat="server" ToolTip="导出" Icon="FolderUp"
|
||||||
|
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||||
|
</f:Button>
|
||||||
</Items>
|
</Items>
|
||||||
</f:Toolbar>
|
</f:Toolbar>
|
||||||
</Toolbars>
|
</Toolbars>
|
||||||
<Columns>
|
<Columns>
|
||||||
<%--<f:RowNumberField HeaderText="序号"/>--%>
|
<%--<f:RowNumberField HeaderText="序号"/>--%>
|
||||||
|
<f:RenderField Width="100px" ColumnID="Code" DataField="Code" FieldType="String"
|
||||||
|
HeaderText="序号" HeaderTextAlign="Center" TextAlign="Left">
|
||||||
|
</f:RenderField>
|
||||||
<f:BoundField Width="350px" ColumnID="Name" DataField="Name" HeaderTextAlign="Center"
|
<f:BoundField Width="350px" ColumnID="Name" DataField="Name" HeaderTextAlign="Center"
|
||||||
HeaderText="工作内容" />
|
HeaderText="工作内容" />
|
||||||
<f:RenderField Width="100px" ColumnID="PreWorkCode" DataField="PreWorkCode" FieldType="String"
|
<f:RenderField Width="100px" ColumnID="PreWorkCode" DataField="PreWorkCode" FieldType="String"
|
||||||
|
|
@ -46,20 +52,20 @@
|
||||||
<f:TextBox runat="server" ID="txtPreWorkCode" MaxLength="50"></f:TextBox>
|
<f:TextBox runat="server" ID="txtPreWorkCode" MaxLength="50"></f:TextBox>
|
||||||
</Editor>
|
</Editor>
|
||||||
</f:RenderField>
|
</f:RenderField>
|
||||||
<f:TemplateField Width="90px" HeaderText="里程碑点" HeaderTextAlign="Center" ID="IsMileStone" TextAlign="Center">
|
<f:TemplateField Width="60px" HeaderText="里程碑点" HeaderTextAlign="Center" ID="IsMileStone" TextAlign="Center">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:CheckBox ID="cbIsMileStone" runat="server"></asp:CheckBox>
|
<asp:CheckBox ID="cbIsMileStone" runat="server"></asp:CheckBox>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</f:TemplateField>
|
</f:TemplateField>
|
||||||
<f:RenderField Width="100px" ColumnID="Weights" DataField="Weights" FieldType="Double"
|
<f:RenderField Width="100px" ColumnID="JDWeights" DataField="JDWeights" FieldType="Double"
|
||||||
HeaderText="权重(%)" HeaderTextAlign="Center" TextAlign="Left">
|
HeaderText="权重(%)" HeaderTextAlign="Center" TextAlign="Left">
|
||||||
<Editor>
|
<Editor>
|
||||||
<f:NumberBox ID="nbWeights" NoDecimal="false" NoNegative="true" MinValue="0"
|
<f:NumberBox ID="nbJDWeights" NoDecimal="false" NoNegative="true" MinValue="0"
|
||||||
runat="server">
|
runat="server">
|
||||||
</f:NumberBox>
|
</f:NumberBox>
|
||||||
</Editor>
|
</Editor>
|
||||||
</f:RenderField>
|
</f:RenderField>
|
||||||
<f:RenderField Width="100px" ColumnID="Unit" DataField="Unit" FieldType="String"
|
<f:RenderField Width="80px" ColumnID="Unit" DataField="Unit" FieldType="String"
|
||||||
HeaderText="单位" HeaderTextAlign="Center" TextAlign="Left">
|
HeaderText="单位" HeaderTextAlign="Center" TextAlign="Left">
|
||||||
<Editor>
|
<Editor>
|
||||||
<f:TextBox runat="server" ID="txtUnit" MaxLength="50"></f:TextBox>
|
<f:TextBox runat="server" ID="txtUnit" MaxLength="50"></f:TextBox>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
|
|
||||||
|
|
@ -27,7 +28,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||||
|
|
||||||
private void BindGrid()
|
private void BindGrid()
|
||||||
{
|
{
|
||||||
DataTable table = BLL.WorkPackageService.GetAllTreeDataTable(this.CurrUser.LoginProjectId);
|
DataTable table = BLL.WorkPackageService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty);
|
||||||
Grid1.DataSource = table;
|
Grid1.DataSource = table;
|
||||||
Grid1.DataBind();
|
Grid1.DataBind();
|
||||||
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
||||||
|
|
@ -38,7 +39,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||||
cbIsMileStone.Visible = false;
|
cbIsMileStone.Visible = false;
|
||||||
foreach (GridColumn column in Grid1.Columns)
|
foreach (GridColumn column in Grid1.Columns)
|
||||||
{
|
{
|
||||||
if (column.ColumnIndex != 0)
|
if (column.ColumnIndex != 0 && column.ColumnIndex != 1)
|
||||||
{
|
{
|
||||||
this.Grid1.Rows[i].CellCssClasses[column.ColumnIndex] = "f-grid-cell-uneditable";
|
this.Grid1.Rows[i].CellCssClasses[column.ColumnIndex] = "f-grid-cell-uneditable";
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +99,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||||
Model.WBS_WorkPackage workPackage = workPackages.FirstOrDefault(x => x.WorkPackageId == this.Grid1.Rows[i].DataKeys[2].ToString());
|
Model.WBS_WorkPackage workPackage = workPackages.FirstOrDefault(x => x.WorkPackageId == this.Grid1.Rows[i].DataKeys[2].ToString());
|
||||||
if (workPackage != null)
|
if (workPackage != null)
|
||||||
{
|
{
|
||||||
string weights = values.Value<string>("Weights");
|
string weights = values.Value<string>("JDWeights");
|
||||||
string unit = values.Value<string>("Unit");
|
string unit = values.Value<string>("Unit");
|
||||||
string planProjectQuantity = values.Value<string>("PlanProjectQuantity");
|
string planProjectQuantity = values.Value<string>("PlanProjectQuantity");
|
||||||
string realProjectQuantity = values.Value<string>("RealProjectQuantity");
|
string realProjectQuantity = values.Value<string>("RealProjectQuantity");
|
||||||
|
|
@ -107,7 +108,7 @@ namespace FineUIPro.Web.JDGL.Check
|
||||||
string realStartDate = values.Value<string>("RealStartDate");
|
string realStartDate = values.Value<string>("RealStartDate");
|
||||||
string preWorkCode = values.Value<string>("PreWorkCode");
|
string preWorkCode = values.Value<string>("PreWorkCode");
|
||||||
System.Web.UI.WebControls.CheckBox cbIsMileStone = (System.Web.UI.WebControls.CheckBox)(this.Grid1.Rows[i].FindControl("cbIsMileStone"));
|
System.Web.UI.WebControls.CheckBox cbIsMileStone = (System.Web.UI.WebControls.CheckBox)(this.Grid1.Rows[i].FindControl("cbIsMileStone"));
|
||||||
workPackage.Weights = Funs.GetNewDecimal(weights);
|
workPackage.JDWeights = Funs.GetNewDecimal(weights);
|
||||||
workPackage.Unit = unit;
|
workPackage.Unit = unit;
|
||||||
workPackage.PlanProjectQuantity = Funs.GetNewDecimal(planProjectQuantity);
|
workPackage.PlanProjectQuantity = Funs.GetNewDecimal(planProjectQuantity);
|
||||||
workPackage.RealProjectQuantity = Funs.GetNewDecimal(realProjectQuantity);
|
workPackage.RealProjectQuantity = Funs.GetNewDecimal(realProjectQuantity);
|
||||||
|
|
@ -171,5 +172,190 @@ namespace FineUIPro.Web.JDGL.Check
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 导出(excel按钮)
|
||||||
|
protected void btnOutExcel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.Grid1.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DataTable table = BLL.WorkPackageService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, "Out");
|
||||||
|
string projectNmae = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||||
|
if (!string.IsNullOrEmpty(projectNmae))
|
||||||
|
{
|
||||||
|
projectNmae = "(" + projectNmae + ")";
|
||||||
|
}
|
||||||
|
string rootPath = Server.MapPath("~/");
|
||||||
|
string initTemplatePath = string.Empty;
|
||||||
|
string uploadfilepath = string.Empty;
|
||||||
|
string newUrl = string.Empty;
|
||||||
|
string filePath = string.Empty;
|
||||||
|
initTemplatePath = Const.JDPlanTemplateUrl;
|
||||||
|
uploadfilepath = rootPath + initTemplatePath;
|
||||||
|
newUrl = uploadfilepath.Replace(".xls", projectNmae + ".xls");
|
||||||
|
File.Copy(uploadfilepath, newUrl);
|
||||||
|
// 第一步:读取文件流
|
||||||
|
NPOI.SS.UserModel.IWorkbook workbook;
|
||||||
|
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
|
||||||
|
{
|
||||||
|
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建单元格样式
|
||||||
|
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||||
|
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.None;
|
||||||
|
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.None;
|
||||||
|
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.None;
|
||||||
|
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.None;
|
||||||
|
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||||
|
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||||
|
var font = workbook.CreateFont();
|
||||||
|
font.FontHeightInPoints = 12;
|
||||||
|
font.IsBold = true;
|
||||||
|
//font.FontHeightInPoints = (short)8.5;字号为小数时要转为short
|
||||||
|
cellStyle0.SetFont(font);
|
||||||
|
|
||||||
|
// 第二步:创建新数据行
|
||||||
|
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheet("Sheet1");
|
||||||
|
NPOI.SS.UserModel.IRow row1 = sheet.CreateRow(1);
|
||||||
|
NPOI.SS.UserModel.ICell cell2;
|
||||||
|
// 添加测试数据
|
||||||
|
cell2 = row1.CreateCell(14);
|
||||||
|
cell2.CellStyle = cellStyle0;
|
||||||
|
cell2.SetCellValue("123");
|
||||||
|
var font2 = workbook.CreateFont();
|
||||||
|
font2.FontHeightInPoints = 10;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 创建单元格样式
|
||||||
|
NPOI.SS.UserModel.ICellStyle cellStyle1 = workbook.CreateCellStyle();
|
||||||
|
cellStyle1.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle1.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle1.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle1.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle1.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||||
|
cellStyle1.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||||
|
var font3 = workbook.CreateFont();
|
||||||
|
font3.FontHeightInPoints = 14;
|
||||||
|
cellStyle1.SetFont(font3);
|
||||||
|
|
||||||
|
NPOI.SS.UserModel.ICellStyle cellStyle2 = workbook.CreateCellStyle();
|
||||||
|
cellStyle2.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle2.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle2.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle2.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
cellStyle2.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
|
||||||
|
cellStyle2.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||||
|
cellStyle2.SetFont(font3);
|
||||||
|
|
||||||
|
int rowCount = 1;
|
||||||
|
NPOI.SS.UserModel.IRow row;
|
||||||
|
NPOI.SS.UserModel.ICell cell;
|
||||||
|
|
||||||
|
#region 填充内容
|
||||||
|
foreach (DataRow tr in table.Rows)
|
||||||
|
{
|
||||||
|
row = sheet.CreateRow(rowCount);
|
||||||
|
cell = row.CreateCell(0);
|
||||||
|
cell.CellStyle = cellStyle2;
|
||||||
|
cell.SetCellValue(tr["Code"].ToString());
|
||||||
|
cell = row.CreateCell(1);
|
||||||
|
cell.CellStyle = cellStyle2;
|
||||||
|
cell.SetCellValue(tr["Name"].ToString());
|
||||||
|
cell = row.CreateCell(2);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
cell.SetCellValue(tr["PreWorkCode"].ToString());
|
||||||
|
cell = row.CreateCell(3);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (!string.IsNullOrEmpty(tr["IsMileStone"].ToString()) && Convert.ToBoolean(tr["IsMileStone"].ToString()) == true)
|
||||||
|
{
|
||||||
|
cell.SetCellValue("是");
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(4);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (!string.IsNullOrEmpty(tr["JDWeights"].ToString()))
|
||||||
|
{
|
||||||
|
cell.SetCellValue(decimal.Round(Convert.ToDecimal(tr["JDWeights"]), 2).ToString("0.##"));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(5);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
cell.SetCellValue(tr["Unit"].ToString());
|
||||||
|
cell = row.CreateCell(6);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (!string.IsNullOrEmpty(tr["PlanProjectQuantity"].ToString()))
|
||||||
|
{
|
||||||
|
cell.SetCellValue(decimal.Round(Convert.ToDecimal(tr["PlanProjectQuantity"]), 2).ToString("0.##"));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(7);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (!string.IsNullOrEmpty(tr["PlanCost"].ToString()))
|
||||||
|
{
|
||||||
|
cell.SetCellValue(decimal.Round(Convert.ToDecimal(tr["PlanCost"]), 2).ToString("0.##"));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(8);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (!string.IsNullOrEmpty(tr["RealProjectQuantity"].ToString()))
|
||||||
|
{
|
||||||
|
cell.SetCellValue(decimal.Round(Convert.ToDecimal(tr["RealProjectQuantity"]), 2).ToString("0.##"));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(9);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (tr["PlanStartDate"] != null)
|
||||||
|
{
|
||||||
|
cell.SetCellValue(string.Format("{0:yyyy-MM-dd}", tr["PlanStartDate"]));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(10);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (tr["PlanEndDate"] != null)
|
||||||
|
{
|
||||||
|
cell.SetCellValue(string.Format("{0:yyyy-MM-dd}", tr["PlanEndDate"]));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(11);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (tr["RealStartDate"] != null)
|
||||||
|
{
|
||||||
|
cell.SetCellValue(string.Format("{0:yyyy-MM-dd}", tr["RealStartDate"]));
|
||||||
|
}
|
||||||
|
cell = row.CreateCell(12);
|
||||||
|
cell.CellStyle = cellStyle1;
|
||||||
|
if (tr["RealEndDate"] != null)
|
||||||
|
{
|
||||||
|
cell.SetCellValue(string.Format("{0:yyyy-MM-dd}", tr["RealEndDate"]));
|
||||||
|
}
|
||||||
|
rowCount++;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
// 第三步:写入文件流
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowNotify("没有数据,无法导出!", MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -75,6 +75,15 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::FineUIPro.Button btnSave;
|
protected global::FineUIPro.Button btnSave;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// btnOut 控件。
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 自动生成的字段。
|
||||||
|
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||||
|
/// </remarks>
|
||||||
|
protected global::FineUIPro.Button btnOut;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// txtPreWorkCode 控件。
|
/// txtPreWorkCode 控件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -103,13 +112,13 @@ namespace FineUIPro.Web.JDGL.Check {
|
||||||
protected global::System.Web.UI.WebControls.CheckBox cbIsMileStone;
|
protected global::System.Web.UI.WebControls.CheckBox cbIsMileStone;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// nbWeights 控件。
|
/// nbJDWeights 控件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// 自动生成的字段。
|
/// 自动生成的字段。
|
||||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::FineUIPro.NumberBox nbWeights;
|
protected global::FineUIPro.NumberBox nbJDWeights;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// txtUnit 控件。
|
/// txtUnit 控件。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue