Exemplo n.º 1
0
        public static TempParkingFeeResult SFMTempParkingFeeResult(string ParkNo, string GateID)
        {
            TempParkingFeeResult result = new TempParkingFeeResult();

            result.Result    = APPResult.OtherException;
            result.ErrorDesc = "车场或通道编号未配置";

            if (!string.IsNullOrWhiteSpace(SystemDefaultConfig.SFMPKID) && !string.IsNullOrWhiteSpace(ParkNo) && !string.IsNullOrWhiteSpace(GateID))
            {
                try
                {
                    BWYGateMapping gate = BWYGateMappingServices.QueryByGateID(1, ParkNo, GateID);
                    if (gate == null)
                    {
                        result.Result    = APPResult.OtherException;
                        result.ErrorDesc = "获取车场信息失败";
                        TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,获取车场信息失败,通道编号:{0}", GateID));
                        return(result);
                    }

                    TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,SFMInterfaceUrl:{0},SFMSecretKey:{1},SFMPKID:{2}", SFMInterfaceUrl, SFMSecretKey, SFMPKID));
                    if (!string.IsNullOrWhiteSpace(SFMInterfaceUrl) && !string.IsNullOrWhiteSpace(SFMSecretKey) && !string.IsNullOrWhiteSpace(SFMPKID))
                    {
                        OutCarInfoResult sfmResult = SFMInterfaceProcess.QueryOutCarOrder(gate.ParkNo, GateID);
                        if (!sfmResult.Success)
                        {
                            result.Result    = APPResult.OtherException;
                            result.ErrorDesc = string.Format("{0}[{1}]", sfmResult.Message, sfmResult.Code);
                            return(result);
                        }
                        if (sfmResult.Data == null)
                        {
                            result.Result    = APPResult.NoCarInBox;
                            result.ErrorDesc = string.Empty;
                            return(result);
                        }
                        return(SFMTransforTempParkingFeeResult(result, sfmResult));
                    }
                }
                catch (Exception ex)
                {
                    TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,异常:{0}", ex.Message));
                }
            }
            else
            {
                TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,参数无效:{0},GateID:{1}", SystemDefaultConfig.SFMPKID, GateID));
            }
            return(result);
        }
Exemplo n.º 2
0
        private static TempParkingFeeResult SFMTransforTempParkingFeeResult(TempParkingFeeResult model, OutCarInfoResult sfmResult)
        {
            if (!sfmResult.Success || sfmResult.Data == null)
            {
                return(model);
            }
            if (sfmResult.Code == "400")
            {
                model.Result = APPResult.AmountIsNot;
                return(model);
            }
            if (sfmResult.Code != "0000")
            {
                model.Result = APPResult.OtherException;
                return(model);
            }
            SMFOutCarInfo payInfo = sfmResult.Data;

            if (!payInfo.payAmount.HasValue || payInfo.payAmount <= 0)
            {
                model.Result = APPResult.NoNeedPay;
                return(model);
            }

            TempParkingFeeResult result = new TempParkingFeeResult();

            result.OrderSource = PayOrderSource.SFM;
            result.PlateNumber = payInfo.carNo;
            result.CardNo      = payInfo.carNo;

            result.ParkingID = SFMPKID;

            result.ExternalPKID = payInfo.Parking_Key;
            BaseParkinfo parking = ParkingServices.QueryParkingByParkingID(SystemDefaultConfig.SFMPKID);

            if (parking != null)
            {
                result.ParkName = parking.PKName;
            }
            result.EntranceDate = DateTime.Parse(payInfo.enterTime);
            result.OutTime      = payInfo.freeTimeout.HasValue ? payInfo.freeTimeout.Value : 10;
            result.isAdd        = true;
            result.PayDate      = DateTime.Now;
            ParkOrder order = new ParkOrder();

            order.RecordID  = payInfo.ParkOrder_OrderNo;
            order.OrderNo   = payInfo.ParkOrder_OrderNo;
            order.TagID     = "1";
            order.OrderType = OrderType.TempCardPayment;
            order.PayWay    = OrderPayWay.WeiXin;

            order.DiscountAmount = payInfo.couponAmount.HasValue ? payInfo.couponAmount.Value : 0;
            order.Amount         = payInfo.totalAmount.HasValue ? payInfo.totalAmount.Value : 0;
            order.UnPayAmount    = 0;
            order.PayAmount      = payInfo.payAmount.HasValue ? payInfo.payAmount.Value : 0;

            order.CarderateID   = "";
            order.Status        = 0;
            order.OrderSource   = OrderSource.WeiXin;
            order.OrderTime     = DateTime.Now;
            order.PayTime       = DateTime.Now;
            order.PKID          = SFMPKID;
            order.UserID        = "";
            order.OnlineUserID  = "";
            order.OnlineOrderNo = "";
            order.Remark        = "";
            result.Pkorder      = order;
            result.OrderSource  = PayOrderSource.SFM;
            return(result);
        }