Source file: Vending Machine Program Integration with Third-Party Software V2.5 new.pdf
Output type: English HTML extract. Non-English content was translated or replaced with the English equivalent already present in the document.
This section explains the design considerations of the program system, including the basic processing flow of the program, the organizational structure of the system, module division, function allocation, interface design, and data structure design.
Note: Different users can implement their respective interfaces based on their different needs. If an interface is not relevant, it does not need to be implemented. QR code scanning requires additional hardware installation.
| Term | Explanation | Remark |
|---|---|---|
| Stocking (Delivery) | The identifier used by the stocking/delivery personnel to open the machine for restocking. It can be entered on the touchscreen or by scanning a QR code. | An 8-digit Arabic numeral. |
| Pick Up Code | The password used by the user to collect goods. It can be entered on the touchscreen or by scanning a QR code. | An 8-digit Arabic numeral. |
All interfaces use HTTP POST to send requests to the third-party server, and the returned results are in JSON format. The request address for the VMC is configurable. See the last page for how to enter the server address.
| Field Name | Type | Explanation |
|---|---|---|
| FunCode | String | Interface No: 1000 |
| MachineID | String | Machine ID |
| TradeNo | String | Serial number; return as-is |
| SlotNo | String | Slot number |
| KeyNum | Int | Key number, for machines with corresponding buttons |
| Status | Int | Slot status: 0 = normal, other = malfunction |
| Quantity | Int | Restocking / delivery quantity |
| Stock | Int | Current stock after restocking / delivery |
| Capacity | Int | Capacity |
| ProductID | String | Commodity / product ID |
| Price | String | Unit price, e.g. 1.5 |
| Type | String | Product type |
| Introduction | String | Product introduction |
| Name | String | Product name |
Any changes to product data on the machine trigger this interface to report to the third-party server.
{"Status":"0","SlotNo":"22","TradeNo":"20170802193446876","Err":"success","ImageUrl":"http://xxx.com/201708029502889.png","ImageDetailUrl":"http://xxx.com/20170801124323318.png"}
| Field Name | Explanation |
|---|---|
| Status | 0 = restocking successful; 1 = re-upload; other = failure. Required. |
| SlotNo | Slot number. Required. |
| TradeNo | Uploaded serial number, returned as-is. |
| ImageUrl | Product image URL. |
| ImageDetailUrl | Product details image URL. |
| Err | Error description. |
| Field Name | Type | Explanation |
|---|---|---|
| FunCode | String | Interface No: 2000 |
| TradeNo | String | Order number / serial number; return as-is |
| SessionCode | String | Pick-up code entered by the client on the touch screen |
| MachineID | String | Machine ID |
| SlotNo | String | Slot number |
| Price | String | Unit price, e.g. 1.5 |
| Account | String | Card number. Usually not used together with SessionCode; choose one. |
| PWD | String | Password |
{ "Status": "0","SlotNo":"23","ProductID":"1002356","TradeNo":"20170609123523569","Err":"success"}
| Field Name | Explanation |
|---|---|
| Status | 0 indicates success; others indicate failure. Required. |
| SlotNo | Slot numbers to dispense from. Multiple slots are separated by |. Example: 23|28. Required. |
| ProductID | Product ID to dispense. If SlotNo > 0, dispensing prioritizes SlotNo. To dispense by ProductID, set SlotNo to a number less than 1. |
| TradeNo | Order number, returned as-is. Required. |
| Err | Error description. |
| Field Name | Type | Explanation |
|---|---|---|
| FunCode | String | Interface No: 4000 |
| MachineID | String | Machine ID |
Case 1: MsgType = 0. Server controls the VMC to dispense the product.
{ "Status": "0","MsgType":"0","TradeNo":"20170609123523569","SlotNo":"25","ProductID":"1005678692","Err":"success"}
| Field Name | Explanation |
|---|---|
| Status | 0 = success; others = failure. |
| MsgType | Message type. |
| TradeNo | Order number / serial number. |
| SlotNo | Slot number to dispense from. |
| ProductID | Product ID to dispense. If SlotNo > 0, dispensing prioritizes SlotNo. To dispense by ProductID, set SlotNo to a number less than 1. |
| Err | Error description. |
Note: This feature is generally used for app or e-commerce one-click pickup. The VMC should call this interface periodically. Recommended interval: 3 seconds.
Case 2: MsgType = 1. E-commerce platform or app notifies the VMC of restocking.
{ "Status": "0","MsgType":"1","SlotNo":"25","TradeNo":"111111","Capacity":"1","Quantity":"1","ProductID":"111111","Name":"dsff","Price":"2.0","Type":"yinl","Introduction":"ssfsf","ImageUrl":"http://xxx.com/201708029502889.png","ImageDetailUrl":"http://xxx.com/201708029502889.png","GoodsAdUrl":"ssfsf","Err":"success"}
| Field Name | Explanation |
|---|---|
| Status | 0 = restocking needed; others = not needed. |
| MsgType | Message type = 1. |
| SlotNo | Slot number. |
| Err | Error description. |
| Capacity | Capacity. |
| Quantity | Restock quantity. |
| ProductID | Product ID. |
| Name | Product name. |
| Price | Price. |
| Type | Product type. |
| Introduction | Product description. |
| ImageUrl | Product image URL. |
| ImageDetailUrl | Product details image URL. |
Note: After successful restocking, call the restocking result feedback interface. Since polling happens every 3 seconds, the machine needs time to update product information after receiving the message. The server can wait a while before checking for success or failure feedback. During this wait, the response can still return the content for server-controlled dispensing.
Note: After downloading, call the download result feedback interface. Because polling happens every 3 seconds, the machine needs time to download the advertisement after publication. The server can wait before checking for success/failure feedback. During this wait, it can still return content for server-controlled dispensing. When returning ad content, return all published ads, including ones already downloaded successfully, because the local machine compares against the returned ad list and deletes ads that are no longer present.
| Field Name | Type | Explanation |
|---|---|---|
| FunCode | String | Interface No: 5000 |
| MachineID | String | Machine ID |
| PayType | Int | Payment type |
| TradeNo | String | Order number / serial number |
| SlotNo | String | Slot number |
| Status | Int | 0 = dispensing successful; 1 = dispensing failed; 2 = dispensing successful but order number missing or invalid; 3 = dispensing failed but order number missing or invalid; 4 = dispensing result unknown |
| Time | String | Delivery time |
| Amount | String | Amount |
| ProductID | String | Product ID |
| Name | String | Product name |
| Type | String | Product type |
{ "Status": "0","TradeNo":"20170609123523569","SlotNo":"25","Err":"success"}
| Field Name | Explanation |
|---|---|
| Status | 0 = confirmation successful; others = failure. |
| TradeNo | Order number / serial number. |
| SlotNo | Slot number. |
| Err | Error description. |
| Field Name | Type | Explanation |
|---|---|---|
| FunCode | String | Interface No: 5001 |
| MachineID | String | Machine ID |
| SlotNo | String | Slot number |
| Status | Int | 0 = success; others = failure |
{ "Status": "0","SlotNo":"25","TradeNo":"20170609123523569","Err":"success"}
| Field Name | Explanation |
|---|---|
| Status | 0 = confirmation successful; others = failure. |
| SlotNo | Slot number. |
| TradeNo | Order number, returned as-is. |
| Err | Error description. |
Polling traffic note: The polling interface (Funcode 4000) polls every 3 seconds by default, which can consume a lot of data.
Go to the machine administration settings page, open E-Commerce pickup, and enter your server address there to receive data.
Note: The original PDF appears to include configuration screenshots on the last pages. Text extraction did not capture the image content.