cancel
Showing results for 
Search instead for 
Did you mean: 
My Areas

Sign in or create account

to get a personalized navigation.

Kjetil Ringstad
PARTNER

Strange error when creating purchase receipts with allocations

by Kjetil Ringstad (Updated ‎24-06-2021 11:11 by Kjetil Ringstad PARTNER )

An error occurs when creating purchase receipts without a link to specific purchases, and the same inventory number occurs multiple times after each other, and in addition allocations are specified.


Endpoint: POST to /controller/api/v1/PurchaseReceipt

 

This error occurs even though the quantities are specified:
"message": "VismaId: 7523eff7-f821-4666-a1da-7e4644487f0c. Error creating purchase receipt. Purchase order error: The quantity must be above 0."

 

If the inventory numbers are not straight after each other , but separated by another number inbetween everything goes well.

 

Example, method 1, this creates an error:
Product 1, allocation A
Product 1, allocation B
Product 2, allocation C

 

But this goes well, method 2,
Product 1, allocation A
Product 2, allocation C
Product 1, allocation B

 

Please see the JSON examples OK and NotOk below.

 

The data is coming from a WMS system , so we don't have control over the order the products are received.


For other reasons, the products need to be stated on two different lines in Visma.net, so we can't merge them into one line with two allocations.

 

Please advise on what we should change to get method 1 to work as intended.

 

Not OK, method 1:

 

{
	"receiptType": {
		"value": "PoReceipt"
	},
	"hold": {
		"value": false
	},
	"date": {
		"value": "2021-06-24T10:11:28.000Z"
	},
	"warehouseId": {
		"value": "AA"
	},
	"supplierId": {
		"value": "50069"
	},
	"locationId": {
		"value": "HOVED"
	},
	"createBill": {
		"value": false
	},
	"lines": [
		{
			"allocations": [
				{
					"operation": "Insert",
					"lineNbr": {
						"value": 1
					},
					"location": {
						"value": "Stuv"
					},
					"lotSerialNumber": {
						"value": "170x170"
					},
					"quantity": {
						"value": 2.8
					},
					"uom": {
						"value": "M2"
					}
				}
			],
			"operation": "Insert",
			"lineNbr": {
				"value": 0
			},
			"lineType": {
				"value": "GoodsForInventory"
			},
			"inventoryId": {
				"value": "117768"
			},
			"warehouseId": {
				"value": "AA"
			},
			"locationId": {
				"value": "Stuv"
			},
			"uom": {
				"value": "M2"
			}
		},
		{
			"allocations": [
				{
					"operation": "Insert",
					"lineNbr": {
						"value": 1
					},
					"location": {
						"value": "Stuv"
					},
					"lotSerialNumber": {
						"value": "400x92"
					},
					"quantity": {
						"value": 3.6
					},
					"uom": {
						"value": "M2"
					}
				}
			],
			"operation": "Insert",
			"lineNbr": {
				"value": 0
			},
			"lineType": {
				"value": "GoodsForInventory"
			},
			"inventoryId": {
				"value": "117768"
			},
			"warehouseId": {
				"value": "AA"
			},
			"locationId": {
				"value": "Stuv"
			},
			"uom": {
				"value": "M2"
			}
		},
		{
			"allocations": [
				{
					"operation": "Insert",
					"lineNbr": {
						"value": 1
					},
					"location": {
						"value": "Stuv"
					},
					"lotSerialNumber": {
						"value": "133x490"
					},
					"quantity": {
						"value": 6.5
					},
					"uom": {
						"value": "M2"
					}
				}
			],
			"operation": "Insert",
			"lineNbr": {
				"value": 0
			},
			"lineType": {
				"value": "GoodsForInventory"
			},
			"inventoryId": {
				"value": "113728"
			},
			"warehouseId": {
				"value": "AA"
			},
			"locationId": {
				"value": "Stuv"
			},
			"uom": {
				"value": "M2"
			}
		}
	]
}

 

 

OK, method 2:

 

{
	"receiptType": {
		"value": "PoReceipt"
	},
	"hold": {
		"value": false
	},
	"date": {
		"value": "2021-06-24T10:11:28.000Z"
	},
	"warehouseId": {
		"value": "AA"
	},
	"supplierId": {
		"value": "50069"
	},
	"locationId": {
		"value": "HOVED"
	},
	"createBill": {
		"value": false
	},
	"lines": [
		{
			"allocations": [
				{
					"operation": "Insert",
					"lineNbr": {
						"value": 1
					},
					"location": {
						"value": "Stuv"
					},
					"lotSerialNumber": {
						"value": "170x170"
					},
					"quantity": {
						"value": 2.8
					},					
					"uom": {
						"value": "M2"
					}
				}
			],
			"operation": "Insert",
			"lineNbr": {
				"value": 0
			},
			"lineType": {
				"value": "GoodsForInventory"
			},
			"inventoryId": {
				"value": "117768"
			},
			"warehouseId": {
				"value": "AA"
			},
			"locationId": {
				"value": "Stuv"
			},
			"uom": {
				"value": "M2"
			}
		},
		{
			"allocations": [
				{
					"operation": "Insert",
					"lineNbr": {
						"value": 1
					},
					"location": {
						"value": "Stuv"
					},
					"lotSerialNumber": {
						"value": "133x490"
					},
					"quantity": {
						"value": 6.5
					},
					"uom": {
						"value": "M2"
					}
				}
			],
			"operation": "Insert",
			"lineNbr": {
				"value": 0
			},
			"lineType": {
				"value": "GoodsForInventory"
			},
			"inventoryId": {
				"value": "113728"
			},
			"warehouseId": {
				"value": "AA"
			},
			"locationId": {
				"value": "Stuv"
			},
			"uom": {
				"value": "M2"
			}
		},
		{
			"allocations": [
				{
					"operation": "Insert",
					"lineNbr": {
						"value": 1
					},
					"location": {
						"value": "Stuv"
					},
					"lotSerialNumber": {
						"value": "400x92"
					},
					"quantity": {
						"value": 3.6
					},
					"uom": {
						"value": "M2"
					}
				}
			],
			"operation": "Insert",
			"lineNbr": {
				"value": 0
			},
			"lineType": {
				"value": "GoodsForInventory"
			},
			"inventoryId": {
				"value": "117768"
			},
			"warehouseId": {
				"value": "AA"
			},
			"locationId": {
				"value": "Stuv"
			},
			"uom": {
				"value": "M2"
			}
		}
	]
}

 

 

1 REPLY 1

by Magnus Johnsen

Hi,

We have confirmed this happens when having two consecutive entries of the same item.

It seems like a check is triggered on the second entry, and if the receiptQty is included on the line, it seems like the inventoryItem is not found.
We'll look into this. 

Thank you.