2023-09-26
This commit is contained in:
@@ -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_CD;
|
||||
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>
|
||||
/// 获取在用计量器具数
|
||||
@@ -433,6 +436,7 @@ namespace BLL
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -440,12 +444,13 @@ namespace BLL
|
||||
/// 获取校准合格数
|
||||
/// </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.IsUsed == 1
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取问题个数
|
||||
@@ -483,8 +488,8 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static int GetProblemNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.Check_CheckControl
|
||||
where x.ProjectId == projectid && x.CheckDate <= DateTime.Now
|
||||
int result = (from x in Funs.DB.Check_CheckControl
|
||||
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;
|
||||
}
|
||||
@@ -517,7 +522,7 @@ namespace BLL
|
||||
public static int GetSNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.WBS_BreakdownProject
|
||||
where x.ProjectId == projectid && x.Class.Contains("S")
|
||||
where x.ProjectId == projectid && x.Class.Contains("S") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -528,7 +533,7 @@ namespace BLL
|
||||
public static int GetANum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.WBS_BreakdownProject
|
||||
where x.ProjectId == projectid && x.Class.Contains("A")
|
||||
where x.ProjectId == projectid && x.Class.Contains("A") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -539,7 +544,7 @@ namespace BLL
|
||||
public static int GetBNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.WBS_BreakdownProject
|
||||
where x.ProjectId == projectid && x.Class.Contains("B")
|
||||
where x.ProjectId == projectid && x.Class.Contains("B") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -550,7 +555,7 @@ namespace BLL
|
||||
public static int GetCNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.WBS_BreakdownProject
|
||||
where x.ProjectId == projectid && x.Class.Contains("C")
|
||||
where x.ProjectId == projectid && x.Class.Contains("C") && x.IsSelected == true && x.CompileDate > Const.DtmarkTime
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
@@ -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>
|
||||
/// 获取单项工程个数
|
||||
@@ -686,7 +691,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;
|
||||
}
|
||||
@@ -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>
|
||||
/// 获取检验批个数
|
||||
@@ -730,7 +735,7 @@ namespace BLL
|
||||
public static int GetInspectionLotNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.WBS_BreakdownProject
|
||||
where x.ProjectId == projectid
|
||||
where x.ProjectId == projectid && x.IsSelected == true
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,38 +1,39 @@
|
||||
using FineUIPro;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class Project_HJGLData_DefectService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
public static SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static List<Model.Project_HJGLData_Defect> GetProject_HJGLData_DefectByModle(Model.Project_HJGLData_Defect table)
|
||||
public static int count { get; set; }
|
||||
|
||||
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByModle(Project_HJGLData_Defect table)
|
||||
{
|
||||
var q = from x in db.Project_HJGLData_Defect
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(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.DefectName) || x.DefectName.Contains(table.DefectName))
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(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.DefectName) || x.DefectName.Contains(table.DefectName))
|
||||
select x
|
||||
;
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
@@ -42,53 +43,51 @@ namespace BLL
|
||||
/// <param name="PageIndex">页码</param>
|
||||
/// <param name="PageSize">每页数量</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(Model.Project_HJGLData_Defect table, Grid Grid1)
|
||||
public static IEnumerable getListData(Project_HJGLData_Defect table, Grid Grid1)
|
||||
{
|
||||
var q = GetProject_HJGLData_DefectByModle(table);
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
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
|
||||
|
||||
public static Model.Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id)
|
||||
public static Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id)
|
||||
{
|
||||
return db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目该日期的缺陷分析数据
|
||||
/// </summary>
|
||||
/// <param name="reportDate"></param>
|
||||
/// <param name="projectid"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Project_HJGLData_Defect> GetProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid)
|
||||
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByDate(DateTime? reportDate,
|
||||
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(Model.Project_HJGLData_Defect newtable)
|
||||
public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
|
||||
{
|
||||
|
||||
Model.Project_HJGLData_Defect table = new Model.Project_HJGLData_Defect
|
||||
var table = new Project_HJGLData_Defect
|
||||
{
|
||||
Id = newtable.Id,
|
||||
ProjectId = newtable.ProjectId,
|
||||
@@ -97,16 +96,21 @@ namespace BLL
|
||||
UnitName = newtable.UnitName,
|
||||
ReportDate = newtable.ReportDate,
|
||||
DefectName = newtable.DefectName,
|
||||
DefectNum = newtable.DefectNum,
|
||||
DefectNum = newtable.DefectNum
|
||||
};
|
||||
db.Project_HJGLData_Defect.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void UpdateProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable)
|
||||
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
|
||||
{
|
||||
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
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)
|
||||
{
|
||||
table.Id = newtable.Id;
|
||||
@@ -119,31 +123,40 @@ namespace BLL
|
||||
table.DefectNum = newtable.DefectNum;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteProject_HJGLData_DefectById(string Id)
|
||||
{
|
||||
|
||||
Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
|
||||
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, string projectid)
|
||||
{
|
||||
|
||||
var table = db.Project_HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断当天是否已统计数据
|
||||
/// </summary>
|
||||
@@ -152,68 +165,110 @@ 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();
|
||||
if (q != null && q.Count > 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据projectid,获取当天的统计后的数据
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type)
|
||||
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<Model.HJGLDataDefectItems> getTodayProject_HJGLData_Defect()
|
||||
|
||||
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 into g
|
||||
select new Model.HJGLDataDefectItems
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
DefectName = g.Key,
|
||||
DefectNum=g.Sum (p=>p.DefectNum)
|
||||
}).ToList();
|
||||
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();
|
||||
return q;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统计所有在建项目数据
|
||||
/// </summary>
|
||||
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) thisUnitId = thisUnit.UnitId;
|
||||
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 }
|
||||
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();
|
||||
DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有
|
||||
var projectHjglDataDefect = new List<Project_HJGLData_Defect>();
|
||||
foreach (var item in data
|
||||
)
|
||||
{
|
||||
StatisticalData(item.ProjectId);
|
||||
var table = new Project_HJGLData_Defect
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
UnitId = item.UnitId,
|
||||
CollCropCode = item.CollCropCode,
|
||||
UnitName = item.UnitName,
|
||||
ProjectId = item.ProjectId,
|
||||
ReportDate = item.ReportDate,
|
||||
DefectName = item.DefectName,
|
||||
DefectNum = item.DefectNum
|
||||
};
|
||||
projectHjglDataDefect.Add(table);
|
||||
}
|
||||
|
||||
AddBulkProject_HJGLData_Defect(projectHjglDataDefect); //批量增加
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统计数据
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
public static void StatisticalData(string projectid)
|
||||
{
|
||||
string thisUnitId = BLL.Const.UnitId_CD;
|
||||
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
|
||||
var thisUnitId = string.Empty;
|
||||
var thisUnit = CommonService.GetIsThisUnit();
|
||||
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))
|
||||
{
|
||||
Model.Project_HJGLData_Defect table = new Model.Project_HJGLData_Defect
|
||||
var table = new Project_HJGLData_Defect
|
||||
{
|
||||
UnitId = thisUnitId,
|
||||
CollCropCode = base_Unit.CollCropCode,
|
||||
@@ -221,7 +276,7 @@ namespace BLL
|
||||
ProjectId = projectid,
|
||||
ReportDate = DateTime.Now.Date,
|
||||
DefectName = t,
|
||||
DefectNum = list.Count(x => x.Defects_Definition == t),
|
||||
DefectNum = list.Count(x => x.Defects_Definition == t)
|
||||
};
|
||||
if (IsReportByToday(projectid, t))
|
||||
{
|
||||
@@ -234,27 +289,26 @@ namespace BLL
|
||||
AddProject_HJGLData_Defect(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取缺陷名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetDefectName(string projectid)
|
||||
{
|
||||
string result = "";
|
||||
var result = "";
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取缺陷数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetDefectNum(string projectid)
|
||||
{
|
||||
int result = 0;
|
||||
var result = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -228,7 +228,12 @@ namespace BLL
|
||||
/// <param name="hJGLDateType">数据类型</param>
|
||||
public static void StatisticalData(string projectid,HJGLDateType hJGLDateType)
|
||||
{
|
||||
string thisUnitId = BLL.Const.UnitId_CD;
|
||||
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))
|
||||
@@ -265,7 +270,7 @@ namespace BLL
|
||||
}
|
||||
if (hJGLDateType == HJGLDateType.DefectAnalysis || hJGLDateType == HJGLDateType.All)
|
||||
{
|
||||
Project_HJGLData_DefectService.StatisticalData(projectid);
|
||||
// Project_HJGLData_DefectService.StatisticalData(projectid);
|
||||
}
|
||||
|
||||
if (IsReportByToday(projectid))
|
||||
@@ -298,7 +303,7 @@ namespace BLL
|
||||
{
|
||||
int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo
|
||||
where x.ProjectId == projectid
|
||||
select x.JOT_Size).ToList().Sum(x=>x.Value));
|
||||
select x.JOT_Size).ToList().Sum());
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -309,7 +314,7 @@ namespace BLL
|
||||
{
|
||||
int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo
|
||||
where x.ProjectId == projectid
|
||||
select x.JOT_DoneDin ).ToList().Sum(x => x.Value));
|
||||
select x.JOT_DoneDin ).ToList().Sum());
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -318,10 +323,10 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static int GetTotalFilmNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.CH_CheckItem
|
||||
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(x => x.Value);
|
||||
select x.CHT_TotalFilm ).ToList().Sum());
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -330,10 +335,10 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static int GetOKFilmNum(string projectid)
|
||||
{
|
||||
int result = (from x in Funs.DB.CH_CheckItem
|
||||
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(x => x.Value);
|
||||
select x.CHT_PassFilm).ToList().Sum());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+114
-85
@@ -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判断当天项目是否已统计数据
|
||||
@@ -198,53 +223,57 @@ namespace BLL
|
||||
}
|
||||
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_CD);
|
||||
//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_CD,
|
||||
// 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>
|
||||
|
||||
@@ -297,7 +297,12 @@ namespace BLL
|
||||
/// <param name="sYHSESDateType"></param>
|
||||
public static void StatisticalData(string projectid,SYHSESDateType sYHSESDateType)
|
||||
{
|
||||
string thisUnitId = BLL.Const.UnitId_CD;
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user