feat: 供应商对账推送增加内容预览和结算口径 (#1018)
Co-authored-by: 苏木 <594326199@qq.com> Co-committed-by: 苏木 <594326199@qq.com>
This commit is contained in:
parent
18222b6ba4
commit
605bfbbe5c
@ -168,10 +168,13 @@ class SupplierReconciliation extends Controller
|
||||
'supplier' => ['required', 'string', 'max:191'],
|
||||
'month' => ['required', 'string', 'regex:/^\d{4}-(0[1-9]|1[0-2])$/'],
|
||||
'reconciler' => ['nullable', 'string', 'max:191'],
|
||||
'push_basis' => ['nullable', 'in:settlement,mine'],
|
||||
]);
|
||||
[$supplier, $companyId] = $this->returnTarget($request);
|
||||
$month = trim((string) $request->input('month'));
|
||||
$reconciler = trim((string) $request->input('reconciler', ''));
|
||||
$pushBasis = trim((string) $request->input('push_basis', 'settlement'));
|
||||
$pushBasis = $pushBasis === 'mine' ? 'mine' : 'settlement';
|
||||
$detail = $this->pageData->financeDetailForFilters($supplier, $companyId, [
|
||||
'month' => $month,
|
||||
'reconciler' => $reconciler,
|
||||
@ -182,9 +185,15 @@ class SupplierReconciliation extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$totals = (array) ($detail['sourceTotals'] ?? []);
|
||||
$qty = (float) ($totals['mineQty'] ?? 0);
|
||||
$amount = (float) ($totals['mineAmount'] ?? 0);
|
||||
if ($pushBasis === 'mine') {
|
||||
$totals = (array) ($detail['sourceTotals'] ?? []);
|
||||
$qty = (float) ($totals['mineQty'] ?? 0);
|
||||
$amount = (float) ($totals['mineAmount'] ?? 0);
|
||||
} else {
|
||||
$summary = (array) ($detail['summary'] ?? []);
|
||||
$qty = (float) ($summary['settleQty'] ?? 0);
|
||||
$amount = (float) ($summary['settleAmount'] ?? 0);
|
||||
}
|
||||
if (abs($qty) < 0.00005 && abs($amount) < 0.005) {
|
||||
return back()->withErrors([
|
||||
'dingtalk_summary_push' => '当前账期没有可推送的对账数据。',
|
||||
|
||||
@ -82,6 +82,7 @@ class SupplierStatementMatcher
|
||||
'theirsAmount' => 0.0,
|
||||
'supplierOverQty' => 0.0,
|
||||
'supplierOverAmount' => 0.0,
|
||||
'settleQty' => 0.0,
|
||||
'settleAmount' => 0.0,
|
||||
];
|
||||
|
||||
@ -114,6 +115,7 @@ class SupplierStatementMatcher
|
||||
$summary['theirsAmount'] = round($summary['theirsAmount'], 2);
|
||||
$summary['supplierOverQty'] = round($summary['supplierOverQty'], 4);
|
||||
$summary['supplierOverAmount'] = round($summary['supplierOverAmount'], 2);
|
||||
$summary['settleQty'] = round($summary['settleQty'], 4);
|
||||
$summary['settleAmount'] = round($summary['settleAmount'], 2);
|
||||
$summary['differenceAmount'] = round($summary['mineAmount'] - $summary['settleAmount'], 2);
|
||||
|
||||
@ -324,11 +326,13 @@ class SupplierStatementMatcher
|
||||
|
||||
if ($mineRow === null) {
|
||||
$type = self::TYPE_SUPPLIER_EXTRA;
|
||||
$settleQty = 0.0;
|
||||
$settle = 0.0;
|
||||
$note = '厂家整条多报:' . $quantityDifference . ';四层匹配后仍未找到我方对应记录,不结算';
|
||||
$summary['supplierExtra']++;
|
||||
} elseif ($theirsRow === null) {
|
||||
$type = self::TYPE_SUPPLIER_MISSING;
|
||||
$settleQty = 0.0;
|
||||
$settle = 0.0;
|
||||
$note = '厂家漏报:我方数量 ' . $this->number($mineQty)
|
||||
. ',单价 ¥' . number_format($mineUnitPrice, 2)
|
||||
@ -337,12 +341,19 @@ class SupplierStatementMatcher
|
||||
$summary['supplierMissing']++;
|
||||
} elseif (abs($mineAmount - $theirsAmount) < 0.005 && abs($mineQty - $theirsQty) < 0.005) {
|
||||
$type = self::TYPE_MATCH;
|
||||
$settleQty = $mineQty;
|
||||
$settle = $mineAmount;
|
||||
$note = $matchNote . '数量、金额一致,正常结算';
|
||||
$summary['match']++;
|
||||
} else {
|
||||
$type = self::TYPE_MISMATCH;
|
||||
$settle = min($mineAmount, $theirsAmount);
|
||||
if ($mineAmount <= $theirsAmount) {
|
||||
$settleQty = $mineQty;
|
||||
$settle = $mineAmount;
|
||||
} else {
|
||||
$settleQty = $theirsQty;
|
||||
$settle = $theirsAmount;
|
||||
}
|
||||
$note = $matchNote . $quantityDifference . ';按金额低的一方结算,请厂家修改';
|
||||
$summary['mismatch']++;
|
||||
}
|
||||
@ -351,6 +362,7 @@ class SupplierStatementMatcher
|
||||
$summary['theirsAmount'] += $theirsAmount;
|
||||
$summary['supplierOverQty'] += max($qtyDifference, 0);
|
||||
$summary['supplierOverAmount'] += max($amountDifference, 0);
|
||||
$summary['settleQty'] += $settleQty;
|
||||
$summary['settleAmount'] += $settle;
|
||||
|
||||
return [
|
||||
@ -379,6 +391,7 @@ class SupplierStatementMatcher
|
||||
'supplierOverQty' => round(max($qtyDifference, 0), 4),
|
||||
'supplierOverAmount' => round(max($amountDifference, 0), 2),
|
||||
'type' => $type,
|
||||
'settleQty' => $settleQty,
|
||||
'settleAmount' => $settle,
|
||||
'dateToleranceDays' => $dateDifferenceDays ?? 0,
|
||||
'dateDifferenceDays' => $dateDifferenceDays,
|
||||
|
||||
@ -599,6 +599,7 @@ class SupplierReconciliationPageData
|
||||
'theirsAmount' => 0.0,
|
||||
'supplierOverQty' => 0.0,
|
||||
'supplierOverAmount' => 0.0,
|
||||
'settleQty' => 0.0,
|
||||
'settleAmount' => 0.0,
|
||||
'differenceAmount' => 0.0,
|
||||
],
|
||||
|
||||
@ -67,6 +67,23 @@
|
||||
.supplier-reconciliation-page .sr-summary-cell { padding: 8px 10px; border: 1px solid var(--vip-border, #D8D2C7); border-radius: 7px; background: #fff; display: grid; gap: 3px; }
|
||||
.supplier-reconciliation-page .sr-summary-cell b { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
|
||||
.supplier-reconciliation-page .sr-summary-cell span { color: var(--vip-content-muted, #595959); font-size: .75rem; }
|
||||
.supplier-reconciliation-page .sr-summary-push { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 12px; padding: 12px; border: 1px solid #E4DCCB; border-radius: 8px; background: #FCFAF5; }
|
||||
.supplier-reconciliation-page .sr-push-preview { min-width: 0; display: grid; gap: 7px; align-content: center; }
|
||||
.supplier-reconciliation-page .sr-push-preview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
|
||||
.supplier-reconciliation-page .sr-push-preview-head b { color: #5B5343; font-size: .8125rem; }
|
||||
.supplier-reconciliation-page .sr-push-preview-head span { color: var(--vip-content-muted, #595959); font-size: .75rem; }
|
||||
.supplier-reconciliation-page .sr-message-preview { min-height: 42px; display: flex; align-items: center; padding: 9px 12px; border: 1px solid #DED3BD; border-left: 4px solid var(--vip-content-accent-dark, #856632); border-radius: 7px; background: #fff; color: var(--vip-content-ink, #171717); font-size: .875rem; font-weight: 600; line-height: 1.6; font-variant-numeric: tabular-nums; }
|
||||
.supplier-reconciliation-page .sr-push-scope { color: var(--vip-content-muted, #595959); font-size: .75rem; line-height: 1.55; }
|
||||
.supplier-reconciliation-page .sr-push-controls { min-width: 0; display: grid; gap: 8px; align-content: center; }
|
||||
.supplier-reconciliation-page .sr-push-basis-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; }
|
||||
.supplier-reconciliation-page .sr-push-basis-field > span { color: #5B5343; font-size: .75rem; font-weight: 600; white-space: nowrap; }
|
||||
.supplier-reconciliation-page .sr-push-basis-field select { flex: 1 1 190px; width: 100%; min-width: 0; }
|
||||
.supplier-reconciliation-page .sr-push-basis-note { color: var(--vip-content-muted, #595959); font-size: .75rem; line-height: 1.55; }
|
||||
.supplier-reconciliation-page .sr-push-basis-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
|
||||
.supplier-reconciliation-page .sr-push-basis-value { min-width: 0; padding: 6px 8px; border: 1px solid #E4DCCB; border-radius: 6px; background: #fff; }
|
||||
.supplier-reconciliation-page .sr-push-basis-value.is-active { border-color: var(--vip-content-accent-dark, #856632); background: var(--vip-content-accent-soft, #F7F0DE); }
|
||||
.supplier-reconciliation-page .sr-push-basis-value span { display: block; color: var(--vip-content-muted, #595959); font-size: .6875rem; }
|
||||
.supplier-reconciliation-page .sr-push-basis-value b { display: block; margin-top: 2px; color: var(--vip-content-ink, #171717); font-size: .75rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||
.supplier-reconciliation-page .sr-comparison-scroll { max-height: min(64vh, 620px); overflow: auto; scrollbar-gutter: stable; }
|
||||
.supplier-reconciliation-page .sr-comparison-scroll thead th { position: sticky; top: 0; z-index: 4; box-shadow: 0 1px 0 var(--vip-border, #D8D2C7); }
|
||||
.supplier-reconciliation-page .sr-comparison-table { min-width: 1540px; font-size: .75rem; }
|
||||
@ -94,6 +111,8 @@
|
||||
@media (max-width: 900px) {
|
||||
.supplier-reconciliation-page .sr-robot-form { grid-template-columns: minmax(0, 1fr); }
|
||||
.supplier-reconciliation-page .sr-detail-actions { width: 100%; margin-left: 0; }
|
||||
.supplier-reconciliation-page .sr-summary-push { grid-template-columns: minmax(0, 1fr); }
|
||||
.supplier-reconciliation-page .sr-push-basis-values { grid-template-columns: minmax(0, 1fr); }
|
||||
}
|
||||
.supplier-reconciliation-page .sr-empty { padding: 28px; border: 1px dashed var(--vip-border, #D8D2C7); border-radius: 8px; color: var(--vip-content-muted, #595959); font-size: .8125rem; text-align: center; }
|
||||
</style>
|
||||
@ -104,9 +123,10 @@
|
||||
@if ($errors->has('import'))
|
||||
<div class="biz-alert biz-alert-error" role="alert">{{ $errors->first('import') }}</div>
|
||||
@endif
|
||||
@if ($errors->has('dingtalk_summary_push') || $errors->has('dingtalk_push') || $errors->has('dingtalk_return_push') || $errors->has('batch_return_push') || $errors->has('dingtalk_webhook') || $errors->has('dingtalk_secret') || $errors->has('month'))
|
||||
@if ($errors->has('dingtalk_summary_push') || $errors->has('push_basis') || $errors->has('dingtalk_push') || $errors->has('dingtalk_return_push') || $errors->has('batch_return_push') || $errors->has('dingtalk_webhook') || $errors->has('dingtalk_secret') || $errors->has('month'))
|
||||
<div class="biz-alert biz-alert-error" role="alert">
|
||||
{{ $errors->first('dingtalk_summary_push')
|
||||
?: $errors->first('push_basis')
|
||||
?: $errors->first('dingtalk_push')
|
||||
?: $errors->first('dingtalk_return_push')
|
||||
?: $errors->first('batch_return_push')
|
||||
@ -203,9 +223,9 @@
|
||||
'comparison_filter' => $comparisonFilter,
|
||||
], static fn (mixed $value): bool => $value !== '' && $value !== null)) }}"
|
||||
class="sr-button">导出当前筛选</a>
|
||||
<form method="POST"
|
||||
action="{{ route('business.supplier-reconciliation.push-summary') }}"
|
||||
onsubmit="return confirm('确认将 {{ $month !== '' ? $month : '当前' }} 对账汇总推送到该厂家钉钉群?')">
|
||||
<form id="summary-push-form"
|
||||
method="POST"
|
||||
action="{{ route('business.supplier-reconciliation.push-summary') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="supplier" value="{{ $selectedSupplier }}">
|
||||
<input type="hidden" name="month" value="{{ $month }}">
|
||||
@ -486,6 +506,74 @@
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$oldPushBasis = old('push_basis', 'settlement');
|
||||
$selectedPushBasis = is_string($oldPushBasis) && $oldPushBasis === 'mine' ? 'mine' : 'settlement';
|
||||
$displayMonthLabel = $month !== ''
|
||||
? preg_replace_callback(
|
||||
'/^(\d{4})-(\d{2})$/',
|
||||
static fn (array $matches): string => (int) $matches[1] . '年' . (int) $matches[2] . '月',
|
||||
$month,
|
||||
)
|
||||
: '当前账期';
|
||||
$settlementQty = (float) ($detail['summary']['settleQty'] ?? 0);
|
||||
$settlementAmount = (float) ($detail['summary']['settleAmount'] ?? 0);
|
||||
$mineQty = (float) ($detail['sourceTotals']['mineQty'] ?? 0);
|
||||
$mineAmount = (float) ($detail['sourceTotals']['mineAmount'] ?? 0);
|
||||
$theirsQty = (float) ($detail['sourceTotals']['theirsQty'] ?? 0);
|
||||
$theirsAmount = (float) ($detail['sourceTotals']['theirsAmount'] ?? 0);
|
||||
$formatPushQty = static fn (float $value): string => rtrim(rtrim(number_format($value, 2, '.', ''), '0'), '.');
|
||||
$pushPreviewQty = $selectedPushBasis === 'mine' ? $mineQty : $settlementQty;
|
||||
$pushPreviewAmount = $selectedPushBasis === 'mine' ? $mineAmount : $settlementAmount;
|
||||
@endphp
|
||||
<section class="sr-summary-push" aria-label="推送内容预览">
|
||||
<div class="sr-push-preview">
|
||||
<div class="sr-push-preview-head">
|
||||
<b>推送内容预览</b>
|
||||
<span>实际发送以这里显示的内容为准</span>
|
||||
</div>
|
||||
<div id="summary-push-preview" class="sr-message-preview" aria-live="polite">账期:{{ $displayMonthLabel }},件数{{ $formatPushQty($pushPreviewQty) }}件,货款{{ number_format($pushPreviewAmount, 2, '.', '') }}元</div>
|
||||
<div class="sr-push-scope">汇总范围:当前账期 + 当前对账人;下方“差异筛选”只改变表格显示,不改变整期推送范围。</div>
|
||||
</div>
|
||||
<div class="sr-push-controls">
|
||||
<label class="sr-push-basis-field" for="summary-push-basis">
|
||||
<span>推送口径</span>
|
||||
<select id="summary-push-basis" name="push_basis" form="summary-push-form">
|
||||
<option value="settlement"
|
||||
data-qty="{{ $settlementQty }}"
|
||||
data-amount="{{ $settlementAmount }}"
|
||||
data-note="厂家少算或漏报取厂家数据;厂家多算不纳入结算。"
|
||||
@selected($selectedPushBasis === 'settlement')>
|
||||
按结算口径(推荐)
|
||||
</option>
|
||||
<option value="mine"
|
||||
data-qty="{{ $mineQty }}"
|
||||
data-amount="{{ $mineAmount }}"
|
||||
data-note="全部按我方终版货款对账原始数据汇总。"
|
||||
@selected($selectedPushBasis === 'mine')>
|
||||
按我方原始数据
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<div id="summary-push-basis-note" class="sr-push-basis-note">
|
||||
{{ $selectedPushBasis === 'mine' ? '全部按我方终版货款对账原始数据汇总。' : '厂家少算或漏报取厂家数据;厂家多算不纳入结算。' }}
|
||||
</div>
|
||||
<div class="sr-push-basis-values" aria-label="双方原始数据与结算口径对照">
|
||||
<div class="sr-push-basis-value {{ $selectedPushBasis === 'mine' ? 'is-active' : '' }}" data-basis-value="mine">
|
||||
<span>我方原始</span>
|
||||
<b>{{ $formatPushQty($mineQty) }}件 / {{ number_format($mineAmount, 2) }}元</b>
|
||||
</div>
|
||||
<div class="sr-push-basis-value" data-basis-value="theirs">
|
||||
<span>厂家原始</span>
|
||||
<b>{{ $formatPushQty($theirsQty) }}件 / {{ number_format($theirsAmount, 2) }}元</b>
|
||||
</div>
|
||||
<div class="sr-push-basis-value {{ $selectedPushBasis === 'settlement' ? 'is-active' : '' }}" data-basis-value="settlement">
|
||||
<span>结算口径</span>
|
||||
<b>{{ $formatPushQty($settlementQty) }}件 / {{ number_format($settlementAmount, 2) }}元</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="sr-summary-groups">
|
||||
<section class="sr-summary-group" aria-label="比对结果汇总">
|
||||
<h3>比对结果</h3>
|
||||
@ -504,6 +592,7 @@
|
||||
<div class="sr-summary-cell"><span>我方金额合计</span><b>{{ number_format($detail['sourceTotals']['mineAmount'], 2) }}</b></div>
|
||||
<div class="sr-summary-cell"><span>厂家金额合计</span><b>{{ number_format($detail['sourceTotals']['theirsAmount'], 2) }}</b></div>
|
||||
<div class="sr-summary-cell"><span>厂家多算金额</span><b>{{ number_format($detail['summary']['supplierOverAmount'], 2) }}</b></div>
|
||||
<div class="sr-summary-cell"><span>按口径结算件数</span><b>{{ number_format($detail['summary']['settleQty'], 2) }}</b></div>
|
||||
<div class="sr-summary-cell"><span>按口径结算合计</span><b>{{ number_format($detail['summary']['settleAmount'], 2) }}</b></div>
|
||||
<div class="sr-summary-cell"><span>差异金额</span><b>{{ number_format($detail['summary']['differenceAmount'], 2) }}</b></div>
|
||||
</div>
|
||||
@ -819,6 +908,49 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($detail)
|
||||
<script>
|
||||
(() => {
|
||||
const form = document.getElementById('summary-push-form');
|
||||
const basis = document.getElementById('summary-push-basis');
|
||||
const preview = document.getElementById('summary-push-preview');
|
||||
const basisNote = document.getElementById('summary-push-basis-note');
|
||||
const basisValues = Array.from(document.querySelectorAll('[data-basis-value]'));
|
||||
const period = @json($displayMonthLabel);
|
||||
const supplier = @json($selectedSupplier);
|
||||
|
||||
if (!form || !basis || !preview || !basisNote) {
|
||||
return;
|
||||
}
|
||||
|
||||
const formatQty = (value) => Number(value || 0)
|
||||
.toFixed(2)
|
||||
.replace(/\.?0+$/, '');
|
||||
const formatAmount = (value) => Number(value || 0).toFixed(2);
|
||||
const renderPreview = () => {
|
||||
const selected = basis.options[basis.selectedIndex];
|
||||
const qty = Number(selected?.dataset.qty || 0);
|
||||
const amount = Number(selected?.dataset.amount || 0);
|
||||
|
||||
preview.textContent = `账期:${period},件数${formatQty(qty)}件,货款${formatAmount(amount)}元`;
|
||||
basisNote.textContent = selected?.dataset.note || '';
|
||||
basisValues.forEach((value) => {
|
||||
value.classList.toggle('is-active', value.dataset.basisValue === basis.value);
|
||||
});
|
||||
};
|
||||
|
||||
basis.addEventListener('change', renderPreview);
|
||||
form.addEventListener('submit', (event) => {
|
||||
if (!window.confirm(`确认将以下汇总推送到 ${supplier} 钉钉群?\n\n${preview.textContent.trim()}`)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
renderPreview();
|
||||
})();
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@if ($detail && $differenceCount > 0)
|
||||
<script>
|
||||
(() => {
|
||||
|
||||
@ -37,6 +37,13 @@ class SupplierReconciliationDingTalkTest extends FeatureTestCase
|
||||
->assertSee('aria-label="选择全部差异"', false)
|
||||
->assertSeeText('推送本条')
|
||||
->assertSeeText('推送到对账群')
|
||||
->assertSeeText('推送内容预览')
|
||||
->assertSeeText('账期:2026年9月,件数3件,货款250.00元')
|
||||
->assertSeeText('按结算口径(推荐)')
|
||||
->assertSeeText('按我方原始数据')
|
||||
->assertSeeText('按口径结算件数')
|
||||
->assertSeeText('厂家少算或漏报取厂家数据;厂家多算不纳入结算。')
|
||||
->assertSee('name="push_basis"', false)
|
||||
->assertSeeText('厂家钉钉群机器人')
|
||||
->assertSeeText('未配置,配置后才能推送差异')
|
||||
->assertDontSee(self::WEBHOOK);
|
||||
@ -122,7 +129,7 @@ class SupplierReconciliationDingTalkTest extends FeatureTestCase
|
||||
$this->assertSame(3, $config['last_push_count']);
|
||||
}
|
||||
|
||||
public function test_push_reconciliation_summary_uses_period_quantity_and_amount(): void
|
||||
public function test_push_reconciliation_summary_uses_settlement_quantity_and_amount_by_default(): void
|
||||
{
|
||||
$companyId = (int) $this->company->id;
|
||||
$this->seedReconciliation();
|
||||
@ -158,7 +165,7 @@ class SupplierReconciliationDingTalkTest extends FeatureTestCase
|
||||
Http::assertSentCount(1);
|
||||
Http::assertSent(function ($request): bool {
|
||||
return ($request['markdown']['title'] ?? null) === '晨丰 · 货款对账汇总 · 2026年9月'
|
||||
&& ($request['markdown']['text'] ?? null) === '账期:2026年9月,件数5件,货款330.00元'
|
||||
&& ($request['markdown']['text'] ?? null) === '账期:2026年9月,件数3件,货款250.00元'
|
||||
&& ! str_contains((string) ($request['markdown']['text'] ?? ''), '990');
|
||||
});
|
||||
|
||||
@ -166,6 +173,49 @@ class SupplierReconciliationDingTalkTest extends FeatureTestCase
|
||||
$this->assertSame(1, $config['last_push_count']);
|
||||
}
|
||||
|
||||
public function test_push_reconciliation_summary_can_use_our_original_quantity_and_amount(): void
|
||||
{
|
||||
$this->seedReconciliation();
|
||||
$this->saveRobot();
|
||||
Http::fake(['*' => Http::response(['errcode' => 0, 'errmsg' => 'ok'])]);
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('business.supplier-reconciliation.push-summary'), [
|
||||
'supplier' => '晨丰',
|
||||
'month' => '2026-09',
|
||||
'reconciler' => '张三',
|
||||
'push_basis' => 'mine',
|
||||
])
|
||||
->assertStatus(302)
|
||||
->assertSessionHas('success', '已将 2026年9月 对账汇总推送到 晨丰 钉钉群。');
|
||||
|
||||
Http::assertSentCount(1);
|
||||
Http::assertSent(function ($request): bool {
|
||||
return ($request['markdown']['text'] ?? null) === '账期:2026年9月,件数5件,货款330.00元';
|
||||
});
|
||||
}
|
||||
|
||||
public function test_push_reconciliation_summary_rejects_unknown_basis_without_http_call(): void
|
||||
{
|
||||
$this->withExceptionHandling();
|
||||
|
||||
$this->seedReconciliation();
|
||||
$this->saveRobot();
|
||||
Http::fake();
|
||||
|
||||
$this->loginAs()
|
||||
->post(route('business.supplier-reconciliation.push-summary'), [
|
||||
'supplier' => '晨丰',
|
||||
'month' => '2026-09',
|
||||
'reconciler' => '张三',
|
||||
'push_basis' => 'theirs',
|
||||
])
|
||||
->assertStatus(302)
|
||||
->assertSessionHasErrors('push_basis');
|
||||
|
||||
Http::assertNothingSent();
|
||||
}
|
||||
|
||||
public function test_push_reconciliation_summary_requires_robot_and_upload(): void
|
||||
{
|
||||
$this->seedReconciliation();
|
||||
|
||||
@ -1764,16 +1764,20 @@ class SupplierReconciliationTest extends FeatureTestCase
|
||||
$this->assertSame(330.0, $result['summary']['mineAmount']);
|
||||
$this->assertSame(330.0, $result['summary']['theirsAmount']);
|
||||
$this->assertSame(80.0, $result['summary']['supplierOverAmount']);
|
||||
$this->assertSame(3.0, $result['summary']['settleQty']);
|
||||
$this->assertSame(250.0, $result['summary']['settleAmount']);
|
||||
$this->assertSame(80.0, $result['summary']['differenceAmount']);
|
||||
|
||||
$byBarcode = collect($result['rows'])->keyBy('barcode');
|
||||
$this->assertSame(1.0, $byBarcode['B-1']['settleQty']);
|
||||
$this->assertSame(50.0, $byBarcode['B-1']['settleAmount']);
|
||||
$this->assertSame(-1.0, $byBarcode['B-1']['qtyDifference']);
|
||||
$this->assertSame(-50.0, $byBarcode['B-1']['amountDifference']);
|
||||
$this->assertSame('PO-B-1', $byBarcode['B-1']['purchaseNo']);
|
||||
$this->assertSame('2026-09-30', $byBarcode['B-1']['date']);
|
||||
$this->assertSame(0.0, $byBarcode['C-1']['settleQty']);
|
||||
$this->assertSame(0.0, $byBarcode['C-1']['settleAmount']);
|
||||
$this->assertSame(0.0, $byBarcode['D-1']['settleQty']);
|
||||
$this->assertSame(0.0, $byBarcode['D-1']['settleAmount']);
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ class SupplierStatementMatcherTest extends TestCase
|
||||
$this->assertSame(0, $result['summary']['supplierMissing']);
|
||||
$this->assertSame(0, $result['summary']['mismatch']);
|
||||
$this->assertSame(0.0, $result['summary']['differenceAmount']);
|
||||
$this->assertSame(20.0, $result['summary']['settleQty']);
|
||||
$this->assertSame(2000.0, $result['summary']['settleAmount']);
|
||||
$this->assertSame(7, $result['rows'][0]['dateToleranceDays']);
|
||||
$this->assertSame(2, $result['rows'][0]['matchedByLayer']);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user