Skip to content

Commit

Permalink
feat(picqer): allocated + stockOnhand
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnvdbrug committed Nov 21, 2023
1 parent d955112 commit 20390ca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/vendure-plugin-picqer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.2.4 (2023-11-21)

- Take Picqer allocated stock into account when setting stock on hand

# 2.2.3 (2023-11-21)

- Log order code when order couldn't be added to push-order queue
Expand Down
2 changes: 1 addition & 1 deletion packages/vendure-plugin-picqer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-picqer",
"version": "2.2.3",
"version": "2.2.4",
"description": "Vendure plugin syncing to orders and stock with Picqer",
"icon": "truck",
"author": "Martijn van de Brug <[email protected]>",
Expand Down
8 changes: 5 additions & 3 deletions packages/vendure-plugin-picqer/src/api/picqer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,15 @@ export class PicqerService implements OnApplicationBootstrap {
variant.id,
location.id
);
const delta = picqerStock.freestock - stockOnHand;
const allocated = picqerStock.reservedallocations ?? 0;
const newStockOnHand = allocated + picqerStock.freestock;
const delta = newStockOnHand - stockOnHand;
const res = await this.connection
.getRepository(ctx, StockLevel)
.save({
id: stockLevelId,
stockOnHand: picqerStock.freestock,
stockAllocated: picqerStock.reservedallocations ?? 0,
stockOnHand: newStockOnHand,
stockAllocated: allocated,
});
// Add stock adjustment
stockAdjustments.push(
Expand Down

0 comments on commit 20390ca

Please sign in to comment.