fix: 供应商查询同步过滤退货厂家 #849

Merged
renshen merged 1 commits from fix/supplier-query-filter-returns into main 2026-11-04 11:14:06 +08:00
2 changed files with 32 additions and 4 deletions

View File

@ -110,6 +110,17 @@ class SupplierReconciliationPageData
));
}
$filteredReturnRows = [];
foreach ($returnRows as $row) {
if ($month !== '' && $this->returnRowMonth($row) !== $month) {
continue;
}
if ($reconciler !== '' && trim((string) ($row['reconciler'] ?? '')) !== $reconciler) {
continue;
}
$filteredReturnRows[] = $row;
}
$suppliers = [];
foreach ($mine as $row) {
$name = trim((string) ($row['supplier'] ?? ''));
@ -117,10 +128,12 @@ class SupplierReconciliationPageData
$suppliers[$name] = true;
}
}
foreach ($this->statements->uploadedSuppliers($companyId) as $name) {
$suppliers[$name] = true;
if ($month === '' && $reconciler === '') {
foreach ($this->statements->uploadedSuppliers($companyId) as $name) {
$suppliers[$name] = true;
}
}
foreach ($returnRows as $row) {
foreach ($filteredReturnRows as $row) {
$name = trim((string) ($row['supplier'] ?? ''));
if ($name !== '') {
$suppliers[$name] = true;

View File

@ -322,16 +322,31 @@ class SupplierReconciliationDingTalkTest extends FeatureTestCase
'amount' => '10',
'reconciler' => '陈亲园',
], $companyId, null);
$store->save('final:supplier:return-reconciliation', 'return:october-foreign', [
'summary_month' => '2026-10',
'send_time' => '2026-10-09 10:00:00',
'supplier' => '鸣飞家具',
'barcode' => 'RETURN-OCTOBER-FOREIGN',
'sku_name' => '其他对账人退货',
'qty' => '1',
'unit_price' => '10',
'amount' => '10',
'reconciler' => '李萌',
], $companyId, null);
$this->loginAs()->get(route('business.pages.show', [
'company_id' => $companyId,
'section' => 'supplier-reconciliation',
'page' => 'finance-data',
'month' => '2026-10',
'reconciler' => '陈亲园',
]))
->assertOk()
->assertSee('<option value="李萌"', false)
->assertSee('<option value="陈亲园"', false);
->assertSee('<option value="陈亲园"', false)
->assertSeeText('共 1 家')
->assertSeeText('晨丰')
->assertDontSeeText('鸣飞家具');
}
public function test_batch_return_push_sends_each_selected_supplier_to_its_own_robot(): void