From ba56bd28ffba2788772409d6b1ce9e867e0f312a Mon Sep 17 00:00:00 2001 From: yhw0507 Date: Tue, 4 Jul 2023 14:51:40 +0800 Subject: [PATCH] =?UTF-8?q?20230704=20=E7=99=BE=E4=B8=87=E5=B7=A5=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8F=96=E5=80=BC=E6=97=B6=E9=97=B4=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MillionsMonthlyReportSave.aspx.cs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs b/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs index 2dcd2a7f..32ca1f91 100644 --- a/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs +++ b/SGGL/FineUIPro.Web/ZHGL/Information/MillionsMonthlyReportSave.aspx.cs @@ -734,26 +734,30 @@ 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.Value.Year.ToString() == year && y.CostManageDate.Value.Month.ToString() == months + 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.Value.Year.ToString() == year && x.TrainStartDate.Value.Month.ToString() == months).Count().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.Value.Year.ToString() == year && x.RegisterDate.Value.Month.ToString() == months && x.States == Const.State_3); + 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.Value.Year.ToString() == year && x.CheckedDate.Value.Month.ToString() == months && x.States == Const.State_5); + 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) { @@ -764,7 +768,7 @@ namespace FineUIPro.Web.ZHGL.Information 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.Value.Year.ToString() == year && y.RecordTime.Value.Month.ToString() == months + where y.States == Const.State_1 && y.RecordTime >= starTime && y.RecordTime <= endTime select x; if (getLarger.Count() > 0) { @@ -774,36 +778,36 @@ namespace FineUIPro.Web.ZHGL.Information 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.Value.Year.ToString() == year && x.StartDate.Value.Month.ToString() == months + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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.Value.Year.ToString() == year && x.ApplyDate.Value.Month.ToString() == months && (x.States == Const.State_2 || x.States == Const.State_3)).Count(); + 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();