修改安全月报到处,以及隐藏公司级不需要的菜单。
This commit is contained in:
parent
1af13f87d6
commit
7311a2b6fa
|
@ -0,0 +1,4 @@
|
|||
--隐藏没用的菜单
|
||||
update sys_menu set IsUsed='0' where menuid='CD167198-1667-4552-9876-E768C2542C30';
|
||||
update sys_menu set IsUsed='0' where menuid='DA7D64F8-A107-4DBC-B7E4-5C79409EB9FA';
|
||||
update sys_menu set IsUsed='0' where menuid='B87413D8-4EFB-42F3-A4F6-9D21C0CD3DFE';
|
|
@ -3359,6 +3359,11 @@ namespace BLL
|
|||
/// </summary>
|
||||
public const string ConExperienceSummaryTemUrl = "File\\Excel\\DataIn\\类似项目施工经验总结清单导入模板.xls";
|
||||
|
||||
/// <summary>
|
||||
/// 新项目安全月报模板文件原始虚拟路径
|
||||
/// </summary>
|
||||
public const string HseMonthReportNewTemplateUrl = "File\\Word\\HSSE\\项目安全月报.doc";
|
||||
|
||||
#region 导出模板
|
||||
/// <summary>
|
||||
/// 质量专项检查模板文件原始虚拟路径
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
<f:MenuButton ID="btnMenuModify" EnablePostBack="true" runat="server" Hidden="true"
|
||||
Text="修改" Icon="Pencil" OnClick="btnMenuModify_Click">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuOut" EnablePostBack="true" runat="server" Hidden="true"
|
||||
<f:MenuButton ID="btnMenuOut" EnablePostBack="true" runat="server" EnableAjax="false" DisableControlBeforePostBack="false"
|
||||
Text="导出" Icon="Find" OnClick="btnMenuOut_Click">
|
||||
</f:MenuButton>
|
||||
<f:MenuButton ID="btnMenuDel" EnablePostBack="true" runat="server" Hidden="true"
|
||||
|
|
|
@ -6,11 +6,16 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using BLL;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
using Aspose.Words;
|
||||
using Aspose.Words.Tables;
|
||||
using System.IO;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.Manager
|
||||
{
|
||||
public partial class ManagerMonthCNew : PageBase
|
||||
{
|
||||
public List<Model.Base_Unit> unitList = new List<Model.Base_Unit>();
|
||||
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
|
@ -38,6 +43,7 @@ namespace FineUIPro.Web.HSSE.Manager
|
|||
//FilterDataRowItem = FilterDataRowItemImplement;
|
||||
if (!IsPostBack)
|
||||
{
|
||||
unitList = Funs.DB.Base_Unit.ToList();
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.ProjectId)
|
||||
{
|
||||
|
@ -204,23 +210,7 @@ namespace FineUIPro.Web.HSSE.Manager
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region 导出
|
||||
/// <summary>
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string MonthReportId = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MonthReportCOut.aspx?MonthReportId={0}", MonthReportId, "编辑 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
|
@ -431,5 +421,607 @@ namespace FineUIPro.Web.HSSE.Manager
|
|||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出
|
||||
#region 转换字符串
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 把单位Id转换为单位名称
|
||||
/// </summary>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertUnitName(string UnitId)
|
||||
{
|
||||
if (UnitId != null)
|
||||
{
|
||||
var u = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == UnitId.ToString());
|
||||
if (u != null)
|
||||
{
|
||||
return u.UnitName;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value">单元格内的值</param>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="cellWidth"></param>
|
||||
/// <param name="cellMerge"></param>
|
||||
/// <param name="CenterPage">有值的话就是序号</param>
|
||||
/// <param name="cellUnitLeft">字体居左</param>
|
||||
/// <returns></returns>
|
||||
public static Cell CreateCell(String value, Document doc, double cellWidth, string cellMerge = "", string CenterPage = "", string cellUnitLeft = "")
|
||||
{
|
||||
Cell cell = new Cell(doc);
|
||||
Paragraph p = new Paragraph(doc);
|
||||
if (!string.IsNullOrEmpty(cellMerge))
|
||||
{
|
||||
if (cellMerge == "0")
|
||||
{
|
||||
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.First;//竖直方向合并的第一个单元格
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.Previous;//竖直方向合并的第一个单元格
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CenterPage))
|
||||
{
|
||||
//序号
|
||||
value = " " + value;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cellUnitLeft))
|
||||
{
|
||||
p.ParagraphFormat.Alignment = ParagraphAlignment.Left;//表格中字体居左
|
||||
}
|
||||
else
|
||||
{
|
||||
p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//表格中字体居中
|
||||
}
|
||||
|
||||
|
||||
p.AppendChild(new Run(doc, value));
|
||||
|
||||
cell.CellFormat.Width = cellWidth;
|
||||
|
||||
cell.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;
|
||||
|
||||
//边框宽度
|
||||
cell.CellFormat.Borders.LineWidth = 0.5;
|
||||
|
||||
cell.AppendChild(p);
|
||||
return cell;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string Id = Grid1.SelectedRowID;//安全月报的主键
|
||||
|
||||
try
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initTemplatePath = string.Empty;
|
||||
string uploadfilepath = string.Empty;
|
||||
string newUrl = string.Empty;
|
||||
string filePath = string.Empty;
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
initTemplatePath = Const.HseMonthReportNewTemplateUrl;
|
||||
uploadfilepath = rootPath + initTemplatePath;
|
||||
//根据id获取月报主表数据
|
||||
var model = db.Manager_MonthReportC.FirstOrDefault(x => x.MonthReportId == Id);
|
||||
|
||||
var startDate = Convert.ToDateTime(model.StartDate);
|
||||
var endDate = Convert.ToDateTime(model.EndDate);
|
||||
//获取project
|
||||
var pModel = db.Base_Project.FirstOrDefault(x => x.ProjectId == model.ProjectId);
|
||||
var urlHz = startDate.ToString("yyyyMMdd") + "-"
|
||||
+ endDate.ToString("yyyyMMdd");
|
||||
|
||||
newUrl = uploadfilepath.Replace("项目安全月报", pModel.ShortName + "项目安全月报(" + model.MonthReportCode + ")" + urlHz);
|
||||
|
||||
if (File.Exists(newUrl))
|
||||
{
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
//更新书签内容
|
||||
Document doc = new Aspose.Words.Document(newUrl);
|
||||
DocumentBuilder builder = new DocumentBuilder(doc);
|
||||
#region 头部静态列
|
||||
//业主单位
|
||||
var unitsYz = (from x in db.Base_Unit
|
||||
join y in db.Project_ProjectUnit
|
||||
on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId && y.UnitType == BLL.Const.ProjectUnitType_4
|
||||
orderby x.UnitName
|
||||
select x).FirstOrDefault();
|
||||
|
||||
Bookmark bkmark = doc.Range.Bookmarks["username"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
|
||||
if (unitsYz != null)
|
||||
{
|
||||
bkmark.Text = unitsYz.UnitName;
|
||||
}
|
||||
//var uModel = db.Sys_User.FirstOrDefault(x => x.UserId == weekModel.CreateMan);
|
||||
//if (uModel!=null)
|
||||
//{
|
||||
// bkmark.Text = uModel.UserName;
|
||||
//}
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["projectNo"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ProjectCode;
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["createdate"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
//bkmark.Text = weekModel.CreateDate.ToString().Split(' ')[0].Replace('/', '.');
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["projectname"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ProjectName;
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["quamanagername"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
var getPUser = Funs.DB.Project_ProjectUser.Where(x => x.ProjectId == model.ProjectId);
|
||||
////安全经理
|
||||
var qa = getPUser.FirstOrDefault(x => x.RoleId.Contains(BLL.Const.HSSEManager));
|
||||
|
||||
bkmark.Text = db.Sys_User.FirstOrDefault(x => x.UserId == qa.UserId).UserName;
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["reportAlldate"];
|
||||
//20XX年XX月XX日至20XX年XX月XX日
|
||||
if (bkmark != null)
|
||||
{
|
||||
var sdate = Convert.ToDateTime(model.StartDate);
|
||||
var edate = Convert.ToDateTime(model.EndDate);
|
||||
bkmark.Text = sdate.Year + "年" + sdate.Month + "月" + sdate.Day + "日至" +
|
||||
edate.Year + "年" + edate.Month + "月" + edate.Day + "日";
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["reportindex"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.MonthReportCode;
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["fromcode"];
|
||||
//fromcode,项目号-RM-PQM-顺序号
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ProjectCode + "-RM-PQM-" + model.MonthReportCode;
|
||||
}
|
||||
#endregion
|
||||
#region 1.项目概况
|
||||
bkmark = doc.Range.Bookmarks["lbProjectName"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ProjectName;
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["lblMainUnitName"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
var mainUnit = BLL.UnitService.GetThisUnitDropDownList()[0];
|
||||
if (mainUnit != null)
|
||||
{
|
||||
bkmark.Text = mainUnit.UnitName;
|
||||
}
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblProjectAddress"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ProjectAddress;
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblProjectCode"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ProjectCode;
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblContractNo"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.ContractNo;
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblProjectType"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(pModel.ProjectType))
|
||||
{
|
||||
var c = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_ProjectType).
|
||||
FirstOrDefault(x => x.ID == pModel.ProjectType);
|
||||
if (c != null)
|
||||
{
|
||||
bkmark.Text = c.ConstText;
|
||||
}
|
||||
}
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblWorkRange"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.WorkRange;
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblDuration"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = pModel.Duration.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblStartDate"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = string.Format("{0:yyyy-MM-dd}", pModel.StartDate);
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["lblEndDate"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = string.Format("{0:yyyy-MM-dd}", pModel.EndDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 2.本月项目现场HSE人力投入情况
|
||||
//获取word文档中的第二个表格
|
||||
int whileIndex = 1;
|
||||
Aspose.Words.Tables.Table table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 1, true);
|
||||
bool isYm = true;
|
||||
//跳过页眉的表头
|
||||
while (isYm)
|
||||
{
|
||||
if (table.Range.Text.Substring(0, 2) != "单位")
|
||||
{
|
||||
whileIndex += 1;
|
||||
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
isYm = false;
|
||||
}
|
||||
}
|
||||
//人力投入情况
|
||||
var sorts = (from x in db.Manager_PersonSortC
|
||||
join y in db.Project_ProjectUnit
|
||||
on x.UnitId equals y.UnitId
|
||||
where x.MonthReportId == Id && y.ProjectId == this.ProjectId
|
||||
orderby y.UnitType
|
||||
select x).ToList();
|
||||
int numberIndex = 2;
|
||||
foreach (var item in sorts)
|
||||
{
|
||||
//创建行
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(ConvertUnitName(item.UnitId), doc, table.Rows[1].Cells[0].CellFormat.Width, "", "", "unit"));
|
||||
row.Cells.Add(CreateCell(item.SumPersonNum.ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.SumOutPersonNum.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.HSEPersonNum.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ContractRange.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.Remark.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
|
||||
numberIndex++;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
//创建合计
|
||||
Row rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("合计", doc, table.Rows[1].Cells[0].CellFormat.Width, "", "", "unit"));
|
||||
rowhj.Cells.Add(CreateCell((from x in sorts select x.SumPersonNum ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell((from x in sorts select x.SumOutPersonNum ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell((from x in sorts select x.HSEPersonNum ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[1].Cells[4].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("", doc, table.Rows[1].Cells[5].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
#endregion
|
||||
|
||||
#region 3.本月项目现场HSE工时/工日统计
|
||||
whileIndex += 1;
|
||||
bkmark = doc.Range.Bookmarks["MonthHSEDay"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.MonthHSEDay.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["SumHSEDay"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.SumHSEDay.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["MonthHSEWorkDay"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.MonthHSEWorkDay.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["YearHSEWorkDay"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.YearHSEWorkDay.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["SumHSEWorkDay"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.SumHSEWorkDay.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["HseManhours"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.HseManhours.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["SubcontractManHours"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.SubcontractManHours.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["TotalHseManhoursYear"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.TotalHseManhoursYear.ToString();
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["TotalHseManhours"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = model.TotalHseManhours.ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 4.1培训数据统计
|
||||
whileIndex += 1;
|
||||
var trainSorts = BLL.TrainSortCService.GetTrainSortsByMonthReportId(Id);
|
||||
if (trainSorts.Count>0)
|
||||
{
|
||||
foreach (var item in trainSorts)
|
||||
{
|
||||
if (item.TrainType == "员工入场安全教育")
|
||||
{
|
||||
bkmark = doc.Range.Bookmarks["classhours1"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.TeachHour.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["traincounts1"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.PersonNum.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["traincounts4"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.TotalPersonNum.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
else if (item.TrainType == "其他安全培训")
|
||||
{
|
||||
bkmark = doc.Range.Bookmarks["classhours2"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.TeachHour.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["traincounts2"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.PersonNum.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["traincounts5"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.TotalPersonNum.ToString();
|
||||
}
|
||||
}
|
||||
else {
|
||||
bkmark = doc.Range.Bookmarks["classhours3"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.TeachHour.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["traincounts3"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.PersonNum.ToString();
|
||||
}
|
||||
|
||||
bkmark = doc.Range.Bookmarks["traincounts6"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = item.TotalPersonNum.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
bkmark = doc.Range.Bookmarks["traincounts7"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = trainSorts.Sum(x => x.TotalPersonNum).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 4.2 现场HSE会议及检查统计
|
||||
var checkSorts = BLL.CheckSortCService.GetCheckSortsByMonthReportId(Id);
|
||||
if (checkSorts.Count > 0)
|
||||
{
|
||||
isYm = true;
|
||||
whileIndex += 1;
|
||||
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
|
||||
//跳过页眉的表头
|
||||
while (isYm)
|
||||
{
|
||||
if (table.Range.Text.Substring(0, 4) != "检查类型")
|
||||
{
|
||||
whileIndex += 1;
|
||||
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
isYm = false;
|
||||
}
|
||||
}
|
||||
numberIndex = 1;
|
||||
foreach (var item in checkSorts)
|
||||
{
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(item.CheckType, doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.CheckNumber.ToString(), doc, table.FirstRow.Cells[1].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.YearCheckNum.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.TotalCheckNum.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
numberIndex++;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 4.3 本月隐患整改情况
|
||||
//人力投入情况
|
||||
var HiddenDangersorts = (from x in db.Manager_HiddenDanger
|
||||
join y in db.Project_ProjectUnit
|
||||
on x.UnitId equals y.UnitId
|
||||
where x.MonthReportId == Id && y.ProjectId == this.ProjectId
|
||||
orderby y.UnitType
|
||||
select x).ToList();
|
||||
if (HiddenDangersorts.Count>0)
|
||||
{
|
||||
isYm = true;
|
||||
whileIndex += 1;
|
||||
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
|
||||
//跳过页眉的表头
|
||||
while (isYm)
|
||||
{
|
||||
if (table.Range.Text.Substring(0, 2) != "序号")
|
||||
{
|
||||
whileIndex += 1;
|
||||
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, whileIndex, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
isYm = false;
|
||||
}
|
||||
}
|
||||
numberIndex = 1;
|
||||
foreach (var item in HiddenDangersorts)
|
||||
{
|
||||
Row row = new Row(doc);
|
||||
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(ConvertUnitName(item.UnitId), doc, table.FirstRow.Cells[1].CellFormat.Width, "", "", "unit"));
|
||||
row.Cells.Add(CreateCell(item.CommonlyNum.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.MajorNum.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
row.Cells.Add(CreateCell(item.ReRate.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, row);
|
||||
numberIndex++;
|
||||
}
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
//合计
|
||||
rowhj = new Row(doc);
|
||||
rowhj.Cells.Add(CreateCell("本月隐患总数", doc, table.FirstRow.Cells[0].CellFormat.Width+table.FirstRow.Cells[1].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(model.MonthHdangerCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell("年度隐患总数", doc, table.FirstRow.Cells[3].CellFormat.Width));
|
||||
rowhj.Cells.Add(CreateCell(model.YearHdangerCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
|
||||
table.Rows.Insert(numberIndex, rowhj);
|
||||
|
||||
//自动设置表格样式
|
||||
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 4.4项目作业许可管理数据
|
||||
|
||||
#endregion
|
||||
|
||||
#region 设置页眉上的数据
|
||||
whileIndex = 1;
|
||||
table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 1, true);
|
||||
if (unitsYz != null)
|
||||
{
|
||||
//业主名称
|
||||
table.Rows[0].Cells[2].FirstParagraph.Runs[0].Text = unitsYz.UnitName;
|
||||
}
|
||||
|
||||
//项目号
|
||||
table.Rows[0].Cells[4].FirstParagraph.Runs[0].Text = pModel.ProjectCode;
|
||||
|
||||
//项目名称
|
||||
table.Rows[1].Cells[2].FirstParagraph.Runs[0].Text = pModel.ProjectName;
|
||||
table.Rows[1].Cells[3].FirstParagraph.Runs[0].Text = pModel.ProjectCode + "-RM-PQM-" + model.MonthReportCode;
|
||||
|
||||
//总页数
|
||||
table.Rows[2].Cells[7].FirstParagraph.Runs[0].Text = doc.PageCount.ToString();
|
||||
|
||||
bkmark = doc.Range.Bookmarks["CountPage"];
|
||||
if (bkmark != null)
|
||||
{
|
||||
bkmark.Text = doc.PageCount.ToString();
|
||||
}
|
||||
|
||||
//页眉是第二个表
|
||||
//tableIndex—要移动的表的索引。
|
||||
//rowIndex - 表中行的索引。
|
||||
//columnIndex—表中列的索引。
|
||||
//字符在单元格中的索引。目前只能指定0移动到单元格的开头,或指定 - 1移动到单元格的结尾。
|
||||
//builder.MoveToCell(1,0,2,0);
|
||||
//builder.Write(unitsYz.UnitName);
|
||||
#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)
|
||||
{
|
||||
Alert.ShowInTop(ex.Message, MessageBoxIcon.Warning);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -718,7 +718,8 @@
|
|||
});
|
||||
|
||||
$(".n-btn-l,.n-btn-r").click(function () {
|
||||
|
||||
var $item = $('.f-tabstrip-header')
|
||||
$item.attr('style', ";display:block !important;")
|
||||
|
||||
$('.n-btn-r').each(function (index) {
|
||||
console.log($(this))
|
||||
|
@ -733,6 +734,13 @@
|
|||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(".bgbtn_head").click(function () {
|
||||
var $item = $('.f-tabstrip-header')
|
||||
$item.attr('style', ";display:none !important;")
|
||||
})
|
||||
|
||||
var mainTabStrip = F(mainTabStripClientID);
|
||||
var leftPanel = F(leftPanelClientID);
|
||||
var mainMenu = leftPanel.items[0];
|
||||
|
|
Loading…
Reference in New Issue