This commit is contained in:
2026-09-08 20:28:05 +08:00
parent 658b2e84cf
commit a7f073c783
13 changed files with 725 additions and 97 deletions
@@ -4,45 +4,99 @@ import test from 'node:test'
const view = readFileSync(new URL('./WarehouseServiceView.vue', import.meta.url), 'utf8')
const api = readFileSync(new URL('../api/warehouseServices.ts', import.meta.url), 'utf8')
const warehouseApi = readFileSync(new URL('../../first-leg/api/firstLeg.ts', import.meta.url), 'utf8')
test('上传关联面单后直接生成箱维度货物明细', () => {
test('贴标申请从当前客户仍有库存的历史入仓单选择来源', () => {
assert.match(view, /海外操作仓(中转仓)/)
assert.match(view, /选择有库存的历史入仓单/)
assert.match(view, /曾经下单且当前仍有库存的入仓单/)
assert.match(view, /当前中转仓暂无已入库可用库存/)
assert.match(view, /relabelInboundOptions/)
assert.match(view, /listRelabelInventoryCandidates\(form\.warehouse\)/)
assert.match(api, /relabel-applications\/inventory-candidates/)
assert.match(api, /params: \{ operationWarehouseId/)
})
test('客户贴标表单不展示客户单号、托盘和内部库存来源列', () => {
assert.doesNotMatch(view, /<i>\*<\/i>客户单号/)
assert.doesNotMatch(view, /<th>原入仓单<\/th>/)
assert.doesNotMatch(view, /<th>托盘<\/th>/)
assert.doesNotMatch(view, /<th>中转仓<\/th>/)
assert.doesNotMatch(view, /已选托盘组成/)
})
test('贴标申请保留关联模板下载和上传入口', () => {
assert.match(view, /downloadRelabelTemplate/)
assert.match(view, /下载关联模板/)
assert.match(view, /templateInput\?\.click\(\)/)
assert.match(view, /上传关联面单/)
assert.match(view, /cargoRows\.value = imported\.map/)
assert.match(view, /totalPackageCount: 1, notifiedPackageCount: 1/)
assert.doesNotMatch(view, /applyCartonMarkBinding/)
assert.doesNotMatch(view, /上传SKU 标签/)
assert.match(view, /importRelabelTemplate/)
assert.match(view, /明细行标识/)
assert.doesNotMatch(view, /库存位置ID/)
})
test('目的仓支持顶部兜底并随每箱明细提交', () => {
assert.match(api, /destinationWarehouseId\?: string/)
assert.match(view, /!item\.destinationWarehouseId && !form\.warehouse/)
assert.match(view, /destinationWarehouseId: item\.destinationWarehouseId \|\| undefined/)
assert.match(view, /cartonMark: item\.cartonMark/)
assert.match(view, /fbaCartonMark: item\.fbaCartonMark/)
test('贴标货物明细支持手动添加和编辑', () => {
assert.match(view, /手动添加行/)
assert.match(view, /addRelabelCargoRow/)
assert.match(view, /货物明细已按所选入仓单的可用库存带出/)
assert.match(view, /<el-input v-model="row\.sku" :readonly="props\.service === 'disposal'"/)
})
test('贴标明细保留箱唛绑定,不再单独填箱数', () => {
assert.match(view, /<th>我方箱唛<\/th><th>FBA 箱唛/)
assert.match(view, /v-model="row\.cartonMark"/)
assert.match(view, /v-if="props\.service !== 'labeling'">\{\{ props\.service === 'disposal'/)
test('贴标货物明细拆分为箱唛换标和 SKU 换标页签', () => {
assert.match(view, /el-tab-pane label="箱唛换标" name="carton"/)
assert.match(view, /el-tab-pane label="SKU 换标" name="sku"/)
assert.match(view, /interface SkuRelabelRow/)
assert.match(view, /来源库存箱 \*/)
assert.match(view, /我方箱唛 \*/)
assert.match(view, /换标数量(件)\*/)
assert.match(view, /buildSkuRelabelItems/)
assert.match(view, /CARTON_AND_SKU/)
assert.match(view, /changeCarton/)
assert.doesNotMatch(view, /SKU 换标提交待接口接入/)
})
test('商品 SKU 在贴标模板和明细中为选填', () => {
assert.match(view, /const header = \['商品SKU(选填)'/)
assert.match(view, /const example = \['', '示例商品'/)
assert.match(view, /headers\.includes\('商品SKU(选填)'\)/)
assert.match(view, /const required = \['中文品名', 'FBA货件编号'/)
assert.match(view, /商品 SKU<span v-if="props\.service !== 'labeling'"> \*<\/span>/)
assert.match(api, /skuCode\?: string; productNameZh/)
test('一次申请单选入仓单且每项保留原库存归属', () => {
assert.doesNotMatch(view, /multiple filterable collapse-tags/)
assert.match(view, /String\(candidate\.inboundOrderId\) === inboundOrderId/)
assert.match(view, /sourceInventoryBalanceId: String\(candidate\.inventoryBalanceId\)/)
assert.match(view, /sourceInventoryPositionId: String\(position\.positionId\)/)
assert.match(view, /sourceInboundOrderId: String\(candidate\.inboundOrderId\)/)
assert.match(api, /sourceInventoryBalanceId: string; sourceInventoryPositionId: string; sourceInboundOrderId: string/)
})
test('贴标申请详情展示逐箱箱唛换标关系', () => {
test('海外操作仓和FBA目的仓使用独立字段', () => {
assert.match(api, /operationWarehouseId: string/)
assert.match(api, /destinationFbaWarehouseCode\?: string/)
assert.match(view, /operationWarehouseId: form\.warehouse/)
assert.match(view, /destinationFbaWarehouseCode: item\.destinationWarehouseId/)
assert.match(view, /<th>FBA 目的仓<\/th>/)
})
test('操作仓和FBA仓均从商户仓库目录按类型加载', () => {
assert.match(view, /getMerchantWarehouses\(\{ warehouseType: 'FBA' \}\)/)
assert.match(view, /getMerchantWarehouses\(\{ warehouseType: 'OVERSEAS' \}\)/)
assert.match(view, /v-for="warehouse in operationWarehouses"/)
assert.match(view, /v-for="warehouse in fbaWarehouses"/)
assert.doesNotMatch(view, /美西海外仓-ONT8/)
})
test('选择海外操作仓后自动带出仓库签收联系方式', () => {
assert.match(warehouseApi, /contactName: string \| null/)
assert.match(warehouseApi, /contactPhone: string \| null/)
assert.match(view, /form\.contact = warehouse\?\.contactName \|\| ''/)
assert.match(view, /form\.phone = warehouse\?\.contactPhone \|\| ''/)
assert.match(view, /海外仓签收联系人/)
assert.match(view, /海外仓联系电话/)
assert.doesNotMatch(view, /ElMessage\.warning\('该海外仓主数据未完整维护/)
assert.match(view, /form\.warehouse && !form\.contact[^\n]+warehouse-unmaintained[^\n]+未维护/)
assert.match(view, /form\.warehouse && !form\.phone[^\n]+warehouse-unmaintained[^\n]+未维护/)
})
test('贴标详情展示箱唛、SKU 子明细和独立FBA目的仓', () => {
assert.match(api, /export interface RelabelDetail/)
assert.match(api, /return overseasApiRequest<RelabelDetail>/)
assert.match(view, /<h3>箱唛换标明细<\/h3>/)
assert.match(view, /item\.cartonMark \|\| '—'/)
assert.match(view, /item\.fbaCartonMark \|\| '—'/)
assert.match(view, /item\.shipmentNo \|\| '—'/)
assert.match(view, /item\.newSkuCode \|\| '—'/)
assert.match(view, /item\.destinationFbaWarehouseCode/)
assert.match(view, /item\.operationType === 'CARTON_AND_SKU'/)
assert.match(view, /item\.skuItems\?\.length/)
})