Beispiel #1
0
 /// <summary>
 /// 保存按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.Params["CheckDayDetailId"]))
     {
         Model.Check_CheckDayDetail detail = BLL.Check_CheckDayDetailService.GetCheckDayDetailByCheckDayDetailId(Request.Params["CheckDayDetailId"]);
         if (detail != null)
         {
             detail.CompleteStatus = true;
             detail.CompletedDate  = Funs.GetNewDateTime(this.txtCompletedDate.Text.Trim());
             BLL.Check_CheckDayDetailService.UpdateCheckDayDetail(detail);
         }
     }
     else if (!string.IsNullOrEmpty(Request.Params["CheckSpecialDetailId"]))
     {
         Model.Check_CheckSpecialDetail detail = BLL.Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialDetailId(Request.Params["CheckSpecialDetailId"]);
         if (detail != null)
         {
             detail.CompleteStatus = true;
             detail.CompletedDate  = Funs.GetNewDateTime(this.txtCompletedDate.Text.Trim());
             BLL.Check_CheckSpecialDetailService.UpdateCheckSpecialDetail(detail);
         }
     }
     else if (!string.IsNullOrEmpty(Request.Params["CheckColligationDetailId"]))
     {
         Model.Check_CheckColligationDetail detail = BLL.Check_CheckColligationDetailService.GetCheckColligationDetailByCheckColligationDetailId(Request.Params["CheckColligationDetailId"]);
         if (detail != null)
         {
             detail.CompleteStatus = true;
             detail.CompletedDate  = Funs.GetNewDateTime(this.txtCompletedDate.Text.Trim());
             BLL.Check_CheckColligationDetailService.UpdateCheckColligationDetail(detail);
         }
     }
     PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 }
Beispiel #2
0
 /// <summary>
 /// 保存按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (this.drpHandleStep.SelectedValue == BLL.Const._Null)
     {
         Alert.ShowInTop("请选择处理措施!", MessageBoxIcon.Warning);
         return;
     }
     Model.Check_CheckSpecialDetail detail = BLL.Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialDetailId(this.CheckSpecialDetailId);
     if (detail != null)
     {
         detail.Unqualified = this.txtUnqualified.Text.Trim();
         detail.Suggestions = this.txtSuggestions.Text.Trim();
         detail.WorkArea    = this.txtWorkArea.Text.Trim();
         if (this.drpUnit.SelectedValue != BLL.Const._Null)
         {
             detail.UnitId = this.drpUnit.SelectedValue;
         }
         if (this.drpHandleStep.SelectedValue != BLL.Const._Null)
         {
             detail.HandleStep = this.drpHandleStep.SelectedValue;
         }
         if (this.txtLimitedDate.Enabled == true)
         {
             detail.LimitedDate = Funs.GetNewDateTime(this.txtLimitedDate.Text.Trim());
         }
         detail.CompleteStatus = Convert.ToBoolean(this.drpCompleteStatus.SelectedValue);
         detail.CheckContent   = this.txtCheckItem.Text.Trim();
         BLL.Check_CheckSpecialDetailService.UpdateCheckSpecialDetail(detail);
     }
     PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 }
Beispiel #3
0
        /// <summary>
        /// 闭环
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCompletedDate_Click(object sender, EventArgs e)
        {
            if (Grid1.SelectedRowIndexArray.Length == 0)
            {
                Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
                return;
            }
            string CheckSpecialId = Grid1.SelectedRowID.Split(',')[0];
            var    checkSpecial   = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(CheckSpecialId);

            if (checkSpecial.States == BLL.Const.State_2)
            {
                string CheckSpecialDetailId           = Grid1.SelectedRowID.Split(',')[1];
                Model.Check_CheckSpecialDetail detail = BLL.Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialDetailId(CheckSpecialDetailId);
                if (detail != null && !detail.CompletedDate.HasValue)
                {
                    PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ShowCompletedDate.aspx?CheckSpecialDetailId={0}", CheckSpecialDetailId), "编辑闭环时间", 400, 250));
                }
                else
                {
                    Alert.ShowInTop("该记录已闭环或不存在明细项!", MessageBoxIcon.Warning);
                    return;
                }
            }
            else
            {
                Alert.ShowInTop("该记录尚未审批完成,无法进行闭环操作!", MessageBoxIcon.Warning);
                return;
            }
        }
Beispiel #4
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;
            }
        }
Beispiel #5
0
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnMenuDel_Click(object sender, EventArgs e)
 {
     if (Grid1.SelectedRowIndexArray.Length > 0)
     {
         foreach (int rowIndex in Grid1.SelectedRowIndexArray)
         {
             string rowID          = Grid1.DataKeys[rowIndex][0].ToString();
             var    RectifyNotices = BLL.RectifyNoticesService.GetRectifyNoticesById(rowID);
             if (RectifyNotices != null)
             {
                 LogService.AddSys_Log(this.CurrUser, RectifyNotices.RectifyNoticesCode, rowID, BLL.Const.ProjectRectifyNoticeMenuId, BLL.Const.BtnDelete);
                 RectifyNoticesService.DeleteRectifyNoticesById(rowID);
                 Model.Check_CheckDayDetail dayDetail = (from x in Funs.DB.Check_CheckDayDetail
                                                         where x.RectifyNoticeId == rowID
                                                         select x).FirstOrDefault();
                 Model.Check_CheckSpecialDetail specialDetail = (from x in Funs.DB.Check_CheckSpecialDetail
                                                                 where x.RectifyNoticeId == rowID
                                                                 select x).FirstOrDefault();
                 Model.Check_CheckColligationDetail colligationDetail = (from x in Funs.DB.Check_CheckColligationDetail
                                                                         where x.RectifyNoticeId == rowID
                                                                         select x).FirstOrDefault();
                 if (dayDetail != null)
                 {
                     dayDetail.RectifyNoticeId = null;
                     Funs.DB.SubmitChanges();
                 }
                 else if (specialDetail != null)
                 {
                     specialDetail.RectifyNoticeId = null;
                     Funs.DB.SubmitChanges();
                 }
                 else if (colligationDetail != null)
                 {
                     colligationDetail.RectifyNoticeId = null;
                     Funs.DB.SubmitChanges();
                 }
             }
         }
         BindGrid();
         ShowNotify("删除数据成功!(表格数据已重新绑定)");
     }
 }
Beispiel #6
0
        /// <summary>
        /// 修改专项检查明细信息
        /// </summary>
        /// <param name="CheckSpecialDetail"></param>
        public static void UpdateCheckSpecialDetail(Model.Check_CheckSpecialDetail CheckSpecialDetail)
        {
            Model.SUBHSSEDB db = Funs.DB;
            var             newCheckSpecialDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == CheckSpecialDetail.CheckSpecialDetailId);

            if (newCheckSpecialDetail != null)
            {
                newCheckSpecialDetail.Unqualified     = CheckSpecialDetail.Unqualified;
                newCheckSpecialDetail.CheckArea       = CheckSpecialDetail.CheckArea;
                newCheckSpecialDetail.UnitId          = CheckSpecialDetail.UnitId;
                newCheckSpecialDetail.HandleStep      = CheckSpecialDetail.HandleStep;
                newCheckSpecialDetail.CompleteStatus  = CheckSpecialDetail.CompleteStatus;
                newCheckSpecialDetail.RectifyNoticeId = CheckSpecialDetail.RectifyNoticeId;
                newCheckSpecialDetail.LimitedDate     = CheckSpecialDetail.LimitedDate;
                newCheckSpecialDetail.CompletedDate   = CheckSpecialDetail.CompletedDate;
                newCheckSpecialDetail.Suggestions     = CheckSpecialDetail.Suggestions;
                newCheckSpecialDetail.WorkArea        = CheckSpecialDetail.WorkArea;
                newCheckSpecialDetail.CheckContent    = CheckSpecialDetail.CheckContent;
                db.SubmitChanges();
            }
        }
        /// <summary>
        /// 根据隐患通知单ID删除所有隐患通知单明细信息
        /// </summary>
        /// <param name="rectifyNoticeId"></param>
        public static void DeleteRectifyNoticeDetails(string rectifyNoticeId)
        {
            Model.SUBHSSEDB db = Funs.DB;
            var             q  = (from x in db.Check_RectifyNoticeDetail where x.RectifyNoticeId == rectifyNoticeId select x).ToList();

            if (q != null)
            {
                foreach (var item in q)
                {
                    ////删除附件表
                    BLL.CommonService.DeleteAttachFileById(item.RectifyNoticeDetailId);
                    Model.Check_CheckDayDetail dayDetail = BLL.Check_CheckDayDetailService.GetCheckDayDetailByCheckDayDetailId(item.RectifyNoticeDetailId);
                    if (dayDetail != null)
                    {
                        dayDetail.RectifyNoticeId = null;
                        BLL.Check_CheckDayDetailService.UpdateCheckDayDetail(dayDetail);
                    }
                    else
                    {
                        Model.Check_CheckSpecialDetail specialDetail = BLL.Check_CheckSpecialDetailService.GetCheckSpecialDetailByCheckSpecialDetailId(item.RectifyNoticeDetailId);
                        if (specialDetail != null)
                        {
                            specialDetail.RectifyNoticeId = null;
                            BLL.Check_CheckSpecialDetailService.UpdateCheckSpecialDetail(specialDetail);
                        }
                        else
                        {
                            Model.Check_CheckColligationDetail colligationDetail = BLL.Check_CheckColligationDetailService.GetCheckColligationDetailByCheckColligationDetailId(item.RectifyNoticeDetailId);
                            if (colligationDetail != null)
                            {
                                colligationDetail.RectifyNoticeId = null;
                                BLL.Check_CheckColligationDetailService.UpdateCheckColligationDetail(colligationDetail);
                            }
                        }
                    }
                }
                db.Check_RectifyNoticeDetail.DeleteAllOnSubmit(q);
                db.SubmitChanges();
            }
        }
Beispiel #8
0
 /// <summary>
 /// 增加专项检查明细信息
 /// </summary>
 /// <param name="CheckSpecialDetail"></param>
 public static void AddCheckSpecialDetail(Model.Check_CheckSpecialDetail CheckSpecialDetail)
 {
     Model.SUBHSSEDB db = Funs.DB;
     Model.Check_CheckSpecialDetail newCheckSpecialDetail = new Model.Check_CheckSpecialDetail
     {
         CheckSpecialDetailId = CheckSpecialDetail.CheckSpecialDetailId,
         CheckSpecialId       = CheckSpecialDetail.CheckSpecialId,
         CheckItem            = CheckSpecialDetail.CheckItem,
         CheckItemType        = CheckSpecialDetail.CheckItemType,
         Unqualified          = CheckSpecialDetail.Unqualified,
         CheckArea            = CheckSpecialDetail.CheckArea,
         UnitId          = CheckSpecialDetail.UnitId,
         HandleStep      = CheckSpecialDetail.HandleStep,
         CompleteStatus  = CheckSpecialDetail.CompleteStatus,
         RectifyNoticeId = CheckSpecialDetail.RectifyNoticeId,
         LimitedDate     = CheckSpecialDetail.LimitedDate,
         CompletedDate   = CheckSpecialDetail.CompletedDate,
         Suggestions     = CheckSpecialDetail.Suggestions,
         WorkArea        = CheckSpecialDetail.WorkArea,
         CheckContent    = CheckSpecialDetail.CheckContent
     };
     db.Check_CheckSpecialDetail.InsertOnSubmit(newCheckSpecialDetail);
     db.SubmitChanges();
 }
        /// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集行数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds)
        {
            string results = string.Empty;
            int    ir      = pds.Rows.Count;

            if (pds != null && ir > 0)
            {
                var getCheckSpecial = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(this.CheckSpecialId);
                if (getCheckSpecial != null)
                {
                    var units     = from x in Funs.DB.Base_Unit select x;
                    var sysConsts = from x in Funs.DB.Sys_Const
                                    where x.GroupId == BLL.ConstValue.Group_HandleStep
                                    select x;
                    var supCheckSets = from x in Funs.DB.Check_ProjectCheckItemSet
                                       where x.ProjectId == this.CurrUser.LoginProjectId && x.SupCheckItem == "0" && x.CheckType == "2"
                                       select x;
                    for (int i = 0; i < ir; i++)
                    {
                        string result = string.Empty;
                        string col0   = pds.Rows[i][0].ToString().Trim();
                        string col1   = pds.Rows[i][1].ToString().Trim();
                        string col2   = pds.Rows[i][2].ToString().Trim();
                        string col3   = pds.Rows[i][3].ToString().Trim();
                        string col4   = pds.Rows[i][4].ToString().Trim();
                        string col5   = pds.Rows[i][5].ToString().Trim();
                        string col6   = pds.Rows[i][6].ToString().Trim();
                        string col7   = pds.Rows[i][7].ToString().Trim();
                        string col8   = pds.Rows[i][8].ToString().Trim();

                        if (!string.IsNullOrEmpty(col0) || !string.IsNullOrEmpty(col1))
                        {
                            if (string.IsNullOrEmpty(col4) || string.IsNullOrEmpty(col5) || string.IsNullOrEmpty(col6))
                            {
                                result += "第" + (i + 2).ToString() + "行," + "必填项为空!" + "|";
                            }
                            else
                            {
                                Model.View_Check_CheckSpecialDetail newViewDetail = new Model.View_Check_CheckSpecialDetail
                                {
                                    CheckSpecialDetailId = SQLHelper.GetNewID(typeof(Model.View_EduTrain_TrainRecordDetail)),
                                    CheckSpecialId       = getCheckSpecial.CheckSpecialId,
                                    CheckContent         = col1,
                                    Unqualified          = col2,
                                    Suggestions          = col3,
                                    WorkArea             = col4,
                                    LimitedDate          = Funs.GetNewDateTime(col7),
                                };

                                var checkName = supCheckSets.FirstOrDefault(x => x.CheckItemName == col0);
                                if (checkName != null)
                                {
                                    newViewDetail.CheckItem    = checkName.CheckItemSetId;
                                    newViewDetail.CheckItemStr = checkName.CheckItemName;
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "项目检查项中不存在!" + "|";
                                }

                                var unit = units.FirstOrDefault(x => x.UnitName == col5);
                                if (unit != null)
                                {
                                    newViewDetail.UnitId   = unit.UnitId;
                                    newViewDetail.UnitName = unit.UnitName;
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "单位表中不存在!" + "|";
                                }

                                var sysConst = sysConsts.FirstOrDefault(x => x.ConstText == col6);
                                if (sysConst != null)
                                {
                                    newViewDetail.HandleStepStr = sysConst.ConstText;
                                    newViewDetail.HandleStep    = sysConst.ConstValue;
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "常量表中不存在!" + "|";
                                }

                                newViewDetail.CompleteStatusName = col8;
                                if (col8 == "是")
                                {
                                    newViewDetail.CompleteStatus = true;
                                }
                                else
                                {
                                    newViewDetail.CompleteStatus = false;
                                }

                                ///判断是否已存在
                                var addItem = Funs.DB.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialId == newViewDetail.CheckSpecialId && x.CheckContent == newViewDetail.CheckContent &&
                                                                                              x.CheckItem == newViewDetail.CheckItem && x.WorkArea == newViewDetail.WorkArea && x.UnitId == newViewDetail.UnitId);
                                if (addItem == null)
                                {
                                    if (string.IsNullOrEmpty(result))
                                    {
                                        Model.Check_CheckSpecialDetail newDetail = new Model.Check_CheckSpecialDetail
                                        {
                                            CheckSpecialDetailId = newViewDetail.CheckSpecialDetailId,
                                            CheckSpecialId       = newViewDetail.CheckSpecialId,
                                            CheckItem            = newViewDetail.CheckItem,
                                            Unqualified          = newViewDetail.Unqualified,
                                            UnitId         = newViewDetail.UnitId,
                                            HandleStep     = newViewDetail.HandleStep,
                                            CompleteStatus = newViewDetail.CompleteStatus,
                                            LimitedDate    = newViewDetail.LimitedDate,
                                            Suggestions    = newViewDetail.Suggestions,
                                            CheckContent   = newViewDetail.CheckContent,
                                            WorkArea       = newViewDetail.WorkArea,
                                        };

                                        BLL.Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
                                        ///加入
                                        viewDetails.Add(newViewDetail);
                                    }
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "导入数据重复" + "|";
                                }


                                if (!string.IsNullOrEmpty(result))
                                {
                                    results += result;
                                }
                            }
                        }
                    }
                    if (viewDetails.Count > 0)
                    {
                        viewDetails           = viewDetails.Distinct().ToList();
                        this.Grid1.Hidden     = false;
                        this.Grid1.DataSource = viewDetails;
                        this.Grid1.DataBind();
                    }

                    if (!string.IsNullOrEmpty(results))
                    {
                        viewDetails.Clear();
                        results    = "数据导入完成,未成功数据:" + results.Substring(0, results.LastIndexOf("|"));
                        errorInfos = results;
                        Alert alert = new Alert
                        {
                            Message = results,
                            Target  = Target.Self
                        };
                        alert.Show();
                    }
                    else
                    {
                        errorInfos = string.Empty;
                        ShowNotify("导入成功!", MessageBoxIcon.Success);
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                }
                else
                {
                    Alert.ShowInTop("培训数据为空!", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning);
            }

            BLL.UploadFileService.DeleteFile(Funs.RootPath, initPath + this.hdFileName.Text);
            return(true);
        }
Beispiel #10
0
        /// <summary>
        ///  保存专项检查明细项
        /// </summary>
        /// <param name="newDetail"></param>
        public static void SaveCheckSpecialDetail(Model.CheckSpecialDetailItem newDetail)
        {
            if (!string.IsNullOrEmpty(newDetail.CheckSpecialId))
            {
                Model.Check_CheckSpecialDetail newCheckSpecialDetail = new Model.Check_CheckSpecialDetail
                {
                    CheckSpecialId  = newDetail.CheckSpecialId,
                    CheckItem       = newDetail.CheckItemSetId,
                    CheckItemType   = newDetail.CheckItemSetName,
                    Unqualified     = newDetail.Unqualified,
                    UnitId          = newDetail.UnitId,
                    HandleStep      = newDetail.HandleStep,
                    CompleteStatus  = newDetail.CompleteStatus,
                    RectifyNoticeId = newDetail.RectifyNoticeId,
                    LimitedDate     = Funs.GetNewDateTime(newDetail.LimitedDate),
                    CompletedDate   = Funs.GetNewDateTime(newDetail.CompletedDate),
                    Suggestions     = newDetail.Suggestions,
                    WorkArea        = newDetail.WorkArea,
                    CheckArea       = newDetail.WorkAreaId,
                    CheckContent    = newDetail.CheckContent,
                };
                var getUnit = UnitService.GetUnitByUnitId(newDetail.UnitId);
                if (getUnit != null)
                {
                    newCheckSpecialDetail.UnitId = newDetail.UnitId;
                }

                var updateDetail = Funs.DB.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == newDetail.CheckSpecialDetailId);
                if (updateDetail == null)
                {
                    newCheckSpecialDetail.CheckSpecialDetailId = SQLHelper.GetNewID();
                    Funs.DB.Check_CheckSpecialDetail.InsertOnSubmit(newCheckSpecialDetail);
                    Funs.DB.SubmitChanges();
                }
                else
                {
                    newCheckSpecialDetail.CheckSpecialDetailId = updateDetail.CheckSpecialDetailId;
                    updateDetail.CheckItem       = newCheckSpecialDetail.CheckItem;
                    updateDetail.CheckItemType   = newCheckSpecialDetail.CheckItemType;
                    updateDetail.Unqualified     = newCheckSpecialDetail.Unqualified;
                    updateDetail.UnitId          = newCheckSpecialDetail.UnitId;
                    updateDetail.HandleStep      = newCheckSpecialDetail.HandleStep;
                    updateDetail.CompleteStatus  = newCheckSpecialDetail.CompleteStatus;
                    updateDetail.RectifyNoticeId = newCheckSpecialDetail.RectifyNoticeId;
                    updateDetail.LimitedDate     = newCheckSpecialDetail.LimitedDate;
                    updateDetail.CompletedDate   = newCheckSpecialDetail.CompletedDate;
                    updateDetail.Suggestions     = newCheckSpecialDetail.Suggestions;
                    updateDetail.WorkArea        = newCheckSpecialDetail.WorkArea;
                    updateDetail.CheckContent    = newCheckSpecialDetail.CheckContent;
                    Funs.DB.SubmitChanges();
                }
                ////保存附件
                if (!string.IsNullOrEmpty(newDetail.AttachUrl1))
                {
                    UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newDetail.AttachUrl1, 10, null), newDetail.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecialDetail.CheckSpecialDetailId);
                }
                else
                {
                    CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecialDetail.CheckSpecialDetailId);
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 确认按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <string> newParentIds = new List <string>();

            TreeNode[] nodes = this.tvCheckItemSet.GetCheckedNodes();
            foreach (var item in nodes)
            {
                if (item.Nodes.Count == 0)
                {
                    parentIds.Add(item.NodeID);   //集合中增加末级节点
                    if (item.ParentNode != null)
                    {
                        newParentIds.Add(item.ParentNode.NodeID);    //记录已增加的末级节点的父级节点集合
                    }
                }
            }
            foreach (var item in nodes)
            {
                if (item.Nodes.Count > 0)
                {
                    if (!newParentIds.Contains(item.NodeID))
                    {
                        parentIds.Add(item.NodeID);
                    }
                }
            }
            if (parentIds.Count == 0 && list.Count == 0)
            {
                ShowNotify("请至少选择一项!", MessageBoxIcon.Warning);
                return;
            }
            if (!string.IsNullOrEmpty(Request.Params["CheckDayId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckDayDetail detail = new Model.Check_CheckDayDetail
                    {
                        CheckDayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckDayDetail)),
                        CheckDayId       = Request.Params["CheckDayId"],
                        CheckItem        = item
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckDayDetailService.AddCheckDayDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckSpecialId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckSpecialDetail detail = new Model.Check_CheckSpecialDetail
                    {
                        CheckSpecialDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecialDetail)),
                        CheckSpecialId       = Request.Params["CheckSpecialId"],
                        CheckItem            = item
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckSpecialDetailService.AddCheckSpecialDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckColligationId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckColligationDetail detail = new Model.Check_CheckColligationDetail
                    {
                        CheckColligationDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckColligationDetail)),
                        CheckColligationId       = Request.Params["CheckColligationId"],
                        CheckItem = item
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckColligationDetailService.AddCheckColligationDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckWorkId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckWorkDetail detail = new Model.Check_CheckWorkDetail
                    {
                        CheckWorkDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckWorkDetail)),
                        CheckWorkId       = Request.Params["CheckWorkId"],
                        CheckItem         = item,
                        CheckResult       = "合格",
                    };

                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                        detail.SortIndex    = checkItemDetail.SortIndex;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                            detail.SortIndex    = projectCheckItemDetail.SortIndex;
                        }
                    }
                    BLL.Check_CheckWorkDetailService.AddCheckWorkDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckHolidayId"]))
            {
                foreach (var item in parentIds)
                {
                    Model.Check_CheckHolidayDetail detail = new Model.Check_CheckHolidayDetail
                    {
                        CheckHolidayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckHolidayDetail)),
                        CheckHolidayId       = Request.Params["CheckHolidayId"],
                        CheckItem            = item,
                        CheckResult          = "合格",
                    };
                    Model.Check_ProjectCheckItemDetail checkItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                    if (checkItemDetail != null)
                    {
                        detail.CheckContent = checkItemDetail.CheckContent;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }

                    BLL.Check_CheckHolidayDetailService.AddCheckHolidayDetail(detail);
                }
            }

            if (!string.IsNullOrEmpty(Request.Params["CheckDayId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckDayDetail detail = new Model.Check_CheckDayDetail
                    {
                        CheckDayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckDayDetail)),
                        CheckDayId       = Request.Params["CheckDayId"],
                        CheckItem        = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckDayDetailService.AddCheckDayDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckSpecialId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckSpecialDetail detail = new Model.Check_CheckSpecialDetail
                    {
                        CheckSpecialDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckSpecialDetail)),
                        CheckSpecialId       = Request.Params["CheckSpecialId"],
                        CheckItem            = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckSpecialDetailService.AddCheckSpecialDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckColligationId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckColligationDetail detail = new Model.Check_CheckColligationDetail
                    {
                        CheckColligationDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckColligationDetail)),
                        CheckColligationId       = Request.Params["CheckColligationId"],
                        CheckItem = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.Unqualified    = "隐患";
                    detail.Suggestions    = "整改";
                    detail.CompleteStatus = true;
                    BLL.Check_CheckColligationDetailService.AddCheckColligationDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckWorkId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckWorkDetail detail = new Model.Check_CheckWorkDetail
                    {
                        CheckWorkDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckWorkDetail)),
                        CheckWorkId       = Request.Params["CheckWorkId"],
                        CheckItem         = item
                    };
                    var checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    else
                    {
                        var projectCheckItemDetail = BLL.Check_ProjectCheckItemDetailService.GetCheckItemDetailById(item);
                        if (projectCheckItemDetail != null)
                        {
                            detail.CheckContent = projectCheckItemDetail.CheckContent;
                        }
                    }
                    detail.CheckResult  = "合格";
                    detail.CheckOpinion = "整改";
                    BLL.Check_CheckWorkDetailService.AddCheckWorkDetail(detail);
                }
            }
            else if (!string.IsNullOrEmpty(Request.Params["CheckHolidayId"]))
            {
                foreach (var item in list)
                {
                    Model.Check_CheckHolidayDetail detail = new Model.Check_CheckHolidayDetail
                    {
                        CheckHolidayDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckHolidayDetail)),
                        CheckHolidayId       = Request.Params["CheckHolidayId"],
                        CheckItem            = item
                    };
                    Model.Check_ProjectCheckItemSet checkItemSet = BLL.Check_ProjectCheckItemSetService.GetCheckItemSetById(item);
                    if (checkItemSet != null)
                    {
                        detail.CheckContent = checkItemSet.CheckItemName;
                    }
                    detail.CheckResult  = "合格";
                    detail.CheckOpinion = "整改";
                    BLL.Check_CheckHolidayDetailService.AddCheckHolidayDetail(detail);
                }
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
Beispiel #12
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);
                    }
                }
            }
        }