商品成本:排除YUNFEI和BCJ占位编码 #485

Merged
chenxi merged 2 commits from feature/chenxi-product-cost-exclude-yunfei-bcj into main 2026-10-24 10:38:18 +08:00
3 changed files with 24 additions and 2 deletions

View File

@ -44,6 +44,8 @@ class SyncStoreReceiptProductCost extends Command
'AZF',
'DF-PJZY0001',
'JIAXIANGJIANCAIJIAJUZIZHUANG964A',
'YUNFEI',
'BCJ',
];
/** 组合装条码前缀;条码结构为「前缀-组件条码-数量-组件条码-数量」。 */

View File

@ -117,8 +117,8 @@
拆单只取最末级订单行(没有任何下级的叶子行),主单和中间汇总层不参与、避免重复计数;
同一单分多仓发货的按末级实际仓库分行;虚拟条码(X0000x)不计入;
ZH-、MKH- 开头的组合装按「组件条码 + 数量」拆分,无法解析的组合装保留原编码;
套餐/服务及指定配件、组合装占位编码 TCXJ、FUWU、AZF、DF-PJZY0001、
JIAXIANGJIANCAIJIAJUZIZHUANG964A 全局不取数(组合装里拆出的这些编码同样剔除)。
套餐/服务、运费及指定配件、组合装占位编码 TCXJ、FUWU、AZF、DF-PJZY0001、
JIAXIANGJIANCAIJIAJUZIZHUANG964A、YUNFEI、BCJ 全局不取数(组合装里拆出的这些编码同样剔除)。
发货仓库默认排除「常州简尚家居有限公司」「简尚-苏州福利品仓」「简尚-自动发货仓」,
其中常州简尚家居有限公司的「DF-」商品行例外保留;先执行商品编码全局排除,再执行仓库过滤。
订单状态为 Cancelled(已取消)的明细行不参与商品成本。

View File

@ -73,6 +73,26 @@ class StoreReceiptProductCostLineTest extends TestCase
$this->assertSame('unique', $result['lines'][0]['platform_mapping_status']);
}
public function test_yunfei_and_bcj_are_excluded_globally_and_from_bundle_components(): void
{
$command = new SyncStoreReceiptProductCost();
$constant = (new \ReflectionClass($command))->getReflectionConstant('EXCLUDED_SKUS');
$excludedSkus = $constant->getValue();
$this->assertContains('YUNFEI', $excludedSkus);
$this->assertContains('BCJ', $excludedSkus);
$method = new ReflectionMethod($command, 'expandComboSku');
$method->setAccessible(true);
$components = $method->invoke(
null,
'MKH-YUNFEI-1-BCJ-1-SG006367N1028V01-2',
3.0,
);
$this->assertSame([['SG006367N1028V01', 6.0, true]], $components);
}
/** @return array{0:list<array<string,mixed>>,1:int,2:int} */
private function costLines(array $rows): array
{