修复:校验托盘状态类型

This commit is contained in:
焦龙言
2026-07-24 19:53:04 +08:00
parent bab09f4eb3
commit cb3bf5bf4c
2 changed files with 32 additions and 3 deletions
@@ -32,7 +32,8 @@ class PalletStateMachine:
current: PalletFlowState,
target: PalletFlowState,
) -> None:
if not isinstance(current, PalletFlowState) or not isinstance(target, PalletFlowState):
raise TypeError('current 和 target 必须是 PalletFlowState')
if (current, target) not in cls._ALLOWED_TRANSITIONS:
raise InvalidPalletTransition(
f'不允许的托盘状态迁移:{current.value} -> {target.value}'
)
raise InvalidPalletTransition(f'不允许的托盘状态迁移:{current.value} -> {target.value}')