Bitzsoft.Integrations.Finance.Invoice.Kingdee 1.0.0-alpha.10

This is a prerelease version of Bitzsoft.Integrations.Finance.Invoice.Kingdee.
dotnet add package Bitzsoft.Integrations.Finance.Invoice.Kingdee --version 1.0.0-alpha.10
                    
NuGet\Install-Package Bitzsoft.Integrations.Finance.Invoice.Kingdee -Version 1.0.0-alpha.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.Finance.Invoice.Kingdee" Version="1.0.0-alpha.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Finance.Invoice.Kingdee" Version="1.0.0-alpha.10" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Finance.Invoice.Kingdee" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.Finance.Invoice.Kingdee --version 1.0.0-alpha.10
                    
#r "nuget: Bitzsoft.Integrations.Finance.Invoice.Kingdee, 1.0.0-alpha.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.Finance.Invoice.Kingdee@1.0.0-alpha.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.Finance.Invoice.Kingdee&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Finance.Invoice.Kingdee&version=1.0.0-alpha.10&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.Finance.Invoice.Kingdee

金蝶发票云服务实现 -- 对接金蝶发票云(票易通 / Piaozone)开放平台 API,提供发票全生命周期管理。

功能特性

  • 完整开票能力:开具蓝字发票、红字冲销、作废(基于 IInvoiceProvider
  • 机动车与二手车IKingdeeIssueProvider 提供机动车销售统一发票、二手车销售统一发票的开具 / 查询 / 红冲
  • 数电异步开票IKingdeeIssueProvider.IssueDigitalAsync 提交异步数电开票任务并通过 QueryDigitalAsyncResultAsync 轮询结果
  • 红字信息表IKingdeeIssueProvider.ApplyRedLetterAsync / QueryRedLetterAsync 支持增值税专用发票红冲前的红字信息表申请与查询
  • 辅助查询:税控设备信息、票种信息、授信额度、电子发票库存、税收分类编码查询
  • 企业级查询IKingdeeQueryProvider 提供销项 / 进项发票的企业级批量查询
  • 批量查验与 OCRIKingdeeVerifyProvider 提供批量异步查验、批量 OCR 识别、批量识别并查验一体化(继承 IInvoiceOcrProvider
  • 进项抵扣闭环IKingdeeInputProvider 提供税款所属期查询、进项采集、勾选 / 取消勾选、统计生成 / 撤回 / 确认、进项查询
  • 聚合接口IKingdeeInvoiceProvider 通过 Issue / Query / Verify / Input 属性聚合上述能力

安装

.NET CLI

dotnet add package Bitzsoft.Integrations.Finance.Invoice.Kingdee

PackageReference

<PackageReference Include="Bitzsoft.Integrations.Finance.Invoice.Kingdee" Version="1.0.0" />

配置

appsettings.json

{
  "Finance": {
    "Invoice": {
      "Kingdee": {
        "AppId": "金蝶提供的 AppId",
        "AppSecret": "双方约定的 AppSecret",
        "TaxNo": "企业税号",
        "BaseUrl": "https://api.kingdee.com/piaozone"
      }
    }
  }
}
配置项 必填 默认值 说明
AppId 金蝶开放平台应用标识
AppSecret 双方约定的应用密钥
TaxNo 销方纳税人识别号
BaseUrl https://api.kingdee.com/piaozone 金蝶发票云 API 基地址

含 AppSecret 等敏感信息,严禁序列化、日志输出或暴露给前端。

注册服务

从 IConfiguration 绑定(推荐)

using Bitzsoft.Integrations.Finance.Invoice.Kingdee;

builder.Services.AddBitzsoftKingdeeInvoice(
    builder.Configuration,
    "Finance:Invoice:Kingdee");

委托配置

builder.Services.AddBitzsoftKingdeeInvoice(options =>
{
    options.AppId = "金蝶提供的 AppId";
    options.AppSecret = "双方约定的 AppSecret";
    options.TaxNo = "企业税号";
});

注册后 Provider 为 Singleton,通过 KingdeeAuthHandler 自动注入令牌,同时注册聚合接口 IKingdeeInvoiceProvider、抽象接口 IInvoiceProvider / IInvoiceOcrProvider 与各角色接口。

第三方请求日志

内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认使用 NullRequestLogStore 不持久化。

// 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
    opts.SensitiveFields.Add("AppSecret");
});
services.AddBitzsoftKingdeeInvoice(options => { /* ... */ });

使用示例

using Bitzsoft.Integrations.Finance.Invoice.Kingdee;
using Bitzsoft.Integrations.Finance.Invoice.Models;

// 注入聚合接口,通过属性访问各能力域
public class KingdeeService(IKingdeeInvoiceProvider kingdee)
{
    // 基础开票(来自 IInvoiceProvider)
    public Task<InvoiceIssueResult> IssueAsync(InvoiceIssueRequest req) => kingdee.IssueAsync(req);

    // 数电异步开票
    public async Task<InvoiceIssueResult> IssueDigitalAsync(InvoiceIssueRequest req)
    {
        var task = await kingdee.Issue.IssueDigitalAsync(req);
        // 轮询直到完成(实际应用中可间隔轮询)
        var result = await kingdee.Issue.QueryDigitalAsyncResultAsync(task.TaskId);
        return result.ToIssueResult();
    }

    // 进项勾选
    public Task TickAsync(IEnumerable<string> ids) => kingdee.Input.TickInvoiceAsync(ids);
}

// 或直接注入所需角色接口
public class VerifyOnlyService(IKingdeeVerifyProvider verify)
{
    public Task<string> BatchVerifyAsync(IEnumerable<InvoiceVerifyRequest> reqs)
        => verify.VerifyMultipleAsync(reqs);
}

核心类型一览

Provider 与注册

类型 说明
KingdeeInvoiceProvider 金蝶发票云服务实现(sealed partial,Singleton)
ServiceCollectionExtensions.AddBitzsoftKingdeeInvoice DI 注册扩展(Action<KingdeeOptions>IConfiguration 双重载)
KingdeeOptions 配置选项(见上表)

扩展接口

接口 能力 主要方法
IKingdeeInvoiceProvider 聚合接口(通过 Issue / Query / Verify / Input 属性分组暴露能力) 继承 IInvoiceProvider
IKingdeeIssueProvider 开票扩展 IssueVehicleAsync / IssueUsedCarAsync / IssueDigitalAsync / QueryDigitalAsyncResultAsync / ApplyRedLetterAsync / QueryRedLetterAsync / GetTaxDeviceInfoAsync / GetInvoiceTypeInfoAsync / QueryCreditAsync / QueryElectronicStockAsync / QueryTaxClassificationAsync
IKingdeeQueryProvider 企业级查询 QuerySalesInvoicesAsync / QueryInputInvoicesAsync
IKingdeeVerifyProvider 查验与 OCR(继承 IInvoiceOcrProvider VerifyMultipleAsync / RecognizeMultipleAsync / RecognizeAndVerifyMultipleAsync
IKingdeeInputProvider 进项抵扣管理 GetTaxPeriodAsync / CollectInputInvoiceAsync / CollectCustomsPaymentAsync / TickInvoiceAsync / UntickInvoiceAsync / GenerateStatisticsAsync / RevokeStatisticsAsync / ConfirmStatisticsAsync / GetCurrentStatisticsAsync / GetHistoricalStatisticsAsync / QueryFullInvoicesAsync / QueryTickedInvoicesAsync

同时实现抽象层接口:IInvoiceProviderIInvoiceOcrProvider

金蝶特有模型(位于 Models/

类型 说明
KingdeeAsyncIssueResult 数电异步开票结果(含 TaskId)
KingdeeCreditResult 授信额度信息
KingdeeInputQueryResult 进项查询结果
KingdeeInvoiceTypeInfo 票种信息
KingdeeIssueResult 开票结果
KingdeeTaxDeviceInfo 税控设备信息

依赖

说明
Bitzsoft.Integrations.Finance.Invoice 发票管理抽象层
Bitzsoft.Integrations.RequestLogging 出站请求记录管道
Microsoft.Extensions.Http IHttpClientFactory(Typed Client 连接池)
Microsoft.Extensions.Options.ConfigurationExtensions Options 配置节点绑定

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Finance.Invoice.Kingdee:

Package Downloads
Bitzsoft.Integrations.Finance.Invoice.All

发票管理服务聚合包 — 包含所有供应商实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.10 37 7/26/2026
1.0.0-alpha.9 57 7/12/2026
1.0.0-alpha.8 68 7/1/2026
1.0.0-alpha.7 77 6/16/2026
1.0.0-alpha.6 74 6/16/2026
1.0.0-alpha.5 63 6/14/2026