提交代码

This commit is contained in:
2024-12-24 19:04:32 +08:00
parent 2e3c34c38c
commit 189a020cc7
78 changed files with 9689 additions and 2214 deletions
+154 -95
View File
@@ -1,4 +1,5 @@
using FineUIPro;
using BLL.CNCECHSSEService;
using FineUIPro;
using Model;
using Newtonsoft.Json;
using NPOI.POIFS.Crypt.Dsig;
@@ -95,59 +96,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();
}
}
}
@@ -236,7 +289,59 @@ namespace BLL
select x).FirstOrDefault();
return q;
}
public static CQMSData_CQMS GetSubUnitCqmsDataByDate(string Unitid, DateTime? reportdate)
{
var result = new Model.CQMSData_CQMS();
if (reportdate == null)
{
return result;
}
var projectlist = BLL.ProjectService.GetProjectWorkList(Unitid);
var base_Unit = UnitService.GetUnitByUnitId(Unitid);
var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS
where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId)
select x).ToList();
result = new CQMSData_CQMS
{
UnitId = Unitid,
CollCropCode = base_Unit.CollCropCode,
UnitName = base_Unit.UnitName,
ReportDate = DateTime.Now.Date,
TrainPersonNum = ProjectData.Sum(x => x.TrainPersonNum),
TechnicalDisclosePersonNum = ProjectData.Sum(x => x.TechnicalDisclosePersonNum),
UseNum = ProjectData.Sum(x => x.UseNum),
OKNum = ProjectData.Sum(x => x.OKNum),
CompanyPersonNum = GetCompanyPersonNum(),
BranchPersonNum = GetBranchPersonNum(),
ProjectPersonNum = ProjectData.Sum(x => x.ProjectPersonNum),
ProblemNum = ProjectData.Sum(x => x.ProblemNum),
ProblemCompletedNum = ProjectData.Sum(x => x.ProblemCompletedNum),
ProblemNotCompletedNum = ProjectData.Sum(x => x.ProblemNotCompletedNum),
SNum = ProjectData.Sum(x => x.SNum),
ANum = ProjectData.Sum(x => x.ANum),
BNum = ProjectData.Sum(x => x.BNum),
CNum = ProjectData.Sum(x => x.CNum),
KeyProcessNum = ProjectData.Sum(x => x.KeyProcessNum),
KeyProcessOKNum = ProjectData.Sum(x => x.KeyProcessOKNum),
SpecialProcessNum = ProjectData.Sum(x => x.SpecialProcessNum),
SpecialProcessOKNum = ProjectData.Sum(x => x.SpecialProcessOKNum),
ConcealedWorksNum = ProjectData.Sum(x => x.ConcealedWorksNum),
ConcealedWorksOKNum = ProjectData.Sum(x => x.ConcealedWorksOKNum),
UnitProjectOnesNum = ProjectData.Sum(x => x.UnitProjectOnesNum),
UnitProjectOnesOKNum = ProjectData.Sum(x => x.UnitProjectOnesOKNum),
MaterialInRecheckNum = ProjectData.Sum(x => x.MaterialInRecheckNum),
MaterialInRecheckOKNum = ProjectData.Sum(x => x.MaterialInRecheckOKNum),
SingleProjectNum = ProjectData.Sum(x => x.SingleProjectNum),
UnitProjectNum = ProjectData.Sum(x => x.UnitProjectNum),
SubProjectNum = ProjectData.Sum(x => x.SubProjectNum),
SubdivisionalWorksNum = ProjectData.Sum(x => x.SubdivisionalWorksNum),
InspectionLotNum = ProjectData.Sum(x => x.InspectionLotNum),
CreateMan = Const.sysglyId,
CreateDate = DateTime.Now
};
return result;
}
public static void UpdateTodyData_State()
{
var q = GetTodayData();
@@ -396,52 +501,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();
}
}
/// <summary>
/// 获取企业总部人数
@@ -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();
}
}
}
}
+121 -47
View File
@@ -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,17 @@ namespace BLL
public static HJGLData GetTodayHJGLData_HJGL()
{
var q = GetTodayData();
var data = new HJGLData();
if (CommonService.GetIsThisUnit().CollCropCode== "91410200170644116B")
{
return GetELECLTodayHJGLData_HJGL();
}
if (CommonService.GetIsThisUnit().CollCropCode == "914200001775697881")
{
return GetCNCEC_16TodayHJGLData_HJGL();
}
var q = GetTodayData();
if (q != null && q.State == Const.CNCEC_State_S)
data = StatisticalData();
else
@@ -181,15 +193,74 @@ namespace BLL
return data;
}
/// <summary>
/// 获取十六化建焊接数据
/// </summary>
/// <returns></returns>
public static HJGLData GetCNCEC_16TodayHJGLData_HJGL()
{
var data = new HJGLData();
string baseurl = "https://aq.cncec16.com.cn/hjglWebApi/api/CNCECServer/PostGetHJGLData";
string token = Const.sysglyId;
string response = Funs.RequestPost(baseurl, token, "");
if (string.IsNullOrEmpty(response))
{
try
{
baseurl = "http://192.168.1.8/hjglwebapi/api/CNCECServer/PostGetHJGLData";
response = Funs.RequestPost(baseurl, token, "");
}
catch (Exception e)
{
APICommonService.SaveSysHttpLog("GetCNCEC_16TodayHJGLData_HJGL", baseurl, e.ToString());
}
}
var json = JsonConvert.DeserializeObject(response) as JObject;
if (json != null && json["code"]?.ToString() == "1")
{
var str = json["data"]?.ToString();
if (str != null) data = JsonConvert.DeserializeObject<HJGLData>(str);
}
APICommonService.SaveSysHttpLog("GetCNCEC_16TodayHJGLData_HJGL", baseurl, response);
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;
}
public static HJGLData_HJGL GetSubUnitHjglDataByDate(string Unitid, DateTime? reportdate)
{
var result = new Model.HJGLData_HJGL();
if (reportdate == null)
{
return result;
}
var projectlist = BLL.ProjectService.GetProjectWorkList(Unitid);
var baseUnit = UnitService.GetUnitByUnitId(Unitid);
var ProjectData = (from x in Funs.DB.Project_HJGLData_HJGL
where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId)
select x).ToList();
result = new HJGLData_HJGL
{
UnitId = Unitid,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ReportDate = DateTime.Now.Date,
WelderNum = ProjectData.Sum(x => x.WelderNum),
TotalDineNum = ProjectData.Sum(x => x.TotalDineNum),
CompleteDineNum = ProjectData.Sum(x => x.CompleteDineNum),
TotalFilmNum = ProjectData.Sum(x => x.TotalFilmNum),
OKFilmNum = ProjectData.Sum(x => x.OKFilmNum),
CreateMan = Const.sysglyId,
CreateDate = DateTime.Now
};
return result;
}
public static void UpdateTodyData_State()
{
var q = GetTodayData();
@@ -293,26 +364,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();
}
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -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();
}
}
}
}
@@ -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<Model.Hazard_RealTimeDevice> 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<Model.Hazard_RealTimeDevice> 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();
}
}
}
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class LotAPIService
{
/// <summary>
/// 保存环境监测
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string saveEnvironmentCheck(Model.EnvironmentalCheckInput input)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//使用Emitmapper 将input 映射到实体类db.ZJ_EnvironmentCheck
var entity = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<Model.EnvironmentalCheckInput, Model.EnvironmentalCheck>().Map(input);
entity.Id = Guid.NewGuid().ToString();
entity.CreateTime = DateTime.Now;
db.EnvironmentalCheck.InsertOnSubmit(entity);
db.SubmitChanges();
return entity.Id;
}
}
}
}
+360
View File
@@ -0,0 +1,360 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BLL {
public class MainSevice
{
/// <summary>
/// 在建项目集合
/// </summary>
private List<string> _beUnderConstructionList;
private HSSEData_HSSE _hsseData;
private string _unitId;
private int _unitType;
public MainSevice(string userid)
{
var userModel = UserService.GetUserByUserId(userid);
int unitType = CommonService.GetUnitTypeByUserId(userid);
var projectList = ProjectService.GetProjectWorkList().Select(x => new { x.ProjectId, x.UnitId }).ToList();
_unitId = userModel.UnitId;
_unitType = unitType;
if (unitType == 0)
{
_beUnderConstructionList = projectList.Select(x => x.ProjectId).ToList();
_unitId = CommonService.GetThisUnitId();
}
else if (unitType == 1)
{
_beUnderConstructionList = projectList.Where(x => x.UnitId == userModel.UnitId).Select(x => x.ProjectId).ToList();
}
else if (unitType == 2)
{
_beUnderConstructionList = new List<string>() { "0" };
}
}
public async Task<HSSEData_HSSE> GetHsseDataAsync()
{
try
{
// 并行执行异步方法
var totalEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeTotalEnergyConsumption();
var incomeComprehensiveEnergyConsumptionTask = ChemicalReportItemService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
var newWaterConsumptionTask = ChemicalReportItemService.GetLatstTimeNewWaterConsumption();
var securityRiskOutputListTask = HSSEData_HSSEService.GetSecurityRiskOutputsAsync()
.ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId)));
var largeEngineeringOutputsTask = HSSEData_HSSEService.GetLargeEngineeringOutputsAsync()
.ContinueWith(t => t.Result.Where(x => _beUnderConstructionList.Contains(x.ProjectId)));
var safetyInjectionEngineerTask = HSSEData_HSSEService.GetSafetyInjectionEngineerAsync();
var certificateATask = HSSEData_HSSEService.GetCertificateAAsync();
var certificateBTask = HSSEData_HSSEService.GetCertificateBAsync();
var certificateCTask = HSSEData_HSSEService.GetCertificateCAsync();
var beUnderConstructionTask = HSSEData_HSSEService.GetBeUnderConstructionAsync();
var shutdownTask = HSSEData_HSSEService.GetShutdownAsync();
var joinConstructionPersonTask = HSSEData_HSSEService.GetJoinConstructionPersonAsync();
var majorProjectsUnderConstructionTask = HSSEData_HSSEService.GetMajorProjectsUnderConstructionAsync();
var totalWorkingHourTask = HSSEData_HSSEService.GetTotalWorkingHourAsync();
var lostWorkingHourTask = HSSEData_HSSEService.GetLostWorkingHourAsync();
var safeWorkingHourTask = HSSEData_HSSEService.GetSafeWorkingHourAsync();
var safeTrainTask = HSSEData_HSSEService.GetSafeTrainAsync();
var specialTrainTask = HSSEData_HSSEService.GetSpecialTrainAsync();
var specialOperationTrainTask = HSSEData_HSSEService.GetSpecialOperationTrainAsync();
var headOfficeInspectorGeneralTask = HSSEData_HSSEService.GetHeadOfficeInspectorGeneralAsync();
var headOfficeFullTimeTask = HSSEData_HSSEService.GetHeadOfficeFullTimeAsync();
var branchInspectorGeneralTask = HSSEData_HSSEService.GetBranchInspectorGeneralAsync();
var branchFullTimeTask = HSSEData_HSSEService.GetBranchFullTimeAsync();
var projectInspectorGeneralTask = HSSEData_HSSEService.GetProjectInspectorGeneralAsync();
var projectFullTimeTask = HSSEData_HSSEService.GetProjectFullTimeAsync();
var projectSafetyMonitorTask = HSSEData_HSSEService.GetProjectSafetyMonitorAsync();
var safetyCommitteeMeetingTask = HSSEData_HSSEService.GetSafetyCommitteeMeetingAsync();
var enterpriseTopicsMeetingTask = HSSEData_HSSEService.GetEnterpriseTopicsMeetingAsync();
var projectSafetyLeadingGroupMeetingTask = HSSEData_HSSEService.GetProjectSafetyLeadingGroupMeetingAsync();
var projectSafetyMeetingTask = HSSEData_HSSEService.GetProjectSafetyMeetingAsync();
var companyLeadShiftCheckTask = HSSEData_HSSEService.GetCompanyLeadShiftCheckAsync();
var companyComprehensiveCheckTask = HSSEData_HSSEService.GetCompanyComprehensiveCheckAsync();
var companySpecialCheckTask = HSSEData_HSSEService.GetCompanySpecialCheckAsync();
var projectLeadShiftCheckTask = HSSEData_HSSEService.GetProjectLeadShiftCheckAsync();
var projectSpecialCheckTask = HSSEData_HSSEService.GetProjectSpecialCheckAsync();
var projectMajorCheckTask = HSSEData_HSSEService.GetProjectMajorCheckAsync();
var nearMissTask = HSSEData_HSSEService.GetNearMissAsync();
var recordableEventTask = HSSEData_HSSEService.GetRecordableEventAsync();
var generalAccidentTask = HSSEData_HSSEService.GetGeneralAccidentAsync();
var majorAccidentTask = HSSEData_HSSEService.GetMajorAccidentAsync();
var seriousAccidentTask = HSSEData_HSSEService.GetSeriousAccidentAsync();
var specialSeriousAccidentTask = HSSEData_HSSEService.GetSpecialSeriousAccidentAsync();
var companyComprehensivePlanTask = HSSEData_HSSEService.GetCompanyComprehensivePlanAsync();
var companySpecialPlanTask = HSSEData_HSSEService.GetCompanySpecialPlanAsync();
var companyOnSiteDisposalPlanTask = HSSEData_HSSEService.GetCompanyOnSiteDisposalPlanAsync();
var companyDrillTask = HSSEData_HSSEService.GetCompanyDrillAsync();
var projectComprehensivePlanTask = HSSEData_HSSEService.GetProjectComprehensivePlanAsync();
var projectSpecialPlanTask = HSSEData_HSSEService.GetProjectSpecialPlanAsync();
var projectOnSiteDisposalPlanTask = HSSEData_HSSEService.GetProjectOnSiteDisposalPlanAsync();
var projectDrillTask = HSSEData_HSSEService.GetProjectDrillAsync();
var costExtractTask = HSSEData_HSSEService.GetCostExtractAsync();
var costUseTask = HSSEData_HSSEService.GetCostUseAsync();
var useEquipmentTask = HSSEData_HSSEService.GetUseEquipmentAsync();
var specialEquipmentTask = HSSEData_HSSEService.GetSpecialEquipmentAsync();
var licensesTask = HSSEData_HSSEService.GetLicensesAsync();
var licensesCloseTask = HSSEData_HSSEService.GetLicensesCloseAsync();
var generalHiddenRectificationOutputsTask = HSSEData_HSSEService.GetGeneralHiddenRectificationOutputsAsync();
var majorHiddenRectificationOutputsTask = HSSEData_HSSEService.GetMajorHiddenRectificationOutputsAsync();
// 等待所有异步方法执行完成
await Task.WhenAll(
securityRiskOutputListTask,
largeEngineeringOutputsTask,
safetyInjectionEngineerTask,
certificateATask,
certificateBTask,
certificateCTask,
beUnderConstructionTask,
shutdownTask,
joinConstructionPersonTask,
majorProjectsUnderConstructionTask,
totalWorkingHourTask,
lostWorkingHourTask,
safeWorkingHourTask,
safeTrainTask,
specialTrainTask,
specialOperationTrainTask,
headOfficeInspectorGeneralTask,
headOfficeFullTimeTask,
branchInspectorGeneralTask,
branchFullTimeTask,
projectInspectorGeneralTask,
projectFullTimeTask,
projectSafetyMonitorTask,
safetyCommitteeMeetingTask,
enterpriseTopicsMeetingTask,
projectSafetyLeadingGroupMeetingTask,
projectSafetyMeetingTask,
companyLeadShiftCheckTask,
companyComprehensiveCheckTask,
companySpecialCheckTask,
projectLeadShiftCheckTask,
projectSpecialCheckTask,
projectMajorCheckTask,
nearMissTask,
recordableEventTask,
generalAccidentTask,
majorAccidentTask,
seriousAccidentTask,
specialSeriousAccidentTask,
companyComprehensivePlanTask,
companySpecialPlanTask,
companyOnSiteDisposalPlanTask,
companyDrillTask,
projectComprehensivePlanTask,
projectSpecialPlanTask,
projectOnSiteDisposalPlanTask,
projectDrillTask,
costExtractTask,
costUseTask,
useEquipmentTask,
specialEquipmentTask,
licensesTask,
licensesCloseTask,
generalHiddenRectificationOutputsTask,
majorHiddenRectificationOutputsTask
);
// 统一获取异步方法的返回值
var totalEnergyConsumption = totalEnergyConsumptionTask;
var incomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumptionTask;
var newWaterConsumption = newWaterConsumptionTask;
var safetyInjectionEngineerList = await safetyInjectionEngineerTask;
var certificateAList = await certificateATask;
var certificateBList = await certificateBTask;
var certificateCList = await certificateCTask;
var beUnderConstructionList = await beUnderConstructionTask;
var shutdownList = await shutdownTask;
var joinConstructionPersonList = await joinConstructionPersonTask;
var majorProjectsUnderConstructionList = await majorProjectsUnderConstructionTask;
var totalWorkingHour = await totalWorkingHourTask;
var lostWorkingHour = await lostWorkingHourTask;
var safeWorkingHour = await safeWorkingHourTask;
var safeTrainList = await safeTrainTask;
var specialTrainList = await specialTrainTask;
var specialOperationTrainList = await specialOperationTrainTask;
var headOfficeInspectorGeneralList = await headOfficeInspectorGeneralTask;
var headOfficeFullTimeList = await headOfficeFullTimeTask;
var branchInspectorGeneralList = await branchInspectorGeneralTask;
var branchFullTimeList = await branchFullTimeTask;
var projectInspectorGeneralList = await projectInspectorGeneralTask;
var projectFullTimeList = await projectFullTimeTask;
var projectSafetyMonitorList = await projectSafetyMonitorTask;
var safetyCommitteeMeetingList = await safetyCommitteeMeetingTask;
var enterpriseTopicsMeetingList = await enterpriseTopicsMeetingTask;
var projectSafetyLeadingGroupMeetingList = await projectSafetyLeadingGroupMeetingTask;
var projectSafetyMeetingList = await projectSafetyMeetingTask;
var companyLeadShiftCheckList = await companyLeadShiftCheckTask;
var companyComprehensiveCheckList = await companyComprehensiveCheckTask;
var companySpecialCheckList = await companySpecialCheckTask;
var projectLeadShiftCheckList = await projectLeadShiftCheckTask;
var projectSpecialCheckList = await projectSpecialCheckTask;
var projectMajorCheckList = await projectMajorCheckTask;
var nearMissList = await nearMissTask;
var recordableEventList = await recordableEventTask;
var generalAccidentList = await generalAccidentTask;
var majorAccidentList = await majorAccidentTask;
var seriousAccidentList = await seriousAccidentTask;
var specialSeriousAccidentList = await specialSeriousAccidentTask;
var companyComprehensivePlanList = await companyComprehensivePlanTask;
var companySpecialPlanList = await companySpecialPlanTask;
var companyOnSiteDisposalPlanList = await companyOnSiteDisposalPlanTask;
var companyDrillList = await companyDrillTask;
var projectComprehensivePlanList = await projectComprehensivePlanTask;
var projectSpecialPlanList = await projectSpecialPlanTask;
var projectOnSiteDisposalPlanList = await projectOnSiteDisposalPlanTask;
var projectDrillList = await projectDrillTask;
var costExtractList = await costExtractTask;
var costUseList = await costUseTask;
var useEquipmentList = await useEquipmentTask;
var specialEquipmentList = await specialEquipmentTask;
var licensesList = await licensesTask;
var licensesCloseList = await licensesCloseTask;
var generalHiddenRectificationOutputsList = await generalHiddenRectificationOutputsTask;
var majorHiddenRectificationOutputsList = await majorHiddenRectificationOutputsTask;
// 构造结果对象
var table = new HSSEData_HSSE
{
JoinConstructionPersonNum = joinConstructionPersonList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
MajorProjectsUnderConstructionNum = majorProjectsUnderConstructionList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
TotalWorkingHour = totalWorkingHour,
LostWorkingHour = lostWorkingHour,
SafeWorkingHour = safeWorkingHour,
SafeTrainNum = safeTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
SpecialTrainNum = specialTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
SpecialOperationTrainNum = specialOperationTrainList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.TrainPersonNum),
EnvironmentalTrainNum = 0,
TotalEnergyConsumption = totalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = incomeComprehensiveEnergyConsumption,
NewWaterConsumption = newWaterConsumption,
HeadOfficeInspectorGeneralNum = headOfficeInspectorGeneralList.Count(),
HeadOfficeFullTimeNum = headOfficeFullTimeList.Count,
BranchInspectorGeneralNum = branchInspectorGeneralList.Count,
BranchFullTimeNum = branchFullTimeList.Count,
ProjectInspectorGeneralNum = projectInspectorGeneralList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectFullTimeNum = projectFullTimeList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyMonitorNum = projectSafetyMonitorList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyLeadingGroupMeetingNum = projectSafetyLeadingGroupMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSafetyMeetingNum = projectSafetyMeetingList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyLeadShiftCheckNum = companyLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyComprehensiveCheckNum = companyComprehensiveCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanySpecialCheckNum = companySpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectLeadShiftCheckNum = projectLeadShiftCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSpecialCheckNum = projectSpecialCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectMajorCheckNum = projectMajorCheckList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
NearMissNum = nearMissList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
RecordableEventNum = recordableEventList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
GeneralAccidentNum = generalAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
MajorAccidentNum = majorAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SeriousAccidentNum = seriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SpecialSeriousAccidentNum = specialSeriousAccidentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CompanyComprehensivePlanNum = companyComprehensivePlanList.Count(x => x.UnitId == _unitId),
CompanySpecialPlanNum = companySpecialPlanList.Count(x => x.UnitId == _unitId),
CompanyOnSiteDisposalPlan = companyOnSiteDisposalPlanList.Count(x => x.UnitId == _unitId),
CompanyDrillNum = companyDrillList.Count(x => x.UnitId.Contains(_unitId)),
ProjectComprehensivePlanNum = projectComprehensivePlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectSpecialPlanNum = projectSpecialPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectOnSiteDisposalPlan = projectOnSiteDisposalPlanList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
ProjectDrillNum = projectDrillList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
CostExtract = Convert.ToInt32(costExtractList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)),
CostUse = Convert.ToInt32(costUseList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.SUMCost)),
UseEquipmentNum = useEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
SpecialEquipmentNum = specialEquipmentList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
LicensesNum = licensesList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
LicensesCloseNum = licensesCloseList.Count(x => _beUnderConstructionList.Contains(x.ProjectId)),
GeneralClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum),
GeneralNotClosedNum = generalHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum),
MajorClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.RecNum),
MajorNotClosedNum = majorHiddenRectificationOutputsList.Where(x => _beUnderConstructionList.Contains(x.ProjectId)).Sum(x => x.NoRecNum),
LowRiskNum = securityRiskOutputListTask.Result.Sum(x => x.LowRiskNum),
GeneralRiskNum = securityRiskOutputListTask.Result.Sum(x => x.GeneralRiskNum),
MediumRiskNum = securityRiskOutputListTask.Result.Sum(x => x.MediumRiskNum),
HighRiskNum = securityRiskOutputListTask.Result.Sum(x => x.HighRiskNum),
CompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.CompletedNum),
TrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.TrainPersonNum),
ConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.ConstructionNum),
FinishedNum = largeEngineeringOutputsTask.Result.Sum(x => x.FinishedNum),
SuperCompletedNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperCompletedNum),
SuperTrainPersonNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperTrainPersonNum),
SuperConstructionNum = largeEngineeringOutputsTask.Result.Sum(x => x.SuperConstructionNum)
};
if (_unitType == 0)
{
table.BeUnderConstructionNum = beUnderConstructionList.Count();
table.ShutdownNum = shutdownList.Count();
table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count();
table.EnterpriseTopicsMeetingNum = enterpriseTopicsMeetingList.Count();
table.CertificateANum = certificateAList.Count();
table.CertificateBNum = certificateBList.Count();
table.CertificateCNum = certificateCList.Count();
table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count();
}
else if (_unitType == 1)
{
table.BeUnderConstructionNum = beUnderConstructionList.Count(x => x.UnitId == _unitId);
table.ShutdownNum = shutdownList.Count(x => x.UnitId == _unitId);
table.SafetyCommitteeMeetingNum = safetyCommitteeMeetingList.Count(x => x.UnitId == _unitId);
table.SafetyInjectionEngineer = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.EnterpriseTopicsMeetingNum = safetyInjectionEngineerList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.CertificateANum = certificateAList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.CertificateBNum = certificateBList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
table.CertificateCNum = certificateCList.Count(x => _beUnderConstructionList.Contains(x.ProjectId) || x.UnitId == _unitId);
}
_hsseData = table;
return _hsseData;
}
catch (Exception ex)
{
throw;
}
}
public List<HSSEDataHiddenDangerDetailItem> GetDataHiddenDangerDetailItems()
{
var db = Funs.DB;
var list = from x in db.HSSE_Hazard_HazardRegister
where _beUnderConstructionList.Contains(x.ProjectId)
select x;
var data = (from x in list
join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId
group x by new
{ x.ProjectId, x.RegisterTypesId, y.RegisterTypesName }
into g
select new
{
UnitId = _unitId,
ProjectId = g.Key.ProjectId,
TypeName = g.Key.RegisterTypesName,
TotalNum = g.Count(),
NeedRectifyNum = g.Count(x => x.States == "1"),
}).ToList();
var result = (from x in data
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)
}).ToList();
return result;
}
} }
@@ -156,47 +156,50 @@ namespace BLL
/// <param name="newtable"></param>
public static void AddProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
{
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
TrainPersonNum = newtable.TrainPersonNum,
TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum,
UseNum = newtable.UseNum,
OKNum = newtable.OKNum,
CompanyPersonNum = newtable.CompanyPersonNum,
BranchPersonNum = newtable.BranchPersonNum,
ProjectPersonNum = newtable.ProjectPersonNum,
ProblemNum = newtable.ProblemNum,
ProblemCompletedNum = newtable.ProblemCompletedNum,
ProblemNotCompletedNum = newtable.ProblemNotCompletedNum,
SNum = newtable.SNum,
ANum = newtable.ANum,
BNum = newtable.BNum,
CNum = newtable.CNum,
KeyProcessNum = newtable.KeyProcessNum,
KeyProcessOKNum = newtable.KeyProcessOKNum,
SpecialProcessNum = newtable.SpecialProcessNum,
SpecialProcessOKNum = newtable.SpecialProcessOKNum,
ConcealedWorksNum = newtable.ConcealedWorksNum,
ConcealedWorksOKNum = newtable.ConcealedWorksOKNum,
UnitProjectOnesNum = newtable.UnitProjectOnesNum,
UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum,
MaterialInRecheckNum = newtable.MaterialInRecheckNum,
MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum,
SingleProjectNum = newtable.SingleProjectNum,
UnitProjectNum = newtable.UnitProjectNum,
SubProjectNum = newtable.SubProjectNum,
SubdivisionalWorksNum = newtable.SubdivisionalWorksNum,
InspectionLotNum = newtable.InspectionLotNum,
};
db.Project_CQMSData_CQMS.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
TrainPersonNum = newtable.TrainPersonNum,
TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum,
UseNum = newtable.UseNum,
OKNum = newtable.OKNum,
CompanyPersonNum = newtable.CompanyPersonNum,
BranchPersonNum = newtable.BranchPersonNum,
ProjectPersonNum = newtable.ProjectPersonNum,
ProblemNum = newtable.ProblemNum,
ProblemCompletedNum = newtable.ProblemCompletedNum,
ProblemNotCompletedNum = newtable.ProblemNotCompletedNum,
SNum = newtable.SNum,
ANum = newtable.ANum,
BNum = newtable.BNum,
CNum = newtable.CNum,
KeyProcessNum = newtable.KeyProcessNum,
KeyProcessOKNum = newtable.KeyProcessOKNum,
SpecialProcessNum = newtable.SpecialProcessNum,
SpecialProcessOKNum = newtable.SpecialProcessOKNum,
ConcealedWorksNum = newtable.ConcealedWorksNum,
ConcealedWorksOKNum = newtable.ConcealedWorksOKNum,
UnitProjectOnesNum = newtable.UnitProjectOnesNum,
UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum,
MaterialInRecheckNum = newtable.MaterialInRecheckNum,
MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum,
SingleProjectNum = newtable.SingleProjectNum,
UnitProjectNum = newtable.UnitProjectNum,
SubProjectNum = newtable.SubProjectNum,
SubdivisionalWorksNum = newtable.SubdivisionalWorksNum,
InspectionLotNum = newtable.InspectionLotNum,
};
db.Project_CQMSData_CQMS.InsertOnSubmit(table);
db.SubmitChanges();
}
}
/// <summary>
/// 修改
@@ -204,46 +207,48 @@ namespace BLL
/// <param name="newtable"></param>
public static void UpdateProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
{
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.TrainPersonNum = newtable.TrainPersonNum;
table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum;
table.UseNum = newtable.UseNum;
table.OKNum = newtable.OKNum;
table.CompanyPersonNum = newtable.CompanyPersonNum;
table.BranchPersonNum = newtable.BranchPersonNum;
table.ProjectPersonNum = newtable.ProjectPersonNum;
table.ProblemNum = newtable.ProblemNum;
table.ProblemCompletedNum = newtable.ProblemCompletedNum;
table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum;
table.SNum = newtable.SNum;
table.ANum = newtable.ANum;
table.BNum = newtable.BNum;
table.CNum = newtable.CNum;
table.KeyProcessNum = newtable.KeyProcessNum;
table.KeyProcessOKNum = newtable.KeyProcessOKNum;
table.SpecialProcessNum = newtable.SpecialProcessNum;
table.SpecialProcessOKNum = newtable.SpecialProcessOKNum;
table.ConcealedWorksNum = newtable.ConcealedWorksNum;
table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum;
table.UnitProjectOnesNum = newtable.UnitProjectOnesNum;
table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum;
table.MaterialInRecheckNum = newtable.MaterialInRecheckNum;
table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum;
table.SingleProjectNum = newtable.SingleProjectNum;
table.UnitProjectNum = newtable.UnitProjectNum;
table.SubProjectNum = newtable.SubProjectNum;
table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum;
table.InspectionLotNum = newtable.InspectionLotNum;
db.SubmitChanges();
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.TrainPersonNum = newtable.TrainPersonNum;
table.TechnicalDisclosePersonNum = newtable.TechnicalDisclosePersonNum;
table.UseNum = newtable.UseNum;
table.OKNum = newtable.OKNum;
table.CompanyPersonNum = newtable.CompanyPersonNum;
table.BranchPersonNum = newtable.BranchPersonNum;
table.ProjectPersonNum = newtable.ProjectPersonNum;
table.ProblemNum = newtable.ProblemNum;
table.ProblemCompletedNum = newtable.ProblemCompletedNum;
table.ProblemNotCompletedNum = newtable.ProblemNotCompletedNum;
table.SNum = newtable.SNum;
table.ANum = newtable.ANum;
table.BNum = newtable.BNum;
table.CNum = newtable.CNum;
table.KeyProcessNum = newtable.KeyProcessNum;
table.KeyProcessOKNum = newtable.KeyProcessOKNum;
table.SpecialProcessNum = newtable.SpecialProcessNum;
table.SpecialProcessOKNum = newtable.SpecialProcessOKNum;
table.ConcealedWorksNum = newtable.ConcealedWorksNum;
table.ConcealedWorksOKNum = newtable.ConcealedWorksOKNum;
table.UnitProjectOnesNum = newtable.UnitProjectOnesNum;
table.UnitProjectOnesOKNum = newtable.UnitProjectOnesOKNum;
table.MaterialInRecheckNum = newtable.MaterialInRecheckNum;
table.MaterialInRecheckOKNum = newtable.MaterialInRecheckOKNum;
table.SingleProjectNum = newtable.SingleProjectNum;
table.UnitProjectNum = newtable.UnitProjectNum;
table.SubProjectNum = newtable.SubProjectNum;
table.SubdivisionalWorksNum = newtable.SubdivisionalWorksNum;
table.InspectionLotNum = newtable.InspectionLotNum;
db.SubmitChanges();
}
}
}
@@ -253,12 +258,14 @@ namespace BLL
/// <param name="Id"></param>
public static void DeleteProject_CQMSData_CQMSById(string Id)
{
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_CQMSData_CQMS.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_CQMSData_CQMS.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
@@ -412,7 +419,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 +429,7 @@ namespace BLL
/// <returns></returns>
public static int GetTechnicalDisclosePersonNum(string projectid)
{
var result = (from x in Funs.DB.Comprehensive_DesignDetails
var result = (from x in Funs.DB.Comprehensive_DesignDetails
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
select x.JoinPersonNum).ToList().Sum(x => x.Value);
var q = Funs.GetNewIntOrZero(result.ToString());
@@ -488,7 +495,7 @@ namespace BLL
/// <returns></returns>
public static int GetProblemNum(string projectid)
{
int result = (from x in Funs.DB.Check_CheckControl
int result = (from x in Funs.DB.Check_CheckControl
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime
select x).Count();
return result;
@@ -567,7 +574,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 +587,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 +698,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;
}
@@ -702,7 +709,7 @@ namespace BLL
public static int GetUnitProjectNum(string projectid)
{
int result = (from x in Funs.DB.WBS_UnitWork
where x.ProjectId == projectid && (x.SuperUnitWork == null || x.SuperUnitWork == "0")
where x.ProjectId == projectid
select x).Count();
return result;
}
@@ -735,11 +742,40 @@ 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;
}
#region
/// <summary>
/// 推送项目质量数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectCQMSData()
{
var items = (from x in db.Project_CQMSData_CQMS
where x.ReportDate == DateTime.Now.Date
select x).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0)
{
var thisUnit = CommonService.GetIsThisUnit();
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/CQMSData/SaveProjectCQMSData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目质量数据";
}
return responeData;
}
#endregion
}
}
@@ -1,4 +1,5 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
@@ -86,6 +87,10 @@ namespace BLL
public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
}
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
@@ -103,56 +108,71 @@ namespace BLL
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
{
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();
}
}
}
@@ -199,7 +219,43 @@ namespace BLL
}).ToList();
return q;
}
public static List<HJGLDataDefectItems> GetModelByUnitIdAndReportDate(string Unitid, DateTime? reportdate)
{
if (!reportdate.HasValue)
{
return new List<HJGLDataDefectItems>();
}
var projectlist = BLL.ProjectService.GetProjectWorkList(Unitid);
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId)
group x by x.DefectName
into g
select new HJGLDataDefectItems
{
Id = SQLHelper.GetNewID(),
DefectName = g.Key,
DefectNum = g.Sum(p => p.DefectNum)
}).ToList();
return q;
}
public static List<HJGLDataDefectItems> GetModelByReportDate( DateTime? reportdate)
{
if (!reportdate.HasValue)
{
return new List<HJGLDataDefectItems>();
}
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate == reportdate
group x by x.DefectName
into g
select new HJGLDataDefectItems
{
Id = SQLHelper.GetNewID(),
DefectName = g.Key,
DefectNum = g.Sum(p => p.DefectNum)
}).ToList();
return q;
}
/// <summary>
/// 统计所有在建项目数据
/// </summary>
@@ -105,64 +105,68 @@ namespace BLL
return db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
}
public static List<Model.Project_HJGLData_HJGL> GetProject_HJGLData_HJGLByProjectid (string Projectid)
public static List<Model.Project_HJGLData_HJGL> GetProject_HJGLData_HJGLByProjectid(string Projectid)
{
var q =( from x in db.Project_HJGLData_HJGL
where x.ProjectId == Projectid
select x).ToList();
var q = (from x in db.Project_HJGLData_HJGL
where x.ProjectId == Projectid
select x).ToList();
return q;
}
public static void AddProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable)
{
Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
WelderNum = newtable.WelderNum,
TotalDineNum = newtable.TotalDineNum,
CompleteDineNum = newtable.CompleteDineNum,
TotalFilmNum = newtable.TotalFilmNum,
OKFilmNum = newtable.OKFilmNum,
};
db.Project_HJGLData_HJGL.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
WelderNum = newtable.WelderNum,
TotalDineNum = newtable.TotalDineNum,
CompleteDineNum = newtable.CompleteDineNum,
TotalFilmNum = newtable.TotalFilmNum,
OKFilmNum = newtable.OKFilmNum,
};
db.Project_HJGLData_HJGL.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable)
{
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.WelderNum = newtable.WelderNum;
table.TotalDineNum = newtable.TotalDineNum;
table.CompleteDineNum = newtable.CompleteDineNum;
table.TotalFilmNum = newtable.TotalFilmNum;
table.OKFilmNum = newtable.OKFilmNum;
db.SubmitChanges();
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.WelderNum = newtable.WelderNum;
table.TotalDineNum = newtable.TotalDineNum;
table.CompleteDineNum = newtable.CompleteDineNum;
table.TotalFilmNum = newtable.TotalFilmNum;
table.OKFilmNum = newtable.OKFilmNum;
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_HJGLById(string Id)
{
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_HJGL.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_HJGLData_HJGL.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断该项目的该日期是否统计数据
@@ -226,7 +230,7 @@ namespace BLL
/// </summary>
/// <param name="projectid">项目id</param>
/// <param name="hJGLDateType">数据类型</param>
public static void StatisticalData(string projectid,HJGLDateType hJGLDateType)
public static void StatisticalData(string projectid, HJGLDateType hJGLDateType)
{
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
@@ -242,7 +246,7 @@ namespace BLL
}
else
{
table.Id = SQLHelper.GetNewID();
table.Id = SQLHelper.GetNewID();
}
table.UnitId = thisUnitId;
table.CollCropCode = base_Unit.CollCropCode;
@@ -250,7 +254,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 +274,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);
@@ -302,30 +306,6 @@ namespace BLL
public static int GetTotalDineNum(string projectid)
{
int result = 0;
if (projectid != null)
{
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
where x.ProjectId == projectid.ToString()
select x;
if (getD1.Count() > 0)
{
foreach (var item in getD1)
{
result += Funs.GetNewIntOrZero(item.TotalWeldQuantity.Split('.')[0]);
}
}
else
{
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where x.ProjectId == projectid.ToString()
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.TotalWeldQuantity.Split('.')[0]);
}
}
}
return result;
}
/// <summary>
@@ -335,30 +315,6 @@ namespace BLL
public static int GetCompleteDineNum(string projectid)
{
int result = 0;
if (projectid != null)
{
var getD1 = from x in Funs.DB.HJGL_FL_TotalQuantity
where x.ProjectId == projectid.ToString()
select x;
if (getD1.Count() > 0)
{
foreach (var item in getD1)
{
result += Funs.GetNewIntOrZero(item.TotalCompleted.Split('.')[0]);
}
}
else
{
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where x.ProjectId == projectid.ToString()
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.TotalCompleted.Split('.')[0]);
}
}
}
return result;
}
/// <summary>
@@ -368,9 +324,9 @@ namespace BLL
public static int GetTotalFilmNum(string projectid)
{
int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem
join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x.CHT_TotalFilm ).ToList().Sum());
join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
where y.ProjectId == projectid
select x.CHT_TotalFilm).ToList().Sum());
return result;
}
/// <summary>
@@ -380,11 +336,44 @@ 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;
}
#region
/// <summary>
/// 推送项目焊接数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectHJGLData()
{
var items = (from x in db.Project_HJGLData_HJGL
where x.ReportDate == DateTime.Now.Date
select x).ToList();
var defectItems = (from x in db.Project_HJGLData_Defect
where x.ReportDate == DateTime.Now.Date
select x).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0 || defectItems.Count() > 0)
{
var thisUnit = CommonService.GetIsThisUnit();
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items, DefectItems = defectItems };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HJGLData/SaveProjectHJGLData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目焊接数据";
}
return responeData;
}
#endregion
}
}
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using FineUIPro;
using Model;
using Newtonsoft.Json;
namespace BLL
{
@@ -226,8 +227,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;
}
}
@@ -320,6 +321,19 @@ namespace BLL
}
}
public static void DeleteProject_HSSEData_HSSEByDate(DateTime? reportDate)
{
using (var db = new SGGLDB(Funs.ConnString))
{
var table = db.Project_HSSEData_HSSE.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.Project_HSSEData_HSSE.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断该项目的该日期是否统计数据
/// </summary>
@@ -330,9 +344,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 +359,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 +374,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 +540,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 +555,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 +596,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 +608,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 +620,8 @@ namespace BLL
public static int GetJoinConstructionPersonNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == projectid && x.IsUsed == true
select x).Count();
where x.ProjectId == projectid && x.IsUsed == true
select x).Count();
return result;
}
@@ -618,8 +632,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 +644,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 +660,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 +679,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 +704,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.TrainPersonNum ?? 0).ToList().Sum();
return result;
}
@@ -703,9 +717,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.TrainPersonNum ?? 0).ToList().Sum();
return result;
}
@@ -716,9 +730,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.TrainPersonNum ?? 0).ToList().Sum();
return result;
}
@@ -799,8 +813,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 == true
select x).Count();
where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.IsUsed == true
select x).Count();
return result;
}
@@ -811,9 +825,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 == true
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 == true
select x).Count();
return result;
}
@@ -824,8 +838,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 == true
select x).Count();
where x.ProjectId == projectid && x.IsSafetyMonitoring == true && x.IsUsed == true
select x).Count();
return result;
}
@@ -836,9 +850,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 == true
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 == true
select x).Count();
return result;
}
@@ -849,9 +863,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 == true
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 == true
select x).Count();
return result;
}
@@ -862,9 +877,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 == true
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 == true
select x).Count();
return result;
}
@@ -875,9 +891,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 == true
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 == true
select x).Count();
return result;
}
@@ -908,8 +925,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 +938,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 +983,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 +995,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 +1007,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 +1019,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 +1032,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 +1045,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 +1057,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 +1069,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 +1081,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 +1133,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 +1146,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 +1159,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 +1173,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 +1196,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 +1211,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 +1229,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 +1242,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 +1254,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 +1267,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 +1280,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.States != "-1" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1276,9 +1293,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 +1306,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.States != "-1" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1303,8 +1320,7 @@ namespace BLL
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
where z.ProjectId == projectid && y.RiskLevel == 2 && z.CompileDate.Value.Year >= 2023
where x.ProjectId == projectid && (y.RiskLevel == 2 || x.HazardLevel == "2") && (x.IsStart == true || x.State == "1")
select x).Count();
return result;
}
@@ -1317,8 +1333,7 @@ namespace BLL
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
where z.ProjectId == projectid && y.RiskLevel == 1 && z.CompileDate.Value.Year >= 2023
where x.ProjectId == projectid && (y.RiskLevel == 1 || x.HazardLevel == "1") && (x.IsStart == true || x.State == "1")
select x).Count();
return result;
}
@@ -1331,8 +1346,7 @@ namespace BLL
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
where z.ProjectId == projectid && y.RiskLevel == 3 && z.CompileDate.Value.Year >= 2023
where x.ProjectId == projectid && (y.RiskLevel == 3 || x.HazardLevel == "3") && (x.IsStart == true || x.State == "1")
select x).Count();
return result;
}
@@ -1345,8 +1359,7 @@ namespace BLL
{
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
join z in Funs.DB.Hazard_HazardList on x.HazardListId equals z.HazardListId
where z.ProjectId == projectid && y.RiskLevel == 4 && z.CompileDate.Value.Year >= 2023
where x.ProjectId == projectid && y.RiskLevel == 4 && (x.IsStart == true || x.State == "1")
select x).Count();
return result;
}
@@ -1358,9 +1371,9 @@ namespace BLL
public static int GetCompletedNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States != "0" && 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;
}
@@ -1371,8 +1384,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;
}
@@ -1383,9 +1396,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;
}
@@ -1396,9 +1409,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;
}
@@ -1409,9 +1422,9 @@ namespace BLL
public static int GetSuperCompletedNum(string projectid)
{
var result = (from x in Funs.DB.Solution_LargerHazard
where x.ProjectId == projectid && x.States != "0" && 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;
}
@@ -1423,8 +1436,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;
}
@@ -1435,9 +1448,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;
}
@@ -1448,9 +1461,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;
}
@@ -1487,85 +1500,118 @@ 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
#region
/// <summary>
/// 推送项目安全隐患风险数据
/// </summary>
/// <returns></returns>
public static ReturnData PushProjectHSSEData()
{
var items = (from x in db.Project_HSSEData_HSSE
where x.ReportDate == DateTime.Now.Date
select x).ToList();
var detailItems = (from x in db.Project_HSSEData_HiddenDangerDetail
where x.ReportDate == DateTime.Now.Date
select x).ToList();
Model.ReturnData responeData = new Model.ReturnData();
if (items.Count() > 0 || detailItems.Count() > 0)
{
var thisUnit = CommonService.GetIsThisUnit();
var newItem = new { CollCropCode = thisUnit.CollCropCode, Items = items, DetailItems = detailItems };
var str = JsonConvert.SerializeObject(newItem);
var baseurl = "/api/HSSEData/SaveProjectHSSEData";
responeData = ServerService.PushCNCEC(str, baseurl);
}
else
{
responeData.code = 0;
responeData.message = "当前没有项目安全隐患风险数据";
}
return responeData;
}
#endregion
@@ -1,4 +1,5 @@
using FineUIPro;
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using System;
using System.Collections;
@@ -115,9 +116,10 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
}
}
public static void UpdateProject_HSSEData_HiddenDangerDetail(Model.Project_HSSEData_HiddenDangerDetail newtable)
{
@@ -208,6 +210,10 @@ namespace BLL
select x).FirstOrDefault();
return q;
}
/// <summary>
/// 获取当天的隐患类别数据
/// </summary>
/// <returns></returns>
public static List<Model.HSSEDataHiddenDangerDetailItem> GetTodayModel()
{
var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail
@@ -222,6 +228,60 @@ namespace BLL
}).ToList();
return q;
}
/// <summary>
/// 根据单位id和日期 获取单位关联项目次日期的数据
/// </summary>
/// <param name="Unitid"></param>
/// <param name="reportdate"></param>
/// <returns></returns>
public static List<Model.HSSEDataHiddenDangerDetailItem> GetModelByUnitIdAndReportDate(string Unitid, DateTime? reportdate)
{
var projectlist = BLL.ProjectService.GetProjectWorkList(Unitid);
var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail
where x.ReportDate == reportdate && projectlist.Select(e => e.ProjectId).Contains(x.ProjectId)
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)
}).ToList();
return q;
}
/// <summary>
/// 根据日期 获取隐患类别数据
/// </summary>
/// <param name="reportdate"></param>
/// <returns></returns>
public static List<Model.HSSEDataHiddenDangerDetailItem> GetModelByReportDate( DateTime? reportdate)
{
var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail
where x.ReportDate == reportdate
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)
}).ToList();
return q;
}
public static List<Model.HSSEDataHiddenDangerDetailItem> GetModelByReportDate(DateTime? reportdate,string projectid)
{
var q = (from x in Funs.DB.Project_HSSEData_HiddenDangerDetail
where x.ReportDate == reportdate && x.ProjectId==projectid
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)
}).ToList();
return q;
}
public static void StatisticalAllProjectData()
{
var db = Funs.DB;
@@ -142,113 +142,120 @@ namespace BLL
}
public static void AddProject_SYHSEData_SYHSE(Model.Project_SYHSEData_SYHSE newtable)
{
Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
GeneralRiskNum = newtable.GeneralRiskNum,
LowRiskNum = newtable.LowRiskNum,
MediumRiskNum = newtable.MediumRiskNum,
HighRiskNum = newtable.HighRiskNum,
GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum,
ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum,
DesignQuantity = newtable.DesignQuantity,
RunningCapacity = newtable.RunningCapacity,
InterlockSettingValue = newtable.InterlockSettingValue,
VideoSurveillanceNum = newtable.VideoSurveillanceNum,
TotalWorkinghours = newtable.TotalWorkinghours,
SafeWorkinghours = newtable.SafeWorkinghours,
LostWorkinghours = newtable.LostWorkinghours,
TotalEnergyConsumption = newtable.TotalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
NewWaterConsumption = newtable.NewWaterConsumption,
GeneralClosedNum = newtable.GeneralClosedNum,
GeneralNotClosedNum = newtable.GeneralNotClosedNum,
MajorClosedNum = newtable.MajorClosedNum,
MajorNotClosedNum = newtable.MajorNotClosedNum,
HotWorkPermitNum = newtable.HotWorkPermitNum,
HotWorkClosedNum = newtable.HotWorkClosedNum,
HighPermitNum = newtable.HighPermitNum,
HighClosedNum = newtable.HighClosedNum,
TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum,
TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum,
BlindPlatePermitNum = newtable.BlindPlatePermitNum,
BlindPlateClosedNum = newtable.BlindPlateClosedNum,
GroundbreakingPermitNum = newtable.GroundbreakingPermitNum,
GroundbreakingClosedNum = newtable.GroundbreakingClosedNum,
OpenCircuitPermitNum = newtable.OpenCircuitPermitNum,
OpenCircuitClosedNum = newtable.OpenCircuitClosedNum,
HoistingPermitNum = newtable.HoistingPermitNum,
HoistingClosedNum = newtable.HoistingClosedNum,
};
db.Project_SYHSEData_SYHSE.InsertOnSubmit(table);
db.SubmitChanges();
Model.Project_SYHSEData_SYHSE table = new Model.Project_SYHSEData_SYHSE
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
GeneralRiskNum = newtable.GeneralRiskNum,
LowRiskNum = newtable.LowRiskNum,
MediumRiskNum = newtable.MediumRiskNum,
HighRiskNum = newtable.HighRiskNum,
GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum,
ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum,
DesignQuantity = newtable.DesignQuantity,
RunningCapacity = newtable.RunningCapacity,
InterlockSettingValue = newtable.InterlockSettingValue,
VideoSurveillanceNum = newtable.VideoSurveillanceNum,
TotalWorkinghours = newtable.TotalWorkinghours,
SafeWorkinghours = newtable.SafeWorkinghours,
LostWorkinghours = newtable.LostWorkinghours,
TotalEnergyConsumption = newtable.TotalEnergyConsumption,
IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
NewWaterConsumption = newtable.NewWaterConsumption,
GeneralClosedNum = newtable.GeneralClosedNum,
GeneralNotClosedNum = newtable.GeneralNotClosedNum,
MajorClosedNum = newtable.MajorClosedNum,
MajorNotClosedNum = newtable.MajorNotClosedNum,
HotWorkPermitNum = newtable.HotWorkPermitNum,
HotWorkClosedNum = newtable.HotWorkClosedNum,
HighPermitNum = newtable.HighPermitNum,
HighClosedNum = newtable.HighClosedNum,
TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum,
TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum,
BlindPlatePermitNum = newtable.BlindPlatePermitNum,
BlindPlateClosedNum = newtable.BlindPlateClosedNum,
GroundbreakingPermitNum = newtable.GroundbreakingPermitNum,
GroundbreakingClosedNum = newtable.GroundbreakingClosedNum,
OpenCircuitPermitNum = newtable.OpenCircuitPermitNum,
OpenCircuitClosedNum = newtable.OpenCircuitClosedNum,
HoistingPermitNum = newtable.HoistingPermitNum,
HoistingClosedNum = newtable.HoistingClosedNum,
};
db.Project_SYHSEData_SYHSE.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateProject_SYHSEData_SYHSE(Model.Project_SYHSEData_SYHSE newtable)
{
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
table.Id = newtable.Id;
table.ProjectId=newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.GeneralRiskNum = newtable.GeneralRiskNum;
table.LowRiskNum = newtable.LowRiskNum;
table.MediumRiskNum = newtable.MediumRiskNum;
table.HighRiskNum = newtable.HighRiskNum;
table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum;
table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum;
table.DesignQuantity = newtable.DesignQuantity;
table.RunningCapacity = newtable.RunningCapacity;
table.InterlockSettingValue = newtable.InterlockSettingValue;
table.VideoSurveillanceNum = newtable.VideoSurveillanceNum;
table.TotalWorkinghours = newtable.TotalWorkinghours;
table.SafeWorkinghours = newtable.SafeWorkinghours;
table.LostWorkinghours = newtable.LostWorkinghours;
table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
table.NewWaterConsumption = newtable.NewWaterConsumption;
table.GeneralClosedNum = newtable.GeneralClosedNum;
table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
table.MajorClosedNum = newtable.MajorClosedNum;
table.MajorNotClosedNum = newtable.MajorNotClosedNum;
table.HotWorkPermitNum = newtable.HotWorkPermitNum;
table.HotWorkClosedNum = newtable.HotWorkClosedNum;
table.HighPermitNum = newtable.HighPermitNum;
table.HighClosedNum = newtable.HighClosedNum;
table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum;
table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum;
table.BlindPlatePermitNum = newtable.BlindPlatePermitNum;
table.BlindPlateClosedNum = newtable.BlindPlateClosedNum;
table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum;
table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum;
table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum;
table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum;
table.HoistingPermitNum = newtable.HoistingPermitNum;
table.HoistingClosedNum = newtable.HoistingClosedNum;
db.SubmitChanges();
}
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId;
table.UnitId = newtable.UnitId;
table.CollCropCode = newtable.CollCropCode;
table.UnitName = newtable.UnitName;
table.ReportDate = newtable.ReportDate;
table.GeneralRiskNum = newtable.GeneralRiskNum;
table.LowRiskNum = newtable.LowRiskNum;
table.MediumRiskNum = newtable.MediumRiskNum;
table.HighRiskNum = newtable.HighRiskNum;
table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum;
table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum;
table.DesignQuantity = newtable.DesignQuantity;
table.RunningCapacity = newtable.RunningCapacity;
table.InterlockSettingValue = newtable.InterlockSettingValue;
table.VideoSurveillanceNum = newtable.VideoSurveillanceNum;
table.TotalWorkinghours = newtable.TotalWorkinghours;
table.SafeWorkinghours = newtable.SafeWorkinghours;
table.LostWorkinghours = newtable.LostWorkinghours;
table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
table.NewWaterConsumption = newtable.NewWaterConsumption;
table.GeneralClosedNum = newtable.GeneralClosedNum;
table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
table.MajorClosedNum = newtable.MajorClosedNum;
table.MajorNotClosedNum = newtable.MajorNotClosedNum;
table.HotWorkPermitNum = newtable.HotWorkPermitNum;
table.HotWorkClosedNum = newtable.HotWorkClosedNum;
table.HighPermitNum = newtable.HighPermitNum;
table.HighClosedNum = newtable.HighClosedNum;
table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum;
table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum;
table.BlindPlatePermitNum = newtable.BlindPlatePermitNum;
table.BlindPlateClosedNum = newtable.BlindPlateClosedNum;
table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum;
table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum;
table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum;
table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum;
table.HoistingPermitNum = newtable.HoistingPermitNum;
table.HoistingClosedNum = newtable.HoistingClosedNum;
db.SubmitChanges();
}
}
}
public static void DeleteProject_SYHSEData_SYHSEById(string Id)
{
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_SYHSEData_SYHSE.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Project_SYHSEData_SYHSE table = db.Project_SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_SYHSEData_SYHSE.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断当天是否统计过数据
+214 -12
View File
@@ -1,25 +1,34 @@
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Configuration;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using ResponeData = Model.ResponeData;
namespace BLL
{
/// <summary>
/// 集团服务类
/// </summary>
public static class ServerService
{
/// <summary>
/// 获取集团token
/// </summary>
/// <returns></returns>
public static Model.TokenItem GetCNCECToken()
{
string CNCECPath = SysConstSetService.CNCECPath;
string baseurl = CNCECPath + "/api/Common/GetToken";
var client = new RestClient(baseurl);
client.Timeout = -1;
client.Timeout = 2000;//获取token设置超时时间为3秒
var request = new RestRequest(Method.POST);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var thisUnit = CommonService.GetIsThisUnit();
@@ -28,28 +37,41 @@ namespace BLL
//request.AddJsonBody(JsonBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var responeData = JsonConvert.DeserializeObject<Model.ResponeData>(response.Content.ToString());
TokenItem tokenItem = new TokenItem();
if (responeData.code == 1 && string.IsNullOrEmpty(responeData.message))
try
{
var token = JsonConvert.DeserializeObject<Model.TokenItem>(responeData.data.ToString());
tokenItem.Token = token.Token.ToString();
tokenItem.ExpiryTime = token.ExpiryTime.ToString();
SysConstSetService.SetToken(tokenItem.Token);
SysConstSetService.SetTokenExpirationTime(tokenItem.ExpiryTime);
var responeData = JsonConvert.DeserializeObject<Model.ResponeData>(response.Content.ToString());
if (responeData != null && responeData.code == 1 && string.IsNullOrEmpty(responeData.message))
{
var token = JsonConvert.DeserializeObject<Model.TokenItem>(responeData.data.ToString());
tokenItem.Token = token.Token.ToString();
tokenItem.ExpiryTime = token.ExpiryTime.ToString();
SysConstSetService.SetToken(tokenItem.Token);
SysConstSetService.SetTokenExpirationTime(tokenItem.ExpiryTime);
}
}
catch (Exception e)
{
}
return tokenItem;
}
/// <summary>
/// 推送数据至集团(post接口)
/// </summary>
/// <param name="JsonBody"></param>
/// <param name="apiurl"></param>
/// <returns></returns>
public static Model.ReturnData PushCNCEC(string JsonBody, string apiurl)
{
try
{
Model.ReturnData responeData = new Model.ReturnData();
string CNCECPath = SysConstSetService.CNCECPath;
//string CNCECPath = "http://localhost:7143";
//CNCECPath = "http://localhost:7143";
if (string.IsNullOrEmpty(CNCECPath))
{
responeData.code = 0;
@@ -78,6 +100,10 @@ namespace BLL
throw;
}
}
/// <summary>
/// 获取token
/// </summary>
/// <returns></returns>
public static Model.TokenItem GetToken()
{
Model.TokenItem tokenItem = new Model.TokenItem();
@@ -95,6 +121,182 @@ namespace BLL
}
return tokenItem;
}
/// <summary>
/// 从集团获取数据(Get接口)
/// </summary>
/// <param name="apiurl">接口地址</param>
/// <param name="parameters">parameters参数</param>
/// <param name="timeout">超时时间</param>
/// <returns></returns>
public static Model.ResponeData GerDataFromCncec(string apiurl, Dictionary<string, string> parameters, int? timeout = null)
{
Model.ResponeData responeData = new Model.ResponeData();
try
{
string CNCECPath = SysConstSetService.CNCECPath;
if (string.IsNullOrEmpty(CNCECPath))
{
responeData.code = 0;
responeData.message = "接口地址为空,请配置!";
return responeData;
}
string baseurl = CNCECPath + apiurl;
var client = new RestClient(baseurl);
client.Timeout = timeout ?? -1;
var request = new RestRequest(Method.GET);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var tokenItem = GetToken();
if (tokenItem == null || string.IsNullOrEmpty(tokenItem.Token))
{
responeData.code = 0;
responeData.message = "token 不存在!";
return responeData;
}
request.AddHeader("token", tokenItem.Token);
if (parameters != null)
{
foreach (var parameter in parameters)
{
request.AddParameter(parameter.Key, parameter.Value);
}
}
IRestResponse response = client.Execute(request);
APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content);
var returnData = JsonConvert.DeserializeObject<Model.ResponeData>(response.Content.ToString());
if (returnData != null)
{
responeData.code = returnData.code;
responeData.message = returnData.message;
responeData.data = returnData.data;
}
else
{
responeData.code = -1;
responeData.message = "接口有误";
}
return responeData;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.ToString();
return responeData;
}
}
/// <summary>
/// 获取安全合规列表
/// </summary>
/// <param name="type">类型(1-法律法规;2-标准规范;3-规章制度;4-管理规定)</param>
/// <returns></returns>
public static async Task<List<Model.SafeLawItem>> GetSafeLawListByTypeAsync(string type)
{
// 使用 lambda 表达式来调用 getSafeLawListByType
return await Task.Run(() => GetSafeLawListByType(type));
}
/// <summary>
/// 获取安全合规列表
/// </summary>
/// <param name="type">类型(1-法律法规;2-标准规范;3-规章制度;4-管理规定)</param>
/// <returns></returns>
public static List<Model.SafeLawItem> GetSafeLawListByType(string type)
{
List<SafeLawItem> result = new List<SafeLawItem>();
string baseurl = "/api/Resources/getSafeLawListByType";
Dictionary<string, string> dic = new Dictionary<string, string>()
{
{"type",type},
{"pageIndex","0"}
};
var returnData = GerDataFromCncec(baseurl, dic, 3000);
if (returnData != null && returnData.code == 1)
{
JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(returnData.data.ToString());
var data = jt["getDataList"].ToString();
result = JsonConvert.DeserializeObject<List<Model.SafeLawItem>>(data);
}
return result;
}
/// <summary>
/// 获取公告列表
/// </summary>
/// <returns></returns>
public static List<Model.NoticeOutput> GetNoticeList()
{
List<NoticeOutput> result = new List<NoticeOutput>();
string baseurl = "/api/Notice/getNoticeList";
Dictionary<string, string> dic = new Dictionary<string, string>()
{
{"pageIndex","0"}
};
var returnData = GerDataFromCncec(baseurl, dic, 4000);
if (returnData != null && returnData.code == 1)
{
JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(returnData.data.ToString());
var data = jt["getDataList"].ToString();
result = JsonConvert.DeserializeObject<List<Model.NoticeOutput>>(data);
}
return result;
}
/// <summary>
/// 获取公告列表
/// </summary>
/// <returns></returns>
public static async Task<List<Model.NoticeOutput>> GetNoticeListAsync()
{
return await Task.Run(() => GetNoticeList());
}
/// <summary>
/// 获取新闻列表
/// </summary>
/// <returns></returns>
public static List<Model.NoticeOutput> GetNewsList()
{
List<NoticeOutput> result = new List<NoticeOutput>();
string baseurl = "/api/Notice/getNewsList";
Dictionary<string, string> dic = new Dictionary<string, string>()
{
{"pageIndex","0"}
};
var returnData = GerDataFromCncec(baseurl, dic, 3000);
if (returnData != null && returnData.code == 1)
{
JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(returnData.data.ToString());
var data = jt["getDataList"].ToString();
result = JsonConvert.DeserializeObject<List<Model.NoticeOutput>>(data);
}
return result;
}
/// <summary>
/// 获取新闻列表
/// </summary>
/// <returns></returns>
public static async Task<List<Model.NoticeOutput>> GetNewsListAsync()
{
return await Task.Run(() => GetNewsList());
}
/// <summary>
/// 获取QHSEUrl
/// </summary>
/// <returns></returns>
public static string GetQHSEUrl()
{
var result = GerDataFromCncec("/api/Data/GetWebUrl", null, 3000).data?.ToString();
return result;
}
}
}