My Products
Help
RonnyV
CONTRIBUTOR ***

InventoryIssue: Unable to add allocations

by RonnyV

Hi,

 

I am trying to create an inventory issue, and since there are some items with lot/serialno I need to provide that as well.

 

I am trying to post the following data:

{
  "issueLines": [
    {
      "warehouseId": {
        "value": "1"
      },
      "tranType": {
        "value": "Issue"
      },
      "operation": "Insert",
      "inventoryNumber": {
        "value": "ZM000736"
      },
      "locationId": {
        "value": "1"
      },
      "quantity": {
        "value": 3.0
      },
      "reasonCode": {
        "value": "2"
      },
      "description": {
        "value": ""
      },
      "allocations": [
        {
          "operation": "Insert",
          "lineNbr": {
            "value": 1
          },
          "location": {
            "value": "1"
          },
          "lotSerialNumber": {
            "value": "SVE98765"
          },
          "quantity": {
            "value": -1.0
          }
        },
        {
          "operation": "Insert",
          "lineNbr": {
            "value": 2
          },
          "location": {
            "value": "1"
          },
          "lotSerialNumber": {
            "value": "SVE98766"
          },
          "quantity": {
            "value": -1.0
          }
        },
        {
          "operation": "Insert",
          "lineNbr": {
            "value": 3
          },
          "location": {
            "value": "1"
          },
          "lotSerialNumber": {
            "value": "SVE98776"
          },
          "quantity": {
            "value": -1.0
          }
        }
      ]
    }
  ],
  "date": {
    "value": "2022-05-20T10:07:16.563"
  },
  "externalReference": {
    "value": "70"
  },
  "description": {
    "value": ""
  }
}

 The response says that I did not provide either location and/or lot/serial number:

{
  "message": "VismaId: 091b387b-aff6-49c5-b8bb-f756385ead1c. Error creating inventory issue. Error: Inserting  'Inventory transaction' record raised at least one error. Please review the errors.\r\nOne or more lines contain unassigned location and/or lot/serial number.\r\n"
}

 Though when I check the data that I send I think I provide both location and lot/serial nunber for every allocation line.

 

Can anyone see what I am doing wrong?

 

Best regards

Ronny Videkull

4 REPLIES 4
Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

Could it be that you are providing negative numbers in the allocation?

We were able to add it when setting the line number quantity to 0 and the 1 for each line as such:

{
  "issueLines": [
    {
      "warehouseId": {
        "value": "1"
      },
      "tranType": {
        "value": "Issue"
      },
      "operation": "Insert",
      "inventoryNumber": {
        "value": "TestUsed"
      },
      "locationId": {
        "value": "1"
      },
      "quantity": {
        "value": 0
      },
      "reasonCode": {
        "value": "2"
      },
      "description": {
        "value": ""
      },
      "allocations": [
        {
          "operation": "Insert",
          "lineNbr": {
            "value": 1
          },
          "location": {
            "value": "1"
          },
          "lotSerialNumber": {
            "value": "125"
          },
          "quantity": {
            "value": 1
          }
        },
        {
          "operation": "Insert",
          "lineNbr": {
            "value": 2
          },
          "location": {
            "value": "1"
          },
          "lotSerialNumber": {
            "value": "126"
          },
          "quantity": {
            "value": 1
          }
        },
        {
          "operation": "Insert",
          "lineNbr": {
            "value": 3
          },
          "location": {
            "value": "1"
          },
          "lotSerialNumber": {
            "value": "127"
          },
          "quantity": {
            "value": 1
          }
        }
      ]
    }
  ],
  "date": {
    "value": "2022-05-20T10:07:16.563"
  },
  "externalReference": {
    "value": "70"
  },
  "description": {
    "value": ""
  }
}
RonnyV
CONTRIBUTOR ***

by RonnyV (Updated ‎24-05-2022 10:07 by RonnyV )

I tried that now, and I get the same error as before.

However, if I also modify the quantity directly on the issueLine and set it to 0 it works.

I.e. when the quantity of each allocation is positive and the quantity of the issueLine is 0 it works.

And when the quantity of each allocation is positive and the quantity of the issueLine is the sum om the allocations quantity it does not work.

 

Is that expected?

 

Edit: Spelling

by Magnus Johnsen

HI,

Yes that is what we noticed as well, you'll see it in the Json I posted.

We will still need to check with the development team if this is the intended behavior.

RonnyV
CONTRIBUTOR ***

by RonnyV

Okay, as long as it creates an inventory issue with the changes we wanted I guess it works for us 🙂