Giao diện
Vận đơn & Thiếu hàng
Trang sinh tự động
Phần nghiệp vụ viết tay; API, dữ liệu, quyền, đường dẫn và file nguồn do bộ sinh điền từ source tại ad83b0aea.
Làm gì
Gom đơn thành vận đơn, cập nhật trạng thái giao, ghi nhận lần giao thất bại và sự cố. Thiếu hàng là một ca riêng vì nó chặn việc huỷ đơn và ảnh hưởng tới tiền.
Quy mô
| Domain API | fulfillment, shortage |
| Query / Mutation | 12 / 9 |
| Nguồn dữ liệu | — |
| Bảng | 0 |
| Luật phân quyền | 3 |
| Đường dẫn Web Admin | 4 |
Thao tác (mutation)
| Mutation | Domain | Mô tả |
|---|---|---|
groupShipment | fulfillment | Retired (U19-P4-02, B013.R15): every new call answers conflict reason retired; use handoverShipment. Requires shipment.create. |
handoverShipment | fulfillment | Atomic create + handover of the selected orders/cycles: shipment, mapping, code, COD snapshot, locked payment mode per unit, CREATED -> PACKING. Requires shipment.create. |
opsCancelOrder | shortage | Cancels the whole order for Hết hàng / thiếu hàng: idempotent by requestId, checks expectedVersion and eligibility at the server. Requires order.cancel. |
recordDeliveryAttempt | fulfillment | Deprecated (U19-P4-02, B190.R02): logs one failed attempt on a SHIPPING shipment, state kept. Requires shipment.update. |
recordFulfillmentEvent | fulfillment | Legacy manual status change or delivery issue. Requires shipment.update. |
recordFulfillmentException | fulfillment | Records a delivery incident; moves no shipment. Requires order.manage (GAP-01/GAP-51). |
recordShipmentCodCollection | fulfillment | Collect every OPEN COD obligation of a DELIVERED shipment in one transaction (Operations confirms, Word B186.R02). Requires cod.collect. |
recordStockShortage | shortage | Records a shortage of a Mua chung product: cancels and refunds each listed order WHOLE (every unit still owed; a smaller quantity answers conflict whole_order_only, Word B048.R02). A Mua định kỳ product answers conflict whole_order_only: use opsCancelOrder (DH-US-08 AC04, U19-R34). Requires ops.shortage manage (SHR-02, GAP-83). |
updateShipmentStatus | fulfillment | Updates a shipment and every order / cycle in it, optionally with the COD collected, in one transaction. Requires shipment.update. |
Phép đọc (query)
| Query | Domain | Mô tả |
|---|---|---|
cycleScheduleForStaff | fulfillment | Cycle schedule of Recurring orders for Operations, by campaign, order, state and date. Requires order.read (OPS-02). |
fulfillmentExceptions | fulfillment | Exceptions of a shipment or an order, newest first. Requires order.read (GAP-51). |
opsOrderCancelPreview | shortage | Read-only preview of the Ops cancel for shortage of one order (button state and the Hệ quả list). Requires order.cancel. |
orderDeliveryProgress | fulfillment | Delivery progress of one order, per Group Buy order / Recurring cycle. |
shipment | fulfillment | One shipment with items and timeline. Requires shipment.read. |
shipmentCandidates | fulfillment | Shipment wizard step 1 (U19-P2-28, VD-US-03 AC01/AC07/AC08): Group Buy orders and Recurring cycles in Chờ đóng gói |
shipmentCodCollectPreview | fulfillment | U28-FU-API-B. Preview of recordShipmentCodCollection (per order / cycle payment status after, reward points released). Read-only. Requires cod.collect (COD-01). Errors: not_found, forbidden, validation_failed. |
shipments | fulfillment | Shipments, newest first; search + filters + tab ANDed, pageSize 1..500 (default 50). Requires shipment.read. |
shipmentStatusPreview | fulfillment | U28-P2-09. Preview of updateShipmentStatus for one target state (per order / cycle consequences, attempt number). Read-only. Requires shipment.update (SHP-03). Errors: not_found, validation_failed. U28-FU-API-D: codCollected = the Đã thu đủ tiền COD tick the save would send (applied with DELIVERED while COD is due). |
stockShortageCase | shortage | One case with its affected orders. Requires SHR-01 (GAP-83). |
stockShortageCases | shortage | Shortage cases, newest first. Requires ops.shortage read (SHR-01, GAP-83). |
stockShortageImpact | shortage | Preview of affected orders (listed, or every LOCKED order of the product). Requires SHR-01. |
Quyền
| Mã | Quyền | Ứng dụng | Vai trò | Phạm vi | Trạng thái |
|---|---|---|---|---|---|
SHP-01 | shipment.read | WEB_ADMIN | operations admin | ALL | DEFINED |
SHP-02 | shipment.create | WEB_ADMIN | operations admin | ALL | DEFINED |
SHP-03 | shipment.update | WEB_ADMIN | operations admin | ALL | DEFINED |
Danh sách đầy đủ và cách đọc các cờ: Ma trận quyền.
Giao diện Web Admin
| Đường dẫn | Hằng số |
|---|---|
/shipments | SHIPMENTS |
/shipments/:id | SHIPMENT_DETAIL |
/shipments/:id/update | SHIPMENT_UPDATE |
/shipments/new | SHIPMENT_NEW |
File nguồn
Backend:
code/apps/api/supabase/functions/graphql/domains/fulfillment/code/apps/api/supabase/functions/graphql/domains/shortage/
Tài nguyên quyền không có luật nào
Bản đồ module khai các tài nguyên shortage nhưng ma trận quyền không có luật nào cho chúng. Hoặc tên tài nguyên trong bản đồ sai, hoặc quyền chưa được định nghĩa.