Beispiel #1
0
        static void postQueryJson(QueryViewModel viewModel, string url, string type)
        {
            InvoiceQuery query = new InvoiceQuery();

            query.invoiceReqSerialNo = viewModel.InvoiceReqSerialNo;
            query.taxpayerNum        = viewModel.TaxpayerNum;
            string content = JsonHelper.Object2String <InvoiceQuery>(query).Replace("\\", "");

            mLogger.Info("查询发票业务内容JSON串");

            Task.Factory.StartNew(() =>
            {
                MsgResponse rsp = mApi.PostQueryJson(url, content);
                Console.WriteLine(rsp.msg);
                if (OnHttpPost != null)
                {
                    OnHttpPost(type + "发票查询" + rsp.msg);
                }
                //if (OnQueryHttpPost != null)
                //{
                //    OnQueryHttpPost(type + "发票查询", rsp.code);
                //}


                if (rsp.code == "0000")
                {
                    viewModel.Code        = rsp.QueryContent.code == "0000" ? "开票成功" : rsp.QueryContent.code == "9999" ? "开票中" : "失败";
                    viewModel.InvoiceDate = rsp.QueryContent.invoiceDate;
                    viewModel.InvoiceType = rsp.QueryContent.invoiceType == "1" ? "蓝票" : "红票";
                    viewModel.TradeNo     = rsp.QueryContent.tradeNo;
                    viewModel.InvoiceNo   = rsp.QueryContent.invoiceNo;
                    viewModel.DownloadUrl = rsp.QueryContent.downloadUrl;
                }
                else
                {
                    viewModel.Code        = "空";
                    viewModel.InvoiceDate = "0000-00-00";
                    viewModel.InvoiceType = "空";
                    viewModel.TradeNo     = "空";
                    viewModel.InvoiceNo   = "空";
                    viewModel.DownloadUrl = "空";
                }
            });
        }
Beispiel #2
0
        internal static void QueryElectronic(QueryViewModel viewModel)
        {
            string url = ConfigurationManager.AppSettings["ElectronicQuery"];

            postQueryJson(viewModel, url, "电子");
        }
Beispiel #3
0
        internal static void QueryPaper(QueryViewModel viewModel)
        {
            string url = ConfigurationManager.AppSettings["PaperQuery"];

            postQueryJson(viewModel, url, "纸质");
        }