Example #1
0
        private GetBatchOrderState_Item GetOrderState(string order_no)
        {
            BaoJiaManager mgr = new BaoJiaManager();
            Hashtable     ht  = mgr.GetOrderInfo(order_no);

            if (ht == null)
            {
                return(null);
            }
            else
            {
                GetBatchOrderState_Item data = new GetBatchOrderState_Item();

                decimal             kmprice = 0.80m, minuteprice = 0.40m, mileage = 0, TotalMoney = 0.00m, SettlementMoney = 0.00m, outServiceAreaFee = 0.00m;
                int                 minutes        = 0;
                string              returnLocType  = "";
                ServiceAreaManager  areaManager    = new ServiceAreaManager();
                SysSettingManager   settingManager = new SysSettingManager();
                VehiclePriceManager priceManager   = new VehiclePriceManager();
                Hashtable           billing_ht     = priceManager.GetOrderSettlement(SiteHelper.GetHashTableValueByKey(ht, "id"));
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "MinutePrice"), out minuteprice);
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "KmPrice"), out kmprice);
                int.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "Minutes"), out minutes);
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "TotalMoney"), out TotalMoney);
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(ht, "SettlementMoney"), out SettlementMoney);
                returnLocType = SiteHelper.GetHashTableValueByKey(ht, "ReturnLocType");
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(ht, "OutServiceAreaFee"), out outServiceAreaFee);

                string orderState = SiteHelper.GetHashTableValueByKey(ht, "OrderState");
                if (orderState == "1")
                {
                    SettlementMoney = TotalMoney;
                    VehicleManager vm         = new VehicleManager();
                    Hashtable      vehicle_ht = vm.GetVehicleInfoByIDORNumber(SiteHelper.GetHashTableValueByKey(ht, "VehicleID"));
                    string         lat        = vehicle_ht["LATITUDE"].ToString();
                    string         lng        = vehicle_ht["LONGITUDE"].ToString();

                    #region 判断还车点是否在运营区域内,运营区域外加收费用
                    Hashtable area_ht = areaManager.GetServiceAreaByVehicleID(SiteHelper.GetHashTableValueByKey(ht, "VehicleID"));
                    if (area_ht != null && area_ht.Keys.Count > 0)
                    {
                        returnLocType = "03";
                        List <LatLng> area_pts    = new List <LatLng>();
                        string        coordinates = SiteHelper.GetHashTableValueByKey(area_ht, "Coordinates");
                        foreach (string str in coordinates.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            string[] pt_arr = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            LatLng   pt     = new LatLng(double.Parse(pt_arr[1]), double.Parse(pt_arr[0]));
                            area_pts.Add(pt);
                        }
                        LatLng vehicle_pt = new LatLng(double.Parse(lat), double.Parse(lng));
                        //vehicle_pt = SiteHelper.TransformFromWGSToGCJ(vehicle_pt);
                        vehicle_pt = SiteHelper.GPSToGCJ02(lng, lat);
                        vehicle_pt = new LatLng(Math.Round(vehicle_pt.latitude, 6), Math.Round(vehicle_pt.longitude, 6));
                        bool isInPoly = SiteHelper.IsPtInPoly(vehicle_pt, area_pts);
                        if (!isInPoly)
                        {
                            returnLocType = "04";
                            string serviceFee = settingManager.GetValueByKey("OutServiceAreaFee");
                            if (serviceFee.StartsWith("+"))
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney + outServiceAreaFee;
                            }
                            else
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney * outServiceAreaFee;
                            }
                            outServiceAreaFee = TotalMoney - SettlementMoney;
                        }
                    }
                    #endregion

                    #region 判断还车点是否在停车点内,否则加收费用
                    string returnVehicleMode = settingManager.GetValueByKey("ReturnVehicleMode");
                    if (outServiceAreaFee == 0 && returnVehicleMode == "1")
                    {
                        returnLocType = "01";
                        LatLng vehicle_pt = new LatLng(double.Parse(lat), double.Parse(lng));
                        //vehicle_pt = SiteHelper.TransformFromWGSToGCJ(vehicle_pt);
                        vehicle_pt = SiteHelper.GPSToGCJ02(lng, lat);
                        vehicle_pt = new LatLng(Math.Round(vehicle_pt.latitude, 6), Math.Round(vehicle_pt.longitude, 6));
                        Hashtable parking_ht = areaManager.GetNearestParking(vehicle_pt.longitude.ToString(), vehicle_pt.latitude.ToString(), SiteHelper.GetHashTableValueByKey(ht, "VehicleID"));

                        List <LatLng> parking_pts = new List <LatLng>();
                        if (parking_ht != null && parking_ht.Keys.Count > 0)
                        {
                            string coordinates = SiteHelper.GetHashTableValueByKey(parking_ht, "Coordinates");
                            foreach (string str in coordinates.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                string[] pt_arr = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                LatLng   pt     = new LatLng(double.Parse(pt_arr[1]), double.Parse(pt_arr[0]));
                                parking_pts.Add(pt);
                            }
                        }

                        bool isInPoly = SiteHelper.IsPtInPoly(vehicle_pt, parking_pts);
                        if (!isInPoly)
                        {
                            returnLocType = "02";
                            string serviceFee = settingManager.GetValueByKey("OutParkingAreaFee");
                            if (serviceFee.StartsWith("+"))
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney + outServiceAreaFee;
                            }
                            else
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney * outServiceAreaFee;
                            }
                            outServiceAreaFee = TotalMoney - SettlementMoney;
                        }
                    }
                    #endregion
                }

                data.order_no = order_no;
                data.amount   = (double)(SettlementMoney + outServiceAreaFee);;

                data.order_status = 10000;
                if (orderState == "1")
                {
                    data.order_status = 10000;
                }
                else if (orderState == "0")
                {
                    data.order_status = 10301;
                }
                else if (orderState == "2" || orderState == "5" || orderState == "3")
                {
                    data.order_status = 80200;
                }

                data.timestamp = (long)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds;

                return(data);
            }
        }
Example #2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["VehicleID"] == null || res["VehicleID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                vehicleID = res["VehicleID"].ToString().Trim();
                VehicleManager      vm  = new VehicleManager();
                SystemImagesManager sim = new SystemImagesManager();

                //如何扫码内容为url地址则从地址中取出车辆id
                if (vehicleID != null && (vehicleID.StartsWith("http://") || vehicleID.StartsWith("https://")))
                {
                    //http://api.qingniaokeji.cn/download/app.aspx?no=xxxxxxxxxxxxx
                    Uri uri = new Uri(vehicleID);
                    System.Collections.Specialized.NameValueCollection coll = System.Web.HttpUtility.ParseQueryString(uri.Query);
                    vehicleID = coll.Get("no");
                }
                Hashtable     vehicle    = vm.GetVehicleInfoByIDORNumber(vehicleID);
                OrdersManager om         = new OrdersManager();
                string        thumbImg   = string.Empty;
                string        detailsImg = string.Empty;
                if (vehicle == null || vehicle.Keys.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "车辆数据为空"));
                }
                else
                {
                    DataTable dt = sim.GetImagesByVehicleID(vehicleID);
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Thumbnail).ToString().Trim())
                            {
                                thumbImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }

                            if (dr["Type"].ToString().Trim() == ((int)ImagesType.Details).ToString().Trim())
                            {
                                detailsImg += SiteHelper.GetFileServer() + dr["ImageUrl"].ToString().Trim() + ";";
                            }
                        }
                    }
                    vehicle["THUMBIMG"]   = thumbImg;
                    vehicle["DETAILSIMG"] = detailsImg;

                    string lng = vehicle["LONGITUDE"].ToString();
                    string lat = vehicle["LATITUDE"].ToString();
                    if (!string.IsNullOrEmpty(lng) && !string.IsNullOrEmpty(lat))
                    {
                        LatLng latlng = new LatLng(double.Parse(lat), double.Parse(lng));
                        latlng = SiteHelper.TransformFromWGSToGCJ(latlng);
                        if (latlng != null)
                        {
                            vehicle["LATITUDE"]  = latlng.latitude;
                            vehicle["LONGITUDE"] = latlng.longitude;
                            if (vehicle["ADDRESS"].ToString().Length <= 0)
                            {
                                vehicle["ADDRESS"] = SiteHelper.GetLocationByGPS(vehicle["LONGITUDE"].ToString(), vehicle["LATITUDE"].ToString(), "gcj02ll");
                            }
                        }
                    }
                    decimal electricity = 0;
                    decimal.TryParse(vehicle["ELECTRICITY"].ToString(), out electricity);
                    int dianliang = Decimal.ToInt32(electricity);
                    vehicle["ELECTRICITY"] = dianliang + "%";

                    vehicle["AbnormalState"] = 0;
                    Hashtable abht = null;// vm.GetAbnormalVehicle(vehicle["ID"].ToString());
                    if (abht != null && abht.Keys.Count > 0)
                    {
                        vehicle["AbnormalState"] = 1;
                        vehicle["AlarmType"]     = SiteHelper.GetHashTableValueByKey(abht, "AlarmType");
                        vehicle["AlarmTime"]     = SiteHelper.GetHashTableValueByKey(abht, "AlarmTime");
                    }

                    vehicle["ChargeBeginTime"] = "";
                    Hashtable chargeht = vm.GetVehicleChargingInfo(vehicle["ID"].ToString());
                    if (chargeht != null && chargeht.Keys.Count > 0)
                    {
                        vehicle["ChargeBeginTime"] = chargeht["BEGINTIME"].ToString();
                    }

                    Hashtable order_ht = om.GetLatestUserByVehicleID(vehicle["ID"].ToString());
                    if (order_ht != null && order_ht.Keys.Count > 0)
                    {
                        vehicle["OrderUserName"] = order_ht["REALNAME"];
                        vehicle["OrderUserTel"]  = order_ht["BINDPHONE"];
                        //vehicle["HeadPortrait"] = SiteHelper.GetFileServer() + order_ht["HEADPORTRAIT"];
                        vehicle["HeadPortrait"] = "";
                        vehicle["OrderState"]   = order_ht["ORDERSTATE"];
                        vehicle["UserType"]     = order_ht["USERTYPE"];
                        vehicle["OrderTime"]    = order_ht["CREATETIME"];
                    }
                    else
                    {
                        vehicle["OrderUserName"] = "";
                        vehicle["OrderUserTel"]  = "";
                        vehicle["HeadPortrait"]  = "";
                        vehicle["OrderState"]    = "";
                        vehicle["UserType"]      = "";
                        vehicle["OrderTime"]     = "";
                    }
                    return(SiteHelper.GetJsonFromHashTable(vehicle, "success", "获取数据成功", "VehicleInfo"));
                }
            }
        }
Example #3
0
        public ApiResp Execute(System.Collections.Hashtable params_ht)
        {
            ApiResp resp = new ApiResp();

            resp.code = "-1";

            string client_id = params_ht["client_id"].ToString();
            long   timestamp = long.Parse(params_ht["timestamp"].ToString());
            string sign      = params_ht["sign"].ToString();

            string plate_no = null;

            if (params_ht["plate_no"] != null)
            {
                plate_no = params_ht["plate_no"].ToString();
                if (plate_no != null && (plate_no.StartsWith("http://") || plate_no.StartsWith("https://")))
                {
                    //http://api.qingniaokeji.cn/download/app.aspx?no=xxxxxxxxxxxxx
                    Uri uri = new Uri(plate_no);
                    System.Collections.Specialized.NameValueCollection coll = System.Web.HttpUtility.ParseQueryString(uri.Query);
                    plate_no = coll.Get("no");
                }
            }

            List <GetNowCars_Item> data = new List <GetNowCars_Item>();

            VehicleManager     vm          = new VehicleManager();
            ServiceAreaManager areaManager = new ServiceAreaManager();

            if (string.IsNullOrEmpty(plate_no))
            {
                DataTable dt = areaManager.GetVehiclesByCity(null, 1, 9999);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        GetNowCars_Item item = new GetNowCars_Item();
                        item.id       = dr["ID"].ToString();
                        item.plate_no = dr["LicenseNumber"].ToString();
                        item.lng      = double.Parse(dr["Longitude"].ToString());
                        item.lat      = double.Parse(dr["Latitude"].ToString());
                        if (dr["LastUpdateTime"].ToString().Trim().Length > 0)
                        {
                            item.datetime = (long)(DateTime.Parse(dr["LastUpdateTime"].ToString()) - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds;
                        }
                        item.mileage = dr["ExpectRange"].ToString();
                        item.power   = (int)double.Parse(dr["Electricity"].ToString());
                        if (item.power > 100)
                        {
                            item.power = 100;
                        }
                        if (item.power < 0)
                        {
                            item.power = 0;
                        }
                        item.minute_price = double.Parse(dr["MinutePrice"].ToString());
                        item.mile_price   = double.Parse(dr["KmPrice"].ToString());
                        item.start_price  = double.Parse(dr["MinPrice"].ToString());
                        item.other_price  = "每日封顶价格:" + dr["MaxPrice"].ToString() + "元";

                        string use_state     = dr["UseState"].ToString();
                        string vehicle_state = dr["VehicleState"].ToString();
                        double electricity   = 0.00;
                        double.TryParse(dr["Electricity"].ToString(), out electricity);
                        DateTime last_update_time = DateTime.Now;
                        if (dr["LastUpdateTime"].ToString().Trim().Length > 0)
                        {
                            DateTime.TryParse(dr["LastUpdateTime"].ToString(), out last_update_time);
                        }

                        item.is_rent = 0;
                        if (vehicle_state == VehicleState.Use.GetHashCode().ToString() && use_state == VehicleUseState.Free.GetHashCode().ToString() && electricity > 20 && (DateTime.Now - last_update_time).TotalMinutes < 5)
                        {
                            item.is_rent = 1;
                        }
                        data.Add(item);
                    }
                    resp.code = "0";
                    resp.msg  = "成功";
                    resp.data = data;
                }
                else
                {
                    resp.code = "-1";
                    resp.msg  = "未找到车辆";
                }
            }
            else
            {
                Hashtable ht = vm.GetVehicleInfoByIDORNumber(plate_no);
                if (ht != null && ht.Keys.Count > 0)
                {
                    GetNowCars_Item item = new GetNowCars_Item();
                    item.id       = SiteHelper.GetHashTableValueByKey(ht, "ID");
                    item.plate_no = SiteHelper.GetHashTableValueByKey(ht, "LicenseNumber");
                    item.lng      = double.Parse(SiteHelper.GetHashTableValueByKey(ht, "Longitude"));
                    item.lat      = double.Parse(SiteHelper.GetHashTableValueByKey(ht, "Latitude"));
                    if (SiteHelper.GetHashTableValueByKey(ht, "LastUpdateTime").Length > 0)
                    {
                        item.datetime = (long)(DateTime.Parse(SiteHelper.GetHashTableValueByKey(ht, "LastUpdateTime")) - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds;
                    }
                    item.mileage = SiteHelper.GetHashTableValueByKey(ht, "ExpectRange");
                    item.power   = (int)double.Parse(SiteHelper.GetHashTableValueByKey(ht, "Electricity"));
                    if (item.power > 100)
                    {
                        item.power = 100;
                    }
                    if (item.power < 0)
                    {
                        item.power = 0;
                    }
                    item.minute_price = double.Parse(SiteHelper.GetHashTableValueByKey(ht, "MinutePrice"));
                    item.mile_price   = double.Parse(SiteHelper.GetHashTableValueByKey(ht, "KmPrice"));
                    item.start_price  = double.Parse(SiteHelper.GetHashTableValueByKey(ht, "MinPrice"));
                    item.other_price  = "每日封顶价格:" + SiteHelper.GetHashTableValueByKey(ht, "MaxPrice") + "元";

                    string use_state     = SiteHelper.GetHashTableValueByKey(ht, "UseState");
                    string vehicle_state = SiteHelper.GetHashTableValueByKey(ht, "VehicleState");
                    double electricity   = 0.00;
                    double.TryParse(SiteHelper.GetHashTableValueByKey(ht, "Electricity"), out electricity);
                    DateTime last_update_time = DateTime.Now;
                    if (SiteHelper.GetHashTableValueByKey(ht, "LastUpdateTime").Length > 0)
                    {
                        DateTime.TryParse(SiteHelper.GetHashTableValueByKey(ht, "LastUpdateTime"), out last_update_time);
                    }
                    item.is_rent = 0;
                    if (vehicle_state == VehicleState.Use.GetHashCode().ToString() && use_state == VehicleUseState.Free.GetHashCode().ToString() && electricity > 20 && (DateTime.Now - last_update_time).Minutes < 5)
                    {
                        item.is_rent = 1;
                    }

                    data.Add(item);

                    resp.code = "0";
                    resp.msg  = "成功";
                    resp.data = data;
                }
                else
                {
                    resp.code = "-1";
                    resp.msg  = "未找到车辆";
                }
            }

            return(resp);
        }
Example #4
0
        public ApiResp Execute(System.Collections.Hashtable params_ht)
        {
            ApiResp resp = new ApiResp();

            resp.code = "-1";

            string client_id = params_ht["client_id"].ToString();
            long   timestamp = long.Parse(params_ht["timestamp"].ToString());
            string sign      = params_ht["sign"].ToString();
            string plate_no  = params_ht["plate_no"].ToString();
            string order_no  = params_ht["order_no"].ToString();

            GetFeeData data = new GetFeeData();

            BaoJiaManager mgr = new BaoJiaManager();
            Hashtable     ht  = mgr.GetOrderInfo(order_no);

            if (ht == null)
            {
                resp.msg  = "未找到相关订单";
                resp.code = "-1";
            }
            else
            {
                decimal             kmprice = 0.80m, minuteprice = 0.40m, mileage = 0, TotalMoney = 0.00m, SettlementMoney = 0.00m, outServiceAreaFee = 0.00m;
                int                 minutes = 0;
                string              returnLocType = "", lng = "0", lat = "0";
                ServiceAreaManager  areaManager    = new ServiceAreaManager();
                SysSettingManager   settingManager = new SysSettingManager();
                VehiclePriceManager priceManager   = new VehiclePriceManager();
                Hashtable           billing_ht     = priceManager.GetOrderSettlement(SiteHelper.GetHashTableValueByKey(ht, "id"));
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "MinutePrice"), out minuteprice);
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "KmPrice"), out kmprice);
                int.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "Minutes"), out minutes);
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(billing_ht, "TotalMoney"), out TotalMoney);
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(ht, "SettlementMoney"), out SettlementMoney);
                returnLocType = SiteHelper.GetHashTableValueByKey(ht, "ReturnLocType");
                decimal.TryParse(SiteHelper.GetHashTableValueByKey(ht, "OutServiceAreaFee"), out outServiceAreaFee);

                string         orderState = SiteHelper.GetHashTableValueByKey(ht, "OrderState");
                VehicleManager vm         = new VehicleManager();
                Hashtable      vehicle_ht = vm.GetVehicleInfoByIDORNumber(SiteHelper.GetHashTableValueByKey(ht, "VehicleID"));
                lat = vehicle_ht["LATITUDE"].ToString();
                lng = vehicle_ht["LONGITUDE"].ToString();
                if (orderState == "1")
                {
                    SettlementMoney = TotalMoney;
                    #region 判断还车点是否在运营区域内,运营区域外加收费用
                    Hashtable area_ht = areaManager.GetServiceAreaByVehicleID(SiteHelper.GetHashTableValueByKey(ht, "VehicleID"));
                    if (area_ht != null && area_ht.Keys.Count > 0)
                    {
                        returnLocType = "03";
                        List <LatLng> area_pts    = new List <LatLng>();
                        string        coordinates = SiteHelper.GetHashTableValueByKey(area_ht, "Coordinates");
                        foreach (string str in coordinates.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            string[] pt_arr = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            LatLng   pt     = new LatLng(double.Parse(pt_arr[1]), double.Parse(pt_arr[0]));
                            area_pts.Add(pt);
                        }
                        LatLng vehicle_pt = new LatLng(double.Parse(lat), double.Parse(lng));
                        //vehicle_pt = SiteHelper.TransformFromWGSToGCJ(vehicle_pt);
                        vehicle_pt = SiteHelper.GPSToGCJ02(lng, lat);
                        vehicle_pt = new LatLng(Math.Round(vehicle_pt.latitude, 6), Math.Round(vehicle_pt.longitude, 6));
                        bool isInPoly = SiteHelper.IsPtInPoly(vehicle_pt, area_pts);
                        if (!isInPoly)
                        {
                            returnLocType = "04";
                            string serviceFee = settingManager.GetValueByKey("OutServiceAreaFee");
                            if (serviceFee.StartsWith("+"))
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney + outServiceAreaFee;
                            }
                            else
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney * outServiceAreaFee;
                            }
                            outServiceAreaFee = TotalMoney - SettlementMoney;
                        }
                    }
                    #endregion

                    #region 判断还车点是否在停车点内,否则加收费用
                    string returnVehicleMode = settingManager.GetValueByKey("ReturnVehicleMode");
                    if (outServiceAreaFee == 0 && returnVehicleMode == "1")
                    {
                        returnLocType = "01";
                        LatLng vehicle_pt = new LatLng(double.Parse(lat), double.Parse(lng));
                        //vehicle_pt = SiteHelper.TransformFromWGSToGCJ(vehicle_pt);
                        vehicle_pt = SiteHelper.GPSToGCJ02(lng, lat);
                        vehicle_pt = new LatLng(Math.Round(vehicle_pt.latitude, 6), Math.Round(vehicle_pt.longitude, 6));
                        Hashtable parking_ht = areaManager.GetNearestParking(vehicle_pt.longitude.ToString(), vehicle_pt.latitude.ToString(), SiteHelper.GetHashTableValueByKey(ht, "VehicleID"));

                        List <LatLng> parking_pts = new List <LatLng>();
                        if (parking_ht != null && parking_ht.Keys.Count > 0)
                        {
                            string coordinates = SiteHelper.GetHashTableValueByKey(parking_ht, "Coordinates");
                            foreach (string str in coordinates.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                string[] pt_arr = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                LatLng   pt     = new LatLng(double.Parse(pt_arr[1]), double.Parse(pt_arr[0]));
                                parking_pts.Add(pt);
                            }
                        }

                        bool isInPoly = SiteHelper.IsPtInPoly(vehicle_pt, parking_pts);
                        if (!isInPoly)
                        {
                            returnLocType = "02";
                            string serviceFee = settingManager.GetValueByKey("OutParkingAreaFee");
                            if (serviceFee.StartsWith("+"))
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney + outServiceAreaFee;
                            }
                            else
                            {
                                serviceFee = serviceFee.Substring(1, serviceFee.Length - 1);
                                decimal.TryParse(serviceFee, out outServiceAreaFee);
                                TotalMoney = TotalMoney * outServiceAreaFee;
                            }
                            outServiceAreaFee = TotalMoney - SettlementMoney;
                        }
                    }
                    #endregion
                }
                SettlementMoney            = Math.Round(SettlementMoney, 2);
                data.order_no              = order_no;
                data.all_mile              = double.Parse(SiteHelper.GetHashTableValueByKey(ht, "Mileage"));
                data.location_address_type = "3";
                if (returnLocType == "01")
                {
                    data.location_address_type = "3";
                }
                if (returnLocType == "02" || returnLocType == "03")
                {
                    data.location_address_type = "1";
                }
                if (returnLocType == "04")
                {
                    data.location_address_type = "2";
                }

                data.location_address_msg = "";
                data.order_status         = 10000;
                if (orderState == "1")
                {
                    data.order_status = 10000;
                }
                else if (orderState == "0")
                {
                    data.order_status = 10301;
                }
                else if (orderState == "2" || orderState == "5" || orderState == "3")
                {
                    data.order_status = 80200;
                }
                data.total_fee = (double)(SettlementMoney + outServiceAreaFee);
                data.timestamp = (long)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()).TotalSeconds;
                data.lng       = double.Parse(lng);
                data.lat       = double.Parse(lat);

                data.details = new List <GetFeeData_Fee>();
                GetFeeData_Fee item1 = new GetFeeData_Fee();
                item1.name   = "用车费用";
                item1.amount = (double)SettlementMoney;
                data.details.Add(item1);
                if (returnLocType == "04")
                {
                    GetFeeData_Fee item2 = new GetFeeData_Fee();
                    item2.name   = "行驶区域外还车调度费";
                    item2.amount = (double)(outServiceAreaFee);
                    data.details.Add(item2);
                }
                if (returnLocType == "02")
                {
                    GetFeeData_Fee item3 = new GetFeeData_Fee();
                    item3.name   = "停车点外还车调度费";
                    item3.amount = (double)(outServiceAreaFee);
                    data.details.Add(item3);
                }

                data.isLock = "1";
                int       cnt        = -1;
                DataTable parking_dt = areaManager.GetNearParking(9999, lng.ToString(), lat.ToString(), 1, 9999, ref cnt);
                if (parking_dt != null && parking_dt.Rows.Count > 0)
                {
                    List <GetFeeData_StationItem> station_list = new List <GetFeeData_StationItem>();
                    foreach (DataRow dr in parking_dt.Rows)
                    {
                        GetFeeData_StationItem station = new GetFeeData_StationItem();
                        station.parkType          = "2";
                        station.coordinatePoints  = dr["Coordinates"].ToString().Replace(";", "|");
                        station.coordinate_center = dr["Longitude"].ToString() + "," + dr["Latitude"].ToString();
                        station_list.Add(station);
                    }
                    data.stationList = station_list;
                }

                resp.data = data;
                resp.code = "0";
            }

            return(resp);
        }