From 7fbcd061af31c72ef2d2876e603e2b1bc693a129 Mon Sep 17 00:00:00 2001 From: renshen <1005457301@qq.com> Date: Fri, 16 Oct 2026 20:58:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E4=BB=98=E6=AC=BE=E7=BB=88=E7=89=88?= =?UTF-8?q?=E8=B4=A7=E6=AC=BE=E5=AF=B9=E8=B4=A6=EF=BC=9A=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=8C=E5=85=A5=E5=BA=93=E5=8D=95=E5=8F=B7/=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E5=8D=95=E5=8F=B7/=E5=AF=B9=E8=B4=A6=E4=BA=BA?= =?UTF-8?q?=E3=80=8D=E5=88=97=20(#351)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 「月份」后补入库单号、采购单号,末尾「未发出」后补对账人;导入模板/表格/导入/编辑/导出同一套字段,只作用于终版目录。 --- .../Services/PayablesFinalRegistry.php | 20 +++++++++++++--- .../SupplierPayableFinalPagesTest.php | 23 ++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/modules/EcommerceFinance/Services/PayablesFinalRegistry.php b/modules/EcommerceFinance/Services/PayablesFinalRegistry.php index 440364d8..2024cf02 100644 --- a/modules/EcommerceFinance/Services/PayablesFinalRegistry.php +++ b/modules/EcommerceFinance/Services/PayablesFinalRegistry.php @@ -34,9 +34,21 @@ class PayablesFinalRegistry /** 所有终版导入模板都带“月份”列,方便按月导入和查看。 */ private const MONTH_FIELD = ['summary_month' => ['label' => '月份', 'type' => 'month']]; - /** 供应商应付(终版)在基础字段之后追加的列(只影响终版目录,基础目录的「未发出」另有口径)。 */ + /** + * 供应商应付(终版)在基础字段前后追加的列(只影响终版目录,基础目录对应列另有口径): + * 货款对账在「月份」后补入库单号、采购单号,在末尾补未发出、对账人。 + */ private const SUPPLIER_EXTRA_FIELDS = [ - 'payment-reconciliation' => ['unsent' => ['label' => '未发出', 'type' => 'text']], + 'payment-reconciliation' => [ + 'before' => [ + 'stockNo' => ['label' => '入库单号', 'type' => 'text'], + 'purchaseNo' => ['label' => '采购单号', 'type' => 'text'], + ], + 'after' => [ + 'unsent' => ['label' => '未发出', 'type' => 'text'], + 'reconciler' => ['label' => '对账人', 'type' => 'text'], + ], + ], ]; public function __construct( @@ -84,6 +96,8 @@ class PayablesFinalRegistry ? $this->productPrices->templateFields() : $this->supplier->fields($dataset); - return self::MONTH_FIELD + $fields + (self::SUPPLIER_EXTRA_FIELDS[$dataset] ?? []); + $extra = self::SUPPLIER_EXTRA_FIELDS[$dataset] ?? []; + + return self::MONTH_FIELD + ($extra['before'] ?? []) + $fields + ($extra['after'] ?? []); } } diff --git a/tests/Feature/Business/SupplierPayableFinalPagesTest.php b/tests/Feature/Business/SupplierPayableFinalPagesTest.php index b0f1207b..e7e9208b 100644 --- a/tests/Feature/Business/SupplierPayableFinalPagesTest.php +++ b/tests/Feature/Business/SupplierPayableFinalPagesTest.php @@ -72,7 +72,7 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase } } - public function test_final_payment_reconciliation_template_adds_unsent_as_the_last_column(): void + public function test_final_payment_reconciliation_template_keeps_the_extra_columns_in_order(): void { $response = $this->loginAs() ->get(route('business.supplier-payables-final.payment-reconciliation.template')) @@ -84,24 +84,25 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase try { file_put_contents($path, $response->streamedContent()); $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($path); - $header = $spreadsheet->getSheet(0)->rangeToArray('A1:Q1')[0]; + $header = $spreadsheet->getSheet(0)->rangeToArray('A1:T1')[0]; $spreadsheet->disconnectWorksheets(); $this->assertSame([ - '记录标识', '月份', '供应商', '货号', '商品编码', '规格名称', '数量', '单价', '金额', - '预估单价', '预估金额', '供应商商品编码', '备注', '仓库名称', '快递名称', '快递单号', '未发出', + '记录标识', '月份', '入库单号', '采购单号', '供应商', '货号', '商品编码', '规格名称', '数量', '单价', + '金额', '预估单价', '预估金额', '供应商商品编码', '备注', '仓库名称', '快递名称', '快递单号', + '未发出', '对账人', ], $header); } finally { @unlink($path); } } - public function test_final_payment_reconciliation_import_keeps_the_unsent_column(): void + public function test_final_payment_reconciliation_import_keeps_the_extra_columns(): void { $file = UploadedFile::fake()->createWithContent( 'payment-reconciliation.csv', - "\xEF\xBB\xBF月份,供应商,货号,商品编码,规格名称,数量,单价,金额,预估单价,预估金额,供应商商品编码,备注,仓库名称,快递名称,快递单号,未发出\n" - . "2026-09,终版供应商,X-1,P-1,规格甲,2,10,20,9,18,SC-1,备注甲,华东仓,顺丰,SF-1,未发出\n", + "\xEF\xBB\xBF月份,入库单号,采购单号,供应商,货号,商品编码,规格名称,数量,单价,金额,预估单价,预估金额,供应商商品编码,备注,仓库名称,快递名称,快递单号,未发出,对账人\n" + . "2026-09,RK-1,CG-1,终版供应商,X-1,P-1,规格甲,2,10,20,9,18,SC-1,备注甲,华东仓,顺丰,SF-1,未发出,对账人甲\n", ); $this->loginAs() @@ -120,12 +121,18 @@ class SupplierPayableFinalPagesTest extends FeatureTestCase 'page' => 'payment-reconciliation', ])) ->assertOk() + ->assertSeeText('入库单号') + ->assertSeeText('采购单号') + ->assertSeeText('对账人') + ->assertSeeText('RK-1') + ->assertSeeText('CG-1') ->assertSeeText('未发出') + ->assertSeeText('对账人甲') ->assertSeeText('SF-1'); $export = $this->loginAs()->get(route('business.supplier-payables-final.payment-reconciliation.export')); $export->assertOk(); - $this->assertStringContainsString('快递单号,未发出', $export->streamedContent()); + $this->assertStringContainsString('快递单号,未发出,对账人', $export->streamedContent()); } public function test_product_price_final_page_reuses_the_price_template_columns(): void