2023-11-11

This commit is contained in:
2023-11-11 16:02:42 +08:00
parent b2ffd4b8d0
commit 48dd589a7f
66 changed files with 2334 additions and 1232 deletions
@@ -156,47 +156,49 @@ namespace BLL
/// <param name="newtable"></param>
public static void AddProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
{
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
TrainPersonNum = newtable.TrainPersonNum,
TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum,
UseNum = newtable.UseNum,
OKNum = newtable.OKNum,
CompanyPersonNum = newtable.CompanyPersonNum,
BranchPersonNum = newtable.BranchPersonNum,
ProjectPersonNum = newtable.ProjectPersonNum,
ProblemNum = newtable.ProblemNum,
ProblemCompletedNum = newtable.ProblemCompletedNum,
ProblemNotCompletedNum = newtable.ProblemNotCompletedNum,
SNum = newtable.SNum,
ANum = newtable.ANum,
BNum = newtable.BNum,
CNum = newtable.CNum,
KeyProcessNum = newtable.KeyProcessNum,
KeyProcessOKNum = newtable.KeyProcessOKNum,
SpecialProcessNum = newtable.SpecialProcessNum,
SpecialProcessOKNum = newtable.SpecialProcessOKNum,
ConcealedWorksNum = newtable.ConcealedWorksNum,
ConcealedWorksOKNum = newtable.ConcealedWorksOKNum,
UnitProjectOnesNum = newtable.UnitProjectOnesNum,
UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum,
MaterialInRecheckNum = newtable.MaterialInRecheckNum,
MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum,
SingleProjectNum = newtable.SingleProjectNum,
UnitProjectNum = newtable.UnitProjectNum,
SubProjectNum = newtable.SubProjectNum,
SubdivisionalWorksNum = newtable.SubdivisionalWorksNum,
InspectionLotNum = newtable.InspectionLotNum,
};
db.Project_CQMSData_CQMS.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
TrainPersonNum = newtable.TrainPersonNum,
TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum,
UseNum = newtable.UseNum,
OKNum = newtable.OKNum,
CompanyPersonNum = newtable.CompanyPersonNum,
BranchPersonNum = newtable.BranchPersonNum,
ProjectPersonNum = newtable.ProjectPersonNum,
ProblemNum = newtable.ProblemNum,
ProblemCompletedNum = newtable.ProblemCompletedNum,
ProblemNotCompletedNum = newtable.ProblemNotCompletedNum,
SNum = newtable.SNum,
ANum = newtable.ANum,
BNum = newtable.BNum,
CNum = newtable.CNum,
KeyProcessNum = newtable.KeyProcessNum,
KeyProcessOKNum = newtable.KeyProcessOKNum,
SpecialProcessNum = newtable.SpecialProcessNum,
SpecialProcessOKNum = newtable.SpecialProcessOKNum,
ConcealedWorksNum = newtable.ConcealedWorksNum,
ConcealedWorksOKNum = newtable.ConcealedWorksOKNum,
UnitProjectOnesNum = newtable.UnitProjectOnesNum,
UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum,
MaterialInRecheckNum = newtable.MaterialInRecheckNum,
MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum,
SingleProjectNum = newtable.SingleProjectNum,
UnitProjectNum = newtable.UnitProjectNum,
SubProjectNum = newtable.SubProjectNum,
SubdivisionalWorksNum = newtable.SubdivisionalWorksNum,
InspectionLotNum = newtable.InspectionLotNum,
};
db.Project_CQMSData_CQMS.InsertOnSubmit(table);
db.SubmitChanges();
}
}
/// <summary>
/// 修改
@@ -204,48 +206,49 @@ namespace BLL
/// <param name="newtable"></param>
public static void UpdateProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
{
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.TrainPersonNum = newtable.TrainPersonNum;
table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum;
table.UseNum = newtable.UseNum;
table.OKNum = newtable.OKNum;
table.CompanyPersonNum = newtable.CompanyPersonNum;
table.BranchPersonNum = newtable.BranchPersonNum;
table.ProjectPersonNum = newtable.ProjectPersonNum;
table.ProblemNum = newtable.ProblemNum;
table.ProblemCompletedNum = newtable.ProblemCompletedNum;
table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum;
table.SNum = newtable.SNum;
table.ANum = newtable.ANum;
table.BNum = newtable.BNum;
table.CNum = newtable.CNum;
table.KeyProcessNum = newtable.KeyProcessNum;
table.KeyProcessOKNum = newtable.KeyProcessOKNum;
table.SpecialProcessNum = newtable.SpecialProcessNum;
table.SpecialProcessOKNum = newtable.SpecialProcessOKNum;
table.ConcealedWorksNum = newtable.ConcealedWorksNum;
table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum;
table.UnitProjectOnesNum = newtable.UnitProjectOnesNum;
table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum;
table.MaterialInRecheckNum = newtable.MaterialInRecheckNum;
table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum;
table.SingleProjectNum = newtable.SingleProjectNum;
table.UnitProjectNum = newtable.UnitProjectNum;
table.SubProjectNum = newtable.SubProjectNum;
table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum;
table.InspectionLotNum = newtable.InspectionLotNum;
db.SubmitChanges();
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.TrainPersonNum = newtable.TrainPersonNum;
table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum;
table.UseNum = newtable.UseNum;
table.OKNum = newtable.OKNum;
table.CompanyPersonNum = newtable.CompanyPersonNum;
table.BranchPersonNum = newtable.BranchPersonNum;
table.ProjectPersonNum = newtable.ProjectPersonNum;
table.ProblemNum = newtable.ProblemNum;
table.ProblemCompletedNum = newtable.ProblemCompletedNum;
table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum;
table.SNum = newtable.SNum;
table.ANum = newtable.ANum;
table.BNum = newtable.BNum;
table.CNum = newtable.CNum;
table.KeyProcessNum = newtable.KeyProcessNum;
table.KeyProcessOKNum = newtable.KeyProcessOKNum;
table.SpecialProcessNum = newtable.SpecialProcessNum;
table.SpecialProcessOKNum = newtable.SpecialProcessOKNum;
table.ConcealedWorksNum = newtable.ConcealedWorksNum;
table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum;
table.UnitProjectOnesNum = newtable.UnitProjectOnesNum;
table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum;
table.MaterialInRecheckNum = newtable.MaterialInRecheckNum;
table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum;
table.SingleProjectNum = newtable.SingleProjectNum;
table.UnitProjectNum = newtable.UnitProjectNum;
table.SubProjectNum = newtable.SubProjectNum;
table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum;
table.InspectionLotNum = newtable.InspectionLotNum;
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据id删除
@@ -253,14 +256,16 @@ namespace BLL
/// <param name="Id"></param>
public static void DeleteProject_CQMSData_CQMSById(string Id)
{
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_CQMSData_CQMS.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_CQMSData_CQMS.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据projectid判断当天项目是否已统计数据
@@ -412,7 +417,7 @@ namespace BLL
public static int GetTrainPersonNum(string projectid)
{
var result = (from x in Funs.DB.Comprehensive_InspectionPerson
where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate>Const.DtmarkTime
where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -422,7 +427,7 @@ namespace BLL
/// <returns></returns>
public static int GetTechnicalDisclosePersonNum(string projectid)
{
var result = (from x in Funs.DB.Comprehensive_DesignDetails
var result = (from x in Funs.DB.Comprehensive_DesignDetails
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.JoinPersonNum).ToList().Sum(x => x.Value);
var q = Funs.GetNewIntOrZero(result.ToString());
@@ -488,7 +493,7 @@ namespace BLL
/// <returns></returns>
public static int GetProblemNum(string projectid)
{
int result = (from x in Funs.DB.Check_CheckControl
int result = (from x in Funs.DB.Check_CheckControl
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime
select x).Count();
return result;
@@ -567,7 +572,7 @@ namespace BLL
{
int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId
where y.ProjectId == projectid && y.CheckAcceptType == "1" && x.CreateDate> Const.DtmarkTime
where y.ProjectId == projectid && y.CheckAcceptType == "1" && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -580,7 +585,7 @@ namespace BLL
int result = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
join y in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals y.BreakdownProjectId
join z in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals z.InspectionId
where y.ProjectId == projectid && y.CheckAcceptType == "1" && z.IsOnceQualified == true && x.CreateDate>Const.DtmarkTime
where y.ProjectId == projectid && y.CheckAcceptType == "1" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -691,7 +696,7 @@ namespace BLL
public static int GetSingleProjectNum(string projectid)
{
int result = (from x in Funs.DB.Project_Installation
where x.ProjectId == projectid && x.SuperInstallationId == "0"
where x.ProjectId == projectid && x.SuperInstallationId == "0"
select x).Count();
return result;
}
@@ -735,7 +740,7 @@ namespace BLL
public static int GetInspectionLotNum(string projectid)
{
int result = (from x in Funs.DB.WBS_BreakdownProject
where x.ProjectId == projectid && x.IsSelected == true
where x.ProjectId == projectid && x.IsSelected == true
select x).Count();
return result;
}
@@ -50,17 +50,17 @@ namespace BLL
if (count == 0) return null;
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.Id,
x.ProjectId,
x.UnitId,
x.CollCropCode,
x.UnitName,
x.ReportDate,
x.DefectName,
x.DefectNum
};
select new
{
x.Id,
x.ProjectId,
x.UnitId,
x.CollCropCode,
x.UnitName,
x.ReportDate,
x.DefectName,
x.DefectNum
};
}
#endregion
@@ -80,80 +80,99 @@ namespace BLL
string projectid)
{
var q = from x in db.Project_HJGLData_Defect
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
select x;
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
select x;
return q.ToList();
}
public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
{
var table = new Project_HJGLData_Defect
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
{
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
}
public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
{
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.DefectName = newtable.DefectName;
table.DefectNum = newtable.DefectNum;
db.SubmitChanges();
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.DefectName = newtable.DefectName;
table.DefectNum = newtable.DefectNum;
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_DefectById(string Id)
{
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_Defect.DeleteOnSubmit(table);
db.SubmitChanges();
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_HJGLData_Defect.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate)
{
var table = db.Project_HJGLData_Defect.Where(x =>
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
var table = db.Project_HJGLData_Defect.Where(x =>
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid)
{
var table = db.Project_HJGLData_Defect.Where(x =>
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
var table = db.Project_HJGLData_Defect.Where(x =>
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
if (table != null)
{
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
@@ -165,9 +184,9 @@ namespace BLL
{
var result = false;
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid && x.DefectName == type
select x).ToList();
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid && x.DefectName == type
select x).ToList();
if (q != null && q.Count > 0) result = true;
return result;
}
@@ -180,24 +199,24 @@ namespace BLL
public static Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type)
{
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid && x.DefectName == type
select x).FirstOrDefault();
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid && x.DefectName == type
select x).FirstOrDefault();
return q;
}
public static List<HJGLDataDefectItems> getTodayProject_HJGLData_Defect()
{
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
group x by x.DefectName
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
group x by x.DefectName
into g
select new HJGLDataDefectItems
{
Id = SQLHelper.GetNewID(),
DefectName = g.Key,
DefectNum = g.Sum(p => p.DefectNum)
}).ToList();
select new HJGLDataDefectItems
{
Id = SQLHelper.GetNewID(),
DefectName = g.Key,
DefectNum = g.Sum(p => p.DefectNum)
}).ToList();
return q;
}
@@ -215,19 +234,19 @@ namespace BLL
var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
var data = (from x in db.CH_CheckItem
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where projectids.Contains(y.ProjectId)
group x by new { x.Defects_Definition, y.ProjectId }
where projectids.Contains(y.ProjectId)
group x by new { x.Defects_Definition, y.ProjectId }
into g
select new
{
UnitId = thisUnitId,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ProjectId = g.Key.ProjectId,
ReportDate = DateTime.Now.Date,
DefectName = g.Key.Defects_Definition,
DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition)
}).ToList();
select new
{
UnitId = thisUnitId,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ProjectId = g.Key.ProjectId,
ReportDate = DateTime.Now.Date,
DefectName = g.Key.Defects_Definition,
DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition)
}).ToList();
DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有
var projectHjglDataDefect = new List<Project_HJGLData_Defect>();
foreach (var item in data
@@ -261,9 +280,9 @@ namespace BLL
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
var base_Unit = UnitService.GetUnitByUnitId(thisUnitId);
var list = from x in db.CH_CheckItem
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x;
join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x;
var types = (from x in list select x.Defects_Definition).Distinct().ToList();
foreach (var t in types)
if (!string.IsNullOrEmpty(t))
@@ -105,64 +105,70 @@ namespace BLL
return db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
}
public static List<Model.Project_HJGLData_HJGL> GetProject_HJGLData_HJGLByProjectid (string Projectid)
public static List<Model.Project_HJGLData_HJGL> GetProject_HJGLData_HJGLByProjectid(string Projectid)
{
var q =( from x in db.Project_HJGLData_HJGL
where x.ProjectId == Projectid
select x).ToList();
var q = (from x in db.Project_HJGLData_HJGL
where x.ProjectId == Projectid
select x).ToList();
return q;
}
public static void AddProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable)
{
Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
WelderNum = newtable.WelderNum,
TotalDineNum = newtable.TotalDineNum,
CompleteDineNum = newtable.CompleteDineNum,
TotalFilmNum = newtable.TotalFilmNum,
OKFilmNum = newtable.OKFilmNum,
};
db.Project_HJGLData_HJGL.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
WelderNum = newtable.WelderNum,
TotalDineNum = newtable.TotalDineNum,
CompleteDineNum = newtable.CompleteDineNum,
TotalFilmNum = newtable.TotalFilmNum,
OKFilmNum = newtable.OKFilmNum,
};
db.Project_HJGLData_HJGL.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable)
{
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.WelderNum = newtable.WelderNum;
table.TotalDineNum = newtable.TotalDineNum;
table.CompleteDineNum = newtable.CompleteDineNum;
table.TotalFilmNum = newtable.TotalFilmNum;
table.OKFilmNum = newtable.OKFilmNum;
db.SubmitChanges();
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.WelderNum = newtable.WelderNum;
table.TotalDineNum = newtable.TotalDineNum;
table.CompleteDineNum = newtable.CompleteDineNum;
table.TotalFilmNum = newtable.TotalFilmNum;
table.OKFilmNum = newtable.OKFilmNum;
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_HJGLById(string Id)
{
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_HJGL.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_HJGLData_HJGL.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断该项目的该日期是否统计数据
@@ -226,7 +232,7 @@ namespace BLL
/// </summary>
/// <param name="projectid">项目id</param>
/// <param name="hJGLDateType">数据类型</param>
public static void StatisticalData(string projectid,HJGLDateType hJGLDateType)
public static void StatisticalData(string projectid, HJGLDateType hJGLDateType)
{
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
@@ -242,7 +248,7 @@ namespace BLL
}
else
{
table.Id = SQLHelper.GetNewID();
table.Id = SQLHelper.GetNewID();
}
table.UnitId = thisUnitId;
table.CollCropCode = base_Unit.CollCropCode;
@@ -250,7 +256,7 @@ namespace BLL
table.ProjectId = projectid;
table.ReportDate = DateTime.Now.Date;
if (hJGLDateType== HJGLDateType.TotalNumberOfWelders|| hJGLDateType == HJGLDateType.All)
if (hJGLDateType == HJGLDateType.TotalNumberOfWelders || hJGLDateType == HJGLDateType.All)
{
table.WelderNum = GetWelderNum(projectid);
@@ -270,9 +276,9 @@ namespace BLL
}
if (hJGLDateType == HJGLDateType.DefectAnalysis || hJGLDateType == HJGLDateType.All)
{
// Project_HJGLData_DefectService.StatisticalData(projectid);
// Project_HJGLData_DefectService.StatisticalData(projectid);
}
if (IsReportByToday(projectid))
{
UpdateProject_HJGLData_HJGL(table);
@@ -314,7 +320,7 @@ namespace BLL
{
int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo
where x.ProjectId == projectid
select x.JOT_DoneDin ).ToList().Sum());
select x.JOT_DoneDin).ToList().Sum());
return result;
}
/// <summary>
@@ -324,9 +330,9 @@ namespace BLL
public static int GetTotalFilmNum(string projectid)
{
int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem
join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x.CHT_TotalFilm ).ToList().Sum());
join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x.CHT_TotalFilm).ToList().Sum());
return result;
}
/// <summary>
@@ -336,9 +342,9 @@ namespace BLL
public static int GetOKFilmNum(string projectid)
{
int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem
join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x.CHT_PassFilm).ToList().Sum());
join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x.CHT_PassFilm).ToList().Sum());
return result;
}
@@ -226,8 +226,8 @@ namespace BLL
using (var db = new SGGLDB(Funs.ConnString))
{
var q = (from x in db.Project_HSSEData_HSSE
where x.ProjectId == Projectid
select x).ToList();
where x.ProjectId == Projectid
select x).ToList();
return q;
}
}
@@ -330,9 +330,9 @@ namespace BLL
{
var result = false;
var q = (from x in Funs.DB.Project_HSSEData_HSSE
where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date &&
x.ProjectId == projectid
select x).ToList();
where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date &&
x.ProjectId == projectid
select x).ToList();
if (q != null && q.Count > 0) result = true;
return result;
}
@@ -345,9 +345,9 @@ namespace BLL
{
var result = false;
var q = (from x in Funs.DB.Project_HSSEData_HSSE
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid
select x).ToList();
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid
select x).ToList();
if (q != null && q.Count > 0) result = true;
return result;
}
@@ -360,9 +360,9 @@ namespace BLL
public static Project_HSSEData_HSSE getProject_HSSEData_HSSEByDate(string projectid)
{
var q = (from x in Funs.DB.Project_HSSEData_HSSE
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid
select x).FirstOrDefault();
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid
select x).FirstOrDefault();
return q;
}
@@ -526,10 +526,10 @@ namespace BLL
DateTime date = DateTime.Now;
Model.SGGLDB db1 = Funs.DB;
var list = from x in db1.HSSE_Hazard_HazardRegister
select x;
select x;
var types = (from x in db1.HSSE_Hazard_HazardRegisterTypes
join y in list on x.RegisterTypesId equals y.RegisterTypesId
select new { x.RegisterTypesId, x.RegisterTypesName }).Distinct().ToList();
join y in list on x.RegisterTypesId equals y.RegisterTypesId
select new { x.RegisterTypesId, x.RegisterTypesName }).Distinct().ToList();
foreach (var type in types)
{
Model.Project_HSSEData_HiddenDangerDetail table1 = new Model.Project_HSSEData_HiddenDangerDetail
@@ -541,7 +541,7 @@ namespace BLL
ReportDate = DateTime.Now.Date,
TypeName = type.RegisterTypesName,
TotalNum = list.Count(x => x.RegisterTypesId == type.RegisterTypesId),
NeedRectifyNum = list.Count(x => x.RegisterTypesId == type.RegisterTypesId && (x.States == "1" )),
NeedRectifyNum = list.Count(x => x.RegisterTypesId == type.RegisterTypesId && (x.States == "1")),
};
if (Project_HSSEData_HiddenDangerDetailService.IsReportByToday(projectid, type.RegisterTypesName))
{
@@ -582,8 +582,8 @@ namespace BLL
public static int GetBeUnderConstructionNum(string projectid)
{
var result = (from x in Funs.DB.Base_Project
where x.ProjectState == "1" && x.ProjectId == projectid
select x).Count();
where x.ProjectState == "1" && x.ProjectId == projectid
select x).Count();
return result;
}
@@ -594,8 +594,8 @@ namespace BLL
public static int GetShutdownNum(string projectid)
{
var result = (from x in Funs.DB.Base_Project
where x.ProjectState == "2" && x.ProjectId == projectid
select x).Count();
where x.ProjectState == "2" && x.ProjectId == projectid
select x).Count();
return result;
}
@@ -606,8 +606,8 @@ namespace BLL
public static int GetJoinConstructionPersonNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == projectid && x.IsUsed == 1
select x).Count();
where x.ProjectId == projectid && x.IsUsed == 1
select x).Count();
return result;
}
@@ -618,8 +618,8 @@ namespace BLL
public static int GetMajorProjectsUnderConstructionNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "2" && x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "2" && x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -630,9 +630,9 @@ namespace BLL
public static int GetTotalWorkingHour(string projectid)
{
var result = (from x in Funs.DB.SitePerson_DayReportDetail
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
select x.PersonWorkTime ?? 0).ToList().Sum();
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
select x.PersonWorkTime ?? 0).ToList().Sum();
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
return q;
@@ -646,12 +646,12 @@ namespace BLL
{
var result =
(from x in Funs.DB.Accident_AccidentHandle
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkHoursLoss)
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkHoursLoss)
.ToList().Sum(x => x.Value)
+ (from x in Funs.DB.Accident_AccidentReport
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkingHoursLoss)
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkingHoursLoss)
.ToList().Sum(x => x.Value);
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
@@ -665,17 +665,17 @@ namespace BLL
public static int GetSafeWorkingHour(string projectid)
{
var result1 = (from x in Funs.DB.SitePerson_DayReportDetail
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
select x.PersonWorkTime ?? 0).ToList().Sum();
join y in Funs.DB.SitePerson_DayReport on x.DayReportId equals y.DayReportId
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
select x.PersonWorkTime ?? 0).ToList().Sum();
var result2 =
(from x in Funs.DB.Accident_AccidentHandle
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkHoursLoss)
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkHoursLoss)
.ToList().Sum(x => x.Value)
+ (from x in Funs.DB.Accident_AccidentReport
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkingHoursLoss)
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.WorkingHoursLoss)
.ToList().Sum(x => x.Value);
var result = result1 - result2;
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
@@ -690,9 +690,9 @@ namespace BLL
public static int GetSafeTrainNum(string projectid)
{
var result = (from x in Funs.DB.EduTrain_TrainRecord
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
where x.ProjectId == projectid && y.TrainType == "1" && x.TrainStartDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
where x.ProjectId == projectid && y.TrainType == "1" && x.TrainStartDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -703,9 +703,9 @@ namespace BLL
public static int GetSpecialTrainNum(string projectid)
{
var result = (from x in Funs.DB.EduTrain_TrainRecord
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
where x.ProjectId == projectid && y.TrainType == "2" && x.TrainStartDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
where x.ProjectId == projectid && y.TrainType == "2" && x.TrainStartDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -716,9 +716,9 @@ namespace BLL
public static int GetSpecialOperationTrainNum(string projectid)
{
var result = (from x in Funs.DB.EduTrain_TrainRecord
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
where x.ProjectId == projectid && y.TrainType == "3" && x.TrainStartDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_TrainType on x.TrainTypeId equals y.TrainTypeId
where x.ProjectId == projectid && y.TrainType == "3" && x.TrainStartDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -799,8 +799,8 @@ namespace BLL
public static int GetProjectInspectorGeneralNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.IsUsed == 1
select x).Count();
where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.IsUsed == 1
select x).Count();
return result;
}
@@ -811,9 +811,9 @@ namespace BLL
public static int GetProjectFullTimeNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.ProjectId == projectid && y.IsHsse == true && x.IsUsed == 1
select x).Count();
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.ProjectId == projectid && y.IsHsse == true && x.IsUsed == 1
select x).Count();
return result;
}
@@ -824,8 +824,8 @@ namespace BLL
public static int GetProjectSafetyMonitorNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == projectid && x.IsSafetyMonitoring == true && x.IsUsed == 1
select x).Count();
where x.ProjectId == projectid && x.IsSafetyMonitoring == true && x.IsUsed == 1
select x).Count();
return result;
}
@@ -836,9 +836,9 @@ namespace BLL
public static int GetSafetyInjectionEngineer(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
where x.ProjectId == projectid && y.IsRegisterHSSE == true && x.IsUsed == 1
select x).Count();
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
where x.ProjectId == projectid && y.IsRegisterHSSE == true && x.IsUsed == 1
select x).Count();
return result;
}
@@ -849,9 +849,10 @@ namespace BLL
public static int GetCertificateANum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
where x.ProjectId == projectid && y.CertificateType == "A" && x.IsUsed == 1
select x).Count();
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
where x.ProjectId == projectid && z.CertificateType == "A" && x.IsUsed == 1
select x).Count();
return result;
}
@@ -862,9 +863,10 @@ namespace BLL
public static int GetCertificateBNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
where x.ProjectId == projectid && y.CertificateType == "B" && x.IsUsed == 1
select x).Count();
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
where x.ProjectId == projectid && z.CertificateType == "B" && x.IsUsed == 1
select x).Count();
return result;
}
@@ -875,9 +877,10 @@ namespace BLL
public static int GetCertificateCNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_Certificate on x.CertificateId equals y.CertificateId
where x.ProjectId == projectid && y.CertificateType == "C" && x.IsUsed == 1
select x).Count();
join y in Funs.DB.QualityAudit_PersonQuality on x.PersonId equals y.PersonId
join z in Funs.DB.Base_Certificate on y.CertificateId equals z.CertificateId
where x.ProjectId == projectid && z.CertificateType == "C" && x.IsUsed == 1
select x).Count();
return result;
}
@@ -908,8 +911,8 @@ namespace BLL
public static int GetProjectSafetyLeadingGroupMeetingNum(string projectid)
{
var result = (from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x)
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x)
.Count();
return result;
}
@@ -921,11 +924,11 @@ namespace BLL
public static int GetProjectSafetyMeetingNum(string projectid)
{
var result = (from x in Funs.DB.Meeting_WeekMeeting
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count()
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count()
+ (from x in Funs.DB.Meeting_MonthMeeting
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -966,8 +969,8 @@ namespace BLL
public static int GetProjectLeadShiftCheckNum(string projectid)
{
var result = (from x in Funs.DB.Check_ProjectLeaderCheck
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -978,8 +981,8 @@ namespace BLL
public static int GetProjectSpecialCheckNum(string projectid)
{
var result = (from x in Funs.DB.Check_CheckSpecial
where x.ProjectId == projectid && x.CheckTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -990,8 +993,8 @@ namespace BLL
public static int GetProjectMajorCheckNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.CheckTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1002,9 +1005,9 @@ namespace BLL
public static int GetNearMissNum(string projectid)
{
var result = (from x in Funs.DB.Accident_AccidentPersonRecord
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where x.ProjectId == projectid && x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where x.ProjectId == projectid && x.IsAttempt == "1" && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1015,9 +1018,9 @@ namespace BLL
public static int GetRecordableEventNum(string projectid)
{
var result = (from x in Funs.DB.Accident_AccidentPersonRecord
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_AccidentType on x.AccidentTypeId equals y.AccidentTypeId
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1028,8 +1031,8 @@ namespace BLL
public static int GetGeneralAccidentNum(string projectid)
{
var result = (from x in Funs.DB.Accident_AccidentReport
where x.ProjectId == projectid && x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.AccidentDegree == "1" && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1040,8 +1043,8 @@ namespace BLL
public static int GetMajorAccidentNum(string projectid)
{
var result = (from x in Funs.DB.Accident_AccidentReport
where x.ProjectId == projectid && x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.AccidentDegree == "2" && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1052,8 +1055,8 @@ namespace BLL
public static int GetSeriousAccidentNum(string projectid)
{
var result = (from x in Funs.DB.Accident_AccidentReport
where x.ProjectId == projectid && x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.AccidentDegree == "3" && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1064,8 +1067,8 @@ namespace BLL
public static int GetSpecialSeriousAccidentNum(string projectid)
{
var result = (from x in Funs.DB.Accident_AccidentReport
where x.ProjectId == projectid && x.AccidentDegree == "4"
select x).Count();
where x.ProjectId == projectid && x.AccidentDegree == "4"
select x).Count();
return result;
}
@@ -1116,9 +1119,9 @@ namespace BLL
public static int GetProjectComprehensivePlanNum(string projectid)
{
var result = (from x in Funs.DB.Emergency_EmergencyList
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1129,9 +1132,9 @@ namespace BLL
public static int GetProjectSpecialPlanNum(string projectid)
{
var result = (from x in Funs.DB.Emergency_EmergencyList
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1142,10 +1145,10 @@ namespace BLL
public static int GetProjectOnSiteDisposalPlan(string projectid)
{
var result = (from x in Funs.DB.Emergency_EmergencyList
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("现场处置") &&
x.CompileDate > Const.DtmarkTime
select x).Count();
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("现场处置") &&
x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1156,8 +1159,8 @@ namespace BLL
public static int GetProjectDrillNum(string projectid)
{
var result = (from x in Funs.DB.Emergency_DrillRecordList
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1179,10 +1182,10 @@ namespace BLL
{
var result = 0;
var costs = (from x in Funs.DB.CostGoods_CostSmallDetailItem
join y in Funs.DB.CostGoods_CostSmallDetail
on x.CostSmallDetailId equals y.CostSmallDetailId
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
select x.CostMoney ?? 0).ToList().Sum();
join y in Funs.DB.CostGoods_CostSmallDetail
on x.CostSmallDetailId equals y.CostSmallDetailId
where y.ProjectId == projectid && y.CompileDate > Const.DtmarkTime
select x.CostMoney ?? 0).ToList().Sum();
result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]);
return result;
}
@@ -1194,14 +1197,14 @@ namespace BLL
public static int GetUseEquipmentNum(string projectid)
{
var result = (from x in Funs.DB.InApproveManager_EquipmentInItem
join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
where y.ProjectId == projectid && x.IsUsed == true
select x).Count() +
join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
where y.ProjectId == projectid && x.IsUsed == true
select x).Count() +
(from x in Funs.DB.InApproveManager_GeneralEquipmentInItem
join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y
.GeneralEquipmentInId
where y.ProjectId == projectid && x.IsUsed == true
select x).Count();
join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y
.GeneralEquipmentInId
where y.ProjectId == projectid && x.IsUsed == true
select x).Count();
return result;
}
@@ -1212,9 +1215,9 @@ namespace BLL
public static int GetSpecialEquipmentNum(string projectid)
{
var result = (from x in Funs.DB.InApproveManager_EquipmentInItem
join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
where y.ProjectId == projectid && x.IsUsed == true
select x).Count();
join y in Funs.DB.InApproveManager_EquipmentIn on x.EquipmentInId equals y.EquipmentInId
where y.ProjectId == projectid && x.IsUsed == true
select x).Count();
return result;
}
@@ -1225,8 +1228,8 @@ namespace BLL
public static int GetLicensesNum(string projectid)
{
var result = (from x in Funs.DB.License_LicenseManager
where x.ProjectId == projectid && x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1237,9 +1240,9 @@ namespace BLL
public static int GetLicensesCloseNum(string projectid)
{
var result = (from x in Funs.DB.License_LicenseManager
where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" &&
x.CompileDate > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" &&
x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1250,9 +1253,9 @@ namespace BLL
public static int GetGeneralClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.Risk_Level == "一般" && x.States == "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.Risk_Level == "一般" && x.States == "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1263,9 +1266,9 @@ namespace BLL
public static int GetGeneralNotClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.Risk_Level == "一般" && x.States != "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.Risk_Level == "一般" && x.States != "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1276,9 +1279,9 @@ namespace BLL
public static int GetMajorClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.Risk_Level == "重大" && x.States == "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.Risk_Level == "重大" && x.States == "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1289,9 +1292,9 @@ namespace BLL
public static int GetMajorNotClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.Risk_Level == "重大" && x.States != "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.Risk_Level == "重大" && x.States != "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1302,9 +1305,9 @@ namespace BLL
public static int GetGeneralRiskNum(string projectid)
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 2 && x.IsStart == true
select x).Count();
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 2 && x.IsStart == true
select x).Count();
return result;
}
@@ -1315,9 +1318,9 @@ namespace BLL
public static int GetLowRiskNum(string projectid)
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 1 && x.IsStart == true
select x).Count();
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 1 && x.IsStart == true
select x).Count();
return result;
}
@@ -1328,9 +1331,9 @@ namespace BLL
public static int GetMediumRiskNum(string projectid)
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 3 && x.IsStart == true
select x).Count();
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 3 && x.IsStart == true
select x).Count();
return result;
}
@@ -1341,9 +1344,9 @@ namespace BLL
public static int GetHighRiskNum(string projectid)
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true
select x).Count();
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true
select x).Count();
return result;
}
@@ -1354,9 +1357,9 @@ namespace BLL
public static int GetCompletedNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == false &&
x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == false &&
x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1367,8 +1370,8 @@ namespace BLL
public static int GetTrainPersonNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime
select x.TrainPersonNum).ToList().Sum(x => x.Value);
where x.ProjectId == projectid && x.IsSuperLargerHazard == false && x.RecordTime > Const.DtmarkTime
select x.TrainPersonNum).ToList().Sum(x => x.Value);
return result;
}
@@ -1379,9 +1382,9 @@ namespace BLL
public static int GetConstructionNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == false &&
x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == false &&
x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1392,9 +1395,9 @@ namespace BLL
public static int GetFinishedNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == false &&
x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == false &&
x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1405,9 +1408,9 @@ namespace BLL
public static int GetSuperCompletedNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == true &&
x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "1" && x.IsSuperLargerHazard == true &&
x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1419,8 +1422,8 @@ namespace BLL
{
var result =
(from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime
select x.TrainPersonNum).ToList().Sum(x => x.Value);
where x.ProjectId == projectid && x.IsSuperLargerHazard == true && x.RecordTime > Const.DtmarkTime
select x.TrainPersonNum).ToList().Sum(x => x.Value);
return result;
}
@@ -1431,9 +1434,9 @@ namespace BLL
public static int GetSuperConstructionNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == true &&
x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "2" && x.IsSuperLargerHazard == true &&
x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1444,9 +1447,9 @@ namespace BLL
public static int GetSuperFinishedNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == true &&
x.RecordTime > Const.DtmarkTime
select x).Count();
where x.ProjectId == projectid && x.States == "3" && x.IsSuperLargerHazard == true &&
x.RecordTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1483,85 +1486,85 @@ namespace BLL
if (Count == 0) return null;
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.Id,
x.ProjectId,
x.UnitId,
x.CollCropCode,
x.UnitName,
x.ReportDate,
x.BeUnderConstructionNum,
x.ShutdownNum,
x.JoinConstructionPersonNum,
x.MajorProjectsUnderConstructionNum,
x.TotalWorkingHour,
x.LostWorkingHour,
x.SafeWorkingHour,
x.SafeTrainNum,
x.SpecialTrainNum,
x.SpecialOperationTrainNum,
x.TotalEnergyConsumption,
x.IncomeComprehensiveEnergyConsumption,
x.NewWaterConsumption,
x.HeadOfficeInspectorGeneralNum,
x.HeadOfficeFullTimeNum,
x.BranchInspectorGeneralNum,
x.BranchFullTimeNum,
x.ProjectInspectorGeneralNum,
x.ProjectFullTimeNum,
x.ProjectSafetyMonitorNum,
x.SafetyInjectionEngineer,
x.CertificateANum,
x.CertificateBNum,
x.CertificateCNum,
x.SafetyCommitteeMeetingNum,
x.EnterpriseTopicsMeetingNum,
x.ProjectSafetyLeadingGroupMeetingNum,
x.ProjectSafetyMeetingNum,
x.CompanyLeadShiftCheckNum,
x.CompanyComprehensiveCheckNum,
x.CompanySpecialCheckNum,
x.ProjectLeadShiftCheckNum,
x.ProjectSpecialCheckNum,
x.ProjectMajorCheckNum,
x.NearMissNum,
x.RecordableEventNum,
x.GeneralAccidentNum,
x.MajorAccidentNum,
x.SeriousAccidentNum,
x.SpecialSeriousAccidentNum,
x.CompanyComprehensivePlanNum,
x.CompanySpecialPlanNum,
x.CompanyOnSiteDisposalPlan,
x.CompanyDrillNum,
x.ProjectComprehensivePlanNum,
x.ProjectSpecialPlanNum,
x.ProjectOnSiteDisposalPlan,
x.ProjectDrillNum,
x.CostExtract,
x.CostUse,
x.UseEquipmentNum,
x.SpecialEquipmentNum,
x.LicensesNum,
x.LicensesCloseNum,
x.GeneralClosedNum,
x.GeneralNotClosedNum,
x.MajorClosedNum,
x.MajorNotClosedNum,
x.GeneralRiskNum,
x.LowRiskNum,
x.MediumRiskNum,
x.HighRiskNum,
x.CompletedNum,
x.TrainPersonNum,
x.ConstructionNum,
x.FinishedNum,
x.SuperCompletedNum,
x.SuperTrainPersonNum,
x.SuperConstructionNum,
x.SuperFinishedNum
};
select new
{
x.Id,
x.ProjectId,
x.UnitId,
x.CollCropCode,
x.UnitName,
x.ReportDate,
x.BeUnderConstructionNum,
x.ShutdownNum,
x.JoinConstructionPersonNum,
x.MajorProjectsUnderConstructionNum,
x.TotalWorkingHour,
x.LostWorkingHour,
x.SafeWorkingHour,
x.SafeTrainNum,
x.SpecialTrainNum,
x.SpecialOperationTrainNum,
x.TotalEnergyConsumption,
x.IncomeComprehensiveEnergyConsumption,
x.NewWaterConsumption,
x.HeadOfficeInspectorGeneralNum,
x.HeadOfficeFullTimeNum,
x.BranchInspectorGeneralNum,
x.BranchFullTimeNum,
x.ProjectInspectorGeneralNum,
x.ProjectFullTimeNum,
x.ProjectSafetyMonitorNum,
x.SafetyInjectionEngineer,
x.CertificateANum,
x.CertificateBNum,
x.CertificateCNum,
x.SafetyCommitteeMeetingNum,
x.EnterpriseTopicsMeetingNum,
x.ProjectSafetyLeadingGroupMeetingNum,
x.ProjectSafetyMeetingNum,
x.CompanyLeadShiftCheckNum,
x.CompanyComprehensiveCheckNum,
x.CompanySpecialCheckNum,
x.ProjectLeadShiftCheckNum,
x.ProjectSpecialCheckNum,
x.ProjectMajorCheckNum,
x.NearMissNum,
x.RecordableEventNum,
x.GeneralAccidentNum,
x.MajorAccidentNum,
x.SeriousAccidentNum,
x.SpecialSeriousAccidentNum,
x.CompanyComprehensivePlanNum,
x.CompanySpecialPlanNum,
x.CompanyOnSiteDisposalPlan,
x.CompanyDrillNum,
x.ProjectComprehensivePlanNum,
x.ProjectSpecialPlanNum,
x.ProjectOnSiteDisposalPlan,
x.ProjectDrillNum,
x.CostExtract,
x.CostUse,
x.UseEquipmentNum,
x.SpecialEquipmentNum,
x.LicensesNum,
x.LicensesCloseNum,
x.GeneralClosedNum,
x.GeneralNotClosedNum,
x.MajorClosedNum,
x.MajorNotClosedNum,
x.GeneralRiskNum,
x.LowRiskNum,
x.MediumRiskNum,
x.HighRiskNum,
x.CompletedNum,
x.TrainPersonNum,
x.ConstructionNum,
x.FinishedNum,
x.SuperCompletedNum,
x.SuperTrainPersonNum,
x.SuperConstructionNum,
x.SuperFinishedNum
};
}
#endregion
@@ -114,9 +114,12 @@ namespace BLL
}
public static void AddBulkProject_HSSEData_HiddenDangerDetails(List<Model.Project_HSSEData_HiddenDangerDetail> newtables)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables);
db.SubmitChanges();
db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
}
public static void UpdateProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable)
{
@@ -173,7 +176,7 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 );
var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
@@ -210,14 +213,14 @@ namespace BLL
public static List<Model.HSSEDataHiddenDangerDetailItem> GetTodayModel()
{
var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
group x by x.TypeName into g
select new Model.HSSEDataHiddenDangerDetailItem
{
Id = SQLHelper.GetNewID(),
TypeName= g.Key,
NeedRectifyNum= g.Sum(p => p.NeedRectifyNum),
TotalNum= g.Sum(p => p.TotalNum)
TypeName = g.Key,
NeedRectifyNum = g.Sum(p => p.NeedRectifyNum),
TotalNum = g.Sum(p => p.TotalNum)
}).ToList();
return q;
}
@@ -233,24 +236,25 @@ namespace BLL
thisUnitId = thisUnit.UnitId;
}
var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
var list = from x in db.HSSE_Hazard_HazardRegister where projectids.Contains(x.ProjectId)
select x;
var list = from x in db.HSSE_Hazard_HazardRegister
where projectids.Contains(x.ProjectId)
select x;
var data = (from x in list
join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId
group x by new
{ x.ProjectId, x.RegisterTypesId ,y.RegisterTypesName}
join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId
group x by new
{ x.ProjectId, x.RegisterTypesId, y.RegisterTypesName }
into g
select new
{
UnitId = thisUnitId,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ProjectId= g.Key.ProjectId,
ReportDate = DateTime.Now.Date,
TypeName=g.Key.RegisterTypesName,
TotalNum = g.Count(),
NeedRectifyNum = g.Count(x => x.States == "1"),
}).ToList();
select new
{
UnitId = thisUnitId,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ProjectId = g.Key.ProjectId,
ReportDate = DateTime.Now.Date,
TypeName = g.Key.RegisterTypesName,
TotalNum = g.Count(),
NeedRectifyNum = g.Count(x => x.States == "1"),
}).ToList();
DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime.Now.Date);
var projectHsseDataHiddenDangerDetails = new List<Project_HSSEData_HiddenDangerDetail>();
foreach (var item in data)
@@ -57,7 +57,7 @@ namespace BLL
public static int count
{
get;
set;
set;
}
public static List<Model.Project_SYHSEData_SYHSE> GetProject_SYHSEData_SYHSEByModle(Model.Project_SYHSEData_SYHSE table)
{
@@ -67,7 +67,7 @@ namespace BLL
(string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName))
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName))
select x
;
@@ -81,13 +81,13 @@ namespace BLL
/// <returns></returns>
public static IEnumerable getListData(Model.Project_SYHSEData_SYHSE table, Grid Grid1)
{
var q = GetProject_SYHSEData_SYHSEByModle(table);
var q = GetProject_SYHSEData_SYHSEByModle(table);
count = q.Count();
if (count == 0)
{
return null;
}
//q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
//q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
@@ -142,113 +142,118 @@ namespace BLL
}
public static void AddProject_SYHSEData_SYHSE(Model.Project_SYHSEData_SYHSE newtable)
{
Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
GeneralRiskNum = newtable.GeneralRiskNum,
LowRiskNum = newtable.LowRiskNum,
MediumRiskNum = newtable.MediumRiskNum,
HighRiskNum = newtable.HighRiskNum,
GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum,
ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum,
DesignQuantity = newtable.DesignQuantity,
RunningCapacity = newtable.RunningCapacity,
InterlockSettingValue = newtable.InterlockSettingValue,
VideoSurveillanceNum = newtable.VideoSurveillanceNum,
TotalWorkinghours = newtable.TotalWorkinghours,
SafeWorkinghours = newtable.SafeWorkinghours,
LostWorkinghours = newtable.LostWorkinghours,
TotalEnergyConsumption = newtable.TotalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
NewWaterConsumption = newtable.NewWaterConsumption,
GeneralClosedNum = newtable.GeneralClosedNum,
GeneralNotClosedNum = newtable.GeneralNotClosedNum,
MajorClosedNum = newtable.MajorClosedNum,
MajorNotClosedNum = newtable.MajorNotClosedNum,
HotWorkPermitNum = newtable.HotWorkPermitNum,
HotWorkClosedNum = newtable.HotWorkClosedNum,
HighPermitNum = newtable.HighPermitNum,
HighClosedNum = newtable.HighClosedNum,
TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum,
TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum,
BlindPlatePermitNum = newtable.BlindPlatePermitNum,
BlindPlateClosedNum = newtable.BlindPlateClosedNum,
GroundbreakingPermitNum = newtable.GroundbreakingPermitNum,
GroundbreakingClosedNum = newtable.GroundbreakingClosedNum,
OpenCircuitPermitNum = newtable.OpenCircuitPermitNum,
OpenCircuitClosedNum = newtable.OpenCircuitClosedNum,
HoistingPermitNum = newtable.HoistingPermitNum,
HoistingClosedNum = newtable.HoistingClosedNum,
};
db.Project_SYHSEData_SYHSE.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
GeneralRiskNum = newtable.GeneralRiskNum,
LowRiskNum = newtable.LowRiskNum,
MediumRiskNum = newtable.MediumRiskNum,
HighRiskNum = newtable.HighRiskNum,
GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum,
ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum,
DesignQuantity = newtable.DesignQuantity,
RunningCapacity = newtable.RunningCapacity,
InterlockSettingValue = newtable.InterlockSettingValue,
VideoSurveillanceNum = newtable.VideoSurveillanceNum,
TotalWorkinghours = newtable.TotalWorkinghours,
SafeWorkinghours = newtable.SafeWorkinghours,
LostWorkinghours = newtable.LostWorkinghours,
TotalEnergyConsumption = newtable.TotalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
NewWaterConsumption = newtable.NewWaterConsumption,
GeneralClosedNum = newtable.GeneralClosedNum,
GeneralNotClosedNum = newtable.GeneralNotClosedNum,
MajorClosedNum = newtable.MajorClosedNum,
MajorNotClosedNum = newtable.MajorNotClosedNum,
HotWorkPermitNum = newtable.HotWorkPermitNum,
HotWorkClosedNum = newtable.HotWorkClosedNum,
HighPermitNum = newtable.HighPermitNum,
HighClosedNum = newtable.HighClosedNum,
TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum,
TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum,
BlindPlatePermitNum = newtable.BlindPlatePermitNum,
BlindPlateClosedNum = newtable.BlindPlateClosedNum,
GroundbreakingPermitNum = newtable.GroundbreakingPermitNum,
GroundbreakingClosedNum = newtable.GroundbreakingClosedNum,
OpenCircuitPermitNum = newtable.OpenCircuitPermitNum,
OpenCircuitClosedNum = newtable.OpenCircuitClosedNum,
HoistingPermitNum = newtable.HoistingPermitNum,
HoistingClosedNum = newtable.HoistingClosedNum,
};
db.Project_SYHSEData_SYHSE.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateProject_SYHSEData_SYHSE(Model.Project_SYHSEData_SYHSE newtable)
{
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId=newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.GeneralRiskNum = newtable.GeneralRiskNum;
table.LowRiskNum = newtable.LowRiskNum;
table.MediumRiskNum = newtable.MediumRiskNum;
table.HighRiskNum = newtable.HighRiskNum;
table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum;
table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum;
table.DesignQuantity = newtable.DesignQuantity;
table.RunningCapacity = newtable.RunningCapacity;
table.InterlockSettingValue = newtable.InterlockSettingValue;
table.VideoSurveillanceNum = newtable.VideoSurveillanceNum;
table.TotalWorkinghours = newtable.TotalWorkinghours;
table.SafeWorkinghours = newtable.SafeWorkinghours;
table.LostWorkinghours = newtable.LostWorkinghours;
table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
table.NewWaterConsumption = newtable.NewWaterConsumption;
table.GeneralClosedNum = newtable.GeneralClosedNum;
table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
table.MajorClosedNum = newtable.MajorClosedNum;
table.MajorNotClosedNum = newtable.MajorNotClosedNum;
table.HotWorkPermitNum = newtable.HotWorkPermitNum;
table.HotWorkClosedNum = newtable.HotWorkClosedNum;
table.HighPermitNum = newtable.HighPermitNum;
table.HighClosedNum = newtable.HighClosedNum;
table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum;
table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum;
table.BlindPlatePermitNum = newtable.BlindPlatePermitNum;
table.BlindPlateClosedNum = newtable.BlindPlateClosedNum;
table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum;
table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum;
table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum;
table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum;
table.HoistingPermitNum = newtable.HoistingPermitNum;
table.HoistingClosedNum = newtable.HoistingClosedNum;
db.SubmitChanges();
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.GeneralRiskNum = newtable.GeneralRiskNum;
table.LowRiskNum = newtable.LowRiskNum;
table.MediumRiskNum = newtable.MediumRiskNum;
table.HighRiskNum = newtable.HighRiskNum;
table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum;
table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum;
table.DesignQuantity = newtable.DesignQuantity;
table.RunningCapacity = newtable.RunningCapacity;
table.InterlockSettingValue = newtable.InterlockSettingValue;
table.VideoSurveillanceNum = newtable.VideoSurveillanceNum;
table.TotalWorkinghours = newtable.TotalWorkinghours;
table.SafeWorkinghours = newtable.SafeWorkinghours;
table.LostWorkinghours = newtable.LostWorkinghours;
table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
table.NewWaterConsumption = newtable.NewWaterConsumption;
table.GeneralClosedNum = newtable.GeneralClosedNum;
table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
table.MajorClosedNum = newtable.MajorClosedNum;
table.MajorNotClosedNum = newtable.MajorNotClosedNum;
table.HotWorkPermitNum = newtable.HotWorkPermitNum;
table.HotWorkClosedNum = newtable.HotWorkClosedNum;
table.HighPermitNum = newtable.HighPermitNum;
table.HighClosedNum = newtable.HighClosedNum;
table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum;
table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum;
table.BlindPlatePermitNum = newtable.BlindPlatePermitNum;
table.BlindPlateClosedNum = newtable.BlindPlateClosedNum;
table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum;
table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum;
table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum;
table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum;
table.HoistingPermitNum = newtable.HoistingPermitNum;
table.HoistingClosedNum = newtable.HoistingClosedNum;
db.SubmitChanges();
}
}
}
public static void DeleteProject_SYHSEData_SYHSEById(string Id)
{
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_SYHSEData_SYHSE.DeleteOnSubmit(table);
db.SubmitChanges();
}
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_SYHSEData_SYHSE.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断当天是否统计过数据
@@ -295,7 +300,7 @@ namespace BLL
/// </summary>
/// <param name="projectid"></param>
/// <param name="sYHSESDateType"></param>
public static void StatisticalData(string projectid,SYHSESDateType sYHSESDateType)
public static void StatisticalData(string projectid, SYHSESDateType sYHSESDateType)
{
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
@@ -319,7 +324,7 @@ namespace BLL
table.ProjectId = projectid;
table.ReportDate = DateTime.Now.Date;
if (sYHSESDateType== SYHSESDateType.RiskControl || sYHSESDateType == SYHSESDateType.All)
if (sYHSESDateType == SYHSESDateType.RiskControl || sYHSESDateType == SYHSESDateType.All)
{
table.GeneralRiskNum = GetGeneralRiskNum(projectid);
table.LowRiskNum = GetLowRiskNum(projectid);