fix: 为无科目OA模板增加费用归类兜底 #822
@ -51,6 +51,8 @@ return [
|
||||
'document_type' => '应付申请流程',
|
||||
'detail_table' => '应付明细',
|
||||
'detail_amount_fields' => ['付款金额'],
|
||||
'fallback_account_code' => '2202.01',
|
||||
'fallback_account_name' => '应付账款_供货商',
|
||||
'payment_table' => '付款明细',
|
||||
'payment_total_fields' => ['付款金额合计'],
|
||||
],
|
||||
@ -58,6 +60,8 @@ return [
|
||||
'document_type' => '线上代发业务报销',
|
||||
'detail_table' => '收款费用明细',
|
||||
'detail_amount_fields' => ['代发订单金额'],
|
||||
'fallback_account_code' => '1405.06',
|
||||
'fallback_account_name' => '库存商品_线上代发',
|
||||
'payment_table' => '付款明细',
|
||||
],
|
||||
'PROC-C5159B8D-F412-4DF8-981D-64EBB8D03EB6' => [
|
||||
|
||||
@ -1193,6 +1193,12 @@ class DingProcessDetailMirrorSynchronizer
|
||||
if ($accountName === '') {
|
||||
$accountName = trim((string) $this->scalarValue($fields['科目名称'] ?? null));
|
||||
}
|
||||
if ($accountCode === '') {
|
||||
$accountCode = trim((string) ($process['fallback_account_code'] ?? ''));
|
||||
}
|
||||
if ($accountName === '') {
|
||||
$accountName = trim((string) ($process['fallback_account_name'] ?? ''));
|
||||
}
|
||||
$details[] = $this->detailRecord(
|
||||
$workflow,
|
||||
$process,
|
||||
|
||||
@ -345,6 +345,63 @@ class DingProcessDetailMirrorSynchronizerTest extends TestCase
|
||||
$this->assertContains('process-account-columns', $this->approvalClient->calls);
|
||||
}
|
||||
|
||||
public function test_process_fallback_account_keeps_legacy_rows_in_expense_summary(): void
|
||||
{
|
||||
config([
|
||||
'upstream_mirrors.ding_process_details.processes.PROC-39DD70DE-DAB2-4A5F-B8F1-0B0B68BD0C88' => [
|
||||
'document_type' => '应付申请流程',
|
||||
'detail_table' => '应付明细',
|
||||
'detail_amount_fields' => ['付款金额'],
|
||||
'fallback_account_code' => '2202.01',
|
||||
'fallback_account_name' => '应付账款_供货商',
|
||||
'payment_table' => '付款明细',
|
||||
'payment_total_fields' => ['付款金额合计'],
|
||||
],
|
||||
]);
|
||||
$this->query->workflows = [[
|
||||
'processInstanceId' => 'process-payable-no-account',
|
||||
'processCode' => 'PROC-39DD70DE-DAB2-4A5F-B8F1-0B0B68BD0C88',
|
||||
'businessId' => '202603090926000222573',
|
||||
'title' => '三洋木业合同月结预付款',
|
||||
'status' => 'COMPLETED',
|
||||
'result' => 'AGREE',
|
||||
'originatorUserId' => 'user-1',
|
||||
'joinAt' => '2026-03-09 09:26:00',
|
||||
'finishTime' => '2026-03-10 10:00:00',
|
||||
]];
|
||||
$this->query->scheme = [
|
||||
'应付明细' => json_encode([[
|
||||
'rowValue' => [
|
||||
['label' => '序号', 'value' => '1'],
|
||||
['label' => '类型', 'value' => '供应商货款-月结'],
|
||||
['label' => '用途', 'value' => '三洋木业合同月结预付款30%申请'],
|
||||
['label' => '付款金额', 'value' => '46800.00'],
|
||||
],
|
||||
]], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
|
||||
'付款明细' => json_encode([[
|
||||
'rowValue' => [
|
||||
['label' => '对应序号', 'value' => '1'],
|
||||
['label' => '付款金额', 'value' => '46800.00'],
|
||||
['label' => '打款时间', 'value' => '2026-03-10'],
|
||||
],
|
||||
]], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR),
|
||||
'付款金额合计' => 46800,
|
||||
];
|
||||
$this->approvalClient->valuesByInstance['process-payable-no-account'] = [
|
||||
'应付明细' => $this->query->scheme['应付明细'],
|
||||
];
|
||||
|
||||
$this->synchronizer->sync(true);
|
||||
|
||||
$row = DB::connection('business_mirror')
|
||||
->table('ding_process_detail_mirror')
|
||||
->where('process_instance_id', 'process-payable-no-account')
|
||||
->first();
|
||||
$this->assertSame('2202.01', $row->account_code);
|
||||
$this->assertSame('应付账款_供货商', $row->account_name);
|
||||
$this->assertEqualsWithDelta(46800.0, (float) $row->amount, 0.001);
|
||||
}
|
||||
|
||||
public function test_completed_workflow_uses_cashier_status_and_keeps_difference_separate(): void
|
||||
{
|
||||
$this->query->workflows = [[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user