feat(顾家对账): 增加灵珊虚拟过账汇总卡片 (#1328)

This commit is contained in:
chenxi 2026-11-20 17:23:55 +08:00
parent c713db6fe5
commit 6d85f64d84
5 changed files with 90 additions and 1 deletions

View File

@ -144,6 +144,7 @@ class KukaReconciliationPageData
$orders = [];
$postingQuantityTotal = '0';
$postingSupplierAmountTotal = '0.00';
$postingSalesAmountTotal = '0.00';
$supplierAmountTotal = '0.00';
$salesAmountTotal = '0.00';
$shippingMatched = 0;
@ -303,6 +304,10 @@ class KukaReconciliationPageData
$postingSupplierAmountTotal,
$supplierAmount,
);
$postingSalesAmountTotal = $this->addMoney(
$postingSalesAmountTotal,
$salesAmount,
);
}
if (! isset($inventory[$materialNumber])) {
@ -417,6 +422,7 @@ class KukaReconciliationPageData
'posting_material_count' => count($posting),
'posting_quantity_total' => $this->formatQuantity($postingQuantityTotal),
'posting_supplier_amount_total' => $postingSupplierAmountTotal,
'posting_sales_amount_total' => $postingSalesAmountTotal,
'toc_quantity_total' => $this->formatQuantity($postingQuantityTotal),
'order_count' => count($orders),
'skipped_missing_material_rows' => $skippedMissingMaterial,
@ -732,6 +738,7 @@ class KukaReconciliationPageData
'posting_material_count' => 0,
'posting_quantity_total' => '0',
'posting_supplier_amount_total' => '0.00',
'posting_sales_amount_total' => '0.00',
'toc_quantity_total' => '0',
'order_count' => 0,
'skipped_missing_material_rows' => 0,

View File

@ -187,6 +187,13 @@
'quantityTotal' => $kukaReconciliation['summary']['toc_quantity_total'] ?? '0',
])
@endif
@if ($tab['slug'] === 'lingshan-virtual-posting' && empty($kukaReconciliation['error']))
@include('business.pages.posting-data.partials.kuka-reconciliation-virtual-summary', [
'quantityTotal' => $kukaReconciliation['summary']['posting_quantity_total'] ?? '0',
'supplierAmountTotal' => $kukaReconciliation['summary']['posting_supplier_amount_total'] ?? '0.00',
'salesAmountTotal' => $kukaReconciliation['summary']['posting_sales_amount_total'] ?? '0.00',
])
@endif
@if (! empty($tab['headers']))
@include($sourceTable, [
'title' => $tab['title'],
@ -201,7 +208,7 @@
'notice' => $tab['slug'] === 'erp-product-import'
? ($kukaReconciliation['notices']['erp'] ?? null)
: null,
'showHeader' => ! in_array($tab['slug'], ['posting-data', 'toc-orders'], true),
'showHeader' => ! in_array($tab['slug'], ['posting-data', 'toc-orders', 'lingshan-virtual-posting'], true),
'emptyMessage' => '当前账期没有可生成的过账数据。',
])
@else

View File

@ -0,0 +1,65 @@
<div class="kuka-virtual-summary" role="region" aria-label="灵珊虚拟过账汇总">
<article class="kuka-virtual-summary__card" data-kuka-virtual-summary-card="quantity">
<span class="kuka-virtual-summary__label">
<span class="material-icons-outlined" aria-hidden="true">inventory_2</span>
采购数量
</span>
<strong>{{ number_format((float) $quantityTotal, 0, '.', ',') }}</strong>
</article>
<article class="kuka-virtual-summary__card" data-kuka-virtual-summary-card="supplier-amount">
<span class="kuka-virtual-summary__label">
<span class="material-icons-outlined" aria-hidden="true">payments</span>
供货商金额
</span>
<strong>{{ number_format((float) $supplierAmountTotal, 2, '.', ',') }}</strong>
</article>
<article class="kuka-virtual-summary__card" data-kuka-virtual-summary-card="sales-amount">
<span class="kuka-virtual-summary__label">
<span class="material-icons-outlined" aria-hidden="true">trending_up</span>
销售金额
</span>
<strong>{{ number_format((float) $salesAmountTotal, 2, '.', ',') }}</strong>
</article>
</div>
<style>
.kuka-virtual-summary {
display: grid;
min-width: 0;
grid-template-columns: repeat(3, minmax(10rem, 1fr));
gap: 12px;
}
.kuka-virtual-summary__card {
display: grid;
min-width: 0;
gap: 7px;
padding: 13px 16px;
border: 1px solid var(--vip-border, #d8d2c7);
border-radius: 12px;
background: var(--vip-surface, #fff);
}
.kuka-virtual-summary__label {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--vip-content-muted, #595959);
font-size: 11px;
font-weight: 500;
}
.kuka-virtual-summary__label .material-icons-outlined {
color: var(--vip-content-accent-dark, #856632);
font-size: 16px;
}
.kuka-virtual-summary__card strong {
color: var(--vip-content-ink, #171717);
font-size: 22px;
font-variant-numeric: tabular-nums;
font-weight: 700;
line-height: 1.2;
}
@media (max-width: 720px) {
.kuka-virtual-summary {
grid-template-columns: 1fr;
}
}
</style>

View File

@ -43,6 +43,9 @@ class KukaReconciliationPageTest extends FeatureTestCase
->assertSee('data-kuka-posting-card="quantity"', false)
->assertSee('data-kuka-posting-card="supplier-amount"', false)
->assertSee('data-kuka-toc-quantity-card', false)
->assertSee('data-kuka-virtual-summary-card="quantity"', false)
->assertSee('data-kuka-virtual-summary-card="supplier-amount"', false)
->assertSee('data-kuka-virtual-summary-card="sales-amount"', false)
->assertDontSeeText('有效物料行')
->assertSeeText('供货商金额')
->assertSeeText('N单号')
@ -83,6 +86,12 @@ class KukaReconciliationPageTest extends FeatureTestCase
$this->assertNotFalse($tocPanelEnd);
$tocPanel = substr($html, $tocPanelStart, $tocPanelEnd - $tocPanelStart);
$this->assertStringNotContainsString('<header class="kuka-source-table__header">', $tocPanel);
$virtualPanelStart = strpos($html, 'data-kuka-reconciliation-panel="lingshan-virtual-posting"');
$virtualPanelEnd = strpos($html, 'data-kuka-reconciliation-panel="', $virtualPanelStart + 20);
$this->assertNotFalse($virtualPanelStart);
$this->assertNotFalse($virtualPanelEnd);
$virtualPanel = substr($html, $virtualPanelStart, $virtualPanelEnd - $virtualPanelStart);
$this->assertStringNotContainsString('<header class="kuka-source-table__header">', $virtualPanel);
}
public function test_kuka_reconciliation_tab_can_open_directly_from_the_url(): void

View File

@ -142,6 +142,7 @@ class KukaReconciliationPageDataTest extends TestCase
$this->assertSame(1, $data['summary']['posting_material_count']);
$this->assertSame('2', $data['summary']['posting_quantity_total']);
$this->assertSame('20.00', $data['summary']['posting_supplier_amount_total']);
$this->assertSame('22.22', $data['summary']['posting_sales_amount_total']);
$this->assertSame('2', $data['summary']['toc_quantity_total']);
$this->assertSame(1, $data['summary']['skipped_missing_material_rows']);
$this->assertSame(1, $data['summary']['skipped_zero_quantity_rows']);