コード例 #1
0
        /// <summary>
        ///  生成隐患整改单
        /// </summary>
        /// <param name="newItem"></param>
        public static void SaveNewRectifyNotices(Model.CheckSpecialItem newItem)
        {
            var newDetail = newItem.CheckSpecialDetailItems.Where(x => x.HandleStep == "3" && (!x.CompleteStatus.HasValue || x.CompleteStatus == false));

            if (newDetail.Count() > 0)
            {
                var getUnitIdList = newDetail.Select(x => x.UnitId).Distinct();
                foreach (var uItem in getUnitIdList)
                {
                    Model.RectifyNoticesItem newRectifyNotices = new Model.RectifyNoticesItem
                    {
                        ProjectId        = newItem.ProjectId,
                        UnitId           = uItem,
                        CheckManNames    = newItem.PartInPersonNames,
                        CheckManIds      = newItem.CheckPersonId,
                        CheckedDate      = newItem.CheckTime,
                        HiddenHazardType = "1",
                        CompleteManId    = newItem.CompileManId,
                        States           = Const.State_0,
                        AttachUrl        = newItem.AttachUrl1,
                    };
                    if (!string.IsNullOrEmpty(newItem.PartInPersonIds))
                    {
                        newRectifyNotices.CheckManIds += (',' + newItem.PartInPersonIds);
                    }
                    var getDetails = newDetail.Where(x => x.UnitId == uItem);
                    if (getDetails.Count() > 0)
                    {
                        string workAreaIds = null;
                        newRectifyNotices.RectifyNoticesItemItem = new List <Model.RectifyNoticesItemItem>();
                        foreach (var dItem in getDetails)
                        {
                            Model.RectifyNoticesItemItem newRectifyNoticesItem = new Model.RectifyNoticesItemItem
                            {
                                WrongContent   = dItem.CheckItemSetName + dItem.CheckContent + dItem.Unqualified,
                                Requirement    = dItem.Suggestions,
                                LimitTime      = dItem.LimitedDate,
                                PhotoBeforeUrl = dItem.AttachUrl1,
                            };
                            if (string.IsNullOrEmpty(workAreaIds))
                            {
                                workAreaIds = dItem.WorkAreaId;
                            }
                            else
                            {
                                workAreaIds += "," + dItem.WorkAreaId;
                            }
                            if (string.IsNullOrEmpty(dItem.CheckSpecialDetailId))
                            {
                                newRectifyNotices.CheckSpecialDetailId = dItem.CheckSpecialDetailId;
                            }
                            else
                            {
                                newRectifyNotices.CheckSpecialDetailId += "," + dItem.CheckSpecialDetailId;
                            }
                            newRectifyNotices.RectifyNoticesItemItem.Add(newRectifyNoticesItem);
                        }

                        newRectifyNotices.WorkAreaId = workAreaIds;
                        APIRectifyNoticesService.SaveRectifyNotices(newRectifyNotices);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 保存RectifyNotices
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public static void SaveRectifyNotices(Model.RectifyNoticesItem rectifyNotices)
        {
            using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString))
            {
                bool insertRectifyNoticesItemItem            = false;
                Model.Check_RectifyNotices newRectifyNotices = new Model.Check_RectifyNotices
                {
                    RectifyNoticesId   = rectifyNotices.RectifyNoticesId,
                    ProjectId          = rectifyNotices.ProjectId,
                    RectifyNoticesCode = rectifyNotices.RectifyNoticesCode,
                    UnitId             = rectifyNotices.UnitId,
                    CheckManNames      = rectifyNotices.CheckManNames,
                    CheckManIds        = rectifyNotices.CheckManIds,
                    CheckedDate        = Funs.GetNewDateTime(rectifyNotices.CheckedDate),
                    HiddenHazardType   = rectifyNotices.HiddenHazardType,
                    States             = rectifyNotices.States,
                };
                if (!string.IsNullOrEmpty(rectifyNotices.WorkAreaId))
                {
                    newRectifyNotices.WorkAreaId = rectifyNotices.WorkAreaId;
                }
                if (!string.IsNullOrEmpty(rectifyNotices.CompleteManId))
                {
                    newRectifyNotices.CompleteManId = rectifyNotices.CompleteManId;
                }
                if (newRectifyNotices.States == Const.State_1)
                {
                    newRectifyNotices.SignPerson = rectifyNotices.SignPersonId;
                }
                //// 新增整改单
                var isUpdate = db.Check_RectifyNotices.FirstOrDefault(x => x.RectifyNoticesId == newRectifyNotices.RectifyNoticesId);
                if (isUpdate == null)
                {
                    newRectifyNotices.RectifyNoticesId   = SQLHelper.GetNewID();
                    newRectifyNotices.Isprint            = "0";
                    newRectifyNotices.Isprintf           = "0";
                    newRectifyNotices.RectifyNoticesCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId);
                    db.Check_RectifyNotices.InsertOnSubmit(newRectifyNotices);
                    db.SubmitChanges();
                    CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId, newRectifyNotices.RectifyNoticesId, newRectifyNotices.CheckedDate);
                    //// 整改单附件
                    if (!string.IsNullOrEmpty(rectifyNotices.BeAttachUrl))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId + "#0", rectifyNotices.BeAttachUrl, "0");
                    }
                    //// 反馈单附件
                    if (!string.IsNullOrEmpty(rectifyNotices.AfAttachUrl))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId + "#1", rectifyNotices.AfAttachUrl, "0");
                    }
                    //// 整个单据附件
                    if (!string.IsNullOrEmpty(rectifyNotices.AttachUrl))
                    {
                        APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.RectifyNoticesId, rectifyNotices.AttachUrl, "0");
                    }
                    insertRectifyNoticesItemItem = true;

                    //// 回写巡检记录表
                    if (!string.IsNullOrEmpty(rectifyNotices.HazardRegisterId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(rectifyNotices.HazardRegisterId, ',');
                        foreach (var item in listIds)
                        {
                            var getHazardRegister = db.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == item);
                            if (getHazardRegister != null)
                            {
                                getHazardRegister.States      = "3";
                                getHazardRegister.HandleIdea += "已升级为隐患整改单:" + newRectifyNotices.RectifyNoticesCode;
                                getHazardRegister.ResultId    = newRectifyNotices.RectifyNoticesId;
                                getHazardRegister.ResultType  = "1";
                                db.SubmitChanges();
                            }
                        }
                    }
                    //// 回写专项检查明细表
                    if (!string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId))
                    {
                        List <string> listIds = Funs.GetStrListByStr(rectifyNotices.CheckSpecialDetailId, ',');
                        foreach (var item in listIds)
                        {
                            var getCheckSpecialDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == item);
                            if (getCheckSpecialDetail != null)
                            {
                                getCheckSpecialDetail.DataType = "1";
                                getCheckSpecialDetail.DataId   = newRectifyNotices.RectifyNoticesId;
                                db.SubmitChanges();
                            }
                        }
                    }
                }
                else
                {
                    newRectifyNotices.RectifyNoticesId = isUpdate.RectifyNoticesId;
                    isUpdate.States = rectifyNotices.States;
                    if (newRectifyNotices.States == "0" || newRectifyNotices.States == "1")  ////编制人 修改或提交
                    {
                        isUpdate.UnitId           = rectifyNotices.UnitId;
                        isUpdate.WorkAreaId       = rectifyNotices.WorkAreaId;
                        isUpdate.CheckManNames    = rectifyNotices.CheckManNames;
                        isUpdate.CheckManIds      = rectifyNotices.CheckManIds;
                        isUpdate.CheckedDate      = Funs.GetNewDateTime(rectifyNotices.CheckedDate);
                        isUpdate.HiddenHazardType = rectifyNotices.HiddenHazardType;
                        if (newRectifyNotices.States == "1" && !string.IsNullOrEmpty(rectifyNotices.SignPersonId))
                        {
                            isUpdate.SignPerson = rectifyNotices.SignPersonId;
                        }
                        else
                        {
                            newRectifyNotices.States = isUpdate.States = "0";
                        }
                        db.SubmitChanges();
                        //// 删除明细表
                        var deleteItem = from x in db.Check_RectifyNoticesItem where x.RectifyNoticesId == isUpdate.RectifyNoticesId select x;
                        if (deleteItem.Count() > 0)
                        {
                            foreach (var cdeleteItem in deleteItem)
                            {
                                CommonService.DeleteAttachFileById(cdeleteItem.RectifyNoticesItemId);
                            }
                            db.Check_RectifyNoticesItem.DeleteAllOnSubmit(deleteItem);
                        }

                        insertRectifyNoticesItemItem = true;
                    }
                    else if (newRectifyNotices.States == "2") ////总包单位项目安全经理 审核
                    {
                        /// 不同意 打回 同意抄送专业工程师、施工经理、项目经理 并下发分包接收人(也就是施工单位项目安全经理)
                        if (rectifyNotices.IsAgree == false)
                        {
                            newRectifyNotices.States = isUpdate.States = "0";
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(rectifyNotices.ProfessionalEngineerId))
                            {
                                isUpdate.ProfessionalEngineerId = rectifyNotices.ProfessionalEngineerId;
                            }
                            if (!string.IsNullOrEmpty(rectifyNotices.ConstructionManagerId))
                            {
                                isUpdate.ConstructionManagerId = rectifyNotices.ConstructionManagerId;
                            }
                            if (!string.IsNullOrEmpty(rectifyNotices.ProjectManagerId))
                            {
                                isUpdate.ProjectManagerId = rectifyNotices.ProjectManagerId;
                            }
                            if (!string.IsNullOrEmpty(rectifyNotices.DutyPersonId))
                            {
                                isUpdate.DutyPersonId = rectifyNotices.DutyPersonId;
                                isUpdate.SignDate     = DateTime.Now;
                            }
                            else
                            {
                                newRectifyNotices.States = isUpdate.States = "1";
                            }
                        }
                        db.SubmitChanges();
                    }
                    else if (newRectifyNotices.States == "3") /// 施工单位项目安全经理 整改 提交施工单位项目负责人
                    {
                        //// 整改明细反馈
                        if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0)
                        {
                            foreach (var rItem in rectifyNotices.RectifyNoticesItemItem)
                            {
                                var getUpdateItem = db.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId);
                                if (getUpdateItem != null)
                                {
                                    getUpdateItem.RectifyResults = rItem.RectifyResults;
                                    if (getUpdateItem.IsRectify != true)
                                    {
                                        getUpdateItem.IsRectify = null;
                                    }
                                    db.SubmitChanges();
                                }
                                if (!string.IsNullOrEmpty(rItem.PhotoAfterUrl))
                                {
                                    APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, rItem.RectifyNoticesItemId + "#2", rItem.PhotoAfterUrl, "0");
                                }
                            }
                        }

                        if (!string.IsNullOrEmpty(rectifyNotices.UnitHeadManId))
                        {
                            isUpdate.UnitHeadManId = rectifyNotices.UnitHeadManId;
                            isUpdate.CompleteDate  = DateTime.Now;
                        }
                        else
                        {
                            newRectifyNotices.States = isUpdate.States = "2";
                        }
                        db.SubmitChanges();
                    }
                    else if (newRectifyNotices.States == "4")
                    { /// 施工单位项目负责人不同意 打回施工单位项目安全经理,同意提交安全经理/安全工程师复查
                        if (rectifyNotices.IsAgree == false)
                        {
                            newRectifyNotices.States = isUpdate.States = "2";
                            isUpdate.CompleteDate    = null;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(rectifyNotices.CheckPersonId))
                            {
                                isUpdate.UnitHeadManDate = DateTime.Now;
                                isUpdate.CheckPerson     = rectifyNotices.CheckPersonId;
                            }
                            else
                            {
                                newRectifyNotices.States = isUpdate.States = "3";
                            }
                        }
                        db.SubmitChanges();
                    }
                    else if (newRectifyNotices.States == "5")
                    {
                        //// 整改明细反馈 复查 是否合格
                        if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0)
                        {
                            foreach (var rItem in rectifyNotices.RectifyNoticesItemItem)
                            {
                                var getUpdateItem = db.Check_RectifyNoticesItem.FirstOrDefault(x => x.RectifyNoticesItemId == rItem.RectifyNoticesItemId);
                                if (getUpdateItem != null)
                                {
                                    getUpdateItem.IsRectify = rItem.IsRectify;
                                    db.SubmitChanges();
                                    //// 存在不合格  意见自动不同意
                                    if (!getUpdateItem.IsRectify.HasValue || getUpdateItem.IsRectify == false)
                                    {
                                        rectifyNotices.IsAgree = false;
                                    }
                                }
                            }
                        }

                        ////安全经理/安全工程师 同意关闭,不同意打回施工单位项目安全经理
                        isUpdate.ReCheckOpinion = rectifyNotices.ReCheckOpinion;
                        if (rectifyNotices.IsAgree == false)
                        {
                            newRectifyNotices.States           = isUpdate.States = "2";
                            isUpdate.UnitHeadManDate           = null;
                            isUpdate.CompleteDate              = null;
                            isUpdate.ProfessionalEngineerTime2 = null;
                            isUpdate.ConstructionManagerTime2  = null;
                            isUpdate.ProjectManagerTime2       = null;
                        }
                        else
                        {
                            isUpdate.ReCheckDate = DateTime.Now;
                            //// 回写专项检查明细表
                            var getcheck = from x in db.Check_CheckSpecialDetail where x.DataId == isUpdate.RectifyNoticesId select x;
                            if (getcheck.Count() > 0)
                            {
                                foreach (var item in getcheck)
                                {
                                    item.CompleteStatus = true;
                                    item.CompletedDate  = DateTime.Now;
                                    db.SubmitChanges();
                                }
                            }
                        }
                        db.SubmitChanges();
                    }
                }
                if (insertRectifyNoticesItemItem)
                {
                    //// 新增明细
                    if (rectifyNotices.RectifyNoticesItemItem != null && rectifyNotices.RectifyNoticesItemItem.Count() > 0)
                    {
                        foreach (var rItem in rectifyNotices.RectifyNoticesItemItem)
                        {
                            Model.Check_RectifyNoticesItem newItem = new Model.Check_RectifyNoticesItem
                            {
                                RectifyNoticesItemId = SQLHelper.GetNewID(),
                                RectifyNoticesId     = newRectifyNotices.RectifyNoticesId,
                                WrongContent         = rItem.WrongContent,
                                Requirement          = rItem.Requirement,
                                LimitTime            = Funs.GetNewDateTime(rItem.LimitTime),
                                RectifyResults       = null,
                                IsRectify            = null,
                            };
                            db.Check_RectifyNoticesItem.InsertOnSubmit(newItem);
                            db.SubmitChanges();

                            if (!string.IsNullOrEmpty(rItem.PhotoBeforeUrl))
                            {
                                APIUpLoadFileService.SaveAttachUrl(Const.ProjectRectifyNoticesMenuId, newItem.RectifyNoticesItemId + "#1", rItem.PhotoBeforeUrl, "0");
                            }
                        }
                    }
                }
                //// 增加审核记录
                if (rectifyNotices.RectifyNoticesFlowOperateItem != null && rectifyNotices.RectifyNoticesFlowOperateItem.Count() > 0)
                {
                    var getOperate = rectifyNotices.RectifyNoticesFlowOperateItem.FirstOrDefault();
                    if (getOperate != null && !string.IsNullOrEmpty(getOperate.OperateManId))
                    {
                        Model.Check_RectifyNoticesFlowOperate newOItem = new Model.Check_RectifyNoticesFlowOperate
                        {
                            FlowOperateId    = SQLHelper.GetNewID(),
                            RectifyNoticesId = newRectifyNotices.RectifyNoticesId,
                            OperateName      = getOperate.OperateName,
                            OperateManId     = getOperate.OperateManId,
                            OperateTime      = DateTime.Now,
                            IsAgree          = getOperate.IsAgree,
                            Opinion          = getOperate.Opinion,
                        };
                        db.Check_RectifyNoticesFlowOperate.InsertOnSubmit(newOItem);
                        db.SubmitChanges();
                    }
                }

                if (newRectifyNotices.States == Const.State_1)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.SignPerson, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您签发", rectifyNotices.CheckManNames, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
                else if (newRectifyNotices.States == Const.State_2)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.DutyPersonId, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您整改", rectifyNotices.SignPersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
                else if (newRectifyNotices.States == Const.State_3)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.UnitHeadManId, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您审核", rectifyNotices.DutyPersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
                else if (newRectifyNotices.States == Const.State_4)
                {
                    APICommonService.SendSubscribeMessage(newRectifyNotices.CheckPerson, "隐患整改单" + newRectifyNotices.RectifyNoticesCode + "待您复查", rectifyNotices.UnitHeadManName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///  保存明细项
        /// </summary>
        private void SaveDetail(string type, Model.Check_CheckSpecial checkSpecial)
        {
            List <Model.Check_CheckSpecialDetail> detailLists = new List <Model.Check_CheckSpecialDetail>();
            JArray teamGroupData = Grid1.GetMergedData();

            foreach (JObject teamGroupRow in teamGroupData)
            {
                JObject values = teamGroupRow.Value <JObject>("values");
                Model.Check_CheckSpecialDetail newDetail = new Model.Check_CheckSpecialDetail
                {
                    CheckSpecialDetailId = SQLHelper.GetNewID(),
                    CheckSpecialId       = this.CheckSpecialId,
                    CheckContent         = values.Value <string>("CheckItemName"),
                    Unqualified          = values.Value <string>("Unqualified"),
                    WorkArea             = values.Value <string>("WorkArea"),
                };
                var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == values.Value <string>("UnitName"));
                if (getUnit != null)
                {
                    newDetail.UnitId = getUnit.UnitId;
                }
                var getHandleStep = Funs.DB.Sys_Const.FirstOrDefault(x => x.GroupId == ConstValue.Group_HandleStep && x.ConstText == values.Value <string>("HandleStepStr"));
                if (getHandleStep != null)
                {
                    newDetail.HandleStep = getHandleStep.ConstValue;
                }
                if (values.Value <string>("CompleteStatusName") == "已整改")
                {
                    newDetail.CompleteStatus = true;
                    newDetail.CompletedDate  = DateTime.Now;
                }
                else
                {
                    newDetail.CompleteStatus = false;
                }
                var getCheckItem = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.SupCheckItem == this.drpSupCheckItemSet.SelectedValue && x.CheckItemName == newDetail.CheckContent);
                if (getCheckItem != null)
                {
                    newDetail.CheckItem = getCheckItem.CheckItemSetId;
                }
                Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
                if (type == Const.BtnSubmit)
                {
                    if (newDetail.CompleteStatus == false)
                    {
                        detailLists.Add(newDetail);
                    }
                }
            }

            if (detailLists.Count() > 0)
            {
                ////隐患整改单
                var getDetail1 = detailLists.Where(x => x.HandleStep == "1");
                if (getDetail1.Count() > 0)
                {
                    var getUnitList = getDetail1.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.RectifyNoticesItem rectifyNotices = new Model.RectifyNoticesItem
                        {
                            ProjectId     = checkSpecial.ProjectId,
                            UnitId        = unitItem,
                            CompleteManId = this.CurrUser.UserId,
                            CheckManNames = checkSpecial.PartInPersons,
                            CheckManIds   = checkSpecial.PartInPersonIds,
                            CheckedDate   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            States        = Const.State_0,
                        };
                        rectifyNotices.RectifyNoticesItemItem = new List <Model.RectifyNoticesItemItem>();
                        var getUnitDItem = getDetail1.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            if (!string.IsNullOrEmpty(item.WorkArea))
                            {
                                newRItem.WrongContent = item.WorkArea + item.Unqualified;
                            }
                            else
                            {
                                newRItem.WrongContent = item.Unqualified;
                            }
                            if (string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId))
                            {
                                rectifyNotices.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                rectifyNotices.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                newRItem.PhotoBeforeUrl = getAtt.AttachUrl;
                            }

                            rectifyNotices.RectifyNoticesItemItem.Add(newRItem);
                        }

                        APIRectifyNoticesService.SaveRectifyNotices(rectifyNotices);
                    }
                }
                ///处罚单
                var getDetail2 = detailLists.Where(x => x.HandleStep == "2");
                if (getDetail2.Count() > 0)
                {
                    var getUnitList = getDetail2.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.PunishNoticeItem punishNotice = new Model.PunishNoticeItem
                        {
                            ProjectId        = checkSpecial.ProjectId,
                            PunishNoticeDate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            UnitId           = unitItem,
                            CompileManId     = this.CurrUser.UserId,
                            PunishStates     = Const.State_0,
                        };

                        var getUnitDItem = getDetail2.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            punishNotice.IncentiveReason += item.Unqualified;
                            if (string.IsNullOrEmpty(punishNotice.CheckSpecialDetailId))
                            {
                                punishNotice.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                punishNotice.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                punishNotice.PunishUrl = getAtt.AttachUrl;
                            }
                        }

                        APIPunishNoticeService.SavePunishNotice(punishNotice);
                    }
                }
                ///暂停令
                var getDetail3 = detailLists.Where(x => x.HandleStep == "3");
                if (getDetail3.Count() > 0)
                {
                    var getUnitList = getDetail3.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.PauseNoticeItem pauseNotice = new Model.PauseNoticeItem
                        {
                            ProjectId   = checkSpecial.ProjectId,
                            UnitId      = unitItem,
                            PauseTime   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            PauseStates = Const.State_0,
                        };

                        var getUnitDItem = getDetail3.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            pauseNotice.ThirdContent += item.Unqualified;
                            if (string.IsNullOrEmpty(pauseNotice.ProjectPlace))
                            {
                                pauseNotice.ProjectPlace = item.WorkArea;
                            }
                            else
                            {
                                if (!pauseNotice.ProjectPlace.Contains(item.WorkArea))
                                {
                                    pauseNotice.ProjectPlace += "," + item.WorkArea;
                                }
                            }
                            if (string.IsNullOrEmpty(pauseNotice.CheckSpecialDetailId))
                            {
                                pauseNotice.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                pauseNotice.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                pauseNotice.PauseNoticeAttachUrl = getAtt.AttachUrl;
                            }
                        }

                        APIPauseNoticeService.SavePauseNotice(pauseNotice);
                    }
                }
            }
        }