Пример #1
0
 /// <summary>
 /// 添加安全开工前检查
 /// </summary>
 /// <param name="checkWork"></param>
 public static void AddCheckWork(Model.Check_CheckWork checkWork)
 {
     Model.SUBHSSEDB       db           = Funs.DB;
     Model.Check_CheckWork newCheckWork = new Model.Check_CheckWork
     {
         CheckWorkId        = checkWork.CheckWorkId,
         CheckWorkCode      = checkWork.CheckWorkCode,
         ProjectId          = checkWork.ProjectId,
         Area               = checkWork.Area,
         CheckTime          = checkWork.CheckTime,
         ThisUnitId         = checkWork.ThisUnitId,
         MainUnitPerson     = checkWork.MainUnitPerson,
         SubUnits           = checkWork.SubUnits,
         SubUnitPerson      = checkWork.SubUnitPerson,
         PartInPersonNames  = checkWork.PartInPersonNames,
         MainUnitDeputy     = checkWork.MainUnitDeputy,
         SubUnitDeputy      = checkWork.SubUnitDeputy,
         MainUnitDeputyDate = checkWork.MainUnitDeputyDate,
         SubUnitDeputyDate  = checkWork.SubUnitDeputyDate,
         AttachUrl          = checkWork.AttachUrl,
         IsCompleted        = checkWork.IsCompleted,
         States             = checkWork.States,
         CompileMan         = checkWork.CompileMan,
         IsAgree            = checkWork.IsAgree
     };
     db.Check_CheckWork.InsertOnSubmit(newCheckWork);
     db.SubmitChanges();
     ////增加一条编码记录
     BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckWorkMenuId, checkWork.ProjectId, null, checkWork.CheckWorkId, checkWork.CheckTime);
 }
Пример #2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindGrid()
        {
            string strSql = @"SELECT CheckWork.CheckWorkId,CheckWork.ProjectId,CodeRecords.Code AS CheckWorkCode,Unit.UnitId,CheckWork.Area,CheckWork.CheckTime,CheckWork.IsAgree "
                            + @" ,(CASE WHEN CheckWork.States = " + BLL.Const.State_0 + " OR CheckWork.States IS NULL THEN '待['+OperateUser.UserName+']提交' WHEN CheckWork.States =  " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperateUser.UserName+']办理' END) AS  FlowOperateName"
                            + @" FROM Check_CheckWork AS CheckWork "
                            + @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON CheckWork.CheckWorkId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1"
                            + @" LEFT JOIN Sys_User AS OperateUser ON FlowOperate.OperaterId=OperateUser.UserId "
                            + @" LEFT JOIN Sys_User AS Users ON CheckWork.CompileMan=Users.UserId "
                            + @" LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=Users.UnitId  "
                            + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckWork.CheckWorkId=CodeRecords.DataId WHERE 1=1 ";
            List <SqlParameter> listStr = new List <SqlParameter>();

            strSql += " AND CheckWork.ProjectId = @ProjectId";
            listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));

            if (!string.IsNullOrEmpty(this.txtCheckWorkCode.Text.Trim()))
            {
                strSql += " AND CheckWorkCode LIKE @CheckWorkCode";
                listStr.Add(new SqlParameter("@CheckWorkCode", "%" + this.txtCheckWorkCode.Text.Trim() + "%"));
            }

            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
            {
                strSql += " AND Unit.UnitId = @UnitId";
                listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue.Trim()));
            }
            if (!string.IsNullOrEmpty(this.txtWorkAreaName.Text.Trim()))
            {
                strSql += " AND Area LIKE @WorkAreaName";
                listStr.Add(new SqlParameter("@WorkAreaName", "%" + this.txtWorkAreaName.Text.Trim() + "%"));
            }
            SqlParameter[] parameter = listStr.ToArray();
            DataTable      tb        = SQLHelper.GetDataTableRunText(strSql, parameter);

            // 2.获取当前分页数据
            //var table = this.GetPagedDataTable(Grid1, tb1);

            Grid1.RecordCount = tb.Rows.Count;
            tb = GetFilteredTable(Grid1.FilteredData, tb);
            var table = this.GetPagedDataTable(Grid1, tb);

            Grid1.DataSource = table;
            Grid1.DataBind();
            for (int i = 0; i < Grid1.Rows.Count; i++)
            {
                Model.Check_CheckWork checkWork = BLL.Check_CheckWorkService.GetCheckWorkByCheckWorkId(this.Grid1.DataKeys[i][0].ToString());
                if (checkWork != null)
                {
                    if (checkWork.IsCompleted != true)
                    {
                        Grid1.Rows[i].RowCssClass = "yellow";
                    }
                }
            }
        }
Пример #3
0
 /// <summary>
 /// 修改安全开工前检查
 /// </summary>
 /// <param name="checkWork"></param>
 public static void UpdateCheckWork(Model.Check_CheckWork checkWork)
 {
     Model.SUBHSSEDB       db           = Funs.DB;
     Model.Check_CheckWork newCheckWork = db.Check_CheckWork.FirstOrDefault(e => e.CheckWorkId == checkWork.CheckWorkId);
     if (newCheckWork != null)
     {
         newCheckWork.Area               = checkWork.Area;
         newCheckWork.CheckTime          = checkWork.CheckTime;
         newCheckWork.ThisUnitId         = checkWork.ThisUnitId;
         newCheckWork.MainUnitPerson     = checkWork.MainUnitPerson;
         newCheckWork.SubUnits           = checkWork.SubUnits;
         newCheckWork.SubUnitPerson      = checkWork.SubUnitPerson;
         newCheckWork.PartInPersonNames  = checkWork.PartInPersonNames;
         newCheckWork.MainUnitDeputy     = checkWork.MainUnitDeputy;
         newCheckWork.SubUnitDeputy      = checkWork.SubUnitDeputy;
         newCheckWork.MainUnitDeputyDate = checkWork.MainUnitDeputyDate;
         newCheckWork.SubUnitDeputyDate  = checkWork.SubUnitDeputyDate;
         newCheckWork.AttachUrl          = checkWork.AttachUrl;
         newCheckWork.IsCompleted        = checkWork.IsCompleted;
         newCheckWork.States             = checkWork.States;
         newCheckWork.IsAgree            = checkWork.IsAgree;
         db.SubmitChanges();
     }
 }
Пример #4
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckWork checkWork = new Model.Check_CheckWork
            {
                CheckWorkCode = this.txtCheckWorkCode.Text.Trim(),
                CheckTime     = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()),
                ProjectId     = this.ProjectId,
                Area          = this.txtArea.Text.Trim()
            };
            if (!string.IsNullOrEmpty(this.drpThisUnit.SelectedValue))
            {
                checkWork.ThisUnitId = this.drpThisUnit.SelectedValue;
            }
            //本单位人员
            string mainUnitPerson = string.Empty;

            foreach (var item in this.drpMainUnitPerson.SelectedValueArray)
            {
                mainUnitPerson += item + ",";
            }
            if (!string.IsNullOrEmpty(mainUnitPerson))
            {
                mainUnitPerson = mainUnitPerson.Substring(0, mainUnitPerson.LastIndexOf(","));
            }
            checkWork.MainUnitPerson = mainUnitPerson;
            //参与单位
            string subUnits = string.Empty;

            foreach (var item in this.drpSubUnits.SelectedValueArray)
            {
                subUnits += item + ",";
            }
            if (!string.IsNullOrEmpty(subUnits))
            {
                checkWork.SubUnits = subUnits.Substring(0, subUnits.LastIndexOf(","));
            }

            //参与用户
            string subUnitPerson = string.Empty;

            foreach (var item in this.drpSubUnitPerson.SelectedValueArray)
            {
                if (item != BLL.Const._Null)
                {
                    subUnitPerson += item + ",";
                }
            }
            if (!string.IsNullOrEmpty(subUnitPerson))
            {
                checkWork.SubUnitPerson = subUnitPerson.Substring(0, subUnitPerson.LastIndexOf(","));
            }
            checkWork.PartInPersonNames = this.txtPartInPersonNames.Text.Trim();
            if (this.ckIsAgree.Checked)
            {
                checkWork.IsAgree = true;
            }
            checkWork.MainUnitDeputy     = this.txtMainUnitDeputy.Text.Trim();
            checkWork.MainUnitDeputyDate = Funs.GetNewDateTime(this.txtMainUnitDeputyDate.Text.Trim());
            checkWork.SubUnitDeputy      = this.txtSubUnitDeputy.Text.Trim();
            checkWork.SubUnitDeputyDate  = Funs.GetNewDateTime(this.txtSubUnitDeputyDate.Text.Trim());
            ////单据状态
            checkWork.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                checkWork.States = this.ctlAuditFlow.NextStep;
            }
            if (!string.IsNullOrEmpty(this.CheckWorkId))
            {
                checkWork.CheckWorkId = this.CheckWorkId;
                BLL.Check_CheckWorkService.UpdateCheckWork(checkWork);
                BLL.LogService.AddSys_Log(this.CurrUser, checkWork.CheckWorkCode, checkWork.CheckWorkId, BLL.Const.ProjectCheckWorkMenuId, BLL.Const.BtnAdd);
            }
            else
            {
                checkWork.CheckWorkId = SQLHelper.GetNewID(typeof(Model.Check_CheckWork));
                checkWork.CompileMan  = this.CurrUser.UserId;
                this.CheckWorkId      = checkWork.CheckWorkId;
                BLL.Check_CheckWorkService.AddCheckWork(checkWork);
                BLL.LogService.AddSys_Log(this.CurrUser, checkWork.CheckWorkCode, checkWork.CheckWorkId, BLL.Const.ProjectCheckWorkMenuId, BLL.Const.BtnModify);
            }
            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCheckWorkMenuId, this.CheckWorkId, (type == BLL.Const.BtnSubmit ? true : false), checkWork.Area, "../Check/CheckWorkView.aspx?CheckWorkId={0}");
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        private void SaveNew(bool isWuHuan)
        {
            if (string.IsNullOrEmpty(this.CheckWorkId))
            {
                Model.Check_CheckWork checkWork = new Model.Check_CheckWork
                {
                    CheckWorkId   = SQLHelper.GetNewID(typeof(Model.Check_CheckWork)),
                    CheckWorkCode = this.txtCheckWorkCode.Text.Trim(),
                    CheckTime     = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()),
                    ProjectId     = this.ProjectId,
                    Area          = this.txtArea.Text.Trim()
                };
                if (!string.IsNullOrEmpty(this.drpThisUnit.SelectedValue))
                {
                    checkWork.ThisUnitId = this.drpThisUnit.SelectedValue;
                }
                //本单位人员
                string mainUnitPerson = string.Empty;
                foreach (var item in this.drpMainUnitPerson.SelectedValueArray)
                {
                    mainUnitPerson += item + ",";
                }
                if (!string.IsNullOrEmpty(mainUnitPerson))
                {
                    mainUnitPerson = mainUnitPerson.Substring(0, mainUnitPerson.LastIndexOf(","));
                }
                checkWork.MainUnitPerson = mainUnitPerson;
                //参与单位
                string subUnits = string.Empty;
                foreach (var item in this.drpSubUnits.SelectedValueArray)
                {
                    subUnits += item + ",";
                }
                if (!string.IsNullOrEmpty(subUnits))
                {
                    checkWork.SubUnits = subUnits.Substring(0, subUnits.LastIndexOf(","));
                }
                //参与用户
                string subUnitPerson = string.Empty;
                foreach (var item in this.drpSubUnitPerson.SelectedValueArray)
                {
                    if (item != BLL.Const._Null)
                    {
                        subUnitPerson += item + ",";
                    }
                }
                if (!string.IsNullOrEmpty(subUnitPerson))
                {
                    checkWork.SubUnitPerson = subUnitPerson.Substring(0, subUnitPerson.LastIndexOf(","));
                }

                //if (this.ckbIsCompleted.Checked)
                //{
                //    checkWork.IsCompleted = true;
                //}

                checkWork.PartInPersonNames  = this.txtPartInPersonNames.Text.Trim();
                checkWork.MainUnitDeputy     = this.txtMainUnitDeputy.Text.Trim();
                checkWork.MainUnitDeputyDate = Funs.GetNewDateTime(this.txtMainUnitDeputyDate.Text.Trim());
                checkWork.SubUnitDeputy      = this.txtSubUnitDeputy.Text.Trim();
                checkWork.SubUnitDeputyDate  = Funs.GetNewDateTime(this.txtSubUnitDeputyDate.Text.Trim());
                checkWork.CompileMan         = this.CurrUser.UserId;
                ////单据状态
                checkWork.States = BLL.Const.State_0;
                this.CheckWorkId = checkWork.CheckWorkId;
                if (this.ckIsAgree.Checked)
                {
                    checkWork.IsAgree = true;
                }
                BLL.Check_CheckWorkService.AddCheckWork(checkWork);
                BLL.LogService.AddSys_Log(this.CurrUser, checkWork.CheckWorkCode, checkWork.CheckWorkId, BLL.Const.ProjectCheckWorkMenuId, BLL.Const.BtnAdd);
                if (isWuHuan)
                {
                    checkWorkDetails = (from x in Funs.DB.Check_ProjectCheckItemDetail
                                        join y in Funs.DB.Check_ProjectCheckItemSet on x.CheckItemSetId equals y.CheckItemSetId
                                        where y.ProjectId == this.ProjectId && y.CheckType == "4"
                                        orderby y.SortIndex
                                        select new Model.View_Check_CheckWorkDetail
                    {
                        CheckWorkId = this.CheckWorkId,
                        CheckItem = y.CheckItemSetId,
                        CheckContent = x.CheckContent,
                        CheckItemStr = x.CheckContent,
                        SortIndex = x.SortIndex,
                        CheckResult = "合格",
                    }).ToList();
                    foreach (var item in checkWorkDetails)
                    {
                        Model.Check_CheckWorkDetail detail = new Model.Check_CheckWorkDetail
                        {
                            CheckWorkDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckWorkDetail)),
                            CheckWorkId       = item.CheckWorkId,
                            CheckItem         = item.CheckItem,
                            CheckContent      = item.CheckContent,
                            SortIndex         = item.SortIndex,
                            CheckResult       = item.CheckResult,
                        };

                        BLL.Check_CheckWorkDetailService.AddCheckWorkDetail(detail);
                    }
                }
            }
        }