Merge branch 'master' of http://47.104.102.122:3000/lpf/sggl_cd
This commit is contained in:
		
						commit
						0b081ea38f
					
				| 
						 | 
				
			
			@ -31,7 +31,7 @@ namespace BLL
 | 
			
		|||
                                  CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
 | 
			
		||||
                                  CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate),
 | 
			
		||||
                                  WorkStageIds = x.WorkStage,
 | 
			
		||||
                                  WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIdsForApi(x.WorkStage),
 | 
			
		||||
                                  WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage),
 | 
			
		||||
                                  Contents = x.Contents,
 | 
			
		||||
                                  WorkAreaName = x.WorkAreaName,
 | 
			
		||||
                                  IdentificationDate = string.Format("{0:yyyy-MM-dd}", x.IdentificationDate),
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ namespace BLL
 | 
			
		|||
                                        CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
 | 
			
		||||
                                        CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate),
 | 
			
		||||
                                        WorkStageIds = x.WorkStage,
 | 
			
		||||
                                        WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIdsForApi(x.WorkStage),
 | 
			
		||||
                                        WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage),
 | 
			
		||||
                                        Contents = x.Contents,
 | 
			
		||||
                                        WorkAreaName = x.WorkAreaName,
 | 
			
		||||
                                        IdentificationDate = string.Format("{0:yyyy-MM-dd}", x.IdentificationDate),
 | 
			
		||||
| 
						 | 
				
			
			@ -98,7 +98,7 @@ namespace BLL
 | 
			
		|||
                                    select new Model.HazardListSelectedItem
 | 
			
		||||
                                    {
 | 
			
		||||
                                        HazardId = x.HazardId,
 | 
			
		||||
                                        WorkStageName = WorkStageService.getWorkStageNamesWorkStageIdsForApi(x.WorkStage),
 | 
			
		||||
                                        WorkStageName = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage),
 | 
			
		||||
                                        SupHazardListTypeName = db.Technique_HazardListType.First(z => z.HazardListTypeId == y.SupHazardListTypeId).HazardListTypeName,
 | 
			
		||||
                                        HazardListTypeName = y.HazardListTypeName,
 | 
			
		||||
                                        HazardCode = y.HazardListTypeCode,
 | 
			
		||||
| 
						 | 
				
			
			@ -117,5 +117,395 @@ namespace BLL
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 获取风险等级列表信息
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取风险等级列表信息
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static List<Model.BaseInfoItem> getRiskLevel()
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                var getRiskLevel = from x in db.Base_RiskLevel
 | 
			
		||||
                                   orderby x.RiskLevel
 | 
			
		||||
                                   select new Model.BaseInfoItem
 | 
			
		||||
                                   {
 | 
			
		||||
                                       BaseInfoId = x.RiskLevelId,
 | 
			
		||||
                                       BaseInfoCode = (x.RiskLevel ?? 0).ToString(),
 | 
			
		||||
                                       BaseInfoName = x.RiskLevelName,
 | 
			
		||||
                                   };
 | 
			
		||||
                return getRiskLevel.ToList();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据HazardListId获取危险源辨识评价明细信息
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据HazardListId获取危险源辨识评价明细信息
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="hazardListId"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static List<Model.HazardListSelectedItem> getHazardItemInfo(string hazardSelectedItemId)
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                var getHazardList = from x in db.Hazard_HazardSelectedItem
 | 
			
		||||
                                    join y in db.Technique_HazardListType on x.HazardListTypeId equals y.HazardListTypeId
 | 
			
		||||
                                    where x.HazardSelectedItemId == hazardSelectedItemId
 | 
			
		||||
                                    orderby x.HazardListTypeId descending
 | 
			
		||||
                                    select new Model.HazardListSelectedItem
 | 
			
		||||
                                    {
 | 
			
		||||
                                        HazardSelectedItemId = hazardSelectedItemId,
 | 
			
		||||
                                        HazardId = x.HazardId,
 | 
			
		||||
                                        WorkStageName = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage),
 | 
			
		||||
                                        SupHazardListTypeName = db.Technique_HazardListType.First(z => z.HazardListTypeId == y.SupHazardListTypeId).HazardListTypeName,
 | 
			
		||||
                                        HazardListTypeName = y.HazardListTypeName,
 | 
			
		||||
                                        HazardCode = y.HazardListTypeCode,
 | 
			
		||||
                                        HazardItems = x.HazardItems,
 | 
			
		||||
                                        DefectsType = x.DefectsType,
 | 
			
		||||
                                        MayLeadAccidents = x.MayLeadAccidents,
 | 
			
		||||
                                        HelperMethod = x.HelperMethod,
 | 
			
		||||
                                        HazardJudge_L = x.HazardJudge_L,
 | 
			
		||||
                                        HazardJudge_E = x.HazardJudge_E,
 | 
			
		||||
                                        HazardJudge_C = x.HazardJudge_C,
 | 
			
		||||
                                        HazardJudge_D = x.HazardJudge_D,
 | 
			
		||||
                                        HazardLevel = x.HazardLevel,
 | 
			
		||||
                                        ControlMeasures = x.ControlMeasures,
 | 
			
		||||
                                        DutyPersonId = x.DutyPerson,
 | 
			
		||||
                                        DutyPersonName = UserService.getUserNamesUserIds(x.DutyPerson),
 | 
			
		||||
                                        PatrolPlanId = (from z in db.Hazard_PatrolPlan where z.HazardSelectedItemId == hazardSelectedItemId && z.CheckDate == null select z.PatrolPlanId).FirstOrDefault(),
 | 
			
		||||
                                        Position = x.Position,
 | 
			
		||||
                                    };
 | 
			
		||||
                return getHazardList.ToList();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 保存风险巡检记录明细项
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  保存风险巡检记录明细项
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="newDetail"></param>
 | 
			
		||||
        public static string SaveRoutingInspection(Model.RoutingInspectionItem newDetail)
 | 
			
		||||
        {
 | 
			
		||||
            string message = string.Empty;
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                var oldP = db.Hazard_PatrolPlan.FirstOrDefault(x => x.HazardSelectedItemId == newDetail.HazardSelectedItemId && x.CheckDate == null);
 | 
			
		||||
                if (oldP != null)
 | 
			
		||||
                {
 | 
			
		||||
                    Model.Hazard_RoutingInspection newRoutingInspection = new Model.Hazard_RoutingInspection
 | 
			
		||||
                    {
 | 
			
		||||
                        RoutingInspectionId = SQLHelper.GetNewID(),
 | 
			
		||||
                        HazardSelectedItemId = newDetail.HazardSelectedItemId,
 | 
			
		||||
                        PatrolManId = newDetail.PatrolManId,
 | 
			
		||||
                        PatrolTime = Funs.GetNewDateTimeOrNow(newDetail.PatrolTime),
 | 
			
		||||
                        PatrolResult = Convert.ToInt32(newDetail.PatrolResult),
 | 
			
		||||
                        OldRiskLevel = db.Hazard_PatrolPlan.FirstOrDefault(x => x.HazardSelectedItemId == newDetail.HazardSelectedItemId && x.CheckDate == null).HazardLevel,
 | 
			
		||||
                        ControlMeasures = newDetail.ControlMeasures,
 | 
			
		||||
                        DealReason = newDetail.DealReason,
 | 
			
		||||
                        RiskManId = newDetail.RiskManId,
 | 
			
		||||
                        PatrolPlanId = db.Hazard_PatrolPlan.FirstOrDefault(x => x.HazardSelectedItemId == newDetail.HazardSelectedItemId && x.CheckDate == null).PatrolPlanId,
 | 
			
		||||
                    };
 | 
			
		||||
                    Model.Hazard_PatrolPlan p = BLL.Hazard_PatrolPlanService.GetPatrolPlanByPatrolPlanId(newRoutingInspection.PatrolPlanId);
 | 
			
		||||
                    db.Hazard_RoutingInspection.InsertOnSubmit(newRoutingInspection);
 | 
			
		||||
                    db.SubmitChanges();
 | 
			
		||||
                    ////保存附件
 | 
			
		||||
                    if (!string.IsNullOrEmpty(newDetail.AttachUrl))
 | 
			
		||||
                    {
 | 
			
		||||
                        UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newDetail.AttachUrl, 10, null), newDetail.AttachUrl, Const.ProjectRiskControlMenuId, newRoutingInspection.RoutingInspectionId);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        CommonService.DeleteAttachFileById(Const.ProjectRiskControlMenuId, newRoutingInspection.RoutingInspectionId);
 | 
			
		||||
                    }
 | 
			
		||||
                    p.CheckDate = newRoutingInspection.PatrolTime;
 | 
			
		||||
                    p.State = "1";   //已巡检
 | 
			
		||||
                    if (newRoutingInspection.PatrolTime > p.LimitCheckDate)
 | 
			
		||||
                    {
 | 
			
		||||
                        p.State = "2";   //超期巡检
 | 
			
		||||
                    }
 | 
			
		||||
                    BLL.Hazard_PatrolPlanService.UpdatePatrolPlan(p);
 | 
			
		||||
                    var ps = BLL.Hazard_PatrolPlanService.GetBeforePatrolPlansByCheckDate(newDetail.HazardSelectedItemId, p.CheckDate.Value);
 | 
			
		||||
                    Model.Hazard_HazardSelectedItem selectedItem = BLL.Hazard_HazardSelectedItemService.GetHazardSelectedItemByHazardSelectedItemId(p.HazardSelectedItemId);
 | 
			
		||||
                    foreach (var item in ps)
 | 
			
		||||
                    {
 | 
			
		||||
                        item.CheckDate = p.CheckDate;
 | 
			
		||||
                        item.State = "3";   //超期未巡检
 | 
			
		||||
                        BLL.Hazard_PatrolPlanService.UpdatePatrolPlan(item);
 | 
			
		||||
                    }
 | 
			
		||||
                    string str = string.Empty;
 | 
			
		||||
                    if (newDetail.PatrolResult == "0")   //原状态
 | 
			
		||||
                    {
 | 
			
		||||
                        //巡检计划
 | 
			
		||||
                        Model.Hazard_PatrolPlan plan = new Model.Hazard_PatrolPlan();
 | 
			
		||||
                        plan.PatrolPlanId = SQLHelper.GetNewID();
 | 
			
		||||
                        plan.HazardSelectedItemId = newDetail.HazardSelectedItemId;
 | 
			
		||||
                        plan.HazardLevel = p.HazardLevel;
 | 
			
		||||
                        plan.DutyPerson = newDetail.RiskManId;
 | 
			
		||||
                        plan.Days = p.Days;
 | 
			
		||||
                        plan.CheckStartDate = p.CheckStartDate;
 | 
			
		||||
                        plan.LimitCheckDate = p.LimitCheckDate.Value.AddDays(p.Days.Value);
 | 
			
		||||
                        plan.State = "0";
 | 
			
		||||
                        Model.Hazard_PatrolPlan oldPlan = BLL.Hazard_PatrolPlanService.GetPatrolPlanByHazardSelectedItemIdAndLimitCheckDate(newDetail.HazardSelectedItemId, plan.LimitCheckDate);
 | 
			
		||||
                        if (oldPlan == null)
 | 
			
		||||
                        {
 | 
			
		||||
                            BLL.Hazard_PatrolPlanService.AddPatrolPlan(plan);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (newDetail.PatrolResult == "1")  //二次评估
 | 
			
		||||
                    {
 | 
			
		||||
                        //二次评价记录
 | 
			
		||||
                        Model.Hazard_RiskEvaluationRecord record = new Model.Hazard_RiskEvaluationRecord();
 | 
			
		||||
                        record.LECItemRecordId = SQLHelper.GetNewID();
 | 
			
		||||
                        record.DataId = newDetail.HazardSelectedItemId;
 | 
			
		||||
                        record.DataType = "Project";
 | 
			
		||||
                        record.Evaluatorld = newDetail.RiskManId;
 | 
			
		||||
                        BLL.RiskEvaluationRecordService.AddRiskEvaluationRecord(record);
 | 
			
		||||
                        if (newDetail.RiskManId == newDetail.CurrUserId)
 | 
			
		||||
                        {
 | 
			
		||||
                            str = "1|" + newDetail.HazardSelectedItemId + "|" + record.LECItemRecordId;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (newDetail.PatrolResult == "2")  //下整改单
 | 
			
		||||
                    {
 | 
			
		||||
                        //巡检计划
 | 
			
		||||
                        Model.Hazard_PatrolPlan plan = new Model.Hazard_PatrolPlan();
 | 
			
		||||
                        plan.PatrolPlanId = SQLHelper.GetNewID();
 | 
			
		||||
                        plan.HazardSelectedItemId = newDetail.HazardSelectedItemId;
 | 
			
		||||
                        plan.HazardLevel = p.HazardLevel;
 | 
			
		||||
                        plan.DutyPerson = newDetail.RiskManId;
 | 
			
		||||
                        plan.Days = p.Days;
 | 
			
		||||
                        plan.CheckStartDate = p.CheckStartDate;
 | 
			
		||||
                        plan.LimitCheckDate = p.LimitCheckDate.Value.AddDays(p.Days.Value);
 | 
			
		||||
                        plan.State = "0";
 | 
			
		||||
                        Model.Hazard_PatrolPlan oldPlan = BLL.Hazard_PatrolPlanService.GetPatrolPlanByHazardSelectedItemIdAndLimitCheckDate(newDetail.HazardSelectedItemId, plan.LimitCheckDate);
 | 
			
		||||
                        if (oldPlan == null)
 | 
			
		||||
                        {
 | 
			
		||||
                            BLL.Hazard_PatrolPlanService.AddPatrolPlan(plan);
 | 
			
		||||
                        }
 | 
			
		||||
                        str = "2|" + newDetail.HazardSelectedItemId;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (newDetail.PatrolResult == "-1")  //消除
 | 
			
		||||
                    {
 | 
			
		||||
                        selectedItem.IsStart = false;
 | 
			
		||||
                        selectedItem.State = "0";
 | 
			
		||||
                        BLL.Hazard_HazardSelectedItemService.UpdateHazardSelectedItem(selectedItem);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    message = "尚未生成巡检计划!";
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return message;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据主键ID获取二次评估详细信息
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据主键ID获取二次评估详细信息
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="hazardListId"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static List<Model.ReEvaluator> getReEvaluatorInfo(string LECItemRecordId)
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                var getHazardList = from x in db.Hazard_RiskEvaluationRecord
 | 
			
		||||
                                    where x.LECItemRecordId == LECItemRecordId
 | 
			
		||||
                                    orderby x.DataId descending
 | 
			
		||||
                                    select new Model.ReEvaluator
 | 
			
		||||
                                    {
 | 
			
		||||
                                        LECItemRecordId = LECItemRecordId,
 | 
			
		||||
                                        HazardSelectedItemId = x.DataId,
 | 
			
		||||
                                        Evaluatorld = x.Evaluatorld,
 | 
			
		||||
                                    };
 | 
			
		||||
                return getHazardList.ToList();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 保存二次评估明细项
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  保存二次评估明细项
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="newDetail"></param>
 | 
			
		||||
        public static void SaveReEvaluator(Model.ReEvaluator newDetail)
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                Model.Hazard_HazardSelectedItem item = BLL.Hazard_HazardSelectedItemService.GetHazardSelectedItemByHazardSelectedItemId(newDetail.HazardSelectedItemId);
 | 
			
		||||
                if (item != null)
 | 
			
		||||
                {
 | 
			
		||||
                    item.HazardJudge_L = newDetail.HazardJudge_L;
 | 
			
		||||
                    item.HazardJudge_E = newDetail.HazardJudge_E;
 | 
			
		||||
                    item.HazardJudge_C = newDetail.HazardJudge_C;
 | 
			
		||||
                    item.HazardJudge_D = newDetail.HazardJudge_D;
 | 
			
		||||
                    item.HazardLevel = newDetail.HazardLevel;
 | 
			
		||||
                    item.ControlMeasures = newDetail.ControlMeasures;
 | 
			
		||||
                    item.IsStart = newDetail.IsStart;
 | 
			
		||||
                    item.CheckStartDate = Funs.GetNewDateTime(newDetail.CheckStartDate);
 | 
			
		||||
                    if (!string.IsNullOrEmpty(newDetail.DutyPerson))
 | 
			
		||||
                    {
 | 
			
		||||
                        item.DutyPerson = newDetail.DutyPerson;
 | 
			
		||||
                    }
 | 
			
		||||
                    item.PlanExistDate = Funs.GetNewDateTime(newDetail.PlanExistDate);
 | 
			
		||||
                    item.State = "1";  //存在
 | 
			
		||||
                    if (!string.IsNullOrEmpty(newDetail.Position))
 | 
			
		||||
                    {
 | 
			
		||||
                        item.Position = newDetail.Position;
 | 
			
		||||
                    }
 | 
			
		||||
                    BLL.Hazard_HazardSelectedItemService.UpdateHazardSelectedItem(item);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                var oldRecord = BLL.RiskEvaluationRecordService.GetRiskEvaluationRecordByDataIdAndEvaluatorDate(newDetail.HazardSelectedItemId);
 | 
			
		||||
                if (oldRecord != null)
 | 
			
		||||
                {
 | 
			
		||||
                    oldRecord.EvaluatorDate = DateTime.Now;
 | 
			
		||||
                    oldRecord.L = item.HazardJudge_L;
 | 
			
		||||
                    oldRecord.E = item.HazardJudge_E;
 | 
			
		||||
                    oldRecord.C = item.HazardJudge_C;
 | 
			
		||||
                    oldRecord.D = item.HazardJudge_D;
 | 
			
		||||
                    oldRecord.RiskLevel = item.HazardLevel;
 | 
			
		||||
                    oldRecord.ControlMeasures = item.ControlMeasures;
 | 
			
		||||
                    oldRecord.Remark = item.Remark;
 | 
			
		||||
                    BLL.RiskEvaluationRecordService.UpdateRiskEvaluationRecord(oldRecord);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    Model.Hazard_RiskEvaluationRecord record = new Model.Hazard_RiskEvaluationRecord();
 | 
			
		||||
                    record.LECItemRecordId = SQLHelper.GetNewID();
 | 
			
		||||
                    record.DataId = item.HazardSelectedItemId;
 | 
			
		||||
                    record.DataType = "Project";
 | 
			
		||||
                    record.Evaluatorld = newDetail.CurrUserId;
 | 
			
		||||
                    record.EvaluatorDate = DateTime.Now;
 | 
			
		||||
                    record.L = item.HazardJudge_L;
 | 
			
		||||
                    record.E = item.HazardJudge_E;
 | 
			
		||||
                    record.C = item.HazardJudge_C;
 | 
			
		||||
                    record.D = item.HazardJudge_D;
 | 
			
		||||
                    record.RiskLevel = item.HazardLevel;
 | 
			
		||||
                    record.ControlMeasures = item.ControlMeasures;
 | 
			
		||||
                    record.Remark = item.Remark;
 | 
			
		||||
                    BLL.RiskEvaluationRecordService.AddRiskEvaluationRecord(record);
 | 
			
		||||
                }
 | 
			
		||||
                if (item.IsStart == true)
 | 
			
		||||
                {
 | 
			
		||||
                    string[] personIds = newDetail.DutyPerson.Split(',');
 | 
			
		||||
                    foreach (var personId in personIds)
 | 
			
		||||
                    {
 | 
			
		||||
                        //巡检计划
 | 
			
		||||
                        Model.Hazard_PatrolPlan plan = new Model.Hazard_PatrolPlan();
 | 
			
		||||
                        plan.PatrolPlanId = SQLHelper.GetNewID();
 | 
			
		||||
                        plan.HazardSelectedItemId = newDetail.HazardSelectedItemId;
 | 
			
		||||
                        plan.HazardLevel = item.HazardLevel;
 | 
			
		||||
                        plan.DutyPerson = personId;
 | 
			
		||||
                        Model.Base_RiskLevel level = BLL.RiskLevelService.GetRiskLevel(item.HazardLevel);
 | 
			
		||||
                        if (level != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            plan.Days = level.Days;
 | 
			
		||||
                        }
 | 
			
		||||
                        plan.CheckStartDate = item.CheckStartDate;
 | 
			
		||||
                        plan.LimitCheckDate = item.CheckStartDate.Value.AddDays(level.Days.Value);
 | 
			
		||||
                        plan.State = "0";
 | 
			
		||||
                        BLL.Hazard_PatrolPlanService.AddPatrolPlan(plan);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据projectId获取危险源辨识评价列表
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据projectId获取危险源辨识评价列表
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="projectId"></param>
 | 
			
		||||
        /// <param name="strParam"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static List<Model.RoutingInspectionItem> getRoutingInspectionList(string projectId)
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                var getHazardList = from x in db.Hazard_RoutingInspection
 | 
			
		||||
                                    join y in db.Hazard_HazardSelectedItem on x.HazardSelectedItemId equals y.HazardSelectedItemId
 | 
			
		||||
                                    join z in db.Hazard_HazardList on y.HazardListId equals z.HazardListId
 | 
			
		||||
                                    where z.ProjectId == projectId
 | 
			
		||||
                                    orderby x.PatrolTime descending
 | 
			
		||||
                                    select new Model.RoutingInspectionItem
 | 
			
		||||
                                    {
 | 
			
		||||
                                        RoutingInspectionId = x.RoutingInspectionId,
 | 
			
		||||
                                        WorkAreaName = z.WorkAreaName,
 | 
			
		||||
                                        WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIds(z.WorkStage),
 | 
			
		||||
                                        HazardListType = db.Technique_HazardListType.First(e => e.HazardListTypeId == y.HazardListTypeId).HazardListTypeName,
 | 
			
		||||
                                        HazardItems = y.HazardItems,
 | 
			
		||||
                                        PatrolManName = db.Sys_User.First(e => e.UserId == x.PatrolManId).UserName,
 | 
			
		||||
                                        PatrolTime = string.Format("{0:yyyy-MM-dd}", x.PatrolTime),
 | 
			
		||||
                                        OldRiskLevelName = db.Base_RiskLevel.First(e => e.RiskLevelId == x.OldRiskLevel).RiskLevelName,
 | 
			
		||||
                                        RiskLevelName = db.Base_RiskLevel.First(e => e.RiskLevelId == y.HazardLevel).RiskLevelName,
 | 
			
		||||
                                        PatrolResultStr = ConvertPatrolResultStr(x.PatrolResult),
 | 
			
		||||
                                    };
 | 
			
		||||
                return getHazardList.ToList();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static string ConvertPatrolResultStr(int? PatrolResult)
 | 
			
		||||
        {
 | 
			
		||||
            if (PatrolResult != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (PatrolResult == 0)
 | 
			
		||||
                {
 | 
			
		||||
                    return "原状态";
 | 
			
		||||
                }
 | 
			
		||||
                else if (PatrolResult == 1)
 | 
			
		||||
                {
 | 
			
		||||
                    return "二次评估";
 | 
			
		||||
                }
 | 
			
		||||
                else if (PatrolResult == 2)
 | 
			
		||||
                {
 | 
			
		||||
                    return "下整改单";
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    return "消除";
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return "";
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据主键ID获取已生成的风险巡检记录信息
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据主键ID获取已生成的风险巡检记录信息
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="hazardListId"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static List<Model.RoutingInspectionItem> getRoutingInspection(string routingInspectionId)
 | 
			
		||||
        {
 | 
			
		||||
            using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
            {
 | 
			
		||||
                var getHazardList = from x in db.Hazard_RoutingInspection
 | 
			
		||||
                                    join y in db.Hazard_HazardSelectedItem on x.HazardSelectedItemId equals y.HazardSelectedItemId
 | 
			
		||||
                                    where x.RoutingInspectionId == routingInspectionId
 | 
			
		||||
                                    orderby x.PatrolTime descending
 | 
			
		||||
                                    select new Model.RoutingInspectionItem
 | 
			
		||||
                                    {
 | 
			
		||||
                                        RoutingInspectionId = x.RoutingInspectionId,
 | 
			
		||||
                                        HazardCode = db.Technique_HazardList.First(z => z.HazardId == y.HazardId).HazardCode,
 | 
			
		||||
                                        HazardSelectedItemId = x.HazardSelectedItemId,
 | 
			
		||||
                                        HazardItems = y.HazardItems,
 | 
			
		||||
                                        DefectsType = y.DefectsType,
 | 
			
		||||
                                        MayLeadAccidents = y.MayLeadAccidents,
 | 
			
		||||
                                        PatrolManId = db.Sys_User.First(z => z.UserId == x.PatrolManId).UserName,
 | 
			
		||||
                                        PatrolTime = string.Format("{0:yyyy-MM-dd}", x.PatrolTime),
 | 
			
		||||
                                        PatrolResult = x.PatrolResult.ToString(),
 | 
			
		||||
                                        ControlMeasures = x.ControlMeasures,
 | 
			
		||||
                                        DealReason = x.DealReason,
 | 
			
		||||
                                        RiskManId = db.Sys_User.First(z => z.UserId == x.RiskManId).UserName,
 | 
			
		||||
                                    };
 | 
			
		||||
                return getHazardList.ToList();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,15 @@ namespace Model
 | 
			
		|||
    /// </summary>
 | 
			
		||||
    public class HazardListSelectedItem
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardSelectedItemId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键
 | 
			
		||||
        /// </summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -140,5 +149,41 @@ namespace Model
 | 
			
		|||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险责任人Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string DutyPersonId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险责任人姓名
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string DutyPersonName
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险巡检计划Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PatrolPlanId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 详细位置描述
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Position
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,141 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Model
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 二次评估信息项
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class ReEvaluator
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// ID
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string LECItemRecordId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险ID
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardSelectedItemId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 当前用户id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Evaluatorld
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 作业条件危险性评价(L)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public decimal? HazardJudge_L
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 作业条件危险性评价(E)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public decimal? HazardJudge_E
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 作业条件危险性评价(C)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public decimal? HazardJudge_C
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 作业条件危险性评价(D)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public decimal? HazardJudge_D
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险等级Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardLevel
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 控制措施
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string ControlMeasures
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 是否启动巡检
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool IsStart
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检启动时间
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string CheckStartDate
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险责任人Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string DutyPerson
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 预计存在时间
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PlanExistDate
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 当前用户Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string CurrUserId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 详细位置描述
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Position
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,185 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Model
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 风险巡检记录信息项
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class RoutingInspectionItem
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// ID
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string RoutingInspectionId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险ID
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardSelectedItemId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检人id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PatrolManId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检时间
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PatrolTime
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检结果(0~原状态,1~二次评估,2~下整改单,-1~消除)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PatrolResult
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 控制措施
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string ControlMeasures
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检处理原因描述
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string DealReason
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 风险责任人Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string RiskManId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 附件
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string AttachUrl
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 当前用户Id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string CurrUserId
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 单位工程
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string WorkAreaName
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 工作阶段
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string WorkStageNames
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 危险源项
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardListType
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 危险源代码
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardCode
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 缺陷类型
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string DefectsType
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 可能导致的事故
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string MayLeadAccidents
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 危险因素明细
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string HazardItems
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PatrolManName
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 原等级
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string OldRiskLevelName
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 现等级
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string RiskLevelName
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 巡检结果
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string PatrolResultStr
 | 
			
		||||
        {
 | 
			
		||||
            get;
 | 
			
		||||
            set;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -110,6 +110,8 @@
 | 
			
		|||
    <Compile Include="APIItem\HSSE\PersonItem.cs" />
 | 
			
		||||
    <Compile Include="APIItem\HSSE\PersonQualityItem.cs" />
 | 
			
		||||
    <Compile Include="APIItem\HSSE\PictureItem.cs" />
 | 
			
		||||
    <Compile Include="APIItem\HSSE\ReEvaluator.cs" />
 | 
			
		||||
    <Compile Include="APIItem\HSSE\RoutingInspectionItem.cs" />
 | 
			
		||||
    <Compile Include="APIItem\HSSE\SeDinMonthReport4OtherItem.cs" />
 | 
			
		||||
    <Compile Include="APIItem\OperationReportDto.cs" />
 | 
			
		||||
    <Compile Include="APIItem\ProjectGpsPointItem.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,5 +68,190 @@ namespace WebAPI.Controllers
 | 
			
		|||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
   
 | 
			
		||||
        #region 获取风险等级列表
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  获取风险等级列表
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public Model.ResponeData getRiskLevel()
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                ////风险等级列表信息
 | 
			
		||||
                var getRiskLevel = APIHazardListService.getRiskLevel();
 | 
			
		||||
                responeData.data = new { getRiskLevel };
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据主键ID获取风险详细
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  根据主键ID获取风险详细
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="hazardSelectedItemId"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public Model.ResponeData getHazardItemById(string hazardSelectedItemId)
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                ////危险源辨识与评价明细信息
 | 
			
		||||
                var getHazardSelectedInfo = APIHazardListService.getHazardItemInfo(hazardSelectedItemId);
 | 
			
		||||
                responeData.data = new { getHazardSelectedInfo };
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 保存风险巡检记录
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 保存风险巡检记录
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="newItem">风险巡检记录</param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public Model.ResponeData SaveRoutingInspection([FromBody] Model.RoutingInspectionItem newItem)
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                responeData.message = APIHazardListService.SaveRoutingInspection(newItem);
 | 
			
		||||
                if (!string.IsNullOrEmpty(responeData.message))
 | 
			
		||||
                {
 | 
			
		||||
                    responeData.code = 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据主键ID获取二次评估详细
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  根据主键ID获取二次评估详细
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="LECItemRecordId"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public Model.ResponeData getReEvaluatorById(string LECItemRecordId)
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var getHazardSelectedInfo = APIHazardListService.getReEvaluatorInfo(LECItemRecordId);
 | 
			
		||||
                responeData.data = new { getHazardSelectedInfo };
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 保存二次评估
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 保存二次评估
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="newItem">二次评估</param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public Model.ResponeData SaveReEvaluator([FromBody] Model.ReEvaluator newItem)
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                APIHazardListService.SaveReEvaluator(newItem);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据projectId获取风险巡检记录列表
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据projectId获取风险巡检记录列表
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="projectId"></param>
 | 
			
		||||
        /// <param name="pageIndex"></param>        
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public Model.ResponeData getRoutingInspectionList(string projectId, int pageIndex)
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var getDataList = APIHazardListService.getRoutingInspectionList(projectId);
 | 
			
		||||
                int pageCount = getDataList.Count();
 | 
			
		||||
                if (pageCount > 0 && pageIndex > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    getDataList = getDataList.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
 | 
			
		||||
                }
 | 
			
		||||
                responeData.data = new { pageCount, getDataList };
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 根据主键ID获取已生成的风险巡检记录
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  根据主键ID获取已生成的风险巡检记录
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="routingInspectionId"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public Model.ResponeData getRoutingInspectionById(string routingInspectionId)
 | 
			
		||||
        {
 | 
			
		||||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                ////危险源辨识与评价明细信息
 | 
			
		||||
                var getHazardSelectedInfo = APIHazardListService.getRoutingInspection(routingInspectionId);
 | 
			
		||||
                responeData.data = new { getHazardSelectedInfo };
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
                responeData.message = ex.Message;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return responeData;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -79,10 +79,26 @@ namespace WebAPI.Controllers
 | 
			
		|||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var getTasks = new Model.SGGLDB(Funs.ConnString).Training_Task.FirstOrDefault(x => x.PlanId == trainingPlanId);
 | 
			
		||||
                using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
                {
 | 
			
		||||
                    var getTasks =db.Training_Task.FirstOrDefault(x => x.PlanId == trainingPlanId);
 | 
			
		||||
                    if (getTasks != null)
 | 
			
		||||
                    {
 | 
			
		||||
                    if (CommonService.IsMainUnitOrAdmin(userId))
 | 
			
		||||
                        bool result = false;
 | 
			
		||||
                        if (userId == Const.sysglyId || userId == Const.hfnbdId)
 | 
			
		||||
                        {
 | 
			
		||||
                            result = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            var user = db.Sys_User.FirstOrDefault(e => e.UserId == userId);
 | 
			
		||||
                            if (user != null && user.UnitId == Const.UnitId_CD)
 | 
			
		||||
                            {
 | 
			
		||||
                                result = true;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if ( result)
 | 
			
		||||
                       //if (CommonService.IsMainUnitOrAdmin(userId))
 | 
			
		||||
                        {
 | 
			
		||||
                            responeData.data = APITestPlanService.SaveTestPlanByTrainingPlanId(trainingPlanId, userId);
 | 
			
		||||
                        }
 | 
			
		||||
| 
						 | 
				
			
			@ -98,6 +114,7 @@ namespace WebAPI.Controllers
 | 
			
		|||
                        responeData.message = "培训计划下没有培训人员,不能生成考试计划!";
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -201,11 +218,11 @@ namespace WebAPI.Controllers
 | 
			
		|||
                        Model.SitePerson_Person person;
 | 
			
		||||
                        if (user != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            person = Funs.DB.SitePerson_Person.FirstOrDefault(e => (e.PersonId == personId || e.IdentityCard == user.IdentityCard) && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
 | 
			
		||||
                            person = db.SitePerson_Person.FirstOrDefault(e => (e.PersonId == personId || e.IdentityCard == user.IdentityCard) && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            person = Funs.DB.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId  && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
 | 
			
		||||
                            person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId  && e.ProjectId == getTestPlan.ProjectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
 | 
			
		||||
 | 
			
		||||
                        }
 | 
			
		||||
                        if (person != null || user != null)
 | 
			
		||||
| 
						 | 
				
			
			@ -246,7 +263,7 @@ namespace WebAPI.Controllers
 | 
			
		|||
                                            TestPlanId = getTestPlan.TestPlanId,
 | 
			
		||||
                                            TestManId = personId,
 | 
			
		||||
                                        };
 | 
			
		||||
                                        TestRecordService.AddTestRecord(newTestRecord);
 | 
			
		||||
                                        TestRecordService.AddTestRecordForApi(newTestRecord);
 | 
			
		||||
                                        responeData.code = 3;
 | 
			
		||||
                                        responeData.message = "您已加入考试计划!";
 | 
			
		||||
                                    }
 | 
			
		||||
| 
						 | 
				
			
			@ -265,7 +282,7 @@ namespace WebAPI.Controllers
 | 
			
		|||
                                            TestPlanId = getTestPlan.TestPlanId,
 | 
			
		||||
                                            TestManId = personId,
 | 
			
		||||
                                        };
 | 
			
		||||
                                        TestRecordService.AddTestRecord(newTestRecord);
 | 
			
		||||
                                        TestRecordService.AddTestRecordForApi(newTestRecord);
 | 
			
		||||
                                        responeData.code = 3;
 | 
			
		||||
                                        responeData.message = "您已加入考试计划!";
 | 
			
		||||
                                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ namespace WebAPI.Controllers
 | 
			
		|||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                personId = PersonService.GetPersonIdByUserId(personId);
 | 
			
		||||
                personId = PersonService.GetPersonIdByUserIdForApi(personId);
 | 
			
		||||
                var getDataLists = APITestRecordService.getTrainingTestRecordListByProjectIdPersonId(projectId, personId);
 | 
			
		||||
                int pageCount = getDataLists.Count;
 | 
			
		||||
                if (pageCount > 0 && pageIndex > 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -101,7 +101,23 @@ namespace WebAPI.Controllers
 | 
			
		|||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                if (CommonService.IsMainUnitOrAdmin(trainingPlan.DesignerId))
 | 
			
		||||
                using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
 | 
			
		||||
                {
 | 
			
		||||
                    bool result = false;
 | 
			
		||||
                    if (trainingPlan.DesignerId == Const.sysglyId || trainingPlan.DesignerId == Const.hfnbdId)
 | 
			
		||||
                    {
 | 
			
		||||
                        result = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        var user = db.Sys_User.FirstOrDefault(e => e.UserId == trainingPlan.DesignerId);
 | 
			
		||||
                        if (user != null && user.UnitId == Const.UnitId_CD)
 | 
			
		||||
                        {
 | 
			
		||||
                            result = true;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (result)
 | 
			
		||||
                    //   if (CommonService.IsMainUnitOrAdmin(trainingPlan.DesignerId))
 | 
			
		||||
                    {
 | 
			
		||||
                        APITrainingPlanService.SaveTrainingPlan(trainingPlan);
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			@ -111,6 +127,7 @@ namespace WebAPI.Controllers
 | 
			
		|||
                        responeData.message = "非本单位用户,不能制定培训计划!";
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                responeData.code = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,7 +86,7 @@ namespace WebAPI.Controllers
 | 
			
		|||
            var responeData = new Model.ResponeData();
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
               string newPersonId = PersonService.GetPersonIdByUserId(personId);
 | 
			
		||||
               string newPersonId = PersonService.GetPersonIdByUserIdForApi(personId);
 | 
			
		||||
                responeData.message = APITrainingTaskService.getTrainingTaskByPlanIdPersonIdCondition(planId, newPersonId);
 | 
			
		||||
                if (string.IsNullOrEmpty(responeData.message))
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue