2023-03-08 实业增加

This commit is contained in:
2023-03-08 11:45:40 +08:00
parent f3ad764dc8
commit 278225fac4
40 changed files with 5249 additions and 31 deletions
+5
View File
@@ -210,6 +210,7 @@
<Compile Include="API\HSSE\APITrainRecordService.cs" />
<Compile Include="API\HTGL\APIHTGLPersonService.cs" />
<Compile Include="BaseInfo\AccidentTypeService.cs" />
<Compile Include="BaseInfo\BaseFactoryService.cs" />
<Compile Include="BaseInfo\CertificateService.cs" />
<Compile Include="BaseInfo\CNProfessionalService.cs" />
<Compile Include="BaseInfo\CompanyModelKindService.cs" />
@@ -646,6 +647,7 @@
<Compile Include="WebService\CNCECHSSEWebService.cs" />
<Compile Include="WebService\FileStructService.cs" />
<Compile Include="ZHGL\DataSync\CQMSDataService.cs" />
<Compile Include="ZHGL\DataSync\Hazard_RealTimeDeviceService.cs" />
<Compile Include="ZHGL\DataSync\HJGLData_DefectService.cs" />
<Compile Include="ZHGL\DataSync\HJGLData_HJGLService.cs" />
<Compile Include="ZHGL\DataSync\HSSEData_HiddenDangerDetailService.cs" />
@@ -657,6 +659,9 @@
<Compile Include="ZHGL\DataSync\ProjectDataSync\Project_HSSEData_HSSEService.cs" />
<Compile Include="ZHGL\DataSync\ProjectDataSync\Project_SYHSEData_SYHSEService.cs" />
<Compile Include="ZHGL\DataSync\ServerService.cs" />
<Compile Include="ZHGL\DataSync\SYHSEData_DataService.cs" />
<Compile Include="ZHGL\DataSync\SYHSEData_HiddenDangerCheckService.cs" />
<Compile Include="ZHGL\DataSync\SYHSEData_RiskControlService.cs" />
<Compile Include="ZHGL\DataSync\SYHSEData_SYHSEService.cs" />
<Compile Include="ZHGL\Information\AccidentCauseReportItemService.cs" />
<Compile Include="ZHGL\Information\AccidentCauseReportService.cs" />
+167
View File
@@ -0,0 +1,167 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class Base_FactoryService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.Base_Factory> GetBase_FactoryByModle(Model.Base_Factory table)
{
var q = from x in db.Base_Factory
where
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.FactoryCode) || x.FactoryCode.Contains(table.FactoryCode)) &&
(string.IsNullOrEmpty(table.FactoryName) || x.FactoryName.Contains(table.FactoryName)) &&
(string.IsNullOrEmpty(table.Address) || x.Address.Contains(table.Address))
select x
;
return q.ToList();
}
public static List<Model.Base_Factory> GetBase_FactoryList()
{
var q = (from x in db.Base_Factory orderby x.FactoryCode select x).ToList();
return q;
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.Base_Factory table, Grid Grid1)
{
var q = GetBase_FactoryByModle(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.FactoryId,
x.UnitId,
x.FactoryCode,
x.FactoryName,
x.Address,
};
}
#endregion
public static Model.Base_Factory GetBase_FactoryById(string FactoryId)
{
return db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
}
public static string GetBase_FactoryNameById(object FactoryId)
{
string name = string.Empty;
if (FactoryId!=null)
{
var model = db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId.ToString());
if (model != null)
{
name = model.FactoryName;
}
}
return name;
}
public static Model.Base_Factory GetBase_FactoryByCode(string FactoryCode)
{
return db.Base_Factory.FirstOrDefault(x => x.FactoryCode == FactoryCode);
}
public static void AddBase_Factory(Model.Base_Factory newtable)
{
Model.Base_Factory table = new Model.Base_Factory
{
FactoryId = newtable.FactoryId,
UnitId = newtable.UnitId,
FactoryCode = newtable.FactoryCode,
FactoryName = newtable.FactoryName,
Address = newtable.Address,
};
db.Base_Factory.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkBase_Factory(List<Model.Base_Factory> newtables)
{
db.Base_Factory.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateBase_Factory(Model.Base_Factory newtable)
{
Model.Base_Factory table = db.Base_Factory.FirstOrDefault(x => x.FactoryId == newtable.FactoryId);
if (table != null)
{
table.FactoryId = newtable.FactoryId;
table.UnitId = newtable.UnitId;
table.FactoryCode = newtable.FactoryCode;
table.FactoryName = newtable.FactoryName;
table.Address = newtable.Address;
db.SubmitChanges();
}
}
public static void DeleteBase_FactoryById(string FactoryId)
{
Model.Base_Factory table = db.Base_Factory.FirstOrDefault(x => x.FactoryId == FactoryId);
if (table != null)
{
db.Base_Factory.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLBase_Factory()
{
if (db.Base_Factory != null)
{
db.Base_Factory.DeleteAllOnSubmit(db.Base_Factory);
db.SubmitChanges();
}
}
public static void InitBase_FactoryDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "FactoryId";
dropName.DataTextField = "FactoryName";
dropName.DataSource = GetBase_FactoryList();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
}
}
+6
View File
@@ -765,6 +765,12 @@
/// 发起检查
/// </summary>
public const string CheckInfoMenuId = "6090DD54-FE59-4011-92EE-9906C9BC69B6";
public const string Base_FactoryMenuId = "CD167198-1667-4552-9876-E768C2542C30";
/// <summary>
/// 实业
/// </summary>
public const string SYHSEData_DataMenuId = "S89E5EC2-F725-4656-9110-5AF83C18FB6C";
#region
/// <summary>
@@ -230,8 +230,8 @@ namespace BLL
/// <summary>
/// ActionPlanID
/// </summary>
/// <param name="Id"></param>
public static Document Print( string Id)
/// <param name="ActionPlanID"></param>
public static Document Print( string ActionPlanID)
{
string rootPath = Funs.RootPath;
@@ -240,7 +240,7 @@ namespace BLL
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
string filePath = string.Empty;
var lwfirwork = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Id);
var lwfirwork = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(ActionPlanID);
initTemplatePath = "File\\Word\\PHTGL\\施工招标实施计划审批表.docx";
if (lwfirwork != null)
{
@@ -259,9 +259,9 @@ namespace BLL
}
File.Copy(uploadfilepath, newUrl);
///更新书签
var getFireWork = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Id);
var Act = PHTGL_ActionPlanReviewService.GetPHTGL_ActionPlanReviewByActionPlanID(Id);
var list = PHTGL_ActionPlanFormation_Sch1Service.GetListPHTGL_ActionPlanFormation_Sch1ById(Id);
var getFireWork = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(ActionPlanID);
var Act = PHTGL_ActionPlanReviewService.GetPHTGL_ActionPlanReviewByActionPlanID(ActionPlanID);
var list = PHTGL_ActionPlanFormation_Sch1Service.GetListPHTGL_ActionPlanFormation_Sch1ById(ActionPlanID);
Document doc = new Aspose.Words.Document(newUrl);
Bookmark txtActionPlanCode = doc.Range.Bookmarks["ActionPlanCode"];
@@ -122,7 +122,7 @@ namespace BLL
return list;
}
public static Document Print(string Id)
public static Document Print(string ApproveUserReviewById)
{
string rootPath = Funs.RootPath;
@@ -140,7 +140,7 @@ namespace BLL
}
File.Copy(uploadfilepath, newUrl);
///更新书签
var getFireWork = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(Id);
var getFireWork = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(ApproveUserReviewById);
var Bid = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(getFireWork.BidDocumentsReviewId);
var Act = BLL.PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(Bid.ActionPlanID);
#region
@@ -152,7 +152,7 @@ namespace BLL
+ @" FROM PHTGL_BidApproveUserReview_Sch1 AS APP "
+ @"where 1=1 AND ApproveUserReviewID = @ApproveUserReviewID ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ApproveUserReviewID", Id));
listStr.Add(new SqlParameter("@ApproveUserReviewID", ApproveUserReviewById));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
@@ -160,7 +160,12 @@ namespace BLL
return list;
}
public static Document Print(string Id)
/// <summary>
/// BidDocumentsReview
/// </summary>
/// <param name="BidDocumentsReviewId"></param>
/// <returns></returns>
public static Document Print(string BidDocumentsReviewId)
{
string rootPath = Funs.RootPath;
@@ -169,7 +174,7 @@ namespace BLL
string newUrl = string.Empty;
string filePath = string.Empty;
initTemplatePath = "File\\Word\\PHTGL\\招标文件审批表.docx";
var lwfirwork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(Id);
var lwfirwork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(BidDocumentsReviewId);
if (lwfirwork != null)
{
if (PHTGL_ActionPlanReviewService.IsSpecialProject(lwfirwork.ProjectId))
@@ -189,12 +194,12 @@ namespace BLL
Document doc = new Aspose.Words.Document(newUrl);
///更新书签
var getFireWork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(Id);
var getFireWork = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(BidDocumentsReviewId);
var Act = PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(getFireWork.ActionPlanID);
var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ConstructionManager);
var model_ControlManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ControlManager);
var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.Approval_Construction);
var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ProjectManager);
var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(BidDocumentsReviewId, getFireWork.ConstructionManager);
var model_ControlManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(BidDocumentsReviewId, getFireWork.ControlManager);
var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(BidDocumentsReviewId, getFireWork.Approval_Construction);
var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(BidDocumentsReviewId, getFireWork.ProjectManager);
Dictionary<string, object> Dic_File = new Dictionary<string, object>();
Dic_File.Add("txtCode", string.Format("{0:yyyyMMdd}", Convert.ToDateTime(getFireWork.CreatTime)));
@@ -171,7 +171,7 @@ namespace BLL
select x).ToList();
return list;
}
public static Document Print(string Id)
public static Document Print(string SetSubReviewID)
{
string rootPath = Funs.RootPath;
@@ -180,7 +180,7 @@ namespace BLL
string newUrl = string.Empty;
string filePath = string.Empty;
string strSql = "";
var getFireWork = PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewById(Id);
var getFireWork = PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewById(SetSubReviewID);
var BidUser = PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(getFireWork.ApproveUserReviewID);
var BidDoc = PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(BidUser.BidDocumentsReviewId);
var Act = BLL.PHTGL_ActionPlanFormationService.GetPHTGL_ActionPlanFormationById(BidDoc.ActionPlanID);
@@ -245,17 +245,17 @@ namespace BLL
File.Copy(uploadfilepath, newUrl);
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@SetSubReviewID", Id));
listStr.Add(new SqlParameter("@SetSubReviewID", SetSubReviewID));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
tb.TableName = "Table";
Document doc = new Aspose.Words.Document(newUrl);
doc.MailMerge.ExecuteWithRegions(tb);
var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ConstructionManager);
var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.ProjectManager);
var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.Approval_Construction);
var model_DeputyGeneralManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(Id, getFireWork.DeputyGeneralManager);
var model_ConstructionManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(SetSubReviewID, getFireWork.ConstructionManager);
var model_ProjectManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(SetSubReviewID, getFireWork.ProjectManager);
var model_Approval_Construction = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(SetSubReviewID, getFireWork.Approval_Construction);
var model_DeputyGeneralManager = PHTGL_ApproveService.GetPHTGL_ApproveByContractIdandUserId(SetSubReviewID, getFireWork.DeputyGeneralManager);
Dictionary<string, object> Dic_File = new Dictionary<string, object>();
Dic_File.Add("txtSetSubReviewCode", getFireWork.SetSubReviewCode);
@@ -633,16 +633,45 @@ namespace BLL
case "4":
break;
case "5":
break;
case "6":
break;
}
}
/// <summary>
/// ConfirmWay 45
/// </summary>
public static void PrintApprovalFormType_Act()
{
}
public static void PrintApprovalFormType_SetSub()
/// <summary>
/// ConfirmWay 123
/// </summary>
public static void PrintApprovalFormType_SetSub(string ContractReviewId)
{
Model.PHTGL_Contract Contract =new Model.PHTGL_Contract(); //合同信息
Model.PHTGL_SetSubReview SetSub = new Model.PHTGL_SetSubReview(); //确认分包商信息
Model.PHTGL_BidApproveUserReview ApproveUser = new Model.PHTGL_BidApproveUserReview(); //评标小组名单信息
Model.PHTGL_BidDocumentsReview BidDoc = new Model.PHTGL_BidDocumentsReview();//招标文件信息
Model.PHTGL_ActionPlanReview ActPlan = new Model.PHTGL_ActionPlanReview();//实施计划信息
var ReviewModel = BLL.PHTGL_ContractReviewService.GetPHTGL_ContractReviewById(ContractReviewId);
Contract = BLL.ContractService.GetContractById(ReviewModel.ContractId);
SetSub = BLL.PHTGL_SetSubReviewService.GetPHTGL_SetSubReviewBySetSubReviewCode(Contract.SetSubReviewCode);
ApproveUser = BLL.PHTGL_BidApproveUserReviewService.GetPHTGL_BidApproveUserReviewById(SetSub.ApproveUserReviewID);
BidDoc = BLL.PHTGL_BidDocumentsReviewService.GetPHTGL_BidDocumentsReviewById(ApproveUser.BidDocumentsReviewId);
ActPlan = BLL.PHTGL_ActionPlanReviewService.GetPHTGL_ActionPlanReviewById(BidDoc.ActionPlanReviewId);
var Doc_ActPlan = PHTGL_ActionPlanFormationService.Print(ActPlan.ActionPlanID);
var Doc_BidDoc = PHTGL_BidDocumentsReviewService.Print(BidDoc.BidDocumentsReviewId);
var Doc_ApproveUser = PHTGL_BidApproveUserReviewService.Print(ApproveUser.ApproveUserReviewID);
var Doc_SetSub = PHTGL_SetSubReviewService.Print(SetSub.SetSubReviewID);
var Doc_Contract = Print(ContractReviewId);
Doc_ActPlan.AppendDocument(Doc_BidDoc, ImportFormatMode.UseDestinationStyles);
Doc_ActPlan.AppendDocument(Doc_ApproveUser, ImportFormatMode.UseDestinationStyles);
Doc_ActPlan.AppendDocument(Doc_SetSub, ImportFormatMode.UseDestinationStyles);
Doc_ActPlan.AppendDocument(Doc_Contract, ImportFormatMode.UseDestinationStyles);
}
public static void PrintApprovalFormType__Con()
{
+14
View File
@@ -345,6 +345,20 @@ namespace BLL
}
return name;
}
public static string GetUnitNameByUnitId(object unitId)
{
string name = string.Empty;
if (unitId != null)
{
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == unitId.ToString());
if (unit != null)
{
name = unit.UnitName;
}
}
return name;
}
/// <summary>
/// 获取单位简称
@@ -0,0 +1,278 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class HazardRealtimedeviceService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.Hazard_RealTimeDevice> GetHazard_RealTimeDeviceByModle(Model.Hazard_RealTimeDevice table)
{
var q = from x in db.Hazard_RealTimeDevice
where
(string.IsNullOrEmpty(table.ID) || x.ID.Contains(table.ID)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
(string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) &&
(string.IsNullOrEmpty(table.HazardName) || x.HazardName.Contains(table.HazardName)) &&
(string.IsNullOrEmpty(table.HazardLevel) || x.HazardLevel.Contains(table.HazardLevel)) &&
(string.IsNullOrEmpty(table.DeviceCode) || x.DeviceCode.Contains(table.DeviceCode)) &&
(string.IsNullOrEmpty(table.DeviceName) || x.DeviceName.Contains(table.DeviceName)) &&
(string.IsNullOrEmpty(table.DeviceType) || x.DeviceType.Contains(table.DeviceType)) &&
(string.IsNullOrEmpty(table.SphereType) || x.SphereType.Contains(table.SphereType)) &&
(string.IsNullOrEmpty(table.TemperatureType) || x.TemperatureType.Contains(table.TemperatureType)) &&
(string.IsNullOrEmpty(table.DesignTemperantureMax) || x.DesignTemperantureMax.Contains(table.DesignTemperantureMax)) &&
(string.IsNullOrEmpty(table.DesignTemperantureMin) || x.DesignTemperantureMin.Contains(table.DesignTemperantureMin)) &&
(string.IsNullOrEmpty(table.PressureType) || x.PressureType.Contains(table.PressureType)) &&
(string.IsNullOrEmpty(table.DesignPressure) || x.DesignPressure.Contains(table.DesignPressure)) &&
(string.IsNullOrEmpty(table.DesignPressureMax) || x.DesignPressureMax.Contains(table.DesignPressureMax)) &&
(string.IsNullOrEmpty(table.Medium) || x.Medium.Contains(table.Medium)) &&
(string.IsNullOrEmpty(table.MediumForm) || x.MediumForm.Contains(table.MediumForm)) &&
(string.IsNullOrEmpty(table.MediumLevelMax) || x.MediumLevelMax.Contains(table.MediumLevelMax)) &&
(string.IsNullOrEmpty(table.Reserves) || x.Reserves.Contains(table.Reserves)) &&
(string.IsNullOrEmpty(table.StandardCode) || x.StandardCode.Contains(table.StandardCode)) &&
(string.IsNullOrEmpty(table.StandardName) || x.StandardName.Contains(table.StandardName)) &&
(string.IsNullOrEmpty(table.StandardType) || x.StandardType.Contains(table.StandardType)) &&
(string.IsNullOrEmpty(table.StandardDes) || x.StandardDes.Contains(table.StandardDes)) &&
(string.IsNullOrEmpty(table.MeasurementUnit) || x.MeasurementUnit.Contains(table.MeasurementUnit)) &&
(string.IsNullOrEmpty(table.MeterMax) || x.MeterMax.Contains(table.MeterMax)) &&
(string.IsNullOrEmpty(table.MeterMin) || x.MeterMin.Contains(table.MeterMin)) &&
(string.IsNullOrEmpty(table.ThresholdLow1) || x.ThresholdLow1.Contains(table.ThresholdLow1)) &&
(string.IsNullOrEmpty(table.ThresholdLow2) || x.ThresholdLow2.Contains(table.ThresholdLow2)) &&
(string.IsNullOrEmpty(table.ThresholdMax1) || x.ThresholdMax1.Contains(table.ThresholdMax1)) &&
(string.IsNullOrEmpty(table.ThresholdMax2) || x.ThresholdMax2.Contains(table.ThresholdMax2)) &&
(string.IsNullOrEmpty(table.BitNum) || x.BitNum.Contains(table.BitNum)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.Value) || x.Value.Contains(table.Value)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
(string.IsNullOrEmpty(table.ReceiveDate) || x.ReceiveDate.Contains(table.ReceiveDate))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.Hazard_RealTimeDevice table, Grid Grid1)
{
var q = GetHazard_RealTimeDeviceByModle(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.UnitName,
x.HazardName,
x.HazardLevel,
x.DeviceCode,
x.DeviceName,
x.DeviceType,
x.SphereType,
x.TemperatureType,
x.DesignTemperantureMax,
x.DesignTemperantureMin,
x.PressureType,
x.DesignPressure,
x.DesignPressureMax,
x.Medium,
x.MediumForm,
x.MediumLevelMax,
x.Reserves,
x.StandardCode,
x.StandardName,
x.StandardType,
x.StandardDes,
x.MeasurementUnit,
x.MeterMax,
x.MeterMin,
x.ThresholdLow1,
x.ThresholdLow2,
x.ThresholdMax1,
x.ThresholdMax2,
x.BitNum,
x.DateTime,
x.ProjectId,
x.Value,
x.FactoryId,
x.ReportDate,
x.ReceiveDate,
};
}
#endregion
public static Model.Hazard_RealTimeDevice GetHazard_RealTimeDeviceById(string ID)
{
return db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID);
}
public static void AddHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable)
{
Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice
{
ID = newtable.ID,
UnitId = newtable.UnitId,
UnitName = newtable.UnitName,
HazardName = newtable.HazardName,
HazardLevel = newtable.HazardLevel,
DeviceCode = newtable.DeviceCode,
DeviceName = newtable.DeviceName,
DeviceType = newtable.DeviceType,
SphereType = newtable.SphereType,
TemperatureType = newtable.TemperatureType,
DesignTemperantureMax = newtable.DesignTemperantureMax,
DesignTemperantureMin = newtable.DesignTemperantureMin,
PressureType = newtable.PressureType,
DesignPressure = newtable.DesignPressure,
DesignPressureMax = newtable.DesignPressureMax,
Medium = newtable.Medium,
MediumForm = newtable.MediumForm,
MediumLevelMax = newtable.MediumLevelMax,
Reserves = newtable.Reserves,
StandardCode = newtable.StandardCode,
StandardName = newtable.StandardName,
StandardType = newtable.StandardType,
StandardDes = newtable.StandardDes,
MeasurementUnit = newtable.MeasurementUnit,
MeterMax = newtable.MeterMax,
MeterMin = newtable.MeterMin,
ThresholdLow1 = newtable.ThresholdLow1,
ThresholdLow2 = newtable.ThresholdLow2,
ThresholdMax1 = newtable.ThresholdMax1,
ThresholdMax2 = newtable.ThresholdMax2,
BitNum = newtable.BitNum,
DateTime = newtable.DateTime,
ProjectId = newtable.ProjectId,
Value = newtable.Value,
FactoryId = newtable.FactoryId,
ReportDate = newtable.ReportDate,
ReceiveDate = newtable.ReceiveDate,
};
db.Hazard_RealTimeDevice.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkHazard_RealTimeDevice(List<Model.Hazard_RealTimeDevice> newtables)
{
db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable)
{
Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID);
if (table != null)
{
table.ID = newtable.ID;
table.UnitId = newtable.UnitId;
table.UnitName = newtable.UnitName;
table.HazardName = newtable.HazardName;
table.HazardLevel = newtable.HazardLevel;
table.DeviceCode = newtable.DeviceCode;
table.DeviceName = newtable.DeviceName;
table.DeviceType = newtable.DeviceType;
table.SphereType = newtable.SphereType;
table.TemperatureType = newtable.TemperatureType;
table.DesignTemperantureMax = newtable.DesignTemperantureMax;
table.DesignTemperantureMin = newtable.DesignTemperantureMin;
table.PressureType = newtable.PressureType;
table.DesignPressure = newtable.DesignPressure;
table.DesignPressureMax = newtable.DesignPressureMax;
table.Medium = newtable.Medium;
table.MediumForm = newtable.MediumForm;
table.MediumLevelMax = newtable.MediumLevelMax;
table.Reserves = newtable.Reserves;
table.StandardCode = newtable.StandardCode;
table.StandardName = newtable.StandardName;
table.StandardType = newtable.StandardType;
table.StandardDes = newtable.StandardDes;
table.MeasurementUnit = newtable.MeasurementUnit;
table.MeterMax = newtable.MeterMax;
table.MeterMin = newtable.MeterMin;
table.ThresholdLow1 = newtable.ThresholdLow1;
table.ThresholdLow2 = newtable.ThresholdLow2;
table.ThresholdMax1 = newtable.ThresholdMax1;
table.ThresholdMax2 = newtable.ThresholdMax2;
table.BitNum = newtable.BitNum;
table.DateTime = newtable.DateTime;
table.ProjectId = newtable.ProjectId;
table.Value = newtable.Value;
table.FactoryId = newtable.FactoryId;
table.ReportDate = newtable.ReportDate;
table.ReceiveDate = newtable.ReceiveDate;
db.SubmitChanges();
}
}
public static void DeleteHazard_RealTimeDeviceById(string ID)
{
Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID);
if (table != null)
{
db.Hazard_RealTimeDevice.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLHazard_RealTimeDevice()
{
if (db.Hazard_RealTimeDevice != null)
{
db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice);
db.SubmitChanges();
}
}
public static List<Model.Hazard_RealTimeDevice> GetHazard_RealTimeDeviceByDate(DateTime? reportDate)
{
var q = from x in db.Hazard_RealTimeDevice
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0
select x;
return q.ToList();
}
public static void DeleteHazard_RealTimeDeviceByDate(DateTime? reportDate)
{
var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,245 @@
using FineUIPro;
using Model;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SYHSEData_DataService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.SYHSEData_Data> GetSYHSEData_DataByModle(Model.SYHSEData_Data table)
{
var q = from x in db.SYHSEData_Data
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.SYHSEData_Data table, Grid Grid1)
{
var q = GetSYHSEData_DataByModle(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.FactoryId,
x.SafetyMnaHours,
x.GeneralRiskNum,
x.LowRiskNum,
x.MoreRiskNum,
x.GreatRiskNum,
x.ReportDate,
};
}
#endregion
public static bool IsReportByDate(DateTime dateTime)
{
var result = false;
var q = (from x in Funs.DB.SYHSEData_Data
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;
}
public static Model.ReturnData PushCNCEC(string Id)
{
string baseurl = "/api/SYHSEData/SaveNewSYHSEData";
var item = GetItemById(Id);
string str = JsonConvert.SerializeObject(item);
var responeData = BLL.ServerService.PushCNCEC(str, baseurl);
return responeData;
}
public static Model.NewSYHSEData GetItemById(string Id)
{
var data=GetSYHSEData_DataById(Id);
var data_realtime = HazardRealtimedeviceService.GetHazard_RealTimeDeviceByDate(data.ReportDate);
var data_hidden= SyhsedataHiddendangercheckService.GetSYHSEData_HiddenDangerCheckByDate(data.ReportDate);
var data_risk= SyhsedataRiskcontrolService.GetSYHSEData_RiskControlByDate(data.ReportDate);
NewSYHSEData APIData = new NewSYHSEData();
var APIDataList_Item= new List<NewSYHSEDataItem>();
var APIDataList_Relatime= new List<NewSYHSEDataRealTimeDeviceItem>();
var APIDataList_Hidden= new List<NewSYHSEDataHiddenDangerCheckItem>();
var APIDataList_Risk= new List<NewSYHSEDataRiskControlItem>();
foreach (var tb in data_realtime)
{
var q = new NewSYHSEDataRealTimeDeviceItem()
{
Id=tb.ID,
HazardName=tb.HazardName,
HazardLevel=tb.HazardLevel,
DeviceName=tb.DeviceName,
Medium=tb.Medium,
MeasurementUnit=tb.MeasurementUnit,
DateTime=tb.DateTime.ToString(),
Value=tb.Value,
};
APIDataList_Relatime.Add(q);
}
foreach (var tb in data_hidden)
{
var q = new NewSYHSEDataHiddenDangerCheckItem()
{
Id=tb.Id,
HiddenDangerName=tb.HiddenDangerName,
TotalNum=tb.TotalNum.HasValue ? tb.TotalNum.Value:0,
OKNum=tb.OKNum.HasValue ? tb.OKNum.Value : 0,
};
APIDataList_Hidden.Add(q);
}
foreach (var tb in data_risk)
{
var q = new NewSYHSEDataRiskControlItem()
{
Id=tb.Id,
RiskControlName=tb.RiskControlName,
};
APIDataList_Risk.Add(q);
}
NewSYHSEDataItem Item = new NewSYHSEDataItem();
Item.Id = data.Id;
Item.ReportDate=data.ReportDate.ToString();
Item.UnitId = Const.UnitId_SEDIN;
Item.CollCropCode = UnitService.GetUnitByUnitId(Const.UnitId_SEDIN).CollCropCode;
Item.UnitName= UnitService.GetUnitByUnitId(Const.UnitId_SEDIN).UnitName;
Item.FactoryId = data.FactoryId;
Item.FactoryCode = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).FactoryCode;
Item.FactoryName = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).FactoryName;
Item.Address = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).Address;
Item.SafetyMnaHours = data.SafetyMnaHours.HasValue ? data.SafetyMnaHours.Value : 0;
Item.GeneralRiskNum = data.GeneralRiskNum.HasValue ? data.GeneralRiskNum.Value : 0;
Item.LowRiskNum = data.LowRiskNum.HasValue ? data.LowRiskNum.Value : 0;
Item.MoreRiskNum = data.MoreRiskNum.HasValue ? data.MoreRiskNum.Value : 0;
Item.GreatRiskNum = data.GreatRiskNum.HasValue ? data.GreatRiskNum.Value : 0;
Item.NewSYHSEDataRiskControlItems = APIDataList_Risk;
Item.NewSYHSEDataRealTimeDeviceItems = APIDataList_Relatime;
Item.NewSYHSEDataHiddenDangerCheckItems = APIDataList_Hidden;
APIDataList_Item.Add(Item);
APIData.NewSYHSEDataItems = APIDataList_Item;
return APIData;
}
public static Model.SYHSEData_Data GetSYHSEData_DataById(string Id)
{
return db.SYHSEData_Data.FirstOrDefault(x => x.Id == Id);
}
public static void AddSYHSEData_Data(Model.SYHSEData_Data newtable)
{
Model.SYHSEData_Data table = new Model.SYHSEData_Data
{
Id = newtable.Id,
FactoryId = newtable.FactoryId,
SafetyMnaHours = newtable.SafetyMnaHours,
GeneralRiskNum = newtable.GeneralRiskNum,
LowRiskNum = newtable.LowRiskNum,
MoreRiskNum = newtable.MoreRiskNum,
GreatRiskNum = newtable.GreatRiskNum,
ReportDate = newtable.ReportDate,
};
db.SYHSEData_Data.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSYHSEData_Data(List<Model.SYHSEData_Data> newtables)
{
db.SYHSEData_Data.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSYHSEData_Data(Model.SYHSEData_Data newtable)
{
Model.SYHSEData_Data table = db.SYHSEData_Data.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.FactoryId = newtable.FactoryId;
table.SafetyMnaHours = newtable.SafetyMnaHours;
table.GeneralRiskNum = newtable.GeneralRiskNum;
table.LowRiskNum = newtable.LowRiskNum;
table.MoreRiskNum = newtable.MoreRiskNum;
table.GreatRiskNum = newtable.GreatRiskNum;
table.ReportDate = newtable.ReportDate;
db.SubmitChanges();
}
}
public static void DeleteSYHSEData_DataById(string Id)
{
Model.SYHSEData_Data table = db.SYHSEData_Data.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.SYHSEData_Data.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSYHSEData_Data()
{
if (db.SYHSEData_Data != null)
{
db.SYHSEData_Data.DeleteAllOnSubmit(db.SYHSEData_Data);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,153 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SyhsedataHiddendangercheckService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.SYHSEData_HiddenDangerCheck> GetSYHSEData_HiddenDangerCheckByModle(Model.SYHSEData_HiddenDangerCheck table)
{
var q = from x in db.SYHSEData_HiddenDangerCheck
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
(string.IsNullOrEmpty(table.HiddenDangerName) || x.HiddenDangerName.Contains(table.HiddenDangerName))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.SYHSEData_HiddenDangerCheck table, Grid Grid1)
{
var q = GetSYHSEData_HiddenDangerCheckByModle(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.FactoryId,
x.HiddenDangerName,
x.TotalNum,
x.OKNum,
x.ReportDate,
};
}
#endregion
public static Model.SYHSEData_HiddenDangerCheck GetSYHSEData_HiddenDangerCheckById(string Id)
{
return db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
}
public static void AddSYHSEData_HiddenDangerCheck(Model.SYHSEData_HiddenDangerCheck newtable)
{
Model.SYHSEData_HiddenDangerCheck table = new Model.SYHSEData_HiddenDangerCheck
{
Id = newtable.Id,
FactoryId = newtable.FactoryId,
HiddenDangerName = newtable.HiddenDangerName,
TotalNum = newtable.TotalNum,
OKNum = newtable.OKNum,
ReportDate = newtable.ReportDate,
};
db.SYHSEData_HiddenDangerCheck.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSYHSEData_HiddenDangerCheck(List<Model.SYHSEData_HiddenDangerCheck> newtables)
{
db.SYHSEData_HiddenDangerCheck.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSYHSEData_HiddenDangerCheck(Model.SYHSEData_HiddenDangerCheck newtable)
{
Model.SYHSEData_HiddenDangerCheck table = db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.FactoryId = newtable.FactoryId;
table.HiddenDangerName = newtable.HiddenDangerName;
table.TotalNum = newtable.TotalNum;
table.OKNum = newtable.OKNum;
table.ReportDate = newtable.ReportDate;
db.SubmitChanges();
}
}
public static void DeleteSYHSEData_HiddenDangerCheckById(string Id)
{
Model.SYHSEData_HiddenDangerCheck table = db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.SYHSEData_HiddenDangerCheck.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSYHSEData_HiddenDangerCheck()
{
if (db.SYHSEData_HiddenDangerCheck != null)
{
db.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(db.SYHSEData_HiddenDangerCheck);
db.SubmitChanges();
}
}
public static List<Model.SYHSEData_HiddenDangerCheck> GetSYHSEData_HiddenDangerCheckByDate(DateTime? reportDate)
{
var q = from x in db.SYHSEData_HiddenDangerCheck
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0
select x;
return q.ToList();
}
public static void DeleteSYHSEData_HiddenDangerCheckByDate(DateTime? reportDate)
{
var table = db.SYHSEData_HiddenDangerCheck.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,147 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SyhsedataRiskcontrolService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.SYHSEData_RiskControl> GetSYHSEData_RiskControlByModle(Model.SYHSEData_RiskControl table)
{
var q = from x in db.SYHSEData_RiskControl
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
(string.IsNullOrEmpty(table.RiskControlName) || x.RiskControlName.Contains(table.RiskControlName))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.SYHSEData_RiskControl table, Grid Grid1)
{
var q = GetSYHSEData_RiskControlByModle(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.FactoryId,
x.RiskControlName,
x.ReportDate,
};
}
#endregion
public static Model.SYHSEData_RiskControl GetSYHSEData_RiskControlById(string Id)
{
return db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
}
public static void AddSYHSEData_RiskControl(Model.SYHSEData_RiskControl newtable)
{
Model.SYHSEData_RiskControl table = new Model.SYHSEData_RiskControl
{
Id = newtable.Id,
FactoryId = newtable.FactoryId,
RiskControlName = newtable.RiskControlName,
ReportDate = newtable.ReportDate,
};
db.SYHSEData_RiskControl.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSYHSEData_RiskControl(List<Model.SYHSEData_RiskControl> newtables)
{
db.SYHSEData_RiskControl.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSYHSEData_RiskControl(Model.SYHSEData_RiskControl newtable)
{
Model.SYHSEData_RiskControl table = db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.FactoryId = newtable.FactoryId;
table.RiskControlName = newtable.RiskControlName;
table.ReportDate = newtable.ReportDate;
db.SubmitChanges();
}
}
public static void DeleteSYHSEData_RiskControlById(string Id)
{
Model.SYHSEData_RiskControl table = db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.SYHSEData_RiskControl.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSYHSEData_RiskControl()
{
if (db.SYHSEData_RiskControl != null)
{
db.SYHSEData_RiskControl.DeleteAllOnSubmit(db.SYHSEData_RiskControl);
db.SubmitChanges();
}
}
public static List<Model.SYHSEData_RiskControl> GetSYHSEData_RiskControlByDate(DateTime? reportDate)
{
var q = from x in db.SYHSEData_RiskControl
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0
select x;
return q.ToList();
}
public static void DeleteSYHSEData_RiskControlByDate(DateTime? reportDate)
{
var table = db.SYHSEData_RiskControl.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.SYHSEData_RiskControl.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}