From 48dd589a7fcbf3014daadbcd594e5e57eb5bbc4d Mon Sep 17 00:00:00 2001 From: fly-l <1420031550@qq.com> Date: Sat, 11 Nov 2023 16:02:42 +0800 Subject: [PATCH] 2023-11-11 --- SGGL/BLL/Common/Funs.cs | 2 +- SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs | 192 +++---- .../ZHGL/DataSync/HJGLData_DefectService.cs | 79 +-- .../BLL/ZHGL/DataSync/HJGLData_HJGLService.cs | 101 ++-- .../BLL/ZHGL/DataSync/HSSEData_HSSEService.cs | 244 ++++----- .../HSSEData_HiddenDangerDetailService.cs | 81 +-- .../DataSync/Hazard_RealTimeDeviceService.cs | 213 ++++---- .../Project_CQMSDataService.cs | 191 +++---- .../Project_HJGLData_DefectService.cs | 181 ++++--- .../Project_HJGLData_HJGLService.cs | 114 ++-- .../Project_HSSEData_HSSEService.cs | 497 +++++++++--------- ...ject_HSSEData_HiddenDangerDetailService.cs | 50 +- .../Project_SYHSEData_SYHSEService.cs | 209 ++++---- SGGL/BLL/ZHGL/DataSync/ServerService.cs | 14 +- SGGL/FineUIPro.Web/DataShow/Accident.aspx.cs | 10 +- SGGL/FineUIPro.Web/DataShow/Check.aspx.cs | 16 +- .../FineUIPro.Web/DataShow/CompanyPerson.aspx | 2 +- .../DataShow/CompanyPerson.aspx.cs | 5 +- .../DataShow/ConstructionEquipment.aspx.cs | 7 +- SGGL/FineUIPro.Web/DataShow/EduTrain.aspx | 17 +- SGGL/FineUIPro.Web/DataShow/EduTrain.aspx.cs | 43 +- SGGL/FineUIPro.Web/DataShow/Emergency.aspx | 18 +- SGGL/FineUIPro.Web/DataShow/Emergency.aspx.cs | 64 ++- .../FineUIPro.Web/DataShow/Environmental.aspx | 2 +- .../DataShow/Environmental.aspx.cs | 7 +- SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx | 18 +- .../FineUIPro.Web/DataShow/HJGLDefect.aspx.cs | 35 +- .../FineUIPro.Web/DataShow/HJGLWelder.aspx.cs | 3 +- SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx | 20 +- .../DataShow/HJGLWelding.aspx.cs | 39 +- .../DataShow/HiddenRectification.aspx | 24 +- .../DataShow/HiddenRectification.aspx.cs | 148 ++++-- .../DataShow/HiddenRectificationItem.aspx.cs | 12 +- .../DataShow/LargeEngineering.aspx | 18 +- .../DataShow/LargeEngineering.aspx.cs | 65 ++- .../DataShow/LargeEngineeringItem.aspx.cs | 9 +- SGGL/FineUIPro.Web/DataShow/License.aspx.cs | 4 +- SGGL/FineUIPro.Web/DataShow/Meeting.aspx.cs | 18 +- .../DataShow/ProjectDivision.aspx | 18 +- .../DataShow/ProjectDivision.aspx.cs | 41 +- .../FineUIPro.Web/DataShow/ProjectPerson.aspx | 2 +- .../DataShow/ProjectPerson.aspx.cs | 1 - .../DataShow/QualityAcceptance.aspx | 21 +- .../DataShow/QualityAcceptance.aspx.cs | 54 +- .../DataShow/QualityControlPoint.aspx | 17 +- .../DataShow/QualityControlPoint.aspx.cs | 35 +- .../DataShow/QualityInstruments.aspx | 18 +- .../DataShow/QualityInstruments.aspx.cs | 32 +- .../DataShow/QualityPerson.aspx.cs | 4 +- .../DataShow/QualityProblem.aspx | 18 +- .../DataShow/QualityProblem.aspx.cs | 40 +- .../DataShow/QualityProblemItem.aspx.cs | 12 +- .../DataShow/QualityTraining.aspx | 18 +- .../DataShow/QualityTraining.aspx.cs | 41 +- .../DataShow/QualityTrainingItem1.aspx.cs | 3 +- .../DataShow/QualityTrainingItem2.aspx.cs | 2 +- SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx | 18 +- .../DataShow/SecurityCost.aspx.cs | 32 +- SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx | 18 +- .../DataShow/SecurityRisk.aspx.cs | 45 +- .../DataShow/SecurityRiskItem.aspx.cs | 11 +- SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx | 18 +- .../DataShow/WorkingHours.aspx.cs | 48 +- .../DataShow/WorkingHoursItem.aspx.cs | 2 +- .../DataSync/CNCECServerController.cs | 224 ++++++++ SGGL/WebAPI/WebAPI.csproj | 1 + 66 files changed, 2334 insertions(+), 1232 deletions(-) create mode 100644 SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index cfa21c1f..7af229d3 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -540,7 +540,7 @@ namespace BLL return revalue; } #endregion - + public static DateTime minSysDate = Funs.GetNewDateTimeOrNow("2023-01-01"); /// /// ָϴļ /// diff --git a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs index 6a49cea8..779e64ce 100644 --- a/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/CQMSDataService.cs @@ -95,59 +95,111 @@ namespace BLL public static void AddCQMSData_CQMS(CQMSData_CQMS newtable) { - var db = Funs.DB; - var table = new CQMSData_CQMS + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - 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, - State = newtable.State, - CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan - }; - db.CQMSData_CQMS.InsertOnSubmit(table); - db.SubmitChanges(); + var table = new CQMSData_CQMS + { + Id = newtable.Id, + 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, + State = newtable.State, + CreateDate = newtable.CreateDate, + CreateMan = newtable.CreateMan + }; + db.CQMSData_CQMS.InsertOnSubmit(table); + db.SubmitChanges(); + } } + public static void UpdateCQMSData_CQMS(CQMSData_CQMS newtable) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + 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; + table.State = newtable.State; + table.CreateMan = newtable.CreateMan; + table.CreateDate = newtable.CreateDate; + db.SubmitChanges(); + } + } + } public static void DeleteCQMSData_CQMSById(string id) { - var db = Funs.DB; - var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.CQMSData_CQMS.DeleteOnSubmit(table); - db.SubmitChanges(); + var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == id); + if (table != null) + { + db.CQMSData_CQMS.DeleteOnSubmit(table); + db.SubmitChanges(); + } } } @@ -396,52 +448,6 @@ namespace BLL return data; } - public static void UpdateCQMSData_CQMS(CQMSData_CQMS newtable) - { - var db = Funs.DB; - var table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) - { - table.Id = newtable.Id; - 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; - table.State = newtable.State; - table.CreateMan = newtable.CreateMan; - table.CreateDate = newtable.CreateDate; - db.SubmitChanges(); - } - } /// /// 获取企业总部人数 diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs index 1ab237ad..f3eecb3a 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_DefectService.cs @@ -81,60 +81,65 @@ namespace BLL public static void AddHJGLData_Defect(Model.HJGLData_Defect newtable) { - - Model.HJGLData_Defect table = new Model.HJGLData_Defect + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - DefectName = newtable.DefectName, - DefectNum = newtable.DefectNum, - }; - db.HJGLData_Defect.InsertOnSubmit(table); - db.SubmitChanges(); + Model.HJGLData_Defect table = new Model.HJGLData_Defect + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + DefectName = newtable.DefectName, + DefectNum = newtable.DefectNum, + }; + db.HJGLData_Defect.InsertOnSubmit(table); + db.SubmitChanges(); + } } public static void UpdateHJGLData_Defect(Model.HJGLData_Defect newtable) { - - Model.HJGLData_Defect table = db.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.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(); + Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + 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 DeleteHJGLData_DefectById(string Id) { - - Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HJGLData_Defect.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.HJGLData_Defect table = db.HJGLData_Defect.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.HJGLData_Defect.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } public static void DeleteHJGLData_DefectByDate(DateTime? reportDate) { - - var table = db.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.HJGLData_Defect.DeleteAllOnSubmit(table); - db.SubmitChanges(); - } - + var table = db.HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.HJGLData_Defect.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } + } } } diff --git a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs index ffd34465..374ac43a 100644 --- a/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HJGLData_HJGLService.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; +using System.Net.PeerToPeer; namespace BLL { @@ -70,36 +71,42 @@ namespace BLL public static void AddHJGLData_HJGL(HJGLData_HJGL newtable) { - var db = Funs.DB; - var table = new HJGLData_HJGL + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - 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, - State = newtable.State, - CreateDate = newtable.CreateDate, - CreateMan = newtable.CreateMan - }; - db.HJGLData_HJGL.InsertOnSubmit(table); - db.SubmitChanges(); + var table = new HJGLData_HJGL + { + Id = newtable.Id, + 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, + State = newtable.State, + CreateDate = newtable.CreateDate, + CreateMan = newtable.CreateMan + }; + db.HJGLData_HJGL.InsertOnSubmit(table); + db.SubmitChanges(); + } + } public static void DeleteHJGLData_HJGLById(string Id) { - var db = Funs.DB; - var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HJGLData_HJGL.DeleteOnSubmit(table); - db.SubmitChanges(); + var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.HJGLData_HJGL.DeleteOnSubmit(table); + db.SubmitChanges(); + } } + } public static HJGLData_HJGL GetHJGLData_HJGLById(string Id) @@ -150,12 +157,12 @@ namespace BLL public static HJGLData GetTodayHJGLData_HJGL() { - var q = GetTodayData(); var data = new HJGLData(); if (CommonService.GetIsThisUnit().CollCropCode== "91410200170644116B") { return GetELECLTodayHJGLData_HJGL(); } + var q = GetTodayData(); if (q != null && q.State == Const.CNCEC_State_S) data = StatisticalData(); else @@ -181,12 +188,11 @@ namespace BLL return data; } - public static HJGLData_HJGL GetTodayData() { var q = (from x in Funs.DB.HJGLData_HJGL - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } @@ -293,26 +299,29 @@ namespace BLL } public static void UpdateHJGLData_HJGL(HJGLData_HJGL newtable) - { - var db = Funs.DB; - var table = db.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.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; - table.State = newtable.State; - table.CreateMan = newtable.CreateMan; - table.CreateDate = newtable.CreateDate; - db.SubmitChanges(); - } + var table = db.HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + 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; + table.State = newtable.State; + table.CreateMan = newtable.CreateMan; + table.CreateDate = newtable.CreateDate; + db.SubmitChanges(); + } + } + } } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs index ec66dd73..4e783c28 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HSSEService.cs @@ -212,7 +212,9 @@ namespace BLL { var list = hSseDataHiddens.Select(detail => new HSSEDataHiddenDangerDetailItem { - Id = detail.Id, NeedRectifyNum = detail.NeedRectifyNum, TotalNum = detail.TotalNum, + Id = detail.Id, + NeedRectifyNum = detail.NeedRectifyNum, + TotalNum = detail.TotalNum, TypeName = detail.TypeName }).ToList(); @@ -332,8 +334,8 @@ namespace BLL { HSSEData data; var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); if (q != null && q.State == Const.CNCEC_State_S) // data = GetItemByHSSEData_HSSE(q, Project_HSSEData_HiddenDangerDetailService.GetTodayModel()); ; data = StatisticalData(); @@ -345,8 +347,8 @@ namespace BLL public static HSSEData_HSSE GetTodayData() { var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).FirstOrDefault(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).FirstOrDefault(); return q; } @@ -364,8 +366,8 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date - select x).ToList(); + where x.ReportDate >= dateTime.Date && x.ReportDate < dateTime.Date.AddDays(1).Date + select x).ToList(); if (q.Count > 0) result = true; return result; } @@ -378,8 +380,8 @@ namespace BLL { var result = false; var q = (from x in Funs.DB.HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); if (q.Count > 0) result = true; return result; } @@ -403,8 +405,8 @@ namespace BLL Project_HSSEData_HiddenDangerDetailService.StatisticalAllProjectData(); var projectData = (from x in Funs.DB.Project_HSSEData_HSSE - where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date - select x).ToList(); + where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date + select x).ToList(); var totalEnergyConsumption = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption(); var incomeComprehensiveEnergyConsumption = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption(); @@ -606,8 +608,8 @@ namespace BLL var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_CompanyBranchPerson - where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId - select x).Count(); + where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId == unitId + select x).Count(); return result; } @@ -621,9 +623,9 @@ namespace BLL var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_CompanyBranchPerson - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId - select x).Count(); + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsOnJob == true && y.IsHsse == true && x.UnitId == unitId + select x).Count(); return result; } @@ -637,8 +639,8 @@ namespace BLL var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_CompanyBranchPerson - where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId - select x).Count(); + where x.IsOnJob == true && x.WorkPostId == Const.WorkPost_HSSEDirector && x.UnitId != unitId + select x).Count(); return result; } @@ -652,9 +654,9 @@ namespace BLL var thisUnit = CommonService.GetIsThisUnit(); if (thisUnit != null) unitId = thisUnit.UnitId; var result = (from x in Funs.DB.Person_CompanyBranchPerson - join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId - where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId - select x).Count(); + join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId + where x.IsOnJob == true && y.IsHsse == true && x.UnitId != unitId + select x).Count(); return result; } @@ -677,8 +679,8 @@ namespace BLL public static int GetEnterpriseTopicsMeetingNum() { var result = (from x in Funs.DB.Meeting_CompanySpecialMeeting - where x.CompileDate > Const.DtmarkTime - select x).Count(); + where x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } @@ -689,8 +691,8 @@ namespace BLL public static int GetCompanyLeadShiftCheckNum() { var result = (from x in Funs.DB.Supervise_SuperviseCheckReport - where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime - select x).Count(); + where x.CheckType == "1" && x.CheckDate > Const.DtmarkTime + select x).Count(); return result; } @@ -701,8 +703,8 @@ namespace BLL public static int GetCompanyComprehensiveCheckNum() { var result = (from x in Funs.DB.Supervise_SuperviseCheckReport - where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime - select x).Count(); + where x.CheckType == "2" && x.CheckDate > Const.DtmarkTime + select x).Count(); return result; } @@ -713,8 +715,8 @@ namespace BLL public static int GetCompanySpecialCheckNum() { var result = (from x in Funs.DB.Supervise_SuperviseCheckReport - where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime - select x).Count(); + where x.CheckType == "3" && x.CheckDate > Const.DtmarkTime + select x).Count(); return result; } @@ -725,9 +727,9 @@ namespace BLL public static int GetCompanyComprehensivePlanNum() { var result = (from x in Funs.DB.Emergency_EmergencyList_Unit - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime - select x).Count(); + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("综合") && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } @@ -738,9 +740,9 @@ namespace BLL public static int GetCompanySpecialPlanNum() { var result = (from x in Funs.DB.Emergency_EmergencyList_Unit - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime - select x).Count(); + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("专项") && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } @@ -751,9 +753,9 @@ namespace BLL public static int GetCompanyOnSiteDisposalPlan() { var result = (from x in Funs.DB.Emergency_EmergencyList_Unit - join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId - where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime - select x).Count(); + join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId + where y.EmergencyTypeName.Contains("现场处置") && x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } @@ -764,8 +766,8 @@ namespace BLL public static int GetCompanyDrillNum() { var result = (from x in Funs.DB.Emergency_DrillRecordList_Unit - where x.CompileDate > Const.DtmarkTime - select x).Count(); + where x.CompileDate > Const.DtmarkTime + select x).Count(); return result; } @@ -802,87 +804,87 @@ 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.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, - x.State, - x.CreateDate, - x.CreateMan - }; + select new + { + x.Id, + 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, + x.State, + x.CreateDate, + x.CreateMan + }; } #endregion 获取列表 diff --git a/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs b/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs index 850bf62b..9677c589 100644 --- a/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs +++ b/SGGL/BLL/ZHGL/DataSync/HSSEData_HiddenDangerDetailService.cs @@ -82,62 +82,67 @@ namespace BLL } public static void AddHSSEData_HiddenDangerDetail(Model.HSSEData_HiddenDangerDetail newtable) { - - Model.HSSEData_HiddenDangerDetail table = new Model.HSSEData_HiddenDangerDetail + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - Id = newtable.Id, - UnitId = newtable.UnitId, - CollCropCode = newtable.CollCropCode, - UnitName = newtable.UnitName, - ReportDate = newtable.ReportDate, - TypeName = newtable.TypeName, - TotalNum = newtable.TotalNum, - NeedRectifyNum = newtable.NeedRectifyNum, - }; - db.HSSEData_HiddenDangerDetail.InsertOnSubmit(table); - db.SubmitChanges(); + Model.HSSEData_HiddenDangerDetail table = new Model.HSSEData_HiddenDangerDetail + { + Id = newtable.Id, + UnitId = newtable.UnitId, + CollCropCode = newtable.CollCropCode, + UnitName = newtable.UnitName, + ReportDate = newtable.ReportDate, + TypeName = newtable.TypeName, + TotalNum = newtable.TotalNum, + NeedRectifyNum = newtable.NeedRectifyNum, + }; + db.HSSEData_HiddenDangerDetail.InsertOnSubmit(table); + db.SubmitChanges(); + } } public static void UpdateHSSEData_HiddenDangerDetail(Model.HSSEData_HiddenDangerDetail newtable) { - - Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.Id = newtable.Id; - 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.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == newtable.Id); + if (table != null) + { + table.Id = newtable.Id; + 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 DeleteHSSEData_HiddenDangerDetailById(string Id) { - - Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HSSEData_HiddenDangerDetail.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.HSSEData_HiddenDangerDetail table = db.HSSEData_HiddenDangerDetail.FirstOrDefault(x => x.Id == Id); + if (table != null) + { + db.HSSEData_HiddenDangerDetail.DeleteOnSubmit(table); + db.SubmitChanges(); + } } - } public static void DeleteHSSEData_HiddenDangerDetailByDate(DateTime? reportDate) { - - var table = db.HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); - db.SubmitChanges(); + var table = db.HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } } - } } diff --git a/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs b/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs index ba6f0cad..50a51306 100644 --- a/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs +++ b/SGGL/BLL/ZHGL/DataSync/Hazard_RealTimeDeviceService.cs @@ -136,124 +136,134 @@ namespace BLL public static void AddHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable) { - - Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - ID = newtable.ID, - UnitId = newtable.UnitId, - UnitName = newtable.UnitName, - HazardName = newtable.HazardName, - HazardLevel = newtable.HazardLevel, - DeviceCode = newtable.DeviceCode, - DeviceName = newtable.DeviceName, - DeviceType = newtable.DeviceType, - SphereType = newtable.SphereType, - TemperatureType = newtable.TemperatureType, - DesignTemperantureMax = newtable.DesignTemperantureMax, - DesignTemperantureMin = newtable.DesignTemperantureMin, - PressureType = newtable.PressureType, - DesignPressure = newtable.DesignPressure, - DesignPressureMax = newtable.DesignPressureMax, - Medium = newtable.Medium, - MediumForm = newtable.MediumForm, - MediumLevelMax = newtable.MediumLevelMax, - Reserves = newtable.Reserves, - StandardCode = newtable.StandardCode, - StandardName = newtable.StandardName, - StandardType = newtable.StandardType, - StandardDes = newtable.StandardDes, - MeasurementUnit = newtable.MeasurementUnit, - MeterMax = newtable.MeterMax, - MeterMin = newtable.MeterMin, - ThresholdLow1 = newtable.ThresholdLow1, - ThresholdLow2 = newtable.ThresholdLow2, - ThresholdMax1 = newtable.ThresholdMax1, - ThresholdMax2 = newtable.ThresholdMax2, - BitNum = newtable.BitNum, - DateTime = newtable.DateTime, - ProjectId = newtable.ProjectId, - Value = newtable.Value, - FactoryId = newtable.FactoryId, - ReportDate = newtable.ReportDate, - ReceiveDate = newtable.ReceiveDate, - }; - db.Hazard_RealTimeDevice.InsertOnSubmit(table); - db.SubmitChanges(); + Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice + { + ID = newtable.ID, + UnitId = newtable.UnitId, + UnitName = newtable.UnitName, + HazardName = newtable.HazardName, + HazardLevel = newtable.HazardLevel, + DeviceCode = newtable.DeviceCode, + DeviceName = newtable.DeviceName, + DeviceType = newtable.DeviceType, + SphereType = newtable.SphereType, + TemperatureType = newtable.TemperatureType, + DesignTemperantureMax = newtable.DesignTemperantureMax, + DesignTemperantureMin = newtable.DesignTemperantureMin, + PressureType = newtable.PressureType, + DesignPressure = newtable.DesignPressure, + DesignPressureMax = newtable.DesignPressureMax, + Medium = newtable.Medium, + MediumForm = newtable.MediumForm, + MediumLevelMax = newtable.MediumLevelMax, + Reserves = newtable.Reserves, + StandardCode = newtable.StandardCode, + StandardName = newtable.StandardName, + StandardType = newtable.StandardType, + StandardDes = newtable.StandardDes, + MeasurementUnit = newtable.MeasurementUnit, + MeterMax = newtable.MeterMax, + MeterMin = newtable.MeterMin, + ThresholdLow1 = newtable.ThresholdLow1, + ThresholdLow2 = newtable.ThresholdLow2, + ThresholdMax1 = newtable.ThresholdMax1, + ThresholdMax2 = newtable.ThresholdMax2, + BitNum = newtable.BitNum, + DateTime = newtable.DateTime, + ProjectId = newtable.ProjectId, + Value = newtable.Value, + FactoryId = newtable.FactoryId, + ReportDate = newtable.ReportDate, + ReceiveDate = newtable.ReceiveDate, + }; + db.Hazard_RealTimeDevice.InsertOnSubmit(table); + db.SubmitChanges(); + } } public static void AddBulkHazard_RealTimeDevice(List newtables) { - - db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables); - db.SubmitChanges(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables); + db.SubmitChanges(); + } } public static void UpdateHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable) { - - Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - table.ID = newtable.ID; - table.UnitId = newtable.UnitId; - table.UnitName = newtable.UnitName; - table.HazardName = newtable.HazardName; - table.HazardLevel = newtable.HazardLevel; - table.DeviceCode = newtable.DeviceCode; - table.DeviceName = newtable.DeviceName; - table.DeviceType = newtable.DeviceType; - table.SphereType = newtable.SphereType; - table.TemperatureType = newtable.TemperatureType; - table.DesignTemperantureMax = newtable.DesignTemperantureMax; - table.DesignTemperantureMin = newtable.DesignTemperantureMin; - table.PressureType = newtable.PressureType; - table.DesignPressure = newtable.DesignPressure; - table.DesignPressureMax = newtable.DesignPressureMax; - table.Medium = newtable.Medium; - table.MediumForm = newtable.MediumForm; - table.MediumLevelMax = newtable.MediumLevelMax; - table.Reserves = newtable.Reserves; - table.StandardCode = newtable.StandardCode; - table.StandardName = newtable.StandardName; - table.StandardType = newtable.StandardType; - table.StandardDes = newtable.StandardDes; - table.MeasurementUnit = newtable.MeasurementUnit; - table.MeterMax = newtable.MeterMax; - table.MeterMin = newtable.MeterMin; - table.ThresholdLow1 = newtable.ThresholdLow1; - table.ThresholdLow2 = newtable.ThresholdLow2; - table.ThresholdMax1 = newtable.ThresholdMax1; - table.ThresholdMax2 = newtable.ThresholdMax2; - table.BitNum = newtable.BitNum; - table.DateTime = newtable.DateTime; - table.ProjectId = newtable.ProjectId; - table.Value = newtable.Value; - table.FactoryId = newtable.FactoryId; - table.ReportDate = newtable.ReportDate; - table.ReceiveDate = newtable.ReceiveDate; - db.SubmitChanges(); + Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID); + if (table != null) + { + table.ID = newtable.ID; + table.UnitId = newtable.UnitId; + table.UnitName = newtable.UnitName; + table.HazardName = newtable.HazardName; + table.HazardLevel = newtable.HazardLevel; + table.DeviceCode = newtable.DeviceCode; + table.DeviceName = newtable.DeviceName; + table.DeviceType = newtable.DeviceType; + table.SphereType = newtable.SphereType; + table.TemperatureType = newtable.TemperatureType; + table.DesignTemperantureMax = newtable.DesignTemperantureMax; + table.DesignTemperantureMin = newtable.DesignTemperantureMin; + table.PressureType = newtable.PressureType; + table.DesignPressure = newtable.DesignPressure; + table.DesignPressureMax = newtable.DesignPressureMax; + table.Medium = newtable.Medium; + table.MediumForm = newtable.MediumForm; + table.MediumLevelMax = newtable.MediumLevelMax; + table.Reserves = newtable.Reserves; + table.StandardCode = newtable.StandardCode; + table.StandardName = newtable.StandardName; + table.StandardType = newtable.StandardType; + table.StandardDes = newtable.StandardDes; + table.MeasurementUnit = newtable.MeasurementUnit; + table.MeterMax = newtable.MeterMax; + table.MeterMin = newtable.MeterMin; + table.ThresholdLow1 = newtable.ThresholdLow1; + table.ThresholdLow2 = newtable.ThresholdLow2; + table.ThresholdMax1 = newtable.ThresholdMax1; + table.ThresholdMax2 = newtable.ThresholdMax2; + table.BitNum = newtable.BitNum; + table.DateTime = newtable.DateTime; + table.ProjectId = newtable.ProjectId; + table.Value = newtable.Value; + table.FactoryId = newtable.FactoryId; + table.ReportDate = newtable.ReportDate; + table.ReceiveDate = newtable.ReceiveDate; + db.SubmitChanges(); + } } - } public static void DeleteHazard_RealTimeDeviceById(string ID) { - - Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Hazard_RealTimeDevice.DeleteOnSubmit(table); - db.SubmitChanges(); + Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID); + if (table != null) + { + db.Hazard_RealTimeDevice.DeleteOnSubmit(table); + db.SubmitChanges(); + } } } public static void DeleteALLHazard_RealTimeDevice() { - if (db.Hazard_RealTimeDevice != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice); - db.SubmitChanges(); + if (db.Hazard_RealTimeDevice != null) + { + db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice); + db.SubmitChanges(); + } } } public static List GetHazard_RealTimeDeviceByDate(DateTime? reportDate) @@ -265,14 +275,15 @@ namespace BLL } public static void DeleteHazard_RealTimeDeviceByDate(DateTime? reportDate) { - - var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); - if (table != null) + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table); - db.SubmitChanges(); + var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); + if (table != null) + { + db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table); + db.SubmitChanges(); + } } - } } } \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs index d4be7285..d61e6bd7 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_CQMSDataService.cs @@ -156,47 +156,49 @@ namespace BLL /// 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(); + } } /// /// 修改 @@ -204,48 +206,49 @@ namespace BLL /// 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(); + } } - } /// /// 根据id删除 @@ -253,14 +256,16 @@ namespace BLL /// 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(); + } } - + } /// /// 根据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 /// 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 /// 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; } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs index 83f584cc..5c818867 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_DefectService.cs @@ -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 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 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(); 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)) diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs index 862989e1..5212a526 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HJGLData_HJGLService.cs @@ -105,64 +105,70 @@ namespace BLL return db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id); } - public static List GetProject_HJGLData_HJGLByProjectid (string Projectid) + public static List 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(); + } } - } /// /// 判断该项目的该日期是否统计数据 @@ -226,7 +232,7 @@ namespace BLL /// /// 项目id /// 数据类型 - 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; } /// @@ -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; } /// @@ -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; } diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs index ed78e015..e90d2e99 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs @@ -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 diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs index 7df3c5e8..3b097e5c 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HiddenDangerDetailService.cs @@ -114,9 +114,12 @@ namespace BLL } public static void AddBulkProject_HSSEData_HiddenDangerDetails(List 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 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(); foreach (var item in data) diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs index 189d7baa..66ce62e0 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_SYHSEData_SYHSEService.cs @@ -57,7 +57,7 @@ namespace BLL public static int count { get; - set; + set; } public static List 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 /// 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(); + } + } } /// /// 判断当天是否统计过数据 @@ -295,7 +300,7 @@ namespace BLL /// /// /// - 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); diff --git a/SGGL/BLL/ZHGL/DataSync/ServerService.cs b/SGGL/BLL/ZHGL/DataSync/ServerService.cs index 77ad9f81..ec2caa03 100644 --- a/SGGL/BLL/ZHGL/DataSync/ServerService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ServerService.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; namespace BLL { - public static class ServerService + public static class ServerService { public static Model.TokenItem GetCNCECToken() { @@ -30,18 +30,18 @@ namespace BLL Console.WriteLine(response.Content); var responeData = JsonConvert.DeserializeObject(response.Content.ToString()); TokenItem tokenItem = new TokenItem(); - if (responeData.code==1&&string .IsNullOrEmpty(responeData.message) ) + if (responeData.code == 1 && string.IsNullOrEmpty(responeData.message)) { var token = JsonConvert.DeserializeObject(responeData.data.ToString()); - tokenItem.Token=token.Token.ToString(); - tokenItem.ExpiryTime= token.ExpiryTime.ToString(); + tokenItem.Token = token.Token.ToString(); + tokenItem.ExpiryTime = token.ExpiryTime.ToString(); SysConstSetService.SetToken(tokenItem.Token); SysConstSetService.SetTokenExpirationTime(tokenItem.ExpiryTime); } return tokenItem; - + } - public static Model.ReturnData PushCNCEC(string JsonBody,string apiurl) + public static Model.ReturnData PushCNCEC(string JsonBody, string apiurl) { Model.ReturnData responeData = new Model.ReturnData(); string CNCECPath = SysConstSetService.CNCECPath; @@ -81,7 +81,7 @@ namespace BLL { //DateTime.Parse(SysConstSetService.CNCECTTokenExTime).AddMinutes(-10) > DateTime.Now tokenItem = GetCNCECToken(); - } + } else if (DateTime.Parse(SysConstSetService.CNCECTTokenExTime).AddMinutes(-10) < DateTime.Now) { tokenItem = GetCNCECToken(); diff --git a/SGGL/FineUIPro.Web/DataShow/Accident.aspx.cs b/SGGL/FineUIPro.Web/DataShow/Accident.aspx.cs index 97805417..20aea920 100644 --- a/SGGL/FineUIPro.Web/DataShow/Accident.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/Accident.aspx.cs @@ -1,12 +1,8 @@ using BLL; -using FineUIPro.Web.BaseInfo; -using Model; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; -using static NPOI.HSSF.Util.HSSFColor; namespace FineUIPro.Web.DataShow { @@ -27,7 +23,7 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); - this.Panel1.Title = "事故事件数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CD) + ")"; + this.Panel1.Title = "事故事件数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -50,7 +46,7 @@ namespace FineUIPro.Web.DataShow LEFT JOIN Base_Project AS Project ON Record.ProjectId = Project.ProjectId LEFT JOIN SitePerson_Person AS Person ON Person.PersonId = Record.PersonId LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Person.UnitId - WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + WHERE Record.AccidentDate>'2023-01-01' "; if (rbType.SelectedValue == "0") { @@ -67,7 +63,7 @@ namespace FineUIPro.Web.DataShow LEFT JOIN Sys_Const AS AccidentType ON AccidentType.ConstValue = Record.AccidentTypeId AND GroupId='AccidentReportRegistration' LEFT JOIN Base_Project AS Project ON Record.ProjectId = Project.ProjectId LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Record.UnitId - WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + WHERE Record.AccidentDate>'2023-01-01' "; if (rbType.SelectedValue == "2") { strSql += " AND Record.AccidentDegree ='1'"; diff --git a/SGGL/FineUIPro.Web/DataShow/Check.aspx.cs b/SGGL/FineUIPro.Web/DataShow/Check.aspx.cs index 520e56dd..7572cfe9 100644 --- a/SGGL/FineUIPro.Web/DataShow/Check.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/Check.aspx.cs @@ -1,12 +1,8 @@ -using Aspose.Words; -using BLL; +using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; -using System.Linq; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -28,7 +24,7 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); - this.Panel1.Title = "安全监督检查数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CD) + ")"; + this.Panel1.Title = "安全监督检查数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -43,7 +39,7 @@ namespace FineUIPro.Web.DataShow + @" FROM dbo.Supervise_SuperviseCheckReport AS S" + @" LEFT JOIN dbo.Base_Project AS P ON P.ProjectId=S.ProjectId" + @" LEFT JOIN dbo.Base_Unit AS U ON U.UnitId=S.UnitId" - + @" WHERE (P.ProjectState2 is null or P.ProjectState2 !=9) "; + + @" WHERE S.CheckDate >'2023-01-01' "; List listStr = new List(); strSql += " AND S.CheckType= @CheckType"; listStr.Add(new SqlParameter("@CheckType", this.rbCom.SelectedValue)); @@ -75,7 +71,7 @@ namespace FineUIPro.Web.DataShow ,CheckTeam= STUFF((SELECT ',' + UserName FROM dbo.Sys_User where PATINDEX('%,' + RTRIM(UserId) + ',%',',' +C.LeaderIds + ',')>0 FOR XML PATH('')), 1, 1,'') from Check_ProjectLeaderCheck AS C LEFT JOIN Base_Project AS P ON C.ProjectId =P.ProjectId - where (P.ProjectState2 is null or P.ProjectState2 !=9) "; + where 1=1 "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) { @@ -109,7 +105,7 @@ namespace FineUIPro.Web.DataShow LEFT JOIN Base_Project AS P ON C.ProjectId =P.ProjectId LEFT JOIN Sys_User AS U ON C.CheckManId=U.UserId LEFT JOIN Base_Unit AS Ut ON C.ResponsibleUnit=Ut.UnitId - where (P.ProjectState2 is null or P.ProjectState2 !=9) "; + where 1=1 "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) { @@ -142,7 +138,7 @@ namespace FineUIPro.Web.DataShow ,UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +(C.PartInUnits) + ',')>0 FOR XML PATH('')), 1, 1,'') from Check_CheckSpecial AS C LEFT JOIN Base_Project AS P ON C.ProjectId =P.ProjectId - where (P.ProjectState2 is null or P.ProjectState2 !=9) "; + where 1=1 "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) { diff --git a/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx b/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx index 41853985..f77eca1d 100644 --- a/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx +++ b/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx @@ -17,7 +17,7 @@ diff --git a/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx.cs b/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx.cs index 708fff47..95173fb7 100644 --- a/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/CompanyPerson.aspx.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { @@ -21,9 +20,9 @@ namespace FineUIPro.Web.DataShow { Funs.DropDownPageSize(this.ddlPageSize); ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); - // 绑定表格t + // 绑定表格 BindGrid(); - this.Panel1.Title = "企业总部/分支机构安全人员(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CD) + ")"; + this.Panel1.Title = "企业总部/分支机构安全人员(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } diff --git a/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx.cs b/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx.cs index c4ff5224..9df7a078 100644 --- a/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/ConstructionEquipment.aspx.cs @@ -1,5 +1,4 @@ using BLL; -using Model; using System; using System.Collections.Generic; using System.Data; @@ -26,7 +25,7 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); - this.Panel1.Title = "施工机具设备(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CD) + ")"; + this.Panel1.Title = "施工机具设备(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -45,14 +44,14 @@ namespace FineUIPro.Web.DataShow LEFT JOIN InApproveManager_EquipmentIn AS EQ ON EQ.EquipmentInId = Item.EquipmentInId LEFT JOIN Base_SpecialEquipment AS SPE ON Item.SpecialEquipmentId = SPE.SpecialEquipmentId LEFT JOIN Base_Project AS P ON EQ.ProjectId = P.ProjectId - LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = EQ.UnitId where (P.ProjectState2 is null or P.ProjectState2 !=9) + LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = EQ.UnitId UNION ALL SELECT Item.GeneralEquipmentInItemId AS ID,EQ.ProjectId,P.ProjectCode,P.ProjectName,EQ.UnitId,Unit.UnitName,Item.SpecialEquipmentId ,SPE.SpecialEquipmentName,Item.SizeModel,Item.OwnerCheck,Item.CertificateNum,Item.IsUsed,EQ.CompileDate,'一般设备' AS EQType FROM InApproveManager_GeneralEquipmentInItem AS Item LEFT JOIN InApproveManager_GeneralEquipmentIn AS EQ ON EQ.GeneralEquipmentInId = Item.GeneralEquipmentInId LEFT JOIN Base_SpecialEquipment AS SPE ON Item.SpecialEquipmentId = SPE.SpecialEquipmentId LEFT JOIN Base_Project AS P ON EQ.ProjectId = P.ProjectId - LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = EQ.UnitId where (P.ProjectState2 is null or P.ProjectState2 !=9)) V + LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = EQ.UnitId ) V WHERE 1=1 "; strSql += " AND V.IsUsed = @IsUsed"; diff --git a/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx b/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx index 70b9c3a5..c28d9b5d 100644 --- a/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx +++ b/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx @@ -8,6 +8,21 @@ 教育培训 +
@@ -20,7 +35,7 @@ SortField="ProjectCode,TrainStartDate" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" - EnableTextSelection="True"> + EnableTextSelection="True" EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx.cs b/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx.cs index 591d0c4b..ed8dbfd5 100644 --- a/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/EduTrain.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -23,6 +24,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + //加载合计 + OutputSummaryData(); this.Panel1.Title = "安全教育(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -41,7 +44,7 @@ namespace FineUIPro.Web.DataShow from EduTrain_TrainRecord AS TrainRecord LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId - WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) and TrainRecord.TrainStartDate >'2023-01-01' "; strSql += " AND TrainType.TrainType =@TrainType"; listStr.Add(new SqlParameter("@TrainType", this.rbType.SelectedValue)); @@ -67,6 +70,9 @@ namespace FineUIPro.Web.DataShow var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; Grid1.DataBind(); + + + } #endregion @@ -79,6 +85,7 @@ namespace FineUIPro.Web.DataShow protected void TextBox_TextChanged(object sender, EventArgs e) { this.BindGrid(); + this.OutputSummaryData(); } #endregion @@ -156,5 +163,39 @@ namespace FineUIPro.Web.DataShow { EditData(); } + + #region 合计 + private void OutputSummaryData() + { + string strSql = string.Empty; + List listStr = new List(); + + strSql = @"select TrainRecord.TrainingId,TrainRecord.TrainTitle,TrainType.TrainTypeName,Project.ProjectId,Project.ProjectCode,Project.ProjectName + ,TrainRecord.TrainStartDate,TrainRecord.TrainEndDate,TrainRecord.TrainPersonNum,TrainRecord.UnitIds + ,UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +TrainRecord.UnitIds + ',')>0 FOR XML PATH('')), 1, 1,'') + from EduTrain_TrainRecord AS TrainRecord + LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId + LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId + WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + + strSql += " AND TrainType.TrainType =@TrainType"; + listStr.Add(new SqlParameter("@TrainType", this.rbType.SelectedValue)); + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int renshu = 0; + foreach (DataRow row in tb.Rows) + { + renshu += Convert.ToInt32(row["TrainPersonNum"]); + } + + + JObject summary = new JObject(); + summary.Add("UnitName", "合计:"); + summary.Add("TrainPersonNum", renshu.ToString()); + + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/Emergency.aspx b/SGGL/FineUIPro.Web/DataShow/Emergency.aspx index bdaa7d11..29a4dbac 100644 --- a/SGGL/FineUIPro.Web/DataShow/Emergency.aspx +++ b/SGGL/FineUIPro.Web/DataShow/Emergency.aspx @@ -8,6 +8,21 @@ 应急信息 + @@ -107,7 +122,8 @@ runat="server" BoxFlex="1" DataKeyNames="DrillRecordListId" DataIDField="DrillRecordListId" AllowSorting="true" SortField="DrillRecordDate" SortDirection="DESC" OnSort="Grid2_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid2_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid2_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid2_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/Emergency.aspx.cs b/SGGL/FineUIPro.Web/DataShow/Emergency.aspx.cs index c2cb4d0f..62f1a75c 100644 --- a/SGGL/FineUIPro.Web/DataShow/Emergency.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/Emergency.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -67,7 +68,7 @@ namespace FineUIPro.Web.DataShow FROM Emergency_EmergencyList_Unit AS Em LEFT JOIN Base_Unit AS Unit ON Em.UnitId=Unit.UnitId LEFT JOIN Base_EmergencyType AS EmergencyType ON Em.EmergencyTypeId=EmergencyType.EmergencyTypeId - LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE 1=1 "; + LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE Em.CompileDate >'2023-01-01' "; List listStr = new List(); if (!string.IsNullOrEmpty(this.txtStartTime.Text)) { @@ -98,7 +99,7 @@ namespace FineUIPro.Web.DataShow LEFT JOIN Base_Unit AS Unit ON Em.UnitId=Unit.UnitId LEFT JOIN Base_Project AS Project ON Em.ProjectId=Project.ProjectId LEFT JOIN Base_EmergencyType AS EmergencyType ON Em.EmergencyTypeId=EmergencyType.EmergencyTypeId - LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE 1=1 "; + LEFT JOIN Sys_User AS Users ON Em.CompileMan=Users.UserId WHERE Em.CompileDate >'2023-01-01' "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) { @@ -246,6 +247,9 @@ namespace FineUIPro.Web.DataShow Grid2.DataSource = table; Grid2.DataBind(); this.Grid2.Columns[1].Hidden = true; + + //加载合计 + OutputSummaryData("A"); } else if (this.rbCom.SelectedValue == "1") { @@ -283,6 +287,9 @@ namespace FineUIPro.Web.DataShow Grid2.DataSource = table; Grid2.DataBind(); this.Grid2.Columns[1].Hidden = true; + + //加载合计 + OutputSummaryData("B"); } } @@ -354,5 +361,58 @@ namespace FineUIPro.Web.DataShow } #endregion + + #region 合计 + private void OutputSummaryData(string type) + { + DataTable tb = new DataTable(); + if (type == "A") + { + string strSql = @"SELECT List.DrillRecordListId + ,DrillRecordType.ConstText AS DrillRecordTypeName,List.JointPersonNum,List.DrillCost + ,List.DrillRecordName,List.DrillRecordDate + ,List.UnitIds,List.UnitNames + ,List.States + FROM Emergency_DrillRecordList_Unit AS List + LEFT JOIN Sys_Const AS DrillRecordType ON DrillRecordType.ConstValue = List.DrillRecordType + and DrillRecordType.GroupId='DrillRecordType' + WHERE 1=1 "; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + tb = SQLHelper.GetDataTableRunText(strSql, parameter); + } + else { + string strSql = @"SELECT List.DrillRecordListId,List.ProjectId,Project.PostCode,Project.ProjectName + ,DrillRecordType.ConstText AS DrillRecordTypeName,List.JointPersonNum,List.DrillCost + ,List.DrillRecordName,List.DrillRecordDate + ,List.UnitIds,List.UnitNames + ,List.States + FROM Emergency_DrillRecordList AS List + LEFT JOIN Base_Project AS Project ON List.Projectid = Project.ProjectId + LEFT JOIN Sys_Const AS DrillRecordType ON DrillRecordType.ConstValue = List.DrillRecordType + and DrillRecordType.GroupId='DrillRecordType' + WHERE 1=1 "; + List listStr = new List(); + + + SqlParameter[] parameter = listStr.ToArray(); + tb = SQLHelper.GetDataTableRunText(strSql, parameter); + } + int JointPersonNum = 0; + double DrillCost = 0.0f; + + foreach (DataRow row in tb.Rows) + { + JointPersonNum += Convert.ToInt32(row["JointPersonNum"]); + DrillCost += Convert.ToDouble(row["DrillCost"]); + } + + JObject summary = new JObject(); + summary.Add("UnitNames", "合计:"); + summary.Add("JointPersonNum", JointPersonNum.ToString()); + summary.Add("DrillCost", DrillCost.ToString("F2")); + Grid2.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/Environmental.aspx b/SGGL/FineUIPro.Web/DataShow/Environmental.aspx index 73d5adbc..0e23bead 100644 --- a/SGGL/FineUIPro.Web/DataShow/Environmental.aspx +++ b/SGGL/FineUIPro.Web/DataShow/Environmental.aspx @@ -61,7 +61,7 @@ - '2023-01-01' "; } else { @@ -55,7 +54,7 @@ namespace FineUIPro.Web.DataShow ,(SELECT ThisYearValue FROM Environmental_ArchitectureReportItem WHERE SortIndex='38' AND ArchitectureReportId=Report.ArchitectureReportId) AS CO2 FROM Environmental_ArchitectureReport AS Report - WHERE 1=1 "; + WHERE Report.FillingDate >'2023-01-01' "; } if (!string.IsNullOrEmpty(this.txtStartTime.Text)) { diff --git a/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx b/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx index c688b99f..a2e0afbc 100644 --- a/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx +++ b/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx @@ -8,6 +8,21 @@ 缺陷分析 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ID" DataIDField="ID" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableTextSelection="True"> + EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx.cs b/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx.cs index 30a8f956..6bddb13e 100644 --- a/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx.cs @@ -1,10 +1,9 @@ using BLL; -using FineUIPro.Web.BaseInfo; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { @@ -25,6 +24,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + //合计 + OutputSummaryData(); this.Panel1.Title = "焊接缺陷数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -36,11 +37,11 @@ namespace FineUIPro.Web.DataShow ///
private void BindGrid() { - string strSql = @"SELECT NEWID() AS ID,Project.ProjectId,Project.ProjectCode,Project.ProjectName,Defects_Definition,COUNT(Item.CHT_CheckItemID) AS Counts + string strSql = @"SELECT NEWID() AS ID,Project.ProjectId,Project.ProjectName,Project.ProjectCode,Defects_Definition,COUNT(Item.CHT_CheckItemID) AS Counts FROM CH_CheckItem AS Item LEFT JOIN CH_Check AS Checks ON Item.CHT_CheckID =Checks.CHT_CheckID LEFT JOIN Base_Project AS Project ON Checks.ProjectId =Project.ProjectId - WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) and Checks.CHT_CheckDate >'2023-01-01' "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) @@ -123,5 +124,31 @@ namespace FineUIPro.Web.DataShow BindGrid(); } #endregion + + #region 合计 + private void OutputSummaryData() { + string strSql = @"SELECT NEWID() AS ID,Project.ProjectId,Project.ProjectName,Project.ProjectCode,Defects_Definition,COUNT(Item.CHT_CheckItemID) AS Counts + FROM CH_CheckItem AS Item + LEFT JOIN CH_Check AS Checks ON Item.CHT_CheckID =Checks.CHT_CheckID + LEFT JOIN Base_Project AS Project ON Checks.ProjectId =Project.ProjectId + WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + + List listStr = new List(); + strSql += " GROUP BY Project.ProjectId,Project.ProjectName,Project.ProjectCode,Defects_Definition"; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + int Counts = 0; + + foreach (DataRow row in tb.Rows) + { + Counts += Convert.ToInt32(row["Counts"]); + } + JObject summary = new JObject(); + summary.Add("Defects_Definition", "合计:"); + summary.Add("Counts", Counts.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/HJGLWelder.aspx.cs b/SGGL/FineUIPro.Web/DataShow/HJGLWelder.aspx.cs index 73b3c999..dcdfca65 100644 --- a/SGGL/FineUIPro.Web/DataShow/HJGLWelder.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/HJGLWelder.aspx.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { @@ -41,7 +40,7 @@ namespace FineUIPro.Web.DataShow LEFT JOIN Base_Project AS Project ON Welder.ProjectId = Project.ProjectId LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Welder.WED_Unit LEFT JOIN ProjectData_TeamGroup AS TeamGroup ON TeamGroup.TeamGroupId = Welder.TeamGroupId - WHERE (Project.ProjectState2 is null or Project.ProjectState2 !=9) and (Welder.WederType='1' OR Welder.WederType is null) AND Welder.ProjectId IS NOT NULL "; + WHERE (Welder.WederType='1' OR Welder.WederType is null) AND Welder.ProjectId IS NOT NULL"; List listStr = new List(); if (this.drpProject.SelectedValue !=Const._Null) { diff --git a/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx b/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx index 130abdcf..1983254b 100644 --- a/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx +++ b/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx @@ -8,6 +8,21 @@ 焊接数据 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> @@ -68,7 +84,7 @@ - + diff --git a/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx.cs b/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx.cs index 2c8fffb2..bd35314b 100644 --- a/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/HJGLWelding.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + // 合计 + OutputSummaryData(); this.Panel1.Title = "焊接数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -35,7 +38,7 @@ namespace FineUIPro.Web.DataShow ///
private void BindGrid() { - string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1 and (isDelete IS NULL OR isDelete =0) "; + string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; List listStr = new List(); string cpara = string.Empty; if (this.drpProject.SelectedValue != Const._Null) @@ -277,5 +280,39 @@ namespace FineUIPro.Web.DataShow } return cout1; } + + #region 合计 + private void OutputSummaryData() { + string strSql = @"select ProjectId,ProjectCode, ProjectName, + isnull((select sum(JOT_Size) from PW_JointInfo as A where A.ProjectId=P.ProjectId ),0) as count1, + isnull((select sum(JOT_DoneDin) from PW_JointInfo as B where B.ProjectId=P.ProjectId ),0) as count2, + isnull((select sum(CHT_TotalFilm) from CH_CheckItem C left join CH_Check D on C.CHT_CheckID=D.CHT_CheckID + WHERE D.ProjectId=P.ProjectId),0) AS count3, + isnull((select sum(CHT_PassFilm) from CH_CheckItem E left join CH_Check F on E.CHT_CheckID=F.CHT_CheckID + WHERE F.ProjectId=P.ProjectId),0) AS count4 + from Base_Project as P + where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + List listStr = new List(); + string cpara = string.Empty; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + int count1 = 0, count2 = 0, count3 = 0, count4 = 0; + foreach (DataRow row in tb.Rows) + { + count1 += Convert.ToInt32(row["count1"]); + count2 += Convert.ToInt32(row["count2"]); + count3 += Convert.ToInt32(row["count3"]); + count4 += Convert.ToInt32(row["count4"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", count1.ToString()); + summary.Add("Count2", count2.ToString()); + summary.Add("Count3", count3.ToString()); + summary.Add("Count4", count4.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx b/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx index 7709b046..3e489164 100644 --- a/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx +++ b/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx @@ -8,6 +8,21 @@ 隐患排查 + @@ -17,9 +32,10 @@ + SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" + IsDatabasePaging="False" PageSize="20" ForceFit="true" + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> @@ -51,7 +67,7 @@ - + diff --git a/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx.cs b/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx.cs index fc970fb7..8ef1ead6 100644 --- a/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/HiddenRectification.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -9,7 +10,9 @@ namespace FineUIPro.Web.DataShow { public partial class HiddenRectification : PageBase { - + private int AllCount1 = 0; + private int AllCount2 = 0; + private int AllCount3 = 0; #region 加载页面 /// /// 加载页面 @@ -25,6 +28,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + //合计 + // OutputSummaryData(); this.Panel1.Title = "隐患排查治理数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -62,8 +67,9 @@ namespace FineUIPro.Web.DataShow DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); Grid1.RecordCount = tb.Rows.Count; var table = this.GetPagedDataTable(Grid1, tb); - Grid1.DataSource = table; + Grid1.DataSource = tb; Grid1.DataBind(); + OutputSummaryData(); } #endregion @@ -75,6 +81,9 @@ namespace FineUIPro.Web.DataShow /// protected void TextBox_TextChanged(object sender, EventArgs e) { + AllCount1 = 0; + AllCount2 = 0; + AllCount3= 0; this.BindGrid(); } #endregion @@ -154,7 +163,7 @@ namespace FineUIPro.Web.DataShow { EditData(); } - + /// /// 数量 /// @@ -166,8 +175,8 @@ namespace FineUIPro.Web.DataShow if (projectId != null) { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); - var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "4"); + var datetime2 = Funs.GetNewDateTime(this.txtEndTime.Text); + var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "4" && x.RegisterDate > Funs.minSysDate && x.ProblemTypes == "1"); if (datetime1.HasValue) { getT = getT.Where(x => x.RegisterDate >= datetime1); @@ -186,6 +195,36 @@ namespace FineUIPro.Web.DataShow } cout1 = getT.Count(); } + + AllCount1 += cout1; + return cout1; + } + protected int CountALL(object projectId) + { + int cout1 = 0; + if (projectId != null) + { + var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); + var datetime2 = Funs.GetNewDateTime(this.txtEndTime.Text); + var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "4" && x.RegisterDate > Funs.minSysDate && x.ProblemTypes == "1"); + if (datetime1.HasValue) + { + getT = getT.Where(x => x.RegisterDate >= datetime1); + } + if (datetime2.HasValue) + { + getT = getT.Where(x => x.RegisterDate <= datetime2); + } + if (this.rbType.SelectedValue == "0") + { + getT = getT.Where(x => x.Risk_Level == "重大"); + } + else + { + getT = getT.Where(x => x.Risk_Level == "一般"); + } + cout1 = getT.Count(); + } return cout1; } @@ -195,8 +234,8 @@ namespace FineUIPro.Web.DataShow if (projectId != null) { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); - var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States == "3"); + var datetime2 = Funs.GetNewDateTime(this.txtEndTime.Text); + var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States == "3" && x.RegisterDate > Funs.minSysDate && x.ProblemTypes=="1"); if (datetime1.HasValue) { getT = getT.Where(x => x.RegisterDate >= datetime1); @@ -215,17 +254,46 @@ namespace FineUIPro.Web.DataShow } cout1 = getT.Count(); } + + AllCount2 += cout1; + return cout1; + } + protected int CountOk(object projectId) + { + int cout1 = 0; + if (projectId != null) + { + var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); + var datetime2 = Funs.GetNewDateTime(this.txtEndTime.Text); + var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States == "3" && x.RegisterDate > Funs.minSysDate && x.ProblemTypes == "1"); + if (datetime1.HasValue) + { + getT = getT.Where(x => x.RegisterDate >= datetime1); + } + if (datetime2.HasValue) + { + getT = getT.Where(x => x.RegisterDate <= datetime2); + } + if (this.rbType.SelectedValue == "0") + { + getT = getT.Where(x => x.Risk_Level == "重大"); + } + else + { + getT = getT.Where(x => x.Risk_Level == "一般"); + } + cout1 = getT.Count(); + } return cout1; } - protected int Count3(object projectId) { int cout1 = 0; if (projectId != null) { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); - var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "3" && x.States != "4"); + var datetime2 = Funs.GetNewDateTime(this.txtEndTime.Text); + var getT = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "3" && x.States != "4" && x.RegisterDate > Funs.minSysDate && x.ProblemTypes == "1"); if (datetime1.HasValue) { getT = getT.Where(x => x.RegisterDate >= datetime1); @@ -244,6 +312,7 @@ namespace FineUIPro.Web.DataShow } cout1 = getT.Count(); } + AllCount3 += cout1; return cout1; } @@ -252,28 +321,8 @@ namespace FineUIPro.Web.DataShow string rate = string.Empty; if (projectId != null) { - var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); - var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getALL = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId == projectId.ToString() && x.States != "4"); - if (this.rbType.SelectedValue == "0") - { - getALL = getALL.Where(x => x.Risk_Level == "重大"); - } - else - { - getALL = getALL.Where(x => x.Risk_Level == "一般"); - } - if (datetime1.HasValue) - { - getALL = getALL.Where(x => x.RegisterDate >= datetime1); - } - if (datetime2.HasValue) - { - getALL = getALL.Where(x => x.RegisterDate >= datetime1); - } - var getT = getALL.Where(x => x.ProjectId == projectId.ToString() && x.States == "3"); - int coutall = getALL.Count(); - int cout0 = getT.Count(); + int coutall = CountALL(projectId); + int cout0 = CountOk(projectId); if (coutall > 0) { rate = Math.Round(cout0 * 1.0 / coutall * 100, 2).ToString(); @@ -281,5 +330,40 @@ namespace FineUIPro.Web.DataShow } return rate; } + + #region 合计数据(不根据条件改变) + public void OutputSummaryData() + { + //string strSql = @"select ProjectId,ProjectCode, ProjectName,isnull(count1,0) as count1,isnull(count2,0) as count2,isnull(count3,0) as count3 from Base_Project f + //left join(select count(*) as count1,ProjectId as ProjectIda from HSSE_Hazard_HazardRegister + //where states <> 4 and Risk_Level= '" + this.rbType.SelectedItem.Text + @"' and RegisterDate > '2023-01-01' + //group by ProjectId) a + //on f.ProjectId = a.ProjectIda + + //left join(select count(*) as count2,ProjectId as ProjectIdb from HSSE_Hazard_HazardRegister + //where states = 3 and Risk_Level= '" + this.rbType.SelectedItem.Text + @"' and RegisterDate > '2023-01-01' + //group by ProjectId) b + //on f.ProjectId = b.ProjectIdb + + //left join(select count(*) as count3,ProjectId as ProjectIdc from HSSE_Hazard_HazardRegister + //where states <> 3 and states<>4 and Risk_Level= '" + this.rbType.SelectedItem.Text + @"' and RegisterDate > '2023-01-01' + //group by ProjectId) c + //on f.ProjectId = c.ProjectIdc + + //where ProjectState = 1 and(isDelete IS NULL OR isDelete = 0)"; + //List listStr = new List(); + //SqlParameter[] parameter = listStr.ToArray(); + //DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", AllCount1.ToString()); + summary.Add("Count2", AllCount2.ToString()); + summary.Add("Count3", AllCount3.ToString()); + summary.Add("Count4", (float.Parse(AllCount2.ToString()) / float.Parse(AllCount1.ToString()) *100).ToString("F2")); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/HiddenRectificationItem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/HiddenRectificationItem.aspx.cs index 0314bba3..c49cb772 100644 --- a/SGGL/FineUIPro.Web/DataShow/HiddenRectificationItem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/HiddenRectificationItem.aspx.cs @@ -1,13 +1,9 @@ -using Aspose.Words; -using BLL; -using Org.BouncyCastle.Asn1.Ocsp; +using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; using System.Linq; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -64,7 +60,7 @@ namespace FineUIPro.Web.DataShow /// private void BindGrid() { - string strSql = "SELECT * FROM View_Hazard_HazardRegister WHERE ProblemTypes in ('1' ,'2') "; + string strSql = "SELECT * FROM View_Hazard_HazardRegister WHERE ProblemTypes ='1' and CheckTime > '2023-01-01' "; List listStr = new List(); strSql += " AND ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"])); @@ -168,7 +164,7 @@ namespace FineUIPro.Web.DataShow var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString()); if (registration != null) { - url = BLL.UploadAttachmentService.ShowImage("../", registration.ImageUrl); + url = BLL.UploadAttachmentService.ShowImage(httpUrl, registration.ImageUrl); } } return url; @@ -194,7 +190,7 @@ namespace FineUIPro.Web.DataShow var registration = BLL.HSSE_Hazard_HazardRegisterService.GetHazardRegisterByHazardRegisterId(registrationId.ToString()); if (registration != null) { - url = BLL.UploadAttachmentService.ShowImage("../", registration.RectificationImageUrl); + url = BLL.UploadAttachmentService.ShowImage(httpUrl, registration.RectificationImageUrl); } } return url; diff --git a/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx b/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx index 852d10e2..032969e3 100644 --- a/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx +++ b/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx @@ -8,6 +8,21 @@ 危大工程 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx.cs b/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx.cs index 80b4e0f0..d19c0441 100644 --- a/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/LargeEngineering.aspx.cs @@ -1,13 +1,10 @@ -using Aspose.Words; -using BLL; +using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; using System.Linq; -using System.ServiceModel.Configuration; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -28,23 +25,25 @@ namespace FineUIPro.Web.DataShow ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); LargerHazard = (from x in Funs.DB.Solution_LargerHazard - join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 - select x).ToList(); + join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId + where y.ProjectState == Const.ProjectState_1 && x.RecordTime > Funs.minSysDate + select x).ToList(); // 绑定表格t BindGrid(); + // 合计 + OutputSummaryData(); this.Panel1.Title = "危大工程数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } - public static List LargerHazard = new List(); + public static List LargerHazard = new List(); /// /// 绑定数据 /// private void BindGrid() { - string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where ProjectState =1 and (isDelete IS NULL OR isDelete =0) "; List listStr = new List(); string cpara = string.Empty; if (this.drpProject.SelectedValue != Const._Null) @@ -143,7 +142,7 @@ namespace FineUIPro.Web.DataShow PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("LargeEngineeringItem.aspx?projectId={0}", Grid1.SelectedRowID, "查看 - "))); } #endregion - + /// /// /// @@ -154,7 +153,6 @@ namespace FineUIPro.Web.DataShow EditData(); } - /// /// 获取危大工程数 /// @@ -162,10 +160,10 @@ namespace FineUIPro.Web.DataShow /// protected int Count1(object projectId) { - int cout1 = 0; + int cout1 = 0; if (projectId != null) { - cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && x.IsSuperLargerHazard == false).Count(); + cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && x.IsSuperLargerHazard == false ).Count(); } return cout1; } @@ -225,7 +223,7 @@ namespace FineUIPro.Web.DataShow int cout1 = 0; if (projectId != null) { - cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString()).Sum(x=>x.TrainPersonNum ?? 0); + cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString()).Sum(x => x.TrainPersonNum ?? 0); } return cout1; } @@ -244,5 +242,42 @@ namespace FineUIPro.Web.DataShow } return cout1; } + + #region 合计 + private void OutputSummaryData() + { + string strSql = @"select P.ProjectId,P.ProjectCode, P.ProjectName, + isnull((select count(*) from Solution_LargerHazard as a where a.ProjectId=P.ProjectId and a.IsSuperLargerHazard=0 ),0) as Count1, + isnull((select count(*) from Solution_LargerHazard as b where b.ProjectId=P.ProjectId and b.IsSuperLargerHazard=1 ),0) as Count2, + isnull((select count(*) from Solution_LargerHazard as c where c.ProjectId=P.ProjectId and c.States='2' ),0) as Count3, + isnull((select count(*) from Solution_LargerHazard as d where d.ProjectId=P.ProjectId and d.States='1' ),0) as Count4, + isnull((select sum(TrainPersonNum) from Solution_LargerHazard as e where e.ProjectId=P.ProjectId ),0) as Count5, + isnull((select count(*) from Solution_LargerHazard as f where f.ProjectId=P.ProjectId and f.States='3' ),0) as Count6 + from Base_Project AS P + where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0, Count2 = 0, Count3 = 0, Count4 = 0, Count5 = 0, Count6 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + Count2 += Convert.ToInt32(row["Count2"]); + Count3 += Convert.ToInt32(row["Count3"]); + Count4 += Convert.ToInt32(row["Count4"]); + Count5 += Convert.ToInt32(row["Count5"]); + Count6 += Convert.ToInt32(row["Count6"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + summary.Add("Count2", Count2.ToString()); + summary.Add("Count3", Count3.ToString()); + summary.Add("Count4", Count4.ToString()); + summary.Add("Count5", Count5.ToString()); + summary.Add("Count6", Count6.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/LargeEngineeringItem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/LargeEngineeringItem.aspx.cs index ebce4a3f..a7654c98 100644 --- a/SGGL/FineUIPro.Web/DataShow/LargeEngineeringItem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/LargeEngineeringItem.aspx.cs @@ -1,13 +1,8 @@ -using Aspose.Words; -using BLL; -using Org.BouncyCastle.Asn1.Ocsp; +using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; -using System.Linq; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -48,7 +43,7 @@ namespace FineUIPro.Web.DataShow FROM Solution_LargerHazard AS L LEFT JOIN Sys_User AS Users ON L.RecardMan=Users.UserId LEFT JOIN Sys_Const AS Const ON L.HazardType=Const.ConstValue and Const.GroupId='LargerHazardType' - LEFT JOIN Sys_CodeRecords AS CodeRecords ON L.HazardId=CodeRecords.DataId WHERE 1=1 "; + LEFT JOIN Sys_CodeRecords AS CodeRecords ON L.HazardId=CodeRecords.DataId WHERE L.RecordTime >'2023-01-01' "; List listStr = new List(); strSql += " AND L.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"])); diff --git a/SGGL/FineUIPro.Web/DataShow/License.aspx.cs b/SGGL/FineUIPro.Web/DataShow/License.aspx.cs index e4d9b980..6268700c 100644 --- a/SGGL/FineUIPro.Web/DataShow/License.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/License.aspx.cs @@ -1,10 +1,8 @@ using BLL; -using Model; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { @@ -41,7 +39,7 @@ namespace FineUIPro.Web.DataShow ,V.WorkAreaName,V.CompileDate,V.StartDate,V.EndDate,V.WorkStatesStr,V.LicenseTypeId,V.UnitId,V.LicenseManageContents ,V.CompileMan,V.CompileDate,V.States,V.UserName FROM View_License_LicenseManager AS V - WHERE 1=1"; + WHERE V.CompileDate > '2023-01-01' "; if (this.rbType.SelectedValue=="2") { strSql += " AND V.WorkStates = @WorkStates"; diff --git a/SGGL/FineUIPro.Web/DataShow/Meeting.aspx.cs b/SGGL/FineUIPro.Web/DataShow/Meeting.aspx.cs index b8aa965b..b27435e8 100644 --- a/SGGL/FineUIPro.Web/DataShow/Meeting.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/Meeting.aspx.cs @@ -1,12 +1,8 @@ -using Aspose.Words; -using BLL; +using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; -using System.Linq; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -44,7 +40,7 @@ namespace FineUIPro.Web.DataShow ,MeetingHostMan AS HostMan,Meeting.AttentPersonNum,Meeting.AttentPerson FROM Meeting_CompanySafetyMeeting AS Meeting LEFT JOIN Sys_User AS Users ON Meeting.MeetingHostMan=Users.UserId - where 1=1 "; + where Meeting.CompanySafetyMeetingDate > '2023-01-01' "; List listStr = new List(); if (!string.IsNullOrEmpty(this.txtStartTime.Text)) { @@ -72,7 +68,7 @@ namespace FineUIPro.Web.DataShow ,MeetingHostMan AS HostMan,Meeting.AttentPersonNum,Meeting.AttentPerson FROM Meeting_CompanySpecialMeeting AS Meeting LEFT JOIN Sys_User AS Users ON Meeting.MeetingHostMan=Users.UserId - where 1=1 "; + where Meeting.CompanySpecialMeetingDate > '2023-01-01' "; List listStr = new List(); if (!string.IsNullOrEmpty(this.txtStartTime.Text)) { @@ -100,7 +96,7 @@ namespace FineUIPro.Web.DataShow FROM Meeting_SafetyLeaderGroupMeeting AS Meeting LEFT JOIN Sys_User AS Users ON Meeting.MeetingHostMan=Users.UserId LEFT JOIN Base_Project AS Project ON Meeting.ProjectId=Project.ProjectId - where (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + where Meeting.SafetyLeaderGroupMeetingDate > '2023-01-01' "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) { @@ -134,14 +130,14 @@ namespace FineUIPro.Web.DataShow ,MeetingHostMan AS HostMan,Meeting.AttentPersonNum,Meeting.AttentPerson FROM Meeting_MonthMeeting AS Meeting LEFT JOIN Sys_User AS Users ON Meeting.MeetingHostMan=Users.UserId - LEFT JOIN Base_Project AS Project ON Meeting.ProjectId=Project.ProjectId where (Project.ProjectState2 is null or Project.ProjectState2 !=9) + LEFT JOIN Base_Project AS Project ON Meeting.ProjectId=Project.ProjectId union all SELECT Project.ProjectId,Project.ProjectName,Meeting.WeekMeetingId AS ID,Meeting.WeekMeetingName AS MeetingName,Meeting.WeekMeetingDate AS MeetingDate,Meeting.MeetingHours ,MeetingHostMan AS HostMan,Meeting.AttentPersonNum,Meeting.AttentPerson FROM Meeting_WeekMeeting AS Meeting LEFT JOIN Sys_User AS Users ON Meeting.MeetingHostMan=Users.UserId - LEFT JOIN Base_Project AS Project ON Meeting.ProjectId=Project.ProjectId where (Project.ProjectState2 is null or Project.ProjectState2 !=9)) V - where 1=1 "; + LEFT JOIN Base_Project AS Project ON Meeting.ProjectId=Project.ProjectId ) V + where V.MeetingDate > '2023-01-01' "; List listStr = new List(); if (this.drpProject.SelectedValue != Const._Null) { diff --git a/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx b/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx index c2370ebe..49d391c4 100644 --- a/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx +++ b/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx @@ -8,6 +8,21 @@ 工程划分 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableTextSelection="True"> + EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx.cs b/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx.cs index 054e8a7d..fa2f35c4 100644 --- a/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/ProjectDivision.aspx.cs @@ -1,10 +1,9 @@ using BLL; -using FineUIPro.Web.BaseInfo; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { @@ -25,6 +24,9 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + + //合计 + OutputSummaryData(); this.Panel1.Title = "工程划分数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -124,5 +126,40 @@ namespace FineUIPro.Web.DataShow BindGrid(); } #endregion + + #region 合计 + private void OutputSummaryData() { + string strSql = @"SELECT P.ProjectId,P.ProjectCode,P.ProjectName + ,(SELECT COUNT(*) FROM Project_Installation AS A WHERE A.ProjectId =P.ProjectId AND A.SuperInstallationId='0') AS count1 + ,(SELECT COUNT(*) FROM WBS_UnitWork AS B WHERE B.ProjectId =P.ProjectId) AS count2 + ,(SELECT COUNT(*) FROM WBS_DivisionProject AS C WHERE C.ProjectId =P.ProjectId AND C.SubItemType= '1') AS count3 + ,(SELECT COUNT(*) FROM WBS_DivisionProject AS D WHERE D.ProjectId =P.ProjectId AND D.SubItemType= '3') AS count4 + ,(SELECT COUNT(*) FROM WBS_BreakdownProject AS E WHERE E.ProjectId =P.ProjectId ) AS count5 + FROM Base_Project AS P + WHERE P.ProjectState = 1 "; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + int count1 =0, count2=0, count3=0, count4=0, count5 = 0; + + foreach (DataRow row in tb.Rows) + { + count1 += Convert.ToInt32(row["count1"]); + count2 += Convert.ToInt32(row["count2"]); + count3 += Convert.ToInt32(row["count3"]); + count4 += Convert.ToInt32(row["count4"]); + count5 += Convert.ToInt32(row["count5"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("count1", count1.ToString()); + summary.Add("count2", count2.ToString()); + summary.Add("count3", count3.ToString()); + summary.Add("count4", count4.ToString()); + summary.Add("count5", count5.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx b/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx index 7106d883..0a523a85 100644 --- a/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx +++ b/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx @@ -28,7 +28,7 @@ EnableEdit="true" OnSelectedIndexChanged="TextBox_TextChanged" AutoPostBack="true"> - diff --git a/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx.cs b/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx.cs index a3cb1d85..c1b3c75a 100644 --- a/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/ProjectPerson.aspx.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { diff --git a/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx b/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx index 3f85e96f..1a19780d 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx +++ b/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx @@ -8,25 +8,40 @@ 质量验收 + + ShowHeader="true" Layout="VBox" BoxConfigAlign="Stretch"> + EnableTextSelection="True" EnableSummary="true" SummaryPosition="Bottom"> - diff --git a/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs index ec0ed140..c2946e57 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityAcceptance.aspx.cs @@ -1,5 +1,6 @@ using BLL; using FineUIPro.Web.BaseInfo; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,7 +26,10 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); - this.Panel1.Title = "质量验收数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CD) + ")"; + + // 合计 + + this.Panel1.Title = "质量验收数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } #endregion @@ -65,6 +69,7 @@ namespace FineUIPro.Web.DataShow var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; Grid1.DataBind(); + OutputSummaryData(); } #region 查询 @@ -128,6 +133,7 @@ namespace FineUIPro.Web.DataShow private static IQueryable getDataItemLists = from x in Funs.DB.ProcessControl_InspectionManagementDetail join y in Funs.DB.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId join z in Funs.DB.WBS_BreakdownProject on x.ControlPointType equals z.BreakdownProjectId + where x.CreateDate > Funs.minSysDate select new Model.QualityAcceptanceItem { InspectionDetailId = x.InspectionDetailId, @@ -204,5 +210,51 @@ namespace FineUIPro.Web.DataShow } return rate; } + + #region 合计 + private void OutputSummaryData() + { + string strSql = @"select a.ProjectId,a.ProjectCode, a.ProjectName,a.UnitId,isnull(Count1,0) as Count1, + isnull(Count2,0) as Count2 + from Base_Project a + + left join (select count(*) as Count1,z.ProjectId From ProcessControl_InspectionManagementDetail x + left join ProcessControl_InspectionManagement y on x.InspectionId=y.InspectionId + left join WBS_BreakdownProject z on x.ControlPointType=z.BreakdownProjectId group by z.ProjectId) as b + on a.ProjectId= b.ProjectId + + left join (select count(*) as Count2,z.ProjectId,IsOnceQualified From ProcessControl_InspectionManagementDetail x + left join ProcessControl_InspectionManagement y on x.InspectionId=y.InspectionId + left join WBS_BreakdownProject z on x.ControlPointType=z.BreakdownProjectId + group by z.ProjectId,y.IsOnceQualified) as c + on a.ProjectId= c.ProjectId and IsOnceQualified=1 + + where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + List listStr = new List(); + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0, Count2 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + Count2 += Convert.ToInt32(row["Count2"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + summary.Add("Count2", Count2.ToString()); + summary.Add("Count3", (Count1- Count2).ToString()); + if (Count1 > 0) + { + summary.Add("Count4", Math.Round(Count2 * 1.0 / Count1 * 100, 2).ToString()); + } + else + { + summary.Add("Count4", "0"); + } + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx b/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx index 265ec4f9..fc3037d9 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx +++ b/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx @@ -8,6 +8,21 @@ 质量控制点 + @@ -19,7 +34,7 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableTextSelection="True"> + EnableTextSelection="True" EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx.cs index 3eda4848..2c310759 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityControlPoint.aspx.cs @@ -1,5 +1,5 @@ using BLL; -using FineUIPro.Web.BaseInfo; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +25,9 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + // 合计 + OutputSummaryData(); + this.Panel1.Title = "质量控制点数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -196,5 +199,35 @@ namespace FineUIPro.Web.DataShow return count; } + + #region 合计 + private void OutputSummaryData() { + string strSql = @"select ProjectId,ProjectCode, ProjectName, + isnull((select count(*) from WBS_BreakdownProject as a where a.ProjectId=P.ProjectId and a.Class LIKE'%S%'),0) as Count1, + isnull((select count(*) from WBS_BreakdownProject as a where a.ProjectId=P.ProjectId and a.Class LIKE'%A%'),0) as Count2, + isnull((select count(*) from WBS_BreakdownProject as a where a.ProjectId=P.ProjectId and a.Class LIKE'%B%'),0) as Count3, + isnull((select count(*) from WBS_BreakdownProject as a where a.ProjectId=P.ProjectId and a.Class LIKE'%C%'),0) as Count4 + from Base_Project as P + where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0, Count2 = 0, Count3 = 0, Count4 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + Count2 += Convert.ToInt32(row["Count2"]); + Count3 += Convert.ToInt32(row["Count3"]); + Count4 += Convert.ToInt32(row["Count4"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + summary.Add("Count2", Count2.ToString()); + summary.Add("Count3", Count3.ToString()); + summary.Add("Count4", Count4.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx b/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx index e40542b6..11d995fd 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx +++ b/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx @@ -8,6 +8,21 @@ 计量器具 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx.cs index 5a0597c2..bf0df920 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityInstruments.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,10 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + + // 合计 + OutputSummaryData(); + this.Panel1.Title = "计量器具数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -170,7 +175,8 @@ namespace FineUIPro.Web.DataShow var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); var getD1 = from x in Funs.DB.Comprehensive_InspectionMachine - where x.ProjectId == projectId.ToString() && x.IsOnSite == true && x.InspectionType.Contains("计量") + where x.ProjectId == projectId.ToString() && x.IsOnSite == true && x.InspectionType.Contains("计量") + // && x.CompileDate == Funs.minSysDate select x; if (datetime1.HasValue) { @@ -200,6 +206,7 @@ namespace FineUIPro.Web.DataShow var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); var getD1 = from x in Funs.DB.Comprehensive_InspectionMachine where x.ProjectId == projectId.ToString() && x.IsOnSite == true && x.InspectionType.Contains("计量") && x.IsCheckOK == true + // && x.CompileDate == Funs.minSysDate select x; if (datetime1.HasValue) { @@ -214,5 +221,28 @@ namespace FineUIPro.Web.DataShow } return cout1; } + + #region 合计 + private void OutputSummaryData() { + string strSql = @"select ProjectId,ProjectCode, ProjectName , + isnull((select count(*) from Comprehensive_InspectionMachine as a where a.ProjectId=P.ProjectId and a.IsOnSite=1 and a.InspectionType like '%计量%' ),0) as Count1, + isnull((select count(*) from Comprehensive_InspectionMachine as a where a.ProjectId=P.ProjectId and a.IsOnSite=1 and a.InspectionType like '%计量%' and a.IsCheckOK=1 ),0) as Count2 + from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0, Count2 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + Count2 += Convert.ToInt32(row["Count2"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + summary.Add("Count2", Count2.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/QualityPerson.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityPerson.aspx.cs index 364fb786..5ef61917 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityPerson.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityPerson.aspx.cs @@ -57,11 +57,11 @@ namespace FineUIPro.Web.DataShow } else { - strSql = @"SELECT Person.PersonId AS ID,Unit.UnitName,Project.ProjectName,Person.PersonName,case Person.Sex when '1' then '男' else '女' end as SexStr,Person.IdentityCard,WorkPost.WorkPostName,Person.Telephone,Person.Remark + strSql = @"SELECT Person.PersonId AS ID,Unit.UnitName,Project.ProjectName,Person.PersonName,case Person.Sex when '1' then '男' when '2' then '女' else '男' end as SexStr,Person.IdentityCard,WorkPost.WorkPostName,Person.Telephone,Person.Remark FROM SitePerson_Person AS Person LEFT JOIN Base_Project AS Project ON Project.ProjectId=Person.ProjectId LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=Person.UnitId - LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId=WorkPost.WorkPostId WHERE WorkPost.IsCQMS=1 and (Project.ProjectState2 is null or Project.ProjectState2 !=9) "; + LEFT JOIN Base_WorkPost AS WorkPost ON Person.WorkPostId=WorkPost.WorkPostId WHERE WorkPost.IsCQMS=1 "; if (this.drpProject.SelectedValue != Const._Null) { strSql += " AND Person.ProjectId = @ProjectId"; diff --git a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx index bad0f3fc..1d9de93f 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx +++ b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx @@ -8,6 +8,21 @@ 质量问题 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs index ff6692f8..9c87253d 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityProblem.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,10 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + + // 合计 + OutputSummaryData(); + this.Panel1.Title = "质量问题治理数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -167,7 +172,7 @@ namespace FineUIPro.Web.DataShow { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString()); + var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.CheckDate > Funs.minSysDate ); if (datetime1.HasValue) { getT = getT.Where(x => x.CheckDate >= datetime1); @@ -189,7 +194,7 @@ namespace FineUIPro.Web.DataShow { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State == "7"); + var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State == "7" && x.CheckDate > Funs.minSysDate); if (datetime1.HasValue) { getT = getT.Where(x => x.CheckDate >= datetime1); @@ -211,7 +216,7 @@ namespace FineUIPro.Web.DataShow { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State != "7"); + var getT = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.State != "7" && x.CheckDate > Funs.minSysDate); if (datetime1.HasValue) { getT = getT.Where(x => x.CheckDate >= datetime1); @@ -232,7 +237,7 @@ namespace FineUIPro.Web.DataShow { var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text); var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); - var getALL = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString()); + var getALL = Funs.DB.Check_CheckControl.Where(x => x.ProjectId == projectId.ToString() && x.CheckDate > Funs.minSysDate ); if (datetime1.HasValue) { @@ -252,5 +257,32 @@ namespace FineUIPro.Web.DataShow } return rate; } + + #region 合计 + private void OutputSummaryData() { + string strSql = @"select ProjectId,ProjectCode, ProjectName, + isnull((select count(*) from Check_CheckControl as a where a.ProjectId=p.ProjectId and a.CheckDate > '2023-01-01' ),0) as Count1, + isnull((select count(*) from Check_CheckControl as a where a.ProjectId=p.ProjectId and a.state='7' and a.CheckDate > '2023-01-01' ),0) as Count2, + isnull((select count(*) from Check_CheckControl as a where a.ProjectId=p.ProjectId and a.state<>'7' and a.CheckDate > '2023-01-01' ),0) as Count3 + from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0, Count2 = 0, Count3 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + Count2 += Convert.ToInt32(row["Count2"]); + Count3 += Convert.ToInt32(row["Count3"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + summary.Add("Count2", Count2.ToString()); + summary.Add("Count3", Count3.ToString()); + summary.Add("Count4", Count1 == 0 ? "0" : Math.Round(Count2 * 1.0 / Count1 * 100, 2).ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/QualityProblemItem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityProblemItem.aspx.cs index 7c557531..6a244205 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityProblemItem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityProblemItem.aspx.cs @@ -1,13 +1,9 @@ -using Aspose.Words; -using BLL; -using Org.BouncyCastle.Asn1.Ocsp; +using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; using System.Linq; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -49,7 +45,7 @@ namespace FineUIPro.Web.DataShow left join Base_CNProfessional cNProfessional on cNProfessional.CNProfessionalId=chec.CNProfessionalCode left join WBS_UnitWork unitWork on unitWork.UnitWorkId = chec.UnitWorkId left join Base_QualityQuestionType QualityQuestionType on QualityQuestionType.QualityQuestionTypeId = chec.QuestionType - WHERE 1=1 "; + WHERE chec.CheckDate > '2023-01-01' "; List listStr = new List(); strSql += " AND chec.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"])); @@ -150,7 +146,7 @@ namespace FineUIPro.Web.DataShow if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png")) AttachUrl += item.AttachUrl.TrimEnd(',') + ","; } - url = BLL.UploadAttachmentService.ShowImage("../", AttachUrl.TrimEnd(',')); + url = BLL.UploadAttachmentService.ShowImage(httpUrl, AttachUrl.TrimEnd(',')); } } return url; @@ -176,7 +172,7 @@ namespace FineUIPro.Web.DataShow if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png")) AttachUrl += item.AttachUrl.TrimEnd(',') + ","; } - url = BLL.UploadAttachmentService.ShowImage("../", AttachUrl.TrimEnd(',')); + url = BLL.UploadAttachmentService.ShowImage(httpUrl, AttachUrl.TrimEnd(',')); } } return url; diff --git a/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx b/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx index 3e3a4487..64f4cfd7 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx +++ b/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx @@ -8,6 +8,21 @@ 质量培训 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx.cs index 0e23f042..82ee4884 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityTraining.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,9 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + + // 合计 + OutputSummaryData(); this.Panel1.Title = "质量培训数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -77,6 +81,7 @@ namespace FineUIPro.Web.DataShow protected void TextBox_TextChanged(object sender, EventArgs e) { this.BindGrid(); + this.OutputSummaryData(); } #endregion @@ -177,7 +182,7 @@ namespace FineUIPro.Web.DataShow var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); if (this.rbCom.SelectedValue == "1") { - var getT = Funs.DB.Comprehensive_InspectionPerson.Where(x => x.ProjectId == projectId.ToString() && x.IsTrain == true); + var getT = Funs.DB.Comprehensive_InspectionPerson.Where(x => x.ProjectId == projectId.ToString() && x.IsTrain == true && x.CompileDate >Funs.minSysDate); if (datetime1.HasValue) { getT = getT.Where(x => x.CompileDate >= datetime1); @@ -190,7 +195,7 @@ namespace FineUIPro.Web.DataShow } else { - var getT = Funs.DB.Comprehensive_DesignDetails.Where(x => x.ProjectId == projectId.ToString()); + var getT = Funs.DB.Comprehensive_DesignDetails.Where(x => x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate); if (datetime1.HasValue) { getT = getT.Where(x => x.CompileDate >= datetime1); @@ -207,5 +212,37 @@ namespace FineUIPro.Web.DataShow } return cout1; } + + #region 合计 + private void OutputSummaryData() { + string strSql = ""; + if (this.rbCom.SelectedValue == "1") + { + strSql= @"select ProjectId,ProjectCode, ProjectName, + isnull((select count(*) from Comprehensive_InspectionPerson as a + where a.ProjectId=P.ProjectId and a.IsTrain=1 and a.CompileDate > '2023-01-01' ),0) as Count1 + from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + } + else { + strSql = @"select ProjectId,ProjectCode, ProjectName, + isnull((select sum(JoinPersonNum) from Comprehensive_DesignDetails as a + where a.ProjectId=P.ProjectId and a.CompileDate > '2023-01-01' ),0) as Count1 + from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9) "; + } + + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem1.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem1.aspx.cs index 8c39359f..a962bcda 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem1.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem1.aspx.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; namespace FineUIPro.Web.DataShow { @@ -44,7 +43,7 @@ namespace FineUIPro.Web.DataShow left join Base_Unit U on C.UnitId=U.UnitId left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId left join Base_WorkPost P on C.PostId=P.WorkPostId - where C.ProjectId = @ProjectId"; + where C.ProjectId = @ProjectId and C.CompileDate > '2023-01-01' "; List listStr = new List(); strSql += " AND C.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"])); diff --git a/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem2.aspx.cs b/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem2.aspx.cs index d3804e28..581419c1 100644 --- a/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem2.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/QualityTrainingItem2.aspx.cs @@ -40,7 +40,7 @@ namespace FineUIPro.Web.DataShow UnitName, AttachUrl, CompileMan, CN.ProfessionalName from Comprehensive_DesignDetails C left join Base_CNProfessional CN on C.CNProfessionalId=CN.CNProfessionalId - where C.ProjectId = @ProjectId"; + where C.ProjectId = @ProjectId and C.DetailsDate > '2023-01-01'"; List listStr = new List(); strSql += " AND C.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"])); diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx b/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx index a2a29f6e..2222df9d 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx +++ b/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx @@ -8,6 +8,21 @@ 安全费用 + @@ -20,7 +35,8 @@ SortField="Months" SortDirection="DESC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" - EnableTextSelection="True"> + EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx.cs b/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx.cs index 65f04b4b..14ff8d00 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/SecurityCost.aspx.cs @@ -1,5 +1,6 @@ using BLL; using Model; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + // 合计 + OutputSummaryData(); this.Panel1.Title = "安全费用(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -43,7 +46,7 @@ namespace FineUIPro.Web.DataShow FROM CostGoods_CostSmallDetail as cost left join Base_Project as p on cost.ProjectId =p.ProjectId left join Base_Unit as Unit on cost.UnitId =Unit.UnitId - WHERE (p.ProjectState2 is null or p.ProjectState2 !=9) "; + WHERE cost.CompileDate > '2023-01-01'and (p.ProjectState2 is null or p.ProjectState2 !=9) "; if (this.drpProject.SelectedValue != Const._Null) { @@ -155,5 +158,32 @@ namespace FineUIPro.Web.DataShow { EditData(); } + + #region 合计 + private void OutputSummaryData() { + string strSql = string.Empty; + List listStr = new List(); + + strSql = @"SELECT cost.CostSmallDetailId, p.ProjectId,p.ProjectCode,p.ProjectName,cost.UnitId,Unit.UnitName,cost.Months + ,(CAST((SELECT SUM(ISNULL(CostMoney,0)) FROM CostGoods_CostSmallDetailItem + WHERE CostSmallDetailId=cost.CostSmallDetailId) *1.0 /10000 as decimal(18, 2) ))AS SUMCost + FROM CostGoods_CostSmallDetail as cost + left join Base_Project as p on cost.ProjectId =p.ProjectId + left join Base_Unit as Unit on cost.UnitId =Unit.UnitId + WHERE (p.ProjectState2 is null or p.ProjectState2 !=9) and cost.CompileDate > '2023-01-01'"; + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + float SUMCost = 0.0f; + + foreach (DataRow row in tb.Rows) + { + SUMCost += float.Parse(row["SUMCost"].ToString()); + } + JObject summary = new JObject(); + summary.Add("Months", "合计:"); + summary.Add("SUMCost", SUMCost.ToString("F2")); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx index 263a3878..9f7934e9 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx +++ b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx @@ -8,6 +8,21 @@ 安全风险 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs index 490605d3..83ca623a 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs @@ -1,5 +1,6 @@ using BLL; using FineUIPro.Web.BaseInfo; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + // 合计 + OutputSummaryData(); this.Panel1.Title = "安全风险数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -216,17 +219,13 @@ namespace FineUIPro.Web.DataShow } return cout1; } - /// - /// 定义变量 - /// - private static IQueryable getDataLists = from x in Funs.DB.Hazard_HazardList - select x; + /// /// 定义变量 /// private static IQueryable getDataItemLists = from x in Funs.DB.Hazard_HazardSelectedItem - where x.IsStart == true - select x; + where x.IsStart == true + select x; /// /// /// @@ -239,10 +238,40 @@ namespace FineUIPro.Web.DataShow var getlevel = Funs.DB.Base_RiskLevel.FirstOrDefault(x => x.RiskLevel == level); if (getlevel != null) { - count = getDataItemLists.Where(x => x.ProjectId == projectId && x.HazardLevel == getlevel.RiskLevelId).Count(); + string levels = getlevel.RiskLevel.ToString(); + count = getDataItemLists.Where(x => x.ProjectId == projectId&& x.HazardLevel== levels).Count(); } return count; } + + #region 合计 + private void OutputSummaryData() { + string strSql = @"select ProjectId,ProjectCode, ProjectName , + isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='1'),0) as Count1, + isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='2' ),0) as Count2, + isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='3'),0) as Count3, + isnull((select count(*) from Hazard_HazardSelectedItem as a where a.IsStart=1 and a.ProjectId=p.ProjectId and a.HazardLevel='4'),0) as Count4 + from Base_Project as P where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9)"; + List listStr = new List(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + int Count1 = 0, Count2 = 0, Count3 = 0, Count4 = 0; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToInt32(row["Count1"]); + Count2 += Convert.ToInt32(row["Count2"]); + Count3 += Convert.ToInt32(row["Count3"]); + Count4 += Convert.ToInt32(row["Count4"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString()); + summary.Add("Count2", Count2.ToString()); + summary.Add("Count3", Count3.ToString()); + summary.Add("Count4", Count4.ToString()); + Grid1.SummaryData = summary; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityRiskItem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/SecurityRiskItem.aspx.cs index 8dd16bf0..48d85e0f 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityRiskItem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/SecurityRiskItem.aspx.cs @@ -1,15 +1,8 @@ -using Aspose.Words; -using BLL; -using FineUIPro.Web.BaseInfo; -using Model; -using Org.BouncyCastle.Asn1.Ocsp; +using BLL; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.IO; -using System.Linq; -using System.Text; namespace FineUIPro.Web.DataShow { @@ -44,7 +37,7 @@ namespace FineUIPro.Web.DataShow { string strSql = @"select Item.HazardSelectedItemId,Item.HazardListId,List.IdentificationDate,List.WorkAreaName,Item.WorkStage,Item.HazardListTypeId , Item.HazardListTypeId,Item.HazardId,Item.HazardItems,Item.DefectsType,Item.MayLeadAccidents - ,Item.HelperMethod,Item.HazardJudge_L,Item.HazardJudge_E,Item.HazardJudge_C,Item.HazardJudge_E + ,Item.HelperMethod,Item.HazardJudge_L,Item.HazardJudge_E,Item.HazardJudge_C,HazardJudge_D,Item.HazardJudge_E ,level.RiskLevelName,Item.ControlMeasures from Hazard_HazardSelectedItem AS Item LEFT JOIN Hazard_HazardList AS List on List.HazardListId = Item.HazardListId diff --git a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx index 15b9bc4f..0484b8aa 100644 --- a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx +++ b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx @@ -8,6 +8,21 @@ 安全工时 + @@ -19,7 +34,8 @@ runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true" - EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"> + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True" + EnableSummary="true" SummaryPosition="Bottom"> diff --git a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs index 7b0244b2..8c0bc493 100644 --- a/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/WorkingHours.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); // 绑定表格t BindGrid(); + // 合计 + OutputSummaryData(); this.Panel1.Title = "工时数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")"; } } @@ -171,7 +174,7 @@ namespace FineUIPro.Web.DataShow var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); var getD1 = from x in Funs.DB.SitePerson_DayReport join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 + where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate select x; if (datetime1.HasValue) { @@ -207,11 +210,11 @@ namespace FineUIPro.Web.DataShow var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); var getD1 = from x in Funs.DB.Accident_AccidentHandle join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 + where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate select x; var getD2 = from x in Funs.DB.Accident_AccidentReport join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 + where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate select x; if (datetime1.HasValue) { @@ -249,16 +252,16 @@ namespace FineUIPro.Web.DataShow var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text); var getC1 = from x in Funs.DB.SitePerson_DayReport join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 + where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate select x; var getD1 = from x in Funs.DB.Accident_AccidentHandle join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 + where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate select x; var getD2 = from x in Funs.DB.Accident_AccidentReport join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId - where y.ProjectState == Const.ProjectState_1 + where y.ProjectState == Const.ProjectState_1 && x.ProjectId == projectId.ToString() && x.CompileDate > Funs.minSysDate select x; if (datetime1.HasValue) @@ -294,5 +297,38 @@ namespace FineUIPro.Web.DataShow return cout1; } + #region 合计 + private void OutputSummaryData() + { + string strSql = @" select ProjectId,ProjectCode, ProjectName, + isnull((select sum(PersonWorkTime) + from SitePerson_DayReport x + left join(select PersonWorkTime,DayReportId from SitePerson_DayReportDetail) y on x.DayReportId=y.DayReportId + where x.ProjectId=p.ProjectId and x.CompileDate >'2023-01-01'),0) as count1, + isnull((select sum(WorkHoursLoss) from Accident_AccidentHandle a where a.ProjectId=p.ProjectId and a.AccidentDate >'2023-01-01'),0) as count2, + isnull((select sum(WorkingHoursLoss) from Accident_AccidentReport a where a.ProjectId=p.ProjectId and a.AccidentDate >'2023-01-01'),0) as count3 + from Base_Project as P + where ProjectState =1 and (ProjectState2 is null or ProjectState2 !=9)"; + List listStr = new List(); + + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + double Count1 = 0.0f, Count2 = 0.0f, Count3 = 0.0f; + foreach (DataRow row in tb.Rows) + { + Count1 += Convert.ToDouble(row["Count1"]); + Count2 += Convert.ToDouble(row["Count2"]); + Count3 += Convert.ToDouble(row["Count3"]); + } + JObject summary = new JObject(); + summary.Add("ProjectName", "合计:"); + summary.Add("Count1", Count1.ToString("f2")); + summary.Add("Count2", (Count2+Count3).ToString("f2")); + summary.Add("Count3", (Count1- Count2- Count3).ToString("f2")); + Grid1.SummaryData = summary; + + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/DataShow/WorkingHoursItem.aspx.cs b/SGGL/FineUIPro.Web/DataShow/WorkingHoursItem.aspx.cs index ee757905..edf57c4c 100644 --- a/SGGL/FineUIPro.Web/DataShow/WorkingHoursItem.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/WorkingHoursItem.aspx.cs @@ -36,7 +36,7 @@ namespace FineUIPro.Web.DataShow ///
private void BindGrid() { - string strSql = @"select DayReportId,CompileDate,ProjectId from SitePerson_DayReport WHERE 1=1 "; + string strSql = @"select DayReportId,CompileDate,ProjectId from SitePerson_DayReport WHERE CompileDate > '2023-01-01' "; List listStr = new List(); strSql += " AND ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"])); diff --git a/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs b/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs new file mode 100644 index 00000000..5d467e30 --- /dev/null +++ b/SGGL/WebAPI/Controllers/DataSync/CNCECServerController.cs @@ -0,0 +1,224 @@ +using BLL; +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; +using System.Web.Mvc; + +namespace WebAPI.Controllers +{ + /// + /// 上报集团数据接口 + /// + public class CNCECServerController : ApiController + { + /// + /// 获取质量统计数据 + /// + /// + public Model.ReturnData PostGetCQMSData() + { + var returnData = new Model.ReturnData(); + returnData.type = "CQMS"; + returnData.time = DateTime.Now.ToString(); + ServerService.GetToken(); + returnData.token = BLL.SysConstSetService.CNCECToken; + returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; + if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime)&& DateTime.Parse(returnData.expiryTime)>DateTime.Now) + { + returnData.data = CQMSDataService.GetTodayCQMSData_CQMS(); + } + else + { + returnData.code = 500; + returnData.message = "token失效"; + } + return returnData; + } + /// + /// 获取质量统计数据成功后,回调通知上报成功 + /// + /// + /// + public Model.ReturnData PostGetCQMSData_CallBalk([FromBody] CQMSData data) + { + var returnData = new Model.ReturnData(); + try + { + returnData.type = "CQMS_Back"; + returnData.time = DateTime.Now.ToString(); + foreach (var item in data.CQMSDataItems) + { + var cQMSData_CQMS= CQMSDataService.GetCQMSData_CQMSById(item.Id); + cQMSData_CQMS.State = Const.CNCEC_State_S; + CQMSDataService.UpdateCQMSData_CQMS(cQMSData_CQMS); + } + + } + catch (Exception ex) + { + + returnData.code = 404; + returnData.message = ex.ToString(); + } + return returnData; + } + /// + /// 获取焊接统计数据 + /// + /// + public Model.ReturnData PostGetHJGLData() + { + var returnData = new Model.ReturnData(); + returnData.type = "HJGL"; + returnData.time = DateTime.Now.ToString(); + ServerService.GetToken(); + returnData.token = BLL.SysConstSetService.CNCECToken; + returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; + if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime)&&DateTime.Parse(returnData.expiryTime) > DateTime.Now) + { + returnData.data = HJGLData_HJGLService.GetTodayHJGLData_HJGL(); + } + else + { + returnData.code = 500; + returnData.message = "token失效"; + } + return returnData; + } + /// + /// 获取焊接统计数据 成功后,回调通知上报成功 + /// + /// + /// + public Model.ReturnData PostGetHJGLData_CallBalk([FromBody] Model.HJGLData data) + { + var returnData = new Model.ReturnData(); + try + { + returnData.type = "HJGL_Back"; + returnData.time = DateTime.Now.ToString(); + foreach (var item in data.HJGLDataItems) + { + var hJGLData_HJGL = HJGLData_HJGLService.GetHJGLData_HJGLById(item.Id); + hJGLData_HJGL.State = Const.CNCEC_State_S; + HJGLData_HJGLService.UpdateHJGLData_HJGL(hJGLData_HJGL); + } + } + catch (Exception ex) + { + + returnData.code = 404; + returnData.message = ex.ToString(); + } + return returnData; + } + /// + /// 获取安全统计数据 + /// + /// + public Model.ReturnData PostGetHSSEData() + { + var returnData = new Model.ReturnData(); + returnData.type = "HSSE"; + returnData.time = DateTime.Now.ToString(); + ServerService.GetToken(); + returnData.token = BLL.SysConstSetService.CNCECToken; + returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; + if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime) && DateTime.Parse(returnData.expiryTime) > DateTime.Now) + { + returnData.data = HSSEData_HSSEService.GetTodayHSSEData_HSSE(); + } + else + { + returnData.code = 500; + returnData.message = "token失效"; + } + return returnData; + } + /// + /// 获取安全统计数据成功后,回调通知上报成功 + /// + /// + /// + public Model.ReturnData PostGetHSSEData_CallBalk([FromBody] HSSEData data) + { + var returnData = new Model.ReturnData(); + try + { + returnData.type = "HSSE_Back"; + returnData.time = DateTime.Now.ToString(); + + foreach (var item in data.HSSEDataItems) + { + var hSSEData_HSSE = HSSEData_HSSEService.GetHSSEData_HSSEById(item.Id); + hSSEData_HSSE.State = Const.CNCEC_State_S; + HSSEData_HSSEService.UpdateHSSEData_HSSE(hSSEData_HSSE); + } + } + catch (Exception ex) + { + + returnData.code = 404; + returnData.message = ex.ToString(); + } + return returnData; + } + + /// + /// 获取实业统计数据 + /// + /// + public Model.ReturnData PostGetSYHSEData() + { + var returnData = new Model.ReturnData(); + returnData.type = "SYHSE"; + returnData.time = DateTime.Now.ToString(); + ServerService.GetToken(); + returnData.token = BLL.SysConstSetService.CNCECToken; + returnData.expiryTime = BLL.SysConstSetService.CNCECTTokenExTime; + if (!string.IsNullOrEmpty(returnData.token) && !string.IsNullOrEmpty(returnData.expiryTime) && DateTime.Parse(returnData.expiryTime) > DateTime.Now) + { + returnData.data = SYHSEData_SYHSEService.GetTodaySYHSEData_SYHSE(); + } + else + { + returnData.code = 500; + returnData.message = "token失效"; + } + return returnData; + } + /// + /// 获取实业统计数据成功后,回调通知上报成功 + /// + /// + /// + public Model.ReturnData PostGetSYHSEData_CallBalk([FromBody] SYHSEData data) + { + var returnData = new Model.ReturnData(); + try + { + returnData.type = "SYHSE_Back"; + returnData.time = DateTime.Now.ToString(); + foreach (var item in data.SYHSEDataItems) + { + var sYHSEData_SYHSE = SYHSEData_SYHSEService.GetSYHSEData_SYHSEById(item.Id); + sYHSEData_SYHSE.State = Const.CNCEC_State_S; + SYHSEData_SYHSEService.UpdateSYHSEData_SYHSE(sYHSEData_SYHSE); + } + //SYHSEData_SYHSE data = _data; + //data.State = Const.CNCEC_State_S; + //SYHSEData_SYHSEService.UpdateSYHSEData_SYHSE(data); + } + catch (Exception ex) + { + + returnData.code = 404; + returnData.message = ex.ToString(); + } + return returnData; + } + } +} \ No newline at end of file diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index 18909607..b0187b89 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -220,6 +220,7 @@ +