修改上报接口
This commit is contained in:
parent
97207481b2
commit
cdf073a097
|
@ -1,464 +1,468 @@
|
|||
using FineUIPro;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.POIFS.Crypt.Dsig;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class CQMSDataService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 集团接口地址
|
||||
/// </summary>
|
||||
public static string CNCECServerUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
#region 获取列表
|
||||
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static List<Model.CQMSData_CQMS> GetCQMSData_CQMSByModle(Model.CQMSData_CQMS table)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.CQMSData_CQMS
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(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))
|
||||
orderby x.ReportDate descending
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="PageIndex">页码</param>
|
||||
/// <param name="PageSize">每页数量</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(Model.CQMSData_CQMS table, Grid Grid1)
|
||||
{
|
||||
var q = GetCQMSData_CQMSByModle(table);
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.UnitId,
|
||||
x.CollCropCode,
|
||||
x.UnitName,
|
||||
x.ReportDate,
|
||||
x.TrainPersonNum,
|
||||
x.TechnicalDisclosePersonNum,
|
||||
x.UseNum,
|
||||
x.OKNum,
|
||||
x.CompanyPersonNum,
|
||||
x.BranchPersonNum,
|
||||
x.ProjectPersonNum,
|
||||
x.ProblemNum,
|
||||
x.ProblemCompletedNum,
|
||||
x.ProblemNotCompletedNum,
|
||||
x.SNum,
|
||||
x.ANum,
|
||||
x.BNum,
|
||||
x.CNum,
|
||||
x.KeyProcessNum,
|
||||
x.KeyProcessOKNum,
|
||||
x.SpecialProcessNum,
|
||||
x.SpecialProcessOKNum,
|
||||
x.ConcealedWorksNum,
|
||||
x.ConcealedWorksOKNum,
|
||||
x.UnitProjectOnesNum,
|
||||
x.UnitProjectOnesOKNum,
|
||||
x.MaterialInRecheckNum,
|
||||
x.MaterialInRecheckOKNum,
|
||||
x.SingleProjectNum,
|
||||
x.UnitProjectNum,
|
||||
x.SubProjectNum,
|
||||
x.SubdivisionalWorksNum,
|
||||
x.InspectionLotNum,
|
||||
x.State,
|
||||
x.CreateDate,
|
||||
x.CreateMan,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion 获取列表
|
||||
|
||||
public static void AddCQMSData_CQMS(Model.CQMSData_CQMS newtable)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CQMSData_CQMS table = new Model.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 DeleteCQMSData_CQMSById(string Id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CQMSData_CQMS table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
db.CQMSData_CQMS.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static Model.CQMSData_CQMS GetCQMSData_CQMSById(string Id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
return db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
public static Model.CQMSData GetItemById(string Id)
|
||||
{
|
||||
var model = GetCQMSData_CQMSById(Id);
|
||||
CQMSData data = new CQMSData();
|
||||
CqmsDataItem item = new CqmsDataItem();
|
||||
if (model != null)
|
||||
{
|
||||
item.Id = model.Id;
|
||||
item.ReportDate = model.ReportDate.Value.ToShortDateString();
|
||||
item.UnitId = model.UnitId;
|
||||
item.CollCropCode = model.CollCropCode;
|
||||
item.TrainPersonNum = model.TrainPersonNum;
|
||||
item.TechnicalDisclosePersonNum = model.TechnicalDisclosePersonNum;
|
||||
item.UseNum = model.UseNum;
|
||||
item.OKNum = model.OKNum;
|
||||
item.CompanyPersonNum = model.CompanyPersonNum;
|
||||
item.BranchPersonNum = model.BranchPersonNum;
|
||||
item.ProjectPersonNum = model.ProjectPersonNum;
|
||||
item.ProblemNum = model.ProblemNum;
|
||||
item.ProblemCompletedNum = model.ProblemCompletedNum;
|
||||
item.ProblemNotCompletedNum = model.ProblemNotCompletedNum;
|
||||
item.ProblemRate = "";
|
||||
item.SNum = model.SNum;
|
||||
item.ANum = model.ANum;
|
||||
item.BNum = model.BNum;
|
||||
item.CNum = model.CNum;
|
||||
item.KeyProcessNum = model.KeyProcessNum;
|
||||
item.KeyProcessOKNum = model.KeyProcessOKNum;
|
||||
item.KeyProcessRate = "";
|
||||
item.SpecialProcessNum = model.SpecialProcessNum;
|
||||
item.SpecialProcessOKNum = model.SpecialProcessOKNum;
|
||||
item.SpecialProcessRate = "";
|
||||
item.ConcealedWorksNum = model.ConcealedWorksNum;
|
||||
item.ConcealedWorksOKNum = model.ConcealedWorksOKNum;
|
||||
item.ConcealedWorksRate = "";
|
||||
item.UnitProjectOnesNum = model.UnitProjectOnesNum;
|
||||
item.UnitProjectOnesOKNum = model.UnitProjectOnesOKNum;
|
||||
item.UnitProjectOnesRate = "";
|
||||
item.MaterialInRecheckNum = model.MaterialInRecheckNum;
|
||||
item.MaterialInRecheckOKNum = model.MaterialInRecheckOKNum;
|
||||
item.MaterialInRecheckRate = "";
|
||||
item.SingleProjectNum = model.SingleProjectNum;
|
||||
item.UnitProjectNum = model.UnitProjectNum;
|
||||
item.SubProjectNum = model.SubProjectNum;
|
||||
item.SubdivisionalWorksNum = model.SubdivisionalWorksNum;
|
||||
item.InspectionLotNum = model.InspectionLotNum;
|
||||
}
|
||||
List<CqmsDataItem> cqmsDataItems = new List<CqmsDataItem>();
|
||||
cqmsDataItems.Add(item);
|
||||
data.CQMSDataItems = cqmsDataItems;
|
||||
return data;
|
||||
}
|
||||
|
||||
public static Model.CQMSData GetTodayCQMSData_CQMS()
|
||||
{
|
||||
|
||||
var q = GetTodayData();
|
||||
CQMSData data = new CQMSData();
|
||||
if (q != null && q.State == Const.CNCEC_State_S)
|
||||
{
|
||||
data = GetDataByCQMSData_CQMS(q);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = StatisticalData();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static Model.CQMSData_CQMS GetTodayData()
|
||||
{
|
||||
var q = (from x in Funs.DB.CQMSData_CQMS
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).FirstOrDefault();
|
||||
return q;
|
||||
}
|
||||
public static void UpdateTodyData_State()
|
||||
{
|
||||
var q = GetTodayData();
|
||||
if (q!=null )
|
||||
{
|
||||
q.State = Const.CNCEC_State_1;
|
||||
UpdateCQMSData_CQMS(q);
|
||||
|
||||
}
|
||||
}
|
||||
public static bool IsReportByDate(DateTime dateTime)
|
||||
{
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.CQMSData_CQMS
|
||||
where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date)
|
||||
select x).ToList();
|
||||
if (q != null && q.Count > 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断当天是否已统计
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool IsReportByToday()
|
||||
{
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.CQMSData_CQMS
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
if (q != null && q.Count > 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Model.ReturnData PushCNCEC(string Id)
|
||||
{
|
||||
string baseurl = "/api/CQMSData/SaveCQMSData";
|
||||
var item = GetItemById(Id);
|
||||
string str = JsonConvert.SerializeObject(item);
|
||||
var responeData = BLL.ServerService.PushCNCEC(str, baseurl);
|
||||
return responeData;
|
||||
}
|
||||
|
||||
public static CQMSData StatisticalData()
|
||||
{
|
||||
string thisUnitId = string.Empty;
|
||||
var thisUnit = Const.UnitId_CWCEC;
|
||||
if (thisUnit != null)
|
||||
{
|
||||
thisUnitId = thisUnit;
|
||||
}
|
||||
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
|
||||
Project_CQMSDataService.StatisticalAllProjectData();
|
||||
|
||||
var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
Model.CQMSData_CQMS table = new Model.CQMSData_CQMS
|
||||
{
|
||||
UnitId = thisUnitId,
|
||||
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 = ProjectData.Sum(x => x.CompanyPersonNum),
|
||||
BranchPersonNum = ProjectData.Sum(x => x.BranchPersonNum),
|
||||
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,
|
||||
};
|
||||
if (IsReportByToday())
|
||||
{
|
||||
table.Id = GetTodayData().Id;
|
||||
table.State = Const.CNCEC_State_1;
|
||||
UpdateCQMSData_CQMS(table);
|
||||
}
|
||||
else
|
||||
{
|
||||
table.Id = SQLHelper.GetNewID();
|
||||
table.State = Const.CNCEC_State_0;
|
||||
AddCQMSData_CQMS(table);
|
||||
}
|
||||
CQMSData data = new CQMSData();
|
||||
data = GetDataByCQMSData_CQMS(table);
|
||||
return data;
|
||||
}
|
||||
public static CQMSData GetDataByCQMSData_CQMS(Model.CQMSData_CQMS table)
|
||||
{
|
||||
CQMSData data = new CQMSData();
|
||||
CqmsDataItem item = new CqmsDataItem();
|
||||
item.Id = table.Id;
|
||||
item.ReportDate = table.ReportDate.Value.ToShortDateString();
|
||||
item.UnitId = table.UnitId;
|
||||
item.CollCropCode = table.CollCropCode;
|
||||
item.TrainPersonNum = table.TrainPersonNum;
|
||||
item.TechnicalDisclosePersonNum = table.TechnicalDisclosePersonNum;
|
||||
item.UseNum = table.UseNum;
|
||||
item.OKNum = table.OKNum;
|
||||
item.CompanyPersonNum = table.CompanyPersonNum;
|
||||
item.BranchPersonNum = table.BranchPersonNum;
|
||||
item.ProjectPersonNum = table.ProjectPersonNum;
|
||||
item.ProblemNum = table.ProblemNum;
|
||||
item.ProblemCompletedNum = table.ProblemCompletedNum;
|
||||
item.ProblemNotCompletedNum = table.ProblemNotCompletedNum;
|
||||
item.ProblemRate = "";
|
||||
item.SNum = table.SNum;
|
||||
item.ANum = table.ANum;
|
||||
item.BNum = table.BNum;
|
||||
item.CNum = table.CNum;
|
||||
item.KeyProcessNum = table.KeyProcessNum;
|
||||
item.KeyProcessOKNum = table.KeyProcessOKNum;
|
||||
item.KeyProcessRate = "";
|
||||
item.SpecialProcessNum = table.SpecialProcessNum;
|
||||
item.SpecialProcessOKNum = table.SpecialProcessOKNum;
|
||||
item.SpecialProcessRate = "";
|
||||
item.ConcealedWorksNum = table.ConcealedWorksNum;
|
||||
item.ConcealedWorksOKNum = table.ConcealedWorksOKNum;
|
||||
item.ConcealedWorksRate = "";
|
||||
item.UnitProjectOnesNum = table.UnitProjectOnesNum;
|
||||
item.UnitProjectOnesOKNum = table.UnitProjectOnesOKNum;
|
||||
item.UnitProjectOnesRate = "";
|
||||
item.MaterialInRecheckNum = table.MaterialInRecheckNum;
|
||||
item.MaterialInRecheckOKNum = table.MaterialInRecheckOKNum;
|
||||
item.MaterialInRecheckRate = "";
|
||||
item.SingleProjectNum = table.SingleProjectNum;
|
||||
item.UnitProjectNum = table.UnitProjectNum;
|
||||
item.SubProjectNum = table.SubProjectNum;
|
||||
item.SubdivisionalWorksNum = table.SubdivisionalWorksNum;
|
||||
item.InspectionLotNum = table.InspectionLotNum;
|
||||
List<CqmsDataItem> cqmsDataItems = new List<CqmsDataItem>();
|
||||
cqmsDataItems.Add(item);
|
||||
data.CQMSDataItems = cqmsDataItems;
|
||||
return data;
|
||||
}
|
||||
public static void UpdateCQMSData_CQMS(Model.CQMSData_CQMS newtable)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CQMSData_CQMS 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.POIFS.Crypt.Dsig;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class CQMSDataService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 集团接口地址
|
||||
/// </summary>
|
||||
public static string CNCECServerUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
#region 获取列表
|
||||
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static List<Model.CQMSData_CQMS> GetCQMSData_CQMSByModle(Model.CQMSData_CQMS table)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.CQMSData_CQMS
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(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))
|
||||
orderby x.ReportDate descending
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="PageIndex">页码</param>
|
||||
/// <param name="PageSize">每页数量</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(Model.CQMSData_CQMS table, Grid Grid1)
|
||||
{
|
||||
var q = GetCQMSData_CQMSByModle(table);
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.UnitId,
|
||||
x.CollCropCode,
|
||||
x.UnitName,
|
||||
x.ReportDate,
|
||||
x.TrainPersonNum,
|
||||
x.TechnicalDisclosePersonNum,
|
||||
x.UseNum,
|
||||
x.OKNum,
|
||||
x.CompanyPersonNum,
|
||||
x.BranchPersonNum,
|
||||
x.ProjectPersonNum,
|
||||
x.ProblemNum,
|
||||
x.ProblemCompletedNum,
|
||||
x.ProblemNotCompletedNum,
|
||||
x.SNum,
|
||||
x.ANum,
|
||||
x.BNum,
|
||||
x.CNum,
|
||||
x.KeyProcessNum,
|
||||
x.KeyProcessOKNum,
|
||||
x.SpecialProcessNum,
|
||||
x.SpecialProcessOKNum,
|
||||
x.ConcealedWorksNum,
|
||||
x.ConcealedWorksOKNum,
|
||||
x.UnitProjectOnesNum,
|
||||
x.UnitProjectOnesOKNum,
|
||||
x.MaterialInRecheckNum,
|
||||
x.MaterialInRecheckOKNum,
|
||||
x.SingleProjectNum,
|
||||
x.UnitProjectNum,
|
||||
x.SubProjectNum,
|
||||
x.SubdivisionalWorksNum,
|
||||
x.InspectionLotNum,
|
||||
x.State,
|
||||
x.CreateDate,
|
||||
x.CreateMan,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion 获取列表
|
||||
|
||||
public static void AddCQMSData_CQMS(Model.CQMSData_CQMS newtable)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CQMSData_CQMS table = new Model.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 DeleteCQMSData_CQMSById(string Id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CQMSData_CQMS table = db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
db.CQMSData_CQMS.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static Model.CQMSData_CQMS GetCQMSData_CQMSById(string Id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
return db.CQMSData_CQMS.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
public static Model.CQMSData GetItemById(string Id)
|
||||
{
|
||||
var model = GetCQMSData_CQMSById(Id);
|
||||
CQMSData data = new CQMSData();
|
||||
CqmsDataItem item = new CqmsDataItem();
|
||||
if (model != null)
|
||||
{
|
||||
item.Id = model.Id;
|
||||
item.ReportDate = model.ReportDate.Value.ToShortDateString();
|
||||
item.UnitId = model.UnitId;
|
||||
item.CollCropCode = model.CollCropCode;
|
||||
item.TrainPersonNum = model.TrainPersonNum;
|
||||
item.TechnicalDisclosePersonNum = model.TechnicalDisclosePersonNum;
|
||||
item.UseNum = model.UseNum;
|
||||
item.OKNum = model.OKNum;
|
||||
item.CompanyPersonNum = model.CompanyPersonNum;
|
||||
item.BranchPersonNum = model.BranchPersonNum;
|
||||
item.ProjectPersonNum = model.ProjectPersonNum;
|
||||
item.ProblemNum = model.ProblemNum;
|
||||
item.ProblemCompletedNum = model.ProblemCompletedNum;
|
||||
item.ProblemNotCompletedNum = model.ProblemNotCompletedNum;
|
||||
item.ProblemRate = "";
|
||||
item.SNum = model.SNum;
|
||||
item.ANum = model.ANum;
|
||||
item.BNum = model.BNum;
|
||||
item.CNum = model.CNum;
|
||||
item.KeyProcessNum = model.KeyProcessNum;
|
||||
item.KeyProcessOKNum = model.KeyProcessOKNum;
|
||||
item.KeyProcessRate = "";
|
||||
item.SpecialProcessNum = model.SpecialProcessNum;
|
||||
item.SpecialProcessOKNum = model.SpecialProcessOKNum;
|
||||
item.SpecialProcessRate = "";
|
||||
item.ConcealedWorksNum = model.ConcealedWorksNum;
|
||||
item.ConcealedWorksOKNum = model.ConcealedWorksOKNum;
|
||||
item.ConcealedWorksRate = "";
|
||||
item.UnitProjectOnesNum = model.UnitProjectOnesNum;
|
||||
item.UnitProjectOnesOKNum = model.UnitProjectOnesOKNum;
|
||||
item.UnitProjectOnesRate = "";
|
||||
item.MaterialInRecheckNum = model.MaterialInRecheckNum;
|
||||
item.MaterialInRecheckOKNum = model.MaterialInRecheckOKNum;
|
||||
item.MaterialInRecheckRate = "";
|
||||
item.SingleProjectNum = model.SingleProjectNum;
|
||||
item.UnitProjectNum = model.UnitProjectNum;
|
||||
item.SubProjectNum = model.SubProjectNum;
|
||||
item.SubdivisionalWorksNum = model.SubdivisionalWorksNum;
|
||||
item.InspectionLotNum = model.InspectionLotNum;
|
||||
}
|
||||
List<CqmsDataItem> cqmsDataItems = new List<CqmsDataItem>();
|
||||
cqmsDataItems.Add(item);
|
||||
data.CQMSDataItems = cqmsDataItems;
|
||||
return data;
|
||||
}
|
||||
|
||||
public static Model.CQMSData GetTodayCQMSData_CQMS()
|
||||
{
|
||||
|
||||
var q = GetTodayData();
|
||||
CQMSData data = new CQMSData();
|
||||
if (q != null && q.State == Const.CNCEC_State_S)
|
||||
{
|
||||
data = GetDataByCQMSData_CQMS(q);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = StatisticalData();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static Model.CQMSData_CQMS GetTodayData()
|
||||
{
|
||||
var q = (from x in Funs.DB.CQMSData_CQMS
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).FirstOrDefault();
|
||||
return q;
|
||||
}
|
||||
public static void UpdateTodyData_State()
|
||||
{
|
||||
var q = GetTodayData();
|
||||
if (q!=null )
|
||||
{
|
||||
q.State = Const.CNCEC_State_1;
|
||||
UpdateCQMSData_CQMS(q);
|
||||
|
||||
}
|
||||
}
|
||||
public static bool IsReportByDate(DateTime dateTime)
|
||||
{
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.CQMSData_CQMS
|
||||
where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date)
|
||||
select x).ToList();
|
||||
if (q != null && q.Count > 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断当天是否已统计
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool IsReportByToday()
|
||||
{
|
||||
var result = false;
|
||||
var q = (from x in Funs.DB.CQMSData_CQMS
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
if (q != null && q.Count > 0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Model.ReturnData PushCNCEC(string Id)
|
||||
{
|
||||
string baseurl = "/api/CQMSData/SaveCQMSData";
|
||||
var item = GetItemById(Id);
|
||||
string str = JsonConvert.SerializeObject(item);
|
||||
var responeData = BLL.ServerService.PushCNCEC(str, baseurl);
|
||||
return responeData;
|
||||
}
|
||||
|
||||
public static CQMSData StatisticalData()
|
||||
{
|
||||
string thisUnitId = string.Empty;
|
||||
var thisUnit = Const.UnitId_CWCEC;
|
||||
if (thisUnit != null)
|
||||
{
|
||||
thisUnitId = thisUnit;
|
||||
}
|
||||
var base_Unit = BLL.UnitService.GetUnitByUnitId(thisUnitId);
|
||||
Project_CQMSDataService.StatisticalAllProjectData();
|
||||
|
||||
var ProjectData = (from x in Funs.DB.Project_CQMSData_CQMS
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
Model.CQMSData_CQMS table = new Model.CQMSData_CQMS
|
||||
{
|
||||
UnitId = thisUnitId,
|
||||
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,
|
||||
};
|
||||
if (IsReportByToday())
|
||||
{
|
||||
table.Id = GetTodayData().Id;
|
||||
table.State = Const.CNCEC_State_1;
|
||||
UpdateCQMSData_CQMS(table);
|
||||
}
|
||||
else
|
||||
{
|
||||
table.Id = SQLHelper.GetNewID();
|
||||
table.State = Const.CNCEC_State_0;
|
||||
AddCQMSData_CQMS(table);
|
||||
}
|
||||
CQMSData data = new CQMSData();
|
||||
data = GetDataByCQMSData_CQMS(table);
|
||||
return data;
|
||||
}
|
||||
public static CQMSData GetDataByCQMSData_CQMS(Model.CQMSData_CQMS table)
|
||||
{
|
||||
CQMSData data = new CQMSData();
|
||||
CqmsDataItem item = new CqmsDataItem();
|
||||
item.Id = table.Id;
|
||||
item.ReportDate = table.ReportDate.Value.ToShortDateString();
|
||||
item.UnitId = table.UnitId;
|
||||
item.CollCropCode = table.CollCropCode;
|
||||
item.TrainPersonNum = table.TrainPersonNum;
|
||||
item.TechnicalDisclosePersonNum = table.TechnicalDisclosePersonNum;
|
||||
item.UseNum = table.UseNum;
|
||||
item.OKNum = table.OKNum;
|
||||
item.CompanyPersonNum = table.CompanyPersonNum;
|
||||
item.BranchPersonNum = table.BranchPersonNum;
|
||||
item.ProjectPersonNum = table.ProjectPersonNum;
|
||||
item.ProblemNum = table.ProblemNum;
|
||||
item.ProblemCompletedNum = table.ProblemCompletedNum;
|
||||
item.ProblemNotCompletedNum = table.ProblemNotCompletedNum;
|
||||
item.ProblemRate = "";
|
||||
item.SNum = table.SNum;
|
||||
item.ANum = table.ANum;
|
||||
item.BNum = table.BNum;
|
||||
item.CNum = table.CNum;
|
||||
item.KeyProcessNum = table.KeyProcessNum;
|
||||
item.KeyProcessOKNum = table.KeyProcessOKNum;
|
||||
item.KeyProcessRate = "";
|
||||
item.SpecialProcessNum = table.SpecialProcessNum;
|
||||
item.SpecialProcessOKNum = table.SpecialProcessOKNum;
|
||||
item.SpecialProcessRate = "";
|
||||
item.ConcealedWorksNum = table.ConcealedWorksNum;
|
||||
item.ConcealedWorksOKNum = table.ConcealedWorksOKNum;
|
||||
item.ConcealedWorksRate = "";
|
||||
item.UnitProjectOnesNum = table.UnitProjectOnesNum;
|
||||
item.UnitProjectOnesOKNum = table.UnitProjectOnesOKNum;
|
||||
item.UnitProjectOnesRate = "";
|
||||
item.MaterialInRecheckNum = table.MaterialInRecheckNum;
|
||||
item.MaterialInRecheckOKNum = table.MaterialInRecheckOKNum;
|
||||
item.MaterialInRecheckRate = "";
|
||||
item.SingleProjectNum = table.SingleProjectNum;
|
||||
item.UnitProjectNum = table.UnitProjectNum;
|
||||
item.SubProjectNum = table.SubProjectNum;
|
||||
item.SubdivisionalWorksNum = table.SubdivisionalWorksNum;
|
||||
item.InspectionLotNum = table.InspectionLotNum;
|
||||
List<CqmsDataItem> cqmsDataItems = new List<CqmsDataItem>();
|
||||
cqmsDataItems.Add(item);
|
||||
data.CQMSDataItems = cqmsDataItems;
|
||||
return data;
|
||||
}
|
||||
public static void UpdateCQMSData_CQMS(Model.CQMSData_CQMS newtable)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CQMSData_CQMS 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>
/// 获取企业总部人数
/// </summary>
/// <returns></returns>
public static int GetCompanyPersonNum()
{
string unitId = BLL.Const.UnitId_CWCEC;
int result = (from x in Funs.DB.Person_CompanyBranchPerson
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.IsOnJob == true && y.IsCQMS == true && x.UnitId == unitId
select x).Count();
return result;
}
|
||||
|
||||
/// <summary>
/// 获取分支机构人数
/// </summary>
/// <returns></returns>
public static int GetBranchPersonNum()
{
string unitId = BLL.Const.UnitId_CWCEC;
int result = (from x in Funs.DB.Person_CompanyBranchPerson
join y in Funs.DB.Base_WorkPost on x.WorkPostId equals y.WorkPostId
where x.IsOnJob == true && y.IsCQMS == true && x.UnitId != unitId
select x).Count();
return result;
}
|
||||
}
|
||||
}
|
|
@ -538,9 +538,9 @@ namespace BLL
|
|||
var ProjectData = (from x in Funs.DB.Project_HSSEData_HSSE
|
||||
where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
|
||||
select x).ToList();
|
||||
//int TotalEnergyConsumption= Information_EnvironmentalDataService.GetLatstTimeTotalEnergyConsumption();
|
||||
//int IncomeComprehensiveEnergyConsumption = Information_EnvironmentalDataService.GetLatstTimeIncomeComprehensiveEnergyConsumption();
|
||||
//int NewWaterConsumption = Information_EnvironmentalDataService.GetLatstTimeNewWaterConsumption();
|
||||
decimal TotalEnergyConsumption = GetLatstTimeTotalEnergyConsumption();
|
||||
decimal IncomeComprehensiveEnergyConsumption = GetLatstTimeIncomeComprehensiveEnergyConsumption();
|
||||
decimal NewWaterConsumption = GetLatstTimeNewWaterConsumption();
|
||||
|
||||
Model.HSSEData_HSSE table = new Model.HSSEData_HSSE
|
||||
{
|
||||
|
@ -801,9 +801,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSafetyCommitteeMeetingNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Meeting_CompanySafetyMeeting where x.CompanySafetyMeetingDate.Value.Year == date.Year && x.CompanySafetyMeetingDate.Value.Month == date.Month && x.CompanySafetyMeetingDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Meeting_CompanySafetyMeeting select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业专题会议数
|
||||
|
@ -811,9 +810,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetEnterpriseTopicsMeetingNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Meeting_CompanySpecialMeeting where x.CompanySpecialMeetingDate.Value.Year == date.Year && x.CompanySpecialMeetingDate.Value.Month == date.Month && x.CompanySpecialMeetingDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Meeting_CompanySpecialMeeting select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -822,9 +820,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanyLeadShiftCheckNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "1" && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "1" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业综合检查次数
|
||||
|
@ -832,9 +829,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanyComprehensiveCheckNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "2" && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "2" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业专项检查次数
|
||||
|
@ -842,9 +838,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanySpecialCheckNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "3" && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Supervise_SuperviseCheckReport where x.CheckType == "3" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业级综合预案数
|
||||
|
@ -852,13 +847,11 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanyComprehensivePlanNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
||||
// join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
||||
// where x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month
|
||||
// && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("综合")
|
||||
// select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
||||
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
||||
where y.EmergencyTypeName.Contains("综合")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业级专项预案数
|
||||
|
@ -866,13 +859,11 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanySpecialPlanNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
||||
// join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
||||
// where x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month
|
||||
// && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("专项")
|
||||
// select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
||||
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
||||
where y.EmergencyTypeName.Contains("专项")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业级现场处置预案
|
||||
|
@ -880,13 +871,11 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanyOnSiteDisposalPlan()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
||||
// join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
||||
// where x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month
|
||||
// && x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("现场处置")
|
||||
// select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Emergency_EmergencyList_Unit
|
||||
join y in Funs.DB.Base_EmergencyType on x.EmergencyTypeId equals y.EmergencyTypeId
|
||||
where y.EmergencyTypeName.Contains("现场处置")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取企业级演练次数
|
||||
|
@ -894,12 +883,54 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompanyDrillNum()
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
|
||||
// where x.DrillRecordDate.Value.Year == date.Year && x.DrillRecordDate.Value.Month == date.Month
|
||||
// && x.DrillRecordDate.Value.Day == date.Day
|
||||
// select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Emergency_DrillRecordList_Unit
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static decimal GetLatstTimeTotalEnergyConsumption()
|
||||
{
|
||||
var q1 = (from x in db.Environmental_ChemicalReportItem where x.SortIndex == "01" select x);
|
||||
decimal d1 = 0;
|
||||
foreach (var item in q1)
|
||||
{
|
||||
d1 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||||
}
|
||||
var q2 = (from x in db.Environmental_ArchitectureReportItem where x.SortIndex == "01" select x);
|
||||
decimal d2 = 0;
|
||||
foreach (var item in q2)
|
||||
{
|
||||
d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||||
}
|
||||
return d1 + d2;
|
||||
}
|
||||
public static decimal GetLatstTimeIncomeComprehensiveEnergyConsumption()
|
||||
{
|
||||
var q2 = (from x in db.Environmental_ArchitectureReportItem where x.SortIndex == "15" select x);
|
||||
decimal d2 = 0;
|
||||
foreach (var item in q2)
|
||||
{
|
||||
d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||||
}
|
||||
return d2;
|
||||
|
||||
}
|
||||
public static decimal GetLatstTimeNewWaterConsumption()
|
||||
{
|
||||
var q1 = (from x in db.Environmental_ChemicalReportItem where x.SortIndex == "70" select x);
|
||||
decimal d1 = 0;
|
||||
foreach (var item in q1)
|
||||
{
|
||||
d1 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||||
}
|
||||
var q2 = (from x in db.Environmental_ArchitectureReportItem where x.SortIndex == "38" select x);
|
||||
decimal d2 = 0;
|
||||
foreach (var item in q2)
|
||||
{
|
||||
d2 += Funs.GetNewDecimalOrZero(item.ThisYearValue);
|
||||
}
|
||||
return d1 + d2;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -411,9 +411,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetTrainPersonNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Comprehensive_InspectionPerson
|
||||
where x.ProjectId == projectid && x.IsTrain == true && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month && x.CompileDate.Value.Day == date.Day
|
||||
where x.ProjectId == projectid && x.IsTrain == true
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -423,9 +422,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetTechnicalDisclosePersonNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
var result = (from x in Funs.DB.Comprehensive_DesignDetails
|
||||
where x.ProjectId == projectid && x.DetailsDate.Value.Year == date.Year && x.DetailsDate.Value.Month == date.Month && x.DetailsDate.Value.Day == date.Day
|
||||
where x.ProjectId == projectid
|
||||
select x.JoinPersonNum).ToList().Sum(x => x.Value);
|
||||
var q = Funs.GetNewIntOrZero(result.ToString());
|
||||
return q;
|
||||
|
|
|
@ -301,10 +301,32 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetTotalDineNum(string projectid)
|
||||
{
|
||||
//int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo
|
||||
// where x.ProjectId == projectid
|
||||
// select x.JOT_Size).ToList().Sum());
|
||||
return 0;
|
||||
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>
|
||||
/// 获取完成达因数
|
||||
|
@ -312,10 +334,32 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetCompleteDineNum(string projectid)
|
||||
{
|
||||
//int result = Convert.ToInt32((from x in Funs.DB.PW_JointInfo
|
||||
// where x.ProjectId == projectid
|
||||
// select x.JOT_DoneDin ).ToList().Sum());
|
||||
return 0;
|
||||
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>
|
||||
/// 获取总片数
|
||||
|
@ -323,11 +367,32 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
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());
|
||||
return 0;
|
||||
int result = 0;
|
||||
if (projectid != null)
|
||||
{
|
||||
var getD1 = from x in Funs.DB.HJGL_FL_NdtList
|
||||
where x.ProjectId == projectid.ToString()
|
||||
select x;
|
||||
if (getD1.Count() > 0)
|
||||
{
|
||||
foreach (var item in getD1)
|
||||
{
|
||||
result += Funs.GetNewIntOrZero(item.OneTimeFilmAmount.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.OneTimeFilmAmount.Split('.')[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取合格片数
|
||||
|
@ -335,11 +400,32 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
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());
|
||||
return 0;
|
||||
int result = 0;
|
||||
if (projectid != null)
|
||||
{
|
||||
var getD1 = from x in Funs.DB.HJGL_FL_NdtList
|
||||
where x.ProjectId == projectid.ToString()
|
||||
select x;
|
||||
if (getD1.Count() > 0)
|
||||
{
|
||||
foreach (var item in getD1)
|
||||
{
|
||||
result += Funs.GetNewIntOrZero(item.OneTimeFilmQualifiedAmount.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.OneTimeFilmQualifiedAmount.Split('.')[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -682,12 +682,11 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetTotalWorkingHour(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
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.Value.Year == date.Year && y.CompileDate.Value.Month == date.Month && y.CompileDate.Value.Day == date.Day
|
||||
select x.PersonWorkTime ).ToList().Sum(x=>x.Value);
|
||||
var q = Funs.GetNewIntOrZero(result.ToString());
|
||||
where y.ProjectId == projectid
|
||||
select x.PersonWorkTime).ToList().Sum(x => x.Value);
|
||||
var q = Funs.GetNewIntOrZero(result.ToString());
|
||||
return q;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -696,9 +695,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetLostWorkingHour(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
var result = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day select x.WorkHoursLoss).ToList().Sum(x => x.Value)
|
||||
+ (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day select x.WorkingHoursLoss).ToList().Sum(x => x.Value);
|
||||
var result = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid select x.WorkHoursLoss).ToList().Sum(x => x.Value)
|
||||
+ (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid select x.WorkingHoursLoss).ToList().Sum(x => x.Value);
|
||||
var q = Funs.GetNewIntOrZero(result.ToString());
|
||||
|
||||
return q;
|
||||
|
@ -709,13 +707,12 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSafeWorkingHour(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
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.Value.Year == date.Year && y.CompileDate.Value.Month == date.Month && y.CompileDate.Value.Day == date.Day
|
||||
where y.ProjectId == projectid
|
||||
select x.PersonWorkTime).ToList().Sum(x => x.Value);
|
||||
var result2 = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid && x.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day select x.WorkHoursLoss).ToList().Sum(x => x.Value)
|
||||
+ (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day select x.WorkingHoursLoss).ToList().Sum(x => x.Value);
|
||||
var result2 = (from x in Funs.DB.Accident_AccidentHandle where x.ProjectId == projectid select x.WorkHoursLoss).ToList().Sum(x => x.Value)
|
||||
+ (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid select x.WorkingHoursLoss).ToList().Sum(x => x.Value);
|
||||
var result = result1 - result2;
|
||||
var q = Funs.GetNewIntOrZero(result.ToString());
|
||||
|
||||
|
@ -727,10 +724,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSafeTrainNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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 && x.TrainStartDate.Value.Year == date.Year && x.TrainStartDate.Value.Month == date.Month && x.TrainStartDate.Value.Day == date.Day && y.TrainType == "1"
|
||||
where x.ProjectId == projectid && y.TrainType == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -740,10 +736,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSpecialTrainNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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 && x.TrainStartDate.Value.Year == date.Year && x.TrainStartDate.Value.Month == date.Month && x.TrainStartDate.Value.Day == date.Day && y.TrainType == "2"
|
||||
where x.ProjectId == projectid && y.TrainType == "2"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -753,10 +748,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSpecialOperationTrainNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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 && x.TrainStartDate.Value.Year == date.Year && x.TrainStartDate.Value.Month == date.Month && x.TrainStartDate.Value.Day == date.Day && y.TrainType == "3"
|
||||
where x.ProjectId == projectid && y.TrainType == "3"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -929,9 +923,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectSafetyLeadingGroupMeetingNum(string projectid)
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting where x.ProjectId == projectid && x.SafetyLeaderGroupMeetingDate.Value.Year == date.Year && x.SafetyLeaderGroupMeetingDate.Value.Month == date.Month && x.SafetyLeaderGroupMeetingDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Meeting_SafetyLeaderGroupMeeting where x.ProjectId == projectid select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取项目安全例会数
|
||||
|
@ -939,9 +932,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectSafetyMeetingNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Meeting_WeekMeeting where x.ProjectId == projectid && x.WeekMeetingDate.Value.Year == date.Year && x.WeekMeetingDate.Value.Month == date.Month && x.WeekMeetingDate.Value.Day == date.Day select x).Count()
|
||||
+ (from x in Funs.DB.Meeting_MonthMeeting where x.ProjectId == projectid && x.MonthMeetingDate.Value.Year == date.Year && x.MonthMeetingDate.Value.Month == date.Month && x.MonthMeetingDate.Value.Day == date.Day select x).Count();
|
||||
int result = (from x in Funs.DB.Meeting_WeekMeeting where x.ProjectId == projectid select x).Count()
|
||||
+ (from x in Funs.DB.Meeting_MonthMeeting where x.ProjectId == projectid select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -977,9 +969,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectLeadShiftCheckNum(string projectid)
|
||||
{
|
||||
//DateTime date = DateTime.Now;
|
||||
//int result = (from x in Funs.DB.Check_ProjectLeaderCheck where x.ProjectId == projectid && x.CheckDate.Value.Year == date.Year && x.CheckDate.Value.Month == date.Month && x.CheckDate.Value.Day == date.Day select x).Count();
|
||||
return 0;
|
||||
int result = (from x in Funs.DB.Check_ProjectLeaderCheck where x.ProjectId == projectid select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取项目专项检查次数
|
||||
|
@ -987,8 +978,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectSpecialCheckNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Check_CheckSpecial where x.ProjectId == projectid && x.CheckTime.Value.Year == date.Year && x.CheckTime.Value.Month == date.Month && x.CheckTime.Value.Day == date.Day select x).Count();
|
||||
int result = (from x in Funs.DB.Check_CheckSpecial where x.ProjectId == projectid select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -997,8 +987,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectMajorCheckNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.ProjectId == projectid && x.CheckTime.Value.Year == date.Year && x.CheckTime.Value.Month == date.Month && x.CheckTime.Value.Day == date.Day select x).Count();
|
||||
int result = (from x in Funs.DB.HSSE_Hazard_HazardRegister where x.ProjectId == projectid select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1007,10 +996,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetNearMissNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day && x.IsAttempt=="1"
|
||||
where x.ProjectId == projectid && x.IsAttempt == "1"
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -1020,10 +1008,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetRecordableEventNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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.AccidentDate.Year == date.Year && x.AccidentDate.Month == date.Month && x.AccidentDate.Day == date.Day && x.IsAttempt != "1"
|
||||
where x.ProjectId == projectid
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -1033,8 +1020,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetGeneralAccidentNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "1" select x).Count();
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDegree == "1" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1043,8 +1029,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetMajorAccidentNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "2" select x).Count();
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDegree == "2" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1053,8 +1038,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSeriousAccidentNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "3" select x).Count();
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDegree == "3" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1063,8 +1047,7 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetSpecialSeriousAccidentNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDate.Value.Year == date.Year && x.AccidentDate.Value.Month == date.Month && x.AccidentDate.Value.Day == date.Day && x.AccidentDegree == "4" select x).Count();
|
||||
int result = (from x in Funs.DB.Accident_AccidentReport where x.ProjectId == projectid && x.AccidentDegree == "4" select x).Count();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1109,11 +1092,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectComprehensivePlanNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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 && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month
|
||||
&& x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("综合")
|
||||
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("综合")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -1123,11 +1104,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectSpecialPlanNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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 && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month
|
||||
&& x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("专项")
|
||||
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("专项")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -1137,11 +1116,9 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectOnSiteDisposalPlan(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int 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 && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month
|
||||
&& x.CompileDate.Value.Day == date.Day && y.EmergencyTypeName.Contains("现场处置")
|
||||
where x.ProjectId == projectid && y.EmergencyTypeName.Contains("现场处置")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -1151,10 +1128,8 @@ namespace BLL
|
|||
/// <returns></returns>
|
||||
public static int GetProjectDrillNum(string projectid)
|
||||
{
|
||||
DateTime date = DateTime.Now;
|
||||
int result = (from x in Funs.DB.Emergency_DrillRecordList
|
||||
where x.ProjectId == projectid && x.DrillRecordDate.Value.Year == date.Year && x.DrillRecordDate.Value.Month == date.Month
|
||||
&& x.DrillRecordDate.Value.Day == date.Day
|
||||
where x.ProjectId == projectid
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -1174,6 +1149,12 @@ namespace BLL
|
|||
public static int GetCostUse(string projectid)
|
||||
{
|
||||
int 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
|
||||
select x.CostMoney ?? 0).ToList().Sum();
|
||||
result = Funs.GetNewIntOrZero(costs.ToString().Split('.')[0]);
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -1341,7 +1322,7 @@ namespace BLL
|
|||
{
|
||||
int result = (from x in Funs.DB.Solution_LargerHazard
|
||||
where x.ProjectId == projectid && x.IsSuperLargerHazard == false
|
||||
select x.TrainPersonNum ).ToList().Sum(x=>x.Value);
|
||||
select x.TrainPersonNum).ToList().Sum(x => x.Value);
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue