校正流程明细付款校验口径 #652

Merged
yueyang merged 1 commits from hotfix/yueyang-ding-process-details-validation into main 2026-10-26 20:50:49 +08:00
2 changed files with 18 additions and 6 deletions

View File

@ -103,8 +103,9 @@ return [
'PROC-5AB333E3-4496-4DF3-A5C1-1FBFAB7C72C8' => [
'document_type' => '板材流程',
'detail_table' => '收款费用明细',
'detail_amount_fields' => ['实际需支付金额', '订单金额'],
'detail_amount_fields' => ['订单金额'],
'amount_total_fields' => ['请款金额'],
'payment_table' => '付款明细',
],
'PROC-657E5EEA-DEAA-4DC5-AD8B-A679FE9AD361' => [
'document_type' => '板材流程',

View File

@ -658,14 +658,29 @@ class DingProcessDetailMirrorSynchronizer
? $this->tableRows($fields[$paymentTable] ?? null, $workflow, $paymentTable, $issues)
: [];
$payments = [];
$declaredCents = $this->firstFieldMoneyCents(
$fields,
(array) ($process['payment_total_fields'] ?? []),
);
foreach ($rows as $row) {
$amountCents = $this->moneyFromRow($row, ['付款金额', '付款总金额']);
if ($amountCents === null) {
if (trim((string) ($row['对应序号'] ?? '')) === ''
&& trim((string) ($row['科目编码'] ?? '')) === ''
&& trim((string) ($row['科目名称'] ?? '')) === '') {
continue;
}
$issues[] = (string) ($workflow['businessId'] ?? '') . ' 的付款明细存在空金额';
continue;
}
$accountCode = trim((string) ($row['科目编码'] ?? ''));
if ($accountCode !== ''
&& ! preg_match('/^1(?:001|002|012)(?:\.|$)/', $accountCode)) {
continue;
}
$payments[] = [
'business_id' => mb_substr(trim((string) ($workflow['businessId'] ?? '')), 0, 32),
'process_instance_id' => mb_substr(
@ -677,7 +692,7 @@ class DingProcessDetailMirrorSynchronizer
'sequence_spec' => mb_substr(trim((string) ($row['对应序号'] ?? '')), 0, 255),
'amount' => $this->moneyString($amountCents),
'amount_cents' => $amountCents,
'account_code' => mb_substr(trim((string) ($row['科目编码'] ?? '')), 0, 64),
'account_code' => mb_substr($accountCode, 0, 64),
'account_name' => mb_substr(trim((string) ($row['科目名称'] ?? '')), 0, 255),
'payment_method' => mb_substr(trim((string) ($row['付款方式'] ?? '')), 0, 50),
'paid_at' => mb_substr(trim((string) ($row['打款时间'] ?? '')), 0, 50),
@ -688,10 +703,6 @@ class DingProcessDetailMirrorSynchronizer
];
}
$declaredCents = $this->firstFieldMoneyCents(
$fields,
(array) ($process['payment_total_fields'] ?? []),
);
$detailPaymentCents = array_sum(array_column($payments, 'amount_cents'));
if ($declaredCents !== null) {