This commit is contained in:
sophie committed 2026-09-07 11:13:33 +08:00
1 parent 78576f5745
commit 63b997a7e4
68 files changed
+3680 -1413

No files matched your search

@@ -1,82 +1,89 @@
/**
* features/workspace/api/voucherCheck.api.ts
* 用途:工作台立账凭证检核记录查询 API 客户端。
* 用途:工作台立账凭证检核任务列表、批次明细与强制重检 API 客户端。
* 依赖:@/shared/api/client、getAuthHeaders。
* 逻辑:AccountingVoucherCheckView 调用;对应 /api/workspace/accounting-voucher-check/*。
*/
import { requestJson } from '@/shared/api/client';
import { getAuthHeaders } from '@/shared/utils/auth';
export interface VoucherCheckStateItem {
export interface VoucherCheckRunItem {
id: number;
scope_code: string;
schedule_run_id?: number | null;
run_no: string;
profile_code: string;
period_month: string | null;
invoice_no: string;
invoice_date?: string | null;
mode: string;
status: string;
folder_path?: string | null;
folder_exists?: boolean;
matched_files?: Record<string, string>;
missing_materials?: Array<{ code?: string; name?: string }>;
last_checked_at?: string | null;
last_missing_notified_on?: string | null;
subject_count: number;
missing_file_count: number;
missing_invoice_count: number;
technical_error_count: number;
staged_file_count: number;
finished_at?: string | null;
}
export interface VoucherCheckStatesResponse {
scope_code: string;
period: string;
export interface VoucherCheckRunsResponse {
page: number;
page_size: number;
total: number;
items: VoucherCheckStateItem[];
items: VoucherCheckRunItem[];
}
export interface VoucherCheckRunInvoiceItem {
id: number;
invoice_no: string;
result: string;
status_label?: string | null;
missing_materials?: Array<{ code?: string; name?: string }>;
cells?: Record<string, string>;
checked_at?: string | null;
}
export interface VoucherCheckRunItemsResponse {
run_id: number;
engine_run_id?: number;
run_no: string;
page: number;
page_size: number;
total: number;
items: Array<{
id: number;
invoice_no: string;
invoice_date?: string | null;
result: string;
folder_path?: string | null;
folder_exists?: boolean;
matched_files?: Record<string, string>;
missing_materials?: Array<{ code?: string; name?: string }>;
error_code?: string | null;
error_message?: string | null;
checked_at?: string | null;
}>;
items: VoucherCheckRunInvoiceItem[];
}
export interface VoucherCheckForceRunResponse {
schedule_task_id: number;
schedule_run_id: number;
run_no: string;
job_id: number;
mode: string;
status: string;
}
/**
* 按月份/状态/发票号筛选最新检核状态。
* 分页查询检核任务列表。
*/
export function listVoucherCheckStates(params: {
export function listVoucherCheckRuns(params: {
period?: string;
profile_code?: string;
status?: string;
invoice_no?: string;
page?: number;
page_size?: number;
}) {
const q = new URLSearchParams();
if (params.period) q.set('period', params.period);
if (params.profile_code) q.set('profile_code', params.profile_code);
if (params.status) q.set('status', params.status);
if (params.invoice_no) q.set('invoice_no', params.invoice_no);
if (params.page) q.set('page', String(params.page));
if (params.page_size) q.set('page_size', String(params.page_size));
const qs = q.toString();
return requestJson<VoucherCheckStatesResponse>(
`/api/workspace/accounting-voucher-check/states${qs ? `?${qs}` : ''}`,
return requestJson<VoucherCheckRunsResponse>(
`/api/workspace/accounting-voucher-check/runs${qs ? `?${qs}` : ''}`,
{ headers: getAuthHeaders() },
);
}
/**
* 分页查询指定批次明细。
* 分页查询指定排程批次的 invoice 明细。
*/
export function listVoucherCheckRunItems(runId: number, params?: { result?: string; page?: number; page_size?: number }) {
const q = new URLSearchParams();
@@ -89,3 +96,17 @@ export function listVoucherCheckRunItems(runId: number, params?: { result?: stri
{ headers: getAuthHeaders() },
);
}
/**
* 强制重检上一个自然月(不走增量跳过)。
*/
export function triggerVoucherCheckForceAll() {
return requestJson<VoucherCheckForceRunResponse>(
'/api/workspace/accounting-voucher-check/runs',
{
method: 'POST',
headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
body: JSON.stringify({ mode: 'force_all' }),
},
);
}