diff --git a/DataBase/版本日志/SGGLDB_V2025-07-11-001-gaofei.sql b/DataBase/版本日志/SGGLDB_V2025-07-11-001-gaofei.sql new file mode 100644 index 00000000..222e2d5b --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-07-11-001-gaofei.sql @@ -0,0 +1,37 @@ +alter table Information_ActionWorkLedger add KeyWorkNum int null +alter table Information_ActionWorkLedger add KeyWorkOKNum int null +alter table Information_ActionWorkLedger add KeyWorkOKRate nvarchar(20) null +GO + + + +ALTER VIEW [dbo].[View_Information_ActionWorkLedger] AS +SELECT + Report.ActionWorkLedgerId, + Report.UnitId, + Report.ReportDate, + Report.YearId, + Report.Quarter, + Report.UpState, + Report.HandleState, + Report.KeyWorkNum, + Report.KeyWorkOKNum, + Report.KeyWorkOKRate, + (ISNULL(Group_0008.ConstText,'-') + ISNULL(Group_0011.ConstText,'-')) AS Quarters, + u.UnitName, + Report.HandleMan, + US.PersonName as UserName +FROM dbo.Information_ActionWorkLedger AS Report +LEFT JOIN Sys_Const AS Group_0008 ON Group_0008.GroupId='0008' AND Group_0008.ConstValue =Report.YearId +LEFT JOIN Sys_Const AS Group_0011 ON Group_0011.GroupId='0011' AND Group_0011.ConstValue =Report.Quarter +Left join Base_Unit as u on u.UnitId=Report.UnitId +LEFT JOIN Person_Persons AS US ON US.PersonId=Report.HandleMan + + + + + + + +GO + diff --git a/SGGL/BLL/WebService/CNCECHSSEWebService.cs b/SGGL/BLL/WebService/CNCECHSSEWebService.cs index c77e3d26..dc79d0a5 100644 --- a/SGGL/BLL/WebService/CNCECHSSEWebService.cs +++ b/SGGL/BLL/WebService/CNCECHSSEWebService.cs @@ -1679,6 +1679,9 @@ Quarter = x.Quarter, YearId = x.YearId, CompileMan = x.CompileMan, + KeyWorkNum = x.KeyWorkNum, + KeyWorkOKNum = x.KeyWorkOKNum, + KeyWorkOKRate = x.KeyWorkOKRate, }; var upReportItem = from x in db.Information_ActionWorkLedgerItem diff --git a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs index c1b6f1ea..53bac291 100644 --- a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs @@ -692,7 +692,7 @@ namespace BLL EquipmentInspectionNum = inspectionEquipmentList.Count(), EquipmentInspectionQualifiedNum = inspectionEquipmentList.Count(), PersonInspectionNum = inspectionPersonList.Count(), - PersonInspectionQualifiedNum = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true).Count(), + PersonInspectionQualifiedNum = inspectionPersonList.Where(x => x.ValidityDate == null || (x.ValidityDate.HasValue && x.ValidityDate >= DateTime.Now)).Count(), MachineInspectionNum = inspectionMachineList.Count(), MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckCertificate == true).Count(), @@ -765,7 +765,7 @@ namespace BLL EquipmentInspectionNum = inspectionEquipmentList.Count(x => x.ProjectId == projectid), EquipmentInspectionQualifiedNum = inspectionEquipmentList.Where(x => x.ProjectId == projectid).Count(), PersonInspectionNum = inspectionPersonList.Count(x => x.ProjectId == projectid), - PersonInspectionQualifiedNum = inspectionPersonList.Where(x => x.IsOnSite.HasValue && x.IsOnSite == true && x.ProjectId == projectid).Count(), + PersonInspectionQualifiedNum = inspectionPersonList.Where(x => (x.ValidityDate == null || (x.ValidityDate.HasValue && x.ValidityDate >= DateTime.Now)) && x.ProjectId == projectid).Count(), MachineInspectionNum = inspectionMachineList.Count(x => x.ProjectId == projectid), MachineInspectionQualifiedNum = inspectionMachineList.Where(x => x.IsCheckCertificate == true && x.ProjectId == projectid).Count(), MaterialInspectionNum = 0, @@ -1213,7 +1213,7 @@ namespace BLL public static List GetComprehensive_InspectionPerson() { var result = (from x in Funs.DB.Comprehensive_InspectionPerson - where BeUnderConstructionList.Contains(x.ProjectId) && x.CompileDate > Const.DtmarkTime + where BeUnderConstructionList.Contains(x.ProjectId) && x.IsOnSite.HasValue && x.IsOnSite == true && x.CompileDate > Const.DtmarkTime select x).ToList(); return result; } diff --git a/SGGL/BLL/ZHGL/Information/ActionWorkLedgerService.cs b/SGGL/BLL/ZHGL/Information/ActionWorkLedgerService.cs index 603f472f..ed3eb2c9 100644 --- a/SGGL/BLL/ZHGL/Information/ActionWorkLedgerService.cs +++ b/SGGL/BLL/ZHGL/Information/ActionWorkLedgerService.cs @@ -81,6 +81,9 @@ namespace BLL newActionWorkLedger.UpState = ActionWorkLedger.UpState; newActionWorkLedger.HandleState = ActionWorkLedger.HandleState; newActionWorkLedger.HandleMan = ActionWorkLedger.HandleMan; + newActionWorkLedger.KeyWorkNum = ActionWorkLedger.KeyWorkNum; + newActionWorkLedger.KeyWorkOKNum = ActionWorkLedger.KeyWorkOKNum; + newActionWorkLedger.KeyWorkOKRate = ActionWorkLedger.KeyWorkOKRate; Funs.DB.SubmitChanges(); } } diff --git a/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedger.aspx b/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedger.aspx index 6e2464f6..a2d16bc6 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedger.aspx +++ b/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedger.aspx @@ -80,14 +80,26 @@ - + - + + + + + + + + + + + + protected global::FineUIPro.Label lbHandleMan; + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// txtKeyWorkNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label txtKeyWorkNum; + + /// + /// txtKeyWorkOKNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label txtKeyWorkOKNum; + + /// + /// txtKeyWorkOKRate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label txtKeyWorkOKRate; + /// /// Grid1 控件。 /// diff --git a/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx b/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx index 2e0c1ddb..40f63ba3 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx +++ b/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx @@ -27,6 +27,15 @@ + + + + + + + + + 0) + { + rate = (decimal.Round(keyWorkOKNum / keyWorkNum, 4) * 100).ToString("0.##") + "%"; + } + this.txtKeyWorkOKRate.Text = rate; + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx.designer.cs b/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx.designer.cs index ffe225da..97c972e7 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/ZHGL/Information/ActionWorkLedgerAdd.aspx.designer.cs @@ -75,6 +75,33 @@ namespace FineUIPro.Web.ZHGL.Information { /// protected global::FineUIPro.DatePicker dpkCompileDate; + /// + /// txtKeyWorkNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtKeyWorkNum; + + /// + /// txtKeyWorkOKNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtKeyWorkOKNum; + + /// + /// txtKeyWorkOKRate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtKeyWorkOKRate; + /// /// Grid1 控件。 /// diff --git a/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs index e86d2bad..3aaebf90 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs @@ -1,7 +1,4 @@ using BLL; -using FineUIPro.Web.BaseInfo; -using FineUIPro.Web.DataShow; -using FineUIPro.Web.InformationProject; using Model; using Newtonsoft.Json.Linq; using System; @@ -60,11 +57,125 @@ namespace FineUIPro.Web.ZHGL.Information string months = Request.QueryString["Months"]; MillionsMonthlyReportId = Request.QueryString["MillionsMonthlyReportId"]; if (!String.IsNullOrEmpty(MillionsMonthlyReportId)) - { + { + items = BLL.MillionsMonthlyReportItemService.GetItemsNoSum(MillionsMonthlyReportId); + this.Grid1.DataSource = items; + this.Grid1.DataBind(); var report = BLL.MillionsMonthlyReportService.GetMillionsMonthlyReportByMillionsMonthlyReportId(MillionsMonthlyReportId); if (report != null) { - setPageInfo(report); + this.btnSave.Hidden = true; + this.btnSubmit.Hidden = true; + this.btnCopy.Hidden = true; + if (report.HandleState == BLL.Const.HandleState_4) + { + this.btnUpdata.Hidden = false; + } + else + { + if (report.HandleMan == this.CurrUser.PersonId || this.CurrUser.PersonId == BLL.Const.sysglyId) + { + this.btnSave.Hidden = false; + this.btnSubmit.Hidden = false; + } + } + if (report.UpState == BLL.Const.UpState_3) + { + this.btnSave.Hidden = true; + //this.btnUpdata.Hidden = true; + } + drpMonth.SelectedValue = report.Month.ToString(); + drpYear.SelectedValue = report.Year.ToString(); + drpUnit.SelectedValue = report.UnitId; + if (report.FillingDate != null) + { + txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", report.FillingDate); + } + txtDutyPerson.Text = report.DutyPerson; + if (report.RecordableIncidentRate != null) + { + txtRecordableIncidentRate.Text = report.RecordableIncidentRate.ToString(); + } + if (report.LostTimeRate != null) + { + txtLostTimeRate.Text = report.LostTimeRate.ToString(); + } + if (report.LostTimeInjuryRate != null) + { + txtLostTimeInjuryRate.Text = report.LostTimeInjuryRate.ToString(); + } + if (report.DeathAccidentFrequency != null) + { + txtDeathAccidentFrequency.Text = report.DeathAccidentFrequency.ToString(); + } + if (report.AccidentMortality != null) + { + txtAccidentMortality.Text = report.AccidentMortality.ToString(); + } + if (report.InputCosts != null) + { + this.txtInputCosts.Text = Convert.ToString(report.InputCosts); + } + if (report.TrainNum != null) + { + this.txtTrainNum.Text = Convert.ToString(report.TrainNum); + } + if (report.GeneralHazardNum != null) + { + this.txtGeneralHazardNum.Text = Convert.ToString(report.GeneralHazardNum); + } + if (report.MajorHazardNum != null) + { + this.txtMajorHazardNum.Text = Convert.ToString(report.MajorHazardNum); + } + if (report.NotProofLargeProjectNum != null) + { + this.txtNotProofLargeProjectNum.Text = Convert.ToString(report.NotProofLargeProjectNum); + } + if (report.ProofLargeProjectNum != null) + { + this.txtProofLargeProjectNum.Text = Convert.ToString(report.ProofLargeProjectNum); + } + if (report.FireLicenseNum != null) + { + this.txtFireLicenseNum.Text = Convert.ToString(report.FireLicenseNum); + } + if (report.LimitLicenseNum != null) + { + this.txtLimitLicenseNum.Text = Convert.ToString(report.LimitLicenseNum); + } + if (report.HighLicenseNum != null) + { + this.txtHighLicenseNum.Text = Convert.ToString(report.HighLicenseNum); + } + if (report.HoistingLicenseNum != null) + { + this.txtHoistingLicenseNum.Text = Convert.ToString(report.HoistingLicenseNum); + } + if (report.BreakGroundLicenseNum != null) + { + this.txtBreakGroundLicenseNum.Text = Convert.ToString(report.BreakGroundLicenseNum); + } + if (report.ElectricityLicenseNum != null) + { + this.txtElectricityLicenseNum.Text = Convert.ToString(report.ElectricityLicenseNum); + } + if (report.RTLicenseNum != null) + { + this.txtRTLicenseNum.Text = Convert.ToString(report.RTLicenseNum); + } + if (report.NightLicenseNum != null) + { + this.txtNightLicenseNum.Text = Convert.ToString(report.NightLicenseNum); + } + if (report.CommissionerNum != null) + { + this.txtCommissionerNum.Text = Convert.ToString(report.CommissionerNum); + } + if (report.SoleDutyNum != null) + { + this.txtSoleDutyNum.Text = Convert.ToString(report.SoleDutyNum); + } } } else @@ -75,7 +186,9 @@ namespace FineUIPro.Web.ZHGL.Information txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); txtDutyPerson.Text = this.CurrUser.PersonName; //增加明细集合 - GetNewItems(year, months); + GetNewItems(year, months); + this.Grid1.DataSource = items; + this.Grid1.DataBind(); this.txtRecordableIncidentRate.Text = "0"; this.txtLostTimeRate.Text = "0"; this.txtLostTimeInjuryRate.Text = "0"; @@ -84,133 +197,6 @@ namespace FineUIPro.Web.ZHGL.Information } } } - - #region 初始化页面信息 - /// - /// - /// - /// - private void setPageInfo(Model.Information_MillionsMonthlyReport report) - { - this.btnSave.Hidden = true; - this.btnSubmit.Hidden = true; - this.btnCopy.Hidden = true; - if (report.HandleState == BLL.Const.HandleState_4) - { - this.btnUpdata.Hidden = false; - } - else - { - if (report.HandleMan == this.CurrUser.PersonId || this.CurrUser.PersonId == BLL.Const.sysglyId) - { - this.btnSave.Hidden = false; - this.btnSubmit.Hidden = false; - } - } - if (report.UpState == BLL.Const.UpState_3) - { - this.btnSave.Hidden = true; - this.btnUpdata.Hidden = true; - } - drpMonth.SelectedValue = report.Month.ToString(); - drpYear.SelectedValue = report.Year.ToString(); - drpUnit.SelectedValue = report.UnitId; - if (report.FillingDate != null) - { - txtFillingDate.Text = string.Format("{0:yyyy-MM-dd}", report.FillingDate); - } - txtDutyPerson.Text = report.DutyPerson; - if (report.RecordableIncidentRate != null) - { - txtRecordableIncidentRate.Text = report.RecordableIncidentRate.ToString(); - } - if (report.LostTimeRate != null) - { - txtLostTimeRate.Text = report.LostTimeRate.ToString(); - } - if (report.LostTimeInjuryRate != null) - { - txtLostTimeInjuryRate.Text = report.LostTimeInjuryRate.ToString(); - } - if (report.DeathAccidentFrequency != null) - { - txtDeathAccidentFrequency.Text = report.DeathAccidentFrequency.ToString(); - } - if (report.AccidentMortality != null) - { - txtAccidentMortality.Text = report.AccidentMortality.ToString(); - } - if (report.InputCosts != null) - { - this.txtInputCosts.Text = Convert.ToString(report.InputCosts); - } - if (report.TrainNum != null) - { - this.txtTrainNum.Text = Convert.ToString(report.TrainNum); - } - if (report.GeneralHazardNum != null) - { - this.txtGeneralHazardNum.Text = Convert.ToString(report.GeneralHazardNum); - } - if (report.MajorHazardNum != null) - { - this.txtMajorHazardNum.Text = Convert.ToString(report.MajorHazardNum); - } - if (report.NotProofLargeProjectNum != null) - { - this.txtNotProofLargeProjectNum.Text = Convert.ToString(report.NotProofLargeProjectNum); - } - if (report.ProofLargeProjectNum != null) - { - this.txtProofLargeProjectNum.Text = Convert.ToString(report.ProofLargeProjectNum); - } - if (report.FireLicenseNum != null) - { - this.txtFireLicenseNum.Text = Convert.ToString(report.FireLicenseNum); - } - if (report.LimitLicenseNum != null) - { - this.txtLimitLicenseNum.Text = Convert.ToString(report.LimitLicenseNum); - } - if (report.HighLicenseNum != null) - { - this.txtHighLicenseNum.Text = Convert.ToString(report.HighLicenseNum); - } - if (report.HoistingLicenseNum != null) - { - this.txtHoistingLicenseNum.Text = Convert.ToString(report.HoistingLicenseNum); - } - if (report.BreakGroundLicenseNum != null) - { - this.txtBreakGroundLicenseNum.Text = Convert.ToString(report.BreakGroundLicenseNum); - } - if (report.ElectricityLicenseNum != null) - { - this.txtElectricityLicenseNum.Text = Convert.ToString(report.ElectricityLicenseNum); - } - if (report.RTLicenseNum != null) - { - this.txtRTLicenseNum.Text = Convert.ToString(report.RTLicenseNum); - } - if (report.NightLicenseNum != null) - { - this.txtNightLicenseNum.Text = Convert.ToString(report.NightLicenseNum); - } - if (report.CommissionerNum != null) - { - this.txtCommissionerNum.Text = Convert.ToString(report.CommissionerNum); - } - if (report.SoleDutyNum != null) - { - this.txtSoleDutyNum.Text = Convert.ToString(report.SoleDutyNum); - } - - items = BLL.MillionsMonthlyReportItemService.GetItemsNoSum(MillionsMonthlyReportId); - this.Grid1.DataSource = items; - this.Grid1.DataBind(); - } - #endregion - #endregion #region 关闭窗口 @@ -362,21 +348,100 @@ namespace FineUIPro.Web.ZHGL.Information { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ReportSubmit.aspx?Type=MillionsMonthlyReport&Id={0}", report.MillionsMonthlyReportId, "编辑 - "))); } + else if (type == "add") + { + ShowNotify("保存成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + return; + } } protected void btnSave_Click(object sender, EventArgs e) { - Save("add"); + string err = AuditData(); + if (string.IsNullOrEmpty(err)) + { + Save("add"); + } + else + { + ShowNotify(err, MessageBoxIcon.Warning); + } } protected void btnUpdata_Click(object sender, EventArgs e) { - Save("updata"); + string err = AuditData(); + if (string.IsNullOrEmpty(err)) + { + Save("updata"); + } + else + { + ShowNotify(err, MessageBoxIcon.Warning); + } } protected void btnSubmit_Click(object sender, EventArgs e) { - Save("submit"); + string err = AuditData(); + if (string.IsNullOrEmpty(err)) + { + Save("submit"); + } + else + { + ShowNotify(err, MessageBoxIcon.Warning); + } + } + + 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(); + //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("values"); + if (!string.IsNullOrEmpty(values["Name"].ToString()) && !string.IsNullOrEmpty(values["TotalWorkNum"].ToString())) + { + string name = values.Value("Name"); + decimal d = values.Value("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; + } + } + } + return err; } #endregion @@ -735,99 +800,29 @@ namespace FineUIPro.Web.ZHGL.Information #region 获取明细 private void GetNewItems(string year, string months) { - DateTime nowTime = Funs.GetNewDateTimeOrNow(year + "-" + months); - DateTime starTime = nowTime.AddMonths(-2).AddDays(24); - DateTime endTime = nowTime.AddMonths(-1).AddDays(23); - - var getCosts = from x in Funs.DB.CostGoods_CostManageItem - join y in Funs.DB.CostGoods_CostManage on x.CostManageId equals y.CostManageId - where y.CostManageDate >=starTime && y.CostManageDate <= endTime - select x; - if (getCosts.Count() > 0) - { - this.txtInputCosts.Text = getCosts.Sum(x => x.PriceMoney ?? 0).ToString(); - } - this.txtTrainNum.Text = Funs.DB.EduTrain_TrainRecord.Where(x => x.TrainStartDate >= starTime && x.TrainStartDate <= endTime).Count().ToString(); - - int HazardAll = 0, RectifyAll = 0; - int HazardMajor = 0, RectifyMajor = 0; - var getHazardRegister = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.RegisterDate >= starTime && x.RegisterDate <= endTime && x.States == Const.State_3); - HazardAll = getHazardRegister.Count(); - if (HazardAll > 0) - { - HazardMajor = getHazardRegister.Where(x => x.HazardValue == "2").Count(); - } - - var getRectifyNotices = Funs.DB.Check_RectifyNotices.Where(x => x.CheckedDate >= starTime && x.CheckedDate <= endTime && x.States == Const.State_5); - RectifyAll = getRectifyNotices.Count(); - if (RectifyAll > 0) - { - RectifyMajor = getRectifyNotices.Where(x => x.HiddenHazardType == "3").Count(); - } - this.txtGeneralHazardNum.Text = ((HazardAll - HazardMajor) + (RectifyAll - RectifyMajor)).ToString(); - this.txtMajorHazardNum.Text = (HazardMajor + RectifyMajor).ToString(); - - var getLarger = from x in Funs.DB.Solution_LargerHazardListItem - join y in Funs.DB.Solution_LargerHazardList on x.LargerHazardListId equals y.LargerHazardListId - where y.States == Const.State_1 && y.RecordTime >= starTime && y.RecordTime <= endTime - select x; - if (getLarger.Count() > 0) - { - this.txtNotProofLargeProjectNum.Text = Convert.ToString(getLarger.Where(x => x.IsArgument == false).Count()); - this.txtProofLargeProjectNum.Text = Convert.ToString(getLarger.Where(x => x.IsArgument == true).Count()); - } - - var getLicense = from x in Funs.DB.License_LicenseManager - join y in Funs.DB.Base_LicenseType on x.LicenseTypeId equals y.LicenseTypeId - where x.States != Const.State_R && x.StartDate >= starTime && x.StartDate <= endTime - select new { x.LicenseManagerId,x.StartDate,x.EndDate,x.States,y.LicenseTypeId,y.LicenseTypeCode,y.LicenseTypeName}; - - int fire1 = Funs.DB.License_FireWork.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int fire2 = getLicense.Where(x => x.LicenseTypeName.Contains("动火")).Count(); - this.txtFireLicenseNum.Text =(fire1+ fire2) .ToString(); - - int limit1 = Funs.DB.License_LimitedSpace.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int limit2 = getLicense.Where(x => x.LicenseTypeName.Contains("受限空间")).Count(); - this.txtLimitLicenseNum.Text = (limit1+ limit2).ToString(); - - int High1 = Funs.DB.License_HeightWork.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int High2 = getLicense.Where(x => x.LicenseTypeName.Contains("登高")).Count(); - this.txtHighLicenseNum.Text =(High1+ High2).ToString(); - - int Hoisting1 = Funs.DB.License_LiftingWork.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int Hoisting2 = getLicense.Where(x => x.LicenseTypeName.Contains("吊装")).Count(); - this.txtHoistingLicenseNum.Text =(Hoisting1+ Hoisting2).ToString(); - - int Break1 = Funs.DB.License_BreakGround.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int Break2 = getLicense.Where(x => x.LicenseTypeName.Contains("动土")).Count(); - this.txtBreakGroundLicenseNum.Text = (Break1+ Break2).ToString(); - - this.txtElectricityLicenseNum.Text = getLicense.Where(x=>x.LicenseTypeName.Contains("临电")).Count().ToString(); - - int rt1 = Funs.DB.License_RadialWork.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int rt2 = getLicense.Where(x => x.LicenseTypeName.Contains("射线")).Count(); - this.txtRTLicenseNum.Text =(rt1+ rt2).ToString(); - - int night1 = Funs.DB.License_NightWork.Where(x => x.ApplyDate >= starTime && x.ApplyDate <= endTime && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); - int night2 = getLicense.Where(x => x.LicenseTypeName.Contains("夜间")).Count(); - this.txtNightLicenseNum.Text =(night1+ night2).ToString(); - - var getPersons = from x in Funs.DB.SitePerson_Person - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.States == Const.ProjectPersonStates_1 && y.IsHsse == true - select new { x.ProjectId,y.WorkPostName} ; - int isHsse = getPersons.Count(); - if (isHsse > 0) - { - this.txtCommissionerNum.Text = Convert.ToString(getPersons.Where(x => x.WorkPostName.Contains("安全总监")).Count()); - } - - this.txtSoleDutyNum.Text = isHsse.ToString(); - + //获取项目集合 + List millionsMonthlyReports = (from x in Funs.DB.InformationProject_MillionsMonthlyReport where x.Year.ToString() == year && x.Month.ToString() == months && x.States == BLL.Const.State_2 select x).ToList(); + this.txtInputCosts.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.InputCosts ?? 0)); + this.txtTrainNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.TrainNum ?? 0)); + this.txtGeneralHazardNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.GeneralHazardNum ?? 0)); + this.txtMajorHazardNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.MajorHazardNum ?? 0)); + this.txtNotProofLargeProjectNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.NotProofLargeProjectNum ?? 0)); + this.txtProofLargeProjectNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.ProofLargeProjectNum ?? 0)); + this.txtFireLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.FireLicenseNum ?? 0)); + this.txtLimitLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.LimitLicenseNum ?? 0)); + this.txtHighLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.HighLicenseNum ?? 0)); + this.txtHoistingLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.HoistingLicenseNum ?? 0)); + this.txtBreakGroundLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.BreakGroundLicenseNum ?? 0)); + this.txtElectricityLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.ElectricityLicenseNum ?? 0)); + this.txtRTLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.RTLicenseNum ?? 0)); + this.txtNightLicenseNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.NightLicenseNum ?? 0)); + this.txtCommissionerNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.CommissionerNum ?? 0)); + this.txtSoleDutyNum.Text = Convert.ToString(millionsMonthlyReports.Sum(x => x.SoleDutyNum ?? 0)); + List projectIds = millionsMonthlyReports.Select(x => x.ProjectId).ToList(); //增加明细集合 Model.Information_MillionsMonthlyReportItem item1 = new Information_MillionsMonthlyReportItem { - MillionsMonthlyReportItemId = SQLHelper.GetNewID(), + MillionsMonthlyReportItemId = SQLHelper.GetNewID(typeof(Model.Information_MillionsMonthlyReportItem)), Affiliation = "机关后勤服务", Name = "总部", SortIndex = 10, @@ -863,7 +858,7 @@ namespace FineUIPro.Web.ZHGL.Information items.Add(item1); Model.Information_MillionsMonthlyReportItem item2 = new Information_MillionsMonthlyReportItem { - MillionsMonthlyReportItemId = SQLHelper.GetNewID(), + MillionsMonthlyReportItemId = SQLHelper.GetNewID(typeof(Model.Information_MillionsMonthlyReportItem)), Affiliation = "机关后勤服务", Name = "二级单位", SortIndex = 20, @@ -896,16 +891,21 @@ namespace FineUIPro.Web.ZHGL.Information LossDayNum = 0, }; items.Add(item2); + var projects = (from x in Funs.DB.Base_Project + where projectIds.Contains(x.ProjectId) + select x).ToList(); - - var projects = BLL.ProjectService.GetProjectWorkList(); + if (this.CurrUser.UnitId == BLL.Const.UnitId_SEDIN) + { + projects = BLL.ProjectService.GetProjectWorkList(); + } int i = 20; foreach (var p in projects) { i += 10; Model.Information_MillionsMonthlyReportItem item = new Information_MillionsMonthlyReportItem { - MillionsMonthlyReportItemId = SQLHelper.GetNewID(), + MillionsMonthlyReportItemId = SQLHelper.GetNewID(typeof(Model.Information_MillionsMonthlyReportItem)), Affiliation = "项目现场", Name = p.ProjectName, SortIndex = i @@ -920,51 +920,70 @@ namespace FineUIPro.Web.ZHGL.Information item.Name = "[" + p.ProjectCode + "]" + p.ProjectName; } } - var getSitePersons = Funs.DB.SitePerson_Person.Where(x => x.ProjectId == p.ProjectId && x.States == Const.ProjectPersonStates_1); - //var getZSOerson = from x in getSitePersons - // join y in Funs.DB.Person_Persons on x.PersonId equals y.PersonId - // where y.PersonType == "1" && x.UnitId == Const.UnitId_SEDIN - // select x; - var getAllSedinPerson= getSitePersons.Where(x => x.UnitId == Const.UnitId_SEDIN).Count(); - item.PostPersonNum = getAllSedinPerson; - item.SnapPersonNum = 0; - item.ContractorNum = getSitePersons.Where(x => x.UnitId != Const.UnitId_SEDIN).Count(); - item.SumPersonNum = getSitePersons.Count(); - item.TotalWorkNum = 0; - var getInfo = APISeDinMonthReportService.getSeDinMonthReport2ById(p.ProjectId, year + "-" + months); - if (getInfo != null) + Model.InformationProject_MillionsMonthlyReport report = millionsMonthlyReports.FirstOrDefault(x => x.ProjectId == p.ProjectId); + if (report != null) { - item.TotalWorkNum = Math.Round(getInfo.MonthWorkTime / 10000 ?? 0, 4); + item.PostPersonNum = report.PostPersonNum; + item.SnapPersonNum = report.SnapPersonNum; + item.ContractorNum = report.ContractorNum; + item.SumPersonNum = report.SumPersonNum; + item.TotalWorkNum = report.TotalWorkNum; + item.SeriousInjuriesNum = report.SeriousInjuriesNum; + item.SeriousInjuriesPersonNum = report.SeriousInjuriesPersonNum; + item.SeriousInjuriesLossHour = report.SeriousInjuriesLossHour; + item.MinorAccidentNum = report.MinorAccidentNum; + item.MinorAccidentPersonNum = report.MinorAccidentPersonNum; + item.MinorAccidentLossHour = report.MinorAccidentLossHour; + item.DeathAccidentNum = report.DeathAccidentNum; + item.DeathAccidentPersonNum = report.DeathAccidentPersonNum; + item.DeathAccidentLossHour = report.DeathAccidentLossHour; + item.RestrictedWorkPersonNum = report.RestrictedWorkPersonNum; + item.RestrictedWorkLossHour = report.RestrictedWorkLossHour; + item.MedicalTreatmentPersonNum = report.MedicalTreatmentPersonNum; + item.MedicalTreatmentLossHour = report.MedicalTreatmentLossHour; + item.FireNum = report.FireNum; + item.EnvironmenNum = report.EnvironmenNum; + item.TrafficNum = report.TrafficNum; + item.EquipmentNum = report.EquipmentNum; + item.QualityNum = report.QualityNum; + item.OtherNum = report.OtherNum; + item.FirstAidDressingsNum = report.FirstAidDressingsNum; + item.AttemptedEventNum = report.AttemptedEventNum; + item.LossDayNum = report.LossDayNum; + } + else + { + item.PostPersonNum = 0; + item.SnapPersonNum = 0; + item.ContractorNum = 0; + item.SumPersonNum = 0; + item.TotalWorkNum = 0; + item.SeriousInjuriesNum = 0; + item.SeriousInjuriesPersonNum = 0; + item.SeriousInjuriesLossHour = 0; + item.MinorAccidentNum = 0; + item.MinorAccidentPersonNum = 0; + item.MinorAccidentLossHour = 0; + item.DeathAccidentNum = 0; + item.DeathAccidentPersonNum = 0; + item.DeathAccidentLossHour = 0; + item.RestrictedWorkPersonNum = 0; + item.RestrictedWorkLossHour = 0; + item.MedicalTreatmentPersonNum = 0; + item.MedicalTreatmentLossHour = 0; + item.FireNum = 0; + item.EnvironmenNum = 0; + item.TrafficNum = 0; + item.EquipmentNum = 0; + item.QualityNum = 0; + item.OtherNum = 0; + item.FirstAidDressingsNum = 0; + item.AttemptedEventNum = 0; + item.LossDayNum = 0; } - - item.SeriousInjuriesNum = 0; - item.SeriousInjuriesPersonNum = 0; - item.SeriousInjuriesLossHour = 0; - item.MinorAccidentNum = 0; - item.MinorAccidentPersonNum = 0; - item.MinorAccidentLossHour = 0; - item.DeathAccidentNum = 0; - item.DeathAccidentPersonNum = 0; - item.DeathAccidentLossHour = 0; - item.RestrictedWorkPersonNum = 0; - item.RestrictedWorkLossHour = 0; - item.MedicalTreatmentPersonNum = 0; - item.MedicalTreatmentLossHour = 0; - item.FireNum = 0; - item.EnvironmenNum = 0; - item.TrafficNum = 0; - item.EquipmentNum = 0; - item.QualityNum = 0; - item.OtherNum = 0; - item.FirstAidDressingsNum = 0; - item.AttemptedEventNum = 0; - item.LossDayNum = 0; items.Add(item); } - - this.Grid1.DataSource = items; - this.Grid1.DataBind(); } #endregion @@ -984,6 +1003,16 @@ namespace FineUIPro.Web.ZHGL.Information Grid1.DataSource = items; Grid1.DataBind(); } + + protected void drpDate_SelectedIndexChanged(object sender, EventArgs e) + { + items.Clear(); + GetNewItems(drpYear.SelectedValue, drpMonth.SelectedValue); + Grid1.DataSource = items; + Grid1.DataBind(); + } + + #endregion #region 获取按钮权限 diff --git a/SGGL/Model/APIItem/ActionWorkLedger.cs b/SGGL/Model/APIItem/ActionWorkLedger.cs index d54abd04..7501f62c 100644 --- a/SGGL/Model/APIItem/ActionWorkLedger.cs +++ b/SGGL/Model/APIItem/ActionWorkLedger.cs @@ -40,5 +40,23 @@ namespace Model get; set; } + + public int? KeyWorkNum + { + get; + set; + } + + public int? KeyWorkOKNum + { + get; + set; + } + + public string KeyWorkOKRate + { + get; + set; + } } } diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 68ebc382..74576549 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -120179,6 +120179,12 @@ namespace Model private string _HandleMan; + private System.Nullable _KeyWorkNum; + + private System.Nullable _KeyWorkOKNum; + + private string _KeyWorkOKRate; + private EntityRef _Base_Unit; private EntitySet _Information_ActionWorkLedgerItem; @@ -120205,6 +120211,12 @@ namespace Model partial void OnHandleStateChanged(); partial void OnHandleManChanging(string value); partial void OnHandleManChanged(); + partial void OnKeyWorkNumChanging(System.Nullable value); + partial void OnKeyWorkNumChanged(); + partial void OnKeyWorkOKNumChanging(System.Nullable value); + partial void OnKeyWorkOKNumChanged(); + partial void OnKeyWorkOKRateChanging(string value); + partial void OnKeyWorkOKRateChanged(); #endregion public Information_ActionWorkLedger() @@ -120398,6 +120410,66 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_KeyWorkNum", DbType="Int")] + public System.Nullable KeyWorkNum + { + get + { + return this._KeyWorkNum; + } + set + { + if ((this._KeyWorkNum != value)) + { + this.OnKeyWorkNumChanging(value); + this.SendPropertyChanging(); + this._KeyWorkNum = value; + this.SendPropertyChanged("KeyWorkNum"); + this.OnKeyWorkNumChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_KeyWorkOKNum", DbType="Int")] + public System.Nullable KeyWorkOKNum + { + get + { + return this._KeyWorkOKNum; + } + set + { + if ((this._KeyWorkOKNum != value)) + { + this.OnKeyWorkOKNumChanging(value); + this.SendPropertyChanging(); + this._KeyWorkOKNum = value; + this.SendPropertyChanged("KeyWorkOKNum"); + this.OnKeyWorkOKNumChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_KeyWorkOKRate", DbType="NVarChar(20)")] + public string KeyWorkOKRate + { + get + { + return this._KeyWorkOKRate; + } + set + { + if ((this._KeyWorkOKRate != value)) + { + this.OnKeyWorkOKRateChanging(value); + this.SendPropertyChanging(); + this._KeyWorkOKRate = value; + this.SendPropertyChanged("KeyWorkOKRate"); + this.OnKeyWorkOKRateChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Information_ActionWorkLedger_Base_Unit", Storage="_Base_Unit", ThisKey="UnitId", OtherKey="UnitId", IsForeignKey=true)] public Base_Unit Base_Unit { @@ -296990,6 +297062,12 @@ namespace Model private string _HandleState; + private System.Nullable _KeyWorkNum; + + private System.Nullable _KeyWorkOKNum; + + private string _KeyWorkOKRate; + private string _Quarters; private string _UnitName; @@ -297114,6 +297192,54 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_KeyWorkNum", DbType="Int")] + public System.Nullable KeyWorkNum + { + get + { + return this._KeyWorkNum; + } + set + { + if ((this._KeyWorkNum != value)) + { + this._KeyWorkNum = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_KeyWorkOKNum", DbType="Int")] + public System.Nullable KeyWorkOKNum + { + get + { + return this._KeyWorkOKNum; + } + set + { + if ((this._KeyWorkOKNum != value)) + { + this._KeyWorkOKNum = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_KeyWorkOKRate", DbType="NVarChar(20)")] + public string KeyWorkOKRate + { + get + { + return this._KeyWorkOKRate; + } + set + { + if ((this._KeyWorkOKRate != value)) + { + this._KeyWorkOKRate = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Quarters", DbType="NVarChar(200) NOT NULL", CanBeNull=false)] public string Quarters {