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 百万工时上报 /// /// 百万工时上报 /// 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; } } /// /// UpApiMillionsMonthlyReportApi调用 /// /// 主表 /// 明细表 /// private static int UpApiMillionsMonthlyReport(IQueryable upReport, IQueryable 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 职工伤亡事故原因分析报表上报 /// /// 职工伤亡事故原因分析报表上报 /// 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; } } /// /// AccidentCauseReportApi调用 /// /// 主表 /// 明细表 /// private static int UpApiAccidentCauseReport(IQueryable upReport, IQueryable 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 安全生产数据季报上报 /// /// 安全生产数据季报上报 /// 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; } } /// /// DrillConductedQuarterlyReportApi调用 /// /// 主表 /// 明细表 /// private static int UpApiSaveSafetyQuarterlyReport(IQueryable 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 应急演练开展情况季报表上报 /// /// 应急演练开展情况季报表上报 /// 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; } } /// /// DrillConductedQuarterlyReportApi调用 /// /// 主表 /// 明细表 /// private static int UpApiSaveDrillConductedQuarterlyReport(IQueryable upReport, IQueryable 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 应急演练工作计划半年报表 /// /// 应急演练工作计划半年报表 /// 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; } } /// /// DrillPlanHalfYearReportApi调用 /// /// 主表 /// 明细表 /// private static int UpApiDrillPlanHalfYearReport(IQueryable upReport, IQueryable 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 } }