Files
SupplierSystem/docs/design/20260824-delivery-loading-photo-required.md
T
Ubuntu deb3e72750
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
chore: 以 AI 生鲜配送系统 当前版本作为 SupplierSystem 起点
来源仓库:jxc/ai-fresh-delivery
来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d
快照树:  09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件)

按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据
(生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、
deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值),
整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。
供应商系统后续开发自本提交开始。
2026-10-08 17:35:43 +08:00

2.0 KiB

核货强制补拍(发车前)

日期:2026-08-24
关联:delivery-loading-photos

目标 / 非目标

目标

  • 管理员在配送员角色上勾选「核货强制补拍」后:入库没有有效验收照的核货行,必须各有 1 张 补拍,配送员才能在小程序「确认发车 / 本车全部发车」。
  • 未勾选时仍可选拍;补拍上限改为 1 张,再拍则覆盖。
  • 补拍仍只写入 picking_items.loading_photos,不混入库照。

非目标

  • 不改结束配送「拍照送达」。
  • 不把补拍写入 inspections、不跑 AI。
  • 不要求入库已有照的商品再拍。
  • 不改 Web 代发车(tryAdvanceOrderToDelivering / allowAdminStart)。
  • 不把补拍检查写进 assertDeliveryLoadingComplete(该函数被定位上报复用)。

方案要点

  • 权限码 delivery_loading_photo,判定只认 role_permissions.role = 'delivery'(与 delivery_sign_photo 相同)。
  • 独立 assertDeliveryLoadingPhotosIfRequired:仅 POST /mobile/delivery/start、start-batch、以及 location 在任务尚未 task_status≥20 却要发车 时调用。
  • can_start_delivery 在开关打开时额外要求无入库照行 loading_photo_count >= 1;确认有货 / 扫码 / 撤销不要求照片。

改动面

  • server/src/seed-permissions.ts、deliveryPhotoService.ts、deliveryLoadingService.ts、mobileDeliveryRoutes.ts
  • src/config/permissionCatalog.ts、src/utils/permissionLabels.ts
  • miniprogram/components/delivery-panel/
  • docs/modules/05-配送履约.md

验收标准

  • 开关关:可不拍就从小程序发车
  • 开关开:无入库照每行 1 张才能发车;缺拍 start 返回 400
  • 入库已有照:无拍照钮
  • 定位:已配送中可继续上报;未发车借定位发车同样拦补拍
  • 无新表;结束配送送达照逻辑不变

风险与回滚

关掉配送员角色上的「核货强制补拍」即恢复可不拍发车;回滚代码即可。