diff --git a/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php b/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php index fed550b28..369833b26 100644 --- a/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php +++ b/modules/EcommerceFinance/Services/Jushuitan/ShippingReplicaSynchronizer.php @@ -3593,6 +3593,7 @@ class ShippingReplicaSynchronizer /** 因商品/金额无法安全替换而保留的旧包裹:包裹级字段(省市区、快递、仓库、店铺等)仍按本次上游刷新,商品与金额不动。 */ private function refreshRetainedPackages(array $refresh, array $previous): void { + $refresh = app(ShippingWeightPrecision::class)->shipmentRows($refresh); foreach ($refresh as $id => $new) { $set = []; foreach (self::REFRESHED_PACKAGE_FIELDS as $field) { diff --git a/tests/Feature/Business/ShippingWeightPrecisionTest.php b/tests/Feature/Business/ShippingWeightPrecisionTest.php index 383bbb0e4..b1429251e 100644 --- a/tests/Feature/Business/ShippingWeightPrecisionTest.php +++ b/tests/Feature/Business/ShippingWeightPrecisionTest.php @@ -49,6 +49,14 @@ class ShippingWeightPrecisionTest extends FeatureTestCase $this->assertSame('江苏',$rows[0]['receiver_state']); $this->assertNull($rows[2]['online_weight']); $this->assertArrayNotHasKey('receiver_state',$rows[2]); + $db->table('jst_oms_shipping')->insert(['source_id'=>1,'sku_source_id'=>1,'express_no'=>'TEST10001', + 'express_name1'=>'测试快递','ship_time'=>'2026-11-30','receiver_state'=>'旧省']); + $factory=$this->createMock(UpstreamReadOnlyQueryFactory::class); + $factory->method('forSource')->willReturn($this->createMock(UpstreamReadOnlyQuery::class)); + $sync=new ShippingReplicaSynchronizer($factory); + $method=new \ReflectionMethod($sync,'refreshRetainedPackages'); + $method->invoke($sync,[1=>array_replace($base,['receiver_state'=>'错误省'])],[]); + $this->assertSame('江苏',$db->table('jst_oms_shipping')->where('source_id',1)->value('receiver_state')); } public function test_alignment_keeps_confirmed_tiny_weight_on_the_primary_row(): void