修改安全月报

This commit is contained in:
潘鸿锋 2024-09-03 17:22:58 +08:00
parent d21533d599
commit 89657b13df
9 changed files with 1257 additions and 195 deletions

View File

@ -0,0 +1,6 @@
ALTER TABLE Manager_Month_InjuryAccidentC
add LossCount int null;
ALTER TABLE Manager_Month_InjuryAccidentC
add DeathCount int null;

View File

@ -36,9 +36,11 @@ namespace BLL
FirstAidDressing = injuryAccident.FirstAidDressing,
MedicalTreatment = injuryAccident.MedicalTreatment,
WorkLimitation = injuryAccident.WorkLimitation,
LossCount = injuryAccident.LossCount,
LossPerson = injuryAccident.LossPerson,
LossWorkTime = injuryAccident.LossWorkTime,
LossEconomy = injuryAccident.LossEconomy,
DeathCount=injuryAccident.DeathCount,
DeathPerson = injuryAccident.DeathPerson,
DeathWorkTime = injuryAccident.DeathWorkTime,
DeathEconomy = injuryAccident.DeathEconomy

File diff suppressed because one or more lines are too long

View File

@ -10,6 +10,19 @@
<script type="text/javascript" src="../../res/index/js/jquery-3.4.1.min.js"></script>
<script src="../../Controls/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<style>
.grid-empty-text {
position: absolute;
top: 50%;
left: 50%;
width: 500px;
margin-left: -250px;
margin-top: -15px;
font-size: 24px;
text-align: center;
}
</style>
<style>
.Toolbar2 {
position: absolute;
@ -41,6 +54,7 @@
.photo {
height: 300px;
line-height: 300px;
overflow: hidden;
}
@ -48,6 +62,7 @@
.photo img {
height: 300px;
vertical-align: middle;
}
</style>
</head>
@ -85,7 +100,7 @@
bordercolor="#bcd2e7" bordercolordark="#bcd2e7" bordercolorlight="#bcd2e7">
<tr>
<td align="center" style="width: 24%;" rowspan="2">
<img alt="" src="../../Images/Logo.jpg" />
<img alt="" src="../../Images/Logo1.jpg" />
</td>
<td align="center" style="width: 46%; height: 30px; vertical-align: middle; font-size: 12pt;">
<asp:Label ID="lblProjectName" runat="server"></asp:Label>
@ -202,7 +217,7 @@
</f:RenderField>
</Columns>
</f:GroupField>
<f:RenderField Width="160px" ColumnID="HSEPersonNum" DataField="HSEPersonNum" FieldType="Int"
<f:RenderField Width="170px" ColumnID="HSEPersonNum" DataField="HSEPersonNum" FieldType="Int"
HeaderText="专职HSE管理人员数量" HeaderTextAlign="Center" TextAlign="Left">
<Editor>
<f:NumberBox ID="nbHSEPersonNum" NoDecimal="true" NoNegative="true" MinValue="0"
@ -925,6 +940,13 @@
<Columns>
<f:GroupField EnableLock="true" HeaderText="损工事故" TextAlign="Center">
<Columns>
<f:RenderField Width="90px" ColumnID="LossCount" DataField="LossCount" FieldType="Int"
HeaderText="起数" HeaderTextAlign="Center" TextAlign="Left">
<Editor>
<f:NumberBox ID="NumberBox27" runat="server" NoDecimal="true" NoNegative="true"></f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField Width="90px" ColumnID="LossPerson" DataField="LossPerson" FieldType="Int"
HeaderText="人数" HeaderTextAlign="Center" TextAlign="Left">
<Editor>
@ -947,6 +969,13 @@
</f:GroupField>
<f:GroupField EnableLock="true" HeaderText="死亡事故" TextAlign="Center">
<Columns>
<f:RenderField Width="90px" ColumnID="DeathCount" DataField="DeathCount" FieldType="Int"
HeaderText="起数" HeaderTextAlign="Center" TextAlign="Left">
<Editor>
<f:NumberBox ID="NumberBox28" runat="server" NoDecimal="true" NoNegative="true"></f:NumberBox>
</Editor>
</f:RenderField>
<f:RenderField Width="90px" ColumnID="DeathPerson" DataField="DeathPerson" FieldType="Int"
HeaderText="人数" HeaderTextAlign="Center" TextAlign="Left">
<Editor>

View File

@ -188,6 +188,7 @@ namespace FineUIPro.Web.HSSE.Manager
if (model.Months != null)
{
txtReportMonths.Text = string.Format("{0:yyyy-MM}", model.Months);
months = Convert.ToDateTime(model.Months);
}
if (model.StartDate != null)
{
@ -263,7 +264,7 @@ namespace FineUIPro.Web.HSSE.Manager
{
nbFireWorkCount.Text = PModel.FireWorkCount.ToString();
nbBreakGroundCount.Text = PModel.BreakGroundCount.ToString();
nbLimitedSpaceCount.Text = PModel.FireWorkCount.ToString();
nbLimitedSpaceCount.Text = PModel.LimitedSpaceCount.ToString();
nbElectricityCount.Text = PModel.ElectricityCount.ToString();
nbHeightWorkCount.Text = PModel.HeightWorkCount.ToString();
nbRadialWork.Text = PModel.RadialWork.ToString();
@ -321,6 +322,9 @@ namespace FineUIPro.Web.HSSE.Manager
DrillRecordListGrid.DataSource = drillRecordList;
DrillRecordListGrid.DataBind();
}
else {
DrillRecordListGrid.EmptyText = "<raw><div class=\"grid-empty-text\">暂无数据</div></raw>";
}
#endregion
#region 4.6.3
@ -474,7 +478,7 @@ namespace FineUIPro.Web.HSSE.Manager
startTime = Convert.ToDateTime(txtStartDate.Text);
endTime = Convert.ToDateTime(txtEndDate.Text);
yearStartTime = Convert.ToDateTime(months.ToString("yyyy-01-01"));
yearStartTime = Convert.ToDateTime(startTime.ToString("yyyy-01-01"));
if (project.StartDate != null)
{
@ -600,7 +604,7 @@ namespace FineUIPro.Web.HSSE.Manager
monthReport.MonthReportId = MonthReportId;
monthReport.ProjectId = this.CurrUser.LoginProjectId;
monthReport.MonthReportCode = txtPeriod.Text;
monthReport.Months = Funs.GetNewDateTime(Request.Params["months"]);
monthReport.Months = months;
monthReport.ReportMan = this.CurrUser.UserId;
monthReport.MonthReportDate = DateTime.Now;
@ -1066,10 +1070,12 @@ namespace FineUIPro.Web.HSSE.Manager
FirstAidDressing = Funs.GetNewInt(values.Value<string>("FirstAidDressing").ToString()),
MedicalTreatment = Funs.GetNewInt(values.Value<string>("MedicalTreatment").ToString()),
WorkLimitation = Funs.GetNewInt(values.Value<string>("WorkLimitation").ToString()),
LossCount = Funs.GetNewInt(values.Value<string>("LossCount").ToString()),
LossPerson = Funs.GetNewInt(values.Value<string>("LossPerson").ToString()),
LossWorkTime = Funs.GetNewDecimal(values.Value<string>("LossWorkTime").ToString()),
LossEconomy = Funs.GetNewDecimal(values.Value<string>("LossEconomy").ToString()),
DeathPerson = Funs.GetNewInt(values.Value<string>("DeathPerson").ToString()),
DeathCount = Funs.GetNewInt(values.Value<string>("DeathCount").ToString()),
DeathWorkTime = Funs.GetNewDecimal(values.Value<string>("DeathWorkTime").ToString()),
DeathEconomy = Funs.GetNewDecimal(values.Value<string>("DeathEconomy").ToString()),
};
@ -1769,6 +1775,7 @@ namespace FineUIPro.Web.HSSE.Manager
int totalSumPersonNum = 0;//总部
int totalSumOutPersonNum = 0;//外聘
int totalHSEPersonNum = 0;
var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1");
if (units.Count() > 0)
{
foreach (Model.Project_ProjectUnit u in units)
@ -1777,13 +1784,34 @@ namespace FineUIPro.Web.HSSE.Manager
{
PersonSortId = Guid.NewGuid().ToString(),
UnitId = u.UnitId,
SumPersonNum = BLL.PersonService.GetPersonCountByUnitId(u.UnitId, ProjectId, Convert.ToDateTime(txtEndDate.Text), false),//本部
SumOutPersonNum = BLL.PersonService.GetPersonCountByUnitId(u.UnitId, ProjectId, Convert.ToDateTime(txtEndDate.Text), true),//外聘
HSEPersonNum = BLL.PersonService.GetHSEPersonCountByUnitId(u.UnitId, ProjectId, Convert.ToDateTime(txtEndDate.Text)),
HSEPersonNum = 0,
ContractRange = u.ContractRange
};
//本部本月人数,本年考勤人数除当前月份,取平均数
//年度
var yearList = spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.UnitId == u.UnitId).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard})
.ToList();
personSort.SumPersonNum = yearList.Count();
//五环
if (u.UnitId == Const.UnitId_CWCEC)
{
personSort.SumOutPersonNum = 0;
}
else {
personSort.SumOutPersonNum = 0;
}
////本部人员
//SumPersonNum = BLL.PersonService.GetPersonCountByUnitId(u.UnitId, ProjectId, Convert.ToDateTime(txtEndDate.Text), false),//本部
// SumOutPersonNum = 0,//外聘
personSorts.Add(personSort);
totalSumPersonNum += Convert.ToInt32(personSort.SumPersonNum);
totalSumPersonNum += Convert.ToInt32(personSort.SumPersonNum)+ Convert.ToInt32(personSort.SumOutPersonNum);
totalSumOutPersonNum += Convert.ToInt32(personSort.SumOutPersonNum);
totalHSEPersonNum += Convert.ToInt32(personSort.HSEPersonNum);
}
@ -1795,7 +1823,7 @@ namespace FineUIPro.Web.HSSE.Manager
JObject summary = new JObject();
summary.Add("UnitId", "合计:");
summary.Add("SumPersonNum", totalSumPersonNum);
summary.Add("SumOutPersonNum", totalSumOutPersonNum);
//summary.Add("SumOutPersonNum", totalSumOutPersonNum);
summary.Add("HSEPersonNum", totalHSEPersonNum);
this.gvPersonSort.SummaryData = summary;
}
@ -1836,8 +1864,8 @@ namespace FineUIPro.Web.HSSE.Manager
{
JObject summary = new JObject();
summary.Add("UnitId", "合计:");
summary.Add("SumPersonNum", (from x in personSorts select x.SumPersonNum ?? 0).Sum());
summary.Add("SumOutPersonNum", (from x in personSorts select x.SumOutPersonNum ?? 0).Sum());
summary.Add("SumPersonNum", (from x in personSorts select x.SumPersonNum ?? 0).Sum()+ (from x in personSorts select x.SumOutPersonNum ?? 0).Sum());
//summary.Add("SumOutPersonNum", (from x in personSorts select x.SumOutPersonNum ?? 0).Sum());
summary.Add("HSEPersonNum", (from x in personSorts select x.HSEPersonNum ?? 0).Sum());
this.gvPersonSort.SummaryData = summary;
}
@ -1854,169 +1882,90 @@ namespace FineUIPro.Web.HSSE.Manager
#endregion
#region 3.HSE人工日统计
public class hseDayItem {
public string IdentityCard { get; set; }
public string IntoOutTime { get; set; }
public string UnitId { get; set; }
}
public string getShortTime(DateTime? a) {
return Convert.ToDateTime(a).ToString("yyyy-MM-dd");
}
private void getMonthReportCHSEDay()
{
var spckList = db.SitePerson_Checking.Where(x => x.ProjectId == ProjectId && x.IntoOut == "1");
//本月项目现场HSE人工日统计
Model.MonthReportCHSEDay hseDay = new Model.MonthReportCHSEDay
{
MonthHSEDay = (endTime - startTime).Days + 1
};
Model.Manager_MonthReportC mr = BLL.MonthReportCService.GetLastMonthReportByDate(endTime, this.ProjectId);
if (mr != null)
{
if (mr.SumHSEDay != 0)
{
hseDay.SumHSEDay = (mr.SumHSEDay ?? 0) + hseDay.MonthHSEDay;
}
else
{
hseDay.SumHSEDay = hseDay.MonthHSEDay;
}
}
else
{
hseDay.SumHSEDay = hseDay.MonthHSEDay;
}
//累计安全工作天数(当前日期-项目开始日期)
hseDay.SumHSEDay = (endTime - projectStartTime).Days;
int? monthHSEWorkDay = 0;
int? yearHSEWorkDay = 0;
int? sumHSEWorkDay = 0;
decimal? hSEManhours = 0;
decimal? sumHseManhours = 0;
decimal? SubcontractManHours = 0;
//本月HSE人工日、年度累计HSE人工日、总累计HSE人工日考勤中取
//本月
var list = spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList();
decimal? YearHSEWorkDay = 0;
//年度安全人工时
var getProjectMonthReport = from x in db.SitePerson_MonthReport where x.ProjectId == ProjectId select x;
if (getProjectMonthReport.Count() > 0)
//本月HSE人工日
hseDay.MonthHSEWorkDay = list.Count();
//本月安全人工时(五环)
hseDay.HseManhours = spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.UnitId == Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
{
////人工时月报明细
var getMonthReportDetail = from x in db.SitePerson_MonthReportDetail
join y in getProjectMonthReport on x.MonthReportId equals y.MonthReportId
select x;
var yearMonthReport = from x in getProjectMonthReport
where x.CompileDate.Value.Year == months.Year
select x;
if (yearMonthReport.Count() > 0)
{
foreach (var item in yearMonthReport)
{
////年度累计安全人工时
YearHSEWorkDay += getMonthReportDetail.Where(x => x.MonthReportId ==
item.MonthReportId).Sum(x => x.PersonWorkTime) ?? 0;
}
}
}
else
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList().Count() * 8;
//本月安全人工时(分包商)
hseDay.SubcontractManHours= spckList.Where(x => x.IntoOutTime >= startTime
&& x.IntoOutTime <= endTime && x.UnitId != Const.UnitId_CWCEC).ToList().Select(x => new hseDayItem()
{
YearHSEWorkDay = 0;
}
hseDay.YearHSEWorkDay = Convert.ToInt32(YearHSEWorkDay);
var monthReport = BLL.Funs.DB.SitePerson_MonthReport.FirstOrDefault(x => x.CompileDate == months && x.ProjectId == ProjectId); //当月人工时月报
if (monthReport != null)
{
monthHSEWorkDay = Convert.ToInt32((from x in Funs.DB.SitePerson_MonthReportDetail
where x.MonthReportId == monthReport.MonthReportId
select x.RealPersonNum ?? 0).Sum());
hSEManhours = (from x in Funs.DB.SitePerson_MonthReportDetail
join z in Funs.DB.Project_ProjectUnit
on x.UnitId equals z.UnitId
where z.UnitType == "1" && z.ProjectId == this.CurrUser.LoginProjectId && x.MonthReportId == monthReport.MonthReportId //总包
select x.PersonWorkTime ?? 0).Sum();
var q = (from x in Funs.DB.SitePerson_MonthReportDetail
join z in Funs.DB.Project_ProjectUnit
on x.UnitId equals z.UnitId
where z.UnitType == "2" && z.ProjectId == this.CurrUser.LoginProjectId && x.MonthReportId == monthReport.MonthReportId //分包
select x);
foreach (var item in q)
{
SubcontractManHours += item.PersonWorkTime ?? 0;
}
}
else
{
monthHSEWorkDay = 0;
hSEManhours = 0;
SubcontractManHours = 0;
}
//年度人工日
if (months.Month == 1)
{
yearHSEWorkDay = monthHSEWorkDay;
}
else
{
if (mr != null)
{
if (mr.YearHSEWorkDay != null)
{
yearHSEWorkDay = (mr.YearHSEWorkDay ?? 0) + monthHSEWorkDay;
}
else
{
yearHSEWorkDay = monthHSEWorkDay;
}
}
else
{
yearHSEWorkDay = monthHSEWorkDay;
}
}
if (mr != null)
{
if (mr.SumHSEWorkDay != 0)
{
sumHSEWorkDay = (mr.SumHSEWorkDay ?? 0) + monthHSEWorkDay;
}
else
{
sumHSEWorkDay = monthHSEWorkDay;
}
if (mr.TotalHseManhours != 0)
{
sumHseManhours = (mr.TotalHseManhours ?? 0) + hSEManhours + SubcontractManHours;
}
else
{
sumHseManhours = hSEManhours + SubcontractManHours;
}
}
else
{
sumHSEWorkDay = monthHSEWorkDay;
sumHseManhours = hSEManhours + SubcontractManHours;
}
hseDay.MonthHSEWorkDay = monthHSEWorkDay ?? 0;
hseDay.YearHSEWorkDay = yearHSEWorkDay ?? 0;
hseDay.SumHSEWorkDay = sumHSEWorkDay ?? 0;
if (hSEManhours.ToString().Contains("."))
{
hseDay.HseManhours = int.Parse(hSEManhours.ToString().Substring(0, hSEManhours.ToString().LastIndexOf(".")));
}
else
{
hseDay.HseManhours = int.Parse(hSEManhours.ToString());
}
if (SubcontractManHours.ToString().Contains("."))
{
hseDay.SubcontractManHours = int.Parse(SubcontractManHours.ToString().Substring(0, SubcontractManHours.ToString().LastIndexOf(".")));
}
else
{
hseDay.SubcontractManHours = int.Parse(SubcontractManHours.ToString());
}
if (sumHseManhours.ToString().Contains("."))
{
hseDay.TotalHseManhours = int.Parse(sumHseManhours.ToString().Substring(0, sumHseManhours.ToString().LastIndexOf(".")));
}
else
{
hseDay.TotalHseManhours = int.Parse(sumHseManhours.ToString());
}
List<Model.MonthReportCHSEDay> list = new List<Model.MonthReportCHSEDay>();
list.Add(hseDay);
this.gvHSEDay.DataSource = list;
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList().Count() * 8;
//年度
var yearList = spckList.Where(x => x.IntoOutTime >= yearStartTime
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList();
//年度累计人工日
hseDay.YearHSEWorkDay = yearList.Count;
//年度累计HSE人工时
hseDay.TotalHseManhoursYear = yearList.Count * 8;
// //项目累计
var pList = spckList.Where(x => x.IntoOutTime >= projectStartTime
&& x.IntoOutTime <= endTime).ToList().Select(x => new hseDayItem()
{
IdentityCard = x.IdentityCard,
IntoOutTime = getShortTime(x.IntoOutTime)
}).GroupBy(x => new { x.IdentityCard, x.IntoOutTime })
.ToList();
hseDay.SumHSEWorkDay = pList.Count;
hseDay.TotalHseManhours = pList.Count * 8;
List<Model.MonthReportCHSEDay> listCHSEDay = new List<Model.MonthReportCHSEDay>();
listCHSEDay.Add(hseDay);
this.gvHSEDay.DataSource = listCHSEDay;
this.gvHSEDay.DataBind();
}
#endregion
@ -2029,9 +1978,12 @@ namespace FineUIPro.Web.HSSE.Manager
{
trainSorts.Clear();
var TotalPersonNum = 0;
var list = db.Base_TrainType.ToList();
var list = db.Base_TrainType.ToList().OrderBy(x=>x.TrainTypeCode);
var listTrain = BLL.EduTrain_TrainRecordService.GetTrainingsByTrainDate(startTime, endTime, this.ProjectId);
var listAllTrain = BLL.EduTrain_TrainRecordService.GetTrainingsByTrainDate(endTime, this.ProjectId);
var listBosheng = db.Bo_Sheng_Train.Where(x => x.ProjectId == ProjectId && x.TrainStartDate >= startTime && x.TrainStartDate <= endTime).ToList();
var listAllBosheng = db.Bo_Sheng_Train.Where(x => x.ProjectId == ProjectId && x.TrainStartDate <= endTime).ToList();
foreach (var item in list)
{
int i = 0;
@ -2051,6 +2003,34 @@ namespace FineUIPro.Web.HSSE.Manager
trainSort.TeachHour = 0;
trainSort.PersonNum = 0;
}
if (listBosheng.Count> 0)
{
//入场
if (item.TrainTypeId == "dfb6a37e-4412-4ba9-ad59-3bc505bc21f7")
{
trainSort.PersonNum += listBosheng.Where(x => x.TrainType.Contains("入场")).Sum(x=>x.PersonCount);
Func<string, decimal, decimal> funDelegate = CustomCount;
decimal numSum = 0;
trainSort.TeachHour += listBosheng.Where(x => x.TrainType.Contains("入场")).Sum(x => funDelegate(x.TrainPeriod, numSum));
}
else if (item.TrainTypeId == "c1a513bb-a547-45b0-944d-b0dd88f06f82")
{
//其他
trainSort.PersonNum += listBosheng.Where(x => x.TrainType.Contains("其他")).Sum(x => x.PersonCount);
Func<string, decimal, decimal> funDelegate = CustomCount;
decimal numSum = 0;
trainSort.TeachHour += listBosheng.Where(x => x.TrainType.Contains("其他")).Sum(x => funDelegate(x.TrainPeriod, numSum));
}
else {
//专项
trainSort.PersonNum += listBosheng.Where(x => x.TrainType.Contains("专项")).Sum(x => x.PersonCount);
Func<string, decimal, decimal> funDelegate = CustomCount;
decimal numSum = 0;
trainSort.TeachHour += listBosheng.Where(x => x.TrainType.Contains("专项")).Sum(x => funDelegate(x.TrainPeriod, numSum));
}
}
if (listAllTrain.Count > 0)
{
trainSort.TotalPersonNum = listAllTrain.Where(x => x.TrainTypeId == item.TrainTypeId).Sum(x => x.TrainPersonNum);
@ -2060,6 +2040,31 @@ namespace FineUIPro.Web.HSSE.Manager
{
trainSort.TotalPersonNum = 0;
}
if (listAllBosheng.Count>0)
{
//入场
if (item.TrainTypeId == "dfb6a37e-4412-4ba9-ad59-3bc505bc21f7")
{
trainSort.TotalPersonNum += listAllBosheng.Where(x => x.TrainType.Contains("入场")).Sum(x => x.PersonCount);
TotalPersonNum+= Convert.ToInt32(trainSort.TotalPersonNum);
}
else if (item.TrainTypeId == "c1a513bb-a547-45b0-944d-b0dd88f06f82")
{
//其他
trainSort.TotalPersonNum += listAllBosheng.Where(x => x.TrainType.Contains("其他")).Sum(x => x.PersonCount);
TotalPersonNum += Convert.ToInt32(trainSort.TotalPersonNum);
}
else
{
//专项
trainSort.TotalPersonNum += listAllBosheng.Where(x => x.TrainType.Contains("专项")).Sum(x => x.PersonCount);
TotalPersonNum += Convert.ToInt32(trainSort.TotalPersonNum);
}
}
//博晟工具箱中的数据
i++;
trainSorts.Add(trainSort);
}
@ -2079,9 +2084,16 @@ namespace FineUIPro.Web.HSSE.Manager
}
#endregion
#region 4.2HSE会议及检查统计
private void GetCheckSort()
public static decimal CustomCount(string strNum, decimal Sum)
{
Sum += Convert.ToDecimal(strNum);
return Sum;
}
#region 4.2HSE会议及检查统计
private void GetCheckSort()
{
var hselogList = db.Manager_HSSELog.Where(x => x.ProjectId == ProjectId).ToList();
int i = 0;
#region HSE会议
@ -2131,14 +2143,15 @@ namespace FineUIPro.Web.HSSE.Manager
};
checkSorts.Add(checkSort2);
i++;
//日巡检取HSE日志检查次数
Model.Manager_CheckSortC checkSort3 = new Model.Manager_CheckSortC
{
CheckSortId = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortC)),
SortIndex = i,
CheckType = "日巡检",
CheckNumber = BLL.Check_CheckDayService.GetCountByCheckTime(startTime, endTime, this.ProjectId),
YearCheckNum = BLL.Check_CheckDayService.GetCountByCheckTime(yearStartTime, endTime, this.ProjectId),
TotalCheckNum = BLL.Check_CheckDayService.GetCountByCheckTime(projectStartTime, endTime, this.ProjectId)
CheckNumber = hselogList.Where(x=>x.CompileDate>=startTime && x.CompileDate<=endTime).Sum(x=>x.Num21),
YearCheckNum = hselogList.Where(x => x.CompileDate >= yearStartTime && x.CompileDate <= endTime).Sum(x => x.Num21),
TotalCheckNum = hselogList.Where(x => x.CompileDate >= projectStartTime && x.CompileDate <= endTime).Sum(x => x.Num21)
};
checkSorts.Add(checkSort3);
i++;
@ -2293,7 +2306,7 @@ namespace FineUIPro.Web.HSSE.Manager
var YhzgdList = from x in db.Check_RectifyNoticesItem
join y in db.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId
where y.ProjectId == ProjectId && y.CheckedDate >= startTime && y.CheckedDate <= endTime
select new { y.UnitId, x.HiddenHazardType, y.States };
select new { y.UnitId, x.HiddenHazardType, y.States,y.CompleteDate,x.LimitTime };
int yhMonthSum = 0, yhYearSum = 0;
var list = new List<Model.Manager_HiddenDanger>();
@ -2310,32 +2323,41 @@ namespace FineUIPro.Web.HSSE.Manager
};
//HSE巡检(一般和重大)
//所有数据
var Commonly1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.Risk_Level == "一般" && x.States == "2").Count();
var MajorNum1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.Risk_Level == "重大" && x.States == "2").Count();
//总数,已整改
var Commonly1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && (x.Risk_Level == "一般" || x.Risk_Level==null || x.Risk_Level == "") && x.States == "3").Count();
var MajorNum1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.Risk_Level == "重大" && x.States == "3").Count();
//总数
var Sum1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0).Count();
var Yzg1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.States == "2").Count();
//已关闭并且在期限内的
var Yzg1 = HseList.Where(x => x.ResponsibleUnit == u.UnitId && x.Type == 0 && x.States == "2"
&& x.RectificationTime<= x.RectificationPeriod ).Count();
//专项检查(一般和重大)
var Commonly2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "1" && x.CompleteStatus == true).Count();
var Commonly2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && (x.HiddenHazardType == "1"|| x.HiddenHazardType==null || x.HiddenHazardType == "") && x.CompleteStatus == true).Count();
var MajorNum2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "3" && x.CompleteStatus == true).Count();
//总数,已整改
var Sum2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId).Count();
var Yzg2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && x.CompleteStatus == true).Count();
//已整改,在期限内的
var Yzg2 = CheckSpecialList.Where(x => x.UnitId == u.UnitId && x.CompleteStatus == true
&& x.CompletedDate<=x.Rectification_Date).Count();
//综合检查(一般和重大)
var Commonly3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "一般" && x.CompleteStatus == true).Count();
var Commonly3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && (x.HiddenHazardType == "一般" || x.HiddenHazardType==null || x.HiddenHazardType == "") && x.CompleteStatus == true).Count();
var MajorNum3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "重大" && x.CompleteStatus == true).Count();
//总数,已整改
var Sum3 = CheckColligationList.Where(x => x.UnitId == u.UnitId).Count();
var Yzg3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && x.CompleteStatus == true).Count();
//已整改
var Yzg3 = CheckColligationList.Where(x => x.UnitId == u.UnitId && x.CompleteStatus == true && x.HandleStep=="5"
&& x.CompletedDate<= x.LimitedDate).Count();
//隐患整改(一般和重大)
var Commonly4 = YhzgdList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "一般" && x.States == "5").Count();
var Commonly4 = YhzgdList.Where(x => x.UnitId == u.UnitId && (x.HiddenHazardType == "一般"
|| x.HiddenHazardType == null || x.HiddenHazardType == "") && x.States == "5").Count();
var MajorNum4 = YhzgdList.Where(x => x.UnitId == u.UnitId && x.HiddenHazardType == "重大" && x.States == "5").Count();
//总数,已整改
var Sum4 = YhzgdList.Where(x => x.UnitId == u.UnitId).Count();
var Yzg4 = YhzgdList.Where(x => x.UnitId == u.UnitId && x.States == "5").Count();
var Yzg4 = YhzgdList.Where(x => x.UnitId == u.UnitId && x.States == "5"
&& x.CompleteDate<= x.LimitTime).Count();
model.CommonlyNum = Commonly1 + Commonly2 + Commonly3 + Commonly4;
@ -2350,7 +2372,7 @@ namespace FineUIPro.Web.HSSE.Manager
{
model.ReRate = "0";
}
yhMonthSum += Sum1 + Sum2 + Sum3 + Sum4;
yhMonthSum += Convert.ToInt32(model.CommonlyNum) + Convert.ToInt32(model.MajorNum);
list.Add(model);
i++;
@ -2364,21 +2386,25 @@ namespace FineUIPro.Web.HSSE.Manager
//安全巡检list
var HseListYear = (from x in Funs.DB.View_Hazard_HazardRegister
where x.ProblemTypes == "1" && x.ProjectId == ProjectId && x.CheckTime >= yearStartTime && x.CheckTime <= endTime
&& x.States == "3"
select x).ToList().Count;
//专项检查
var CheckSpecialListYear = (from x in db.Check_CheckSpecialDetail
join y in db.Check_CheckSpecial on x.CheckSpecialId equals y.CheckSpecialId
where y.ProjectId == ProjectId && y.CheckTime >= yearStartTime && y.CheckTime <= endTime
&& x.CompleteStatus == true
select x).ToList().Count;
//综合检查
var CheckColligationListYear = (from x in db.Check_CheckColligationDetail
join y in db.Check_CheckColligation on x.CheckColligationId equals y.CheckColligationId
where y.ProjectId == ProjectId && y.CheckTime >= yearStartTime && y.CheckTime <= endTime
&& x.CompleteStatus == true
select x).ToList().Count;
//隐患整改单
var YhzgdListYear = (from x in db.Check_RectifyNoticesItem
join y in db.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId
where y.ProjectId == ProjectId && y.CheckedDate >= yearStartTime && y.CheckedDate <= endTime
&& y.States == "5"
select new { y.UnitId, x.HiddenHazardType, y.States }).ToList().Count;
txtYearHdangerCount.Text = (HseListYear + CheckSpecialListYear + CheckColligationListYear + YhzgdListYear).ToString();
#endregion
@ -2572,8 +2598,14 @@ namespace FineUIPro.Web.HSSE.Manager
};
drillRecordList.Add(model);
}
this.DrillRecordListGrid.DataSource = drillRecordList;
this.DrillRecordListGrid.DataBind();
if (drillRecordList.Count == 0)
{
DrillRecordListGrid.EmptyText = "<raw><div class=\"grid-empty-text\">暂无数据</div></raw>";
}
else {
this.DrillRecordListGrid.DataSource = drillRecordList;
this.DrillRecordListGrid.DataBind();
}
}
#endregion
@ -2981,9 +3013,11 @@ namespace FineUIPro.Web.HSSE.Manager
FirstAidDressing = 0, //
MedicalTreatment = 0,//
WorkLimitation = 0,//
LossCount=0,
LossPerson = (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.PeopleNum).Sum(),
LossWorkTime = (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.WorkingHoursLoss).Sum(),
LossEconomy = (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.EconomicLoss).Sum() + (from x in reports where x.UnitId == Const.UnitId_CWCEC select x.EconomicOtherLoss).Sum(),
DeathCount=0,
DeathPerson = (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.PeopleNum).Sum(),
DeathWorkTime = (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.WorkingHoursLoss).Sum(),
DeathEconomy = (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.EconomicLoss).Sum() + (from x in deathReports where x.UnitId == Const.UnitId_CWCEC select x.EconomicOtherLoss).Sum(),
@ -2997,6 +3031,8 @@ namespace FineUIPro.Web.HSSE.Manager
FirstAidDressing = 0, //
MedicalTreatment = 0,//
WorkLimitation = 0,//
LossCount = 0,
DeathCount = 0,
LossPerson = (from x in reports
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
where y.UnitType == Const.ProjectUnitType_2
@ -3044,7 +3080,7 @@ namespace FineUIPro.Web.HSSE.Manager
JObject summary = new JObject();
int TotalAttemptedIncidents = 0, TotalFirstAidDressing = 0, TotalMedicalTreatment = 0, TotalWorkLimitation = 0, TotalLossPerson = 0, TotalDeathPerson = 0;
decimal TotalLossWorkTime = 0, TotalLossEconomy = 0, TotalDeathWorkTime = 0, TotalDeathEconomy = 0;
decimal TotalLossWorkTime = 0, TotalLossEconomy = 0, TotalDeathWorkTime = 0, TotalDeathEconomy = 0 ,TotalLossCount=0,TotalDeathCount=0;
foreach (JObject mergedRow in gvInjuryAccident.GetMergedData())
{
JObject values = mergedRow.Value<JObject>("values");
@ -3084,15 +3120,25 @@ namespace FineUIPro.Web.HSSE.Manager
{
TotalDeathEconomy += values.Value<decimal>("DeathEconomy");
}
if (!string.IsNullOrEmpty(values["LossCount"].ToString()))
{
TotalLossCount += values.Value<decimal>("LossCount");
}
if (!string.IsNullOrEmpty(values["DeathCount"].ToString()))
{
TotalDeathCount += values.Value<decimal>("DeathCount");
}
}
summary.Add("UnitName", "项目合计");
summary.Add("AttemptedIncidents", TotalAttemptedIncidents.ToString("F2"));
summary.Add("FirstAidDressing", TotalFirstAidDressing.ToString("F2"));
summary.Add("MedicalTreatment", TotalMedicalTreatment.ToString("F2"));
summary.Add("WorkLimitation", TotalWorkLimitation.ToString("F2"));
summary.Add("LossCount", TotalLossCount.ToString("F2"));
summary.Add("LossPerson", TotalLossPerson.ToString("F2"));
summary.Add("LossWorkTime", TotalLossWorkTime.ToString("F2"));
summary.Add("LossEconomy", TotalLossEconomy.ToString("F2"));
summary.Add("DeathCount", TotalDeathCount.ToString("F2"));
summary.Add("DeathPerson", TotalDeathPerson.ToString("F2"));
summary.Add("DeathWorkTime", TotalDeathWorkTime.ToString("F2"));
summary.Add("DeathEconomy", TotalDeathEconomy.ToString("F2"));

View File

@ -1292,6 +1292,15 @@ namespace FineUIPro.Web.HSSE.Manager
/// </remarks>
protected global::FineUIPro.NumberBox NumberBox20;
/// <summary>
/// NumberBox27 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox NumberBox27;
/// <summary>
/// NumberBox21 控件。
/// </summary>
@ -1319,6 +1328,15 @@ namespace FineUIPro.Web.HSSE.Manager
/// </remarks>
protected global::FineUIPro.NumberBox NumberBox23;
/// <summary>
/// NumberBox28 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox NumberBox28;
/// <summary>
/// NumberBox24 控件。
/// </summary>

View File

@ -580,7 +580,7 @@ namespace FineUIPro.Web.HSSE.Manager
bkmark = doc.Range.Bookmarks["createdate"];
if (bkmark != null)
{
//bkmark.Text = weekModel.CreateDate.ToString().Split(' ')[0].Replace('/', '.');
bkmark.Text = model.EndDate.ToString().Split(' ')[0].Replace('/', '.');
}
bkmark = doc.Range.Bookmarks["projectname"];
@ -616,10 +616,10 @@ namespace FineUIPro.Web.HSSE.Manager
}
bkmark = doc.Range.Bookmarks["fromcode"];
//fromcode,项目号-RM-PQM-顺序号
//fromcode,项目号-RM-HSE-顺序号
if (bkmark != null)
{
bkmark.Text = pModel.ProjectCode + "-RM-PQM-" + model.MonthReportCode;
bkmark.Text = pModel.ProjectCode + "-RM-HSE-" + model.MonthReportCode;
}
#endregion
#region 1.
@ -720,8 +720,15 @@ namespace FineUIPro.Web.HSSE.Manager
//创建行
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));
if (item.UnitId == Const.UnitId_CWCEC)
{
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));
}
else {
row.Cells.Add(CreateCell(item.SumPersonNum.ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width+ 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));
@ -735,8 +742,10 @@ namespace FineUIPro.Web.HSSE.Manager
//创建合计
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.SumPersonNum ?? 0).Sum()
+ (from x in sorts select x.SumOutPersonNum ?? 0).Sum()).ToString(), doc, table.Rows[1].Cells[1].CellFormat.Width
+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));
@ -907,6 +916,9 @@ namespace FineUIPro.Web.HSSE.Manager
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 4.3
@ -917,7 +929,7 @@ namespace FineUIPro.Web.HSSE.Manager
where x.MonthReportId == Id && y.ProjectId == this.ProjectId
orderby y.UnitType
select x).ToList();
if (HiddenDangersorts.Count>0)
if (HiddenDangersorts.Count > 0)
{
isYm = true;
whileIndex += 1;
@ -952,7 +964,7 @@ namespace FineUIPro.Web.HSSE.Manager
//合计
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("本月隐患总数", 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));
@ -962,10 +974,911 @@ namespace FineUIPro.Web.HSSE.Manager
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 4.4
var mpModel = db.Manager_ProjectAssignment.FirstOrDefault(x => x.MonthReportId == Id);
whileIndex += 1;
if (mpModel!=null)
{
bkmark = doc.Range.Bookmarks["nbFireWorkCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.FireWorkCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbBreakGroundCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.BreakGroundCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbLimitedSpaceCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.LimitedSpaceCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbElectricityCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.ElectricityCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbHeightWorkCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.HeightWorkCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbRadialWork"];
if (bkmark != null)
{
bkmark.Text = mpModel.RadialWork.ToString();
}
bkmark = doc.Range.Bookmarks["nbLiftingWorkCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.LiftingWorkCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbNightWork"];
if (bkmark != null)
{
bkmark.Text = mpModel.NightWork.ToString();
}
bkmark = doc.Range.Bookmarks["nbMonthCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.MonthCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbYearCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.YearCount.ToString();
}
bkmark = doc.Range.Bookmarks["nbProCount"];
if (bkmark != null)
{
bkmark.Text = mpModel.ProCount.ToString();
}
}
#endregion
#region 4.5
bkmark = doc.Range.Bookmarks["MonthExpertNoCount"];
if (bkmark != null)
{
bkmark.Text =model.MonthExpertNoCount.ToString();
}
bkmark = doc.Range.Bookmarks["MonthExpertCount"];
if (bkmark != null)
{
bkmark.Text = model.MonthExpertCount.ToString();
}
whileIndex += 1;
#endregion
#region 4.6.1
var emergencyPlanList = db.Manager_EmergencyPlan.Where(x => x.MonthReportId == Id).OrderBy(x => x.SortIndex).ToList();
if (emergencyPlanList.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 emergencyPlanList)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.CaType, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.MonthCount.ToString(), doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.YearCount.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ProCount.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 4.6.2
var drillRecordList = db.Manager_DrillRecordList.Where(x => x.MonthReportId == Id).OrderBy(x => x.Ddate).ToList();
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;
}
}
if (drillRecordList.Count > 0)
{
numberIndex = 1;
foreach (var item in drillRecordList)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.Dname, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(Convert.ToDateTime(item.Ddate).ToString("yyyy-MM-dd"), doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.DrillRecordTypeName.ToString(), doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.PersonNum.ToString(), doc, table.FirstRow.Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.DrillCost.ToString(), doc, table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width+ table.FirstRow.Cells[2].CellFormat.Width
+ table.FirstRow.Cells[3].CellFormat.Width
+ table.FirstRow.Cells[4].CellFormat.Width
+ table.FirstRow.Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 4.6.3
bkmark = doc.Range.Bookmarks["EmergencyManagementWorkDef"];
if (bkmark != null)
{
bkmark.Text = model.EmergencyManagementWorkDef.ToString();
}
#endregion
#region 4.7 HSE奖励与处罚
whileIndex += 1;
var rewardAndPunishSortCs = db.Manager_RewardAndPunishSortC.FirstOrDefault(x=>x.MonthReportId==Id);
if (rewardAndPunishSortCs!=null)
{
bkmark = doc.Range.Bookmarks["RewardNum"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.RewardNum.ToString();
}
bkmark = doc.Range.Bookmarks["RewardMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.RewardMoney.ToString();
}
bkmark = doc.Range.Bookmarks["ProjectRewardMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.ProjectRewardMoney.ToString();
}
bkmark = doc.Range.Bookmarks["PunishNum"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.PunishNum.ToString();
}
bkmark = doc.Range.Bookmarks["PunishMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.PunishMoney.ToString();
}
bkmark = doc.Range.Bookmarks["ProjectPunishMoney"];
if (bkmark != null)
{
bkmark.Text = rewardAndPunishSortCs.ProjectPunishMoney.ToString();
}
}
#endregion
#region 4.8HSE现场其他管理情况
var otherManagements = BLL.OtherManagementCService.GetOtherManagementByMonthReportId(Id);
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;
}
}
if (otherManagements.Count > 0)
{
numberIndex = 1;
foreach (var item in otherManagements)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.ManagementDes, doc, table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 5.1 HSE费用投入统计
var fiveExpenses = BLL.FiveExpenseCService.GetFiveExpenseByMonthReportId(Id);
if (fiveExpenses.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 = 2;
foreach (var item in fiveExpenses)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell((numberIndex - 1).ToString(), doc, table.Rows[1].Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.InvestmentProject, doc, table.Rows[1].Cells[1].CellFormat.Width, "", "", "unit"));
row.Cells.Add(CreateCell(item.PlanCostMonth.ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.PlanCostYear.ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.ActualCostMonth.ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.ActualCostYear.ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
//求和
//创建合计
rowhj = new Row(doc);
rowhj.Cells.Add(CreateCell("合计", doc, (table.Rows[1].Cells[0].CellFormat.Width + table.Rows[1].Cells[1].CellFormat.Width)));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.PlanCostMonth ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.PlanCostYear ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.ActualCostMonth ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[4].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in fiveExpenses select x.ActualCostYear ?? 0).Sum().ToString(), doc, table.Rows[1].Cells[5].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
whileIndex += 1;
}
#endregion
#region 6.1(1) HSE责任事故/
var attemptedModel = db.Manager_Attempted.FirstOrDefault(x => x.MonthReportId == Id);
if (attemptedModel != null)
{
bkmark = doc.Range.Bookmarks["WhMonthNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.WhMonthNum.ToString();
}
bkmark = doc.Range.Bookmarks["WhYearNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.WhYearNum.ToString();
}
bkmark = doc.Range.Bookmarks["FbsMonthNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.FbsMonthNum.ToString();
}
bkmark = doc.Range.Bookmarks["FbsYearNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.FbsYearNum.ToString();
}
bkmark = doc.Range.Bookmarks["ProNum"];
if (bkmark != null)
{
bkmark.Text = attemptedModel.ProNum.ToString();
}
whileIndex += 1;
}
#endregion
#region 6.1(2)
var injuryAccidents = BLL.InjuryAccidentCService.GetInjuryAccidentCByMonthReportId(Id);
if (injuryAccidents.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 = 4;
foreach (var item in injuryAccidents)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(item.UnitName, doc, table.Rows[3].Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.FirstAidDressing.ToString(), doc, table.Rows[3].Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.MedicalTreatment.ToString(), doc, table.Rows[3].Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.WorkLimitation.ToString(), doc, table.Rows[3].Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossCount.ToString(), doc, table.Rows[3].Cells[4].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossPerson.ToString(), doc, table.Rows[3].Cells[5].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossWorkTime.ToString(), doc, table.Rows[3].Cells[6].CellFormat.Width));
row.Cells.Add(CreateCell(item.LossEconomy.ToString(), doc, table.Rows[3].Cells[7].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathCount.ToString(), doc, table.Rows[3].Cells[8].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathPerson.ToString(), doc, table.Rows[3].Cells[9].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathWorkTime.ToString(), doc, table.Rows[3].Cells[10].CellFormat.Width));
row.Cells.Add(CreateCell(item.DeathEconomy.ToString(), doc, table.Rows[3].Cells[11].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
//求和
//创建合计
rowhj = new Row(doc);
rowhj.Cells.Add(CreateCell("项目合计", doc, (table.Rows[4].Cells[0].CellFormat.Width)));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.FirstAidDressing ?? 0).Sum().ToString(), doc,
table.Rows[4].Cells[1].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.MedicalTreatment ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[2].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.WorkLimitation ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[3].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossCount ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[4].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossPerson ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[5].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossWorkTime ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[6].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.LossEconomy ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[7].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathCount ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[8].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathPerson ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[9].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathWorkTime ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[10].CellFormat.Width));
rowhj.Cells.Add(CreateCell((from x in injuryAccidents select x.DeathEconomy ?? 0).Sum().ToString(), doc, table.Rows[3].Cells[11].CellFormat.Width));
table.Rows.Insert(numberIndex, rowhj);
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 6.2 HSE责任事故/
bkmark = doc.Range.Bookmarks["Def"];
if (bkmark != null)
{
bkmark.Text = model.AccidentDef.ToString();
}
#endregion
#region 6.3 HSE目标实现情况
bkmark = doc.Range.Bookmarks["Goalach1"];
if (bkmark != null)
{
bkmark.Text = model.Goalach1.ToString();
}
bkmark = doc.Range.Bookmarks["Goalach2"];
if (bkmark != null)
{
bkmark.Text = model.Goalach2.ToString();
}
bkmark = doc.Range.Bookmarks["Goalach3"];
if (bkmark != null)
{
bkmark.Text = model.Goalach3.ToString();
}
whileIndex += 1;
#endregion
#region 7.1 HSE工作计划
var otherWorkPlanCs = BLL.OtherWorkPlanCService.GetOtherWorkPlanByMonthReportId(Id);
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;
}
}
if (otherWorkPlanCs.Count > 0)
{
numberIndex = 1;
foreach (var item in otherWorkPlanCs)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.WorkContent, doc, table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 8 HSE合规义务识别与评价
var complianceObligationsCs = (from x in Funs.DB.Manager_Month_ComplianceObligationsC where x.MonthReportId == Id select x).ToList();
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;
}
}
if (complianceObligationsCs.Count > 0)
{
numberIndex = 1;
foreach (var item in complianceObligationsCs)
{
Row row = new Row(doc);
row.Cells.Add(CreateCell(numberIndex.ToString(), doc, table.FirstRow.Cells[0].CellFormat.Width));
row.Cells.Add(CreateCell(item.InformationContent, doc, table.FirstRow.Cells[1].CellFormat.Width));
row.Cells.Add(CreateCell(item.ResponseMeasures, doc, table.FirstRow.Cells[2].CellFormat.Width));
row.Cells.Add(CreateCell(item.ImplementationStatus, doc, table.FirstRow.Cells[3].CellFormat.Width));
row.Cells.Add(CreateCell(item.EvaluationConclusion, doc, table.FirstRow.Cells[4].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
numberIndex++;
}
//自动设置表格样式
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
else {
numberIndex = 1;
Row row = new Row(doc);
row.Cells.Add(CreateCell("暂无数据", doc, table.FirstRow.Cells[0].CellFormat.Width
+ table.FirstRow.Cells[1].CellFormat.Width + table.FirstRow.Cells[2].CellFormat.Width
+ table.FirstRow.Cells[3].CellFormat.Width
+ table.FirstRow.Cells[4].CellFormat.Width));
table.Rows.Insert(numberIndex, row);
table.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
#endregion
#region 9
bkmark = doc.Range.Bookmarks["Question"];
if (bkmark != null)
{
bkmark.Text = model.Question.ToString();
}
#endregion
#region 10 HSE影像照片
var txtReportList = Funs.DB.Report_TextBoxContent.Where(x => x.ReportId == Id).ToList();
string imageUrl = "res/images/R-C.png";
var imageUrl1 = txtReportList.FirstOrDefault(x => x.ContentType == "10-1").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl1) && imageUrl1 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl1;
builder.MoveToBookmark("ImageUrl1");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl1, out JpgSize, out Wpx, out Hpx);
if (File.Exists(url))
{
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl2 = txtReportList.FirstOrDefault(x => x.ContentType == "10-2").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl2) && imageUrl2 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl2;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl2");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl2, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl3 = txtReportList.FirstOrDefault(x => x.ContentType == "10-3").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl3) && imageUrl3 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl3;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl3");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl3, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl4 = txtReportList.FirstOrDefault(x => x.ContentType == "10-4").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl4) && imageUrl4 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl4;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl4");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl4, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl5 = txtReportList.FirstOrDefault(x => x.ContentType == "10-5").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl5) && imageUrl5 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl5;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl5");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl5, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl6 = txtReportList.FirstOrDefault(x => x.ContentType == "10-6").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl6) && imageUrl6 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl6;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl6");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl6, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl7 = txtReportList.FirstOrDefault(x => x.ContentType == "10-7").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl7) && imageUrl7 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl7;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl7");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl7, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl8 = txtReportList.FirstOrDefault(x => x.ContentType == "10-8").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl8) && imageUrl8 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl8;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl8");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl8, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl9 = txtReportList.FirstOrDefault(x => x.ContentType == "10-9").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl9) && imageUrl9 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl9;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl9");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl9, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl10 = txtReportList.FirstOrDefault(x => x.ContentType == "10-10").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl10) && imageUrl10 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl10;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl10");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl10, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl11 = txtReportList.FirstOrDefault(x => x.ContentType == "10-11").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl11) && imageUrl11 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl11;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl11");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl11, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
var imageUrl12 = txtReportList.FirstOrDefault(x => x.ContentType == "10-12").ImageUrl;
if (!string.IsNullOrWhiteSpace(imageUrl12) && imageUrl12 != imageUrl)
{
string rootPathUrl = rootPath.Replace("\\", "/");
string url = rootPathUrl + imageUrl12;
//DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("ImageUrl12");
if (!string.IsNullOrEmpty(url))
{
System.Drawing.Size JpgSize;
float Wpx;
float Hpx;
UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl12, out JpgSize, out Wpx, out Hpx);
//double w = 1;
//w = JpgSize.Width / 50.0;
if (File.Exists(url))
{
//builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w);
builder.InsertImage(url, 200, 150);
}
}
}
#region
bkmark = doc.Range.Bookmarks["ImageContent1"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-1").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent2"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-2").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent3"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-3").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent4"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-4").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent5"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-5").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent6"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-6").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent7"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-7").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent8"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-8").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent9"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-9").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent10"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-10").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent11"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-11").ContentText;
}
bkmark = doc.Range.Bookmarks["ImageContent12"];
if (bkmark != null)
{
bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "10-12").ContentText;
}
#endregion
#endregion
#region
@ -982,7 +1895,7 @@ namespace FineUIPro.Web.HSSE.Manager
//项目名称
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[1].Cells[3].FirstParagraph.Runs[0].Text = pModel.ProjectCode + "-RM-HSE-" + model.MonthReportCode;
//总页数
table.Rows[2].Cells[7].FirstParagraph.Runs[0].Text = doc.PageCount.ToString();

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

View File

@ -241516,6 +241516,10 @@ namespace Model
private System.Nullable<decimal> _DeathEconomy;
private System.Nullable<int> _LossCount;
private System.Nullable<int> _DeathCount;
private EntityRef<Manager_MonthReportC> _Manager_MonthReportC;
#region
@ -241548,6 +241552,10 @@ namespace Model
partial void OnDeathWorkTimeChanged();
partial void OnDeathEconomyChanging(System.Nullable<decimal> value);
partial void OnDeathEconomyChanged();
partial void OnLossCountChanging(System.Nullable<int> value);
partial void OnLossCountChanged();
partial void OnDeathCountChanging(System.Nullable<int> value);
partial void OnDeathCountChanged();
#endregion
public Manager_Month_InjuryAccidentC()
@ -241820,6 +241828,46 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LossCount", DbType="Int")]
public System.Nullable<int> LossCount
{
get
{
return this._LossCount;
}
set
{
if ((this._LossCount != value))
{
this.OnLossCountChanging(value);
this.SendPropertyChanging();
this._LossCount = value;
this.SendPropertyChanged("LossCount");
this.OnLossCountChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeathCount", DbType="Int")]
public System.Nullable<int> DeathCount
{
get
{
return this._DeathCount;
}
set
{
if ((this._DeathCount != value))
{
this.OnDeathCountChanging(value);
this.SendPropertyChanging();
this._DeathCount = value;
this.SendPropertyChanged("DeathCount");
this.OnDeathCountChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Manager_Month_InjuryAccidentC_Manager_MonthReportC", Storage="_Manager_MonthReportC", ThisKey="MonthReportId", OtherKey="MonthReportId", IsForeignKey=true)]
public Manager_MonthReportC Manager_MonthReportC
{