Example #1
0
 protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "click")
     {
         string[] checkSpecialDetail = (Grid1.DataKeys[e.RowIndex][0].ToString()).Split(',');
         if (checkSpecialDetail.Count() > 1)
         {
             var detail = Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialDetailId(checkSpecialDetail[1]);
             if (detail != null)
             {
                 if (detail.DataType == "1")
                 {
                     PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RectifyNoticesView.aspx?RectifyNoticesId={0}", detail.DataId, "查看 - ")));
                 }
                 else if (detail.DataType == "2")
                 {
                     PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PunishNoticeView.aspx?PunishNoticeId={0}", detail.DataId, "查看 - ")));
                 }
                 else if (detail.DataType == "3")
                 {
                     PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PauseNoticeView.aspx?PauseNoticeId={0}", detail.DataId, "查看 - ")));
                 }
             }
         }
     }
 }
Example #2
0
        /// <summary>
        /// 生成隐患整改单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnMenuRectify_Click(object sender, EventArgs e)
        {
            if (Grid1.SelectedRowIndexArray.Length == 0)
            {
                Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
                return;
            }
            string rectifyNoticeCode = string.Empty;
            string CheckSpecialId    = Grid1.SelectedRowID.Split(',')[0];
            var    checkSpecial      = Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(CheckSpecialId);

            if (checkSpecial.States == Const.State_2)
            {
                string CheckSpecialDetailId           = Grid1.SelectedRowID.Split(',')[1];
                Model.Check_CheckSpecialDetail detail = Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialDetailId(CheckSpecialDetailId);
                if (string.IsNullOrEmpty(detail.RectifyNoticeId))
                {
                    Model.Check_RectifyNotices rectifyNotice = new Model.Check_RectifyNotices
                    {
                        RectifyNoticesId   = SQLHelper.GetNewID(typeof(Model.Check_RectifyNotice)),
                        ProjectId          = checkSpecial.ProjectId,
                        UnitId             = detail.UnitId,
                        CheckedDate        = checkSpecial.CheckTime,
                        RectifyNoticesCode = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectRectifyNoticeMenuId, checkSpecial.ProjectId, detail.UnitId),
                        WrongContent       = "开展了专项检查,发现问题及隐患:" + detail.Unqualified + "\n" + detail.Suggestions,
                        SignPerson         = this.CurrUser.UserId,
                        SignDate           = DateTime.Now,
                        States             = Const.State_0,
                    };

                    var workArea = Funs.DB.ProjectData_WorkArea.FirstOrDefault(x => x.ProjectId == checkSpecial.ProjectId && x.WorkAreaName == detail.WorkArea);
                    if (workArea != null)
                    {
                        rectifyNotice.WorkAreaId = workArea.WorkAreaId;
                    }

                    RectifyNoticesService.AddRectifyNotices(rectifyNotice);
                    rectifyNoticeCode      = rectifyNotice.RectifyNoticesCode;
                    detail.RectifyNoticeId = rectifyNotice.RectifyNoticesId;
                    Check_CheckSpecialDetailService.UpdateCheckSpecialDetail(detail);
                }
                if (!string.IsNullOrEmpty(rectifyNoticeCode))
                {
                    Alert.ShowInTop("已生成隐患整改通知单:" + rectifyNoticeCode + "!", MessageBoxIcon.Success);
                }
                else
                {
                    Alert.ShowInTop("隐患整改通知单已存在,请到对应模块进行处理!", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.ShowInTop("该记录尚未审批完成,无法进行操作!", MessageBoxIcon.Warning);
                return;
            }
        }
Example #3
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckSpecial checkSpecial = new Model.Check_CheckSpecial
            {
                CheckSpecialCode = this.txtCheckSpecialCode.Text.Trim(),
                ProjectId        = this.ProjectId
            };

            ///组成员
            string partInPersonIds = string.Empty;
            string partInPersons   = string.Empty;

            foreach (var item in this.drpPartInPersons.SelectedValueArray)
            {
                var user = BLL.UserService.GetUserByUserId(item);
                if (user != null)
                {
                    partInPersonIds += user.UserId + ",";
                    partInPersons   += user.UserName + ",";
                }
            }
            if (!string.IsNullOrEmpty(partInPersonIds))
            {
                checkSpecial.PartInPersonIds = partInPersonIds.Substring(0, partInPersonIds.LastIndexOf(","));
                checkSpecial.PartInPersons   = partInPersons.Substring(0, partInPersons.LastIndexOf(","));
            }

            checkSpecial.PartInPersonNames = this.txtPartInPersonNames.Text.Trim();
            checkSpecial.CheckTime         = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
            ////单据状态
            checkSpecial.States = Const.State_0;
            if (type == Const.BtnSubmit)
            {
                checkSpecial.States = Const.State_1;
            }
            if (!string.IsNullOrEmpty(this.drpSupCheckItemSet.SelectedValue) && this.drpSupCheckItemSet.SelectedValue != Const._Null)
            {
                checkSpecial.CheckItemSetId = this.drpSupCheckItemSet.SelectedValue;
            }
            if (!string.IsNullOrEmpty(this.CheckSpecialId))
            {
                checkSpecial.CheckSpecialId = this.CheckSpecialId;
                Check_CheckSpecialService.UpdateCheckSpecial(checkSpecial);
                LogService.AddSys_Log(this.CurrUser, checkSpecial.CheckSpecialCode, checkSpecial.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId, BLL.Const.BtnModify);
                Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(this.CheckSpecialId);
            }
            else
            {
                checkSpecial.CheckSpecialId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecial));
                this.CheckSpecialId         = checkSpecial.CheckSpecialId;
                checkSpecial.CompileMan     = this.CurrUser.UserId;
                Check_CheckSpecialService.AddCheckSpecial(checkSpecial);
                LogService.AddSys_Log(this.CurrUser, checkSpecial.CheckSpecialCode, checkSpecial.CheckSpecialId, BLL.Const.ProjectCheckSpecialMenuId, BLL.Const.BtnAdd);
            }
            this.SaveDetail(type, checkSpecial);
        }
Example #4
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);
                    }
                }
            }
        }