| 12345678910111213141516 |
- <?php
- declare(strict_types=1);
- namespace plugin\saiadmin\app\service\fulfillment;
- use plugin\saiadmin\exception\ApiException;
- /** Explicit state policy shared by settlement commands and route completion. */
- final class DeliveryState
- {
- public const ACTIVE = ['pending','assigned','transit','returning'];
- public const TERMINAL = ['completed','returned','cancelled'];
- public static function requireAction(string $state,string $action): void
- {
- $allowed=['receive'=>['transit'],'return_receive'=>['returning'],'redeliver'=>['returned']];
- if (!in_array($state,$allowed[$action]??[],true)) throw new ApiException('当前配送状态不允许此操作,请刷新任务');
- }
- }
|