This commit is contained in:
zlwu committed 2026-09-16 10:27:24 +08:00
1 parent d294ecad84
commit 5623d0125c
13 files changed
+135 -100

No files matched your search

@@ -5,6 +5,10 @@ import type { ProductionWorkOrderItem } from '@/api/production-work-order'
import { extractProductionTaskSteps } from '@/utils/production-labels'
export function needsProductionReceptionGate(row: ProductionWorkOrderItem): boolean {
// 仅入库生产(细胞存储/科研捐赠)需要生产接收登记;扩增传代(temporary)、出库等不需要。
// 注意:临时工单 DB 默认 reception_source=cell_storage,不可仅凭来源判断。
const woType = String(row.workOrderType || 'inbound').trim() || 'inbound'
if (woType !== 'inbound') return false
const src = String(row.receptionSource || '').trim()
return src === 'cell_storage' || src === 'research_donation'
}
@@ -39,17 +39,44 @@ describe('classifyTasksForCompleteWorkOrderGate', () => {
})
describe('needsProductionReceptionGate', () => {
it('true for cell_storage and research_donation', () => {
assert.equal(needsProductionReceptionGate({ receptionSource: 'cell_storage' } as any), true)
it('true for inbound cell_storage and research_donation', () => {
assert.equal(
needsProductionReceptionGate({ receptionSource: 'research_donation' } as any),
needsProductionReceptionGate({
workOrderType: 'inbound',
receptionSource: 'cell_storage'
} as any),
true
)
assert.equal(
needsProductionReceptionGate({
workOrderType: 'inbound',
receptionSource: 'research_donation'
} as any),
true
)
// 缺省 workOrderType 视为入库
assert.equal(needsProductionReceptionGate({ receptionSource: 'cell_storage' } as any), true)
})
it('false for outbound/temporary', () => {
it('false for outbound/temporary even if receptionSource looks inbound', () => {
assert.equal(needsProductionReceptionGate({ receptionSource: 'outbound' } as any), false)
assert.equal(needsProductionReceptionGate({} as any), false)
// 扩增/传代临时工单:DB 默认 reception_source=cell_storage,且常无 sampleCode
assert.equal(
needsProductionReceptionGate({
workOrderType: 'temporary',
receptionSource: 'cell_storage',
sampleCode: ''
} as any),
false
)
assert.equal(
needsProductionReceptionGate({
workOrderType: 'outbound',
receptionSource: 'cell_storage'
} as any),
false
)
})
})