示例#1
0
        protected override void RunCommand()
        {
            TaxCard taxCard = TaxCardFactory.CreateTaxCard();

            new InvSplitPara().GetInvSplitPara(InvType.Special);
            SPFLService service = new SPFLService();

            if (CommonTool.isSPBMVersion() && (service.GetMaxBMBBBH() == "0.0"))
            {
                MessageBox.Show("商品和服务税收分类编码表为空,请先更新商品和服务税收分类编码表后,再开具发票!");
            }
            else
            {
                GenerateFP efp  = new GenerateFP(InvType.Special);
                string     code = "";
                if (!efp.CanInvoice(0, out code))
                {
                    MessageManager.ShowMsgBox(code);
                }
                else if (!this.CanXTInv(taxCard))
                {
                    MessageManager.ShowMsgBox("INP-242132");
                }
                else
                {
                    efp.ShowDialog();
                }
            }
        }
示例#2
0
        async Task ExecuteCreateFPCommand()
        {
            if (!IsBusy)
            {
                try
                {
                    IsBusy    = true;
                    AltitudeC = string.IsNullOrEmpty(AltitudeC) ? "35000" : AltitudeC;
                    var fp = new GenerateFP
                    {
                        FromIcao    = Departue,
                        ToIcao      = Destination,
                        MaxAlt      = AltitudeC,
                        CruiseSpeed = SpeedC
                    };

                    var result = await FP.Current.GenerateRouteAsync(fp);

                    await Navigation.PushAsync <FpDetailViewModel>(false, result);
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Erro", $"Erro:{ex.Message}", "Ok");
                }
                finally
                {
                    IsBusy = false;
                }
            }
            return;
        }
示例#3
0
        protected override void RunCommand()
        {
            TaxCard      taxCard = TaxCardFactory.CreateTaxCard();
            InvSplitPara para    = new InvSplitPara();

            para.GetInvSplitPara(InvType.Common);
            bool flag = taxCard.get_StateInfo().CompanyType != 0;

            if (para.ShowSetForm && flag)
            {
                GenerateInvSetForm form2 = new GenerateInvSetForm(InvType.Common)
                {
                    NCPBZ = 1
                };
                form2.ShowDialog();
            }
            else
            {
                GenerateFP efp  = new GenerateFP(InvType.Common, 1);
                string     code = "";
                if (!efp.CanInvoice(2, out code))
                {
                    MessageManager.ShowMsgBox(code);
                }
                else if (!this.CanXTInv(taxCard))
                {
                    MessageManager.ShowMsgBox("INP-242132");
                }
                else
                {
                    efp.ShowDialog();
                }
            }
        }
示例#4
0
文件: Api.cs 项目: pictos/APIFP
        public async Task <GenerateResponseFP> GenerateRouteAsync(GenerateFP fp)
        {
            var teste = JsonConvert.SerializeObject(fp);

            using (var content = new StringContent(teste, Encoding.UTF8, "application/json"))
            {
                var response = await Client.PostAsync(Const.generateUrl, content).ConfigureAwait(false);

                var json = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    var show = JsonConvert.DeserializeObject <GenerateResponseFP>(json);
                    //show.Positions = new List<Position>();
                    var myFp = GooglePoints.Decode(show.EncodedPolyline);

                    foreach (var item in myFp)
                    {
                        show.Positions.Add(new Position(item.Latitude, item.Longitude));
                    }

                    return(show);
                }

                else
                {
                    var msg = ApiException(json);
                    throw new BadRequestException(msg);
                }
            }
        }
        protected override void RunCommand()
        {
            SPFLService  service;
            TaxCard      taxCard = TaxCardFactory.CreateTaxCard();
            InvSplitPara para    = new InvSplitPara();

            para.GetInvSplitPara(InvType.Common);
            bool flag = taxCard.get_StateInfo().CompanyType != 0;

            if (para.ShowSetForm && flag)
            {
                service = new SPFLService();
                if (CommonTool.isSPBMVersion() && (service.GetMaxBMBBBH() == "0.0"))
                {
                    MessageBox.Show("商品和服务税收分类编码表为空,请先更新商品和服务税收分类编码表后,再开具发票!");
                }
                else
                {
                    GenerateInvSetForm form2 = new GenerateInvSetForm(InvType.Common)
                    {
                        NCPBZ = 2
                    };
                    form2.ShowDialog();
                }
            }
            else
            {
                service = new SPFLService();
                if (CommonTool.isSPBMVersion() && (service.GetMaxBMBBBH() == "0.0"))
                {
                    MessageBox.Show("商品和服务税收分类编码表为空,请先更新商品和服务税收分类编码表后,再开具发票!");
                }
                else
                {
                    GenerateFP efp  = new GenerateFP(InvType.Common, 2);
                    string     code = "";
                    if (!efp.CanInvoice(2, out code))
                    {
                        MessageManager.ShowMsgBox(code);
                    }
                    else if (!this.CanXTInv(taxCard))
                    {
                        MessageManager.ShowMsgBox("INP-242132");
                    }
                    else
                    {
                        JSFPJSelect select = new JSFPJSelect(2);
                        if (select.ShowDialog() == DialogResult.OK)
                        {
                            if (efp.GetCurrent(0x29) != null)
                            {
                            }
                            efp.ShowDialog();
                        }
                    }
                }
            }
        }
示例#6
0
 public async Task CreateFP_WithoutKey_ReturnError()
 {
     await Assert.ThrowsExceptionAsync <BadRequestException>(async() =>
     {
         var fp = new GenerateFP
         {
             FromIcao = "SBCF",
             ToIcao   = "SBGR"
         };
         api.Init("batata");
         var result = await api.GenerateRouteAsync(fp);
     });
 }
示例#7
0
        public async Task CreateFP_ReturnJson()
        {
            api.Init();

            var fp = new GenerateFP
            {
                FromIcao = "SBCF",
                ToIcao   = "SBGR"
            };
            var result = await api.GenerateRouteAsync(fp);

            Assert.IsInstanceOfType(result, typeof(GenerateResponseFP));
        }
示例#8
0
        protected override void RunCommand()
        {
            GenerateFP efp = new GenerateFP(InvType.vehiclesales, 4);

            if (efp.FPleftnum == 0)
            {
                MessageManager.ShowMsgBox("INP-242103");
            }
            else
            {
                efp.ShowDialog();
            }
        }
示例#9
0
        static async Task TesteException()
        {
            try
            {
                var api = FP.Current;
                var fp  = new GenerateFP
                {
                    FromIcao = "EHAM",
                    ToIcao   = "KJFK"
                };

                var retorno = await api.GenerateRouteAsync(fp);
            }
            catch (BadRequestException ex)
            {
                // var exc = ErrorMessage.FromJson(ex.Message);
                WriteLine(ex.Message);
                //await Task.Delay(1);
                //throw;
            }
        }
示例#10
0
        protected override void RunCommand()
        {
            SPFLService service = new SPFLService();

            if (CommonTool.isSPBMVersion() && (service.GetMaxBMBBBH() == "0.0"))
            {
                MessageBox.Show("商品和服务税收分类编码表为空,请先更新商品和服务税收分类编码表后,再开具发票!");
            }
            else
            {
                GenerateFP efp  = new GenerateFP(InvType.transportation);
                string     code = "";
                if (!efp.CanInvoice(11, out code))
                {
                    MessageManager.ShowMsgBox(code);
                }
                else
                {
                    efp.ShowDialog();
                }
            }
        }