/// <summary>
        /// 终止车场服务
        /// </summary>
        /// <param name="requestdata"></param>
        /// <returns></returns>
        public bool StopParkService(ParkServiceModel requestdata)
        {
            ApiResult <APIResultBase> result = proxyApi.PostRaw <APIResultBase>("park/stopparkservice", requestdata);

            if (result.successed)
            {
                if (result.data.code == "0")
                {
                    return(true);
                }
                else
                {
                    LogHelper.Info("车场服务[" + requestdata.parkServiceId + "]终止服务失败," + result.data.msg);
                }
            }
            else
            {
                LogHelper.Info("车场服务[" + requestdata.parkServiceId + "]终止服务失败," + result.message);
            }
            return(false);
        }
        /// <summary>
        /// 开通车场服务
        /// </summary>
        /// <param name="requestdata"></param>
        /// <returns></returns>
        public ParkServiceModel EnableParkService(ParkServiceModel requestdata)
        {
            ApiResult <APIResultBase <ParkServiceModel> > result = proxyApi.PostRaw <APIResultBase <ParkServiceModel> >("park/enableparkservice", requestdata);

            if (result.successed)
            {
                if (result.data.code == "0")
                {
                    return(result.data.data);
                }
                else
                {
                    LogHelper.Info("人员[" + requestdata.personId + "][" + requestdata.personName + "]开通车场服务失败," + result.data.msg);
                }
            }
            else
            {
                LogHelper.Info("人员[" + requestdata.personId + "][" + requestdata.personName + "]开通车场服务失败," + result.message);
            }
            return(null);
        }
        private void button_SyncFix_Click(object sender, EventArgs e)
        {
            try
            {
                JielinkApi                   jielinkApi         = new JielinkApi();
                ParkWhiteListBLL             parkWhiteBll       = new ParkWhiteListBLL();
                FixSyncPlateBLL              fixSyncPlateBLL    = new FixSyncPlateBLL();
                ICollection <VehicleInfoDb>  IVehicleInfoDb     = parkWhiteBll.GetDBParkWhiteList();
                ICollection <VehicleInfoDb>  IVehicleInfoDbAll  = parkWhiteBll.GetAll();
                ICollection <FixPersonModel> IFixPersonModelAll = fixSyncPlateBLL.GetPerson();

                int ideleteCount = 0;
                if (IFixPersonModelAll != null)
                {
                    LogHelper.Info("===============jielink总用户数:[" + IFixPersonModelAll.Count + "]====================");
                }
                if (IVehicleInfoDbAll != null)
                {
                    LogHelper.Info("===============同步总用户数:[" + IVehicleInfoDbAll.Count + "]====================");
                }

                List <FixPersonModel> LDeletePerson = new List <FixPersonModel>();

                if (IFixPersonModelAll != null)
                {
                    foreach (FixPersonModel item in IFixPersonModelAll)
                    {
                        VehicleInfoDb ve = IVehicleInfoDbAll.Where(p => p.PersonId == item.PGUID.ToString()).FirstOrDefault();
                        if (ve == null)
                        {
                            LDeletePerson.Add(item);
                        }
                    }
                }


                if (LDeletePerson != null && LDeletePerson.Count > 0)
                {
                    LogHelper.Info("===============jielink需注销的用户数:[" + LDeletePerson.Count + "]====================");
                    foreach (FixPersonModel item in LDeletePerson)
                    {
                        ideleteCount++;
                        try
                        {
                            LogHelper.Info("===============序号[" + ideleteCount + "]开始执行=============");
                            VehicleInfoDb ve = IVehicleInfoDbAll.Where(p => p.PersonId == item.PGUID.ToString()).FirstOrDefault();
                            if (ve == null)
                            {
                                LogHelper.Info("===============序号[" + ideleteCount + "],车牌[" + item.PersonName + "],PersonId为[" + item.PGUID.ToString() + "],开始注销人员====================");
                                PersonModel personmodel = new PersonModel();
                                personmodel.personId = item.PGUID.ToString();
                                if (jielinkApi.DeletePerson(personmodel))
                                {
                                    LogHelper.Info("===============序号[" + ideleteCount + "],车牌[" + item.PersonName + "],PersonId为[" + item.PGUID.ToString() + "],注销人员成功====================");
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Error("==========异常注销错误:序号[" + ideleteCount + "],车牌[" + item.PersonName + "],PersonId为[" + item.PGUID.ToString() + "]:" + ex.ToString());
                        }
                    }
                    LogHelper.Info("===============全部异常注销完成====================");
                }



                int iSyncCount = 0;
                if (IVehicleInfoDbAll != null && IVehicleInfoDbAll.Count > 0)
                {
                    LogHelper.Info("===============同步总用户数:[" + IVehicleInfoDbAll.Count + "]====================");
                    foreach (VehicleInfoDb item in IVehicleInfoDbAll)
                    {
                        iSyncCount++;
                        try
                        {
                            LogHelper.Info("===============序号[" + iSyncCount + "]开始执行,车牌[" + item.vehicleNo + "]=============");
                            if (!string.IsNullOrWhiteSpace(item.PersonId))
                            {
                                FixPersonModel fixPerson = IFixPersonModelAll.Where(p => item.PersonId == p.PGUID.ToString()).FirstOrDefault();
                                if (fixPerson == null)
                                {
                                    //正常应该不会有这种情况.暂不处理
                                    LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "]PersonID[" + item.PersonId + "]在jielink中不存在=============");
                                }
                                else
                                {
                                    if (item.yn == "0")//合法车
                                    {
                                        bool updateFlag = false;
                                        if (fixPerson.IsIssueCard != 1)
                                        {
                                            updateFlag = true;
                                            LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],开始重新绑定车辆====================");
                                            VehicleModel vehicleModel = new VehicleModel();
                                            vehicleModel.personId      = item.PersonId;
                                            vehicleModel.plateNumber   = item.vehicleNo;
                                            vehicleModel.vehicleStatus = 1;
                                            vehicleModel = jielinkApi.VehicleBind(vehicleModel);
                                            if (vehicleModel != null)
                                            {
                                                item.BindCar = 1;
                                                LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],绑定车辆成功====================");
                                            }
                                            else
                                            {
                                                item.BindCar = 0;
                                                LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],绑定车辆失败返回NULL====================");
                                            }
                                        }
                                        if (fixPerson.IsParkService != 1)
                                        {
                                            updateFlag = true;
                                            try
                                            {
                                                LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],开始开通车场服务====================");
                                                ParkServiceModel parkService = new ParkServiceModel();
                                                parkService.carNumber = 1;
                                                parkService.personId  = item.PersonId;
                                                DateTime dtNow = DateTime.Now;
                                                parkService.startTime = dtNow.ToShortDateString();
                                                parkService.endTime   = dtNow.AddYears(19).ToShortDateString();
                                                parkService.setmealNo = 50;
                                                parkService           = jielinkApi.EnableParkService(parkService);
                                                if (parkService != null)
                                                {
                                                    item.ParkServiceId = parkService.parkServiceId;
                                                }
                                                else
                                                {
                                                    LogHelper.Error("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "]开通车场服务错误,返回NULL");
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                LogHelper.Error("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "]开通车场服务错误", ex);
                                            }
                                        }
                                        if (updateFlag)
                                        {
                                            parkWhiteBll.Update(item);
                                        }
                                    }
                                    else
                                    {
                                        bool updateFlag = false;
                                        if (fixPerson.IsIssueCard != 1)
                                        {
                                            updateFlag = true;
                                            LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],开始重新绑定车辆====================");
                                            VehicleModel vehicleModel = new VehicleModel();
                                            vehicleModel.personId      = item.PersonId;
                                            vehicleModel.plateNumber   = item.vehicleNo;
                                            vehicleModel.vehicleStatus = 1;
                                            vehicleModel = jielinkApi.VehicleBind(vehicleModel);
                                            if (vehicleModel != null)
                                            {
                                                item.BindCar = 1;
                                                LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],绑定车辆成功====================");
                                            }
                                            else
                                            {
                                                item.BindCar = 0;
                                                LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],绑定车辆失败返回NULL====================");
                                            }
                                        }
                                        if (fixPerson.IsParkService == 1)
                                        {
                                            updateFlag = true;
                                            try
                                            {
                                                LogHelper.Info("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "],开始注销车场服务====================");
                                                ParkServiceModel parkService1 = new ParkServiceModel();
                                                parkService1.parkServiceId = item.ParkServiceId;
                                                bool result = jielinkApi.StopParkService(parkService1);

                                                if (result)
                                                {
                                                    item.ParkServiceId = "";
                                                }
                                                else
                                                {
                                                    LogHelper.Error("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "]注销车场服务错误,返回NULL");
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                LogHelper.Error("===============序号[" + iSyncCount + "]车牌[" + item.vehicleNo + "],PersonId为[" + item.PersonId + "]注销车场服务错误", ex);
                                            }
                                        }
                                        if (updateFlag)
                                        {
                                            parkWhiteBll.Update(item);
                                        }
                                    }
                                }
                            }
                            else
                            {
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    LogHelper.Info("===============全部同步修复完成====================");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("同步错误,", ex);
            }
        }