提交代码

This commit is contained in:
2024-12-25 15:43:38 +08:00
parent 0a2f9ea3a7
commit c0b489aaf4
79 changed files with 8536 additions and 1546 deletions
@@ -156,7 +156,7 @@ namespace BLL
/// <param name="newtable"></param>
public static void AddProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_CQMSData_CQMS table = new Model.Project_CQMSData_CQMS
{
@@ -200,7 +200,6 @@ namespace BLL
db.SubmitChanges();
}
}
/// <summary>
/// 修改
@@ -208,8 +207,7 @@ namespace BLL
/// <param name="newtable"></param>
public static void UpdateProject_CQMSData_CQMS(Model.Project_CQMSData_CQMS newtable)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
@@ -252,7 +250,6 @@ namespace BLL
db.SubmitChanges();
}
}
}
/// <summary>
@@ -261,8 +258,7 @@ namespace BLL
/// <param name="Id"></param>
public static void DeleteProject_CQMSData_CQMSById(string Id)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_CQMSData_CQMS table = db.Project_CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
if (table != null)
@@ -271,7 +267,6 @@ namespace BLL
db.SubmitChanges();
}
}
}
/// <summary>
@@ -321,7 +316,7 @@ namespace BLL
}
public static void StatisticalAllProjectData()
{
var projectlist = ProjectService.GetCNCECShowProjectList();
var projectlist = ProjectService.GetProjectWorkList();
foreach (var item in projectlist)
{
StatisticalData(item.ProjectId, CQMSDateType.All);
@@ -490,7 +485,7 @@ namespace BLL
{
int result = (from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.ProjectId == projectid && y.IsCQMS == true && x.States=="1"
where x.ProjectId == projectid && y.IsCQMS == true && x.States == "1"
select x).Count();
return result;
}
@@ -703,8 +698,8 @@ namespace BLL
public static int GetSingleProjectNum(string projectid)
{
int result = (from x in Funs.DB.WBS_UnitWork
where x.ProjectId == projectid
select x).Count();
where x.ProjectId == projectid
select x).Count();
return result;
}
/// <summary>
@@ -753,5 +748,34 @@ namespace BLL
}
#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,39 +1,39 @@
using FineUIPro;
using Model;
using Microsoft.SqlServer.Dts.Runtime;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
namespace BLL
{
public static class Project_HJGLData_DefectService
{
public static Model.SGGLDB db = Funs.DB;
public static SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.Project_HJGLData_Defect> GetProject_HJGLData_DefectByModle(Model.Project_HJGLData_Defect table)
public static int count { get; set; }
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByModle(Project_HJGLData_Defect table)
{
var q = from x in db.Project_HJGLData_Defect
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) &&
(string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName))
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) &&
(string.IsNullOrEmpty(table.DefectName) || x.DefectName.Contains(table.DefectName))
select x
;
;
return q.ToList();
}
@@ -43,76 +43,83 @@ namespace BLL
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.Project_HJGLData_Defect table, Grid Grid1)
public static IEnumerable getListData(Project_HJGLData_Defect table, Grid Grid1)
{
var q = GetProject_HJGLData_DefectByModle(table);
count = q.Count();
if (count == 0)
{
return null;
}
if (count == 0) return null;
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
x.Id,
x.ProjectId,
x.UnitId,
x.CollCropCode,
x.UnitName,
x.ReportDate,
x.DefectName,
x.DefectNum,
};
select new
{
x.Id,
x.ProjectId,
x.UnitId,
x.CollCropCode,
x.UnitName,
x.ReportDate,
x.DefectName,
x.DefectNum
};
}
#endregion
public static Model.Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id)
public static Project_HJGLData_Defect GetProject_HJGLData_DefectById(string Id)
{
return db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
}
/// <summary>
/// 获取项目该日期的缺陷分析数据
/// </summary>
/// <param name="reportDate"></param>
/// <param name="projectid"></param>
/// <returns></returns>
public static List<Model.Project_HJGLData_Defect> GetProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid)
public static List<Project_HJGLData_Defect> GetProject_HJGLData_DefectByDate(DateTime? reportDate,
string projectid)
{
var q = from x in db.Project_HJGLData_Defect
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
select x;
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid
select x;
return q.ToList();
}
public static void AddProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable)
public static void AddProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_HJGLData_Defect table = new Model.Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum,
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void UpdateProject_HJGLData_Defect(Model.Project_HJGLData_Defect newtable)
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
}
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
@@ -125,39 +132,50 @@ namespace BLL
table.DefectNum = newtable.DefectNum;
db.SubmitChanges();
}
}
}
}
public static void DeleteProject_HJGLData_DefectById(string Id)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_HJGLData_Defect table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
var table = db.Project_HJGLData_Defect.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.Project_HJGLData_Defect.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate, string projectid)
public static void DeleteProject_HJGLData_DefectByDate(DateTime? reportDate)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.Project_HJGLData_Defect.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
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)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.Project_HJGLData_Defect.Where(x =>
x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 && x.ProjectId == projectid);
if (table != null)
{
db.Project_HJGLData_Defect.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断当天是否已统计数据
/// </summary>
@@ -166,37 +184,76 @@ namespace BLL
{
var result = false;
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid && x.DefectName == type
select x).ToList();
if (q != null && q.Count > 0)
{
result = true;
}
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid && x.DefectName == type
select x).ToList();
if (q != null && q.Count > 0) result = true;
return result;
}
/// <summary>
/// 根据projectid,获取当天的统计后的数据
/// </summary>
/// <param name="projectid"></param>
/// <returns></returns>
public static Model.Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type)
public static Project_HJGLData_Defect getTodayProject_HJGLData_Defect(string projectid, string type)
{
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date && x.ProjectId == projectid && x.DefectName == type
select x).FirstOrDefault();
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date &&
x.ProjectId == projectid && x.DefectName == type
select x).FirstOrDefault();
return q;
}
public static List<Model.HJGLDataDefectItems> getTodayProject_HJGLData_Defect()
public static List<HJGLDataDefectItems> getTodayProject_HJGLData_Defect()
{
var q = (from x in Funs.DB.Project_HJGLData_Defect
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
group x by x.DefectName into g
select new Model.HJGLDataDefectItems
{
Id = SQLHelper.GetNewID(),
DefectName = g.Key,
DefectNum=g.Sum (p=>p.DefectNum)
}).ToList();
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
group x by x.DefectName
into g
select new HJGLDataDefectItems
{
Id = SQLHelper.GetNewID(),
DefectName = g.Key,
DefectNum = g.Sum(p => p.DefectNum)
}).ToList();
return q;
}
public static List<HJGLDataDefectItems> GetModelByUnitIdAndReportDate(string Unitid, DateTime? reportdate)
{
if (!reportdate.HasValue)
{
return new List<HJGLDataDefectItems>();
}
var projectlist = BLL.ProjectService.GetProjectWorkList();
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>
@@ -209,15 +266,60 @@ namespace BLL
{
StatisticalData(item.ProjectId);
}
//var db = Funs.DB;
//var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList();
//var thisUnitId = string.Empty;
//var thisUnit = CommonService.GetIsThisUnit();
//if (thisUnit != null) thisUnitId = thisUnit.UnitId;
//var baseUnit = UnitService.GetUnitByUnitId(thisUnitId);
//var data = (from x in db.CH_CheckItem
// join y in db.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
// where projectids.Contains(y.ProjectId)
// group x by new { x.Defects_Definition, y.ProjectId }
// into g
// select new
// {
// UnitId = thisUnitId,
// CollCropCode = baseUnit.CollCropCode,
// UnitName = baseUnit.UnitName,
// ProjectId = g.Key.ProjectId,
// ReportDate = DateTime.Now.Date,
// DefectName = g.Key.Defects_Definition,
// DefectNum = g.Count(x => x.Defects_Definition == g.Key.Defects_Definition)
// }).ToList();
//DeleteProject_HJGLData_DefectByDate(DateTime.Now.Date); //删除当前所有
//var projectHjglDataDefect = new List<Project_HJGLData_Defect>();
//foreach (var item in data
// )
//{
// var table = new Project_HJGLData_Defect
// {
// Id = SQLHelper.GetNewID(),
// UnitId = item.UnitId,
// CollCropCode = item.CollCropCode,
// UnitName = item.UnitName,
// ProjectId = item.ProjectId,
// ReportDate = item.ReportDate,
// DefectName = item.DefectName,
// DefectNum = item.DefectNum
// };
// projectHjglDataDefect.Add(table);
//}
//AddBulkProject_HJGLData_Defect(projectHjglDataDefect); //批量增加
}
/// <summary>
/// 统计数据
/// </summary>
/// <param name="projectid"></param>
public static void StatisticalData(string projectid)
{
string thisUnitId = BLL.Const.UnitId_SEDIN;
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
var thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null) thisUnitId = thisUnit.UnitId;
var base_Unit = UnitService.GetUnitByUnitId(thisUnitId);
var list = from x in db.HJGL_Batch_NDEItem
join y in db.HJGL_Batch_NDE on x.NDEID equals y.NDEID
where y.ProjectId == projectid
@@ -250,25 +352,25 @@ namespace BLL
}
}
}
/// <summary>
/// 获取缺陷名称
/// </summary>
/// <returns></returns>
public static string GetDefectName(string projectid)
{
string result = "";
var result = "";
return result;
}
/// <summary>
/// 获取缺陷数量
/// </summary>
/// <returns></returns>
public static int GetDefectNum(string projectid)
{
int result = 0;
var result = 0;
return result;
}
}
}
@@ -114,7 +114,7 @@ namespace BLL
}
public static void AddProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_HJGLData_HJGL table = new Model.Project_HJGLData_HJGL
{
@@ -133,11 +133,10 @@ namespace BLL
db.Project_HJGLData_HJGL.InsertOnSubmit(table);
db.SubmitChanges();
}
}
public static void UpdateProject_HJGLData_HJGL(Model.Project_HJGLData_HJGL newtable)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
@@ -156,11 +155,10 @@ namespace BLL
db.SubmitChanges();
}
}
}
public static void DeleteProject_HJGLData_HJGLById(string Id)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_HJGLData_HJGL table = db.Project_HJGLData_HJGL.FirstOrDefault(x => x.Id == Id);
if (table != null)
@@ -169,8 +167,6 @@ namespace BLL
db.SubmitChanges();
}
}
}
/// <summary>
/// 判断该项目的该日期是否统计数据
@@ -223,7 +219,7 @@ namespace BLL
/// </summary>
public static void StatisticalAllProjectData()
{
var projectlist = ProjectService.GetCNCECShowProjectList();
var projectlist = ProjectService.GetProjectWorkList();
foreach (var item in projectlist)
{
StatisticalData(item.ProjectId, HJGLDateType.All);
@@ -311,7 +307,7 @@ namespace BLL
{
int result = Convert.ToInt32((from x in Funs.DB.HJGL_WeldJoint
where x.ProjectId == projectid
select x.Size).ToList().Sum(x=>x.Value));
select x.Size).ToList().Sum(x => x.Value));
return result;
}
/// <summary>
@@ -333,7 +329,7 @@ namespace BLL
{
int result = (from x in Funs.DB.HJGL_Batch_NDEItem
join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID
where y.ProjectId == projectid
where y.ProjectId == projectid
select x.TotalFilm).ToList().Sum(x => x.Value);
return result;
}
@@ -345,10 +341,43 @@ namespace BLL
{
int result = (from x in Funs.DB.HJGL_Batch_NDEItem
join y in Funs.DB.HJGL_Batch_NDE on x.NDEID equals y.NDEID
where y.ProjectId == projectid
where y.ProjectId == projectid
select x.PassFilm).ToList().Sum(x => x.Value);
return result;
}
#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
{
@@ -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>
@@ -371,7 +385,7 @@ namespace BLL
/// </summary>
public static void StatisticalAllProjectData()
{
var projectlist = ProjectService.GetCNCECShowProjectList();
var projectlist = ProjectService.GetProjectWorkList();
foreach (var item in projectlist) StatisticalData(item.ProjectId, HSSEDateType.All);
}
@@ -606,7 +620,7 @@ namespace BLL
public static int GetJoinConstructionPersonNum(string projectid)
{
var result = (from x in Funs.DB.SitePerson_Person
where x.ProjectId == projectid && x.States=="1"
where x.ProjectId == projectid && x.States == "1"
select x).Count();
return result;
}
@@ -629,11 +643,10 @@ namespace BLL
/// <returns></returns>
public static int GetTotalWorkingHour(string projectid)
{
var result = (from x in Funs.DB.SeDin_MonthReport2
join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId
where y.ProjectId == projectid
orderby y.ReporMonth descending
select x.ProjectWorkTime ?? 0).FirstOrDefault();
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();
var q = Funs.GetNewIntOrZero(result.ToString().Split('.')[0]);
return q;
@@ -665,11 +678,10 @@ namespace BLL
/// <returns></returns>
public static int GetSafeWorkingHour(string projectid)
{
var result1 = (from x in Funs.DB.SeDin_MonthReport2
join y in Funs.DB.SeDin_MonthReport on x.MonthReportId equals y.MonthReportId
where y.ProjectId == projectid
orderby y.ReporMonth descending
select x.ProjectWorkTime ?? 0).FirstOrDefault();
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();
var result2 =
(from x in Funs.DB.Accident_AccidentHandle
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
@@ -694,7 +706,7 @@ namespace BLL
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();
select x.TrainPersonNum ?? 0).ToList().Sum();
return result;
}
@@ -707,7 +719,7 @@ namespace BLL
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();
select x.TrainPersonNum ?? 0).ToList().Sum();
return result;
}
@@ -720,7 +732,7 @@ namespace BLL
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();
select x.TrainPersonNum ?? 0).ToList().Sum();
return result;
}
@@ -801,7 +813,7 @@ 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.States=="1"
where x.ProjectId == projectid && x.WorkPostId == Const.WorkPost_ProjectHSSEDirector && x.States == "1"
select x).Count();
return result;
}
@@ -851,8 +863,9 @@ 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.States == "1"
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.States == "1"
select x).Count();
return result;
}
@@ -864,8 +877,9 @@ 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.States == "1"
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.States == "1"
select x).Count();
return result;
}
@@ -877,8 +891,9 @@ 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.States == "1"
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.States == "1"
select x).Count();
return result;
}
@@ -968,7 +983,7 @@ 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
where x.ProjectId == projectid && x.CheckDate > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1202,7 +1217,7 @@ namespace BLL
(from x in Funs.DB.InApproveManager_GeneralEquipmentInItem
join y in Funs.DB.InApproveManager_GeneralEquipmentIn on x.GeneralEquipmentInId equals y
.GeneralEquipmentInId
where y.ProjectId == projectid
where y.ProjectId == projectid
select x).Count();
return result;
}
@@ -1227,34 +1242,9 @@ namespace BLL
public static int GetLicensesNum(string projectid)
{
var result = (from x in Funs.DB.License_LicenseManager
where x.ProjectId == projectid && x.CompileDate > Const.DtmarkTime
where x.ProjectId == projectid && x.IsHighRisk == true && x.CompileDate > Const.DtmarkTime
select x).Count();
var result1 = (from x in Funs.DB.License_BreakGround
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result2 = (from x in Funs.DB.License_FireWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result3 = (from x in Funs.DB.License_HeightWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result4 = (from x in Funs.DB.License_LiftingWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result5 = (from x in Funs.DB.License_LimitedSpace
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result6 = (from x in Funs.DB.License_NightWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result7 = (from x in Funs.DB.License_OpenCircuit
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
var result8 = (from x in Funs.DB.License_RadialWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime
select x).Count();
return (result+ result1+ result2+ result3+ result4+ result5+ result6+ result7+ result8);
return result;
}
/// <summary>
@@ -1264,36 +1254,10 @@ namespace BLL
public static int GetLicensesCloseNum(string projectid)
{
var result = (from x in Funs.DB.License_LicenseManager
where x.ProjectId == projectid && x.WorkStates == "3" &&
where x.ProjectId == projectid && x.IsHighRisk == true && x.WorkStates == "3" &&
x.CompileDate > Const.DtmarkTime
select x).Count();
var result1 = (from x in Funs.DB.License_BreakGround
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result2 = (from x in Funs.DB.License_FireWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result3 = (from x in Funs.DB.License_HeightWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result4 = (from x in Funs.DB.License_LiftingWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result5 = (from x in Funs.DB.License_LimitedSpace
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result6 = (from x in Funs.DB.License_NightWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result7 = (from x in Funs.DB.License_OpenCircuit
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
var result8 = (from x in Funs.DB.License_RadialWork
where x.ProjectId == projectid && x.ValidityStartTime > Const.DtmarkTime && x.States == "3"
select x).Count();
return (result + result1 + result2 + result3 + result4 + result5 + result6 + result7 + result8);
return result;
}
/// <summary>
@@ -1303,7 +1267,8 @@ namespace BLL
public static int GetGeneralClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" && x.CheckTime > Const.DtmarkTime
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States == "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
}
@@ -1315,7 +1280,7 @@ namespace BLL
public static int GetGeneralNotClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" &&
where x.ProjectId == projectid && (x.HazardValue == "0.3" || x.HazardValue == "1" || x.HazardValue == null) && x.States != "3" && x.States != "-1" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
@@ -1328,7 +1293,7 @@ namespace BLL
public static int GetMajorClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.HazardValue == "3" && x.States == "3" &&
where x.ProjectId == projectid && x.HazardValue == "3" && x.States == "3" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
@@ -1341,7 +1306,7 @@ namespace BLL
public static int GetMajorNotClosedNum(string projectid)
{
var result = (from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.ProjectId == projectid && x.HazardValue == "3" && x.States != "3" &&
where x.ProjectId == projectid && x.HazardValue == "3" && x.States != "3" && x.States != "-1" &&
x.CheckTime > Const.DtmarkTime
select x).Count();
return result;
@@ -1355,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
select x).Count();
return result;
}
@@ -1369,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
select x).Count();
return result;
}
@@ -1383,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
select x).Count();
return result;
}
@@ -1397,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
select x).Count();
return result;
}
@@ -1621,5 +1582,38 @@ namespace BLL
}
#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;
@@ -113,8 +114,9 @@ namespace BLL
}
public static void AddBulkProject_HSSEData_HiddenDangerDetails(List<Model.Project_HSSEData_HiddenDangerDetail> newtables)
{
using (var db = new SGGLDB(Funs.ConnString))
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HSSEData_HiddenDangerDetail.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
@@ -174,7 +176,7 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
var table = db.Project_HSSEData_HiddenDangerDetail.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 );
db.Project_HSSEData_HiddenDangerDetail.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
@@ -208,10 +210,68 @@ 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
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
group x by x.TypeName into g
select new Model.HSSEDataHiddenDangerDetailItem
{
Id = SQLHelper.GetNewID(),
TypeName= g.Key,
NeedRectifyNum= g.Sum(p => p.NeedRectifyNum),
TotalNum= g.Sum(p => p.TotalNum)
}).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();
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
{
@@ -226,7 +286,7 @@ namespace BLL
{
var db = Funs.DB;
var projectids = ProjectService.GetCNCECShowProjectList().Select(x => x.ProjectId).ToList();
var projectids = ProjectService.GetProjectWorkList().Select(x => x.ProjectId).ToList();
var thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
if (thisUnit != null)
@@ -234,25 +294,24 @@ namespace BLL
thisUnitId = thisUnit.UnitId;
}
var baseUnit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
var list = from x in db.HSSE_Hazard_HazardRegister
where projectids.Contains(x.ProjectId)
select x;
var list = from x in db.HSSE_Hazard_HazardRegister where projectids.Contains(x.ProjectId)
select x;
var data = (from x in list
join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId
group x by new
{ x.ProjectId, x.RegisterTypesId, y.RegisterTypesName }
join y in db.HSSE_Hazard_HazardRegisterTypes on x.RegisterTypesId equals y.RegisterTypesId
group x by new
{ x.ProjectId, x.RegisterTypesId ,y.RegisterTypesName}
into g
select new
{
UnitId = thisUnitId,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ProjectId = g.Key.ProjectId,
ReportDate = DateTime.Now.Date,
TypeName = g.Key.RegisterTypesName,
TotalNum = g.Count(),
NeedRectifyNum = g.Count(x => x.States == "1"),
}).ToList();
select new
{
UnitId = thisUnitId,
CollCropCode = baseUnit.CollCropCode,
UnitName = baseUnit.UnitName,
ProjectId= g.Key.ProjectId,
ReportDate = DateTime.Now.Date,
TypeName=g.Key.RegisterTypesName,
TotalNum = g.Count(),
NeedRectifyNum = g.Count(x => x.States == "1"),
}).ToList();
DeleteProject_HSSEData_HiddenDangerDetailByDate(DateTime.Now.Date);
var projectHsseDataHiddenDangerDetails = new List<Project_HSSEData_HiddenDangerDetail>();
foreach (var item in data)
@@ -57,7 +57,7 @@ namespace BLL
public static int count
{
get;
set;
set;
}
public static List<Model.Project_SYHSEData_SYHSE> GetProject_SYHSEData_SYHSEByModle(Model.Project_SYHSEData_SYHSE table)
{
@@ -67,7 +67,7 @@ namespace BLL
(string.IsNullOrEmpty(table.ProjectId) || x.Id.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.CollCropCode) || x.CollCropCode.Contains(table.CollCropCode)) &&
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName))
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName))
select x
;
@@ -81,13 +81,13 @@ namespace BLL
/// <returns></returns>
public static IEnumerable getListData(Model.Project_SYHSEData_SYHSE table, Grid Grid1)
{
var q = GetProject_SYHSEData_SYHSEByModle(table);
var q = GetProject_SYHSEData_SYHSEByModle(table);
count = q.Count();
if (count == 0)
{
return null;
}
//q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
//q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
{
@@ -142,113 +142,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>
/// 判断当天是否统计过数据
@@ -284,7 +291,7 @@ namespace BLL
/// </summary>
public static void StatisticalAllProjectData()
{
var projectlist = ProjectService.GetCNCECShowProjectList();
var projectlist = ProjectService.GetProjectWorkList();
foreach (var item in projectlist)
{
StatisticalData(item.ProjectId, SYHSESDateType.All);
@@ -295,7 +302,7 @@ namespace BLL
/// </summary>
/// <param name="projectid"></param>
/// <param name="sYHSESDateType"></param>
public static void StatisticalData(string projectid, SYHSESDateType sYHSESDateType)
public static void StatisticalData(string projectid,SYHSESDateType sYHSESDateType)
{
string thisUnitId = string.Empty;
var thisUnit = CommonService.GetIsThisUnit();
@@ -319,7 +326,7 @@ namespace BLL
table.ProjectId = projectid;
table.ReportDate = DateTime.Now.Date;
if (sYHSESDateType == SYHSESDateType.RiskControl || sYHSESDateType == SYHSESDateType.All)
if (sYHSESDateType== SYHSESDateType.RiskControl || sYHSESDateType == SYHSESDateType.All)
{
table.GeneralRiskNum = GetGeneralRiskNum(projectid);
table.LowRiskNum = GetLowRiskNum(projectid);