fix(库存流水): 加工入库(processing_in)补中文标签与入库配色(三语),溯源页流水标签同步
This commit is contained in:
@@ -238,6 +238,8 @@ const TRACE_LOG_TYPE_LABELS: Record<string, string> = {
|
||||
delivery_loading_out: '配送核货出库',
|
||||
delivery_loading_restore: '发车撤销回补',
|
||||
processing_out: '加工出库',
|
||||
processing_in: '加工入库',
|
||||
processing_return: '加工退料',
|
||||
adjust: '库存调整',
|
||||
order_item_return: '退货回冲入库',
|
||||
in: '入库',
|
||||
|
||||
@@ -91,6 +91,7 @@ export const inventory: MessageDict = {
|
||||
'op.picking_out': 'Picking out',
|
||||
'op.delivery_loading_out': 'Delivery loading out',
|
||||
'op.retail_out': 'Walk-in sale outbound',
|
||||
'op.processing_in': 'Processing stock-in',
|
||||
'op.processing_out': 'Processing out',
|
||||
'op.processing_return': 'Processing return',
|
||||
'op.in': 'In',
|
||||
|
||||
@@ -95,6 +95,7 @@ export const inventory: MessageDict = {
|
||||
'op.picking_out': 'Keluar picking',
|
||||
'op.delivery_loading_out': 'Keluar muat kirim',
|
||||
'op.retail_out': 'Keluar penjualan eceran',
|
||||
'op.processing_in': 'Masuk stok hasil proses',
|
||||
'op.processing_out': 'Keluar olah',
|
||||
'op.processing_return': 'Retur olah',
|
||||
'op.in': 'Masuk',
|
||||
|
||||
@@ -90,6 +90,7 @@ export const inventory: MessageDict = {
|
||||
'op.picking_out': '分拣出库',
|
||||
'op.delivery_loading_out': '配送核货出库',
|
||||
'op.retail_out': '散客出库',
|
||||
'op.processing_in': '加工入库(成品)',
|
||||
'op.processing_out': '加工出库',
|
||||
'op.processing_return': '加工退料',
|
||||
'op.in': '入库',
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
/**
|
||||
* 库存流水「操作类型」必须有中文标签(2026-10-23 开发者报障:
|
||||
* 独立加工产出的流水显示成裸代码 `processing_in`)。
|
||||
* 口径:缺 key 时会原样显示代码 ⇒ 新增流水类型必须三语齐全,并在颜色映射里归类。
|
||||
*/
|
||||
const zh = readFileSync(new URL('../../i18n/locales/zh-CN/inventory.ts', import.meta.url), 'utf8');
|
||||
const en = readFileSync(new URL('../../i18n/locales/en/inventory.ts', import.meta.url), 'utf8');
|
||||
const id = readFileSync(new URL('../../i18n/locales/id/inventory.ts', import.meta.url), 'utf8');
|
||||
const page = readFileSync(new URL('./InventoryManagement.tsx', import.meta.url), 'utf8');
|
||||
|
||||
describe('库存流水操作类型:processing_in 有中文标签', () => {
|
||||
it('三语都有 op.processing_in', () => {
|
||||
expect(zh).toContain("'op.processing_in'");
|
||||
expect(en).toContain("'op.processing_in'");
|
||||
expect(id).toContain("'op.processing_in'");
|
||||
});
|
||||
|
||||
it('中文名明确是「加工入库」而不是裸代码', () => {
|
||||
expect(zh).toMatch(/'op\.processing_in':\s*'加工入库[^']*'/);
|
||||
});
|
||||
|
||||
it('入库类流水在颜色映射里归为入库(绿色),不落到中性灰', () => {
|
||||
const block = page.slice(page.indexOf('const getOperationTypeColor'), page.indexOf('/** 流水 quantity 存正数'));
|
||||
expect(block).toContain('processing_in:');
|
||||
expect(block).toMatch(/processing_in:\s*'bg-emerald-50/);
|
||||
});
|
||||
|
||||
it('渲染时通过 i18n key 取标签,缺 key 才回退代码(不是硬编码中文)', () => {
|
||||
expect(page).toContain('const key = `inventory.op.${type}`;');
|
||||
});
|
||||
});
|
||||
@@ -792,6 +792,7 @@ export const InventoryManagement: React.FC = () => {
|
||||
delivery_loading_out: 'bg-red-50 text-red-700 dark:bg-red-950/50 dark:text-red-300',
|
||||
processing_out: 'bg-red-50 text-red-700 dark:bg-red-950/50 dark:text-red-300',
|
||||
processing_return: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-300',
|
||||
processing_in: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-300',
|
||||
in: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-300',
|
||||
out: 'bg-red-50 text-red-700 dark:bg-red-950/50 dark:text-red-300',
|
||||
adjust: 'bg-amber-50 text-amber-700 dark:bg-amber-950/50 dark:text-amber-300',
|
||||
|
||||
Reference in New Issue
Block a user