补全工作平台供应商管理字段同步和展示 #380

Merged
limeng merged 1 commits from fix/limeng-supplier-full-columns into main 2026-10-17 13:12:53 +08:00
6 changed files with 50 additions and 8 deletions

View File

@ -211,8 +211,13 @@ return [
'full_reconcile_hours' => 1,
'columns' => ['Id', 'guid', 'sourcefrom', 'coopersgn', 'scmcode', 'scmname', 'scmtype',
'tradebody', 'company', 'enterpriseType', 'creditcode', 'handlePerson', 'accountbankno', 'legalPerson',
'buyer', 'tradebtime', 'tradeetime', 'cooperbtime', 'cooperetime', 'memo',
'updator', 'local_created', 'local_updated'],
'paycyclesgn', 'corpmobile', 'tradebtime', 'tradeetime', 'cooperbtime', 'cooperetime',
'undefined1', 'undefined2', 'dsper', 'reconciliter', 'levelname',
'linkerprovience', 'linkercity', 'linkerarea', 'linkeradd', 'memo',
'buyer', 'buymid', 'buytop', 'craftType', 'outline', 'capacity', 'freereason',
'area', 'stocker', 'region', 'sindou', 'follower', 'presc', 'strategy',
'updator', 'local_created', 'local_updated', 'send_date',
'endTimeA', 'endTimeB', 'finishTimeA', 'finishTimeB'],
'indexes' => [['scmcode', 'Id'], ['coopersgn', 'Id']],
],
'jiansun.dbo.js_supplier_contract_View' => [

View File

@ -152,3 +152,7 @@ php artisan business-mirror:sync-tables jiansun.dbo.jst_small_payment_order_map
```
两张表完成后,页面按工单主记录的完成时间筛选并稳定分页,以 `woNo` 关联最新的工单主记录;查询依赖工单表 `(woTypeId, completeTime, woNo, Id)` 和映射表 `(woTypeId, woNo)` 两个索引。映射表的 `transaction_no` 是线上订单号后备来源,不得展示为支付宝批次号;支付宝批次号只读取表单中的明确字段。工单状态按聚水潭状态码翻译,已完成工单再结合打款方式显示打款状态。筛选支持完成日期、工单号、店铺、支付宝批次号、线上订单号、状态和打款原因;表单详情从镜像中的 `businessFieldList` 解析,导出与页面使用同一筛选口径。首次全量未完成、查询索引未就绪或刷新失败时均保留明确状态,不能把空结果解释为没有小额打款工单。
### 供应商管理完整字段
简尚版主视图 `jiansun.dbo.js_supplier_View` 明确同步全部 52 个源字段,包含原列表右侧资料;列表与全部筛选结果导出共用字段映射。`undefined2` 是板材提供方,`linkerprovience` 保留上游拼写;`endTimeA/endTimeB` 分别为罚款/赔付终止日期,`finishTimeA/finishTimeB` 分别为终止/重启合作日期,不能用 `cooperetime/cooperbtime` 替代。未确认业务含义的辅助字段保留在镜像中,不猜测中文列名。扩展字段上线后必须备份原镜像及同步状态,并完整校准已有行;只追加新 Id 无法回补存量资料。验收对比源字段集合、总数、全量行内容及页面分页/筛选/导出。

View File

@ -21,7 +21,17 @@ class SupplierManagementMirrorRepository
'sourcefrom' => '数据来源', 'coopersgn' => '是否合作', 'scmcode' => '供应商代码',
'scmname' => '供应商名称', 'scmtype' => '供应商类型', 'tradebody' => '合同主体',
'company' => '签订公司', 'enterpriseType' => '企业类型', 'creditcode' => '社会信用代码',
'accountbankno' => '电子合同经办人', 'buyer' => '采购人员',
'handlePerson' => '电子合同经办人姓名', 'accountbankno' => '电子合同经办人账号',
'legalPerson' => '法人姓名', 'corpmobile' => '法人电话', 'paycyclesgn' => '结算周期',
'tradebtime' => '合同开始时间', 'tradeetime' => '合同截止时间',
'endTimeA' => '罚款终止日期', 'endTimeB' => '赔付终止日期',
'finishTimeA' => '终止合作日期', 'finishTimeB' => '重启合作日期',
'undefined2' => '板材提供方', 'dsper' => '分配人', 'reconciliter' => '对账会计',
'levelname' => '级别', 'linkerprovience' => '联系人省', 'linkercity' => '联系人市',
'linkerarea' => '联系人区', 'linkeradd' => '联系人详细地址', 'memo' => '备注',
'buyer' => '采购', 'craftType' => '工艺类型', 'outline' => '生产线',
'capacity' => '工厂产能', 'freereason' => '免罚原因', 'region' => '所属区域',
'sindou' => '叫货周期',
];
public function __construct(

View File

@ -82,12 +82,12 @@
<div class="supplier-management-alert" role="status">最近一次同步失败,当前显示上次同步成功的资料。</div>
@endif
<div class="supplier-management-status">
<span>共 {{ number_format($suppliers->total()) }} 家供应商</span>
<span>共 {{ number_format($suppliers->total()) }} 家供应商 · {{ count($supplierColumns) }} 项资料,横向滚动可查看完整字段</span>
<span>最近同步:<time>{{ $supplierState['last_succeeded_at'] ?? '尚未同步' }}</time></span>
</div>
<div class="supplier-management-panel">
<div class="supplier-management-panel" data-finance-table-surface>
<div class="supplier-management-scroll">
<table class="supplier-management-table" aria-label="供应商列表">
<table class="supplier-management-table" data-finance-table aria-label="供应商列表">
<thead><tr><th scope="col">序号</th>@foreach ($supplierColumns as $label)<th scope="col">{{ $label }}</th>@endforeach</tr></thead>
<tbody>
@forelse ($suppliers as $supplier)

View File

@ -35,13 +35,16 @@ class SupplierManagementPageTest extends FeatureTestCase
public function test_filters_and_selected_supplier_details_render_without_full_page_navigation(): void
{
$repository = $this->repository(true);
$row = (object) ['Id' => 3, 'scmcode' => '001', 'scmname' => '测试供应商', 'coopersgn' => 1];
$row = (object) ['Id' => 3, 'scmcode' => '001', 'scmname' => '测试供应商', 'coopersgn' => 1,
'region' => '苏北', 'sindou' => '双日', 'capacity' => '120'];
$repository->shouldReceive('paginate')->once()->with(['supplier_name' => '测试', 'buyer' => '', 'cooperation_status' => '1'], 1, 20)
->andReturn(['rows' => [$row], 'total' => 1]);
$repository->shouldReceive('details')->once()->with($row, 'contacts', 1, 20)
->andReturn(['rows' => [(object) ['linker' => '测试联系人']], 'total' => 1, 'ready' => true, 'message' => null]);
$this->loginAs()->get($this->url(['supplier_name' => ' 测试 ', 'cooperation_status' => '1', 'supplier_id' => 3, 'detail_tab' => 'contacts']))
->assertOk()->assertSeeText('测试供应商')->assertSeeText('测试联系人')->assertSee('data-caiwu-replay', false)->assertSeeText('打款信息');
->assertOk()->assertSeeText('测试供应商')->assertSeeText('测试联系人')->assertSee('data-caiwu-replay', false)->assertSeeText('打款信息')
->assertSeeText('工厂产能')->assertSeeText('叫货周期')->assertSeeText('赔付终止日期')
->assertSeeText('苏北')->assertSeeText('双日')->assertSeeText('120');
}
public function test_detail_failure_keeps_the_supplier_list_visible(): void

View File

@ -50,6 +50,26 @@ class SupplierManagementMirrorRepositoryTest extends TestCase
$this->assertSame([1, 2], array_map(fn ($row) => $row->Id, iterator_to_array($this->repository->exportRows($filters))));
}
public function test_right_hand_supplier_fields_survive_pagination_and_export(): void
{
$this->ready(SupplierManagementMirrorRepository::DATASET);
$fields = ['handlePerson' => '测试经办人', 'paycyclesgn' => '月结',
'endTimeB' => '2026-12-31', 'finishTimeA' => '2026-10-01',
'undefined2' => '第三方', 'linkerprovience' => '江苏省', 'linkeradd' => '测试地址',
'craftType' => '板式', 'capacity' => '120', 'region' => '苏北', 'sindou' => '双日'];
$this->table('js_supplier_management')->insert(['Id' => 9, 'scmname' => '完整资料测试'] + $fields);
$page = $this->repository->paginate([], 1, 20);
$export = iterator_to_array($this->repository->exportRows([]));
foreach ($fields as $column => $value) {
$this->assertSame($value, $page['rows'][0]->{$column});
$this->assertSame($value, $export[0]->{$column});
$this->assertArrayHasKey($column, SupplierManagementMirrorRepository::COLUMNS);
}
$columns = (new BusinessMirrorDatasetRegistry())->columnSelection(SupplierManagementMirrorRepository::DATASET);
$this->assertCount(52, $columns);
$this->assertSame([], array_values(array_diff(array_keys(SupplierManagementMirrorRepository::COLUMNS), $columns)));
}
public function test_related_mirror_indexes_can_be_built_from_the_50_character_source_fields(): void
{
$registry = new BusinessMirrorDatasetRegistry();