예제 #1
0
        /// <summary>
        /// 车牌号缴费
        /// </summary>
        /// <param name="PlateNumber"></param>
        /// <param name="CardNo"></param>
        /// <param name="ParkingID"></param>
        /// <param name="SystemID"></param>
        /// <param name="AccountID"></param>
        /// <returns></returns>
        public static TempParkingFeeResult WXTempParkingFee(string PlateNumber, string ParkingID, string AccountID, DateTime CalculatDate)
        {
            WXServiceClient client = ServiceUtil <WXServiceClient> .GetServiceClient("WXService");

            string result = client.WXTempParkingFee(PlateNumber, ParkingID, CalculatDate, AccountID, 1);

            client.Close();
            client.Abort();
            TempParkingFeeResult model = JsonHelper.GetJson <TempParkingFeeResult>(result);

            try
            {
                if (!string.IsNullOrWhiteSpace(BWYInterfaceUrl) && !string.IsNullOrWhiteSpace(BWYSessionID) && !string.IsNullOrWhiteSpace(BWPKID))
                {
                    if (model.Result == APPResult.NotFindIn || model.Result == APPResult.ProxyException || model.Result == APPResult.NoTempCard ||
                        model.Result == APPResult.NotFindCard || model.Result == APPResult.OtherException)
                    {
                        BWYOrderQueryResult bwyResult = BWYInterfaceProcess.TempParkingFee(PlateNumber);
                        if (bwyResult != null)
                        {
                            //return TransforTempParkingFeeResult(model, bwyResult, PlateNumber);

                            model = BWYTransforTempParkingFeeResult(model, bwyResult, PlateNumber);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("WXTempParkingFee方法,异常:{0}", ex.Message));
            }

            try
            {
                if (model.Result == APPResult.NotFindIn || model.Result == APPResult.ProxyException || model.Result == APPResult.NoTempCard ||
                    model.Result == APPResult.NotFindCard || model.Result == APPResult.OtherException)
                {
                    if (!string.IsNullOrWhiteSpace(SFMInterfaceUrl) && !string.IsNullOrWhiteSpace(SFMSecretKey) && !string.IsNullOrWhiteSpace(SFMPKID))
                    {
                        PlateQueryResult sfmResult = SFMInterfaceProcess.GetCarPrice(PlateNumber);
                        if (sfmResult != null)
                        {
                            model = SFMTransforTempParkingFeeResult(model, sfmResult);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TxtLogServices.WriteTxtLogEx("SFMError", string.Format("WXTempParkingFee方法,异常:{0}", ex.Message));
            }

            return(model);
        }
예제 #2
0
        public static TempParkingFeeResult BWYTempParkingFeeResult(string GateID)
        {
            TempParkingFeeResult result = new TempParkingFeeResult();

            result.Result    = APPResult.NoCarInBox;
            result.ErrorDesc = "未知异常";

            int bwyGateId = 0;

            if (!string.IsNullOrWhiteSpace(SystemDefaultConfig.BWPKID) && int.TryParse(GateID, out bwyGateId))
            {
                try
                {
                    OutCarResult bwyResult = BWYInterfaceProcess.QueryOutCar(bwyGateId);
                    if (bwyResult.Result != 0)
                    {
                        result.Result    = APPResult.OtherException;
                        result.ErrorDesc = bwyResult.Desc;
                        return(result);
                    }
                    if (bwyResult.Reference == null || string.IsNullOrWhiteSpace(bwyResult.Reference.LPR))
                    {
                        result.Result    = APPResult.NoCarInBox;
                        result.ErrorDesc = bwyResult.Desc;
                        return(result);
                    }
                    TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("BWYTempParkingFeeResult方法,BWYInterfaceUrl:{0},BWYSessionID:{1},BWPKID:{2}", BWYInterfaceUrl, BWYSessionID, BWPKID));
                    if (!string.IsNullOrWhiteSpace(BWYInterfaceUrl) && !string.IsNullOrWhiteSpace(BWYSessionID) && !string.IsNullOrWhiteSpace(BWPKID))
                    {
                        BWYOrderQueryResult tempResult = BWYInterfaceProcess.TempParkingFee(bwyResult.Reference.LPR);
                        if (tempResult != null)
                        {
                            return(BWYTransforTempParkingFeeResult(result, tempResult, bwyResult.Reference.LPR));
                        }
                    }
                }
                catch (Exception ex)
                {
                    TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("BWYTempParkingFeeResult方法,异常:{0}", ex.Message));
                }
            }
            else
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("BWYTempParkingFeeResult方法,参数无效:{0},GateID:{1}", SystemDefaultConfig.BWPKID, GateID));
            }
            return(result);
        }
예제 #3
0
        private static TempParkingFeeResult BWYTransforTempParkingFeeResult(TempParkingFeeResult model, BWYOrderQueryResult bwyResult, string plateNumber)
        {
            if (bwyResult.Result != 0 || bwyResult.Reference == null || bwyResult.Reference.Count == 0)
            {
                return(model);
            }
            OrderQueryResultReference reference = bwyResult.Reference.First();
            TempParkingFeeResult      result    = new TempParkingFeeResult();

            result.OrderSource = PayOrderSource.BWY;
            result.PlateNumber = plateNumber;
            result.CardNo      = plateNumber;
            OrderResultReferenceParkingLot parking = reference.ParkingLot;

            if (parking == null)
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("TransforTempParkingFeeResult方法,OrderResultReferenceParkingLot is null"));
                return(model);
            }
            result.ParkingID    = BWPKID;
            result.ParkName     = parking.Name;
            result.ExternalPKID = parking.Index.ToString();
            OrderResultBill bill = reference.Bill;

            if (bill == null)
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("TransforTempParkingFeeResult方法,OrderResultBill is null"));
                return(model);
            }

            if (bill.PayState == 3)
            {
                result.Result = APPResult.NoNeedPay;
            }
            //if (bill.PayState == 10)
            //{
            //    result.Result = APPResult.NotFindIn;
            //}
            if (bill.PayState == 1 || bill.PayState == 2 || bill.PayState == 10)
            {
                result.Result = APPResult.Normal;
            }

            result.EntranceDate = bill.StartDate;
            result.OutTime      = 10;
            result.isAdd        = true;
            result.PayDate      = DateTime.Now;
            ParkOrder order = new ParkOrder();

            order.ID        = bill.Index;
            order.RecordID  = bill.Index.ToString();
            order.OrderNo   = bill.Index.ToString();
            order.TagID     = bill.Index.ToString();
            order.OrderType = OrderType.TempCardPayment;
            order.PayWay    = OrderPayWay.WeiXin;


            OrderResultCostDetail detail = reference.CostDetail;

            if (detail == null)
            {
                TxtLogServices.WriteTxtLogEx("BWYInterfaceProcess", string.Format("TransforTempParkingFeeResult方法,OrderResultCostDetail is null"));
                return(model);
            }
            if (detail != null && detail.Discount != null)
            {
                order.DiscountAmount = detail.Discount.Sums / 100;
            }
            if (detail.Sums == 0)
            {
                result.Result = APPResult.NoNeedPay;
            }

            order.Amount      = (detail.Sums - order.DiscountAmount) / 100;
            order.UnPayAmount = 0;
            order.PayAmount   = (detail.Sums - order.DiscountAmount) / 100;

            order.CarderateID = "";
            order.Status      = 0;
            order.OrderSource = OrderSource.WeiXin;
            order.OrderTime   = DateTime.Now;
            order.PayTime     = DateTime.Now;
            //order.OldUserulDate = DateTime.MinValue;
            //order.NewUsefulDate = DateTime.MinValue;
            //order.OldMoney = null;
            //order.NewMoney = null;
            order.PKID          = parking.Index.ToString();
            order.UserID        = "";
            order.OnlineUserID  = "";
            order.OnlineOrderNo = "";
            order.Remark        = "";
            //order.LastUpdateTime = "";
            //order.HaveUpdate = "";
            //order.DataStatus = "";
            result.Pkorder     = order;
            result.OrderSource = PayOrderSource.BWY;
            return(result);
        }