2143 lines
		
	
	
		
			120 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			2143 lines
		
	
	
		
			120 KiB
		
	
	
	
		
			C#
		
	
	
	
namespace BLL
 | 
						||
{
 | 
						||
    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 CNCECHSSEService.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 CNCECHSSEService.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,
 | 
						||
                                       };
 | 
						||
                    
 | 
						||
                    var getR = hsseC.DataInsertInformation_MillionsMonthlyReportTable(upReport.ToList(), upReportItem.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        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());               
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【百万工时安全统计月报表】上传到服务器" + getR.Count.ToString() + "条数据;", 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;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #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 CNCECHSSEService.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 CNCECHSSEService.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,
 | 
						||
                                       };
 | 
						||
 | 
						||
                    var getR = hsseC.DataInsertInformation_AccidentCauseReportTable(upReport.ToList(), upReportItem.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        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());                            
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【职工伤亡事故原因分析报表】上传到服务器" + getR.Count.ToString() + "条数据;", 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;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #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 CNCECHSSEService.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,
 | 
						||
                                       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 = FileStructService.GetFileStructByAttachUrl(x.FullTimeManAttachUrl),
 | 
						||
                                       PMManAttachUrlFileContext = 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
 | 
						||
                                   };
 | 
						||
 | 
						||
                    var getR = hsseC.DataInsertInformation_SafetyQuarterlyReportTable(upReport.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        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());
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【安全生产数据季报上报】上传到服务器" + getR.Count.ToString() + "条数据;", 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;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #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 CNCECHSSEService.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 CNCECHSSEService.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,
 | 
						||
                                       };
 | 
						||
 | 
						||
                    var getR = hsseC.DataInsertInformation_DrillConductedQuarterlyReportTable(upReport.ToList(), upReportItem.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        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());                            
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【应急演练开展情况季报表上报】上传到服务器" + getR.Count.ToString() + "条数据;", 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;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #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 CNCECHSSEService.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 CNCECHSSEService.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,
 | 
						||
                                       };
 | 
						||
 | 
						||
                    var getR = hsseC.DataInsertInformation_DrillPlanHalfYearReportTable(upReport.ToList(), upReportItem.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        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());
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【应急演练工作计划半年报表】上传到服务器" + getR.Count.ToString() + "条数据;", 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;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 企业监督检查报告上报
 | 
						||
        /// <summary>
 | 
						||
        /// 企业监督检查报告上报
 | 
						||
        /// </summary>
 | 
						||
        public static string UpCheckReport(string upCheckReportId, Model.Sys_User CurrUser)
 | 
						||
        {
 | 
						||
            string code = "0";
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var upCheckReport = from x in db.Supervise_UpCheckReport
 | 
						||
                                   where x.UpCheckReportId == upCheckReportId
 | 
						||
                                   select new CNCECHSSEService.Supervise_UpCheckReport
 | 
						||
                                   {
 | 
						||
                                       UpCheckReportId = x.UpCheckReportId,
 | 
						||
                                       UnitId = x.UnitId,
 | 
						||
                                       CheckStartTime = x.CheckStartTime,
 | 
						||
                                       CheckEndTime = x.CheckEndTime,
 | 
						||
                                       Values1 = x.Values1,
 | 
						||
                                       Values2 = x.Values2,
 | 
						||
                                       Values3 = x.Values3,
 | 
						||
                                       Values4 = x.Values4,
 | 
						||
                                       Values5 = x.Values5,
 | 
						||
                                       Values6 = x.Values6,
 | 
						||
                                       Values7 = x.Values7,
 | 
						||
                                       CompileDate = x.CompileDate,
 | 
						||
                                       AuditDate = x.AuditDate,
 | 
						||
                                   };
 | 
						||
 | 
						||
                    var upCheckReportItem = from x in db.Supervise_UpCheckReportItem
 | 
						||
                                            where x.UpCheckReportId == upCheckReportId
 | 
						||
                                            select new CNCECHSSEService.Supervise_UpCheckReportItem
 | 
						||
                                            {
 | 
						||
                                                UpCheckReportItemId = x.UpCheckReportItemId,
 | 
						||
                                                UpCheckReportId = x.UpCheckReportId,
 | 
						||
                                                SortIndex = x.SortIndex,
 | 
						||
                                                Name = x.Name,
 | 
						||
                                                Sex = x.Sex,
 | 
						||
                                                UnitName = x.UnitName,
 | 
						||
                                                PostName = x.PostName,
 | 
						||
                                                WorkTitle = x.WorkTitle,
 | 
						||
                                                CheckPostName = x.CheckPostName,
 | 
						||
                                                CheckDate = x.CheckDate,
 | 
						||
                                            };
 | 
						||
                    var upCheckReportItem2 = from x in db.Supervise_UpCheckReportItem2
 | 
						||
                                             where x.UpCheckReportId == upCheckReportId
 | 
						||
                                             select new CNCECHSSEService.Supervise_UpCheckReportItem2
 | 
						||
                                             {
 | 
						||
                                                 UpCheckReportItem2Id = x.UpCheckReportItem2Id,
 | 
						||
                                                 UpCheckReportId = x.UpCheckReportId,
 | 
						||
                                                 SortIndex = x.SortIndex,
 | 
						||
                                                 SubjectObject = x.SubjectObject,
 | 
						||
                                                 SubjectObjectInfo = x.SubjectObjectInfo,
 | 
						||
                                                 UnitMan = x.UnitMan,
 | 
						||
                                                 UnitManTel = x.UnitManTel,
 | 
						||
                                                 UnitHSSEMan = x.UnitHSSEMan,
 | 
						||
                                                 UnitHSSEManTel = x.UnitHSSEManTel,
 | 
						||
                                                 CheckDate = x.CheckDate,
 | 
						||
                                                 RectifyCount = x.RectifyCount,
 | 
						||
                                                 CompRectifyCount = x.CompRectifyCount,
 | 
						||
                                                 TotalGetScore = x.TotalGetScore,
 | 
						||
                                                 ResultLevel = x.ResultLevel,
 | 
						||
                                             };
 | 
						||
 | 
						||
                    var getR = hsseC.DataInsertSupervise_UpCheckReportTable(upCheckReport.ToList(), upCheckReportItem.ToList(), upCheckReportItem2.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        var report = db.Supervise_UpCheckReport.FirstOrDefault(e => e.UpCheckReportId == item);
 | 
						||
                        if (report != null)
 | 
						||
                        {
 | 
						||
                            report.UpState = BLL.Const.UpState_3;
 | 
						||
                            report.UpDateTime = System.DateTime.Now;
 | 
						||
                            db.SubmitChanges();
 | 
						||
                            ////更新 当前人要处理的意见
 | 
						||
                            ProjectDataFlowSetService.CloseFlowOperate(Const.DrillPlanHalfYearReportMenuId, item, string.Empty);                           
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【安全监督检查评价报告】上传到服务器" + getR.Count.ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources);
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    ErrLogInfo.WriteLog("【安全监督检查评价报告】上传到服务器", ex);
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【安全监督检查评价报告】上传到服务器失败;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources);
 | 
						||
                }
 | 
						||
                return code;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全监督检查整改上报
 | 
						||
        /// <summary>
 | 
						||
        /// 企业监督检查报告上报
 | 
						||
        /// </summary>
 | 
						||
        public static string UpCheck_CheckRectify(string checkRectifyId, Model.Sys_User CurrUser)
 | 
						||
        {
 | 
						||
            string code = "0";
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var upCheckReport = from x in Funs.DB.View_CheckRectifyListFromSUB
 | 
						||
                                        where x.RealEndDate.HasValue && x.CheckRectifyId == checkRectifyId
 | 
						||
                                        select new CNCECHSSEService.Check_CheckRectify
 | 
						||
                                        {
 | 
						||
                                            CheckRectifyId = x.CheckRectifyId,
 | 
						||
                                            CheckRectifyCode = x.CheckRectifyCode,
 | 
						||
                                            ProjectId = x.ProjectId,
 | 
						||
                                            UnitId = x.UnitId,
 | 
						||
                                            CheckDate = x.CheckDate,
 | 
						||
                                            IssueMan = x.IssueMan,
 | 
						||
                                            IssueDate = x.IssueDate,
 | 
						||
                                            HandleState = x.HandleState,
 | 
						||
                                            CheckRectifyItemId = x.CheckRectifyItemId,
 | 
						||
                                            ConfirmMan = x.ConfirmMan,
 | 
						||
                                            ConfirmDate = x.ConfirmDate,
 | 
						||
                                            OrderEndDate = x.OrderEndDate,
 | 
						||
                                            OrderEndPerson = x.OrderEndPerson,
 | 
						||
                                            RealEndDate = x.RealEndDate,
 | 
						||
                                            Verification = x.Verification,
 | 
						||
                                            AttachFileId = x.AttachFileId2,
 | 
						||
                                            ToKeyId = x.ToKeyId2,
 | 
						||
                                            AttachSource = x.AttachSource2,
 | 
						||
                                            AttachUrl = x.AttachUrl2,
 | 
						||
                                            ////附件转为字节传送
 | 
						||
                                            FileContext = FileStructService.GetMoreFileStructByAttachUrl(x.AttachUrl2),
 | 
						||
                                        };
 | 
						||
 | 
						||
                    var getR = hsseC.DataInsertCheck_CheckRectifyTable(upCheckReport.ToList());
 | 
						||
                    foreach (var item in getR)
 | 
						||
                    {
 | 
						||
                        var newCheckRectify = db.Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == item);
 | 
						||
                        if (newCheckRectify != null)
 | 
						||
                        {
 | 
						||
                            newCheckRectify.HandleState = BLL.Const.State_3;    //已完成                              
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【集团检查整改】上传到服务器" + getR.Count.ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources);
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    ErrLogInfo.WriteLog("【集团检查整改】上传到服务器", ex);
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【集团检查整改】上传到服务器失败;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources);
 | 
						||
                }
 | 
						||
                return code;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 企业安全文件上报
 | 
						||
        /// <summary>
 | 
						||
        /// 企业安全文件上报
 | 
						||
        /// </summary>
 | 
						||
        public static string UpSupervise_SubUnitReportItem(string subUnitReportId, Model.Sys_User CurrUser)
 | 
						||
        {
 | 
						||
            string code = "0";
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var upCheckReport = from x in db.View_Supervise_SubUnitReportItem
 | 
						||
                                        where x.SubUnitReportId == subUnitReportId && (x.UpState == BLL.Const.UpState_2 || x.UpState == BLL.Const.UpState_4 || x.UpState == null)
 | 
						||
                                        select new CNCECHSSEService.Supervise_SubUnitReportItem
 | 
						||
                                        {
 | 
						||
                                            SubUnitReportItemId = x.SubUnitReportItemId,
 | 
						||
                                            ReportTitle = x.ReportTitle,
 | 
						||
                                            ReportContent = x.ReportContent,
 | 
						||
                                            // AttachUrl = x.AttachUrl,
 | 
						||
                                            ReportDate = x.ReportDate,
 | 
						||
                                            State = x.State,
 | 
						||
                                            ////附件转为字节传送
 | 
						||
                                            //FileContext = FileStructService.GetFileStructByAttachUrl(x.AttachUrl)
 | 
						||
                                            AttachFileId = x.AttachFileId,
 | 
						||
                                            ToKeyId = x.ToKeyId,
 | 
						||
                                            AttachSource = x.AttachSource,
 | 
						||
                                            AttachUrl = x.AttachUrl,
 | 
						||
                                            ////附件转为字节传送
 | 
						||
                                            FileContext = FileStructService.GetMoreFileStructByAttachUrl(x.AttachUrl),
 | 
						||
                                        };
 | 
						||
                    if (upCheckReport.Count() > 0)
 | 
						||
                    {
 | 
						||
                        var getR = hsseC.DataInsertSupervise_SubUnitReportItemItemTable(upCheckReport.ToList());
 | 
						||
                        foreach (var item in getR)
 | 
						||
                        {
 | 
						||
                            var subUnitReportItem = db.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportItemId == item);
 | 
						||
                            if (subUnitReportItem != null)
 | 
						||
                            {
 | 
						||
                                subUnitReportItem.UpState = BLL.Const.UpState_3;
 | 
						||
                                subUnitReportItem.State = BLL.Const.UpState_3;
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    code = "1";
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【企业安全文件上报】上传到服务器" + upCheckReport.Count().ToString() + "条数据;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources);
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    ErrLogInfo.WriteLog("【企业安全文件上报】上传到服务器", ex);
 | 
						||
                    LogService.AddSys_Log(CurrUser, "【企业安全文件上报】上传到服务器失败;", null, BLL.Const.UpCheckReportMenuId, BLL.Const.BtnUploadResources);
 | 
						||
                }
 | 
						||
                return code;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 从集团获取数据
 | 
						||
        #region 催报信息从集团公司提取到企业
 | 
						||
        /// <summary>
 | 
						||
        /// 催报信息从集团公司提取到企业
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getInformation_UrgeReport()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {                  
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetInformation_UrgeReportToSUB(Const.UnitId_CWCEC);
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var urg = db.Information_UrgeReport.FirstOrDefault(x => x.UrgeReportId == item.UrgeReportId);
 | 
						||
                            if (urg == null)
 | 
						||
                            {
 | 
						||
                                Model.Information_UrgeReport newUrgeReport = new Model.Information_UrgeReport
 | 
						||
                                {
 | 
						||
                                    UrgeReportId = item.UrgeReportId,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    ReprotType = item.ReprotType,
 | 
						||
                                    YearId = item.YearId,
 | 
						||
                                    MonthId = item.MonthId,
 | 
						||
                                    QuarterId = item.QuarterId,
 | 
						||
                                    HalfYearId = item.HalfYearId,
 | 
						||
                                    UrgeDate = item.UrgeDate,
 | 
						||
                                    IsComplete = null,
 | 
						||
                                    IsCancel = item.IsCancel
 | 
						||
                                };
 | 
						||
                                db.Information_UrgeReport.InsertOnSubmit(newUrgeReport);
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                            else
 | 
						||
                            {
 | 
						||
                                urg.IsCancel = item.IsCancel;
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    responeData.message = "获取成功:记录" + getData.Count().ToString() + "条";
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("催报信息从集团公司提取到企业!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }          
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全监督检查整改信息从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 安全监督检查整改信息从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getCheck_CheckRectify()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetCheck_CheckRectifyListToSUB(Const.UnitId_CWCEC);
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<string> ids = new List<string>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            if (!ids.Contains(item.CheckRectifyId))
 | 
						||
                            {
 | 
						||
                                var newRectify = db.Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == item.CheckRectifyId);
 | 
						||
                                if (newRectify == null)
 | 
						||
                                {
 | 
						||
                                    ids.Add(item.CheckRectifyId);
 | 
						||
                                    Model.Check_CheckRectify newCheckRectify = new Model.Check_CheckRectify
 | 
						||
                                    {
 | 
						||
                                        CheckRectifyId = item.CheckRectifyId,
 | 
						||
                                        CheckRectifyCode = item.CheckRectifyCode,
 | 
						||
                                        ProjectId = item.ProjectId,
 | 
						||
                                        UnitId = item.UnitId,
 | 
						||
                                        CheckDate = item.CheckDate,
 | 
						||
                                        IssueMan = item.IssueMan,
 | 
						||
                                        IssueDate = item.IssueDate,
 | 
						||
                                        HandleState = item.HandleState
 | 
						||
                                    };
 | 
						||
                                    db.Check_CheckRectify.InsertOnSubmit(newCheckRectify);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
 | 
						||
                                    //获取对应主表主键的明细集合
 | 
						||
                                    var table5Items = getData.Where(x => x.CheckRectifyId == item.CheckRectifyId);
 | 
						||
                                    foreach (var newItem in table5Items)
 | 
						||
                                    {
 | 
						||
                                        var oldItem5 = db.Check_CheckInfo_Table5Item.FirstOrDefault(x => x.ID == newItem.Table5ItemId);
 | 
						||
                                        if (oldItem5 == null)
 | 
						||
                                        {
 | 
						||
                                            Model.Check_CheckInfo_Table5Item newCheckRectifyItem = new Model.Check_CheckInfo_Table5Item
 | 
						||
                                            {
 | 
						||
                                                ID = newItem.Table5ItemId,
 | 
						||
                                                SortIndex = newItem.SortIndex,
 | 
						||
                                                WorkType = newItem.WorkType,
 | 
						||
                                                DangerPoint = newItem.DangerPoint,
 | 
						||
                                                RiskExists = newItem.RiskExists,
 | 
						||
                                                IsProject = newItem.IsProject,
 | 
						||
                                                CheckMan = newItem.CheckMan,
 | 
						||
                                                SubjectUnitMan = newItem.SubjectUnitMan
 | 
						||
                                            };
 | 
						||
                                            db.Check_CheckInfo_Table5Item.InsertOnSubmit(newCheckRectifyItem);
 | 
						||
                                            db.SubmitChanges();
 | 
						||
 | 
						||
                                            ////上传附件
 | 
						||
                                            if (!string.IsNullOrEmpty(newItem.AttachFileId))
 | 
						||
                                            {
 | 
						||
                                                BLL.FileInsertService.InsertAttachFile(newItem.AttachFileId, newItem.Table5ItemId, newItem.AttachSource, newItem.AttachUrl, newItem.FileContext);
 | 
						||
                                            }
 | 
						||
                                        }
 | 
						||
 | 
						||
                                        var oldItem = db.Check_CheckRectifyItem.FirstOrDefault(e => e.CheckRectifyItemId == newItem.CheckRectifyItemId);
 | 
						||
                                        if (oldItem == null)
 | 
						||
                                        {
 | 
						||
                                            Model.Check_CheckRectifyItem newCheckRectifyItem = new Model.Check_CheckRectifyItem
 | 
						||
                                            {
 | 
						||
                                                CheckRectifyItemId = newItem.CheckRectifyItemId,
 | 
						||
                                                CheckRectifyId = newItem.CheckRectifyId,
 | 
						||
                                                Table5ItemId = newItem.Table5ItemId,
 | 
						||
                                                ConfirmMan = newItem.ConfirmMan,
 | 
						||
                                                ConfirmDate = newItem.ConfirmDate,
 | 
						||
                                                OrderEndDate = newItem.OrderEndDate,
 | 
						||
                                                OrderEndPerson = newItem.OrderEndPerson,
 | 
						||
                                                RealEndDate = newItem.RealEndDate
 | 
						||
                                            };
 | 
						||
 | 
						||
                                            db.Check_CheckRectifyItem.InsertOnSubmit(newCheckRectifyItem);
 | 
						||
                                            db.SubmitChanges();
 | 
						||
                                        }
 | 
						||
                                    }
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    responeData.message = "获取成功:整改明细记录" + getData.Count().ToString() + "条";
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("安全监督检查整改信息从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全监督检查报告信息从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 安全监督检查报告信息从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getCheck_CheckInfo_Table8Item()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetCheck_CheckInfo_Table8ItemListToSUB(Const.UnitId_CWCEC);
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<string> ids = new List<string>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            if (!ids.Contains(item.CheckInfoId))
 | 
						||
                            {
 | 
						||
                                var updateCheckInfo = db.Check_CheckInfo.FirstOrDefault(x => x.CheckInfoId == item.CheckInfoId);
 | 
						||
                                if (updateCheckInfo == null)
 | 
						||
                                {
 | 
						||
                                    ids.Add(item.CheckInfoId);
 | 
						||
                                    Model.Check_CheckInfo newCheckInfo = new Model.Check_CheckInfo
 | 
						||
                                    {
 | 
						||
                                        CheckInfoId = item.CheckInfoId,
 | 
						||
                                        CheckTypeName = item.CheckTypeName,
 | 
						||
                                        SubjectUnitId = item.SubjectUnitId,
 | 
						||
                                        SubjectUnitAdd = item.SubjectUnitAdd,
 | 
						||
                                        SubjectUnitMan = item.SubjectUnitMan,
 | 
						||
                                        SubjectUnitTel = item.SubjectUnitTel,
 | 
						||
                                        CheckStartTime = item.CheckStartTime,
 | 
						||
                                        CheckEndTime = item.CheckEndTime,
 | 
						||
                                        SubjectObject = item.SubjectObject
 | 
						||
                                    };
 | 
						||
                                    db.Check_CheckInfo.InsertOnSubmit(newCheckInfo);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
                                else
 | 
						||
                                {
 | 
						||
                                    updateCheckInfo.CheckInfoId = item.CheckInfoId;
 | 
						||
                                    updateCheckInfo.CheckTypeName = item.CheckTypeName;
 | 
						||
                                    updateCheckInfo.SubjectUnitId = item.SubjectUnitId;
 | 
						||
                                    updateCheckInfo.SubjectUnitAdd = item.SubjectUnitAdd;
 | 
						||
                                    updateCheckInfo.SubjectUnitMan = item.SubjectUnitMan;
 | 
						||
                                    updateCheckInfo.SubjectUnitTel = item.SubjectUnitTel;
 | 
						||
                                    updateCheckInfo.CheckStartTime = item.CheckStartTime;
 | 
						||
                                    updateCheckInfo.CheckEndTime = item.CheckEndTime;
 | 
						||
                                    updateCheckInfo.SubjectObject = item.SubjectObject;
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
 | 
						||
                            var updateTable8 = db.Check_CheckInfo_Table8.FirstOrDefault(x => x.CheckItemId == item.CheckItemId);
 | 
						||
                            if (updateTable8 == null)
 | 
						||
                            {
 | 
						||
                                Model.Check_CheckInfo_Table8 newTable8 = new Model.Check_CheckInfo_Table8
 | 
						||
                                {
 | 
						||
                                    CheckItemId = item.CheckItemId,
 | 
						||
                                    CheckInfoId = item.CheckInfoId,
 | 
						||
                                    Values1 = item.Values1,
 | 
						||
                                    Values2 = item.Values2,
 | 
						||
                                    Values3 = item.Values3,
 | 
						||
                                    Values4 = item.Values4,
 | 
						||
                                    Values5 = item.Values5,
 | 
						||
                                    Values6 = item.Values6,
 | 
						||
                                    Values7 = item.Values7,
 | 
						||
                                    Values8 = item.Values8
 | 
						||
                                };
 | 
						||
                                db.Check_CheckInfo_Table8.InsertOnSubmit(newTable8);
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                            else
 | 
						||
                            {
 | 
						||
                                updateTable8.Values1 = item.Values1;
 | 
						||
                                updateTable8.Values2 = item.Values2;
 | 
						||
                                updateTable8.Values3 = item.Values3;
 | 
						||
                                updateTable8.Values4 = item.Values4;
 | 
						||
                                updateTable8.Values5 = item.Values5;
 | 
						||
                                updateTable8.Values6 = item.Values6;
 | 
						||
                                updateTable8.Values7 = item.Values7;
 | 
						||
                                updateTable8.Values8 = item.Values8;
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
 | 
						||
                            var updateTable8Item = db.Check_CheckInfo_Table8Item.FirstOrDefault(x => x.ID == item.ID);
 | 
						||
                            if (updateTable8Item == null)
 | 
						||
                            {
 | 
						||
                                Model.Check_CheckInfo_Table8Item newTable8Item = new Model.Check_CheckInfo_Table8Item
 | 
						||
                                {
 | 
						||
                                    ID = item.ID,
 | 
						||
                                    CheckInfoId = item.CheckInfoId,
 | 
						||
                                    Name = item.Name,
 | 
						||
                                    Sex = item.Sex,
 | 
						||
                                    UnitName = item.UnitName,
 | 
						||
                                    PostName = item.PostName,
 | 
						||
                                    WorkTitle = item.WorkTitle,
 | 
						||
                                    CheckPostName = item.CheckPostName,
 | 
						||
                                    CheckDate = item.CheckDate,
 | 
						||
                                    SortIndex = item.SortIndex
 | 
						||
                                };
 | 
						||
                                db.Check_CheckInfo_Table8Item.InsertOnSubmit(newTable8Item);
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                            else
 | 
						||
                            {
 | 
						||
                                updateTable8Item.ID = item.ID;
 | 
						||
                                updateTable8Item.CheckInfoId = item.CheckInfoId;
 | 
						||
                                updateTable8Item.Name = item.Name;
 | 
						||
                                updateTable8Item.Sex = item.Sex;
 | 
						||
                                updateTable8Item.UnitName = item.UnitName;
 | 
						||
                                updateTable8Item.PostName = item.PostName;
 | 
						||
                                updateTable8Item.WorkTitle = item.WorkTitle;
 | 
						||
                                updateTable8Item.CheckPostName = item.CheckPostName;
 | 
						||
                                updateTable8Item.CheckDate = item.CheckDate;
 | 
						||
                                updateTable8Item.SortIndex = item.SortIndex;
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + getData.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("安全监督检查报告信息从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 企业安全文件从集团获取
 | 
						||
        /// <summary>
 | 
						||
        /// 企业安全文件上报
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getSupervise_SubUnitReport()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetSupervise_SubUnitReportListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var newSubUnitReport = db.Supervise_SubUnitReport.FirstOrDefault(e => e.SubUnitReportId == item.SubUnitReportId);
 | 
						||
                            if (newSubUnitReport == null)
 | 
						||
                            {
 | 
						||
                                Model.Supervise_SubUnitReport newSubUnitReport1 = new Model.Supervise_SubUnitReport
 | 
						||
                                {
 | 
						||
                                    SubUnitReportId = item.SubUnitReportId,
 | 
						||
                                    SubUnitReportCode = item.SubUnitReportCode,
 | 
						||
                                    SubUnitReportName = item.SubUnitReportName,
 | 
						||
                                    SupSubUnitReportId = item.SupSubUnitReportId,
 | 
						||
                                    IsEndLever = item.IsEndLever
 | 
						||
                                };
 | 
						||
 | 
						||
                                db.Supervise_SubUnitReport.InsertOnSubmit(newSubUnitReport1);
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                            else
 | 
						||
                            {
 | 
						||
                                newSubUnitReport.SubUnitReportCode = item.SubUnitReportCode;
 | 
						||
                                newSubUnitReport.SubUnitReportName = item.SubUnitReportName;
 | 
						||
                                newSubUnitReport.SupSubUnitReportId = item.SupSubUnitReportId;
 | 
						||
                                newSubUnitReport.IsEndLever = item.IsEndLever;
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                        }                      
 | 
						||
                    }
 | 
						||
 | 
						||
                    var getDataItem = hsseC.GetSupervise_SubUnitReportItemListToSUB(Const.UnitId_CWCEC);
 | 
						||
                    foreach (var item in getDataItem)
 | 
						||
                    {
 | 
						||
                        var newItem = db.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportItemId == item.SubUnitReportItemId);
 | 
						||
                        if (newItem == null)
 | 
						||
                        {
 | 
						||
                            var newSubUnitReport = db.Supervise_SubUnitReport.FirstOrDefault(e => e.SubUnitReportId == item.SubUnitReportId);
 | 
						||
                            if (newSubUnitReport != null)
 | 
						||
                            {
 | 
						||
                                Model.Supervise_SubUnitReportItem newItem1 = new Model.Supervise_SubUnitReportItem
 | 
						||
                                {
 | 
						||
                                    SubUnitReportItemId = item.SubUnitReportItemId,
 | 
						||
                                    SubUnitReportId = item.SubUnitReportId,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    PlanReortDate = item.PlanReortDate,
 | 
						||
                                    State = item.State
 | 
						||
                                };
 | 
						||
                                db.Supervise_SubUnitReportItem.InsertOnSubmit(newItem1);
 | 
						||
                                db.SubmitChanges();
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        else
 | 
						||
                        {
 | 
						||
                            newItem.SubUnitReportId = item.SubUnitReportId;
 | 
						||
                            newItem.UnitId = item.UnitId;
 | 
						||
                            newItem.PlanReortDate = item.PlanReortDate;
 | 
						||
                            newItem.State = item.State;
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                    }
 | 
						||
                    responeData.message = "获取成功:类型记录" + getData.Count().ToString() + "条;明细记录" + getDataItem.Count().ToString() + "条";
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("企业安全文件上报!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 资源库数据
 | 
						||
        #region 法律法规从集团公司提取到企业
 | 
						||
        /// <summary>
 | 
						||
        /// 法律法规从集团公司提取到企业
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getLaw_LawRegulationList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetLaw_LawRegulationListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Law_LawRegulationList> LawRegulationLists = new List<Model.Law_LawRegulationList>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getLawRegulationList = db.Law_LawRegulationList.FirstOrDefault(x => x.LawRegulationId == item.LawRegulationId);
 | 
						||
                            if (getLawRegulationList == null)
 | 
						||
                            {
 | 
						||
                                var type =db.Base_LawsRegulationsType.FirstOrDefault(e => e.Id == item.LawsRegulationsTypeId);
 | 
						||
                                if (!string.IsNullOrEmpty(item.LawsRegulationsTypeId) && type == null)
 | 
						||
                                {
 | 
						||
                                    Model.Base_LawsRegulationsType new_LawsRegulationsType = new Model.Base_LawsRegulationsType
 | 
						||
                                    {
 | 
						||
                                        Id = item.LawsRegulationsTypeId,
 | 
						||
                                        Code = item.LawsRegulationsTypeCode,
 | 
						||
                                        Name = item.LawsRegulationsTypeName
 | 
						||
                                    };
 | 
						||
                                    db.Base_LawsRegulationsType.InsertOnSubmit(new_LawsRegulationsType);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
 | 
						||
                                Model.Law_LawRegulationList newLawRegulationList = new Model.Law_LawRegulationList
 | 
						||
                                {
 | 
						||
                                    LawRegulationId = item.LawRegulationId,
 | 
						||
                                    LawsRegulationsTypeId = item.LawsRegulationsTypeId,
 | 
						||
                                    ApprovalDate = item.ApprovalDate,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    Description = item.Description,
 | 
						||
                                    EffectiveDate = item.EffectiveDate,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    LawRegulationCode = item.LawRegulationCode,
 | 
						||
                                    LawRegulationName = item.LawRegulationName,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                LawRegulationLists.Add(newLawRegulationList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.LawRegulationId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }                            
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (LawRegulationLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Law_LawRegulationList.InsertAllOnSubmit(LawRegulationLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + LawRegulationLists.Count().ToString() + "条";
 | 
						||
                    }                 
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("法律法规从集团公司提取到企业!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 标准规范从集团公司提取到企业
 | 
						||
        /// <summary>
 | 
						||
        /// 标准规范从集团公司提取到企业
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getLaw_HSSEStandardsList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetLaw_HSSEStandardsListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Law_HSSEStandardsList> HSSEStandardsLists = new List<Model.Law_HSSEStandardsList>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getHSSEStandardsList = db.Law_HSSEStandardsList.FirstOrDefault(x => x.StandardId == item.StandardId);
 | 
						||
                            if (getHSSEStandardsList == null)
 | 
						||
                            {
 | 
						||
                                var type = db.Base_HSSEStandardListType.FirstOrDefault(e => e.TypeId == item.TypeId);
 | 
						||
                                if (!string.IsNullOrEmpty(item.TypeId) && type == null)
 | 
						||
                                {
 | 
						||
                                    Model.Base_HSSEStandardListType new_Type = new Model.Base_HSSEStandardListType
 | 
						||
                                    {
 | 
						||
                                        TypeId = item.TypeId,
 | 
						||
                                        TypeCode = item.TypeCode,
 | 
						||
                                        TypeName = item.TypeName
 | 
						||
                                    };
 | 
						||
                                    db.Base_HSSEStandardListType.InsertOnSubmit(new_Type);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
 | 
						||
                                Model.Law_HSSEStandardsList newHSSEStandardsList = new Model.Law_HSSEStandardsList
 | 
						||
                                {
 | 
						||
                                    StandardId = item.StandardId,
 | 
						||
                                    StandardGrade = item.StandardGrade,
 | 
						||
                                    StandardNo = item.StandardNo,
 | 
						||
                                    StandardName = item.StandardName,
 | 
						||
                                    TypeId = item.TypeId,
 | 
						||
                                    IsSelected1 = item.IsSelected1,
 | 
						||
                                    IsSelected2 = item.IsSelected2,
 | 
						||
                                    IsSelected3 = item.IsSelected3,
 | 
						||
                                    IsSelected4 = item.IsSelected4,
 | 
						||
                                    IsSelected5 = item.IsSelected5,
 | 
						||
                                    IsSelected6 = item.IsSelected6,
 | 
						||
                                    IsSelected7 = item.IsSelected7,
 | 
						||
                                    IsSelected8 = item.IsSelected8,
 | 
						||
                                    IsSelected9 = item.IsSelected9,
 | 
						||
                                    IsSelected10 = item.IsSelected10,
 | 
						||
                                    IsSelected11 = item.IsSelected11,
 | 
						||
                                    IsSelected12 = item.IsSelected12,
 | 
						||
                                    IsSelected13 = item.IsSelected13,
 | 
						||
                                    IsSelected14 = item.IsSelected14,
 | 
						||
                                    IsSelected15 = item.IsSelected15,
 | 
						||
                                    IsSelected16 = item.IsSelected16,
 | 
						||
                                    IsSelected17 = item.IsSelected17,
 | 
						||
                                    IsSelected18 = item.IsSelected18,
 | 
						||
                                    IsSelected19 = item.IsSelected19,
 | 
						||
                                    IsSelected20 = item.IsSelected20,
 | 
						||
                                    IsSelected21 = item.IsSelected21,
 | 
						||
                                    IsSelected22 = item.IsSelected22,
 | 
						||
                                    IsSelected23 = item.IsSelected23,
 | 
						||
                                    IsSelected24 = item.IsSelected24,
 | 
						||
                                    IsSelected25 = item.IsSelected25,
 | 
						||
                                    IsSelected90 = item.IsSelected90,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                HSSEStandardsLists.Add(newHSSEStandardsList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.StandardId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (HSSEStandardsLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Law_HSSEStandardsList.InsertAllOnSubmit(HSSEStandardsLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + HSSEStandardsLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("标准规范从集团公司提取到企业!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全生产规章制度从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 安全生产规章制度从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getLaw_RulesRegulations()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetLaw_RulesRegulationsToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Law_RulesRegulations> RulesRegulationsLists = new List<Model.Law_RulesRegulations>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getRulesRegulationsList = db.Law_RulesRegulations.FirstOrDefault(x => x.RulesRegulationsId == item.RulesRegulationsId);
 | 
						||
                            if (getRulesRegulationsList == null)
 | 
						||
                            {
 | 
						||
                                var type = db.Base_RulesRegulationsType.FirstOrDefault(e => e.RulesRegulationsTypeId == item.RulesRegulationsTypeId);
 | 
						||
                                if (!string.IsNullOrEmpty(item.RulesRegulationsTypeId) && type == null)
 | 
						||
                                {
 | 
						||
                                    Model.Base_RulesRegulationsType new_Type = new Model.Base_RulesRegulationsType
 | 
						||
                                    {
 | 
						||
                                        RulesRegulationsTypeId = item.RulesRegulationsTypeId,
 | 
						||
                                        RulesRegulationsTypeCode = item.RulesRegulationsTypeCode,
 | 
						||
                                        RulesRegulationsTypeName = item.RulesRegulationsTypeName
 | 
						||
                                    };
 | 
						||
                                    db.Base_RulesRegulationsType.InsertOnSubmit(new_Type);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
 | 
						||
                                Model.Law_RulesRegulations newRulesRegulationsList = new Model.Law_RulesRegulations
 | 
						||
                                {
 | 
						||
                                    RulesRegulationsId = item.RulesRegulationsId,
 | 
						||
                                    RulesRegulationsCode = item.RulesRegulationsCode,
 | 
						||
                                    RulesRegulationsName = item.RulesRegulationsName,
 | 
						||
                                    RulesRegulationsTypeId = item.RulesRegulationsTypeId,
 | 
						||
                                    CustomDate = item.CustomDate,
 | 
						||
                                    ApplicableScope = item.ApplicableScope,
 | 
						||
                                    Remark = item.Remark,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                RulesRegulationsLists.Add(newRulesRegulationsList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.RulesRegulationsId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (RulesRegulationsLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Law_RulesRegulations.InsertAllOnSubmit(RulesRegulationsLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + RulesRegulationsLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("安全生产规章制度从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全管理规定从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 安全管理规定从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getLaw_ManageRule()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetLaw_ManageRuleToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Law_ManageRule> ManageRuleLists = new List<Model.Law_ManageRule>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getManageRuleList = db.Law_ManageRule.FirstOrDefault(x => x.ManageRuleId == item.ManageRuleId);
 | 
						||
                            if (getManageRuleList == null)
 | 
						||
                            {
 | 
						||
                                var type = db.Base_ManageRuleType.FirstOrDefault(e => e.ManageRuleTypeId == item.ManageRuleTypeId);
 | 
						||
                                if (!string.IsNullOrEmpty(item.ManageRuleTypeId) && type == null)
 | 
						||
                                {
 | 
						||
                                    Model.Base_ManageRuleType new_Type = new Model.Base_ManageRuleType
 | 
						||
                                    {
 | 
						||
                                        ManageRuleTypeId = item.ManageRuleTypeId,
 | 
						||
                                        ManageRuleTypeCode = item.ManageRuleTypeCode,
 | 
						||
                                        ManageRuleTypeName = item.ManageRuleTypeName
 | 
						||
                                    };
 | 
						||
                                    db.Base_ManageRuleType.InsertOnSubmit(new_Type);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
 | 
						||
                                Model.Law_ManageRule newManageRuleList = new Model.Law_ManageRule
 | 
						||
                                {
 | 
						||
                                    ManageRuleId = item.ManageRuleId,
 | 
						||
                                    ManageRuleCode = item.ManageRuleCode,
 | 
						||
                                    ManageRuleName = item.ManageRuleName,
 | 
						||
                                    ManageRuleTypeId = item.ManageRuleTypeId,
 | 
						||
                                    VersionNo = item.VersionNo,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    Remark = item.Remark,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                ManageRuleLists.Add(newManageRuleList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.ManageRuleId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (ManageRuleLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Law_ManageRule.InsertAllOnSubmit(ManageRuleLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + ManageRuleLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("安全管理规定从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region HAZOP管理从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// HAZOP管理从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTechnique_HAZOP()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetTechnique_HAZOPToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_HAZOP> ManageRuleLists = new List<Model.Technique_HAZOP>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getHAZOP = db.Technique_HAZOP.FirstOrDefault(e => e.HAZOPId == item.HAZOPId); ;
 | 
						||
                            if (getHAZOP == null)
 | 
						||
                            {
 | 
						||
                                Model.Technique_HAZOP newManageRuleList = new Model.Technique_HAZOP
 | 
						||
                                {
 | 
						||
                                    HAZOPId = item.HAZOPId,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    Abstract = item.Abstract,
 | 
						||
                                    HAZOPDate = item.HAZOPDate,
 | 
						||
                                    HAZOPTitle = item.HAZOPTitle,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                ManageRuleLists.Add(newManageRuleList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.HAZOPId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (ManageRuleLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_HAZOP.InsertAllOnSubmit(ManageRuleLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + ManageRuleLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("HAZOP管理从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 管理评价从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 管理评价从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTechnique_Appraise()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetTechnique_AppraiseToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_Appraise> ManageRuleLists = new List<Model.Technique_Appraise>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getAppraise = db.Technique_Appraise.FirstOrDefault(e => e.AppraiseId == item.AppraiseId); ;
 | 
						||
                            if (getAppraise == null)
 | 
						||
                            {
 | 
						||
                                Model.Technique_Appraise newManageRuleList = new Model.Technique_Appraise
 | 
						||
                                {
 | 
						||
                                    AppraiseId = item.AppraiseId,
 | 
						||
                                    AppraiseCode = item.AppraiseCode,
 | 
						||
                                    AppraiseTitle = item.AppraiseTitle,
 | 
						||
                                    Abstract = item.Abstract,
 | 
						||
                                    AppraiseDate = item.AppraiseDate,
 | 
						||
                                    ArrangementPerson = item.ArrangementPerson,
 | 
						||
                                    ArrangementDate = item.ArrangementDate,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                ManageRuleLists.Add(newManageRuleList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.AppraiseId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (ManageRuleLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_Appraise.InsertAllOnSubmit(ManageRuleLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + ManageRuleLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("管理评价从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 应急预案从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 应急预案从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTechnique_Emergency()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetTechnique_EmergencyToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_Emergency> EmergencyLists = new List<Model.Technique_Emergency>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getEmergencyList = db.Technique_Emergency.FirstOrDefault(x => x.EmergencyId == item.EmergencyId);
 | 
						||
                            if (getEmergencyList == null)
 | 
						||
                            {
 | 
						||
                                var type = db.Base_EmergencyType.FirstOrDefault(e => e.EmergencyTypeId == item.EmergencyTypeId);
 | 
						||
                                if (!string.IsNullOrEmpty(item.EmergencyTypeId) && type == null)
 | 
						||
                                {
 | 
						||
                                    Model.Base_EmergencyType new_Type = new Model.Base_EmergencyType
 | 
						||
                                    {
 | 
						||
                                        EmergencyTypeId = item.EmergencyTypeId,
 | 
						||
                                        EmergencyTypeCode = item.EmergencyTypeCode,
 | 
						||
                                        EmergencyTypeName = item.EmergencyTypeName
 | 
						||
                                    };
 | 
						||
                                    db.Base_EmergencyType.InsertOnSubmit(new_Type);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
 | 
						||
                                Model.Technique_Emergency newEmergencyList = new Model.Technique_Emergency
 | 
						||
                                {
 | 
						||
                                    EmergencyId = item.EmergencyId,
 | 
						||
                                    EmergencyTypeId = item.EmergencyTypeId,
 | 
						||
                                    EmergencyCode = item.EmergencyCode,
 | 
						||
                                    EmergencyName = item.EmergencyName,
 | 
						||
                                    Summary = item.Summary,
 | 
						||
                                    Remark = item.Remark,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                EmergencyLists.Add(newEmergencyList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.EmergencyId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (EmergencyLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_Emergency.InsertAllOnSubmit(EmergencyLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + EmergencyLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("应急预案从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 专项方案从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 专项方案从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTechnique_SpecialScheme()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    var getData = hsseC.GetTechnique_SpecialSchemeToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_SpecialScheme> SpecialSchemeLists = new List<Model.Technique_SpecialScheme>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getSpecialSchemeList = db.Technique_SpecialScheme.FirstOrDefault(x => x.SpecialSchemeId == item.SpecialSchemeId);
 | 
						||
                            if (getSpecialSchemeList == null)
 | 
						||
                            {
 | 
						||
                                var type = db.Base_SpecialSchemeType.FirstOrDefault(e => e.SpecialSchemeTypeId == item.SpecialSchemeTypeId);
 | 
						||
                                if (!string.IsNullOrEmpty(item.SpecialSchemeTypeId) && type == null)
 | 
						||
                                {
 | 
						||
                                    Model.Base_SpecialSchemeType new_Type = new Model.Base_SpecialSchemeType
 | 
						||
                                    {
 | 
						||
                                        SpecialSchemeTypeId = item.SpecialSchemeTypeId,
 | 
						||
                                        SpecialSchemeTypeCode = item.SpecialSchemeTypeCode,
 | 
						||
                                        SpecialSchemeTypeName = item.SpecialSchemeTypeName
 | 
						||
                                    };
 | 
						||
                                    db.Base_SpecialSchemeType.InsertOnSubmit(new_Type);
 | 
						||
                                    db.SubmitChanges();
 | 
						||
                                }
 | 
						||
 | 
						||
                                Model.Technique_SpecialScheme newSpecialSchemeList = new Model.Technique_SpecialScheme
 | 
						||
                                {
 | 
						||
                                    SpecialSchemeId = item.SpecialSchemeId,
 | 
						||
                                    SpecialSchemeTypeId = item.SpecialSchemeTypeId,
 | 
						||
                                    SpecialSchemeCode = item.SpecialSchemeCode,
 | 
						||
                                    SpecialSchemeName = item.SpecialSchemeName,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    Summary = item.Summary,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
 | 
						||
                                SpecialSchemeLists.Add(newSpecialSchemeList);
 | 
						||
                                ////上传附件
 | 
						||
                                BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.SpecialSchemeId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
 | 
						||
                        if (SpecialSchemeLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_SpecialScheme.InsertAllOnSubmit(SpecialSchemeLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:记录" + SpecialSchemeLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("专项方案从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 培训教材库信息从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 培训教材库信息从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTraining_TrainingList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    ///获取教材类别
 | 
						||
                    var getData = hsseC.GetTraining_TrainingListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Training_Training> newLists = new List<Model.Training_Training>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getTraining = db.Training_Training.FirstOrDefault(x => x.TrainingId == item.TrainingId);
 | 
						||
                            if (getTraining == null)
 | 
						||
                            {
 | 
						||
                                Model.Training_Training newList = new Model.Training_Training
 | 
						||
                                {
 | 
						||
                                    TrainingId = item.TrainingId,
 | 
						||
                                    TrainingCode = item.TrainingCode,
 | 
						||
                                    TrainingName = item.TrainingName,
 | 
						||
                                    SupTrainingId = item.SupTrainingId,
 | 
						||
                                    IsEndLever = item.IsEndLever,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
                                newLists.Add(newList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Training_Training.InsertAllOnSubmit(newLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:培训教材库类别" + newLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                    ///获取明细
 | 
						||
                    var getDataItem = hsseC.GetTraining_TrainingItemListToSUB();
 | 
						||
                    if (getDataItem.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Training_TrainingItem> newItemLists = new List<Model.Training_TrainingItem>();
 | 
						||
                        foreach (var item in getDataItem)
 | 
						||
                        {
 | 
						||
                            var getItem = db.Training_TrainingItem.FirstOrDefault(x => x.TrainingId == item.TrainingId);
 | 
						||
                            if (getItem == null)
 | 
						||
                            {
 | 
						||
                                Model.Training_TrainingItem newItemList = new Model.Training_TrainingItem
 | 
						||
                                {
 | 
						||
                                    TrainingItemId = item.TrainingItemId,
 | 
						||
                                    TrainingId = item.TrainingId,
 | 
						||
                                    TrainingItemCode = item.TrainingItemCode,
 | 
						||
                                    TrainingItemName = item.TrainingItemName,
 | 
						||
                                    VersionNum = item.VersionNum,
 | 
						||
                                    ApproveState = item.ApproveState,
 | 
						||
                                    ResourcesFrom = item.ResourcesFrom,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    ResourcesFromType = item.ResourcesFromType,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsPass = true,
 | 
						||
                                    AttachUrl = item.AttachUrl
 | 
						||
                                };
 | 
						||
                                newItemLists.Add(newItemList);
 | 
						||
                                if (item.FileContext != null)
 | 
						||
                                {                                    ////上传附件
 | 
						||
                                    BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.TrainingItemId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newItemLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Training_TrainingItem.InsertAllOnSubmit(newItemLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message += ";明细" + newItemLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("培训教材" +
 | 
						||
                        "库信息从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全试题库信息从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 安全试题库信息从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTraining_TrainTestDBList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    ///获取类别
 | 
						||
                    var getData = hsseC.GetTraining_TrainTestDBListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Training_TrainTestDB> newLists = new List<Model.Training_TrainTestDB>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getTrainTestDB = db.Training_TrainTestDB.FirstOrDefault(x => x.TrainTestId == item.TrainTestId);
 | 
						||
                            if (getTrainTestDB == null)
 | 
						||
                            {
 | 
						||
                                Model.Training_TrainTestDB newList = new Model.Training_TrainTestDB
 | 
						||
                                {
 | 
						||
                                    TrainTestId = item.TrainTestId,
 | 
						||
                                    TrainTestCode = item.TrainTestCode,
 | 
						||
                                    TrainTestName = item.TrainTestName,
 | 
						||
                                    SupTrainTestId = item.SupTrainTestId,
 | 
						||
                                    IsEndLever = item.IsEndLever,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
                                newLists.Add(newList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Training_TrainTestDB.InsertAllOnSubmit(newLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:安全试题类别" + newLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                    ///获取明细
 | 
						||
                    var getDataItem = hsseC.GetTraining_TrainTestDBItemListToSUB();
 | 
						||
                    if (getDataItem.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Training_TrainTestDBItem> newItemLists = new List<Model.Training_TrainTestDBItem>();
 | 
						||
                        foreach (var item in getDataItem)
 | 
						||
                        {
 | 
						||
                            var getItem = db.Training_TrainTestDBItem.FirstOrDefault(x => x.TrainTestItemId == item.TrainTestItemId);
 | 
						||
                            if (getItem == null)
 | 
						||
                            {
 | 
						||
                                Model.Training_TrainTestDBItem newItemList = new Model.Training_TrainTestDBItem
 | 
						||
                                {
 | 
						||
                                    TrainTestItemId = item.TrainTestItemId,
 | 
						||
                                    TrainTestId = item.TrainTestId,
 | 
						||
                                    TrainTestItemCode = item.TrainTestItemCode,
 | 
						||
                                    TraiinTestItemName = item.TraiinTestItemName,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsPass = true
 | 
						||
                                };
 | 
						||
                                newItemLists.Add(newItemList);
 | 
						||
                                if (item.FileContext != null)
 | 
						||
                                {      ////上传附件
 | 
						||
                                    BLL.FileInsertService.InsertAttachFile(item.AttachFileId, item.TrainTestId, item.AttachSource, item.AttachUrl, item.FileContext);
 | 
						||
                                }
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newItemLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Training_TrainTestDBItem.InsertAllOnSubmit(newItemLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message += ";明细" + newItemLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("安全试题库信息从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 事故案例库信息从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 事故案例库信息从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getEduTrain_AccidentCaseList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    ///获取类别
 | 
						||
                    var getData = hsseC.GetEduTrain_AccidentCaseListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.EduTrain_AccidentCase> newLists = new List<Model.EduTrain_AccidentCase>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getAccidentCase = db.EduTrain_AccidentCase.FirstOrDefault(x => x.AccidentCaseId == item.AccidentCaseId);
 | 
						||
                            if (getAccidentCase == null)
 | 
						||
                            {
 | 
						||
                                Model.EduTrain_AccidentCase newList = new Model.EduTrain_AccidentCase
 | 
						||
                                {
 | 
						||
                                    AccidentCaseId = item.AccidentCaseId,
 | 
						||
                                    AccidentCaseCode = item.AccidentCaseCode,
 | 
						||
                                    AccidentCaseName = item.AccidentCaseName,
 | 
						||
                                    SupAccidentCaseId = item.SupAccidentCaseId,
 | 
						||
                                    IsEndLever = item.IsEndLever,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
                                newLists.Add(newList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.EduTrain_AccidentCase.InsertAllOnSubmit(newLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:事故案例类别" + newLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                    ///获取明细
 | 
						||
                    var getDataItem = hsseC.GetEduTrain_AccidentCaseItemListToSUB();
 | 
						||
                    if (getDataItem.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.EduTrain_AccidentCaseItem> newItemLists = new List<Model.EduTrain_AccidentCaseItem>();
 | 
						||
                        foreach (var item in getDataItem)
 | 
						||
                        {
 | 
						||
                            var getItem = db.EduTrain_AccidentCaseItem.FirstOrDefault(x => x.AccidentCaseItemId == item.AccidentCaseItemId);
 | 
						||
                            if (getItem == null)
 | 
						||
                            {
 | 
						||
                                Model.EduTrain_AccidentCaseItem newItemList = new Model.EduTrain_AccidentCaseItem
 | 
						||
                                {
 | 
						||
                                    AccidentCaseItemId = item.AccidentCaseItemId,
 | 
						||
                                    AccidentCaseId = item.AccidentCaseId,
 | 
						||
                                    Activities = item.Activities,
 | 
						||
                                    AccidentName = item.AccidentName,
 | 
						||
                                    AccidentProfiles = item.AccidentProfiles,
 | 
						||
                                    AccidentReview = item.AccidentReview,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsPass = true
 | 
						||
                                };
 | 
						||
                                newItemLists.Add(newItemList);                              
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newItemLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.EduTrain_AccidentCaseItem.InsertAllOnSubmit(newItemLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message += ";明细" + newItemLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("事故案例库信息从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 危险源清单从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 危险源清单从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTechnique_HazardList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    ///获取类别
 | 
						||
                    var getData = hsseC.GetTechnique_HazardListTypeListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_HazardListType> newLists = new List<Model.Technique_HazardListType>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getHType = db.Technique_HazardListType.FirstOrDefault(e => e.HazardListTypeId == item.HazardListTypeId);
 | 
						||
                            if (getHType == null)
 | 
						||
                            {
 | 
						||
                                Model.Technique_HazardListType newList = new Model.Technique_HazardListType
 | 
						||
                                {
 | 
						||
                                    HazardListTypeId = item.HazardListTypeId,
 | 
						||
                                    HazardListTypeCode = item.HazardListTypeCode,
 | 
						||
                                    HazardListTypeName = item.HazardListTypeName,
 | 
						||
                                    SupHazardListTypeId = item.SupHazardListTypeId,
 | 
						||
                                    IsEndLevel = item.IsEndLevel,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
                                newLists.Add(newList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_HazardListType.InsertAllOnSubmit(newLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:类别" + newLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                    ///获取明细
 | 
						||
                    var getDataItem = hsseC.GetTechnique_HazardListListToSUB();
 | 
						||
                    if (getDataItem.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_HazardList> newItemLists = new List<Model.Technique_HazardList>();
 | 
						||
                        foreach (var item in getDataItem)
 | 
						||
                        {
 | 
						||
                            var getItem = db.Technique_HazardList.FirstOrDefault(x => x.HazardId == item.HazardId);
 | 
						||
                            if (getItem == null)
 | 
						||
                            {
 | 
						||
                                Model.Technique_HazardList newItemList = new Model.Technique_HazardList
 | 
						||
                                {
 | 
						||
                                    HazardId = item.HazardId,
 | 
						||
                                    HazardListTypeId = item.HazardListTypeId,
 | 
						||
                                    HazardCode = item.HazardCode,
 | 
						||
                                    HazardItems = item.HazardItems,
 | 
						||
                                    DefectsType = item.DefectsType,
 | 
						||
                                    MayLeadAccidents = item.MayLeadAccidents,
 | 
						||
                                    HelperMethod = item.HelperMethod,
 | 
						||
                                    HazardJudge_L = item.HazardJudge_L,
 | 
						||
                                    HazardJudge_E = item.HazardJudge_E,
 | 
						||
                                    HazardJudge_C = item.HazardJudge_C,
 | 
						||
                                    HazardJudge_D = item.HazardJudge_D,
 | 
						||
                                    HazardLevel = item.HazardLevel,
 | 
						||
                                    ControlMeasures = item.ControlMeasures,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsPass = true
 | 
						||
                                };
 | 
						||
                                newItemLists.Add(newItemList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newItemLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_HazardList.InsertAllOnSubmit(newItemLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message += ";明细" + newItemLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("危险源清单从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
 | 
						||
        #region 安全隐患从集团公司提取
 | 
						||
        /// <summary>
 | 
						||
        /// 安全隐患从集团公司提取
 | 
						||
        /// </summary>
 | 
						||
        /// <returns></returns>
 | 
						||
        public static Model.ResponeData getTechnique_RectifyList()
 | 
						||
        {
 | 
						||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
						||
            {
 | 
						||
                var responeData = new Model.ResponeData();
 | 
						||
                try
 | 
						||
                {
 | 
						||
                    CNCECHSSEService.HSSEServiceClient hsseC = new CNCECHSSEService.HSSEServiceClient();
 | 
						||
                    ///获取类别
 | 
						||
                    var getData = hsseC.GetTechnique_RectifyListToSUB();
 | 
						||
                    if (getData.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_Rectify> newLists = new List<Model.Technique_Rectify>();
 | 
						||
                        foreach (var item in getData)
 | 
						||
                        {
 | 
						||
                            var getAccidentCase = db.Technique_Rectify.FirstOrDefault(x => x.RectifyId == item.RectifyId);
 | 
						||
                            if (getAccidentCase == null)
 | 
						||
                            {
 | 
						||
                                Model.Technique_Rectify newList = new Model.Technique_Rectify
 | 
						||
                                {
 | 
						||
                                    RectifyId = item.RectifyId,
 | 
						||
                                    RectifyCode = item.RectifyCode,
 | 
						||
                                    RectifyName = item.RectifyName,
 | 
						||
                                    SupRectifyId = item.SupRectifyId,
 | 
						||
                                    IsEndLever = item.IsEndLever,
 | 
						||
                                    IsBuild = true
 | 
						||
                                };
 | 
						||
                                newLists.Add(newList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_Rectify.InsertAllOnSubmit(newLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message = "获取成功:安全隐患类别" + newLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                    ///获取明细
 | 
						||
                    var getDataItem = hsseC.GetTechnique_RectifyItemListToSUB();
 | 
						||
                    if (getDataItem.Count() > 0)
 | 
						||
                    {
 | 
						||
                        List<Model.Technique_RectifyItem> newItemLists = new List<Model.Technique_RectifyItem>();
 | 
						||
                        foreach (var item in getDataItem)
 | 
						||
                        {
 | 
						||
                            var getItem = db.Technique_RectifyItem.FirstOrDefault(x => x.RectifyItemId == item.RectifyItemId);
 | 
						||
                            if (getItem == null)
 | 
						||
                            {
 | 
						||
                                Model.Technique_RectifyItem newItemList = new Model.Technique_RectifyItem
 | 
						||
                                {
 | 
						||
                                    RectifyItemId = item.RectifyItemId,
 | 
						||
                                    RectifyId = item.RectifyId,
 | 
						||
                                    HazardSourcePoint = item.HazardSourcePoint,
 | 
						||
                                    RiskAnalysis = item.RiskAnalysis,
 | 
						||
                                    RiskPrevention = item.RiskPrevention,
 | 
						||
                                    SimilarRisk = item.SimilarRisk,
 | 
						||
                                    CompileMan = item.CompileMan,
 | 
						||
                                    CompileDate = item.CompileDate,
 | 
						||
                                    UnitId = item.UnitId,
 | 
						||
                                    IsPass = true
 | 
						||
                                };
 | 
						||
                                newItemLists.Add(newItemList);
 | 
						||
                            }
 | 
						||
                        }
 | 
						||
                        if (newItemLists.Count() > 0)
 | 
						||
                        {
 | 
						||
                            db.Technique_RectifyItem.InsertAllOnSubmit(newItemLists);
 | 
						||
                            db.SubmitChanges();
 | 
						||
                        }
 | 
						||
                        responeData.message += ";明细" + newItemLists.Count().ToString() + "条";
 | 
						||
                    }
 | 
						||
                }
 | 
						||
                catch (Exception ex)
 | 
						||
                {
 | 
						||
                    responeData.code = 0;
 | 
						||
                    responeData.message = "获取失败:" + ex.Message;
 | 
						||
                    ErrLogInfo.WriteLog("安全隐患从集团公司提取!", ex);
 | 
						||
                }
 | 
						||
                return responeData;
 | 
						||
            }
 | 
						||
        }
 | 
						||
        #endregion
 | 
						||
        #endregion
 | 
						||
    }
 | 
						||
}
 |