安全报表增加系统外工时统计
This commit is contained in:
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.ZHGL.Information
|
||||
@@ -43,6 +44,11 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
drpAffiliation.DataTextField = "UnitName";
|
||||
drpAffiliation.DataValueField = "UnitName";
|
||||
drpAffiliation.DataSource = BLL.UnitService.GetBranchUnitList(false);
|
||||
drpAffiliation.DataBind();
|
||||
|
||||
this.GetButtonPower();
|
||||
items.Clear();
|
||||
BLL.ConstValue.InitConstValueDropDownList(this.drpMonth, ConstValue.Group_0009, false);
|
||||
@@ -414,50 +420,52 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
private string AuditData()
|
||||
{
|
||||
string err = string.Empty;
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var reports = from x in db.Information_MillionsMonthlyReport
|
||||
where x.FillingDate < DateTime.Now
|
||||
orderby x.FillingDate descending
|
||||
select x;
|
||||
if (!string.IsNullOrEmpty(this.MillionsMonthlyReportId))
|
||||
{
|
||||
reports = from x in reports
|
||||
where x.MillionsMonthlyReportId != this.MillionsMonthlyReportId
|
||||
orderby x.FillingDate descending
|
||||
select x;
|
||||
}
|
||||
var reportIds = reports.Select(x => x.MillionsMonthlyReportId).Take(3).ToList();
|
||||
//Model.SUBQHSEDB db = Funs.DB;
|
||||
//var reports = from x in db.Information_MillionsMonthlyReport
|
||||
// where x.FillingDate < DateTime.Now
|
||||
// orderby x.FillingDate descending
|
||||
// select x;
|
||||
//if (!string.IsNullOrEmpty(this.MillionsMonthlyReportId))
|
||||
//{
|
||||
// reports = from x in reports
|
||||
// where x.MillionsMonthlyReportId != this.MillionsMonthlyReportId
|
||||
// orderby x.FillingDate descending
|
||||
// select x;
|
||||
//}
|
||||
//var reportIds = reports.Select(x => x.MillionsMonthlyReportId).Take(3).ToList();
|
||||
////var items = from x in db.Information_MillionsMonthlyReportItem
|
||||
//// where reportIds.Contains(x.MillionsMonthlyReportId)
|
||||
//// select new { x.Name, x.TotalWorkNum };
|
||||
//var items = from x in db.Information_MillionsMonthlyReportItem
|
||||
// where reportIds.Contains(x.MillionsMonthlyReportId)
|
||||
// select new { x.Name, x.TotalWorkNum };
|
||||
var items = from x in db.Information_MillionsMonthlyReportItem
|
||||
where reportIds.Contains(x.MillionsMonthlyReportId)
|
||||
select new { x.Name, x.TotalWorkNum };
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
if (!string.IsNullOrEmpty(values["Name"].ToString()) && !string.IsNullOrEmpty(values["TotalWorkNum"].ToString()))
|
||||
{
|
||||
string name = values.Value<string>("Name");
|
||||
decimal d = values.Value<decimal>("TotalWorkNum");
|
||||
var list = items.Where(x => x.Name == name);
|
||||
decimal a = 0;
|
||||
if (list.Count() > 0)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
a += item.TotalWorkNum ?? 0;
|
||||
}
|
||||
|
||||
//decimal b = a / list.Count();
|
||||
//if (d > b * 5)
|
||||
//{
|
||||
// err = name + "的总工时数超过前三个月平均值5倍,请核对后重新录入!";
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
//foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
//{
|
||||
// JObject values = mergedRow.Value<JObject>("values");
|
||||
// if (!string.IsNullOrEmpty(values["Name"].ToString()) && !string.IsNullOrEmpty(values["TotalWorkNum"].ToString()))
|
||||
// {
|
||||
// string name = values.Value<string>("Name");
|
||||
// decimal d = values.Value<decimal>("TotalWorkNum");
|
||||
// var list = items.Where(x => x.Name == name);
|
||||
// decimal a = 0;
|
||||
// if (list.Count() > 0)
|
||||
// {
|
||||
// foreach (var item in list)
|
||||
// {
|
||||
// a += item.TotalWorkNum ?? 0;
|
||||
// }
|
||||
// }
|
||||
// if (list.Count() > 0)
|
||||
// {
|
||||
// decimal b = a / list.Count();
|
||||
// if (d > b * 5)
|
||||
// {
|
||||
// err = name + "的总工时数超过前三个月平均值5倍,请核对后重新录入!";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
return err;
|
||||
}
|
||||
#endregion
|
||||
@@ -465,7 +473,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
#region 增加本月明细
|
||||
private void GetItems(string millionsMonthlyReportId)
|
||||
{
|
||||
decimal TotalWorkNumSum = 0;
|
||||
decimal TotalWorkNumSum = 0, OutSideUnitWorkNumSum = 0;
|
||||
int PostPersonNumSum = 0, SnapPersonNumSum = 0, ContractorNumSum = 0, SumPersonNumSum = 0, SeriousInjuriesNumSum = 0, SeriousInjuriesPersonNumSum = 0, SeriousInjuriesLossHourSum = 0, MinorAccidentNumSum = 0,
|
||||
MinorAccidentPersonNumSum = 0, MinorAccidentLossHourSum = 0, DeathAccidentNumSum = 0, DeathAccidentPersonNumSum = 0, DeathAccidentLossHourSum = 0, RestrictedWorkPersonNumSum = 0, RestrictedWorkLossHourSum = 0, MedicalTreatmentPersonNumSum = 0, MedicalTreatmentLossHourSum = 0,
|
||||
FireNumSum = 0, EnvironmenNumSum = 0, TrafficNumSum = 0, EquipmentNumSum = 0, QualityNumSum = 0, OtherNumSum = 0, FirstAidDressingsNumSum = 0, AttemptedEventNumSum = 0, LossDayNumSum = 0;
|
||||
@@ -475,7 +483,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
int SumPersonNum = 0;
|
||||
Model.Information_MillionsMonthlyReportItem item = new Information_MillionsMonthlyReportItem();
|
||||
Information_MillionsMonthlyReportItem item = new Information_MillionsMonthlyReportItem();
|
||||
if (values["MillionsMonthlyReportItemId"].ToString() != "")
|
||||
{
|
||||
item.MillionsMonthlyReportItemId = values.Value<string>("MillionsMonthlyReportItemId");
|
||||
@@ -485,10 +493,21 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
if (!string.IsNullOrEmpty(values["Affiliation"].ToString()))
|
||||
{
|
||||
item.Affiliation = values.Value<string>("Affiliation");
|
||||
//var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == values.Value<string>("Affiliation"));
|
||||
//if (getUnit != null)
|
||||
//{
|
||||
// item.UnitId = getUnit.UnitId;
|
||||
//}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(values["Name"].ToString()))
|
||||
{
|
||||
item.Name = values.Value<string>("Name");
|
||||
//var Name = System.Text.RegularExpressions.Regex.Replace(values.Value<string>("Name"), @"\[[^\]]*\]", "").Trim();
|
||||
//var getProject = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectName == Name);
|
||||
//if (getProject != null)
|
||||
//{
|
||||
// item.ProjectId = getProject.ProjectId;
|
||||
//}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(values["PostPersonNum"].ToString()))
|
||||
{
|
||||
@@ -536,6 +555,15 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
{
|
||||
item.TotalWorkNum = 0;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(values["OutSideUnitWorkNum"].ToString()))
|
||||
{
|
||||
item.OutSideUnitWorkNum = values.Value<decimal>("OutSideUnitWorkNum");
|
||||
OutSideUnitWorkNumSum += values.Value<decimal>("OutSideUnitWorkNum");
|
||||
}
|
||||
else
|
||||
{
|
||||
item.OutSideUnitWorkNum = 0;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(values["SeriousInjuriesNum"].ToString()))
|
||||
{
|
||||
item.SeriousInjuriesNum = values.Value<int>("SeriousInjuriesNum");
|
||||
@@ -742,6 +770,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
ContractorNum = ContractorNumSum,
|
||||
SumPersonNum = SumPersonNumSum,
|
||||
TotalWorkNum = TotalWorkNumSum,
|
||||
OutSideUnitWorkNum = OutSideUnitWorkNumSum,
|
||||
SeriousInjuriesNum = SeriousInjuriesNumSum,
|
||||
SeriousInjuriesPersonNum = SeriousInjuriesPersonNumSum,
|
||||
SeriousInjuriesLossHour = SeriousInjuriesLossHourSum,
|
||||
@@ -787,6 +816,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
{
|
||||
newItem.SortIndex = oldItem.SortIndex + 1;
|
||||
newItem.Affiliation = oldItem.Affiliation;
|
||||
drpAffiliation_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -848,6 +878,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
ContractorNum = 0,
|
||||
SumPersonNum = 0,
|
||||
TotalWorkNum = 0,
|
||||
OutSideUnitWorkNum = 0,
|
||||
SeriousInjuriesNum = 0,
|
||||
SeriousInjuriesPersonNum = 0,
|
||||
SeriousInjuriesLossHour = 0,
|
||||
@@ -884,6 +915,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
ContractorNum = 0,
|
||||
SumPersonNum = 0,
|
||||
TotalWorkNum = 0,
|
||||
OutSideUnitWorkNum = 0,
|
||||
SeriousInjuriesNum = 0,
|
||||
SeriousInjuriesPersonNum = 0,
|
||||
SeriousInjuriesLossHour = 0,
|
||||
@@ -938,7 +970,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
}
|
||||
}
|
||||
|
||||
Model.InformationProject_MillionsMonthlyReport report = millionsMonthlyReports.FirstOrDefault(x => x.ProjectId == p.ProjectId);
|
||||
InformationProject_MillionsMonthlyReport report = millionsMonthlyReports.FirstOrDefault(x => x.ProjectId == p.ProjectId);
|
||||
if (report != null)
|
||||
{
|
||||
item.PostPersonNum = report.PostPersonNum;
|
||||
@@ -946,6 +978,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
item.ContractorNum = report.ContractorNum;
|
||||
item.SumPersonNum = report.SumPersonNum;
|
||||
item.TotalWorkNum = report.TotalWorkNum;
|
||||
item.OutSideUnitWorkNum = report.OutSideUnitWorkNum;
|
||||
item.SeriousInjuriesNum = report.SeriousInjuriesNum;
|
||||
item.SeriousInjuriesPersonNum = report.SeriousInjuriesPersonNum;
|
||||
item.SeriousInjuriesLossHour = report.SeriousInjuriesLossHour;
|
||||
@@ -976,6 +1009,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
item.ContractorNum = 0;
|
||||
item.SumPersonNum = 0;
|
||||
item.TotalWorkNum = 0;
|
||||
item.OutSideUnitWorkNum = 0;
|
||||
item.SeriousInjuriesNum = 0;
|
||||
item.SeriousInjuriesPersonNum = 0;
|
||||
item.SeriousInjuriesLossHour = 0;
|
||||
@@ -1131,6 +1165,7 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
ContractorNum = item.ContractorNum,
|
||||
SumPersonNum = item.SumPersonNum,
|
||||
TotalWorkNum = item.TotalWorkNum,
|
||||
OutSideUnitWorkNum = item.OutSideUnitWorkNum,
|
||||
SeriousInjuriesNum = item.SeriousInjuriesNum,
|
||||
SeriousInjuriesPersonNum = item.SeriousInjuriesPersonNum,
|
||||
SeriousInjuriesLossHour = item.SeriousInjuriesLossHour,
|
||||
@@ -1282,5 +1317,92 @@ namespace FineUIPro.Web.ZHGL.Information
|
||||
}
|
||||
this.txtKeyWorkOKRate.Text = rate;
|
||||
}
|
||||
|
||||
protected void drpAffiliation_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(drpAffiliation.SelectedValue))
|
||||
{
|
||||
var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == drpAffiliation.SelectedValue);
|
||||
if (getUnit != null)
|
||||
{
|
||||
var originalProjects = ProjectService.GetProjectWorkList(getUnit.UnitId);
|
||||
var getSProjects = originalProjects.Select(x => new
|
||||
{
|
||||
x.ProjectId,
|
||||
ProjectName = $"[{x.ProjectCode}]{x.ProjectName}",
|
||||
}).ToList();
|
||||
drpName.DataTextField = "ProjectName";
|
||||
drpName.DataValueField = "ProjectName";
|
||||
drpName.DataSource = getSProjects;
|
||||
drpName.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drpName_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
bool isDuplicate = false;
|
||||
|
||||
if (!string.IsNullOrEmpty(drpName.SelectedValue))
|
||||
{
|
||||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||||
{
|
||||
JObject values = mergedRow.Value<JObject>("values");
|
||||
if (!string.IsNullOrEmpty(values["Name"].ToString()) && !string.IsNullOrEmpty(values["Affiliation"].ToString()))
|
||||
{
|
||||
if (values.Value<string>("Name") == drpName.SelectedValue && values.Value<string>("Affiliation") == drpAffiliation.SelectedValue)
|
||||
{
|
||||
isDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isDuplicate)
|
||||
{
|
||||
drpName.SelectedValue = string.Empty;
|
||||
Alert.Show("此项目已被选择,请勿重复!");
|
||||
}
|
||||
}
|
||||
|
||||
#region 动态加载下拉框
|
||||
|
||||
[WebMethod]
|
||||
public static List<object> InitDrpNameDataSource(string unitName)
|
||||
{
|
||||
List<object> result = new List<object>();
|
||||
try
|
||||
{
|
||||
var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == unitName);
|
||||
if (getUnit != null)
|
||||
{
|
||||
var originalProjects = ProjectService.GetProjectWorkList(getUnit.UnitId);
|
||||
var getSProjects = originalProjects.Select(x => new
|
||||
{
|
||||
x.ProjectId,
|
||||
ProjectName = $"[{x.ProjectCode}]{x.ProjectName}",
|
||||
}).ToList();
|
||||
|
||||
foreach (var project in getSProjects)
|
||||
{
|
||||
result.Add(new
|
||||
{
|
||||
display = project.ProjectName ?? "",
|
||||
enabled = 1,
|
||||
group = "",
|
||||
prefix = string.Empty,
|
||||
value = project.ProjectName ?? "",
|
||||
text = project.ProjectName ?? "",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user