This commit is contained in:
夏菊 2025-04-28 09:11:39 +08:00
commit a557ecdce6
23 changed files with 1497 additions and 121 deletions

View File

@ -32,6 +32,14 @@ namespace BLL
wordDoc = new Document(path);
}
public Document Document
{
get
{
return wordDoc;
}
}
/// <summary>
/// 添加图片
/// </summary>

View File

@ -1,5 +1,6 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JointCheckChartStatistics.aspx.cs"
Inherits="FineUIPro.Web.CQMS.Check.JointCheckChartStatistics" %>
<%@ Register Src="~/Controls/UnitProjectTControl.ascx" TagName="UnitProjectTControl" TagPrefix="uc1" %>
<%@ Register Src="~/Controls/ChartControl.ascx" TagName="ChartControl" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ -12,58 +13,77 @@
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="RegionPanel1" AjaxAspnetControls="divAccidentUnit,divAccidentTime" />
<f:Panel ID="Panel3" CssClass="blockpanel" runat="server" EnableCollapse="false"
BodyPadding="10px" ShowBorder="true" ShowHeader="false">
<Items>
<f:Form ID="Form2" ShowHeader="false" ShowBorder="false" runat="server">
<Rows>
<f:FormRow ColumnWidths="20% 3% 20% 30% 15% 10%">
<Items>
<f:DatePicker ID="txtStartRectificationTime" runat="server" Label="检查时间" LabelAlign="Right"
LabelWidth="80px">
</f:DatePicker>
<f:Label ID="Label3" runat="server" Text="至" Width="5px">
</f:Label>
<f:DatePicker ID="txtEndRectificationTime" runat="server">
</f:DatePicker>
<f:RadioButtonList ID="rblState" runat="server" Label="分析类型" LabelWidth="80px" Width="250px"
AutoPostBack="true" OnSelectedIndexChanged="drpChartType_SelectedIndexChanged">
<f:RadioItem Value="0" Selected="true" Text="按责任单位" />
<f:RadioItem Value="1" Text="按问题类别" />
</f:RadioButtonList>
<f:Button ID="BtnAnalyse" Text="统计" Icon="ChartPie" runat="server" OnClick="BtnAnalyse_Click">
</f:Button>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</Items>
</f:Panel>
<f:Panel ID="Panel4" CssClass="blockpanel" runat="server" EnableCollapse="false" MarginTop="10px"
BodyPadding="10px" ShowBorder="true" ShowHeader="false">
<Items>
<f:TabStrip ID="TabStrip1" CssClass="f-tabstrip-theme-simple" Height="400px" ShowBorder="true"
TabPosition="Top" MarginBottom="5px" EnableTabCloseMenu="false" runat="server">
<Tabs>
<f:Tab ID="Tab2" Title="图表" BodyPadding="5px" Layout="Fit" IconFont="Bookmark" runat="server"
TitleToolTip="图表">
<Items>
<f:ContentPanel ShowHeader="false" runat="server" ID="cpAccidentTime" Margin="0 0 0 0" >
<div id="divAccidentTime" style="width: 1000px; height: 300px;">
</div>
</f:ContentPanel>
</Items>
</f:Tab>
</Tabs>
</f:TabStrip>
</Items>
</f:Panel>
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server"/>
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
EnableCollapse="true" Width="380" Title="公司-项目" TitleToolTip="公司-项目" ShowBorder="true"
ShowHeader="true" AutoScroll="true" BodyPadding="5px" IconFont="ArrowCircleLeft" Layout="Fit">
<Items>
<f:ContentPanel ID="ContentPanel1" runat="server" ShowHeader="false" EnableCollapse="true" AutoScroll="true"
BodyPadding="0px">
<uc1:UnitProjectTControl ID="ucTree" runat="server" Onchange="changeTree"/>
</f:ContentPanel>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" AutoScroll="true">
<Items>
<f:Panel ID="Panel3" CssClass="blockpanel" runat="server" EnableCollapse="false"
BodyPadding="10px" ShowBorder="true" ShowHeader="false">
<Items>
<f:Form ID="Form2" ShowHeader="false" ShowBorder="false" runat="server">
<Rows>
<f:FormRow ColumnWidths="20% 3% 20% 30% 15% 10%">
<Items>
<f:DatePicker ID="txtStartRectificationTime" runat="server" Label="检查时间" LabelAlign="Right"
LabelWidth="80px">
</f:DatePicker>
<f:Label ID="Label3" runat="server" Text="至" Width="5px">
</f:Label>
<f:DatePicker ID="txtEndRectificationTime" runat="server">
</f:DatePicker>
<f:RadioButtonList ID="rblState" runat="server" Label="分析类型" LabelWidth="80px" Width="250px"
AutoPostBack="true" OnSelectedIndexChanged="drpChartType_SelectedIndexChanged">
<f:RadioItem Value="0" Selected="true" Text="按责任单位"/>
<f:RadioItem Value="1" Text="按问题类别"/>
</f:RadioButtonList>
<f:Button ID="BtnAnalyse" Text="统计" Icon="ChartPie" runat="server" OnClick="BtnAnalyse_Click">
</f:Button>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</Items>
</f:Panel>
<f:Panel ID="Panel4" CssClass="blockpanel" runat="server" EnableCollapse="false" MarginTop="10px"
BodyPadding="10px" ShowBorder="true" ShowHeader="false">
<Items>
<f:TabStrip ID="TabStrip1" CssClass="f-tabstrip-theme-simple" Height="400px" ShowBorder="true"
TabPosition="Top" MarginBottom="5px" EnableTabCloseMenu="false" runat="server">
<Tabs>
<f:Tab ID="Tab2" Title="图表" BodyPadding="5px" Layout="Fit" IconFont="Bookmark" runat="server"
TitleToolTip="图表">
<Items>
<f:ContentPanel ShowHeader="false" runat="server" ID="cpAccidentTime" Margin="0 0 0 0">
<div id="divAccidentTime" style="width: 1000px; height: 300px;">
</div>
</f:ContentPanel>
</Items>
</f:Tab>
</Tabs>
</f:TabStrip>
</Items>
</f:Panel>
</Items>
</f:Panel>
</Items>
</f:Panel>
</form>
</body>
<script language="javascript">

View File

@ -9,6 +9,33 @@ namespace FineUIPro.Web.CQMS.Check
{
public partial class JointCheckChartStatistics : PageBase
{
#region
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
/// <summary>
/// 公司级树加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void changeTree(object sender, EventArgs e)
{
this.ProjectId = this.ucTree.ProjectId;
this.AnalyseData();
}
#region
/// <summary>
/// 加载页面
@ -19,6 +46,17 @@ namespace FineUIPro.Web.CQMS.Check
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
{
this.ProjectId = Request.Params["projectId"];
}
this.ucTree.UnitId = this.CurrUser.UnitId;
this.ucTree.ProjectId = this.ProjectId;
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId) )
{
this.panelLeftRegion.Hidden = true;
}
this.txtStartRectificationTime.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
this.txtEndRectificationTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
}
@ -48,6 +86,10 @@ namespace FineUIPro.Web.CQMS.Check
/// </summary>
private void AnalyseData()
{
if (string.IsNullOrEmpty(this.ProjectId))
{
return;
}
if (this.rblState.SelectedValue == "0")
{
@ -68,7 +110,7 @@ namespace FineUIPro.Web.CQMS.Check
}
strSql += " group by UnitId,unitName ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
@ -140,7 +182,7 @@ namespace FineUIPro.Web.CQMS.Check
}
strSql += " group by QuestionDef,QuestionTypeStr ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);

View File

@ -32,6 +32,51 @@ namespace FineUIPro.Web.CQMS.Check
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// ContentPanel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ContentPanel ContentPanel1;
/// <summary>
/// ucTree 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Web.Controls.UnitProjectTControl ucTree;
/// <summary>
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Panel3 控件。
/// </summary>

View File

@ -0,0 +1,31 @@
安全质量环保检查记录
编号20250105
|项目名称|«projectName» |
|项 | «remark» |
|目 | |
|概 | |
|况 | |
|工程名称|«projectName» |
|检 |为深入贯彻《关于做好今冬明春重大事故隐患排杏整治的通知》、《关 |
|查 |于开展建筑施工安全生产“自查自纠”活动的通知》、《关于开展我市建|
|发 |筑施工安全“强执法 |
|现 |补短板”专项行动的通知》等文件要求,加强项目危大工程安全管控,|
|的 |2025年1月5日由项目经理带队项目领导班子副职以及项目安质部|
|问 |、工程部、物设部、工经部、办公室等部门、分包单位相关人员参加|
|题 |,对本项目在建工程进行了专项检查暨安全质量环保周常检查记录 |
| |,现将具体检查问题记录如下: |
| |现场问题: |
| | |
| | |
|被检查单| |
|位负责人|年 月 日 |
|检查单位|中化学建设投资集团安徽工程有限公司«projectName» |
|检查人员| |
| |年 月 日 |
本表一式2份整改单位、检查单位各1份验证存档。

View File

@ -25,7 +25,7 @@
<f:Button ID="btnSubmit" OnClick="btnSubmit_Click" Icon="SystemSaveNew" runat="server" Text="提交" ToolTip="提交"
ValidateForms="SimpleForm1">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
@ -67,7 +67,7 @@
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" AllowCellEditing="true" Title="安全隐患及整改要求"
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" AllowCellEditing="true" Title="安全隐患及整改要求" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="RectifyNoticesItemId" DataIDField="RectifyNoticesItemId" EnableColumnLines="true"
AllowSorting="true" SortField="RectifyNoticesItemId" SortDirection="ASC" EnableTextSelection="True" MinHeight="240px"
EnableRowDoubleClickEvent="true" OnRowCommand="Grid1_RowCommand" PageSize="500" >
@ -116,6 +116,9 @@
<f:LinkButtonField ID="del" ColumnID="del" HeaderText="删除" Width="60px" HeaderTextAlign="Center"
CommandName="delete" Icon="Delete" />
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu"/>
</Listeners>
</f:Grid>
</Items>
</f:FormRow>
@ -165,6 +168,22 @@
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
Text="导出" Icon="Printer" OnClick="btnPrinter_Click" EnableAjax="false" DisableControlBeforePostBack="false">
</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>

View File

@ -5,7 +5,11 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
namespace FineUIPro.Web.HSSE.Check
{
@ -417,5 +421,188 @@ namespace FineUIPro.Web.HSSE.Check
//}
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrinter_Click(object sender, EventArgs e)
{
//获取所有列表导出
if (!string.IsNullOrEmpty(this.RectifyNoticesId))
{
var rectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId);
string CheckManIds = rectifyNotices.CheckManIds;
string CheckManNames = string.Empty;
if (CheckManIds != null)
{
string[] Ids = CheckManIds.ToString().Split(',');
foreach (string t in Ids)
{
var Name = BLL.UserService.GetUserNameByUserId(t);
if (Name != null)
{
CheckManNames += Name + ",";
}
}
}
string DutyPersonId = rectifyNotices.DutyPersonId;
string DutyPersonName = UserService.GetUserNameByUserId(DutyPersonId);
var dataList = (from item in Funs.DB.Check_RectifyNoticesItem
join rectify in Funs.DB.Technique_Rectify
on item.RectifyId equals rectify.RectifyId into rectifyGroup
from rectify in rectifyGroup.DefaultIfEmpty()
where item.RectifyNoticesId == RectifyNoticesId
select new
{
RectifyNoticesItemId = item.RectifyNoticesItemId,
RectifyId = rectify.RectifyName,
RectifyNoticesId = item.RectifyNoticesId,
WrongContent = item.WrongContent,
Requirement = item.Requirement,
LimitTime = item.LimitTime,
RectifyResults = item.RectifyResults,
IsRectify = item.IsRectify
}).ToList();
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
initTemplatePath = "File\\Word\\HSSE\\安全质量环保检查记录(模板)建投隐患整改通知单.doc";
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", RectifyNoticesId + ".doc");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
var project =
(from x in Funs.DB.Base_Project where x.ProjectId == this.CurrUser.LoginProjectId select x)
.FirstOrDefault();
string projectName = project.ProjectName;
string remark = project.Remark;
string[] fieldNames =
{
"projectName", "remark"
};
object[] fieldValues =
{
projectName, remark
};
helper.Executefield(fieldNames, fieldValues); //域赋值
if (dataList.Count > 0)
{
Document doc = helper.Document;
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = (Table)doc.GetChild(NodeType.Table, 1, true); // 定位第一个表格
int number = 1;
foreach (var item in dataList)
{
string WrongContent = item.WrongContent;
string Requirement = item.Requirement;
string LimitTime = item.LimitTime.HasValue
? $" {item.LimitTime.Value.Year} 年 {item.LimitTime.Value.Month:D2} 月 {item.LimitTime.Value.Day:D2} 日"
: "";
List<string> Paths = new List<string>();
var res = AttachFileService.getFileUrl(item.RectifyNoticesItemId + "#1");
if (!string.IsNullOrEmpty(res))
{
string[] arr = res.Split(',');
for (int i = 0; i < arr.Length; i++)
{
Paths.Add(rootPath + arr[i]);
}
}
// 克隆模板占位行
Row newRow = (Row)table.LastRow.Clone(true);
table.AppendChild(newRow);
// 定位到单元格
Cell cell = newRow.FirstCell;
// 清空单元格所有段落
cell.RemoveAllChildren();
Paragraph para = new Paragraph(doc); // 显式创建段落
cell.AppendChild(para);
builder.MoveTo(para); // 定位到段落
// 插入文本
builder.Write(" 存在问题" + number.ToString() + "" + WrongContent);
builder.Writeln(); // 换行
builder.Write(" 整改要求:" + Requirement);
builder.Writeln(); // 换行
builder.Write(" 整改时间:" + LimitTime + " 整改责任人:" + DutyPersonName + " 监督人:" +
CheckManNames);
builder.Writeln(); // 换行
// 插入多张图片(横向排列)
if (Paths.Count > 0)
{
foreach (string imgPath in Paths)
{
// 计算每张图片宽度(总宽度按单元格宽度平分)
double cellWidth = cell.CellFormat.Width;
double imgWidth = (cellWidth - 10 * (Paths.Count - 1)) / Paths.Count - 10;
// 插入图片并调整尺寸
Shape image = builder.InsertImage(imgPath);
image.Width = Paths.Count == 1 ? imgWidth / 2 : imgWidth;
// image.Height = image.ImageData.ImageSize.HeightPixels * (imgWidth / image.ImageData.ImageSize.WidthPixels);
image.Height = 120;
// 图片间留间距(横向排列)
if (imgPath != Paths.Last())
{
builder.MoveTo(cell.LastParagraph.AppendChild(new Run(doc)));
builder.Write(" "); // 插入空格分隔
}
}
}
number++;
}
// 删除模板中的原始占位行
table.Rows.RemoveAt(0);
}
helper.SaveDoc(newUrl); //文件保存保存为doc
// 验证文件是否存在
if (!File.Exists(newUrl))
{
throw new Exception("文件不存在: " + 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);
}
}
}
}

View File

@ -7,11 +7,13 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Check {
public partial class RectifyNoticesAdd {
namespace FineUIPro.Web.HSSE.Check
{
public partial class RectifyNoticesAdd
{
/// <summary>
/// form1 控件。
/// </summary>
@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel4 控件。
/// </summary>
@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel4;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar1 控件。
/// </summary>
@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// hdRectifyNoticesId 控件。
/// </summary>
@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdRectifyNoticesId;
/// <summary>
/// btnSave 控件。
/// </summary>
@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnSubmit 控件。
/// </summary>
@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSubmit;
/// <summary>
/// txtRectifyNoticesCode 控件。
/// </summary>
@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtRectifyNoticesCode;
/// <summary>
/// drpUnitId 控件。
/// </summary>
@ -101,7 +103,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpUnitId;
/// <summary>
/// drpWorkAreaId 控件。
/// </summary>
@ -110,7 +112,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpWorkAreaId;
/// <summary>
/// drpCheckMan 控件。
/// </summary>
@ -119,7 +121,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpCheckMan;
/// <summary>
/// txtCheckPerson 控件。
/// </summary>
@ -128,7 +130,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCheckPerson;
/// <summary>
/// txtCheckedDate 控件。
/// </summary>
@ -137,7 +139,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtCheckedDate;
/// <summary>
/// drpHiddenHazardType 控件。
/// </summary>
@ -146,7 +148,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpHiddenHazardType;
/// <summary>
/// Grid1 控件。
/// </summary>
@ -155,7 +157,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// toolAdd 控件。
/// </summary>
@ -164,7 +166,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar toolAdd;
/// <summary>
/// btnAdd 控件。
/// </summary>
@ -173,7 +175,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAdd;
/// <summary>
/// drpRectifyId 控件。
/// </summary>
@ -182,7 +184,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpRectifyId;
/// <summary>
/// tWrongContent 控件。
/// </summary>
@ -191,7 +193,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox tWrongContent;
/// <summary>
/// tRequirement 控件。
/// </summary>
@ -200,7 +202,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox tRequirement;
/// <summary>
/// txtLimitTimes 控件。
/// </summary>
@ -209,7 +211,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtLimitTimes;
/// <summary>
/// del 控件。
/// </summary>
@ -218,7 +220,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.LinkButtonField del;
/// <summary>
/// drpSignPerson 控件。
/// </summary>
@ -227,7 +229,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpSignPerson;
/// <summary>
/// gvFlowOperate 控件。
/// </summary>
@ -236,7 +238,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvFlowOperate;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
@ -245,7 +247,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
/// <summary>
/// WindowAtt 控件。
/// </summary>
@ -254,5 +256,23 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
}
}

View File

@ -57,7 +57,7 @@
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="安全隐患及整改要求" runat="server"
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="安全隐患及整改要求" runat="server" EnableCollapse="true"
DataKeyNames="RectifyNoticesItemId" DataIDField="RectifyNoticesItemId" EnableColumnLines="true" PageSize="500"
AllowSorting="true" SortField="RectifyNoticesItemId" SortDirection="ASC" EnableTextSelection="True" MinHeight="240px">
<Columns>
@ -92,6 +92,9 @@
HeaderText="合格" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu"/>
</Listeners>
</f:Grid>
</Items>
</f:FormRow>
@ -167,6 +170,22 @@
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</form>
<f:Menu ID="Menu1" runat="server">
<Items>
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
Text="导出" Icon="Printer" OnClick="btnPrinter_Click" EnableAjax="false" DisableControlBeforePostBack="false">
</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>

View File

@ -6,6 +6,10 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.IO;
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
namespace FineUIPro.Web.HSSE.Check
{
@ -315,5 +319,189 @@ namespace FineUIPro.Web.HSSE.Check
}
}
}
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrinter_Click(object sender, EventArgs e)
{
//获取所有列表导出
if (!string.IsNullOrEmpty(this.RectifyNoticesId))
{
var rectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId);
string CheckManIds = rectifyNotices.CheckManIds;
string CheckManNames = string.Empty;
if (CheckManIds != null)
{
string[] Ids = CheckManIds.ToString().Split(',');
foreach (string t in Ids)
{
var Name = BLL.UserService.GetUserNameByUserId(t);
if (Name != null)
{
CheckManNames += Name + ",";
}
}
}
string DutyPersonId = rectifyNotices.DutyPersonId;
string DutyPersonName = UserService.GetUserNameByUserId(DutyPersonId);
var dataList = (from item in Funs.DB.Check_RectifyNoticesItem
join rectify in Funs.DB.Technique_Rectify
on item.RectifyId equals rectify.RectifyId into rectifyGroup
from rectify in rectifyGroup.DefaultIfEmpty()
where item.RectifyNoticesId == RectifyNoticesId
select new
{
RectifyNoticesItemId = item.RectifyNoticesItemId,
RectifyId = rectify.RectifyName,
RectifyNoticesId = item.RectifyNoticesId,
WrongContent = item.WrongContent,
Requirement = item.Requirement,
LimitTime = item.LimitTime,
RectifyResults = item.RectifyResults,
IsRectify = item.IsRectify
}).ToList();
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
initTemplatePath = "File\\Word\\HSSE\\安全质量环保检查记录(模板)建投隐患整改通知单.doc";
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", RectifyNoticesId + ".doc");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
var project =
(from x in Funs.DB.Base_Project where x.ProjectId == this.CurrUser.LoginProjectId select x)
.FirstOrDefault();
string projectName = project.ProjectName;
string remark = project.Remark;
string[] fieldNames =
{
"projectName", "remark"
};
object[] fieldValues =
{
projectName, remark
};
helper.Executefield(fieldNames, fieldValues); //域赋值
if (dataList.Count > 0)
{
Document doc = helper.Document;
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = (Table)doc.GetChild(NodeType.Table, 1, true); // 定位第一个表格
int number = 1;
foreach (var item in dataList)
{
string WrongContent = item.WrongContent;
string Requirement = item.Requirement;
string LimitTime = item.LimitTime.HasValue
? $" {item.LimitTime.Value.Year} 年 {item.LimitTime.Value.Month:D2} 月 {item.LimitTime.Value.Day:D2} 日"
: "";
List<string> Paths = new List<string>();
var res = AttachFileService.getFileUrl(item.RectifyNoticesItemId + "#1");
if (!string.IsNullOrEmpty(res))
{
string[] arr = res.Split(',');
for (int i = 0; i < arr.Length; i++)
{
Paths.Add(rootPath + arr[i]);
}
}
// 克隆模板占位行
Row newRow = (Row)table.LastRow.Clone(true);
table.AppendChild(newRow);
// 定位到单元格
Cell cell = newRow.FirstCell;
// 清空单元格所有段落
cell.RemoveAllChildren();
Paragraph para = new Paragraph(doc); // 显式创建段落
cell.AppendChild(para);
builder.MoveTo(para); // 定位到段落
// 插入文本
builder.Write(" 存在问题" + number.ToString() + "" + WrongContent);
builder.Writeln(); // 换行
builder.Write(" 整改要求:" + Requirement);
builder.Writeln(); // 换行
builder.Write(" 整改时间:" + LimitTime + " 整改责任人:" + DutyPersonName + " 监督人:" +
CheckManNames);
builder.Writeln(); // 换行
// 插入多张图片(横向排列)
if (Paths.Count > 0)
{
foreach (string imgPath in Paths)
{
// 计算每张图片宽度(总宽度按单元格宽度平分)
double cellWidth = cell.CellFormat.Width;
double imgWidth = (cellWidth - 10 * (Paths.Count - 1)) / Paths.Count - 10;
// 插入图片并调整尺寸
Shape image = builder.InsertImage(imgPath);
image.Width = Paths.Count == 1 ? imgWidth / 2 : imgWidth;
// image.Height = image.ImageData.ImageSize.HeightPixels * (imgWidth / image.ImageData.ImageSize.WidthPixels);
image.Height = 120;
// 图片间留间距(横向排列)
if (imgPath != Paths.Last())
{
builder.MoveTo(cell.LastParagraph.AppendChild(new Run(doc)));
builder.Write(" "); // 插入空格分隔
}
}
}
number++;
}
// 删除模板中的原始占位行
table.Rows.RemoveAt(0);
}
helper.SaveDoc(newUrl); //文件保存保存为doc
// 验证文件是否存在
if (!File.Exists(newUrl))
{
throw new Exception("文件不存在: " + 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);
}
}
}
}

View File

@ -265,5 +265,23 @@ namespace FineUIPro.Web.HSSE.Check
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
}
}

View File

@ -58,7 +58,7 @@
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="安全隐患及整改要求" runat="server" AllowCellEditing="true"
DataKeyNames="RectifyNoticesItemId" DataIDField="RectifyNoticesItemId" EnableColumnLines="true"
DataKeyNames="RectifyNoticesItemId" DataIDField="RectifyNoticesItemId" EnableColumnLines="true" EnableCollapse="true"
AllowSorting="true" SortField="RectifyNoticesItemId" SortDirection="ASC" EnableTextSelection="True"
MinHeight="240px" PageSize="500">
<Columns>
@ -176,6 +176,13 @@
</Items>
</f:Panel>
</form>
<f:Menu ID="Menu1" runat="server">
<Items>
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
Text="导出" Icon="Printer" OnClick="btnPrinter_Click" EnableAjax="false" DisableControlBeforePostBack="false">
</f:MenuButton>
</Items>
</f:Menu>
<script type="text/javascript">
var rdbIsAgreeID = '<%= rdbIsAgree.ClientID %>';
var grid1ClientID = '<%= Grid1.ClientID %>';
@ -198,6 +205,15 @@
// 回发到后台更新
__doPostBack('', 'UPDATE_SUMMARY');
var menuID = '<%= Menu1.ClientID %>';
// 返回false来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
}
</script>
</body>

View File

@ -6,7 +6,11 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.IO;
using System.Linq;
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
namespace FineUIPro.Web.HSSE.Check
{
public partial class RectifyNoticesRecheck : PageBase
@ -334,5 +338,189 @@ namespace FineUIPro.Web.HSSE.Check
}
this.lbCom.Hidden = !this.lbDutyPerson.Hidden;
}
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrinter_Click(object sender, EventArgs e)
{
//获取所有列表导出
if (!string.IsNullOrEmpty(this.RectifyNoticesId))
{
var rectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId);
string CheckManIds = rectifyNotices.CheckManIds;
string CheckManNames = string.Empty;
if (CheckManIds != null)
{
string[] Ids = CheckManIds.ToString().Split(',');
foreach (string t in Ids)
{
var Name = BLL.UserService.GetUserNameByUserId(t);
if (Name != null)
{
CheckManNames += Name + ",";
}
}
}
string DutyPersonId = rectifyNotices.DutyPersonId;
string DutyPersonName = UserService.GetUserNameByUserId(DutyPersonId);
var dataList = (from item in Funs.DB.Check_RectifyNoticesItem
join rectify in Funs.DB.Technique_Rectify
on item.RectifyId equals rectify.RectifyId into rectifyGroup
from rectify in rectifyGroup.DefaultIfEmpty()
where item.RectifyNoticesId == RectifyNoticesId
select new
{
RectifyNoticesItemId = item.RectifyNoticesItemId,
RectifyId = rectify.RectifyName,
RectifyNoticesId = item.RectifyNoticesId,
WrongContent = item.WrongContent,
Requirement = item.Requirement,
LimitTime = item.LimitTime,
RectifyResults = item.RectifyResults,
IsRectify = item.IsRectify
}).ToList();
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
initTemplatePath = "File\\Word\\HSSE\\安全质量环保检查记录(模板)建投隐患整改通知单.doc";
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", RectifyNoticesId + ".doc");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
var project =
(from x in Funs.DB.Base_Project where x.ProjectId == this.CurrUser.LoginProjectId select x)
.FirstOrDefault();
string projectName = project.ProjectName;
string remark = project.Remark;
string[] fieldNames =
{
"projectName", "remark"
};
object[] fieldValues =
{
projectName, remark
};
helper.Executefield(fieldNames, fieldValues); //域赋值
if (dataList.Count > 0)
{
Document doc = helper.Document;
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = (Table)doc.GetChild(NodeType.Table, 1, true); // 定位第一个表格
int number = 1;
foreach (var item in dataList)
{
string WrongContent = item.WrongContent;
string Requirement = item.Requirement;
string LimitTime = item.LimitTime.HasValue
? $" {item.LimitTime.Value.Year} 年 {item.LimitTime.Value.Month:D2} 月 {item.LimitTime.Value.Day:D2} 日"
: "";
List<string> Paths = new List<string>();
var res = AttachFileService.getFileUrl(item.RectifyNoticesItemId + "#1");
if (!string.IsNullOrEmpty(res))
{
string[] arr = res.Split(',');
for (int i = 0; i < arr.Length; i++)
{
Paths.Add(rootPath + arr[i]);
}
}
// 克隆模板占位行
Row newRow = (Row)table.LastRow.Clone(true);
table.AppendChild(newRow);
// 定位到单元格
Cell cell = newRow.FirstCell;
// 清空单元格所有段落
cell.RemoveAllChildren();
Paragraph para = new Paragraph(doc); // 显式创建段落
cell.AppendChild(para);
builder.MoveTo(para); // 定位到段落
// 插入文本
builder.Write(" 存在问题" + number.ToString() + "" + WrongContent);
builder.Writeln(); // 换行
builder.Write(" 整改要求:" + Requirement);
builder.Writeln(); // 换行
builder.Write(" 整改时间:" + LimitTime + " 整改责任人:" + DutyPersonName + " 监督人:" +
CheckManNames);
builder.Writeln(); // 换行
// 插入多张图片(横向排列)
if (Paths.Count > 0)
{
foreach (string imgPath in Paths)
{
// 计算每张图片宽度(总宽度按单元格宽度平分)
double cellWidth = cell.CellFormat.Width;
double imgWidth = (cellWidth - 10 * (Paths.Count - 1)) / Paths.Count - 10;
// 插入图片并调整尺寸
Shape image = builder.InsertImage(imgPath);
image.Width = Paths.Count == 1 ? imgWidth / 2 : imgWidth;
// image.Height = image.ImageData.ImageSize.HeightPixels * (imgWidth / image.ImageData.ImageSize.WidthPixels);
image.Height = 120;
// 图片间留间距(横向排列)
if (imgPath != Paths.Last())
{
builder.MoveTo(cell.LastParagraph.AppendChild(new Run(doc)));
builder.Write(" "); // 插入空格分隔
}
}
}
number++;
}
// 删除模板中的原始占位行
table.Rows.RemoveAt(0);
}
helper.SaveDoc(newUrl); //文件保存保存为doc
// 验证文件是否存在
if (!File.Exists(newUrl))
{
throw new Exception("文件不存在: " + 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);
}
}
}
}

View File

@ -283,5 +283,23 @@ namespace FineUIPro.Web.HSSE.Check
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
}
}

View File

@ -59,7 +59,7 @@
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="安全隐患及整改要求" runat="server" AllowCellEditing="true"
DataKeyNames="RectifyNoticesItemId" DataIDField="RectifyNoticesItemId" EnableColumnLines="true"
DataKeyNames="RectifyNoticesItemId" DataIDField="RectifyNoticesItemId" EnableColumnLines="true" EnableCollapse="true"
AllowSorting="true" SortField="RectifyNoticesItemId" SortDirection="ASC" EnableTextSelection="True"
OnRowCommand="Grid1_RowCommand" MinHeight="240px" PageSize="500">
<Columns>
@ -100,6 +100,9 @@
<f:LinkButtonField HeaderText="整改*" ConfirmTarget="Top" Width="80" CommandName="AttachUrl"
HeaderTextAlign="Center" TextAlign="Center" ToolTip="整改照片" Text="照片" />
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu"/>
</Listeners>
</f:Grid>
</Items>
</f:FormRow>
@ -149,6 +152,22 @@
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</form>
<f:Menu ID="Menu1" runat="server">
<Items>
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
Text="导出" Icon="Printer" OnClick="btnPrinter_Click" EnableAjax="false" DisableControlBeforePostBack="false">
</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>

View File

@ -6,7 +6,11 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.IO;
using System.Linq;
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
namespace FineUIPro.Web.HSSE.Check
{
public partial class RectifyNoticesRectify : PageBase
@ -273,5 +277,188 @@ namespace FineUIPro.Web.HSSE.Check
}
}
#endregion
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrinter_Click(object sender, EventArgs e)
{
//获取所有列表导出
if (!string.IsNullOrEmpty(this.RectifyNoticesId))
{
var rectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId);
string CheckManIds = rectifyNotices.CheckManIds;
string CheckManNames = string.Empty;
if (CheckManIds != null)
{
string[] Ids = CheckManIds.ToString().Split(',');
foreach (string t in Ids)
{
var Name = BLL.UserService.GetUserNameByUserId(t);
if (Name != null)
{
CheckManNames += Name + ",";
}
}
}
string DutyPersonId = rectifyNotices.DutyPersonId;
string DutyPersonName = UserService.GetUserNameByUserId(DutyPersonId);
var dataList = (from item in Funs.DB.Check_RectifyNoticesItem
join rectify in Funs.DB.Technique_Rectify
on item.RectifyId equals rectify.RectifyId into rectifyGroup
from rectify in rectifyGroup.DefaultIfEmpty()
where item.RectifyNoticesId == RectifyNoticesId
select new
{
RectifyNoticesItemId = item.RectifyNoticesItemId,
RectifyId = rectify.RectifyName,
RectifyNoticesId = item.RectifyNoticesId,
WrongContent = item.WrongContent,
Requirement = item.Requirement,
LimitTime = item.LimitTime,
RectifyResults = item.RectifyResults,
IsRectify = item.IsRectify
}).ToList();
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
initTemplatePath = "File\\Word\\HSSE\\安全质量环保检查记录(模板)建投隐患整改通知单.doc";
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", RectifyNoticesId + ".doc");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
var project =
(from x in Funs.DB.Base_Project where x.ProjectId == this.CurrUser.LoginProjectId select x)
.FirstOrDefault();
string projectName = project.ProjectName;
string remark = project.Remark;
string[] fieldNames =
{
"projectName", "remark"
};
object[] fieldValues =
{
projectName, remark
};
helper.Executefield(fieldNames, fieldValues); //域赋值
if (dataList.Count > 0)
{
Document doc = helper.Document;
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = (Table)doc.GetChild(NodeType.Table, 1, true); // 定位第一个表格
int number = 1;
foreach (var item in dataList)
{
string WrongContent = item.WrongContent;
string Requirement = item.Requirement;
string LimitTime = item.LimitTime.HasValue
? $" {item.LimitTime.Value.Year} 年 {item.LimitTime.Value.Month:D2} 月 {item.LimitTime.Value.Day:D2} 日"
: "";
List<string> Paths = new List<string>();
var res = AttachFileService.getFileUrl(item.RectifyNoticesItemId + "#1");
if (!string.IsNullOrEmpty(res))
{
string[] arr = res.Split(',');
for (int i = 0; i < arr.Length; i++)
{
Paths.Add(rootPath + arr[i]);
}
}
// 克隆模板占位行
Row newRow = (Row)table.LastRow.Clone(true);
table.AppendChild(newRow);
// 定位到单元格
Cell cell = newRow.FirstCell;
// 清空单元格所有段落
cell.RemoveAllChildren();
Paragraph para = new Paragraph(doc); // 显式创建段落
cell.AppendChild(para);
builder.MoveTo(para); // 定位到段落
// 插入文本
builder.Write(" 存在问题" + number.ToString() + "" + WrongContent);
builder.Writeln(); // 换行
builder.Write(" 整改要求:" + Requirement);
builder.Writeln(); // 换行
builder.Write(" 整改时间:" + LimitTime + " 整改责任人:" + DutyPersonName + " 监督人:" +
CheckManNames);
builder.Writeln(); // 换行
// 插入多张图片(横向排列)
if (Paths.Count > 0)
{
foreach (string imgPath in Paths)
{
// 计算每张图片宽度(总宽度按单元格宽度平分)
double cellWidth = cell.CellFormat.Width;
double imgWidth = (cellWidth - 10 * (Paths.Count - 1)) / Paths.Count - 10;
// 插入图片并调整尺寸
Shape image = builder.InsertImage(imgPath);
image.Width = Paths.Count == 1 ? imgWidth / 2 : imgWidth;
// image.Height = image.ImageData.ImageSize.HeightPixels * (imgWidth / image.ImageData.ImageSize.WidthPixels);
image.Height = 120;
// 图片间留间距(横向排列)
if (imgPath != Paths.Last())
{
builder.MoveTo(cell.LastParagraph.AppendChild(new Run(doc)));
builder.Write(" "); // 插入空格分隔
}
}
}
number++;
}
// 删除模板中的原始占位行
table.Rows.RemoveAt(0);
}
helper.SaveDoc(newUrl); //文件保存保存为doc
// 验证文件是否存在
if (!File.Exists(newUrl))
{
throw new Exception("文件不存在: " + 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);
}
}
}
}

View File

@ -211,5 +211,23 @@ namespace FineUIPro.Web.HSSE.Check
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
}
}

View File

@ -94,6 +94,9 @@
HeaderText="合格" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu"/>
</Listeners>
</f:Grid>
</Items>
</f:FormRow>
@ -135,6 +138,22 @@
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
<f:MenuButton ID="btnPrinter" EnablePostBack="true" runat="server"
Text="导出" Icon="Printer" OnClick="btnPrinter_Click" EnableAjax="false" DisableControlBeforePostBack="false">
</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>

View File

@ -3,7 +3,11 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
namespace FineUIPro.Web.HSSE.Check
{
public partial class RectifyNoticesView1 : PageBase
@ -120,5 +124,189 @@ namespace FineUIPro.Web.HSSE.Check
}
return url;
}
/// <summary>
/// 导出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrinter_Click(object sender, EventArgs e)
{
//获取所有列表导出
if (!string.IsNullOrEmpty(this.RectifyNoticesId))
{
var rectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId);
string CheckManIds = rectifyNotices.CheckManIds;
string CheckManNames = string.Empty;
if (CheckManIds != null)
{
string[] Ids = CheckManIds.ToString().Split(',');
foreach (string t in Ids)
{
var Name = BLL.UserService.GetUserNameByUserId(t);
if (Name != null)
{
CheckManNames += Name + ",";
}
}
}
string DutyPersonId = rectifyNotices.DutyPersonId;
string DutyPersonName = UserService.GetUserNameByUserId(DutyPersonId);
var dataList = (from item in Funs.DB.Check_RectifyNoticesItem
join rectify in Funs.DB.Technique_Rectify
on item.RectifyId equals rectify.RectifyId into rectifyGroup
from rectify in rectifyGroup.DefaultIfEmpty()
where item.RectifyNoticesId == RectifyNoticesId
select new
{
RectifyNoticesItemId = item.RectifyNoticesItemId,
RectifyId = rectify.RectifyName,
RectifyNoticesId = item.RectifyNoticesId,
WrongContent = item.WrongContent,
Requirement = item.Requirement,
LimitTime = item.LimitTime,
RectifyResults = item.RectifyResults,
IsRectify = item.IsRectify
}).ToList();
string rootPath = Server.MapPath("~/");
string initTemplatePath = string.Empty;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
initTemplatePath = "File\\Word\\HSSE\\安全质量环保检查记录(模板)建投隐患整改通知单.doc";
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", RectifyNoticesId + ".doc");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
AsposeWordHelper helper = new AsposeWordHelper();
helper.OpenTempelte(newUrl); //打开模板文件
var project =
(from x in Funs.DB.Base_Project where x.ProjectId == this.CurrUser.LoginProjectId select x)
.FirstOrDefault();
string projectName = project.ProjectName;
string remark = project.Remark;
string[] fieldNames =
{
"projectName", "remark"
};
object[] fieldValues =
{
projectName, remark
};
helper.Executefield(fieldNames, fieldValues); //域赋值
if (dataList.Count > 0)
{
Document doc = helper.Document;
DocumentBuilder builder = new DocumentBuilder(doc);
Table table = (Table)doc.GetChild(NodeType.Table, 1, true); // 定位第一个表格
int number = 1;
foreach (var item in dataList)
{
string WrongContent = item.WrongContent;
string Requirement = item.Requirement;
string LimitTime = item.LimitTime.HasValue
? $" {item.LimitTime.Value.Year} 年 {item.LimitTime.Value.Month:D2} 月 {item.LimitTime.Value.Day:D2} 日"
: "";
List<string> Paths = new List<string>();
var res = AttachFileService.getFileUrl(item.RectifyNoticesItemId + "#1");
if (!string.IsNullOrEmpty(res))
{
string[] arr = res.Split(',');
for (int i = 0; i < arr.Length; i++)
{
Paths.Add(rootPath + arr[i]);
}
}
// 克隆模板占位行
Row newRow = (Row)table.LastRow.Clone(true);
table.AppendChild(newRow);
// 定位到单元格
Cell cell = newRow.FirstCell;
// 清空单元格所有段落
cell.RemoveAllChildren();
Paragraph para = new Paragraph(doc); // 显式创建段落
cell.AppendChild(para);
builder.MoveTo(para); // 定位到段落
// 插入文本
builder.Write(" 存在问题" + number.ToString() + "" + WrongContent);
builder.Writeln(); // 换行
builder.Write(" 整改要求:" + Requirement);
builder.Writeln(); // 换行
builder.Write(" 整改时间:" + LimitTime + " 整改责任人:" + DutyPersonName + " 监督人:" +
CheckManNames);
builder.Writeln(); // 换行
// 插入多张图片(横向排列)
if (Paths.Count > 0)
{
foreach (string imgPath in Paths)
{
// 计算每张图片宽度(总宽度按单元格宽度平分)
double cellWidth = cell.CellFormat.Width;
double imgWidth = (cellWidth - 10 * (Paths.Count - 1)) / Paths.Count - 10;
// 插入图片并调整尺寸
Shape image = builder.InsertImage(imgPath);
image.Width = Paths.Count == 1 ? imgWidth / 2 : imgWidth;
// image.Height = image.ImageData.ImageSize.HeightPixels * (imgWidth / image.ImageData.ImageSize.WidthPixels);
image.Height = 120;
// 图片间留间距(横向排列)
if (imgPath != Paths.Last())
{
builder.MoveTo(cell.LastParagraph.AppendChild(new Run(doc)));
builder.Write(" "); // 插入空格分隔
}
}
}
number++;
}
// 删除模板中的原始占位行
table.Rows.RemoveAt(0);
}
helper.SaveDoc(newUrl); //文件保存保存为doc
// 验证文件是否存在
if (!File.Exists(newUrl))
{
throw new Exception("文件不存在: " + 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);
}
}
}
}

View File

@ -7,11 +7,13 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Check {
public partial class RectifyNoticesView1 {
namespace FineUIPro.Web.HSSE.Check
{
public partial class RectifyNoticesView1
{
/// <summary>
/// form1 控件。
/// </summary>
@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel4 控件。
/// </summary>
@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel4;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtProjectName 控件。
/// </summary>
@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtProjectName;
/// <summary>
/// txtRectifyNoticesCode 控件。
/// </summary>
@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtRectifyNoticesCode;
/// <summary>
/// txtUnitId 控件。
/// </summary>
@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtUnitId;
/// <summary>
/// txtWorkAreaId 控件。
/// </summary>
@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtWorkAreaId;
/// <summary>
/// txtCheckPersonId 控件。
/// </summary>
@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCheckPersonId;
/// <summary>
/// txtCheckPerson 控件。
/// </summary>
@ -101,7 +103,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCheckPerson;
/// <summary>
/// txtCheckedDate 控件。
/// </summary>
@ -110,7 +112,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCheckedDate;
/// <summary>
/// drpHiddenHazardType 控件。
/// </summary>
@ -119,7 +121,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox drpHiddenHazardType;
/// <summary>
/// Grid1 控件。
/// </summary>
@ -128,7 +130,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Label1 控件。
/// </summary>
@ -137,7 +139,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// lbImageUrl 控件。
/// </summary>
@ -146,7 +148,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbImageUrl;
/// <summary>
/// Label2 控件。
/// </summary>
@ -155,7 +157,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label2;
/// <summary>
/// gvFlowOperate 控件。
/// </summary>
@ -164,7 +166,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid gvFlowOperate;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
@ -173,7 +175,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
/// <summary>
/// WindowAtt 控件。
/// </summary>
@ -182,5 +184,23 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnPrinter 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnPrinter;
}
}

View File

@ -71,7 +71,7 @@ namespace WebAPI.Controllers.HSSE
/// <param name="PersonId"></param>
/// <returns></returns>
[HttpPost]
public Model.ResponeData updateSignTime(string PersonId, DateTime? newSignTime = null)
public Model.ResponeData updateSignTime([FromBody] Item item)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
@ -79,11 +79,44 @@ namespace WebAPI.Controllers.HSSE
try
{
// 查找要修改的记录
var person = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == PersonId);
var person = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == item.PersonId);
if (person != null)
{
person.SignTime = newSignTime.HasValue ? newSignTime.Value : DateTime.Now; // 更新签字时间
person.SignTime = item.newSignTime.HasValue ? item.newSignTime.Value : DateTime.Now; // 更新签字时间
db.SubmitChanges();
Model.ToDoItem toDoItem = new Model.ToDoItem
{
MenuId = Const.PersonListMenuId,
DataId = item.PersonId + "_1",
UrlStr = item.AttachUrl1,
};
if (!string.IsNullOrEmpty(item.AttachUrl1))
{
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
toDoItem.DataId = item.PersonId + "_2";
toDoItem.UrlStr = item.AttachUrl2;
if (!string.IsNullOrEmpty(item.AttachUrl2))
{
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
toDoItem.DataId = item.PersonId + "_3";
toDoItem.UrlStr = item.AttachUrl3;
if (!string.IsNullOrEmpty(item.AttachUrl3))
{
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
toDoItem.DataId = item.PersonId + "_4";
toDoItem.UrlStr = item.AttachUrl4;
if (!string.IsNullOrEmpty(item.AttachUrl4))
{
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
responeData.code = 1;
responeData.message = "保存成功。";
}
@ -100,4 +133,14 @@ namespace WebAPI.Controllers.HSSE
#endregion
}
public class Item
{
public string PersonId { get; set; }
public string AttachUrl1 { get; set; }
public string AttachUrl2 { get; set; }
public string AttachUrl3 { get; set; }
public string AttachUrl4 { get; set; }
public DateTime? newSignTime { get; set; }
}
}

View File

@ -0,0 +1,92 @@
using BLL;
using System;
using System.Data.Linq.SqlClient;
using System.Linq;
using System.Web.Http;
namespace WebAPI.Controllers.HSSE
{
public class RectifyController : ApiController
{
#region
/// <summary>
/// 获取集合
/// </summary>
/// <returns></returns>
public Model.ResponeData getRectifyList(string RectifyName, int PageNumber, int PageSize)
{
var responeData = new Model.ResponeData();
try
{
var query = (from x in Funs.DB.Technique_Rectify
where x.IsEndLever.Value == true
select new
{
x.RectifyId,
x.RectifyName,
}).ToList();
if (!string.IsNullOrEmpty(RectifyName))
{
query = query.Where(x => x.RectifyName.Contains(RectifyName)).ToList();
}
var paginatedQuery = query
.Skip((PageNumber - 1) * PageSize)
.Take(PageSize)
.ToList();
responeData.data = paginatedQuery;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region id获取明细列表
/// <summary>
/// 获取集合
/// </summary>
/// <returns></returns>
public Model.ResponeData getRectifyItemListBy(string RectifyId,string HazardSourcePoint, int PageNumber, int PageSize)
{
var responeData = new Model.ResponeData();
try
{
var query = (from x in Funs.DB.Technique_RectifyItem
where x.RectifyId == RectifyId
select new
{
x.RectifyItemId,
x.HazardSourcePoint,
x.RiskAnalysis,
x.RiskPrevention
}).ToList();
if (!string.IsNullOrEmpty(HazardSourcePoint))
{
query = query.Where(x => x.HazardSourcePoint.Contains(HazardSourcePoint)).ToList();
}
var paginatedQuery = query
.Skip((PageNumber - 1) * PageSize)
.Take(PageSize)
.ToList();
responeData.data = paginatedQuery;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -152,6 +152,8 @@ namespace WebAPI.Filter
, "Person*PostAddUrl"
, "Person*getWorkPostList"
, "ProjectUnitPenetrate*getDataByProjectUnitId"
, "Rectify*getRectifyList"
, "Rectify*getRectifyItemListBy"
};
/// <summary>