20230704 百万工时自动取值时间范围修改

This commit is contained in:
杨红卫 2023-07-04 14:51:40 +08:00
parent 01616cc059
commit ba56bd28ff
1 changed files with 17 additions and 13 deletions

View File

@ -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();