In our external erp system we have Purchase orders and receipts on them.
We want to create a movement in Quantify to let the system know we have ordered items, and they are to be expected.
Next step would be to receive them.
From within vb.net we tried the following to create the movement for the ordered items :
AvontusPrincipal.Logout()
Dim success As Boolean = AvontusPrincipal.Login("xx", "yy")
If success Then
Console.WriteLine("Login successful")
Else
Console.WriteLine("Login failed")
Console.WriteLine("Press any key to continue...")
Console.ReadLine()
Return
End If
Dim objMovement As Movement = Movement.NewMovement(MovementType.Ordered, False)
With objMovement
.MovementProducts.Item("E08SR0012").Quantity = 15
.MovementNumber = "20160001"
.BusinessPartnerID = Guid.Parse("9c53d64a-f734-48b4-9bc1-683ed8855114")
.DestinationID = Guid.Parse("5cc7d45c-46e5-4f9e-9d45-a20c54048b95")
.BackOrderNumber = "654321"
Try
.Save(True)
Catch ex As Exception
Console.Write(ex.Message.ToString.Trim)
End Try
End With
First thing that surprises me is that after the objMovement has been dimensioned, the property collection MovementProducts has all 365 products from our test environment in it… Is there another way of doing this ?
If we then set the quantity and save this, there is an exception on the save that the validation is not correct, and nothing is being saved.
Where and How can we find what exactly went wrong, is there an error collection somewhere, and why is it creating an exception ?