Actions8
Đặt Mức Tồn Kho
AI-generatedOverview
This node integrates with the Sapo inventory management system to perform various inventory-related operations. It is useful for managing stock levels, transferring inventory between locations, and retrieving detailed inventory information. Typical use cases include:
- Adjusting stock quantities after physical inventory counts or corrections.
- Setting exact stock levels at specific warehouse locations.
- Transferring stock between warehouses or stores.
- Retrieving detailed inventory data for reporting or synchronization.
- Canceling pending inventory transfers.
For example, a retail business can automate stock adjustments after receiving new shipments or returns, ensuring accurate inventory records across multiple store locations.
Properties
| Name | Meaning |
|---|---|
| ID Sản Phẩm | The unique numeric identifier of the inventory item (product) to operate on. |
| ID Kho | The numeric identifier of the inventory location (warehouse/store) involved in the operation. |
| Số Lượng | The quantity number used to adjust, set, or transfer stock. |
| Ghi Chú | Optional notes or reasons describing the inventory operation. |
Additional properties relevant to specific operations:
| Name | Meaning |
|---|---|
| Thao Tác (operation) | The inventory operation to perform. Options: "Điều Chỉnh Số Lượng" (adjustQuantity), "Hủy Chuyển Kho" (cancelTransfer), "Lấy Chi Tiết" (get), "Lấy Chi Tiết Kho" (getLocation), "Lấy Danh Sách" (getMany), "Lấy Chi Tiết Chuyển Kho" (getTransfer), "Danh Sách Kho" (listLocations), "Đặt Mức Tồn Kho" (setLevel), "Chuyển Kho" (transfer). |
| Hành Động (action) | For "adjustQuantity" operation only. Defines how quantity is adjusted: "Đặt Giá Trị" (set), "Thêm" (add), "Bớt" (remove). |
| ID Kho Đích (targetLocationId) | For "transfer" operation. The destination location ID for inventory transfer. |
| ID Chuyển Kho (transferId) | For "getTransfer" and "cancelTransfer" operations. The ID of the inventory transfer. |
| Số Tham Chiếu (referenceNumber) | For "transfer" operation. Reference number associated with the inventory transfer. |
| Trả Về Tất Cả (returnAll) | For "getMany" operation. Boolean indicating whether to return all results or limit them. |
| Giới Hạn (limit) | For "getMany" operation when not returning all. Maximum number of results to return. |
| Thông Tin Bổ Sung (additionalFields) | For "getMany" operation. Additional filters such as location ID and update date ranges. |
Output
The node outputs an array with one element containing a json object representing the result of the selected inventory operation. The structure of this JSON depends on the operation performed:
- For retrieval operations (
get,getMany,getLocation,getTransfer,listLocations), it contains detailed inventory data or lists. - For modification operations (
adjustQuantity,setLevel,transfer,cancelTransfer), it contains confirmation details or updated inventory status.
No binary data output is produced by this node.
Dependencies
- Requires an API key credential for authenticating with the Sapo API.
- Depends on the external Sapo inventory API service.
- The node uses an internal helper class to interact with the Sapo API endpoints.
Troubleshooting
Common issues:
- Invalid or missing product or location IDs will cause API errors.
- Insufficient permissions or invalid API credentials will prevent successful API calls.
- Attempting to transfer more stock than available may result in errors.
- Network connectivity issues can cause request failures.
Error messages:
- Errors from the Sapo API are caught and returned as error messages in the node output if "Continue On Fail" is enabled.
- Otherwise, errors throw exceptions with message and stack trace.
Resolution tips:
- Verify that all required numeric IDs are correct and correspond to existing products and locations.
- Ensure the API key credential is valid and has necessary permissions.
- Check network connectivity and API endpoint availability.
- Use the "Ghi Chú" field to provide context for adjustments or transfers to aid auditing.
Links and References
- Sapo Inventory API Documentation (example link; replace with actual)
- n8n documentation on Creating Custom Nodes
- General inventory management best practices articles and resources