2023-07-07 14:29:15 +08:00
using Aspose.Words ;
using Aspose.Words.Tables ;
using BLL ;
2023-06-01 17:14:29 +08:00
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Data.SqlClient ;
2023-07-07 14:29:15 +08:00
using System.IO ;
2023-06-01 17:14:29 +08:00
using System.Linq ;
namespace FineUIPro.Web.ZHGL.Plan
{
public partial class ActionPlanList : PageBase
{
#region 加 载
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
Funs . DropDownPageSize ( this . ddlPageSize ) ;
////权限按钮方法
this . GetButtonPower ( ) ;
this . btnNew . OnClientClick = Window1 . GetShowReference ( "ActionPlanListEdit.aspx" ) + "return false;" ;
ProjectService . InitAllProjectDropDownList ( this . drpProject , false ) ;
drpProject . Items . Insert ( 0 , new FineUIPro . ListItem ( "公司本部" , "Company" ) ) ;
Funs . FineUIPleaseSelect ( drpProject , "按项目/公司本部查询" ) ;
// 绑定表格
this . BindGrid ( ) ;
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid ( )
{
2023-06-05 10:32:48 +08:00
string strSql = "SELECT ActionPlanList.ActionPlanListId,ActionPlanList.ProjectId,Project.ProjectName,ActionPlanListCode,ActionPlanList.ActionPlanListName,ActionPlanList.VersionNo,(CASE ActionPlanList.ProjectType WHEN '1' THEN 'EPC' WHEN '2' THEN 'EPCM' WHEN '3' THEN 'C' WHEN '4' THEN '其他' END ) AS ProjectType,ActionPlanList.ActionPlanListContents,ActionPlanList.CompileMan,Users.PersonName AS CompileManName, ActionPlanList.CompileDate,ActionPlanList.States"
2023-06-01 17:14:29 +08:00
+ @" FROM ActionPlan_ActionPlanList AS ActionPlanList "
+ @" LEFT JOIN Base_Project AS Project ON ActionPlanList.ProjectId=Project.ProjectId "
+ @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON ActionPlanList.ActionPlanListId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1"
+ @" LEFT JOIN Person_Persons AS OperateUser ON FlowOperate.OperaterId=OperateUser.PersonId "
+ @" LEFT JOIN Person_Persons AS Users ON Users.PersonId = ActionPlanList.CompileMan "
+ @" WHERE 1=1 " ;
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
if ( this . drpProject . SelectedValue ! = BLL . Const . _Null )
{
if ( this . drpProject . SelectedValue = = "Company" )
{
strSql + = " AND ActionPlanList.ProjectId is null" ;
}
else
{
strSql + = " AND ActionPlanList.ProjectId = @ProjectId" ;
listStr . Add ( new SqlParameter ( "@ProjectId" , this . drpProject . SelectedValue ) ) ;
}
}
if ( ! string . IsNullOrEmpty ( this . txtActionPlanListCode . Text . Trim ( ) ) )
{
strSql + = " AND ActionPlanListCode LIKE @ActionPlanListCode" ;
listStr . Add ( new SqlParameter ( "@ActionPlanListCode" , "%" + this . txtActionPlanListCode . Text . Trim ( ) + "%" ) ) ;
}
if ( ! string . IsNullOrEmpty ( this . txtActionPlanListName . Text . Trim ( ) ) )
{
strSql + = " AND ActionPlanListName LIKE @ActionPlanListName" ;
listStr . Add ( new SqlParameter ( "@ActionPlanListName" , "%" + this . txtActionPlanListName . Text . Trim ( ) + "%" ) ) ;
}
SqlParameter [ ] parameter = listStr . ToArray ( ) ;
DataTable tb = SQLHelper . GetDataTableRunText ( strSql , parameter ) ;
Grid1 . RecordCount = tb . Rows . Count ;
var table = this . GetPagedDataTable ( Grid1 , tb ) ;
Grid1 . DataSource = table ;
Grid1 . DataBind ( ) ;
}
#endregion
#region 分 页 排 序
/// <summary>
/// 改变索引事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange ( object sender , GridPageEventArgs e )
{
BindGrid ( ) ;
}
/// <summary>
/// 分页下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged ( object sender , EventArgs e )
{
Grid1 . PageSize = Convert . ToInt32 ( ddlPageSize . SelectedValue ) ;
BindGrid ( ) ;
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort ( object sender , FineUIPro . GridSortEventArgs e )
{
BindGrid ( ) ;
}
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close ( object sender , EventArgs e )
{
BindGrid ( ) ;
}
#endregion
#region 查 询
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged ( object sender , EventArgs e )
{
this . BindGrid ( ) ;
BLL . LogService . AddSys_Log ( this . CurrUser , string . Empty , string . Empty , BLL . Const . OfficeActionPlanListMenuId , Const . BtnQuery ) ;
}
#endregion
#region 编 辑
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick ( object sender , GridRowClickEventArgs e )
{
this . EditData ( ) ;
}
/// <summary>
/// 右键编辑事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click ( object sender , EventArgs e )
{
this . EditData ( ) ;
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditData ( )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
string id = Grid1 . SelectedRowID . Split ( ',' ) [ 0 ] ;
Model . ActionPlan_ActionPlanList actionPlanList = ActionPlanListService . GetActionPlanListById ( id ) ;
if ( actionPlanList . States = = Const . ActionPlanList_Complete )
{
Alert . ShowInTop ( "该文件已经审批完成,无法操作,请右键查看!" , MessageBoxIcon . Warning ) ;
return ;
}
else if ( actionPlanList . States = = Const . ActionPlanList_Compile )
{
if ( actionPlanList . CompileMan = = CurrUser . PersonId | | CurrUser . PersonId = = Const . sysglyId )
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "ActionPlanListEdit.aspx?actionPlanListId={0}" , id ) ) ) ;
}
else
{
Alert . ShowInTop ( "您不是编制人,无法操作!请右键查看" , MessageBoxIcon . Warning ) ;
return ;
}
}
2023-06-27 17:40:37 +08:00
else if ( actionPlanList . States = = Const . ActionPlanList_Review | | actionPlanList . States = = Const . ActionPlanList_Reviewing | | actionPlanList . States = = Const . ActionPlanList_ReCompile | | actionPlanList . States = = Const . ActionPlanList_Review2 | | actionPlanList . States = = Const . ActionPlanList_DepartReview )
2023-06-01 17:14:29 +08:00
{
Model . ActionPlan_ActionPlanListApprove approve = ActionPlanListApproveService . GetActionPlanListApproveByApproveMan ( id , CurrUser . PersonId ) ;
if ( approve ! = null | | CurrUser . PersonId = = Const . sysglyId )
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "ActionPlanListEdit.aspx?actionPlanListId={0}" , id ) ) ) ;
return ;
//Response.Redirect("ActionPlanListAudit.aspx?actionPlanListId=" + id);
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", id, "查看 - ")));
}
else
{
if ( actionPlanList . CompileMan . Equals ( CurrUser . PersonId ) )
{
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "ActionPlanListEdit.aspx?actionPlanListId={0}" , id ) ) ) ;
}
else
{
Alert . ShowInTop ( "您不是办理用户,无法操作!请右键查看" , MessageBoxIcon . Warning ) ;
return ;
}
}
}
}
#endregion
protected void btnMenuView_Click ( object sender , EventArgs e )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
string id = Grid1 . SelectedRowID . Split ( ',' ) [ 0 ] ;
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "ActionPlanListView.aspx?ActionPlanListId={0}" , id ) ) ) ;
}
#region 删 除
/// <summary>
/// 右键删除事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click ( object sender , EventArgs e )
{
if ( Grid1 . SelectedRowIndexArray . Length > 0 )
{
bool isShow = false ;
if ( Grid1 . SelectedRowIndexArray . Length = = 1 )
{
isShow = true ;
}
foreach ( int rowIndex in Grid1 . SelectedRowIndexArray )
{
string rowID = Grid1 . DataKeys [ rowIndex ] [ 0 ] . ToString ( ) ;
if ( this . judgementDelete ( rowID , isShow ) )
{
var getV = BLL . ActionPlanListService . GetActionPlanListById ( rowID ) ;
if ( getV ! = null )
{
BLL . LogService . AddSys_Log ( this . CurrUser , getV . ActionPlanListCode , getV . ActionPlanListId , BLL . Const . OfficeActionPlanListMenuId , Const . BtnDelete ) ;
BLL . ActionPlanListService . DeleteActionPlanListById ( rowID ) ;
}
}
}
BindGrid ( ) ;
ShowNotify ( "删除数据成功!" , MessageBoxIcon . Success ) ;
}
}
/// <summary>
/// 判断是否可以删除
/// </summary>
/// <returns></returns>
private bool judgementDelete ( string id , bool isShow )
{
string content = string . Empty ;
if ( string . IsNullOrEmpty ( content ) )
{
return true ;
}
else
{
if ( isShow )
{
Alert . ShowInTop ( content ) ;
}
return false ;
}
}
#endregion
#region 获 取 按 钮 权 限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower ( )
{
if ( Request . Params [ "value" ] = = "0" )
{
return ;
}
var buttonList = BLL . CommonService . GetAllButtonList ( this . CurrUser . LoginProjectId , this . CurrUser . PersonId , BLL . Const . OfficeActionPlanListMenuId ) ;
if ( buttonList . Count ( ) > 0 )
{
if ( buttonList . Contains ( BLL . Const . BtnAdd ) )
{
this . btnNew . Hidden = false ;
}
if ( buttonList . Contains ( BLL . Const . BtnModify ) )
{
this . btnMenuEdit . Hidden = false ;
}
if ( buttonList . Contains ( BLL . Const . BtnDelete ) )
{
this . btnMenuDelete . Hidden = false ;
}
}
}
#endregion
#region 导 出 按 钮
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click ( object sender , EventArgs e )
{
Response . ClearContent ( ) ;
string filename = Funs . GetNewFileName ( ) ;
Response . AddHeader ( "content-disposition" , "attachment; filename=" + System . Web . HttpUtility . UrlEncode ( "安全实施计划" + filename , System . Text . Encoding . UTF8 ) + ".xls" ) ;
Response . ContentType = "application/excel" ;
Response . ContentEncoding = System . Text . Encoding . UTF8 ;
this . Grid1 . PageSize = 5000 ;
this . BindGrid ( ) ;
Response . Write ( GetGridTableHtml ( Grid1 ) ) ;
Response . End ( ) ;
}
#endregion
/// <summary>
/// 把办理人转换代号为文字形式
/// </summary>
/// <param name="ActionPlanListId"></param>
/// <returns></returns>
///
public static string ConvertApproveMan ( object ActionPlanListId )
{
string name = string . Empty ;
if ( ActionPlanListId ! = null )
{
var approves = BLL . ActionPlanListApproveService . GetActionPlanListApprovesNotHandleList ( ActionPlanListId . ToString ( ) ) ;
foreach ( var item in approves )
{
name + = BLL . Person_PersonsService . GetPersonsNameById ( item . ApproveMan ) + "," ;
}
if ( ! string . IsNullOrEmpty ( name ) )
{
name = name . Substring ( 0 , name . Length - 1 ) ;
}
}
return name ;
}
2023-07-07 14:29:15 +08:00
#region 导 出 详 细
/// <summary>
///
/// </summary>
/// <param name="sender"></param>btnPrinter_Click
/// <param name="e"></param>
protected void btnPrinter_Click ( object sender , EventArgs e )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
2023-07-07 15:31:52 +08:00
2023-07-07 14:29:15 +08:00
string Id = Grid1 . SelectedRowID ;
Model . ActionPlan_ActionPlanList actionPlanList = BLL . ActionPlanListService . GetActionPlanListById ( Id ) ;
2023-07-07 15:31:52 +08:00
if ( actionPlanList . States ! = BLL . Const . ActionPlanList_Complete )
2023-07-07 14:29:15 +08:00
{
Alert . ShowInTop ( "状态必须为审批完成的才能导出!" , MessageBoxIcon . Warning ) ;
return ;
}
if ( actionPlanList ! = null )
{
try
{
string rootPath = Server . MapPath ( "~/" ) ;
string initTemplatePath = string . Empty ;
string uploadfilepath = string . Empty ;
string newUrl = string . Empty ;
string filePath = string . Empty ;
initTemplatePath = "File\\Word\\ZHGL\\项目安全生产策划书评审表.doc" ;
uploadfilepath = rootPath + initTemplatePath ;
string projectName = BLL . ProjectService . GetProjectNameByProjectId ( actionPlanList . ProjectId ) ;
if ( ! string . IsNullOrEmpty ( projectName ) )
{
projectName = "(" + projectName + ")" ;
}
else
{
projectName = "(无项目)" ;
}
2023-07-17 14:26:17 +08:00
projectName = projectName . Replace ( "/" , "_" ) ;
2023-07-07 14:29:15 +08:00
newUrl = uploadfilepath . Replace ( ".doc" , projectName + ".doc" ) ;
if ( File . Exists ( newUrl ) )
{
File . Delete ( newUrl ) ;
}
File . Copy ( uploadfilepath , newUrl ) ;
///更新书签
Document doc = new Aspose . Words . Document ( newUrl ) ;
Aspose . Words . DocumentBuilder builder = new Aspose . Words . DocumentBuilder ( doc ) ;
builder . MoveToBookmark ( "tab" ) ;
builder . StartTable ( ) ;
builder . CellFormat . Borders . LineStyle = LineStyle . Single ;
builder . CellFormat . Borders . Color = System . Drawing . Color . Black ;
builder . Bold = false ;
builder . RowFormat . Height = 20 ;
builder . Font . Size = 9 ;
#region 工 程 名 称 和 项 目 部 编 制 人 员
//工程名称和项目部编制人员
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 100 ;
builder . Font . Bold = true ;
builder . Write ( "工程名称" ) ;
using ( Model . SGGLDB db = new Model . SGGLDB ( Funs . ConnString ) )
{
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 130 ;
builder . Font . Bold = false ;
var project = ProjectService . GetProjectByProjectId ( actionPlanList . ProjectId ) ;
var ActionPlan_ActionPlanListApproveList = db . ActionPlan_ActionPlanListApprove . Where ( x = > x . ActionPlanListId = = Id & & x . ApproveType = = "2" ) . ToList ( ) ;
if ( project ! = null )
{
if ( project . ProjectName . Length > 20 & & ActionPlan_ActionPlanListApproveList . Count ! = 0 )
{
builder . Write ( project . ProjectName . Substring ( 0 , 20 ) + "\n" +
project . ProjectName . Substring ( 20 ) ) ;
}
else
{
builder . Write ( project . ProjectName ) ;
}
}
builder . EndRow ( ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 100 ;
builder . Font . Bold = true ;
builder . Write ( "项目部编制人员" ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 130 ;
builder . Font . Bold = false ;
builder . Write ( BLL . Person_PersonsService . GetPersonsNameById ( actionPlanList . CompileMan ) ) ;
builder . EndRow ( ) ;
#endregion
if ( ActionPlan_ActionPlanListApproveList . Count > 0 )
{
#region 项 目 部 审 核 人
for ( int i = 0 ; i < ActionPlan_ActionPlanListApproveList . Count ; i + + )
{
//一行两个
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 100 ;
builder . Font . Bold = true ;
builder . Write ( "项目部审核人" ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
string manname = man ( ActionPlan_ActionPlanListApproveList [ i ] . ApproveMan ) ;
//判断是不是最后一个
if ( ActionPlan_ActionPlanListApproveList . Count = = i + 1 )
{
builder . CellFormat . Width = 40 ;
builder . Font . Bold = false ;
builder . Write ( manname ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 90 ;
builder . Write ( "" ) ;
}
else
{
builder . CellFormat . Width = 40 ;
builder . Font . Bold = false ;
builder . Write ( manname ) ;
}
//判断还有没有数据 有的话继续加
if ( ActionPlan_ActionPlanListApproveList . Count > i + 1 )
{
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 70 ;
builder . Font . Bold = true ;
builder . Write ( "项目部审核人" ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 20 ;
string manname2 = man ( ActionPlan_ActionPlanListApproveList [ i + 1 ] . ApproveMan ) ;
builder . Font . Bold = false ;
builder . Write ( manname2 ) ;
builder . EndRow ( ) ;
i + = 1 ;
}
else
{
//没有数据
builder . EndRow ( ) ;
}
}
#endregion
}
else
{
}
2023-07-17 14:46:24 +08:00
var approves = db . ActionPlan_ActionPlanListApprove . Where ( x = > x . ActionPlanListId = = Id & & x . ApproveType = = BLL . Const . ActionPlanList_Reviewing ) . ToList ( ) ;
2023-07-07 14:29:15 +08:00
var ActionPlan_ActionPlanListApproveList2 = db . ActionPlan_ActionPlanListApprove . Where ( x = > x . ActionPlanListId = = Id & & x . ApproveType = = "6" ) . ToList ( ) ;
2023-07-17 14:46:24 +08:00
if ( ActionPlan_ActionPlanListApproveList2 . Count > 0 | | approves . Count > 0 )
2023-07-07 14:29:15 +08:00
{
#region 主 要 评 审 部 门
//主要评审部门
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 230 ;
builder . Font . Bold = true ;
builder . Write ( "主要评审部门" ) ;
builder . EndRow ( ) ;
#region 主 要 评 审 部 门
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 80 ;
builder . Font . Bold = true ;
builder . Write ( "评审部门" ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 80 ;
builder . Font . Bold = true ;
builder . Write ( "评审意见" ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 70 ;
builder . Font . Bold = true ;
builder . Write ( "评审部门负责人/日期" ) ;
builder . EndRow ( ) ;
#endregion
2023-07-17 14:46:24 +08:00
foreach ( var item in approves )
{
//部门名称
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 80 ;
builder . Font . Bold = false ;
2023-07-17 14:59:30 +08:00
builder . Write ( "施工管理部" ) ;
2023-07-17 14:46:24 +08:00
//评审意见
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 80 ;
builder . Font . Bold = false ;
if ( ! string . IsNullOrEmpty ( item . ApproveIdea ) )
{
builder . Write ( item . ApproveIdea ) ;
}
else
{
builder . Write ( "无" ) ;
}
//评审日期
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 70 ;
builder . Font . Bold = false ;
if ( item . ApproveDate ! = null )
{
2023-07-17 15:58:09 +08:00
var getUser = Person_PersonsService . GetPerson_PersonsById ( item . ApproveMan ) ;
if ( ! string . IsNullOrEmpty ( getUser . SignatureUrl ) & & File . Exists ( rootPath + getUser . SignatureUrl ) )
{
var file = rootPath + getUser . SignatureUrl ;
builder . InsertImage ( file , 80 , 20 ) ;
builder . Write ( item . ApproveDate . ToString ( ) . Split ( ' ' ) [ 0 ] ) ;
}
else
{
builder . Write ( getUser . PersonName + " " + item . ApproveDate . ToString ( ) . Split ( ' ' ) [ 0 ] ) ;
}
2023-07-17 14:46:24 +08:00
}
else
{
builder . Write ( "" ) ;
}
builder . EndRow ( ) ;
}
2023-07-07 14:29:15 +08:00
foreach ( var item in ActionPlan_ActionPlanListApproveList2 )
{
//部门名称
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 80 ;
var departModel = db . Base_Depart . FirstOrDefault ( x = > x . DepartId = = item . DepartId ) ;
builder . Font . Bold = false ;
if ( departModel ! = null )
{
builder . Write ( departModel . DepartName ) ;
}
//评审意见
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 80 ;
builder . Font . Bold = false ;
if ( ! string . IsNullOrEmpty ( item . ApproveIdea ) )
{
builder . Write ( item . ApproveIdea ) ;
}
else
{
builder . Write ( "无" ) ;
}
//评审日期
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 70 ;
builder . Font . Bold = false ;
if ( item . ApproveDate ! = null )
{
2023-07-17 15:58:09 +08:00
var getUser = Person_PersonsService . GetPerson_PersonsById ( item . ApproveMan ) ;
if ( ! string . IsNullOrEmpty ( getUser . SignatureUrl ) & & File . Exists ( rootPath + getUser . SignatureUrl ) )
{
var file = rootPath + getUser . SignatureUrl ;
builder . InsertImage ( file , 80 , 20 ) ;
builder . Write ( item . ApproveDate . ToString ( ) . Split ( ' ' ) [ 0 ] ) ;
}
else
{
builder . Write ( getUser . PersonName + " " + item . ApproveDate . ToString ( ) . Split ( ' ' ) [ 0 ] ) ;
}
2023-07-07 14:29:15 +08:00
}
else
{
builder . Write ( "" ) ;
}
builder . EndRow ( ) ;
}
#endregion
}
#region 最 后 2 行 审 核
//增加审核
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 100 ;
builder . Font . Bold = true ;
builder . Write ( "审核" ) ;
//公司安全总监/部门负责人
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Bottom ; //底部对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Left ; //水平居中对齐
builder . CellFormat . Width = 130 ;
builder . Font . Bold = true ;
builder . RowFormat . Height = 40 ;
builder . Write ( "公司安全总监/部门负责人:" ) ;
builder . Write ( " 年" ) ;
builder . Write ( " 月" ) ;
builder . Write ( " 日" ) ;
builder . EndRow ( ) ;
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Center ; //垂直居中对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Center ; //水平居中对齐
builder . CellFormat . Width = 100 ;
builder . Font . Bold = true ;
builder . Write ( "审核" ) ;
//公司安全总监/部门负责人
builder . InsertCell ( ) ;
builder . CellFormat . VerticalMerge = Aspose . Words . Tables . CellMerge . None ;
builder . CellFormat . HorizontalMerge = Aspose . Words . Tables . CellMerge . First ;
builder . CellFormat . VerticalAlignment = Aspose . Words . Tables . CellVerticalAlignment . Bottom ; //底部对齐
builder . ParagraphFormat . Alignment = ParagraphAlignment . Left ; //水平居中对齐
builder . CellFormat . Width = 130 ;
builder . Font . Bold = true ;
builder . RowFormat . Height = 40 ;
builder . Write ( "公司主管生产/安全领导:" ) ;
builder . Write ( " 年" ) ;
builder . Write ( " 月" ) ;
builder . Write ( " 日" ) ;
builder . EndRow ( ) ;
builder . Font . Bold = false ;
builder . ParagraphFormat . Alignment = ParagraphAlignment . Left ; //水平居中对齐
builder . Write ( "(公司主要评审部门指:安全质量监督部、运营管理部、施工管理部、工艺设计部、财务资产部、采购部、控制部等)" ) ;
#endregion
}
doc . Save ( newUrl ) ;
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
{
Alert . ShowInTop ( "未查询到数据,请检查网络!" , MessageBoxIcon . Warning ) ;
return ;
}
}
private string man ( string manName )
{
string appman = string . Empty ;
if ( Person_PersonsService . GetPerson_PersonsById ( manName . ToString ( ) ) ! = null )
{
appman = Person_PersonsService . GetPerson_PersonsById ( manName . ToString ( ) ) . PersonName ;
}
return appman ;
}
#endregion
2023-06-01 17:14:29 +08:00
}
}