464 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			464 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			C#
		
	
	
	
| using FineUIPro;
 | |
| using Model;
 | |
| using Newtonsoft.Json;
 | |
| using System;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     public static class SYHSEData_SYHSEService
 | |
|     {
 | |
|         public static Model.SGGLDB db = Funs.DB;
 | |
| 
 | |
|         #region 获取列表
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 记录数
 | |
|         /// </summary>
 | |
|         public static int count
 | |
|         {
 | |
|             get;
 | |
|             set;
 | |
|         }
 | |
| 
 | |
|         /// 获取分页列表
 | |
|         /// </summary>
 | |
|         /// <param name="PageIndex">页码</param>
 | |
|         /// <param name="PageSize">每页数量</param>
 | |
|         /// <returns></returns>
 | |
|         public static IEnumerable getListData(Model.SYHSEData_SYHSE table, Grid Grid1)
 | |
|         {
 | |
|             var q = GetSYHSEData_SYHSEByModle(table);
 | |
|             count = q.Count();
 | |
|             if (count == 0)
 | |
|             {
 | |
|                 return null;
 | |
|             }
 | |
|             //q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
 | |
|             return from x in q
 | |
|                    select new
 | |
|                    {
 | |
|                        x.Id,
 | |
|                        x.UnitId,
 | |
|                        x.CollCropCode,
 | |
|                        x.UnitName,
 | |
|                        x.ReportDate,
 | |
|                        x.GeneralRiskNum,
 | |
|                        x.LowRiskNum,
 | |
|                        x.MediumRiskNum,
 | |
|                        x.HighRiskNum,
 | |
|                        x.GradedResponsiblePersonNum,
 | |
|                        x.ChargeInsurancePersonNum,
 | |
|                        x.DesignQuantity,
 | |
|                        x.RunningCapacity,
 | |
|                        x.InterlockSettingValue,
 | |
|                        x.VideoSurveillanceNum,
 | |
|                        x.TotalWorkinghours,
 | |
|                        x.SafeWorkinghours,
 | |
|                        x.LostWorkinghours,
 | |
|                        x.TotalEnergyConsumption,
 | |
|                        x.IncomeComprehensiveEnergyConsumption,
 | |
|                        x.NewWaterConsumption,
 | |
|                        x.GeneralClosedNum,
 | |
|                        x.GeneralNotClosedNum,
 | |
|                        x.MajorClosedNum,
 | |
|                        x.MajorNotClosedNum,
 | |
|                        x.HotWorkPermitNum,
 | |
|                        x.HotWorkClosedNum,
 | |
|                        x.HighPermitNum,
 | |
|                        x.HighClosedNum,
 | |
|                        x.TemporaryElectricityPermitNum,
 | |
|                        x.TemporaryElectricityClosedNum,
 | |
|                        x.BlindPlatePermitNum,
 | |
|                        x.BlindPlateClosedNum,
 | |
|                        x.GroundbreakingPermitNum,
 | |
|                        x.GroundbreakingClosedNum,
 | |
|                        x.OpenCircuitPermitNum,
 | |
|                        x.OpenCircuitClosedNum,
 | |
|                        x.HoistingPermitNum,
 | |
|                        x.HoistingClosedNum,
 | |
|                        x.State,
 | |
|                        x.CreateDate,
 | |
|                        x.CreateMan,
 | |
|                    };
 | |
|         }
 | |
| 
 | |
|         public static List<Model.SYHSEData_SYHSE> GetSYHSEData_SYHSEByModle(Model.SYHSEData_SYHSE table)
 | |
|         {
 | |
|             var q = from x in db.SYHSEData_SYHSE
 | |
|                     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))
 | |
|                     select x
 | |
|                   ;
 | |
| 
 | |
|             return q.ToList();
 | |
|         }
 | |
|         #endregion 获取列表
 | |
| 
 | |
|         public static void AddSYHSEData_SYHSE(Model.SYHSEData_SYHSE newtable)
 | |
|         {
 | |
|             Model.SYHSEData_SYHSE table = new Model.SYHSEData_SYHSE
 | |
|             {
 | |
|                 Id = newtable.Id,
 | |
|                 UnitId = newtable.UnitId,
 | |
|                 CollCropCode = newtable.CollCropCode,
 | |
|                 UnitName = newtable.UnitName,
 | |
|                 ReportDate = newtable.ReportDate,
 | |
|                 GeneralRiskNum = newtable.GeneralRiskNum,
 | |
|                 LowRiskNum = newtable.LowRiskNum,
 | |
|                 MediumRiskNum = newtable.MediumRiskNum,
 | |
|                 HighRiskNum = newtable.HighRiskNum,
 | |
|                 GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum,
 | |
|                 ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum,
 | |
|                 DesignQuantity = newtable.DesignQuantity,
 | |
|                 RunningCapacity = newtable.RunningCapacity,
 | |
|                 InterlockSettingValue = newtable.InterlockSettingValue,
 | |
|                 VideoSurveillanceNum = newtable.VideoSurveillanceNum,
 | |
|                 TotalWorkinghours = newtable.TotalWorkinghours,
 | |
|                 SafeWorkinghours = newtable.SafeWorkinghours,
 | |
|                 LostWorkinghours = newtable.LostWorkinghours,
 | |
|                 TotalEnergyConsumption = newtable.TotalEnergyConsumption,
 | |
|                 IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption,
 | |
|                 NewWaterConsumption = newtable.NewWaterConsumption,
 | |
|                 GeneralClosedNum = newtable.GeneralClosedNum,
 | |
|                 GeneralNotClosedNum = newtable.GeneralNotClosedNum,
 | |
|                 MajorClosedNum = newtable.MajorClosedNum,
 | |
|                 MajorNotClosedNum = newtable.MajorNotClosedNum,
 | |
|                 HotWorkPermitNum = newtable.HotWorkPermitNum,
 | |
|                 HotWorkClosedNum = newtable.HotWorkClosedNum,
 | |
|                 HighPermitNum = newtable.HighPermitNum,
 | |
|                 HighClosedNum = newtable.HighClosedNum,
 | |
|                 TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum,
 | |
|                 TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum,
 | |
|                 BlindPlatePermitNum = newtable.BlindPlatePermitNum,
 | |
|                 BlindPlateClosedNum = newtable.BlindPlateClosedNum,
 | |
|                 GroundbreakingPermitNum = newtable.GroundbreakingPermitNum,
 | |
|                 GroundbreakingClosedNum = newtable.GroundbreakingClosedNum,
 | |
|                 OpenCircuitPermitNum = newtable.OpenCircuitPermitNum,
 | |
|                 OpenCircuitClosedNum = newtable.OpenCircuitClosedNum,
 | |
|                 HoistingPermitNum = newtable.HoistingPermitNum,
 | |
|                 HoistingClosedNum = newtable.HoistingClosedNum,
 | |
|                 State = newtable.State,
 | |
|                 CreateDate = newtable.CreateDate,
 | |
|                 CreateMan = newtable.CreateMan,
 | |
|             };
 | |
|             db.SYHSEData_SYHSE.InsertOnSubmit(table);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         public static void DeleteSYHSEData_SYHSEById(string Id)
 | |
|         {
 | |
|             Model.SYHSEData_SYHSE table = db.SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id);
 | |
|             if (table != null)
 | |
|             {
 | |
|                 db.SYHSEData_SYHSE.DeleteOnSubmit(table);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public static Model.SYHSEData GetItemById(string Id)
 | |
|         {
 | |
|             SyhseDataItem item = new SyhseDataItem();
 | |
|             SYHSEData data = new SYHSEData();
 | |
|             var data_SYHSE = GetSYHSEData_SYHSEById(Id);
 | |
|             if (data_SYHSE != null)
 | |
|             {
 | |
|                 item.Id = data_SYHSE.Id;
 | |
|                 item.ReportDate = data_SYHSE.ReportDate.Value.ToShortDateString();
 | |
|                 item.UnitId = data_SYHSE.UnitId;
 | |
|                 item.CollCropCode = data_SYHSE.CollCropCode;
 | |
|                 item.GeneralRiskNum = data_SYHSE.GeneralRiskNum;
 | |
|                 item.LowRiskNum = data_SYHSE.LowRiskNum;
 | |
|                 item.MediumRiskNum = data_SYHSE.MediumRiskNum;
 | |
|                 item.HighRiskNum = data_SYHSE.HighRiskNum;
 | |
|                 item.GradedResponsiblePersonNum = data_SYHSE.GradedResponsiblePersonNum;
 | |
|                 item.ChargeInsurancePersonNum = data_SYHSE.ChargeInsurancePersonNum;
 | |
|                 item.DesignQuantity = data_SYHSE.DesignQuantity;
 | |
|                 item.RunningCapacity = data_SYHSE.RunningCapacity;
 | |
|                 item.InterlockSettingValue = data_SYHSE.InterlockSettingValue;
 | |
|                 item.VideoSurveillanceNum = data_SYHSE.VideoSurveillanceNum;
 | |
|                 item.TotalWorkinghours = data_SYHSE.TotalWorkinghours;
 | |
|                 item.SafeWorkinghours = data_SYHSE.SafeWorkinghours;
 | |
|                 item.LostWorkinghours = data_SYHSE.LostWorkinghours;
 | |
|                 item.TotalEnergyConsumption = data_SYHSE.TotalEnergyConsumption;
 | |
|                 item.IncomeComprehensiveEnergyConsumption = data_SYHSE.IncomeComprehensiveEnergyConsumption;
 | |
|                 item.NewWaterConsumption = data_SYHSE.NewWaterConsumption;
 | |
|                 item.GeneralClosedNum = data_SYHSE.GeneralClosedNum;
 | |
|                 item.GeneralNotClosedNum = data_SYHSE.GeneralNotClosedNum;
 | |
|                 item.GeneralRate = "";
 | |
|                 item.MajorClosedNum = data_SYHSE.MajorClosedNum;
 | |
|                 item.MajorNotClosedNum = data_SYHSE.MajorNotClosedNum;
 | |
|                 item.MajorRate = "";
 | |
|                 item.HotWorkPermitNum = data_SYHSE.HotWorkPermitNum;
 | |
|                 item.HotWorkClosedNum = data_SYHSE.HotWorkClosedNum;
 | |
|                 item.HighPermitNum = data_SYHSE.HighPermitNum;
 | |
|                 item.HighClosedNum = data_SYHSE.HighClosedNum;
 | |
|                 item.TemporaryElectricityPermitNum = data_SYHSE.TemporaryElectricityPermitNum;
 | |
|                 item.TemporaryElectricityClosedNum = data_SYHSE.TemporaryElectricityClosedNum;
 | |
|                 item.BlindPlatePermitNum = data_SYHSE.BlindPlatePermitNum;
 | |
|                 item.BlindPlateClosedNum = data_SYHSE.BlindPlateClosedNum;
 | |
|                 item.GroundbreakingPermitNum = data_SYHSE.GroundbreakingPermitNum;
 | |
|                 item.GroundbreakingClosedNum = data_SYHSE.GroundbreakingClosedNum;
 | |
|                 item.OpenCircuitPermitNum = data_SYHSE.OpenCircuitPermitNum;
 | |
|                 item.OpenCircuitClosedNum = data_SYHSE.OpenCircuitClosedNum;
 | |
|                 item.HoistingPermitNum = data_SYHSE.HoistingPermitNum;
 | |
|                 item.HoistingClosedNum = data_SYHSE.HoistingClosedNum;
 | |
|             }
 | |
|             List<SyhseDataItem> syhseDataItems = new List<SyhseDataItem>();
 | |
|             syhseDataItems.Add(item);
 | |
|             data.SYHSEDataItems = syhseDataItems;
 | |
|             return data;
 | |
|         }
 | |
|         public static Model.SYHSEData GetItemBySyhseData_SYHSE(SYHSEData_SYHSE data_SYHSE)
 | |
|         {
 | |
|             SyhseDataItem item = new SyhseDataItem();
 | |
|             SYHSEData data = new SYHSEData();
 | |
|             if (data_SYHSE != null)
 | |
|             {
 | |
|                 item.Id = data_SYHSE.Id;
 | |
|                 item.ReportDate = data_SYHSE.ReportDate.Value.ToShortDateString();
 | |
|                 item.UnitId = data_SYHSE.UnitId;
 | |
|                 item.CollCropCode = data_SYHSE.CollCropCode;
 | |
|                 item.GeneralRiskNum = data_SYHSE.GeneralRiskNum;
 | |
|                 item.LowRiskNum = data_SYHSE.LowRiskNum;
 | |
|                 item.MediumRiskNum = data_SYHSE.MediumRiskNum;
 | |
|                 item.HighRiskNum = data_SYHSE.HighRiskNum;
 | |
|                 item.GradedResponsiblePersonNum = data_SYHSE.GradedResponsiblePersonNum;
 | |
|                 item.ChargeInsurancePersonNum = data_SYHSE.ChargeInsurancePersonNum;
 | |
|                 item.DesignQuantity = data_SYHSE.DesignQuantity;
 | |
|                 item.RunningCapacity = data_SYHSE.RunningCapacity;
 | |
|                 item.InterlockSettingValue = data_SYHSE.InterlockSettingValue;
 | |
|                 item.VideoSurveillanceNum = data_SYHSE.VideoSurveillanceNum;
 | |
|                 item.TotalWorkinghours = data_SYHSE.TotalWorkinghours;
 | |
|                 item.SafeWorkinghours = data_SYHSE.SafeWorkinghours;
 | |
|                 item.LostWorkinghours = data_SYHSE.LostWorkinghours;
 | |
|                 item.TotalEnergyConsumption = data_SYHSE.TotalEnergyConsumption;
 | |
|                 item.IncomeComprehensiveEnergyConsumption = data_SYHSE.IncomeComprehensiveEnergyConsumption;
 | |
|                 item.NewWaterConsumption = data_SYHSE.NewWaterConsumption;
 | |
|                 item.GeneralClosedNum = data_SYHSE.GeneralClosedNum;
 | |
|                 item.GeneralNotClosedNum = data_SYHSE.GeneralNotClosedNum;
 | |
|                 item.GeneralRate = "";
 | |
|                 item.MajorClosedNum = data_SYHSE.MajorClosedNum;
 | |
|                 item.MajorNotClosedNum = data_SYHSE.MajorNotClosedNum;
 | |
|                 item.MajorRate = "";
 | |
|                 item.HotWorkPermitNum = data_SYHSE.HotWorkPermitNum;
 | |
|                 item.HotWorkClosedNum = data_SYHSE.HotWorkClosedNum;
 | |
|                 item.HighPermitNum = data_SYHSE.HighPermitNum;
 | |
|                 item.HighClosedNum = data_SYHSE.HighClosedNum;
 | |
|                 item.TemporaryElectricityPermitNum = data_SYHSE.TemporaryElectricityPermitNum;
 | |
|                 item.TemporaryElectricityClosedNum = data_SYHSE.TemporaryElectricityClosedNum;
 | |
|                 item.BlindPlatePermitNum = data_SYHSE.BlindPlatePermitNum;
 | |
|                 item.BlindPlateClosedNum = data_SYHSE.BlindPlateClosedNum;
 | |
|                 item.GroundbreakingPermitNum = data_SYHSE.GroundbreakingPermitNum;
 | |
|                 item.GroundbreakingClosedNum = data_SYHSE.GroundbreakingClosedNum;
 | |
|                 item.OpenCircuitPermitNum = data_SYHSE.OpenCircuitPermitNum;
 | |
|                 item.OpenCircuitClosedNum = data_SYHSE.OpenCircuitClosedNum;
 | |
|                 item.HoistingPermitNum = data_SYHSE.HoistingPermitNum;
 | |
|                 item.HoistingClosedNum = data_SYHSE.HoistingClosedNum;
 | |
|             }
 | |
|             List<SyhseDataItem> syhseDataItems = new List<SyhseDataItem>();
 | |
|             syhseDataItems.Add(item);
 | |
|             data.SYHSEDataItems = syhseDataItems;
 | |
|             return data;
 | |
|         }
 | |
| 
 | |
|         public static Model.SYHSEData_SYHSE GetSYHSEData_SYHSEById(string Id)
 | |
|         {
 | |
|             return db.SYHSEData_SYHSE.FirstOrDefault(x => x.Id == Id);
 | |
|         }
 | |
| 
 | |
|         public static Model.SYHSEData GetTodaySYHSEData_SYHSE()
 | |
|         {
 | |
|             var q = GetTodayData();
 | |
|             SYHSEData data = new SYHSEData();
 | |
|             if (q != null && q.State == Const.CNCEC_State_S)
 | |
|             {
 | |
|                 data = GetItemBySyhseData_SYHSE(q);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 data = StatisticalData();
 | |
|             }
 | |
|             return data;
 | |
|         }
 | |
|         public static Model.SYHSEData_SYHSE GetTodayData()
 | |
|         {
 | |
|             var q = (from x in Funs.DB.SYHSEData_SYHSE
 | |
|                      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;
 | |
|                 UpdateSYHSEData_SYHSE(q);
 | |
|             }
 | |
|             
 | |
|         }
 | |
|         public static bool IsReportByDate(DateTime dateTime)
 | |
|         {
 | |
|             var result = false;
 | |
|             var q = (from x in Funs.DB.SYHSEData_SYHSE
 | |
|                      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.SYHSEData_SYHSE
 | |
|                      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/SYHSEData/SaveSYHSEData";
 | |
|             var item = GetItemById(Id);
 | |
|             string str = JsonConvert.SerializeObject(item);
 | |
|             var responeData = BLL.ServerService.PushCNCEC(str, baseurl);
 | |
|             return responeData;
 | |
|         }
 | |
| 
 | |
|         public static SYHSEData StatisticalData()
 | |
|         {
 | |
|             var base_Unit = BLL.UnitService.GetUnitByUnitId(BLL.Const.UnitId_CD);
 | |
|             var ProjectData = (from x in Funs.DB.Project_SYHSEData_SYHSE
 | |
|                                where x.ReportDate < DateTime.Now.AddDays(1).Date && x.ReportDate >= DateTime.Now.Date
 | |
|                                select x).ToList();
 | |
|             Project_SYHSEData_SYHSEService.StatisticalAllProjectData();
 | |
| 
 | |
|             Model.SYHSEData_SYHSE table = new Model.SYHSEData_SYHSE
 | |
|             {
 | |
|                 UnitId = BLL.Const.UnitId_CD,
 | |
|                 CollCropCode = base_Unit.CollCropCode,
 | |
|                 UnitName = base_Unit.UnitName,
 | |
|                 ReportDate = DateTime.Now.Date,
 | |
|                 GeneralRiskNum = ProjectData.Sum(x => x.GeneralRiskNum),
 | |
|                 LowRiskNum = ProjectData.Sum(x => x.LowRiskNum),
 | |
|                 MediumRiskNum = ProjectData.Sum(x => x.MediumRiskNum),
 | |
|                 HighRiskNum = ProjectData.Sum(x => x.HighRiskNum),
 | |
|                 GradedResponsiblePersonNum = ProjectData.Sum(x => x.GradedResponsiblePersonNum),
 | |
|                 ChargeInsurancePersonNum = ProjectData.Sum(x => x.ChargeInsurancePersonNum),
 | |
|                 DesignQuantity = ProjectData.Sum(x => x.DesignQuantity),
 | |
|                 RunningCapacity = ProjectData.Sum(x => x.RunningCapacity),
 | |
|                 InterlockSettingValue = ProjectData.Sum(x => x.InterlockSettingValue),
 | |
|                 VideoSurveillanceNum = ProjectData.Sum(x => x.VideoSurveillanceNum),
 | |
|                 TotalWorkinghours = ProjectData.Sum(x => x.TotalWorkinghours),
 | |
|                 SafeWorkinghours = ProjectData.Sum(x => x.SafeWorkinghours),
 | |
|                 LostWorkinghours = ProjectData.Sum(x => x.LostWorkinghours),
 | |
|                 TotalEnergyConsumption = ProjectData.Sum(x => x.TotalEnergyConsumption),
 | |
|                 IncomeComprehensiveEnergyConsumption = ProjectData.Sum(x => x.IncomeComprehensiveEnergyConsumption),
 | |
|                 NewWaterConsumption = ProjectData.Sum(x => x.NewWaterConsumption),
 | |
|                 GeneralClosedNum = ProjectData.Sum(x => x.GeneralClosedNum),
 | |
|                 GeneralNotClosedNum = ProjectData.Sum(x => x.GeneralNotClosedNum),
 | |
|                 MajorClosedNum = ProjectData.Sum(x => x.MajorClosedNum),
 | |
|                 MajorNotClosedNum = ProjectData.Sum(x => x.MajorNotClosedNum),
 | |
|                 HotWorkPermitNum = ProjectData.Sum(x => x.HotWorkPermitNum),
 | |
|                 HotWorkClosedNum = ProjectData.Sum(x => x.HotWorkClosedNum),
 | |
|                 HighPermitNum = ProjectData.Sum(x => x.HighPermitNum),
 | |
|                 HighClosedNum = ProjectData.Sum(x => x.HighClosedNum),
 | |
|                 TemporaryElectricityPermitNum = ProjectData.Sum(x => x.TemporaryElectricityPermitNum),
 | |
|                 TemporaryElectricityClosedNum = ProjectData.Sum(x => x.TemporaryElectricityClosedNum),
 | |
|                 BlindPlatePermitNum = ProjectData.Sum(x => x.BlindPlatePermitNum),
 | |
|                 BlindPlateClosedNum = ProjectData.Sum(x => x.BlindPlateClosedNum),
 | |
|                 GroundbreakingPermitNum = ProjectData.Sum(x => x.GroundbreakingPermitNum),
 | |
|                 GroundbreakingClosedNum = ProjectData.Sum(x => x.GroundbreakingClosedNum),
 | |
|                 OpenCircuitPermitNum = ProjectData.Sum(x => x.OpenCircuitPermitNum),
 | |
|                 OpenCircuitClosedNum = ProjectData.Sum(x => x.OpenCircuitClosedNum),
 | |
|                 HoistingPermitNum = ProjectData.Sum(x => x.HoistingPermitNum),
 | |
|                 HoistingClosedNum = ProjectData.Sum(x => x.HoistingClosedNum),
 | |
|                 CreateMan = Const.sysglyId,
 | |
|                 CreateDate = DateTime.Now,
 | |
|             };
 | |
|             if (IsReportByToday())
 | |
|             {
 | |
|                 table.Id = GetTodayData().Id;
 | |
|                 table.State = Const.CNCEC_State_1;
 | |
|                 UpdateSYHSEData_SYHSE(table);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 table.Id = SQLHelper.GetNewID();
 | |
|                 table.State = Const.CNCEC_State_0;
 | |
|                 AddSYHSEData_SYHSE(table);
 | |
|             }
 | |
|             SYHSEData data = new SYHSEData();
 | |
|             data = GetItemBySyhseData_SYHSE(table);
 | |
| 
 | |
|             return data;
 | |
|         }
 | |
|         public static void UpdateSYHSEData_SYHSE(Model.SYHSEData_SYHSE newtable)
 | |
|         {
 | |
|             Model.SYHSEData_SYHSE table = db.SYHSEData_SYHSE.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.GeneralRiskNum = newtable.GeneralRiskNum;
 | |
|                 table.LowRiskNum = newtable.LowRiskNum;
 | |
|                 table.MediumRiskNum = newtable.MediumRiskNum;
 | |
|                 table.HighRiskNum = newtable.HighRiskNum;
 | |
|                 table.GradedResponsiblePersonNum = newtable.GradedResponsiblePersonNum;
 | |
|                 table.ChargeInsurancePersonNum = newtable.ChargeInsurancePersonNum;
 | |
|                 table.DesignQuantity = newtable.DesignQuantity;
 | |
|                 table.RunningCapacity = newtable.RunningCapacity;
 | |
|                 table.InterlockSettingValue = newtable.InterlockSettingValue;
 | |
|                 table.VideoSurveillanceNum = newtable.VideoSurveillanceNum;
 | |
|                 table.TotalWorkinghours = newtable.TotalWorkinghours;
 | |
|                 table.SafeWorkinghours = newtable.SafeWorkinghours;
 | |
|                 table.LostWorkinghours = newtable.LostWorkinghours;
 | |
|                 table.TotalEnergyConsumption = newtable.TotalEnergyConsumption;
 | |
|                 table.IncomeComprehensiveEnergyConsumption = newtable.IncomeComprehensiveEnergyConsumption;
 | |
|                 table.NewWaterConsumption = newtable.NewWaterConsumption;
 | |
|                 table.GeneralClosedNum = newtable.GeneralClosedNum;
 | |
|                 table.GeneralNotClosedNum = newtable.GeneralNotClosedNum;
 | |
|                 table.MajorClosedNum = newtable.MajorClosedNum;
 | |
|                 table.MajorNotClosedNum = newtable.MajorNotClosedNum;
 | |
|                 table.HotWorkPermitNum = newtable.HotWorkPermitNum;
 | |
|                 table.HotWorkClosedNum = newtable.HotWorkClosedNum;
 | |
|                 table.HighPermitNum = newtable.HighPermitNum;
 | |
|                 table.HighClosedNum = newtable.HighClosedNum;
 | |
|                 table.TemporaryElectricityPermitNum = newtable.TemporaryElectricityPermitNum;
 | |
|                 table.TemporaryElectricityClosedNum = newtable.TemporaryElectricityClosedNum;
 | |
|                 table.BlindPlatePermitNum = newtable.BlindPlatePermitNum;
 | |
|                 table.BlindPlateClosedNum = newtable.BlindPlateClosedNum;
 | |
|                 table.GroundbreakingPermitNum = newtable.GroundbreakingPermitNum;
 | |
|                 table.GroundbreakingClosedNum = newtable.GroundbreakingClosedNum;
 | |
|                 table.OpenCircuitPermitNum = newtable.OpenCircuitPermitNum;
 | |
|                 table.OpenCircuitClosedNum = newtable.OpenCircuitClosedNum;
 | |
|                 table.HoistingPermitNum = newtable.HoistingPermitNum;
 | |
|                 table.HoistingClosedNum = newtable.HoistingClosedNum;
 | |
|                 table.State = newtable.State;
 | |
|                 table.CreateMan = newtable.CreateMan;
 | |
|                 table.CreateDate = newtable.CreateDate;
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| } |