Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

update inventory-cli-reference.md incorrect info #8023

Merged
merged 11 commits into from
Oct 16, 2020
34 changes: 26 additions & 8 deletions src/guides/v2.3/inventory/inventory-cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Command options:

- `-c`, `--complete-orders` - Returns inconsistencies for completed orders. Incorrect reservations may still be on hold for completed orders.
- `-i`, `--incomplete-orders` - Returns inconsistencies for incomplete orders (partially shipped, unshipped). Incorrect reservations may hold too much or not enough salable quantity for the orders.
- `-b`, `--bunch-size` - Defines how many orders to load at once.
- `-r`, `--raw` - Raw output.

Responses using `-r` return in `<ORDER_INCREMENT_ID>:<SKU>:<QUANTITY>:<STOCK-ID>` format:
Expand Down Expand Up @@ -90,14 +91,15 @@ To create reservations, provide compensations using the format `<ORDER_INCREMENT
bin/magento inventory:reservation:create-compensations
```

Command options:
Command option:

- `-c`, `--complete-orders` - Creates reservations for completed order inconsistencies.
- `-i`, `--incomplete-orders` - Creates reservations for incomplete order inconsistencies.
- `-r`, `--raw` - Returns raw output.
- `-d`, `--dry-run` - Simulates reservation creation without applying reservations.

If the format of the request is incorrect, the following message displays: A list of compensations needs to be defined as argument or STDIN.
If the format of the request is incorrect, the following message displays:

```terminal
Error while parsing argument "your_incorrect_format_argument". Given argument does not match pattern "/(?P<increment_id>.*):(?P<sku>.*):(?P<quantity>.*):(?P<stock_id>.*)/".
```

As the command creates reservations, it displays messages indicating the updates by SKU, order, and stock.

Expand All @@ -108,30 +110,46 @@ Following reservations were created:
- Product bike-123 was compensated by +2.000000 for stock 1
```

You can run both commands by piping `list-inconsistencies` and `create-compensations` to detect inconsistencies and immediately create compensations. Use the `-r` command option to generate and submit the raw data to `create-compensations`.
### Detect inconsistencies and create compensations

You can detect inconsistences and immediately create compensations by using a pipe to run both the `list-inconsistencies` and `create-compensations`. Use the `-r` command option to generate and submit the raw data to `create-compensations`.

```bash
bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations
```

Example response:

```terminal
```bash
bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations
```

```terminal
Following reservations were created:
- Product bike-123 was compensated by +2.000000 for stock 1
- Product bikehat-456 was compensated by +1.000000 for stock 1
```

After updates complete, run the list command to verify:

```terminal
```bash
bin/magento inventory:reservation:list-inconsistencies -r
```

```terminal
No order inconsistencies were found.
```

You can also pipe the commands to detect inconsistencies and create compensations for only incomplete (`-i`) or complete (`-c`) orders.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line "No order inconsistencies were found." above is output. Separate the output from the input, as you did for the previous example.


```bash
bin/magento inventory:reservation:list-inconsistencies -r -i | bin/magento inventory:reservation:create-compensations
```

```bash
bin/magento inventory:reservation:list-inconsistencies -r -c | bin/magento inventory:reservation:create-compensations
```

## Import geocodes

{{site.data.var.im}} provides the [Distance Priority](https://docs.magento.com/m2/ce/user_guide/catalog/inventory-configure-distance-priority.html) algorithm, which helps determine the best option for shipping a full or partial order. The algorithm uses GPS information or geocodes to calculate the distance between the source (a warehouse or other physical location) of each item in an order and the shipping address. Based on those results, the algorithm recommends which source should be used to ship out each item in the order.
Expand Down