Exemple #1
0
        /// <summary>
        /// 调用摄像头门卫录入拜访人脸照片
        /// </summary>
        /// <param name="keyValue"></param>
        /// <returns></returns>
        public void SaveFileImgForm(CarUserFileImgEntity entity)
        {
            Repository <CarUserFileImgEntity> inlogdb = new Repository <CarUserFileImgEntity>(DbFactory.Base());
            CarUserFileImgEntity old = inlogdb.FindEntity(entity.ID);

            if (old != null)
            {
                if (string.IsNullOrEmpty(old.Userimg))
                {//人脸信息未录入
                    #region 获取海康地址和秘钥
                    DataItemDetailService data = new DataItemDetailService();
                    var    pitem     = data.GetItemValue("Hikappkey");  //海康服务器密钥
                    var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康服务器地址
                    string Key       = string.Empty;
                    string Signature = string.Empty;
                    if (!string.IsNullOrEmpty(pitem))
                    {
                        Key       = pitem.Split('|')[0];
                        Signature = pitem.Split('|')[1];
                    }
                    #endregion
                    FacedataEntity        face     = new FacedataEntity();
                    List <FacedataEntity> FaceList = new List <FacedataEntity>();
                    face.UserId  = old.ID;
                    face.ImgData = entity.Imgdata;
                    FaceList.Add(face);
                    SocketHelper.UploadFace(FaceList, baseurl, Key, Signature);
                }
                old.Userimg = entity.Userimg;
                old.Imgdata = entity.Imgdata;
                inlogdb.Update(old);
            }
        }
Exemple #2
0
        /// <summary>
        /// 单个添加人脸
        /// </summary>
        public void SaveSingleFace(TemporaryUserEntity insert)
        {
            DataItemDetailService data = new DataItemDetailService();
            var    pitem     = data.GetItemValue("Hikappkey");  //密钥
            var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
            string Key       = string.Empty;
            string Signature = string.Empty;
            string url       = "/artemis/api/resource/v1/face/single/add";

            if (!string.IsNullOrEmpty(pitem))
            {
                Key       = pitem.Split('|')[0];
                Signature = pitem.Split('|')[1];
            }

            var model = new
            {
                personId = insert.USERID,
                faceData = insert.ImgData
            };

            HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseurl, 443, true);
            byte[] result = HttpUtillibKbs.HttpPost(url, JsonConvert.SerializeObject(model), 20);
            //string msg = System.Text.Encoding.UTF8.GetString(result);

            //string msg = SocketHelper.LoadCameraList(model, baseurl, url, Key, Signature);
        }
Exemple #3
0
 /// <summary>
 /// 离场或拒绝入场删除海康平台人员信息
 /// </summary>
 /// <param name="list">离厂人员</param>
 /// <param name="type">0拒绝入场 1人员离厂</param>
 public void DeleteUserHiK(List <CarUserFileImgEntity> list, int type = 0)
 {
     if (list.Count > 0)
     {
         DataItemDetailService data = new DataItemDetailService();
         var    pitem     = data.GetItemValue("Hikappkey");  //海康服务器密钥
         var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康服务器地址
         string Key       = string.Empty;
         string Signature = string.Empty;
         if (!string.IsNullOrEmpty(pitem))
         {
             Key       = pitem.Split('|')[0];
             Signature = pitem.Split('|')[1];
         }
         string        Url     = "/artemis/api/resource/v1/person/batch/delete";//接口地址
         List <string> dellist = new List <string>();
         foreach (var item in list)
         {
             dellist.Add(item.ID);
         }
         if (type == 1)
         {
             DeleteUserlimits(list, baseurl, Key, Signature);
         }
         ;
         var model = new
         {
             personIds = dellist
         };
         SocketHelper.LoadCameraList(model, baseurl, Url, Key, Signature);
     }
 }
Exemple #4
0
        /// <summary>
        /// 将临时人员信息上传到海康平台
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        public AddJurisdictionEntity InsertTempUserHiK(TemporaryUserEntity entity, List <TemporaryUserEntity> list)
        {
            DataItemDetailService data = new DataItemDetailService();
            var    pitem     = data.GetItemValue("Hikappkey");  //密钥
            var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
            string Key       = string.Empty;
            string Signature = string.Empty;
            string no        = new Random().Next(10, 888888).ToString();

            if (!string.IsNullOrEmpty(pitem))
            {
                Key       = pitem.Split('|')[0];
                Signature = pitem.Split('|')[1];
            }
            string Url = "/artemis/api/resource/v1/person/single/add";

            foreach (var item in list)
            {
                //人脸信息(base64必须为jpg格式)
                List <FaceEntity> faces = new List <FaceEntity>();
                FaceEntity        face  = new FaceEntity();
                face.faceData = item.ImgData;
                faces.Add(face);
                string orgcode = "root000000";
                if (item.Istemporary == 0)
                {
                    orgcode = item.Groupsid;
                }
                var model = new
                {
                    personId        = item.USERID,
                    personName      = item.UserName,
                    gender          = "1",
                    orgIndexCode    = orgcode,
                    birthday        = "1990-01-01",
                    phoneNo         = item.Tel,
                    email           = "*****@*****.**",
                    certificateType = "990",
                    certificateNo   = no,
                    jobNo           = item.Tel,
                    faces
                };
                //string msg = SocketHelper.LoadCameraList(model, baseurl, Url, Key, Signature);
                HttpUtillibKbs.SetPlatformInfo(Key, Signature, baseurl, 443, true);
                byte[] result = HttpUtillibKbs.HttpPost(Url, JsonConvert.SerializeObject(model), 20);
                if (result != null)
                {
                    string    msg = System.Text.Encoding.UTF8.GetString(result);
                    parkList1 pl  = JsonConvert.DeserializeObject <parkList1>(msg);
                    if (pl != null && pl.code == "0")
                    {
                        SetLoadUserCarNo(item, baseurl, Key, Signature);
                    }
                }
            }
            //添加权限
            return(UploadUserlimits(list, baseurl, Key, Signature));
        }
Exemple #5
0
        /// <summary>
        /// 批量权限设置
        /// </summary>
        /// <param name="list"></param>
        public List <AddJurisdictionEntity> SaveCycle(List <TemporaryUserEntity> list)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();

            try
            {
                List <TemporaryUserEntity>       list1      = new List <TemporaryUserEntity>();
                List <TemporaryUserEntity>       addlist    = new List <TemporaryUserEntity>();
                List <TemporaryUserEntity>       updatelist = new List <TemporaryUserEntity>();
                Repository <TemporaryUserEntity> inlogdb    = new Repository <TemporaryUserEntity>(DbFactory.Base());
                DataItemDetailService            data       = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                foreach (var entity in list)
                {
                    TemporaryUserEntity old = inlogdb.FindEntity(entity.USERID);
                    if (old != null)
                    {
                        old.EndTime   = entity.EndTime;
                        old.startTime = entity.startTime;
                        if (old.Istemporary == 0 && string.IsNullOrEmpty(old.PassPost))
                        {//添加权限
                            old.PassPost = entity.PassPost;
                            addlist.Add(old);
                        }
                        else
                        {//更改权限
                            updatelist.Add(old);
                            old.PassPost = entity.PassPost;
                        }
                        list1.Add(old);
                    }
                }
                SetLoadUserCarNo1(addlist, baseurl, Key, Signature);
                var delEntity = DelEquipmentRecord(updatelist, baseurl, Key, Signature);
                var addEntity = UploadUserlimits(list1, baseurl, Key, Signature);
                taskIds.Add(delEntity); //删除权限集
                taskIds.Add(addEntity); //添加权限集

                res.Update <TemporaryUserEntity>(list1);
                res.Commit();
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
Exemple #6
0
        /// <summary>
        /// 加入禁入名单
        /// </summary>
        /// <param name="list"></param>
        public List <AddJurisdictionEntity> SaveForbidden(List <TemporaryUserEntity> list)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();

            try
            {
                Repository <TemporaryUserEntity>   inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
                Repository <ForbiddenRecordEntity> Frecord = new Repository <ForbiddenRecordEntity>(DbFactory.Base());
                DataItemDetailService data = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                List <TemporaryUserEntity>   list1 = new List <TemporaryUserEntity>();
                List <ForbiddenRecordEntity> list2 = new List <ForbiddenRecordEntity>();
                foreach (var entity in list)
                {
                    TemporaryUserEntity old = inlogdb.FindEntity(entity.USERID);
                    if (old != null)
                    {
                        old.ISDebar = 1;
                        old.Remark  = entity.Remark;
                        list1.Add(old);
                        //禁入记录
                        ForbiddenRecordEntity RecordEntity = new ForbiddenRecordEntity();
                        RecordEntity.Create();
                        RecordEntity.StartTime = DateTime.Now;
                        RecordEntity.Remark    = entity.Remark;
                        RecordEntity.UserId    = old.USERID;
                        list2.Add(RecordEntity);
                    }
                }
                res.Update <TemporaryUserEntity>(list1);
                res.Insert <ForbiddenRecordEntity>(list2);
                res.Commit();
                if (list1.Count > 0)
                {
                    list1.ForEach(a => a.EndTime = DateTime.Now.AddDays(-1));
                }
                ;
                var Invalidentity = UploadUserlimits(list1, baseurl, Key, Signature);
                taskIds.Add(Invalidentity);
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
Exemple #7
0
        /// <summary>
        /// 单条记录授权或重新授权
        /// </summary>
        /// <param name="entity1"></param>
        /// <param name="keyValue"></param>
        /// <param name="Power">是否受过权 true 更改权限 false 添加权限</param>
        public List <AddJurisdictionEntity> SaveUserFace(TemporaryUserEntity entity1, string keyValue, bool Power)
        {
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();
            var res = DbFactory.Base().BeginTrans();

            try
            {
                DataItemDetailService data = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                Repository <TemporaryUserEntity> inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
                TemporaryUserEntity entity = inlogdb.FindEntity(keyValue);
                if (entity != null)
                {
                    List <TemporaryUserEntity> dellist = new List <TemporaryUserEntity>();
                    dellist.Add(entity);
                    entity.UserImg    = entity1.UserImg;
                    entity.ImgData    = entity1.ImgData;
                    entity.PassPost   = entity1.PassPost;
                    entity.PassPostId = entity1.PassPostId;
                    entity.startTime  = entity1.startTime;
                    entity.EndTime    = entity1.EndTime;
                    res.Update(entity);
                    res.Commit();
                    List <TemporaryUserEntity> list = new List <TemporaryUserEntity>();
                    list.Add(entity);
                    if (Power)
                    {     //更改权限
                        if (entity1.Remark == "1")
                        { //更换人脸(仅用于页面状态临时判断)
                            string msg = UpdateHumanFace(entity, baseurl, Key, Signature);
                        }
                        var delEntity = DelEquipmentRecord(dellist, baseurl, Key, Signature);
                        taskIds.Add(delEntity);//删除权限集
                    }
                    else
                    {//添加权限
                        SetLoadUserCarNo(entity, baseurl, Key, Signature);
                    }
                    var addEntity = UploadUserlimits(list, baseurl, Key, Signature);
                    taskIds.Add(addEntity);//添加权限集
                }
            }
            catch (Exception)
            {
                res.Rollback();
            }
            return(taskIds);
        }
Exemple #8
0
        /// <summary>
        /// 移除禁入名单
        /// </summary>
        /// <param name="list"></param>
        public List <AddJurisdictionEntity> RemoveForbidden(string list)
        {
            //开始事物
            var res = DbFactory.Base().BeginTrans();
            List <AddJurisdictionEntity> taskIds = new List <AddJurisdictionEntity>();

            try
            {
                Repository <TemporaryUserEntity>   inlogdb = new Repository <TemporaryUserEntity>(DbFactory.Base());
                Repository <ForbiddenRecordEntity> Frecord = new Repository <ForbiddenRecordEntity>(DbFactory.Base());
                DataItemDetailService data = new DataItemDetailService();
                var    pitem     = data.GetItemValue("Hikappkey");  //密钥
                var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康地址
                string Key       = string.Empty;
                string Signature = string.Empty;
                if (!string.IsNullOrEmpty(pitem))
                {
                    Key       = pitem.Split('|')[0];
                    Signature = pitem.Split('|')[1];
                }
                List <TemporaryUserEntity>   list1 = new List <TemporaryUserEntity>();
                List <ForbiddenRecordEntity> list2 = new List <ForbiddenRecordEntity>();
                foreach (var UserId in list.Split(','))
                {
                    if (string.IsNullOrEmpty(UserId))
                    {
                        continue;
                    }
                    TemporaryUserEntity old = inlogdb.FindEntity(UserId);
                    if (old != null)
                    {
                        old.ISDebar = 0;
                        list1.Add(old);
                        //移除禁入记录
                        List <ForbiddenRecordEntity> Rlist = Frecord.IQueryable(it => it.UserId == UserId).OrderByDescending(t => t.CreateDate).ToList();
                        if (Rlist != null)
                        {
                            Rlist[0].EndTime = DateTime.Now;
                            list2.Add(Rlist[0]);
                        }
                    }
                }
                var Invalidentity = UploadUserlimits(list1, baseurl, Key, Signature);
                taskIds.Add(Invalidentity);
                res.Update <TemporaryUserEntity>(list1);
                res.Update <ForbiddenRecordEntity>(list2);
                res.Commit();
            }
            catch (Exception er)
            {
                res.Rollback();
            }
            return(taskIds);
        }
Exemple #9
0
        /// <summary>
        ///根据辨识计划ID获取相关风险点的各状态数量信息
        /// </summary>
        /// <param name="planId">计划ID</param>
        /// <param name="startDate">计划开始时间</param>
        /// <param name="endDate">计划结束时间</param>
        /// <returns>依次为原有风险数量,新增风险数量,完善风险数量,删除风险数量和现有风险数量</returns>
        public List <int> GetNumbers(string planId, string startDate, string endDate, int status, string areaId)
        {
            DataItemDetailService detailservice = new DataItemDetailService();
            string     gxhs      = detailservice.GetItemValue("广西华昇版本");
            string     tableName = status == 0 ? "BIS_RISKASSESS" : "BIS_RISKHISTORY";
            List <int> list      = new List <int>();
            //原有风险数量
            string sql  = string.Format("select risknumbers from BIS_RISKPLAN where  id='{0}'", planId);
            int    num1 = this.BaseRepository().FindObject(sql).ToInt();

            list.Add(num1);
            //新增风险数量
            int num2 = this.BaseRepository().FindObject(string.Format("select count(1) from {1} where planid='{0}' and EnabledMark=0 and deletemark=0 and status=2", planId, tableName)).ToInt();

            list.Add(num2);
            //完善风险数量
            int num3 = this.BaseRepository().FindObject(string.Format("select count(1) from {1} where planid='{0}' and state=1 and status=1", planId, tableName)).ToInt();

            list.Add(num3);
            //消除风险数量
            int num4 = this.BaseRepository().FindObject(string.Format("select count(1) from {1} where planid='{0}' and status=1 and state=2", planId, tableName)).ToInt();

            list.Add(num4);
            //现有风险数量
            if (!string.IsNullOrWhiteSpace(gxhs))
            {
                sql = string.Format("select count(1) from {1} where  deletemark=0 and createdate<=to_date('{0}','yyyy-mm-dd hh24:mi:ss')  and deptcode in (select DEPTCODE from bis_riskpplandata t where t.planid ='{2}') ", DateTime.Parse(endDate.ToString()).ToString("yyyy-MM-dd 23:59:59"), tableName, planId);
                if (status == 1)
                {
                    sql = string.Format("select count(1) from {1} where  deletemark=0 and createdate<=to_date('{0}','yyyy-mm-dd hh24:mi:ss')  and newplanid='{2}'", DateTime.Parse(endDate.ToString()).ToString("yyyy-MM-dd 23:59:59"), tableName, planId);
                }
                num4 = this.BaseRepository().FindObject(sql).ToInt();
                list.Add(num4);
            }
            else
            {
                sql = string.Format("select count(1) from {1} where  deletemark=0 and createdate<=to_date('{0}','yyyy-mm-dd hh24:mi:ss')  and districtid in('{2}')", DateTime.Parse(endDate.ToString()).ToString("yyyy-MM-dd 23:59:59"), tableName, areaId.Replace(",", "','"));
                if (DbHelper.DbType == DatabaseType.MySql)
                {
                    sql = string.Format("select count(1) from {1} where  deletemark=0 and createdate<='{0}'  and districtid in('{2}')", DateTime.Parse(endDate.ToString()).ToString("yyyy-MM-dd 23:59:59"), tableName, areaId.Replace(",", "','"));
                }
                if (status == 1)
                {
                    sql = string.Format("select count(1) from {1} where  deletemark=0 and createdate<=to_date('{0}','yyyy-mm-dd hh24:mi:ss')  and newplanid='{2}'", DateTime.Parse(endDate.ToString()).ToString("yyyy-MM-dd 23:59:59"), tableName, planId);
                    if (DbHelper.DbType == DatabaseType.MySql)
                    {
                        sql = string.Format("select count(1) from {1} where  deletemark=0 and createdate<='{0}' and newplanid='{2}'", DateTime.Parse(endDate.ToString()).ToString("yyyy-MM-dd 23:59:59"), tableName, planId);
                    }
                }
                num4 = this.BaseRepository().FindObject(sql).ToInt();
                list.Add(num4);
            }

            //辨识部门、评估部门原有风险数量
            sql = string.Format("select count(1) from BIS_RISKASSESS where createdate<to_date('{0}','yyyy-mm-dd hh24:mi:ss') and status=1 and deletemark=0 and EnabledMark=0 and deptcode in (select DEPTCODE from bis_riskpplandata t where t.planid ='{1}') ", DateTime.Parse(startDate).ToString("yyyy-MM-dd 00:00:01"), planId);
            int num5 = this.BaseRepository().FindObject(sql).ToInt();

            list.Add(num5);
            return(list);
        }
Exemple #10
0
        /// <summary>
        /// 将拜访人员信息上传到海康平台
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        public void UploadUserHiK(VisitcarEntity entity, List <CarUserFileImgEntity> list)
        {
            DataItemDetailService data = new DataItemDetailService();
            var    pitem     = data.GetItemValue("Hikappkey");
            var    baseurl   = data.GetItemValue("HikBaseUrl");
            string Key       = string.Empty;
            string Signature = string.Empty;

            //string no = new Random().Next(10, 888888).ToString();
            if (!string.IsNullOrEmpty(pitem))
            {
                Key       = pitem.Split('|')[0];
                Signature = pitem.Split('|')[1];
            }
            string Url = "/artemis/api/resource/v1/person/single/add";

            foreach (var item in list)
            {
                string time = DateTime.Now.ToString("yyyyMMddHHmmss");
                var    no   = Str.PinYin(item.Username).ToUpper() + time;//卡号唯一
                //人脸信息(base64必须为jpg格式)
                List <FaceEntity> faces = new List <FaceEntity>();
                FaceEntity        face  = new FaceEntity();
                face.faceData = item.Imgdata;
                faces.Add(face);
                var model = new
                {
                    personId        = item.ID,
                    personName      = item.Username,
                    gender          = "1",
                    orgIndexCode    = "root000000",
                    birthday        = "1990-01-01",
                    phoneNo         = entity.Phone,
                    email           = "*****@*****.**",
                    certificateType = "990",
                    certificateNo   = no,
                    faces
                };

                string    msg = SocketHelper.LoadCameraList(model, baseurl, Url, Key, Signature);
                parkList1 pl  = JsonConvert.DeserializeObject <parkList1>(msg);
                if (pl != null && pl.code == "0")
                {
                    SetLoadUserCarNo(item, baseurl, Key, Signature);
                }
            }
        }
Exemple #11
0
        /// <summary>
        /// 获取计划原有风险数量
        /// </summary>
        /// <param name="planId">计划ID</param>
        /// <param name="areaIds">计划关联区域</param>
        /// <param name="startDate">计划开始时间</param>
        /// <returns></returns>
        public int GetRiskNumbers(string areaIds, string startDate, string planId)
        {
            DataItemDetailService detailservice = new DataItemDetailService();
            string gxhs = detailservice.GetItemValue("广西华昇版本");
            string sql  = "";

            if (!string.IsNullOrWhiteSpace(gxhs))
            {
                sql = string.Format("select count(1) from BIS_RISKASSESS where createdate<to_date('{0}','yyyy-mm-dd hh24:mi:ss') and status=1 and deletemark=0 and EnabledMark=0 and deptcode in (select DEPTCODE from bis_riskpplandata t where t.planid='{1}' )", DateTime.Parse(startDate).ToString("yyyy-MM-dd 00:00:01"), planId);
            }
            else
            {
                sql = string.Format("select count(1) from BIS_RISKASSESS where createdate<to_date('{0}','yyyy-mm-dd hh24:mi:ss') and status=1 and deletemark=0 and EnabledMark=0 and districtid in('{1}')", DateTime.Parse(startDate).ToString("yyyy-MM-dd 00:00:01"), areaIds.Replace(",", "','"));
            }
            if (DbHelper.DbType == DatabaseType.MySql)
            {
                sql = string.Format("select count(1) from BIS_RISKASSESS where createdate<'{0}' and status=1 and deletemark=0 and EnabledMark=0 and districtid in('{1}')", DateTime.Parse(startDate).ToString("yyyy-MM-dd 00:00:01"), areaIds.Replace(",", "','"));
            }
            return(this.BaseRepository().FindObject(sql).ToInt());
        }
Exemple #12
0
        /// <summary>
        /// 获取前几个曝光的数据(取当前年的)
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public DataTable QueryExposureLllegal(string num)
        {
            string sql = string.Empty;
            DataItemDetailService dataitemdetailservice = new DataItemDetailService();
            Operator user = ERCHTMS.Code.OperatorProvider.Provider.Current();

            sql = string.Format(@"   select a.* from (
                                                  select distinct a.id ,a.id lllegalid,a.lllegalnumber ,a.reformrequire,a.lllegaldescribe,a.createdate,a.flowstate,a.addtype,a.reformdeptcode,
                                                   f.filepath  filepic, (case when f.filepath is not null then ('{3}'||substr(f.filepath,2)) else '' end)  filepath ,a.createuserorgcode from v_lllegalbaseinfo a
                                                  left join v_imageview f on a.lllegalpic = f.recid  where a.isexposure ='1' and 
                                                  a.reformdeptcode like '{1}%' and to_char(a.createdate,'yyyy') ='{2}' ) a where rownum <= {0} order by createdate  ", int.Parse(num), user.OrganizeCode, DateTime.Now.Year.ToString(), dataitemdetailservice.GetItemValue("imgUrl"));

            var dt = this.BaseRepository().FindTable(sql);

            return(dt);
        }
Exemple #13
0
        /// <summary>
        /// 普通设备离场
        /// </summary>
        /// <param name="equipmentId">用户Id</param>
        /// <param name="leaveTime">离场时间</param>
        /// <returns></returns>
        public int SetLeave(string equipmentId, string leaveTime, string DepartureReason)
        {
            DataItemDetailService service = new DataItemDetailService();

            leaveTime = "to_date('" + leaveTime + " 00:00:00','yyyy-mm-dd hh24:mi:ss')";
            return(this.BaseRepository().ExecuteBySql(string.Format("update BIS_EQUIPMENT set state={0},DepartureTime={1},DepartureReason='{3}' where id in('{2}')", service.GetItemValue("离厂", "EQUIPMENTSTATE"), leaveTime, equipmentId.Replace(",", "','"), DepartureReason)));
        }
Exemple #14
0
 /// <summary>
 /// 海康平台数据同步信息
 /// </summary>
 /// <param name="entity">实体</param>
 /// <param name="type">0新增 1修改 2删除</param>
 /// <param name="NewCar">旧车牌</param>
 public void OperHaiKangRecord(CarinfoEntity entity, int type, string OldCar)
 {
     try
     {
         #region 获取海康地址和秘钥
         DataItemDetailService data = new DataItemDetailService();
         var    pitem     = data.GetItemValue("Hikappkey");  //海康服务器密钥
         var    baseurl   = data.GetItemValue("HikBaseUrl"); //海康服务器地址
         string Key       = string.Empty;
         string Signature = string.Empty;
         if (!string.IsNullOrEmpty(pitem))
         {
             Key       = pitem.Split('|')[0];
             Signature = pitem.Split('|')[1];
         }
         #endregion
         #region 添加车辆
         if (type == 0)
         {//添加
             string        addurl = "/artemis/api/v1/vehicle/addVehicle";
             List <object> mllist = new List <object>();
             var           user   = new UserService().GetEntity(entity.DirverId);
             if (user != null)
             {
                 var model = new
                 {//有车主
                     personId      = entity.DirverId,
                     plateNo       = entity.CarNo,
                     parkIndexCode = GetTrafficPost(entity.Currentgid, entity.Type),//停车场唯一标识
                     plateType     = 0,
                     plateColor    = 0,
                     carType       = 0,
                     carColor      = 0,
                     startTime     = DateTime.Parse(entity.Starttime.ToString()).ToString("yyyy-MM-dd"),
                     endTime       = DateTime.Parse(entity.Endtime.ToString()).ToString("yyyy-MM-dd"),
                     vehicleGroup  = GetGroupInfo(entity.Type)//群组唯一标识
                 };
                 mllist.Add(model);
             }
             else
             {
                 var model = new
                 {//无车主
                     //personId = entity.DirverId,
                     plateNo       = entity.CarNo,
                     parkIndexCode = GetTrafficPost(entity.Currentgid, entity.Type),//停车场唯一标识
                     plateType     = 0,
                     plateColor    = 0,
                     carType       = 0,
                     carColor      = 0,
                     startTime     = DateTime.Parse(entity.Starttime.ToString()).ToString("yyyy-MM-dd"),
                     endTime       = DateTime.Parse(entity.Endtime.ToString()).ToString("yyyy-MM-dd"),
                     vehicleGroup  = GetGroupInfo(entity.Type)//群组唯一标识
                 };
                 mllist.Add(model);
             }
             SocketHelper.LoadCameraList(mllist, baseurl, addurl, Key, Signature);
         }
         #endregion
         #region 修改车辆
         else if (type == 1)
         {//修改
             string        updateurl = "/artemis/api/v1/vehicle/updateVehicle";
             List <object> mllist    = new List <object>();
             var           user      = new UserService().GetEntity(entity.DirverId);
             if (user != null)
             {
                 var model = new
                 {                                                                      //有车主
                     plateNo          = entity.CarNo,                                   //新车牌
                     oldPlateNo       = OldCar,                                         //旧车牌
                     ownerId          = entity.DirverId,
                     parkIndexCode    = GetTrafficPost(entity.Currentgid, entity.Type), //停车场唯一标识
                     plateType        = 0,
                     plateColor       = 0,
                     carType          = 0,
                     carColor         = 0,
                     startTime        = DateTime.Parse(entity.Starttime.ToString()).ToString("yyyy-MM-dd"),
                     endTime          = DateTime.Parse(entity.Endtime.ToString()).ToString("yyyy-MM-dd"),
                     isUpdateFunction = 1,
                     vehicleGroup     = GetGroupInfo(entity.Type)//群组唯一标识
                 };
                 mllist.Add(model);
             }
             else
             {
                 var model = new
                 {                                                                      //无车主
                     plateNo          = entity.CarNo,                                   //新车牌
                     oldPlateNo       = OldCar,                                         //旧车牌
                     parkIndexCode    = GetTrafficPost(entity.Currentgid, entity.Type), //停车场唯一标识
                     plateType        = 0,
                     plateColor       = 0,
                     carType          = 0,
                     carColor         = 0,
                     startTime        = DateTime.Parse(entity.Starttime.ToString()).ToString("yyyy-MM-dd"),
                     endTime          = DateTime.Parse(entity.Endtime.ToString()).ToString("yyyy-MM-dd"),
                     isUpdateFunction = 1,
                     vehicleGroup     = GetGroupInfo(entity.Type)//群组唯一标识
                 };
                 mllist.Add(model);
             }
             SocketHelper.LoadCameraList(mllist, baseurl, updateurl, Key, Signature);
         }
         #endregion
         #region  除车辆
         else if (type == 2)
         {//删除
             string selurl = "/artemis/api/v1/vehicle/fetchVehicle";
             var    model  = new
             {
                 plateNo  = entity.CarNo,
                 pageNo   = 1,
                 pageSize = 10
             };
             //查询车辆记录唯一标识
             string          msg = SocketHelper.LoadCameraList(model, baseurl, selurl, Key, Signature);
             CarSelectEntity pl  = JsonConvert.DeserializeObject <CarSelectEntity>(msg);
             if (pl != null && pl.code == "0")
             {
                 string carid = pl.data.rows[0].vehicleId;
                 //删除车辆
                 string        delurl = "/artemis/api/resource/v1/vehicle/batch/delete";
                 List <string> list   = new List <string>();
                 list.Add(carid);
                 var delmodel = new
                 {
                     vehicleIds = list
                 };
                 SocketHelper.LoadCameraList(delmodel, baseurl, delurl, Key, Signature);
             }
         }
         #endregion
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #15
0
        /// <summary>
        /// 获取使用消防水台账
        /// </summary>
        /// <param name="pagination">分页</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表</returns>
        public DataTable GetLedgerList(Pagination pagination, string queryJson, Operator user)
        {
            DatabaseType dataType = DatabaseType.Oracle;

            #region 数据权限
            string curUserId = user.UserId;
            #endregion

            /*
             * 即将作业:审批通过且实际作业时间为空
             * 作业中:审批通过且实际作业开始时间不为空且实际作业结束时间为空
             * 已结束:审批通过且实际作业结束时间不为空
             */
            #region 查表
            pagination.p_kid         = "Id as workid";
            pagination.p_fields      = "case when workdepttype=0 then '单位内部' when workdepttype=1 then '外包单位' end workdepttypename,workdepttype,workdeptid,workdeptname,workdeptcode,applynumber,a.createdate,workplace,workcontent,workstarttime,workendtime,applyusername,engineeringname,engineeringid,case when a.workoperate='1' then '作业暂停' when realityworkstarttime is not null and realityworkendtime is null then '作业中' when realityworkendtime is not null then '已结束'  else '即将作业' end ledgertype,a.workuserids,a.RealityWorkStartTime,a.RealityWorkEndTime,'' as isoperate,a.createuserid";
            pagination.p_tablename   = " bis_firewater a";
            pagination.conditionJson = "applystate='3'";
            if (!user.IsSystem)
            {
                //配置的部门拥有特殊查看权限
                string specialDeptId = new DataItemDetailService().GetItemValue(user.OrganizeId, "FireDept");
                if (!string.IsNullOrEmpty(specialDeptId) && specialDeptId.Contains(user.DeptId))
                {
                    pagination.conditionJson += " and a.createuserorgcode='" + user.OrganizeCode + "'";
                }
                else
                {
                    if (user.RoleName.Contains("公司") || user.RoleName.Contains("厂级"))
                    {
                        pagination.conditionJson += " and a.createuserorgcode='" + user.OrganizeCode + "'";
                    }
                    else
                    {
                        pagination.conditionJson += string.Format(" and ((workdeptcode in(select encode from base_department where encode like '{0}%'))  or (engineeringid in(select id from epg_outsouringengineer a where a.engineerletdeptid = '{1}')))", user.DeptCode, user.DeptId);
                    }
                }
            }
            #endregion

            #region  筛选条件
            var queryParam = JObject.Parse(queryJson);
            //时间选择
            if (!queryParam["st"].IsEmpty())//使用消防水开始时间
            {
                string from = queryParam["st"].ToString().Trim();
                pagination.conditionJson += string.Format(" and WorkStartTime>=to_date('{0}','yyyy-mm-dd')", from);
            }
            if (!queryParam["et"].IsEmpty())//使用消防水结束时间
            {
                string to = Convert.ToDateTime(queryParam["et"].ToString().Trim()).AddDays(1).ToString("yyyy-MM-dd");
                pagination.conditionJson += string.Format(" and WorkEndTime<=to_date('{0}','yyyy-mm-dd')", to);
            }
            //查询条件
            if (!queryParam["workdeptcode"].IsEmpty())//使用消防水单位code
            {
                pagination.conditionJson += string.Format(" and workdeptcode='{0}'", queryParam["workdeptcode"].ToString());
            }
            if (!queryParam["ledgertype"].IsEmpty())
            {
                var ledgertype = queryParam["ledgertype"].ToString();
                if (ledgertype == "0")// 即将作业
                {
                    pagination.conditionJson += " and RealityWorkStartTime is null";
                }
                else if (ledgertype == "1")//作业中
                {
                    pagination.conditionJson += " and RealityWorkStartTime is not null and RealityWorkEndTime is null";
                }
                else if (ledgertype == "3")
                {
                    pagination.conditionJson += " and workoperate='1'";
                }
                else//已结束
                {
                    pagination.conditionJson += " and RealityWorkEndTime is not null and workoperate is null";
                }
            }
            if (!queryParam["keyname"].IsEmpty())
            {
                pagination.conditionJson += string.Format("  and (workdeptname like '%{0}%' or engineeringname like '%{0}%')", queryParam["keyname"].ToString());
            }
            if (!queryParam["applynumber"].IsEmpty())
            {
                pagination.conditionJson += string.Format(" and applynumber like '%{0}%'", queryParam["applynumber"].ToString());
            }
            #endregion
            var data = this.BaseRepository().FindTableByProcPager(pagination, dataType);
            #region 操作权限
            if (data != null)
            {
                string strRole       = dataitemdetailservice.GetItemValue(user.OrganizeId, "LedgerSendDept");   //责任部门角色
                string strManageRole = dataitemdetailservice.GetItemValue(user.OrganizeId, "LedgerManageDept"); //安全主管部门监管角色
                string strWorkRole   = dataitemdetailservice.GetItemValue(user.OrganizeId, "LedgerWorkDept");   //作业单位
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    string str           = "0";
                    string workUserIds   = data.Rows[i]["workuserids"].ToString();                   //作业人员
                    string applyUserId   = data.Rows[i]["createuserid"].ToString();
                    string engineeringid = data.Rows[i]["engineeringid"].ToString();                 //工程id
                    string workDeptType  = data.Rows[i]["workdepttype"].ToString();
                    string workdeptid    = data.Rows[i]["workdeptid"].ToString();                    //作业单位id
                    var    dept          = new OutsouringengineerService().GetEntity(engineeringid); //获取工程id对应的责任部门
                    if (user.RoleName.Contains("厂级") && !string.IsNullOrEmpty(strManageRole))        //安全主管部门
                    {
                        string[] arrrolename = strManageRole.Split(',');
                        for (int j = 0; j < arrrolename.Length; j++)
                        {
                            if (user.RoleName.Contains(arrrolename[j]))
                            {
                                str = "1";
                                break;
                            }
                        }
                    }
                    if (str != "1" && !string.IsNullOrEmpty(workdeptid))
                    {
                        string[] arrrolename = strWorkRole.Split(',');
                        for (int j = 0; j < arrrolename.Length; j++)
                        {
                            if (user.RoleName.Contains(arrrolename[j]))
                            {
                                str = "1";
                                break;
                            }
                        }
                    }
                    if (str != "1" && ((!string.IsNullOrEmpty(workUserIds) && workUserIds.Contains(curUserId)) || curUserId == applyUserId))//作业人员或申请人
                    {
                        str = "1";
                    }
                    if (str != "1" && dept != null)
                    {
                        if (workDeptType == "1")//责任部门
                        {
                            if (dept.ENGINEERLETDEPTID == user.DeptId && !string.IsNullOrEmpty(strRole))
                            {
                                string[] arrrolename = strRole.Split(',');
                                for (int j = 0; j < arrrolename.Length; j++)
                                {
                                    if (user.RoleName.Contains(arrrolename[j]))
                                    {
                                        str = "1";
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    data.Rows[i]["isoperate"] = str;
                }
            }
            #endregion
            return(data);
        }
Exemple #16
0
        /// <summary>
        /// 出入权限配置
        /// </summary>
        /// <param name="codes">用户或组织id集合</param>
        /// <param name="ParentAccess">控制器id集合</param>
        /// <param name="Access">门禁点id集合</param>
        /// <param name="StartTime">开始时间</param>
        /// <param name="EndTime">结束时间</param>
        /// <param name="Type">0组织 1人员</param>
        /// <param name="baseUrl"></param>
        /// <param name="Key"></param>
        /// <param name="Signature"></param>
        private void DeleteUserlimits(List <string> codes, List <HikAccessNo> ParentAccess, List <HikAccessNo> Access, int Type, string baseUrl, string Key, string Signature)
        {
            var url = "/artemis/api/acps/v1/auth_config/delete";
            List <personDatas1> personDatas = new List <personDatas1>();
            personDatas1        entity      = new personDatas1();

            entity.indexCodes = codes;
            if (Type == 0)
            {
                entity.personDataType = "org";
            }
            else
            {
                entity.personDataType = "person";
            }
            personDatas.Add(entity);

            List <resourceInfos1> AllresourceInfos = new List <resourceInfos1>();//设备信息集合

            for (int i = 0; i < ParentAccess.Count; i++)
            {
                //List<int> nos = new List<int>();
                //nos.Add(1);
                //nos.Add(2);


                resourceInfos1 entity1 = new resourceInfos1();
                entity1.resourceIndexCode = ParentAccess[i].AccId;//设备唯一编号
                entity1.resourceType      = "acsDevice";
                entity1.channelNos        = ParentAccess[i].No;
                AllresourceInfos.Add(entity1);
            }
            //这里门禁控制器固定为设备类型门禁点类型采取数据编码配置
            DataItemDetailService itemBll = new DataItemDetailService();
            string doorType = itemBll.GetItemValue("doorType");

            foreach (var item in Access)
            {
                //List<int> nos = new List<int>();
                //nos.Add(1);
                resourceInfos1 entity1 = new resourceInfos1();
                entity1.resourceIndexCode = item.AccId;//设备唯一编号
                entity1.resourceType      = doorType;
                entity1.channelNos        = item.No;
                AllresourceInfos.Add(entity1);
            }
            var model = new
            {
                personDatas,
                resourceInfos = AllresourceInfos
            };
            string msg  = SocketHelper.LoadCameraList(model, baseUrl, url, Key, Signature);
            var    tsk  = JsonConvert.DeserializeObject <JurisdictionEntity>(msg);
            bool   flag = QuerySpeedofprogress(tsk.data.taskId, baseUrl, Key, Signature);

            if (flag)
            {
                //将删除卡号下发到所有设备
                downloadUserlimits(AllresourceInfos, 1, baseUrl, Key, Signature);
            }
        }
Exemple #17
0
        /// <summary>
        /// 出入权限配置
        /// </summary>
        /// <param name="codes">用户或组织id集合</param>
        /// <param name="ParentAccess">控制器id集合</param>
        /// <param name="Access">门禁点id集合</param>
        /// <param name="StartTime">开始时间</param>
        /// <param name="EndTime">结束时间</param>
        /// <param name="Type">0组织 1人员</param>
        /// <param name="baseUrl"></param>
        /// <param name="Key"></param>
        /// <param name="Signature"></param>
        private void UploadUserlimits(List <string> codes, List <HikAccessNo> ParentAccess, List <HikAccessNo> Access, string StartTime, string EndTime, int Type, string baseUrl, string Key, string Signature)
        {
            var url = "/artemis/api/acps/v1/auth_config/add";
            List <personDatas1> personDatas = new List <personDatas1>();
            personDatas1        entity      = new personDatas1();

            entity.indexCodes = codes;
            if (Type == 0)
            {
                entity.personDataType = "org";
            }
            else
            {
                entity.personDataType = "person";
            }
            personDatas.Add(entity);

            List <resourceInfos1> AllresourceInfos = new List <resourceInfos1>(); //设备信息集合
            List <resourceInfos1> resourceInfos    = new List <resourceInfos1>(); //设备信息集合

            for (int i = 0; i < ParentAccess.Count; i++)
            {
                resourceInfos1 entity1 = new resourceInfos1();
                entity1.resourceIndexCode = ParentAccess[i].AccId;//设备唯一编号
                entity1.resourceType      = "acsDevice";
                entity1.channelNos        = ParentAccess[i].No;
                AllresourceInfos.Add(entity1);
            }
            //这里门禁控制器固定为设备类型门禁点类型采取数据编码配置
            DataItemDetailService itemBll = new DataItemDetailService();
            string doorType = itemBll.GetItemValue("doorType");

            foreach (var item in Access)
            {
                resourceInfos1 entity1 = new resourceInfos1();
                entity1.resourceIndexCode = item.AccId;//设备唯一编号
                entity1.resourceType      = doorType;
                entity1.channelNos        = item.No;
                AllresourceInfos.Add(entity1);
                resourceInfos.Add(entity1);
            }
            string stime = Convert.ToDateTime(StartTime).ToString("yyyy-MM-ddTHH:mm:ss+08:00", DateTimeFormatInfo.InvariantInfo);//ISO8601时间格式
            string etime = Convert.ToDateTime(EndTime).ToString("yyyy-MM-ddTHH:mm:ss+08:00", DateTimeFormatInfo.InvariantInfo);
            var    model = new
            {
                personDatas,
                resourceInfos = AllresourceInfos,
                startTime     = stime, // "2019-12-01T17:30:08+08:00",
                endTime       = etime  //"2019-12-19T17:30:08+08:00"
            };
            string msg  = SocketHelper.LoadCameraList(model, baseUrl, url, Key, Signature);
            var    tsk  = JsonConvert.DeserializeObject <JurisdictionEntity>(msg);
            bool   flag = QuerySpeedofprogress(tsk.data.taskId, baseUrl, Key, Signature);

            if (flag)
            {
                //先将卡号下发到所有设备
                downloadUserlimits(AllresourceInfos, 1, baseUrl, Key, Signature);
                //再讲指纹单独下发到设备
                downloadUserlimits(resourceInfos, 2, baseUrl, Key, Signature);
            }
        }
Exemple #18
0
        /// <summary>
        /// 设置计划完成状态并同步相关联风险记录到历史记录表
        /// </summary>
        /// <param name="planId">计划ID</param>
        /// <param name="areaIds">区域ID(多个用逗号分隔)</param>
        /// <returns></returns>
        public bool SetComplate(string planId, string areaIds)
        {
            this.BaseRepository().BeginTrans();
            DataItemDetailService detailservice = new DataItemDetailService();
            var gxhs = detailservice.GetItemValue("广西华昇版本");

            try
            {
                string sql = string.Format("update BIS_RISKPLAN set status=1,modifydate=sysdate where id='{0}'", planId);
                if (this.BaseRepository().ExecuteBySql(sql) > 0)
                {
                    string id   = Guid.NewGuid().ToString();
                    string guid = string.Format("'{0}'", id);
                    if (DbHelper.DbType == DatabaseType.MySql)
                    {
                        guid = "uuid()";
                    }
                    if (!string.IsNullOrWhiteSpace(gxhs)) //广西华昇版本查询管控部门是辨识部门、评估部门的数据
                    {
                        sql = string.Format(@"insert into BIS_RISKHISTORY(
                    id,areaid,areaname,dangersource,way,itema,itemb,itemc,itemr,
                                    grade,deptcode,deptname,postid,postname,createuserid,createdate,
                                    createusername,createuserdeptcode,createuserorgcode,status,
                                    gradeval,result,accidentname,harmtype,risktype,DeleteMark,
                                    planid,state,districtid,districtname,areacode,newplanid,
                                    WorkTask,Process,EquipmentName,Parts,RiskDesc,ResultType,
                                    measure,majorname,Description,HarmProperty,levelname,faulttype,
                                    jobname,toolordanger,dangersourcetype,hjsystem,hjequpment,
                                    project,dutyperson,dutypersonid,element,faultcategory,majornametype,
                                    packuntil,packnum,storagespace,postdept,postdeptid,postperson,postpersonid,postdeptcode,name,listingid,harmname,hazardtype,harmdescription,typesofrisk,riskcategory,exposedrisk,existingmeasures,isspecialequ,checkprojectname,checkstandard,consequences,advicemeasures,effectiveness,costfactor,measuresresult,isadopt,measuresresultval,isconventional,remark,workcontent)
                                    select id || {0},areaid,t.areaname,t.dangersource,way,itema,
                                    itemb,itemc,itemr,grade,deptcode,deptname,postid,postname,
                                    createuserid,createdate,createusername,createuserdeptcode,
                                    createuserorgcode,status,gradeval,result,accidentname,harmtype,
                                    risktype,DeleteMark,planid,state,districtid,districtname,
                                    areacode,'{1}',WorkTask,Process,EquipmentName,Parts,RiskDesc,
                                    ResultType,measure,majorname,Description,HarmProperty,levelname,
                                    faulttype,jobname,toolordanger,dangersourcetype,hjsystem,hjequpment,
                                    project,dutyperson,dutypersonid,element,faultcategory,majornametype,
                                    packuntil,packnum,storagespace,postdept,postdeptid,postperson,postpersonid,postdeptcode,name,listingid,harmname,hazardtype,harmdescription,typesofrisk,riskcategory,exposedrisk,existingmeasures,isspecialequ,checkprojectname,checkstandard,consequences,advicemeasures,effectiveness,costfactor,measuresresult,isadopt,measuresresultval,isconventional,remark,workcontent
                                    from bis_riskassess t
where (t.deptcode in(select DEPTCODE from bis_riskpplandata t where t.planid ='{1}' ) and status=1) or (planid='{1}' and status=2) order by id", guid, planId, areaIds.Replace(",", "','"));
                    }
                    else
                    {
                        sql = string.Format(@"insert into BIS_RISKHISTORY(
                    id,areaid,areaname,dangersource,way,itema,itemb,itemc,itemr,
                                    grade,deptcode,deptname,postid,postname,createuserid,createdate,
                                    createusername,createuserdeptcode,createuserorgcode,status,
                                    gradeval,result,accidentname,harmtype,risktype,DeleteMark,
                                    planid,state,districtid,districtname,areacode,newplanid,
                                    WorkTask,Process,EquipmentName,Parts,RiskDesc,ResultType,
                                    measure,majorname,Description,HarmProperty,levelname,faulttype,
                                    jobname,toolordanger,dangersourcetype,hjsystem,hjequpment,
                                    project,dutyperson,dutypersonid,element,faultcategory,majornametype,
                                    packuntil,packnum,storagespace,postdept,postdeptid,postperson,postpersonid,postdeptcode,name,listingid,harmname,hazardtype,harmdescription,typesofrisk,riskcategory,exposedrisk,existingmeasures,isspecialequ,checkprojectname,checkstandard,consequences,advicemeasures,effectiveness,costfactor,measuresresult,isadopt,measuresresultval,isconventional,remark)
                                    select id || {0},areaid,t.areaname,t.dangersource,way,itema,
                                    itemb,itemc,itemr,grade,deptcode,deptname,postid,postname,
                                    createuserid,createdate,createusername,createuserdeptcode,
                                    createuserorgcode,status,gradeval,result,accidentname,harmtype,
                                    risktype,DeleteMark,planid,state,districtid,districtname,
                                    areacode,'{1}',WorkTask,Process,EquipmentName,Parts,RiskDesc,
                                    ResultType,measure,majorname,Description,HarmProperty,levelname,
                                    faulttype,jobname,toolordanger,dangersourcetype,hjsystem,hjequpment,
                                    project,dutyperson,dutypersonid,element,faultcategory,majornametype,
                                    packuntil,packnum,storagespace,postdept,postdeptid,postperson,postpersonid,postdeptcode,name,listingid,harmname,hazardtype,harmdescription,typesofrisk,riskcategory,exposedrisk,existingmeasures,isspecialequ,checkprojectname,checkstandard,consequences,advicemeasures,effectiveness,costfactor,measuresresult,isadopt,measuresresultval,isconventional,remark
                                    from bis_riskassess t
where (t.districtid in('{2}') and status=1) or (planid='{1}' and status=2) order by id", guid, planId, areaIds.Replace(",", "','"));
                    }

                    this.BaseRepository().ExecuteBySql(sql);
                    //DataTable dt = this.BaseRepository().FindTable(string.Format("select id from bis_riskassess where (districtid in('{1}') and status=1) or (planid='{0}' and status=2) and id in(select riskid from BIS_MEASURES)",planId, areaIds.Replace(",", "','")));
                    //foreach(DataRow dr in dt.Rows)
                    //{
                    //id = Guid.NewGuid().ToString();
                    sql = string.Format("insert into BIS_MEASURES(id,content,riskid,typename) select  '{0}' || rownum,content,riskid || {3},typename from BIS_MEASURES where riskid in(select id from bis_riskassess where (districtid in('{2}') and status=1) or (planid='{1}' and status=2)) order by riskid", id, planId, areaIds.Replace(",", "','"), guid);
                    this.BaseRepository().ExecuteBySql(sql);

                    //sql = string.Format("insert into BIS_MEASURES(id,content,riskid,typename) select '{0}' || rownum,t.content,'{1}',typename from BIS_MEASURES t where t.riskid='{2}'", Guid.NewGuid().ToString(), dr[0].ToString() + id, dr[0].ToString());
                    //this.BaseRepository().ExecuteBySql(sql);
                    //}
                    sql = string.Format("update bis_riskassess set status=1,planId='' where planId='{0}'", planId);
                    this.BaseRepository().ExecuteBySql(sql);

                    this.BaseRepository().Commit();
                }
                return(true);
            }
            catch
            {
                this.BaseRepository().Rollback();
                return(false);
            }
        }