- 聚水潭奇门客户端与发货同步器骨架:QimenClient(签名+POST)、ShippingDataSynchronizer(erp.sctrade.query 列表 + erp.sradesku.query 明细 + upsert + modified 水位) - 发货明细扁平展示表 jst_oms_shipping(对齐工作平台发货数据 47 列/顺序,用于快递运费核算);原始表 jst_sctrade/_items/_skus/_receiver + jst_sync_state - 快递应付新增「发货数据」页:Pages.contentForShippingData + 视图 + business_navigation 导航项(slug=shipping-data) - ShippingOrderRepository 读展示表;artisan jushuitan:sync-shipping + 每10分钟增量调度(JST_SYNC_ENABLED 默认关) - 落库连接 jushuitan_local(本地容器,env 可覆盖);演示 Seeder(6 条家具发货样例);.env.jushuitan.example Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014nvGZkg27YMEdhRy6EiUwf
38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\EcommerceFinance\Console;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Carbon;
|
|
use Modules\EcommerceFinance\Services\Jushuitan\ShippingDataSynchronizer;
|
|
|
|
/**
|
|
* 聚水潭发货数据同步命令。
|
|
*
|
|
* php artisan jushuitan:sync-shipping # 增量(按水位 - 重叠窗口)
|
|
* php artisan jushuitan:sync-shipping --from=... --to=... # 指定时间窗(首次全量分批用)
|
|
*/
|
|
class SyncJushuitanShipping extends Command
|
|
{
|
|
protected $signature = 'jushuitan:sync-shipping {--from=} {--to=}';
|
|
|
|
protected $description = '从聚水潭(奇门)拉取销售出库单发货数据到 caiwu 共享镜像库';
|
|
|
|
public function handle(): int
|
|
{
|
|
$from = $this->option('from') ? Carbon::parse($this->option('from')) : null;
|
|
$to = $this->option('to') ? Carbon::parse($this->option('to')) : null;
|
|
|
|
$this->info('开始同步聚水潭发货数据...');
|
|
try {
|
|
$result = ShippingDataSynchronizer::make()->syncIncremental($from, $to);
|
|
} catch (\Throwable $e) {
|
|
$this->error('同步失败:' . $e->getMessage());
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$this->info(sprintf('完成:处理 %d 单,水位推进到 %s', $result['processed'], $result['watermark'] ?? '(未变)'));
|
|
return self::SUCCESS;
|
|
}
|
|
}
|