/// <summary>
        /// 人员报警表跨天数据处理(结束当天的报警,写第二天的开始)  20171206
        /// </summary>
        /// <param name="today"></param>
        /// <param name="tomorrow"></param>
        public static void Drv_CrossDayPro(DateTime today, DateTime tomorrow)
        {
            List <R_PbInfo> R_PBList = GetAllR_PBItems().FindAll(a => a.Endtime == null || a.Endtime.ToString("yyyy-MM-dd") == "1900-01-01");

            R_PBList.ForEach(a =>
            {
                a.Endtime   = today;
                a.InfoState = InfoState.Modified;
            });
            //更新数据库
            DataToDbBatchAddRequest <R_PbInfo> request1 = new DataToDbBatchAddRequest <R_PbInfo>();

            request1.Items = R_PBList;
            r_PbService.AddItems(request1);
            //更新缓存
            R_PBCacheBatchUpdateRequest request2 = new R_PBCacheBatchUpdateRequest();

            request2.R_PBInfos = R_PBList;
            r_PBCacheService.BatchUpdateR_PBCache(request2);
            //写所有未结束的报警记录的第二天开始记录
            foreach (R_PbInfo tempR_PB in R_PBList)
            {
                R_PbInfo newPB = new R_PbInfo();
                newPB.Id        = IdHelper.CreateLongId().ToString();
                newPB.Areaid    = tempR_PB.Areaid;
                newPB.Yid       = tempR_PB.Yid;
                newPB.Pointid   = tempR_PB.Pointid;
                newPB.Zdzs      = tempR_PB.Zdzs;
                newPB.Starttime = tomorrow;
                newPB.Endtime   = new DateTime(1900, 1, 1, 0, 0, 0);
                newPB.Type      = tempR_PB.Type;
                newPB.Z1        = tempR_PB.Z1;
                newPB.Z2        = tempR_PB.Z2;
                newPB.Z3        = tempR_PB.Z3;
                newPB.Z4        = tempR_PB.Z4;
                newPB.Z5        = tempR_PB.Z5;
                newPB.Z6        = tempR_PB.Z6;
                newPB.Upflag    = "0";

                //更新数据库
                DataToDbAddRequest <R_PbInfo> request = new DataToDbAddRequest <R_PbInfo>();
                request.Item = newPB;
                r_PbService.AddItem(request);
                //更新缓存
                R_PBCacheAddRequest addRequest = new R_PBCacheAddRequest();
                addRequest.R_PBInfo = newPB;
                r_PBCacheService.AddR_PBCache(addRequest);
            }
        }
        public static void CreateR_PBInfo(string pointID, string areaID, DateTime stime, PersonAlarmState datastate, R_PrealInfo prealInfo)
        {
            R_PbInfo pb = new R_PbInfo();

            // 编号
            pb.Id = IdHelper.CreateLongId().ToString();
            // 区域ID
            if (string.IsNullOrEmpty(areaID))
            {
                pb.Areaid = "0";
            }
            else
            {
                pb.Areaid = areaID;
            }
            // 人员Id
            pb.Yid = prealInfo.Yid;
            // 测点Id
            pb.Pointid = pointID;
            // 报警开始时间,等同于写记录时间
            pb.Starttime = stime;
            // 报警结束时间
            pb.Endtime = new DateTime(1900, 1, 1);
            // 报警类型(关联枚举表)
            pb.Type = (int)datastate;
            // 系统类型标志:0—人员,1—机车
            pb.Z4        = prealInfo.Sysflag;
            pb.Z1        = "0";
            pb.Z2        = "0";
            pb.Z3        = "0";
            pb.Z5        = "0";
            pb.Z6        = "0";
            pb.InfoState = InfoState.AddNew;

            //更新数据库
            DataToDbAddRequest <R_PbInfo> request = new DataToDbAddRequest <R_PbInfo>();

            request.Item = pb;
            r_PbService.AddItem(request);
            //更新缓存
            R_PBCacheAddRequest addRequest = new R_PBCacheAddRequest();

            addRequest.R_PBInfo = pb;
            r_PBCacheService.AddR_PBCache(addRequest);
        }