2023-03-07 增加实业数据编辑

This commit is contained in:
2023-03-07 23:01:04 +08:00
parent 79c311a870
commit 3f158f1a70
38 changed files with 5390 additions and 4 deletions
+5
View File
@@ -182,6 +182,7 @@
<Compile Include="API\HSSE\APITrainTestRecordService.cs" />
<Compile Include="API\HSSE\APITrainRecordService.cs" />
<Compile Include="BaseInfo\AccidentTypeService.cs" />
<Compile Include="BaseInfo\BaseFactoryService.cs" />
<Compile Include="BaseInfo\CertificateService.cs" />
<Compile Include="BaseInfo\CNProfessionalService.cs" />
<Compile Include="BaseInfo\CostTypeService.cs" />
@@ -770,6 +771,7 @@
<Compile Include="WebService\CNCECHSSEWebService.cs" />
<Compile Include="ZHGL\DataStatistics\DataStatisticsService.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" />
@@ -781,6 +783,8 @@
<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_SYHSEService.cs" />
<Compile Include="ZHGL\HSSESystem\HSSEManageItemService.cs" />
<Compile Include="ZHGL\HSSESystem\HSSEManageService.cs" />
@@ -818,6 +822,7 @@
<Compile Include="ZHGL\Supervise\SuperviseCheckRectifyService.cs" />
<Compile Include="ZHGL\Supervise\SuperviseCheckReportItemService.cs" />
<Compile Include="ZHGL\Supervise\SuperviseCheckReportService.cs" />
<Compile Include="ZHGL\DataSync\SYHSEData_RiskControlService.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj">
+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);
}
}
}
}
+8
View File
@@ -344,6 +344,8 @@ namespace BLL
/// 温度设置
/// </summary>
public const string HJGL_TemperatureSetMenuId = "A083BF37-745F-409F-9C3A-BC2FBC755757";
public const string Base_FactoryMenuId = "CD167198-1667-4552-9876-E768C2542C30";
#endregion
#region
@@ -5789,6 +5791,12 @@ namespace BLL
/// 实业数据
/// </summary>
public const string SYHSEData_SYHSEMenuId = "64EE5EC2-F725-4656-9110-5AF83C18FB6C";
/// <summary>
/// 实业
/// </summary>
public const string SYHSEData_DataMenuId = "S89E5EC2-F725-4656-9110-5AF83C18FB6C";
#endregion
#region
+2
View File
@@ -83,6 +83,7 @@
newSysSet5.SetValue = token;
}
newSysSet5.SetName = "token";
newSysSet5.SetId = 99;
Funs.DB.Sys_Set.InsertOnSubmit(newSysSet5);
Funs.DB.SubmitChanges();
}
@@ -106,6 +107,7 @@
newSysSet5.SetValue = ExpirationTime;
}
newSysSet5.SetName = "token失效时间";
newSysSet5.SetId = 98;
Funs.DB.Sys_Set.InsertOnSubmit(newSysSet5);
Funs.DB.SubmitChanges();
}
+14
View File
@@ -332,6 +332,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;
}
public static string GetInstallationNameByUnitId(string installationId)
{
string name = string.Empty;
@@ -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_CD;
Item.CollCropCode = UnitService.GetUnitByUnitId(Const.UnitId_CD).CollCropCode;
Item.UnitName= UnitService.GetUnitByUnitId(Const.UnitId_CD).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();
}
}
}
}