2023-08-04

This commit is contained in:
2023-08-04 17:06:50 +08:00
parent 70a51ab125
commit 78e8037f08
81 changed files with 8897 additions and 2763 deletions
@@ -17,7 +17,7 @@ namespace BLL
/// <summary>
/// CQMS数据类型
/// </summary>
public enum CQMSDateType
public enum CQMSDateType
{
/// <summary>
/// 质量培训数据
@@ -145,9 +145,9 @@ namespace BLL
}
public static List<Model.Project_CQMSData_CQMS> GetProject_CQMSData_CQMSByprojectid(string projectid)
{
var q =( from x in db.Project_CQMSData_CQMS
where x.ProjectId == projectid
select x).ToList();
var q = (from x in db.Project_CQMSData_CQMS
where x.ProjectId == projectid
select x).ToList();
return q;
}
/// <summary>
@@ -283,7 +283,7 @@ namespace BLL
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static bool IsReportByDate(DateTime dateTime,string projectid)
public static bool IsReportByDate(DateTime dateTime, string projectid)
{
var result = false;
var q = (from x in Funs.DB.Project_CQMSData_CQMS
@@ -320,26 +320,31 @@ namespace BLL
/// </summary>
/// <param name="projectid">项目id</param>
/// <param name="cQMSDateType">数据类型</param>
public static void StatisticalData(string projectid,CQMSDateType cQMSDateType)
public static void StatisticalData(string projectid, CQMSDateType cQMSDateType)
{
string thisUnitId = BLL.Const.UnitId_SEDIN;
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
{
thisUnitId = thisUnit.UnitId;
}
var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS();
if (IsReportByToday(projectid))
{
table= getTodayProject_CQMSData_CQMS(projectid);
table = getTodayProject_CQMSData_CQMS(projectid);
}
else
{
table.Id = SQLHelper.GetNewID();
}
table.UnitId = thisUnitId;
table.CollCropCode = base_Unit.CollCropCode;
table.UnitName = base_Unit.UnitName;
table.CollCropCode = baseUnit.CollCropCode;
table.UnitName = baseUnit.UnitName;
table.ProjectId = projectid;
table.ReportDate = DateTime.Now.Date;
if (cQMSDateType== CQMSDateType.QualityTraining|| cQMSDateType == CQMSDateType.All)
if (cQMSDateType == CQMSDateType.QualityTraining || cQMSDateType == CQMSDateType.All)
{
table.TrainPersonNum = GetTrainPersonNum(projectid);
table.TechnicalDisclosePersonNum = GetTechnicalDisclosePersonNum(projectid);
@@ -347,7 +352,7 @@ namespace BLL
if (cQMSDateType == CQMSDateType.MeasuringInstruments || cQMSDateType == CQMSDateType.All)
{
table.UseNum = GetUseNum(projectid);
table.OKNum = GetOKNum(projectid);
table.OKNum = GetOkNum(projectid);
}
if (cQMSDateType == CQMSDateType.ManagerData || cQMSDateType == CQMSDateType.All)
{
@@ -371,11 +376,11 @@ namespace BLL
if (cQMSDateType == CQMSDateType.QualityAcceptance || cQMSDateType == CQMSDateType.All)
{
table.KeyProcessNum = GetKeyProcessNum(projectid);
table.KeyProcessOKNum = GetKeyProcessOKNum(projectid);
table.KeyProcessOKNum = GetKeyProcessOkNum(projectid);
table.SpecialProcessNum = GetSpecialProcessNum(projectid);
table.SpecialProcessOKNum = GetSpecialProcessOKNum(projectid);
table.SpecialProcessOKNum = GetSpecialProcessOkNum(projectid);
table.ConcealedWorksNum = GetConcealedWorksNum(projectid);
table.ConcealedWorksOKNum = GetConcealedWorksOKNum(projectid);
table.ConcealedWorksOKNum = GetConcealedWorksOkNum(projectid);
table.UnitProjectOnesNum = GetUnitProjectOnesNum(projectid);
table.UnitProjectOnesOKNum = GetUnitProjectOnesOKNum(projectid);
table.MaterialInRecheckNum = GetMaterialInRecheckNum(projectid);
@@ -388,7 +393,7 @@ namespace BLL
table.SubProjectNum = GetSubProjectNum(projectid);
table.SubdivisionalWorksNum = GetSubdivisionalWorksNum(projectid);
table.InspectionLotNum = GetInspectionLotNum(projectid);
}
}
if (IsReportByToday(projectid))
{
@@ -406,11 +411,10 @@ namespace BLL
/// <returns></returns>
public static int GetTrainPersonNum(string projectid)
{
//DateTime date = DateTime.Now;
//int result = (from x in Funs.DB.Comprehensive_InspectionPerson
// where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month && x.CompileDate.Value.Day == date.Day
// select x).Count();
return 0;
var result = (from x in Funs.DB.Comprehensive_InspectionPerson
where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取技术交底人次数
@@ -418,12 +422,11 @@ namespace BLL
/// <returns></returns>
public static int GetTechnicalDisclosePersonNum(string projectid)
{
//DateTime date = DateTime.Now;
//var result = (from x in Funs.DB.Comprehensive_DesignDetails
// where x.ProjectId == projectid && x.DetailsDate.Value.Year == date.Year && x.DetailsDate.Value.Month == date.Month && x.DetailsDate.Value.Day == date.Day
// select x.JoinPersonNum ).ToList().Sum(x=>x.Value);
//var q = Funs.GetNewIntOrZero(result.ToString());
return 0;
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());
return q;
}
/// <summary>
/// 获取在用计量器具数
@@ -431,21 +434,23 @@ namespace BLL
/// <returns></returns>
public static int GetUseNum(string projectid)
{
//int result = (from x in Funs.DB.Comprehensive_InspectionMachine
// where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量")
// select x).Count();
return 0;
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量")
&& x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取校准合格数
/// </summary>
/// <returns></returns>
public static int GetOKNum(string projectid)
public static int GetOkNum(string projectid)
{
//int result = (from x in Funs.DB.Comprehensive_InspectionMachine
// where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true
// select x).Count();
return 0;
int result = (from x in Funs.DB.Comprehensive_InspectionMachine
where x.ProjectId == projectid && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true
&& x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取企业总部人数
@@ -471,11 +476,11 @@ namespace BLL
/// <returns></returns>
public static int GetProjectPersonNum(string projectid)
{
//int result = (from x in Funs.DB.Comprehensive_InspectionPerson
// join y in Funs.DB.Base_WorkPost on x.PostId equals y.WorkPostId
// where x.ProjectId == projectid && y.IsCQMS == true && x.IsOnSite == true
// select x).Count();
return 0;
int 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.IsCQMS == true && x.States=="1"
select x).Count();
return result;
}
/// <summary>
/// 获取问题个数
@@ -484,7 +489,7 @@ namespace BLL
public static int GetProblemNum(string projectid)
{
int result = (from x in Funs.DB.Check_CheckControl
where x.ProjectId == projectid && x.CheckDate <= DateTime.Now
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -495,7 +500,7 @@ namespace BLL
public static int GetProblemCompletedNum(string projectid)
{
int result = (from x in Funs.DB.Check_CheckControl
where x.ProjectId == projectid && x.CheckDate <= DateTime.Now && x.State == "7"
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime && x.State == "7"
select x).Count();
return result;
}
@@ -506,7 +511,7 @@ namespace BLL
public static int GetProblemNotCompletedNum(string projectid)
{
int result = (from x in Funs.DB.Check_CheckControl
where x.ProjectId == projectid && x.CheckDate <= DateTime.Now && x.State != "7"
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime && x.State != "7"
select x).Count();
return result;
}
@@ -516,10 +521,10 @@ namespace BLL
/// <returns></returns>
public static int GetSNum(string projectid)
{
//int result = (from x in Funs.DB.WBS_BreakdownProject
// where x.ProjectId == projectid && x.Class.Contains("S")
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_BreakdownProject
where x.ProjectId == projectid && x.Class.Contains("S") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取A级数
@@ -527,10 +532,10 @@ namespace BLL
/// <returns></returns>
public static int GetANum(string projectid)
{
//int result = (from x in Funs.DB.WBS_BreakdownProject
// where x.ProjectId == projectid && x.Class.Contains("A")
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_BreakdownProject
where x.ProjectId == projectid && x.Class.Contains("A") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取B级数
@@ -538,10 +543,10 @@ namespace BLL
/// <returns></returns>
public static int GetBNum(string projectid)
{
//int result = (from x in Funs.DB.WBS_BreakdownProject
// where x.ProjectId == projectid && x.Class.Contains("B")
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_BreakdownProject
where x.ProjectId == projectid && x.Class.Contains("B") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取C级数
@@ -549,10 +554,10 @@ namespace BLL
/// <returns></returns>
public static int GetCNum(string projectid)
{
//int result = (from x in Funs.DB.WBS_BreakdownProject
// where x.ProjectId == projectid && x.Class.Contains("C")
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_BreakdownProject
where x.ProjectId == projectid && x.Class.Contains("C") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取关键工序验收数
@@ -560,24 +565,24 @@ namespace BLL
/// <returns></returns>
public static int GetKeyProcessNum(string projectid)
{
//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"
// select x).Count();
return 0;
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
select x).Count();
return result;
}
/// <summary>
/// 获取关键工序验收合格数
/// </summary>
/// <returns></returns>
public static int GetKeyProcessOKNum(string projectid)
public static int GetKeyProcessOkNum(string projectid)
{
//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
// select x).Count();
return 0;
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
select x).Count();
return result;
}
/// <summary>
/// 获取特殊过程验收数
@@ -585,24 +590,24 @@ namespace BLL
/// <returns></returns>
public static int GetSpecialProcessNum(string projectid)
{
//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 == "2"
// select x).Count();
return 0;
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 == "2" && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取特殊过程验收合格数
/// </summary>
/// <returns></returns>
public static int GetSpecialProcessOKNum(string projectid)
public static int GetSpecialProcessOkNum(string projectid)
{
//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 == "2" && z.IsOnceQualified == true
// select x).Count();
return 0;
var 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 == "2" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取隐蔽工程验收数
@@ -610,24 +615,24 @@ namespace BLL
/// <returns></returns>
public static int GetConcealedWorksNum(string projectid)
{
//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 == "3"
// select x).Count();
return 0;
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 == "3" && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取隐蔽工程验收合格数
/// </summary>
/// <returns></returns>
public static int GetConcealedWorksOKNum(string projectid)
public static int GetConcealedWorksOkNum(string projectid)
{
//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 == "3" && z.IsOnceQualified == true
// select x).Count();
return 0;
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 == "3" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取单位工程一次验收数
@@ -635,11 +640,11 @@ namespace BLL
/// <returns></returns>
public static int GetUnitProjectOnesNum(string projectid)
{
//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 == "4"
// select x).Count();
return 0;
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 == "4" && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取单位工程一次验收合格数
@@ -647,12 +652,12 @@ namespace BLL
/// <returns></returns>
public static int GetUnitProjectOnesOKNum(string projectid)
{
//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 == "4" && z.IsOnceQualified == true
// select x).Count();
return 0;
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 == "4" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取材料进场复验数
@@ -660,11 +665,11 @@ namespace BLL
/// <returns></returns>
public static int GetMaterialInRecheckNum(string projectid)
{
//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 == "5"
// select x).Count();
return 0;
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 == "5" && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取材料进场复验合格数
@@ -672,12 +677,12 @@ namespace BLL
/// <returns></returns>
public static int GetMaterialInRecheckOKNum(string projectid)
{
//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 == "5" && z.IsOnceQualified == true
// select x).Count();
return 0;
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 == "5" && z.IsOnceQualified == true && x.CreateDate > Const.DtmarkTime
select x).Count();
return result;
}
/// <summary>
/// 获取单项工程个数
@@ -685,10 +690,10 @@ namespace BLL
/// <returns></returns>
public static int GetSingleProjectNum(string projectid)
{
//int result = (from x in Funs.DB.Project_Installation
// where x.ProjectId == projectid && x.SuperInstallationId == "0"
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_UnitWork
where x.ProjectId == projectid
select x).Count();
return result;
}
/// <summary>
/// 获取单位工程个数
@@ -707,10 +712,10 @@ namespace BLL
/// <returns></returns>
public static int GetSubProjectNum(string projectid)
{
//int result = (from x in Funs.DB.WBS_DivisionProject
// where x.ProjectId == projectid && x.SubItemType == "1"
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_DivisionProject
where x.ProjectId == projectid && x.SubItemType == "1" && x.IsSelected == true
select x).Count();
return result;
}
/// <summary>
/// 获取分项工程个数
@@ -718,10 +723,10 @@ namespace BLL
/// <returns></returns>
public static int GetSubdivisionalWorksNum(string projectid)
{
//int result = (from x in Funs.DB.WBS_DivisionProject
// where x.ProjectId == projectid && x.SubItemType == "3"
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_DivisionProject
where x.ProjectId == projectid && x.SubItemType == "3" && x.IsSelected == true
select x).Count();
return result;
}
/// <summary>
/// 获取检验批个数
@@ -729,10 +734,10 @@ namespace BLL
/// <returns></returns>
public static int GetInspectionLotNum(string projectid)
{
//int result = (from x in Funs.DB.WBS_BreakdownProject
// where x.ProjectId == projectid
// select x).Count();
return 0;
int result = (from x in Funs.DB.WBS_BreakdownProject
where x.ProjectId == projectid && x.IsSelected == true
select x).Count();
return result;
}
@@ -105,11 +105,11 @@ 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)
@@ -226,9 +226,14 @@ 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 = BLL.Const.UnitId_SEDIN;
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
{
thisUnitId = thisUnit.UnitId;
}
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL();
if (IsReportByToday(projectid))
@@ -237,7 +242,7 @@ namespace BLL
}
else
{
table.Id = SQLHelper.GetNewID();
table.Id = SQLHelper.GetNewID();
}
table.UnitId = thisUnitId;
table.CollCropCode = base_Unit.CollCropCode;
@@ -245,7 +250,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);
@@ -265,9 +270,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);
@@ -320,7 +325,7 @@ namespace BLL
{
int result = (from x in Funs.DB.HJGL_Batch_NDEItem
join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID
where y.ProjectId == projectid
where y.ProjectId == projectid
select x.TotalFilm).ToList().Sum(x => x.Value);
return result;
}
@@ -332,7 +337,7 @@ namespace BLL
{
int result = (from x in Funs.DB.HJGL_Batch_NDEItem
join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID
where y.ProjectId == projectid
where y.ProjectId == projectid
select x.PassFilm).ToList().Sum(x => x.Value);
return result;
}
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,6 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -83,59 +84,73 @@ namespace BLL
/// <returns></returns>
public static List<Model.Project_HSSEData_HiddenDangerDetail> GetProject_HSSEData_HiddenDangerDetailByDate(DateTime? reportDate, string projectid)
{
var q = from x in db.Project_HSSEData_HiddenDangerDetail
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
select x;
return q.ToList();
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var q = from x in db.Project_HSSEData_HiddenDangerDetail
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
select x;
return q.ToList();
}
}
public static void AddProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable)
{
Model.Project_HSSEData_HiddenDangerDetail table = new Model.Project_HSSEData_HiddenDangerDetail
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,
TypeName = newtable.TypeName,
TotalNum = newtable.TotalNum,
NeedRectifyNum = newtable.NeedRectifyNum,
};
db.Project_HSSEData_HiddenDangerDetail.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_HSSEData_HiddenDangerDetail table = new Model.Project_HSSEData_HiddenDangerDetail
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
TypeName = newtable.TypeName,
TotalNum = newtable.TotalNum,
NeedRectifyNum = newtable.NeedRectifyNum,
};
db.Project_HSSEData_HiddenDangerDetail.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable)
public static void AddBulkProject_HSSEData_HiddenDangerDetails(List<Model.Project_HSSEData_HiddenDangerDetail> newtables)
{
Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId = table.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.TypeName = newtable.TypeName;
table.TotalNum = newtable.TotalNum;
table.NeedRectifyNum = newtable.NeedRectifyNum;
db.SubmitChanges();
Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = table.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.TypeName = newtable.TypeName;
table.TotalNum = newtable.TotalNum;
table.NeedRectifyNum = newtable.NeedRectifyNum;
db.SubmitChanges();
}
}
}
public static void DeleteProject_HSSEData_HiddenDangerDetailById(string Id)
{
Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HSSEData_HiddenDangerDetail.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Project_HSSEData_HiddenDangerDetail table = db.Project_HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_HSSEData_HiddenDangerDetail.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据项目id和日期删除隐患类别数据
@@ -144,14 +159,24 @@ namespace BLL
/// <param name="projectid"></param>
public static void DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime? reportDate, string projectid)
{
var table = db.Project_HSSEData_HiddenDangerDetail.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))
{
var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime? reportDate)
{
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);
db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
/// <summary>
/// 根据projectid判断当天项目是否已统计数据
@@ -185,66 +210,71 @@ 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;
}
public static void StatisticalAllProjectData()
{
var projectlist = ProjectService.GetProjectWorkList();
foreach (var item in projectlist)
var db = Funs.DB;
var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList();
var thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
{
StatisticalData(item.ProjectId);
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 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 }
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();
DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime.Now.Date);
var projectHsseDataHiddenDangerDetails = new List<Project_HSSEData_HiddenDangerDetail>();
foreach (var item in data)
{
Project_HSSEData_HiddenDangerDetail table = new Project_HSSEData_HiddenDangerDetail
{
Id = SQLHelper.GetNewID(),
UnitId = item.UnitId,
CollCropCode = item.CollCropCode,
UnitName = item.UnitName,
ProjectId = item.ProjectId,
ReportDate = item.ReportDate,
TypeName = item.TypeName,
TotalNum = item.TotalNum,
NeedRectifyNum = item.NeedRectifyNum,
};
projectHsseDataHiddenDangerDetails.Add(table);
}
AddBulkProject_HSSEData_HiddenDangerDetails(projectHsseDataHiddenDangerDetails);
}
/// <summary>
/// 统计数据
/// </summary>
/// <param name="projectid"></param>
public static void StatisticalData(string projectid)
{
//var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_SEDIN);
//DateTime date = DateTime.Now;
//Model.SGGLDB db = Funs.DB;
//var list = from x in db.Check_RectifyNoticesItem
// join y in db.Check_RectifyNotices on x.RectifyNoticesId equals y.RectifyNoticesId
// where y.ProjectId == projectid && y.CheckedDate.Value.Year == date.Year && y.CheckedDate.Value.Month == date.Month && y.CheckedDate.Value.Day == date.Day
// select x;
//var types = (from x in db.Technique_Rectify
// join y in list on x.RectifyId equals y.RectifyId
// select new { x.RectifyId, x.RectifyName }).Distinct().ToList();
//foreach (var type in types)
//{
// Model.Project_HSSEData_HiddenDangerDetail table = new Model.Project_HSSEData_HiddenDangerDetail
// {
// UnitId = BLL.Const.UnitId_SEDIN,
// CollCropCode = base_Unit.CollCropCode,
// UnitName = base_Unit.UnitName,
// ProjectId = projectid,
// ReportDate = DateTime.Now.Date,
// TypeName = type.RectifyName,
// TotalNum = list.Count(x => x.RectifyId == type.RectifyId),
// NeedRectifyNum = list.Count(x => x.RectifyId == type.RectifyId && (x.IsRectify == null || x.IsRectify == false)),
// };
// if (IsReportByToday(projectid, type.RectifyName))
// {
// table.Id = GetTodayModelByProjectAndType(projectid, type.RectifyName).Id;
// UpdateProject_HSSEData_HiddenDangerDetail(table);
// }
// else
// {
// table.Id = SQLHelper.GetNewID();
// AddProject_HSSEData_HiddenDangerDetail(table);
// }
//}
}
/// <summary>
/// 获取类别名称
/// </summary>
@@ -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
{
@@ -196,7 +196,7 @@ namespace BLL
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId=newtable.ProjectId;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
@@ -295,9 +295,14 @@ 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 = BLL.Const.UnitId_SEDIN;
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
{
thisUnitId = thisUnit.UnitId;
}
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE();
if (IsReportByToday(projectid))
@@ -314,7 +319,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);