From 2b896f2176db6f7338d5cc62ec3b15c1e016b42d Mon Sep 17 00:00:00 2001 From: limeng <1131177064@qq.com> Date: Wed, 2 Dec 2026 20:05:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E9=BD=90=E8=B4=A2=E5=8A=A1?= =?UTF-8?q?=E4=BB=A3=E4=BC=A0=E5=85=A5=E5=8F=A3=E4=B8=8E=E6=A0=87=E5=87=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Support/CourierBills/CourierBillStore.php | 4 +++- app/Support/CourierBills/PortalFreightBills.php | 13 +++++++++++++ docs/厂家门户运费账单上传.md | 13 +++++++++++++ .../View/SupplierReconciliationPageData.php | 3 +++ .../_freight-bills.blade.php | 6 +++--- tests/Feature/Business/PortalFreightBillTest.php | 11 ++++++++++- 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 docs/厂家门户运费账单上传.md diff --git a/app/Support/CourierBills/CourierBillStore.php b/app/Support/CourierBills/CourierBillStore.php index 38ebf5175..2447cc377 100644 --- a/app/Support/CourierBills/CourierBillStore.php +++ b/app/Support/CourierBills/CourierBillStore.php @@ -490,7 +490,9 @@ final class CourierBillStore $db->table('courier_bill_lines')->where('file_id', $fileId)->delete(); } $db->table('courier_bill_surcharges')->where('file_id', $fileId)->delete(); - $overrides = ['waybill_header' => $group->waybill_header, 'amount_header' => $group->amount_header, 'weight_header' => $group->weight_header]; + $overrides = $portal + ? ['waybill_header' => '单号', 'amount_header' => '运费', 'weight_header' => '重量'] + : ['waybill_header' => $group->waybill_header, 'amount_header' => $group->amount_header, 'weight_header' => $group->weight_header]; foreach ($this->parser->parse($path, $extension, $overrides) as $item) { if ($item['type'] === 'sheet') { $sheets[] = isset($item['skipped']) diff --git a/app/Support/CourierBills/PortalFreightBills.php b/app/Support/CourierBills/PortalFreightBills.php index e54959c93..55948a3ab 100644 --- a/app/Support/CourierBills/PortalFreightBills.php +++ b/app/Support/CourierBills/PortalFreightBills.php @@ -37,6 +37,19 @@ final class PortalFreightBills } } + /** 财务代传入口包含尚未上传货款对账单的代发厂家与快递。 */ + public function names(): array + { + try { + return array_values(array_unique([ + ...array_map(static fn ($f) => (string) $f->name, $this->dropship->factories()), + ...array_map(static fn ($g) => (string) $g->name, $this->courier->groups()), + ])); + } catch (Throwable) { + return []; + } + } + /** * 钉钉组织里能认作「快递」的部门名:快递对账分组名和小汇总承运商名。 * diff --git a/docs/厂家门户运费账单上传.md b/docs/厂家门户运费账单上传.md new file mode 100644 index 000000000..60a435276 --- /dev/null +++ b/docs/厂家门户运费账单上传.md @@ -0,0 +1,13 @@ +# 厂家门户上传运费账单 + +厂家和快递通过原有钉钉入口进入门户,下载统一模板后提交账单。账号仅能给绑定的厂家或快递上传。财务账号沿用原页面权限,可为选定对象代传。 + +模板第一行依次为:单号、省、重量、运费、送货备注、面单、费率。仅一张可见账单表,单号及运费必填;单号须完整,数字列须为有效数字。支持 XLSX、XLS、CSV,单份最多50MB、100,000行;XLS沿用现有读取器20MB限制。 + +网页只保存文件并显示等待处理。服务器每分钟通过现有独立批容器执行 `portal-freight:import-pending`,每次处理一份。使用共享同步锁,1 CPU、1GiB容器内存、PHP512MiB和一小时上限。无待办时不启动容器。校验失败在上传记录显示原因;进程中断不自动重导,下一次标记失败,财务核对已有记录后再决定重传。 + +后台继续使用现有代发/快递账单读取与对账规则,重复上传、已结算月份等限制仍生效。门户快递上传不会通过文件名或合并分组设置扩大目标范围。成功回执使用实际读入行数和金额;未配置群机器人时不发送。 + +不新增数据库表。任务文件沿用私有共享storage目录,原账单由现有账单存储流程留存。页面仅查当前对象的近期任务及最近10份已读入账单。 + +验证需包含:两类门户上传、未授权对象拒绝、停用账号拒绝、模板错误、多表拒绝、后台隔离、重复导入和原有对账回归。性能基准以线上已有约7,500行账单为参照,使用10,000行合成账单在隔离环境测量,不向真实厂家群发送测试消息。 diff --git a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php index 955df3d18..88a1387bf 100644 --- a/modules/EcommerceFinance/View/SupplierReconciliationPageData.php +++ b/modules/EcommerceFinance/View/SupplierReconciliationPageData.php @@ -331,6 +331,9 @@ class SupplierReconciliationPageData ) as $name) { $suppliers[$name] = true; } + foreach (app(\App\Support\CourierBills\PortalFreightBills::class)->names() as $name) { + $suppliers[$name] = true; + } $supplierNames = array_keys($suppliers); sort($supplierNames); diff --git a/resources/views/business/pages/supplier-reconciliation/_freight-bills.blade.php b/resources/views/business/pages/supplier-reconciliation/_freight-bills.blade.php index 725e6d38f..ec1b17dbe 100644 --- a/resources/views/business/pages/supplier-reconciliation/_freight-bills.blade.php +++ b/resources/views/business/pages/supplier-reconciliation/_freight-bills.blade.php @@ -6,9 +6,9 @@ $defaultMonth = $accountingMonthKey ?? now()->startOfMonth()->subMonth()->format('Y-m'); @endphp