推送数据

This commit is contained in:
2023-01-30 14:14:20 +08:00
parent 354f0ef6fe
commit 5c4b481651
49 changed files with 3905 additions and 289 deletions
+4
View File
@@ -650,6 +650,8 @@
<Compile Include="OfficeCheck\Check\ProjectSupervision_RectifyItemService.cs" />
<Compile Include="OfficeCheck\Check\ProjectSupervision_RectifyService.cs" />
<Compile Include="OfficeCheck\ProjectEvaluation\ProjectEvaluationService.cs" />
<Compile Include="OpenService\FileInsertService.cs" />
<Compile Include="OpenService\FileStructService.cs" />
<Compile Include="OpenService\MonitorService.cs" />
<Compile Include="DynamicTHeaderHepler.cs" />
<Compile Include="OpenService\GetDataService.cs" />
@@ -765,6 +767,7 @@
<Compile Include="TestRun\ProduceTestRun\TestRunRecordService.cs" />
<Compile Include="TestRun\ProduceTestRun\TestRunReportService.cs" />
<Compile Include="TestRun\TestRunService.cs" />
<Compile Include="WebService\CNCECHSSEWebService.cs" />
<Compile Include="ZHGL\DataStatistics\DataStatisticsService.cs" />
<Compile Include="ZHGL\DataSync\CQMSDataService.cs" />
<Compile Include="ZHGL\DataSync\HJGLData_DefectService.cs" />
@@ -792,6 +795,7 @@
<Compile Include="ZHGL\Information\MillionsMonthlyReportItemService.cs" />
<Compile Include="ZHGL\Information\MillionsMonthlyReportService.cs" />
<Compile Include="ZHGL\Information\SafetyQuarterlyReportService.cs" />
<Compile Include="ZHGL\Information\UrgeReportService.cs" />
<Compile Include="ZHGL\ProjectAccident\AccidentAnalysisItemService.cs" />
<Compile Include="ZHGL\ProjectAccident\AccidentAnalysisService.cs" />
<Compile Include="ZHGL\ProjectAccident\AccidentStatisticsService.cs" />
+1 -1
View File
@@ -540,7 +540,7 @@ namespace BLL
}
}
#endregion
#region
/// <summary>
/// 保存数据
@@ -1,5 +1,6 @@
namespace BLL
{
using System;
using System.Collections;
using System.Linq;
@@ -311,5 +312,21 @@
where x.MenuId == menuId && x.DataId == dataId && (x.IsClosed == false || !x.IsClosed.HasValue)
select x).FirstOrDefault();
}
/// <summary>
///
/// </summary>
public static void CloseFlowOperate(string menuId, string dataId, string opinion)
{
var updateUnFlowOperate = db.ProjectData_FlowOperate.FirstOrDefault(x => x.MenuId == menuId && x.DataId == dataId && (x.IsClosed == false || !x.IsClosed.HasValue));
if (updateUnFlowOperate != null)
{
updateUnFlowOperate.OperaterTime = DateTime.Now;
updateUnFlowOperate.IsClosed = true;
updateUnFlowOperate.Opinion = opinion;
BLL.ProjectDataFlowSetService.UpdateFlowOperateOpinion(updateUnFlowOperate);
}
}
}
}
@@ -17,7 +17,7 @@ namespace BLL
/// <returns></returns>
public static Model.Training_TestTrainingItem GetTestTrainingItemById(string TrainingItemId)
{
return Funs.DB.Training_TestTrainingItem.FirstOrDefault(e => e.TrainingItemId == TrainingItemId);
return Funs.DB.Training_TestTrainingItem.FirstOrDefault(e => e.TrainingItemId == TrainingItemId && e.DepartIds !=null);
}
/// <summary>
+138
View File
@@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.IO;
using System.Web;
namespace BLL
{
public static class FileInsertService
{
/// <summary>
/// 获取附件数据流类
/// </summary>
/// <param name="attachUrl">附件路径</param>
/// <returns></returns>
public static void FileInsert(List<byte[]> fileContextList, string attachUrl)
{
if (fileContextList != null && fileContextList.Count > 0)
{
string physicalpath = Funs.RootPath;
//HttpContext.Current.Request.PhysicalApplicationPath;
string fullPath = physicalpath + attachUrl;
if (!File.Exists(fullPath))
{
byte[] fileContext = fileContextList[0];
int index = fullPath.LastIndexOf("\\");
string filePath = fullPath.Substring(0, index);
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
//string savePath = fullPath + fileName;
//文件读写模式
System.IO.FileMode fileMode = System.IO.FileMode.Create;
//写入文件
using (System.IO.FileStream fs = new System.IO.FileStream(fullPath, fileMode, System.IO.FileAccess.Write))
{
fs.Write(fileContext, 0, fileContext.Length);
}
}
}
}
/// <summary>
/// 获取多附件数据流类
/// </summary>
/// <param name="attachUrl">附件路径</param>
/// <returns></returns>
public static void FileMoreInsert(List<byte[]> fileContextList, string attachUrl)
{
if (fileContextList != null && fileContextList.Count() > 0)
{
if (fileContextList.Count > 0)
{
string[] strs = attachUrl.Trim().Split(',');
int i = 0;
foreach (var item in fileContextList)
{
if (strs.Count() > i)
{
string physicalpath = Funs.RootPath;
//HttpContext.Current.Request.PhysicalApplicationPath;
string fullPath = physicalpath + strs[i];
if (!File.Exists(fullPath))
{
byte[] fileContext = item;
int index = fullPath.LastIndexOf("\\");
string filePath = fullPath.Substring(0, index);
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
//string savePath = fullPath + fileName;
//文件读写模式
System.IO.FileMode fileMode = System.IO.FileMode.Create;
//写入文件
using (System.IO.FileStream fs = new System.IO.FileStream(fullPath, fileMode, System.IO.FileAccess.Write))
{
fs.Write(fileContext, 0, fileContext.Length);
}
}
i++;
}
}
}
}
}
/// <summary>
/// 数据和附件插入到多附件表
/// </summary>
public static void InsertAttachFile(string attachFileId, string dataId, string attachSource, string attachUrl, List<byte[]> fileContext)
{
var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFileId);
if (getAtt != null)
{
Funs.DB.AttachFile.DeleteOnSubmit(getAtt);
Funs.DB.SubmitChanges();
}
//多附件
var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);
if (attachFile == null && !string.IsNullOrEmpty(attachSource))
{
Model.AttachFile newAttachFile = new Model.AttachFile
{
AttachFileId = attachFileId,
ToKeyId = dataId,
AttachSource = attachSource,
AttachUrl = attachUrl
};
Funs.DB.AttachFile.InsertOnSubmit(newAttachFile);
Funs.DB.SubmitChanges();
////插入附件文件
BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
}
else
{
if (attachFile.AttachUrl != attachUrl)
{
///删除附件文件
BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
////插入附件文件
BLL.FileInsertService.FileMoreInsert(fileContext, attachUrl);
attachFile.AttachSource = attachSource;
attachFile.AttachUrl = attachUrl;
Funs.DB.SubmitChanges();
}
}
}
}
}
+107
View File
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.IO;
using System.Web;
namespace BLL
{
public static class FileStructService
{
/// <summary>
/// 获取附件数据流类
/// </summary>
/// <param name="attachUrl">附件路径</param>
/// <returns></returns>
public static List<byte[]> GetFileStructByAttachUrl(string attachUrl)
{
List<byte[]> fileContext = new List<byte[]>();
if (!String.IsNullOrEmpty(attachUrl))
{
string filePath = string.Empty;
string physicalpath = Funs.RootPath;
//HttpContext.Current.Request.PhysicalApplicationPath;
filePath = physicalpath + attachUrl;
if (File.Exists(filePath))
{
FileInfo fileInfo = new FileInfo(filePath);
Stream stream = fileInfo.OpenRead();
//读取指定大小的文件流内容到uploadFile.Context以便上传
int b;
while (stream.Position > -1 && stream.Position < stream.Length)
{
if (stream.Length - stream.Position >= 20000000)
{
b = 20000000;
}
else
{
b = (int)(stream.Length - stream.Position);
}
byte[] filebyte = new byte[b];
stream.Read(filebyte, 0, b);
fileContext.Add(filebyte);
}
stream.Close();
}
}
return fileContext;
}
/// <summary>
/// 获取附件数据流类 多附件的情况
/// </summary>
/// <param name="attachUrl">附件路径</param>
/// <returns></returns>
public static List<byte[]> GetMoreFileStructByAttachUrl(string attachUrl)
{
List<byte[]> fileContext = new List<byte[]>();
if (!String.IsNullOrEmpty(attachUrl))
{
string[] strs = attachUrl.Trim().Split(',');
foreach (var item in strs)
{
string filePath = string.Empty;
string physicalpath = Funs.RootPath;
//HttpContext.Current.Request.PhysicalApplicationPath;
filePath = physicalpath + item;
if (File.Exists(filePath))
{
FileInfo fileInfo = new FileInfo(filePath);
if (fileInfo != null)
{
Stream stream = fileInfo.OpenRead();
if (stream != null)
{
//读取指定大小的文件流内容到uploadFile.Context以便上传
int b;
while (stream.Position > -1 && stream.Position < stream.Length)
{
if (stream.Length - stream.Position >= 20000000)
{
b = 20000000;
}
else
{
b = (int)(stream.Length - stream.Position);
}
byte[] filebyte = new byte[b];
stream.Read(filebyte, 0, b);
fileContext.Add(filebyte);
}
}
stream.Close();
}
}
}
}
return fileContext;
}
}
}
+627
View File
@@ -0,0 +1,627 @@
namespace BLL
{
using Model;
using Newtonsoft.Json;
using NPOI.POIFS.Crypt.Dsig;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
public static class CNCECHSSEWebService
{
#region
#region
/// <summary>
/// 百万工时上报
/// </summary>
public static string UpMillionsMonthlyReport(string millionsMonthlyReportId, Model.Sys_User CurrUser)
{
string code = "0";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
//CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
var upReport = from x in db.Information_MillionsMonthlyReport
where x.MillionsMonthlyReportId == millionsMonthlyReportId
select new Model.HSSE.Information_MillionsMonthlyReport
{
MillionsMonthlyReportId = x.MillionsMonthlyReportId,
UnitId = x.UnitId,
Year = x.Year,
Month = x.Month,
FillingMan = x.FillingMan,
FillingDate = x.FillingDate,
DutyPerson = x.DutyPerson,
RecordableIncidentRate = x.RecordableIncidentRate,
LostTimeRate = x.LostTimeRate,
LostTimeInjuryRate = x.LostTimeInjuryRate,
DeathAccidentFrequency = x.DeathAccidentFrequency,
AccidentMortality = x.AccidentMortality,
};
var upReportItem = from x in db.Information_MillionsMonthlyReportItem
where x.MillionsMonthlyReportId == millionsMonthlyReportId
select new Model.HSSE.Information_MillionsMonthlyReportItem
{
MillionsMonthlyReportItemId = x.MillionsMonthlyReportItemId,
MillionsMonthlyReportId = x.MillionsMonthlyReportId,
SortIndex = x.SortIndex,
Affiliation = x.Affiliation,
Name = x.Name,
PostPersonNum = x.PostPersonNum,
SnapPersonNum = x.SnapPersonNum,
ContractorNum = x.ContractorNum,
SumPersonNum = x.SumPersonNum,
TotalWorkNum = x.TotalWorkNum,
SeriousInjuriesNum = x.SeriousInjuriesNum,
SeriousInjuriesPersonNum = x.SeriousInjuriesPersonNum,
SeriousInjuriesLossHour = x.SeriousInjuriesLossHour,
MinorAccidentNum = x.MinorAccidentNum,
MinorAccidentPersonNum = x.MinorAccidentPersonNum,
MinorAccidentLossHour = x.MinorAccidentLossHour,
OtherAccidentNum = x.OtherAccidentNum,
OtherAccidentPersonNum = x.OtherAccidentPersonNum,
OtherAccidentLossHour = x.OtherAccidentLossHour,
RestrictedWorkPersonNum = x.RestrictedWorkPersonNum,
RestrictedWorkLossHour = x.RestrictedWorkLossHour,
MedicalTreatmentPersonNum = x.MedicalTreatmentPersonNum,
MedicalTreatmentLossHour = x.MedicalTreatmentLossHour,
FireNum = x.FireNum,
ExplosionNum = x.ExplosionNum,
TrafficNum = x.TrafficNum,
EquipmentNum = x.EquipmentNum,
QualityNum = x.QualityNum,
OtherNum = x.OtherNum,
FirstAidDressingsNum = x.FirstAidDressingsNum,
AttemptedEventNum = x.AttemptedEventNum,
LossDayNum = x.LossDayNum,
};
//老接口Serveice
//var getR = hsseC.DataInsertInformation_MillionsMonthlyReportTable(upReport.ToList(), upReportItem.ToList());
//新接口Api
code = UpApiMillionsMonthlyReport(upReport, upReportItem).ToString();
if (code == "1")
{
foreach (var item in upReport.Select(p => p.MillionsMonthlyReportId))
{
var report = db.Information_MillionsMonthlyReport.FirstOrDefault(e => e.MillionsMonthlyReportId == item);
if (report != null)
{
report.UpState = BLL.Const.UpState_3;
db.SubmitChanges();
////更新 当前人要处理的意见
ProjectDataFlowSetService.CloseFlowOperate(Const.MillionsMonthlyReportMenuId, item, string.Empty);
// //更新催报信息
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_1, report.Year.ToString(), report.Month.ToString());
}
}
LogService.AddSys_Log(CurrUser, "【百万工时安全统计月报表】上传到服务器" + upReport.Count().ToString() + "条数据;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
else
{
LogService.AddSys_Log(CurrUser, "【百万工时安全统计月报表】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog("【百万工时安全统计月报表】上传到服务器", ex);
LogService.AddSys_Log(CurrUser, "【百万工时安全统计月报表】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
return code;
}
}
/// <summary>
/// UpApiMillionsMonthlyReportApi调用
/// </summary>
/// <param name="upReport">主表</param>
/// <param name="upReportItem">明细表</param>
/// <returns></returns>
private static int UpApiMillionsMonthlyReport(IQueryable<Model.HSSE.Information_MillionsMonthlyReport> upReport, IQueryable<Model.HSSE.Information_MillionsMonthlyReportItem> upReportItem)
{
string baseurl = "/api/InformationData/SaveMillionsMonthlyReport";
//合并
//var resultJson = JsonConvert.SerializeObject(new { upReport, ReportItem = upReportItem });
var resultJsonReport = JsonConvert.SerializeObject(upReport.FirstOrDefault());
var resultJsonReportItem = JsonConvert.SerializeObject(new { MillionsMonthlyReportItem = upReportItem });
resultJsonReport = "{\"InformationDataItems\":[" + (resultJsonReport + resultJsonReportItem).Replace("}{", ",") + "]}";
var responeData = BLL.ServerService.PushCNCEC(resultJsonReport, baseurl);
return responeData.code;
}
#endregion
#region
/// <summary>
/// 职工伤亡事故原因分析报表上报
/// </summary>
public static string UpAccidentCauseReport(string accidentCauseReportId, Model.Sys_User CurrUser)
{
string code = "0";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
//CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
var upReport = from x in db.Information_AccidentCauseReport
where x.AccidentCauseReportId == accidentCauseReportId
select new Model.HSSE.Information_AccidentCauseReport
{
AccidentCauseReportId = x.AccidentCauseReportId,
UnitId = x.UnitId,
AccidentCauseReportCode = x.AccidentCauseReportCode,
Year = x.Year,
Month = x.Month,
DeathAccident = x.DeathAccident,
DeathToll = x.DeathToll,
InjuredAccident = x.InjuredAccident,
InjuredToll = x.InjuredToll,
MinorWoundAccident = x.MinorWoundAccident,
MinorWoundToll = x.MinorWoundToll,
AverageTotalHours = x.AverageTotalHours,
AverageManHours = x.AverageManHours,
TotalLossMan = x.TotalLossMan,
LastMonthLossHoursTotal = x.LastMonthLossHoursTotal,
KnockOffTotal = x.KnockOffTotal,
DirectLoss = x.DirectLoss,
IndirectLosses = x.IndirectLosses,
TotalLoss = x.TotalLoss,
TotalLossTime = x.TotalLossTime,
FillCompanyPersonCharge = x.FillCompanyPersonCharge,
TabPeople = x.TabPeople,
AuditPerson = x.AuditPerson,
FillingDate = x.FillingDate,
};
var upReportItem = from x in db.Information_AccidentCauseReportItem
where x.AccidentCauseReportId == accidentCauseReportId
select new Model.HSSE.Information_AccidentCauseReportItem
{
AccidentCauseReportItemId = x.AccidentCauseReportItemId,
AccidentCauseReportId = x.AccidentCauseReportId,
AccidentType = x.AccidentType,
TotalDeath = x.TotalDeath,
TotalInjuries = x.TotalInjuries,
TotalMinorInjuries = x.TotalMinorInjuries,
Death1 = x.Death1,
Injuries1 = x.Injuries1,
MinorInjuries1 = x.MinorInjuries1,
Death2 = x.Death2,
Injuries2 = x.Injuries2,
MinorInjuries2 = x.MinorInjuries2,
Death3 = x.Death3,
Injuries3 = x.Injuries3,
MinorInjuries3 = x.MinorInjuries3,
Death4 = x.Death4,
Injuries4 = x.Injuries4,
MinorInjuries4 = x.MinorInjuries4,
Death5 = x.Death5,
Injuries5 = x.Injuries5,
MinorInjuries5 = x.MinorInjuries5,
Death6 = x.Death6,
Injuries6 = x.Injuries6,
MinorInjuries6 = x.MinorInjuries6,
Death7 = x.Death7,
Injuries7 = x.Injuries7,
MinorInjuries7 = x.MinorInjuries7,
Death8 = x.Death8,
Injuries8 = x.Injuries8,
MinorInjuries8 = x.MinorInjuries8,
Death9 = x.Death9,
Injuries9 = x.Injuries9,
MinorInjuries9 = x.MinorInjuries9,
Death10 = x.Death10,
Injuries10 = x.Injuries10,
MinorInjuries10 = x.MinorInjuries10,
Death11 = x.Death11,
Injuries11 = x.Injuries11,
MinorInjuries11 = x.MinorInjuries11,
};
//老接口Serveice
// var getR = hsseC.DataInsertInformation_AccidentCauseReportTable(upReport.ToList(), upReportItem.ToList());
//新接口Api
code = UpApiAccidentCauseReport(upReport, upReportItem).ToString();
if (code == "1")
{
foreach (var item in upReport.Select(p => p.AccidentCauseReportId))
{
var report = db.Information_AccidentCauseReport.FirstOrDefault(e => e.AccidentCauseReportId == item);
if (report != null)
{
report.UpState = BLL.Const.UpState_3;
db.SubmitChanges();
////更新 当前人要处理的意见
ProjectDataFlowSetService.CloseFlowOperate(Const.MillionsMonthlyReportMenuId, item, string.Empty);
////更新催报信息
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_2, report.Year.ToString(), report.Month.ToString());
}
}
LogService.AddSys_Log(CurrUser, "【职工伤亡事故原因分析报表】上传到服务器" + upReport.Count().ToString() + "条数据;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
else
{
LogService.AddSys_Log(CurrUser, "【职工伤亡事故原因分析报表】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog("【职工伤亡事故原因分析报表】上传到服务器", ex);
LogService.AddSys_Log(CurrUser, "【职工伤亡事故原因分析报表】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
return code;
}
}
/// <summary>
/// AccidentCauseReportApi调用
/// </summary>
/// <param name="upReport">主表</param>
/// <param name="upReportItem">明细表</param>
/// <returns></returns>
private static int UpApiAccidentCauseReport(IQueryable<Model.HSSE.Information_AccidentCauseReport> upReport, IQueryable<Model.HSSE.Information_AccidentCauseReportItem> upReportItem)
{
string baseurl = "/api/InformationData/SaveAccidentCauseReport";
//合并
//var resultJson = JsonConvert.SerializeObject(new { upReport, ReportItem = upReportItem });
var resultJson = JsonConvert.SerializeObject(upReport.FirstOrDefault());
var resultJson1 = JsonConvert.SerializeObject(new { AccidentCauseReportItem = upReportItem });
resultJson = "{\"InformationDataItems\":[" + (resultJson + resultJson1).Replace("}{", ",") + "]}";
var responeData = BLL.ServerService.PushCNCEC(resultJson, baseurl);
return responeData.code;
}
#endregion
#region
/// <summary>
/// 安全生产数据季报上报
/// </summary>
public static string UpSafetyQuarterlyReport(string safetyQuarterlyReportId, Model.Sys_User CurrUser)
{
string code = "0";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
//CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
var upReport = from x in db.Information_SafetyQuarterlyReport
where x.SafetyQuarterlyReportId == safetyQuarterlyReportId
select new Model.HSSE.Information_SafetyQuarterlyReport
{
SafetyQuarterlyReportId = x.SafetyQuarterlyReportId,
UnitId = x.UnitId,
YearId = x.YearId,
Quarters = x.Quarters,
TotalInWorkHours = x.TotalInWorkHours,
TotalInWorkHoursRemark = x.TotalInWorkHoursRemark,
TotalOutWorkHours = x.TotalOutWorkHours,
TotalOutWorkHoursRemark = x.TotalOutWorkHoursRemark,
WorkHoursLossRate = x.WorkHoursLossRate,
WorkHoursLossRateRemark = x.WorkHoursLossRateRemark,
WorkHoursAccuracy = x.WorkHoursAccuracy,
WorkHoursAccuracyRemark = x.WorkHoursAccuracyRemark,
MainBusinessIncome = x.MainBusinessIncome,
MainBusinessIncomeRemark = x.MainBusinessIncomeRemark,
FillingDate = x.FillingDate,
ConstructionRevenue = x.ConstructionRevenue,
ConstructionRevenueRemark = x.ConstructionRevenueRemark,
UnitTimeIncome = x.UnitTimeIncome,
UnitTimeIncomeRemark = x.UnitTimeIncomeRemark,
BillionsOutputMortality = x.BillionsOutputMortality,
BillionsOutputMortalityRemark = x.BillionsOutputMortalityRemark,
MajorFireAccident = x.MajorFireAccident,
MajorFireAccidentRemark = x.MajorFireAccidentRemark,
MajorEquipAccident = x.MajorEquipAccident,
MajorEquipAccidentRemark = x.MajorEquipAccidentRemark,
AccidentFrequency = x.AccidentFrequency,
AccidentFrequencyRemark = x.AccidentFrequencyRemark,
SeriousInjuryAccident = x.SeriousInjuryAccident,
SeriousInjuryAccidentRemark = x.SeriousInjuryAccidentRemark,
FireAccident = x.FireAccident,
FireAccidentRemark = x.FireAccidentRemark,
EquipmentAccident = x.EquipmentAccident,
EquipmentAccidentRemark = x.EquipmentAccidentRemark,
PoisoningAndInjuries = x.PoisoningAndInjuries,
PoisoningAndInjuriesRemark = x.PoisoningAndInjuriesRemark,
ProductionSafetyInTotal = x.ProductionSafetyInTotal,
ProductionSafetyInTotalRemark = x.ProductionSafetyInTotalRemark,
ProtectionInput = x.ProtectionInput,
ProtectionInputRemark = x.ProtectionInputRemark,
LaboAndHealthIn = x.LaboAndHealthIn,
LaborAndHealthInRemark = x.LaborAndHealthInRemark,
TechnologyProgressIn = x.TechnologyProgressIn,
TechnologyProgressInRemark = x.TechnologyProgressInRemark,
EducationTrainIn = x.EducationTrainIn,
EducationTrainInRemark = x.EducationTrainInRemark,
ProjectCostRate = x.ProjectCostRate,
ProjectCostRateRemark = x.ProjectCostRateRemark,
ProductionInput = x.ProductionInput,
ProductionInputRemark = x.ProductionInputRemark,
Revenue = x.Revenue,
RevenueRemark = x.RevenueRemark,
FullTimeMan = x.FullTimeMan,
FullTimeManRemark = x.FullTimeManRemark,
FullTimeManAttachUrl = x.FullTimeManAttachUrl,
PMMan = x.PMMan,
PMManRemark = x.PMManRemark,
PMManAttachUrl = x.PMManAttachUrl,
CorporateDirectorEdu = x.CorporateDirectorEdu,
CorporateDirectorEduRemark = x.CorporateDirectorEduRemark,
ProjectLeaderEdu = x.ProjectLeaderEdu,
ProjectLeaderEduRemark = x.ProjectLeaderEduRemark,
FullTimeEdu = x.FullTimeEdu,
FullTimeEduRemark = x.FullTimeEduRemark,
ThreeKidsEduRate = x.ThreeKidsEduRate,
ThreeKidsEduRateRemark = x.ThreeKidsEduRateRemark,
UplinReportRate = x.UplinReportRate,
UplinReportRateRemark = x.UplinReportRateRemark,
Remarks = x.Remarks,
CompileMan = x.CompileMan,
////附件转为字节传送
FullTimeManAttachUrlFileContext = BLL.FileStructService.GetFileStructByAttachUrl(x.FullTimeManAttachUrl),
PMManAttachUrlFileContext = BLL.FileStructService.GetFileStructByAttachUrl(x.PMManAttachUrl),
KeyEquipmentTotal = x.KeyEquipmentTotal,
KeyEquipmentTotalRemark = x.KeyEquipmentTotalRemark,
KeyEquipmentReportCount = x.KeyEquipmentReportCount,
KeyEquipmentReportCountRemark = x.KeyEquipmentReportCountRemark,
ChemicalAreaProjectCount = x.ChemicalAreaProjectCount,
ChemicalAreaProjectCountRemark = x.ChemicalAreaProjectCountRemark,
HarmfulMediumCoverCount = x.HarmfulMediumCoverCount,
HarmfulMediumCoverCountRemark = x.HarmfulMediumCoverCountRemark,
HarmfulMediumCoverRate = x.HarmfulMediumCoverRate,
HarmfulMediumCoverRateRemark = x.HarmfulMediumCoverRateRemark
};
//老接口Serveice
// var getR = hsseC.DataInsertInformation_SafetyQuarterlyReportTable(upReport.ToList());
//新接口Api
code = UpApiSaveSafetyQuarterlyReport(upReport).ToString();
if (code == "1")
{
foreach (var item in upReport.Select(p => p.SafetyQuarterlyReportId))
{
var report = db.Information_SafetyQuarterlyReport.FirstOrDefault(e => e.SafetyQuarterlyReportId == item);
if (report != null)
{
report.UpState = BLL.Const.UpState_3;
db.SubmitChanges();
////更新 当前人要处理的意见
ProjectDataFlowSetService.CloseFlowOperate(Const.MillionsMonthlyReportMenuId, item, string.Empty);
////更新催报信息
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_3, report.YearId.ToString(), report.Quarters.ToString());
}
};
LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传到服务器" + upReport.Count().ToString() + "条数据;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
else
{
LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog("【安全生产数据季报上报】上传到服务器", ex);
LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
return code;
}
}
/// <summary>
/// DrillConductedQuarterlyReportApi调用
/// </summary>
/// <param name="upReport">主表</param>
/// <param name="upReportItem">明细表</param>
/// <returns></returns>
private static int UpApiSaveSafetyQuarterlyReport(IQueryable<Model.HSSE.Information_SafetyQuarterlyReport> upReport)
{
string baseurl = "/api/InformationData/SaveSafetyQuarterlyReport";
var resultJson = JsonConvert.SerializeObject(new { InformationDataItems = upReport });
var responeData = BLL.ServerService.PushCNCEC(resultJson, baseurl);
return responeData.code;
}
#endregion
#region
/// <summary>
/// 应急演练开展情况季报表上报
/// </summary>
public static string UpDrillConductedQuarterlyReport(string drillConductedQuarterlyReportId, Model.Sys_User CurrUser)
{
string code = "0";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
//CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
var upReport = from x in db.Information_DrillConductedQuarterlyReport
where x.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId
select new Model.HSSE.Information_DrillConductedQuarterlyReport
{
DrillConductedQuarterlyReportId = x.DrillConductedQuarterlyReportId,
UnitId = x.UnitId,
ReportDate = x.ReportDate,
Quarter = x.Quarter,
YearId = x.YearId,
CompileMan = x.CompileMan,
};
var upReportItem = from x in db.Information_DrillConductedQuarterlyReportItem
where x.DrillConductedQuarterlyReportId == drillConductedQuarterlyReportId
select new Model.HSSE.Information_DrillConductedQuarterlyReportItem
{
DrillConductedQuarterlyReportItemId = x.DrillConductedQuarterlyReportItemId,
DrillConductedQuarterlyReportId = x.DrillConductedQuarterlyReportId,
IndustryType = x.IndustryType,
TotalConductCount = x.TotalConductCount,
TotalPeopleCount = x.TotalPeopleCount,
TotalInvestment = x.TotalInvestment,
HQConductCount = x.HQConductCount,
HQPeopleCount = x.HQPeopleCount,
HQInvestment = x.HQInvestment,
BasicConductCount = x.BasicConductCount,
BasicPeopleCount = x.BasicPeopleCount,
BasicInvestment = x.BasicInvestment,
ComprehensivePractice = x.ComprehensivePractice,
CPScene = x.CPScene,
CPDesktop = x.CPDesktop,
SpecialDrill = x.SpecialDrill,
SDScene = x.SDScene,
SDDesktop = x.SDDesktop,
SortIndex = x.SortIndex,
};
//老接口Serveice
//var getR = hsseC.DataInsertInformation_DrillConductedQuarterlyReportTable(upReport.ToList(), upReportItem.ToList());
//新接口Api
code = UpApiSaveDrillConductedQuarterlyReport(upReport, upReportItem).ToString();
if (code == "1")
{
foreach (var item in upReport.Select(p => p.DrillConductedQuarterlyReportId))
{
var report = db.Information_DrillConductedQuarterlyReport.FirstOrDefault(e => e.DrillConductedQuarterlyReportId == item);
if (report != null)
{
report.UpState = BLL.Const.UpState_3;
db.SubmitChanges();
////更新 当前人要处理的意见
ProjectDataFlowSetService.CloseFlowOperate(Const.MillionsMonthlyReportMenuId, item, string.Empty);
////更新催报信息
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_4, report.YearId.ToString(), report.Quarter.ToString());
}
}
LogService.AddSys_Log(CurrUser, "【应急演练开展情况季报表上报】上传到服务器" + upReport.Count().ToString() + "条数据;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
else
{
LogService.AddSys_Log(CurrUser, "【应急演练开展情况季报表上报】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog("【应急演练开展情况季报表上报】上传到服务器", ex);
LogService.AddSys_Log(CurrUser, "【应急演练开展情况季报表上报】上传到服务器失败;", null, BLL.Const.MillionsMonthlyReportMenuId, BLL.Const.BtnUploadResources);
}
return code;
}
}
/// <summary>
/// DrillConductedQuarterlyReportApi调用
/// </summary>
/// <param name="upReport">主表</param>
/// <param name="upReportItem">明细表</param>
/// <returns></returns>
private static int UpApiSaveDrillConductedQuarterlyReport(IQueryable<Model.HSSE.Information_DrillConductedQuarterlyReport> upReport, IQueryable<Model.HSSE.Information_DrillConductedQuarterlyReportItem> upReportItem)
{
string baseurl = "/api/InformationData/SaveDrillConductedQuarterlyReport";
//合并
//var resultJson = JsonConvert.SerializeObject(new { upReport, ReportItem = upReportItem });
var resultJson = JsonConvert.SerializeObject(upReport.FirstOrDefault());
var resultJson1 = JsonConvert.SerializeObject(new { drillConductedQuarterlyReportItem = upReportItem });
resultJson = "{\"InformationDataItems\":[" + (resultJson + resultJson1).Replace("}{", ",") + "]}";
var responeData = BLL.ServerService.PushCNCEC(resultJson, baseurl);
return responeData.code;
}
#endregion
#region
/// <summary>
/// 应急演练工作计划半年报表
/// </summary>
public static string UpDrillPlanHalfYearReport(string drillPlanHalfYearReportId, Model.Sys_User CurrUser)
{
string code = "0";
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
try
{
///CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
var upReport = from x in db.Information_DrillPlanHalfYearReport
where x.DrillPlanHalfYearReportId == drillPlanHalfYearReportId
select new Model.HSSE.Information_DrillPlanHalfYearReport
{
DrillPlanHalfYearReportId = x.DrillPlanHalfYearReportId,
UnitId = x.UnitId,
CompileMan = x.CompileMan,
CompileDate = x.CompileDate,
YearId = x.YearId,
HalfYearId = x.HalfYearId,
Telephone = x.Telephone,
};
var upReportItem = from x in db.Information_DrillPlanHalfYearReportItem
where x.DrillPlanHalfYearReportId == drillPlanHalfYearReportId
select new Model.HSSE.Information_DrillPlanHalfYearReportItem
{
DrillPlanHalfYearReportItemId = x.DrillPlanHalfYearReportItemId,
DrillPlanHalfYearReportId = x.DrillPlanHalfYearReportId,
DrillPlanName = x.DrillPlanName,
OrganizationUnit = x.OrganizationUnit,
DrillPlanDate = x.DrillPlanDate,
AccidentScene = x.AccidentScene,
ExerciseWay = x.ExerciseWay,
SortIndex = x.SortIndex,
};
//老接口Serveice
// var getR = hsseC.DataInsertInformation_DrillPlanHalfYearReportTable(upReport.ToList(), upReportItem.ToList());
//新接口Api
code = UpApiDrillPlanHalfYearReport(upReport, upReportItem).ToString();
if (code == "1")
{
foreach (var item in upReport.Select(p => p.DrillPlanHalfYearReportId))
{
var report = db.Information_DrillPlanHalfYearReport.FirstOrDefault(e => e.DrillPlanHalfYearReportId == item);
if (report != null)
{
report.UpState = BLL.Const.UpState_3;
db.SubmitChanges();
////更新 当前人要处理的意见
ProjectDataFlowSetService.CloseFlowOperate(Const.DrillPlanHalfYearReportMenuId, item, string.Empty);
////更新催报信息
UrgeReportService.SetComplete(report.UnitId, Const.ReportType_5, report.YearId.ToString(), report.HalfYearId.ToString());
}
}
LogService.AddSys_Log(CurrUser, "【应急演练工作计划半年报表】上传到服务器" + upReport.Count().ToString() + "条数据;", null, BLL.Const.DrillPlanHalfYearReportMenuId, BLL.Const.BtnUploadResources);
}
else
{
LogService.AddSys_Log(CurrUser, "【应急演练工作计划半年报表】上传到服务器失败;", null, BLL.Const.DrillPlanHalfYearReportMenuId, BLL.Const.BtnUploadResources);
}
}
catch (Exception ex)
{
ErrLogInfo.WriteLog("【应急演练工作计划半年报表】上传到服务器", ex);
LogService.AddSys_Log(CurrUser, "【应急演练工作计划半年报表】上传到服务器失败;", null, BLL.Const.DrillPlanHalfYearReportMenuId, BLL.Const.BtnUploadResources);
}
return code;
}
}
/// <summary>
/// DrillPlanHalfYearReportApi调用
/// </summary>
/// <param name="upReport">主表</param>
/// <param name="upReportItem">明细表</param>
/// <returns></returns>
private static int UpApiDrillPlanHalfYearReport(IQueryable<Model.HSSE.Information_DrillPlanHalfYearReport> upReport, IQueryable<Model.HSSE.Information_DrillPlanHalfYearReportItem> upReportItem)
{
string baseurl = "/api/InformationData/SaveDrillPlanHalfYearReport";
//合并
//var resultJson = JsonConvert.SerializeObject(new { upReport, ReportItem = upReportItem });
var resultJson = JsonConvert.SerializeObject(upReport.FirstOrDefault());
var resultJson1 = JsonConvert.SerializeObject(new { drillPlanHalfYearReportItem = upReportItem });
resultJson = "{\"InformationDataItems\":[" + (resultJson + resultJson1).Replace("}{", ",") + "]}";
var responeData = BLL.ServerService.PushCNCEC(resultJson, baseurl);
return responeData.code;
}
#endregion
#endregion
}
}
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public static class UrgeReportService
{
/// <summary>
/// 更新催报完成
/// </summary>
/// <param name="unitId"></param>
/// <param name="reportType"></param>
/// <param name="Year"></param>
/// <param name="Month"></param>
public static void SetComplete(string unitId, string reportType, string year, string value)
{
Model.Information_UrgeReport urgeReport = new Model.Information_UrgeReport();
if (reportType == Const.ReportType_1 || reportType == Const.ReportType_2)
{
urgeReport = Funs.DB.Information_UrgeReport.FirstOrDefault(x => x.UnitId == unitId && x.ReprotType == reportType && x.YearId == year && x.MonthId == value);
}
else if (reportType == Const.ReportType_3 || reportType == Const.ReportType_4)
{
urgeReport = Funs.DB.Information_UrgeReport.FirstOrDefault(x => x.UnitId == unitId && x.ReprotType == reportType && x.YearId == year && x.QuarterId == value);
}
else if (reportType == Const.ReportType_5)
{
urgeReport = Funs.DB.Information_UrgeReport.FirstOrDefault(x => x.UnitId == unitId && x.ReprotType == reportType && x.YearId == year && x.HalfYearId == value);
}
if (urgeReport != null)
{
urgeReport.IsComplete = true;
Funs.DB.SubmitChanges();
}
}
}
}