Exemple #1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public int SaveForm(string keyValue, SaftyCheckDataRecordEntity entity, ref string recid)
 {
     try
     {
         return(service.SaveForm(keyValue, entity, ref recid));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        /// <summary>
        /// 根据检查对象和检查内容名称获取检查内容ID和检查对象ID(中间用逗号分隔,依次为检查内容ID、检查对象ID),当无匹配时返回空字符串
        /// </summary>
        ///  <param name="chkId">检查记录Id</param>
        /// <param name="checkObject">检查对象名称</param>
        /// <param name="checkContent">检查内容名称</param>
        /// <param name="user">当前用户</param>
        /// <returns></returns>
        public string GetCheckContentId(string chkId, string checkObject, string checkContent, Operator user)
        {
            string        id      = "";
            DepartmentBLL deptBll = new DepartmentBLL();

            if (string.IsNullOrWhiteSpace(checkObject) && string.IsNullOrWhiteSpace(checkContent))
            {
                id = GetRecordFromHT(chkId, user);
            }
            else
            {
                string sql = string.Format("select id from BIS_SAFTYCHECKDATADETAILED where recid='{2}' and checkobject='{0}' and checkcontent='{1}'", checkObject.Trim(), checkContent.Trim(), chkId);

                SaftyCheckDataRecordEntity sd = GetEntity(chkId);
                if (sd != null)
                {
                    if (sd.CheckDataType != 1)
                    {
                        sql += string.Format(" and (',' || checkmanid || ',') like '%,{0},%'", user.Account);
                    }
                }
                DataTable dt = deptBll.GetDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    id = dt.Rows[0][0].ToString();
                    DataTable dtItem = deptBll.GetDataTable(string.Format("select id from BIS_SAFTYCONTENT where checkobject='{0}' and detailid='{1}' and recid='{2}'", checkObject.Trim(), id, chkId));
                    if (dtItem.Rows.Count > 0)
                    {
                        id = "";
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(id))
            {
                DataTable dt = deptBll.GetDataTable(string.Format("select checkobjectid from BIS_SAFTYCHECKDATADETAILED where  id='{0}' and recid='{1}'", id, chkId));
                if (dt.Rows.Count > 0)
                {
                    id += "," + dt.Rows[0][0].ToString();
                }
            }
            return(id);
        }
 public ActionResult Make(string keyValue, CheckNoticeEntity sn)
 {
     try
     {
         SaftyCheckDataRecordBLL    srbll  = new SaftyCheckDataRecordBLL();
         SaftyCheckDataRecordEntity entity = srbll.GetEntity(sn.CheckId);
         if (entity != null)
         {
             sn.StartDate = entity.CheckBeginTime;
             sn.EndDate   = entity.CheckEndTime;
         }
         SaftyCheckContentBLL scbll = new SaftyCheckContentBLL();
         scbll.SaveNotice(keyValue, sn);
         return(Success("操作成功"));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
Exemple #4
0
 /// <summary>
 /// 新增日常检查计划
 /// </summary>
 public int addDailySafeCheck(SaftyCheckDataRecordEntity se, Operator user)
 {
     return(service.addDailySafeCheck(se, user));
 }
Exemple #5
0
 public void Save(string keyValue, List <SaftyCheckDataDetailEntity> list, SaftyCheckDataRecordEntity entity, Operator user, string deptCode = "")
 {
     service.Save(keyValue, list, entity, user, deptCode);
 }
        public void Save(string keyValue, List <SaftyCheckDataDetailEntity> list, SaftyCheckDataRecordEntity entity, Operator user, string deptCode = "")
        {
            if (BaseRepository().Insert(list) > 0 && !string.IsNullOrEmpty(deptCode))
            {
                string        sql = "";
                StringBuilder sb  = new StringBuilder();
                foreach (string code in deptCode.Split(','))
                {
                    if (!string.IsNullOrEmpty(code))
                    {
                        sb.AppendFormat("insert into BIS_SAFETYCHECKDEPT(id,recid,deptcode) values('{0}','{1}','{2}');\r\n", Guid.NewGuid().ToString(), list[0].RecID, code);
                    }
                }
                if (sb.Length > 0)
                {
                    sql = string.Format("begin\r\n{0} end\r\n commit;", sb.ToString());
                    BaseRepository().ExecuteBySql(sql);
                }
            }
            string id    = entity.ID;
            string recId = "";

            if (entity.DataType == 1 && entity.IsSubmit == 1)
            {
                SaftyCheckDataRecordService service = new SaftyCheckDataRecordService();
                int j = 0;
                foreach (string deptId in entity.CheckedDepartID.Split(','))
                {
                    SaftyCheckDataRecordEntity sd = new SaftyCheckDataRecordEntity();
                    sd.BelongDept          = new DepartmentService().GetEntity(deptId).EnCode;
                    sd.BelongDeptID        = deptId;
                    sd.CheckBeginTime      = entity.CheckBeginTime;
                    sd.CheckDataRecordName = entity.CheckDataRecordName;
                    sd.CheckDataType       = entity.CheckDataType;

                    sd.CheckDept   = entity.CheckDept;
                    sd.CheckDeptID = entity.CheckDeptID;
                    if (!string.IsNullOrEmpty(entity.CheckDeptCode))
                    {
                        sd.CheckDeptCode = entity.CheckDeptCode.Trim(',');
                    }
                    sd.CheckEndTime     = entity.CheckEndTime;
                    sd.CheckLevel       = entity.CheckLevel;
                    sd.CheckLevelID     = entity.CheckLevelID;
                    sd.CheckMan         = entity.CheckMan;
                    sd.CheckManageMan   = entity.CheckManageMan;
                    sd.CheckManageManID = entity.CheckManageManID;
                    sd.CheckManID       = entity.CheckManID;
                    sd.CheckUserIds     = entity.CheckUserIds;
                    sd.CheckUsers       = entity.CheckUsers;
                    sd.DataType         = entity.DataType;
                    sd.EndDate          = entity.EndDate;
                    sd.ReceiveUserIds   = entity.ReceiveUserIds;
                    sd.ReceiveUsers     = entity.ReceiveUsers;
                    sd.Remark           = entity.Remark;
                    sd.Aim             = entity.Aim;
                    sd.AreaName        = entity.AreaName;
                    sd.StartDate       = entity.StartDate;
                    sd.Status          = 0;
                    sd.ID              = Guid.NewGuid().ToString();
                    sd.CheckedDepartID = deptId;
                    sd.CheckedDepart   = entity.CheckedDepart.Split(',')[j];
                    sd.DutyDept        = sd.BelongDept;
                    sd.DutyUserId      = id;
                    sd.RId             = id;
                    if (user.RoleName.Contains("省级") || user.RoleName.Contains("公司级"))
                    {
                        entity.DutyDept = user.OrganizeCode;
                    }
                    else
                    {
                        entity.DutyDept = sd.BelongDept;
                    }

                    if (service.SaveForm(sd.ID, sd, ref recId) > 0)
                    {
                        string newId = Guid.NewGuid().ToString();
                        BaseRepository().ExecuteBySql(string.Format(@"insert into bis_saftycheckdatadetailed(id,riskname,checkcontent,belongdeptid,belongdept,recid,checkman,checkmanid,checkdataid,checkobject,checkobjectid,checkobjecttype,checkstate,autoid) 
select id || '" + newId + "',t.riskname,t.checkcontent,t.belongdeptid,t.belongdept,'{1}',t.checkman,t.checkmanid,t.checkdataid,t.checkobject,t.checkobjectid,t.checkobjecttype,t.checkstate,autoid from bis_saftycheckdatadetailed t where recid='{0}'", id, sd.ID));

                        newId = new Random().Next(1, 10000).ToString();
                        BaseRepository().ExecuteBySql(string.Format(@"insert into BASE_FILEINFO(fileid,folderid,filename,filepath,filesize,fileextensions,filetype,isshare,recid,DeleteMark,createdate)
select t.fileid || '{2}' || rownum,t.folderid,t.filename,t.filepath,t.filesize,t.fileextensions,t.filetype,t.isshare,'{1}',DeleteMark,createdate from BASE_FILEINFO t where recid='{0}'", id, sd.ID, newId));

                        j++;
                    }
                }
            }
        }