feat(admin): add simulated container booking links

This commit is contained in:
2026-08-14 20:59:19 +08:00
parent 1540b80c89
commit 086b4304c6
11 changed files with 235 additions and 48 deletions
@@ -226,10 +226,24 @@ describe('ContainersView', () => {
expect(source).not.toContain('上传入口待')
})
it('does not expose manual container creation without an ocean-booking channel snapshot', () => {
it('creates an internal simulation without asking for real booking transport facts', () => {
const source = readFileSync(resolve(process.cwd(), 'src/modules/container-loading/pages/ContainersView.vue'), 'utf8')
expect(source).not.toContain('新增货柜')
expect(source).not.toContain('createContainer(')
expect(source).toContain('新增模拟柜')
expect(source).toContain('createContainerSimulation({ ...simulationForm })')
expect(source).toContain("channelCode: '', warehouseId: '', containerType: '40HQ', capacityCbm: 68, maxWeightKg: 28000")
expect(source).toContain('服务端会生成稳定的内部柜次')
expect(source).not.toContain('openCreate')
})
it('allows first linking after preloading but only offers unlinking for wait-loading containers', () => {
const source = readFileSync(resolve(process.cwd(), 'src/modules/container-loading/pages/ContainersView.vue'), 'utf8')
expect(source).toContain("!row.oceanBookingId && ['WAIT_LOADING','EDITING'].includes(row.planStatus)")
expect(source).toContain("row.oceanBookingId && row.planStatus === 'WAIT_LOADING'")
expect(source).toContain('已预排货但尚未进入 PDA、取证或单证阶段的模拟柜仍可首次关联')
expect(source).toContain('内部柜次与装柜明细保持不变')
expect(source).toContain('只有尚未排货的空柜可以解除')
expect(source).toContain('linkContainerOceanBooking(target.id, { oceanBookingId: candidate.oceanBookingId, requirementId: candidate.requirementId, expectedVersion: target.version })')
expect(source).toContain('unlinkContainerOceanBooking(target.id, target.version, unlinkReason.value.trim())')
})
})