GoodsIn - Examples

Received values

Simple product

During review of the received goods, the user will set the received values. This will not only update the received_… fields but also add entries to the received_values_change_log.

The following JSON shows an example for a GoodsInItem for a basic product (no custom unit, lots, conditions, unique item identifiers) where the received values have been set exactly once:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 10,
  "received_values_change_log": [
    {
      "id": "635f9ce3d3fef5e94a928e2f",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 10,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 0,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:15:22Z"
    }
  ]
}

Product with condition and lot

If the product uses conditions or lots, the user must also confirm/set the received_condition_id and received_lot_id fields during review of the received goods. Setting those values will cause additional entries to show up in the received_values_change_log.

The following JSON shows an example for a GoodsInItem for a product using conditions and lots where the user first confirmed condition & lot and then the received quantity:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 10,
  "received_values_change_log": [
    // Setting received condition
    {
      "id": "635f9e9a3012cc3fb567d0c0",
      "type": "SET_RECEIVED_CONDITION",
      "details": {
        "@type": "SetReceivedConditionChangeDetail",
        "new_received_condition_id": "635f9e6a6e681b0aa44de228"
      },
      "timestamp": "2019-08-24T14:12:32Z"
    },

    // Setting received lot
    {
      "id": "635f9ea157e6f172f9896b7d",
      "type": "SET_RECEIVED_LOT",
      "details": {
        "@type": "SetReceivedLotChangeDetail",
        "new_received_lot_id": "635f9e91054ea41382105f72"
      },
      "timestamp": "2019-08-24T14:13:56Z"
    },

    // Setting received quantity
    {
      "id": "635f9ea8976541f10f843631",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 10,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 0,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:15:22Z"
    }
  ]
}

Multiple records and under/overdelivery

Sometimes the user needs to modify received values after having set the initially. For example, the user might record a received quantity less than the expected one but later discover more units of the product in the received goods.

In such cases, multiple SET_RECEIVED_… entries for the same information (number of units, condition, lot) will be present in the log.

The following JSON shows an example for a GoodsInItem where the user first recorded an underdelivery of two units but later adjusted the recieved number of units to an overdelivery of one unit:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 11,
  "received_values_change_log": [
    // Initial "set received number of units" - underdelivery
    {
      "id": "635f9ce3d3fef5e94a928e2e",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 8,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 8,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": -2,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:15:22Z"
    },

    // Second "set received number of units" - overdelivery
    {
      "id": "635fa1e7836870497c5f12bd",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 11,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 3,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 1,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:15:22Z"
    }
  ]
}

Setting and clearing

In case the received values have been set by mistake, they must be cleared. For condition and lot, this is done by simply recording a SET_RECEIVED_CONDITION/SET_RECEIVED_LOT entry with no condition/lot identifier. For the received number of units though, a dedicated CLEAR_RECEIVED_NUMBER_OF_UNITS entry type exists.

The reason for the dedicated entry type is that there is a difference in having received_number_of_units == 0 and received_number_of_units == null. The former indicates that the review of the GoodsInItem has been performed and that no units have been delivered for the item. The latter indicates that the review for the item has not yet been done.

The following JSON shows an example for a GoodsInItem where the user first sets the received values (condition, lot, number of units) and then later clears them again:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": null,
  "received_values_change_log": [
    // Setting received condition
    {
      "id": "635f9e9a3012cc3fb567d0c0",
      "type": "SET_RECEIVED_CONDITION",
      "details": {
        "@type": "SetReceivedConditionChangeDetail",
        "new_received_condition_id": "635f9e6a6e681b0aa44de228"
      },
      "timestamp": "2019-08-24T14:12:32Z"
    },

    // Setting received lot
    {
      "id": "635f9ea157e6f172f9896b7d",
      "type": "SET_RECEIVED_LOT",
      "details": {
        "@type": "SetReceivedLotChangeDetail",
        "new_received_lot_id": "635f9e91054ea41382105f72"
      },
      "timestamp": "2019-08-24T14:13:56Z"
    },

    // Setting received quantity
    {
      "id": "635f9ea8976541f10f843631",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 10,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 0,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:15:22Z"
    },

    // Clearing received condition
    {
      "id": "635fa5843b20830e34b025b5",
      "type": "SET_RECEIVED_CONDITION",
      "details": {
        "@type": "SetReceivedConditionChangeDetail",
        "new_received_condition_id": null
      },
      "timestamp": "2019-08-24T15:20:33Z"
    },

    // Clearing received lot
    {
      "id": "635fa58cf1c5f1e6d254d254",
      "type": "SET_RECEIVED_LOT",
      "details": {
        "@type": "SetReceivedLotChangeDetail",
        "new_received_lot_id": null
      },
      "timestamp": "2019-08-24T15:20:33Z"
    },

    // Clearing received quantity
    {
      "id": "635fa59101e4eba19042d2c3",
      "type": "CLEAR_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "ClearReceivedNumberOfUnitsChangeDetail",
        "delta_to_previous_quantity": {
          "number_of_delta_units": -10,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": -10,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T15:20:33Z"
    }
  ]
}

Delta computation edge cases

Note that there are a number of edge cases in the context of the delta computations. Notably computing deltas against non-existing values and computing deltas for goods-in items whose unit or expected number of units are changed.

Deltas against non-existing values

Deltas against non-existing values are needed for four cases:

  • for goods-in items that do not have an expected_number_of_units set
  • for all "received values change log"-entry with a ClearReceivedNumberOfUnitsChangeDetail
  • for all "received values change log"-entry with a SetReceivedNumberOfUnitsChangeDetail that
    • are the first such entry in their change log
    • are the first such entry following an entry with a ClearReceivedNumberOfUnitsChangeDetail

Often, only a single value is missing. For example for the "delta to previous quantity" for the first SetReceivedNumberOfUnitsChangeDetail entry in the log. But there are cases where both values are missing. For example for the "delta to expected quantity" for a ClearReceivedNumberOfUnitsChangeDetail entry.

The missing values for such delta computations are substituted by generating a quantity with the numeric value of zero and the unit/custom unit taken from the other value (if it exists) or the goods-in item (for deltas where both values are missing).

For example, conider the following goods-in item:

D1P (marked in blue) is a "delta to previous quantity" where there is no "old received quantity" as the delta belongs to the first SetReceivedNumberOfUnitsChangeDetail in the log. The value 0x 1pc is substituted by taking the 1pc unit from the "new received quantity" (from the log entry the delta belongs to) and using zero as number of units.

D2P (marked in khaki/yellow) is a "delta to previous quantity" where there is no "new received quantity" as it belongs to a ClearReceivedNumberOfUnitsChangeDetail entry. The value 0x 1pc is substituted by taking the 1pc unit from the "previous received quantity" (from the preceeding log entry) and using zero as number of units.

D3P (marked in green) is a "delta to previous quantity" where there is no "old received quantity" as the delta belongs to the first SetReceivedNumberOfUnitsChangeDetail log entry after a ClearReceivedNumberOfUnitsChangeDetail entry. The value 0x 1pc is substituted by taking the 1pc unit from the "new received quantity" (from the log entry the delta belongs to) and using zero as number of units.

D1E and D3E (marked in tan/brown) are "deltas to expected quantity" where there is no "expected quantity" as the goods-in item does not have an expected number of units. The value 0x 1pc is substituted by taking the 1pcs unit from the "current received quantity" (from the log entries the deltas belong to) and using zero as number of units.

D2E (marked in gold) is a "delta to expected quantity" where both the "expected quantity" and the "current received quantity" are missing. The value 0x 1pc is substituted for both by taking the 1pcs unit form the goods-in item and using zero as number of units.

Deltas when changing the item's unit or expected number of units

Deltas for goods-in items whose unit or expected number of units is changed require special attention as they a) are often deltas between two values that use different units and b) are adjusted based on the changed unit.

Deltas between values using different units (e.g., a delta between 2kg (received qty) and 5000g (expected qty)) are computed by first converting both values into the product's "tracking unit" (e.g., 2kg to 5000g = 2000000mg to 5000000mg = -3000000mg, assuming mg as tracking unit).

As deltas

For example consider the following goods-in item and assume the product uses mg as tracking unit:

Note how a change in the item's expected number of units causes the "deltas to expected" to update:

A change to the goods-in item's unit causes most deltas to be adjusted to the changed unit too:

Note how the "deltas to the expected quantity" switched to the resource's tracking unit in case the "current received quantity" exists and uses a different unit (D1E and D3E) or to the item's unit in case no "curret received quantity" exists (D2E).

New entries in the log file will use the item's new unit, so their "delta to expected" will use that one too. The "delta to previous" will usually fall back to the tracking unit as the "old received quantity" uses the old unit:

Resolutions

Basic Collect

The most commonly used type of resolution is Collect. A Collect indicates that the delivered goods have been taken over moved into the recipients storage system.

The following JSON shows an example for a GoodsInItem where the full received quantity has been collected:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 10,
  "resolved_number_of_units": 10,
  "resolutions": [
    {
      "id": "635fab5a1247c8cd74c0c48a",
      "affected_stock": {
        "number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:15:22Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T16:32:56Z"
        }
      ]
    }
  ]
}

Note that the example omits the received_values_change_log for brevity.

Discard before Collect

Another common case is that some of the delivery goods is damaged/broken and thus cannot be collected.

If this is detected before recording the Collect, simply recording a Discard resolution for the broken units and then a Collect for the remaining units is possible.

The following JSON shows an example for a GoodsInItem where the two units are resolved as Discard and then the remaining eight units are collected:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 10,
  "resolved_number_of_units": 10,
  "resolutions": [
    {
      "id": "635fab5a1247c8cd74c0c48a",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:15:22Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:23:33Z"
        }
      ]
    },
    {
      "id": "635faddf6c08f1086698fdd0",
      "affected_stock": {
        "number_of_units": 8,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T16:25:43Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T16:32:56Z"
        }
      ]
    }
  ]
}

Collect, then adjust and Discard

Sometimes, mistakes are made or stock that was seen as "good" and thus has been collected is later found to be "not good".

Any case that requires changing the outcome of an already booked resolution requires an "adjustment" of the resolution.

The following JSON shows an example for a GoodsInItem where all ten units were Collected but later two units were found to be defective/broken and needed to be Discarded:

{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 10,
  "resolved_number_of_units": 10,
  "resolutions": [
    {
      "id": "635fb36b8db8aa3a2625aca1",
      "affected_stock": {
        "number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:29:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:30:00Z"
        }
      ],
      "adjustments": [
        {
          "id": "635fec1267743cd6f905a40d",
          "type": "DECREASE",
          "affected_stock": {
            "number_of_units": 2,
            "unit": {
              "value": 1,
              "unit": "QUANTITY_PIECES"
            }
          },
          "due_to": {
            "item_id": "635f9c9f5fc3a61ae8df7861",
            "resolution_id": "635fb3772ab68c151f3ce1a1"
          },
          "status": "BOOKED",
          "status_log": [
            {
              "status": "PLANNED",
              "timestamp": "2019-08-24T15:00:00Z"
            },
            {
              "status": "BOOKED",
              "timestamp": "2019-08-24T15:00:10Z"
            }
          ]
        }
      ]
    },
    {
      "id": "635fb3772ab68c151f3ce1a1",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T15:00:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T15:00:10Z"
        }
      ]
    }
  ]
}

Full use cases

Case 1 - overdelivery, discard, overdelivery, collect

The following JSON payload shows a GoodsInItem with an expected quantity of 2 KOL (where one KOL consists of 6 pcs) after the following operations have been performed by the user:

  1. Setting received quantity to 3 KOL
  2. Booking a Discard of 2 KOL due to damaged goods
  3. Booking another Discard of 1 KOL due to damaged goods
  4. Updating the received quantity to 5 KOL
  5. Booking a Collect of 2 KOL
{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 6,
    "unit": "QUANTITY_PIECES"
  },
  "custom_unit_id": "635fb71a67743cd6f905a124",
  "expected_number_of_units": 2,
  "received_number_of_units": 5,
  "resolved_number_of_units": 5,
  "received_values_change_log": [
    // 1 - Setting received quantity to `3 KOL`
    {
      "id": "635fb73267743cd6f905a131",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 3,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124",
        "delta_to_previous_quantity": {
          "number_of_delta_units": 3,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 1,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        }
      },
      "timestamp": "2019-08-24T14:10:00Z"
    },

    // 4 - Updating the received quantity to `5 KOL`
    {
      "id": "635fb73267743cd6f905a134",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 5,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124",
        "delta_to_previous_quantity": {
          "number_of_delta_units": 2,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 3,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        }
      },
      "timestamp": "2019-08-24T14:40:00Z"
    }
  ],
  "resolutions": [
    // 2 - Booking a `Discard` of `2 KOL` due to damaged goods
    {
      "id": "635fb73267743cd6f905a132",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:20:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:20:00Z"
        }
      ]
    },
    
    // 3 - Booking another `Discard` of `1 KOL` due to damaged goods
    {
      "id": "635fb73267743cd6f905a133",
      "affected_stock": {
        "number_of_units": 1,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:30:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:30:00Z"
        }
      ]
    },

    // 5 - Booking a `Collect` of `2 KOL`
    {
      "id": "635fb73267743cd6f905a135",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:50:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:50:00Z"
        }
      ]
    }
  ]
}

Case 2 - overdelivery, collect, discard, overdelivery, collect

This use case is similar to use case 1, except that the initially recorded recevied quantity of 3 KOL is immediately collected. The later Discard resolutions then can only be performed after adjusting the initial Collect.

The following operations are performed by the user:

  1. Setting received quantity to 3 KOL
  2. Booking a Collect of 3 KOL
  3. Booking a Discard of 2 KOL together with a -2 KOL adjustment of the Collect
  4. Booking another Discard of 1 KOL together with a -1 KOL adjustment of the Collect
  5. Updating the received quantity to 5 KOL
  6. Booking a Collect of 2 KOL
{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 6,
    "unit": "QUANTITY_PIECES"
  },
  "custom_unit_id": "635fb71a67743cd6f905a124",
  "expected_number_of_units": 2,
  "received_number_of_units": 5,
  "resolved_number_of_units": 5,
  "received_values_change_log": [
    // 1 - Setting received quantity to `3 KOL`
    {
      "id": "635fb73267743cd6f905a131",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 3,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124",
        "delta_to_previous_quantity": {
          "number_of_delta_units": 3,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 1,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        }
      },
      "timestamp": "2019-08-24T14:10:00Z"
    },

    // 5 - Updating the received quantity to `5 KOL`
    {
      "id": "635fb73267743cd6f905a135",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 5,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124",
        "delta_to_previous_quantity": {
          "number_of_delta_units": 2,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 3,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        }
      },
      "timestamp": "2019-08-24T14:50:00Z"
    }
  ],
  "resolutions": [
    // 2 - Booking a `Collect` of `3 KOL`
    {
      "id": "635fb73267743cd6f905a132",
      "affected_stock": {
        "number_of_units": 3,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:20:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:20:00Z"
        }
      ],
      "adjustments": [
        // 3b - `-2 KOL` adjustment of the `Collect` due to `Discard` of `2 KOL`
        {
          "id": "635fb73267743cd6f905a133b",
          "type": "DECREASE",
          "affected_stock": {
            "number_of_units": 2,
            "unit": {
              "value": 6,
              "unit": "QUANTITY_PIECES"
            },
            "custom_unit_id": "635fb71a67743cd6f905a124"
          },
          "due_to": {
            "item_id": "635f9c9f5fc3a61ae8df7861",
            "resolution_id": "635fb73267743cd6f905a133"
          },
          "status": "BOOKED",
          "status_log": [
            {
              "status": "PLANNED",
              "timestamp": "2019-08-24T14:30:00Z"
            },
            {
              "status": "BOOKED",
              "timestamp": "2019-08-24T14:30:00Z"
            }
          ]
        },

        // 4b - `-1 KOL` adjustment of the `Collect` due to `Discard` of `1 KOL`
        {
          "id": "635fb73267743cd6f905a134b",
          "type": "DECREASE",
          "affected_stock": {
            "number_of_units": 1,
            "unit": {
              "value": 6,
              "unit": "QUANTITY_PIECES"
            },
            "custom_unit_id": "635fb71a67743cd6f905a124"
          },
          "due_to": {
            "item_id": "635f9c9f5fc3a61ae8df7861",
            "resolution_id": "635fb73267743cd6f905a134"
          },
          "status": "BOOKED",
          "status_log": [
            {
              "status": "PLANNED",
              "timestamp": "2019-08-24T14:40:00Z"
            },
            {
              "status": "BOOKED",
              "timestamp": "2019-08-24T14:40:00Z"
            }
          ]
        }
      ]
    },

    // 3a - Booking a `Discard` of `2 KOL`
    {
      "id": "635fb73267743cd6f905a133",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:30:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:30:00Z"
        }
      ]
    },
    
    // 4a - Booking another `Discard` of `1 KOL`
    {
      "id": "635fb73267743cd6f905a134",
      "affected_stock": {
        "number_of_units": 1,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:40:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:40:00Z"
        }
      ]
    },

    // 6 - Booking a `Collect` of `2 KOL`
    {
      "id": "635fb73267743cd6f905a136",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T15:00:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T15:00:00Z"
        }
      ]
    }
  ]
}

Case 3 - overdelivery, discard, revert discard, discard, underdelivery

The following JSON payload shows a GoodsInItem with an expected quantity of 2 KOL (where one KOL consists of 6 pcs) after the following operations have been performed by the user:

  1. Setting received quantity to 3 KOL
  2. Booking a Discard of 2 KOL due to damaged goods
  3. Reverting the Discard (that is, adjust it to effectively zero units)
  4. Booking another Discard of 1 KOL due to damaged goods
  5. Updating the received quantity to 1 KOL
{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 6,
    "unit": "QUANTITY_PIECES"
  },
  "custom_unit_id": "635fb71a67743cd6f905a124",
  "expected_number_of_units": 2,
  "received_number_of_units": 1,
  "resolved_number_of_units": 1,
  "received_values_change_log": [
    // 1 - Setting received quantity to `3 KOL`
    {
      "id": "635fb73267743cd6f905a131",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 3,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124",
        "delta_to_previous_quantity": {
          "number_of_delta_units": 3,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 1,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        }
      },
      "timestamp": "2019-08-24T14:10:00Z"
    },

    // 5 - Updating the received quantity to `1 KOL`
    {
      "id": "635fb73267743cd6f905a135",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 1,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124",
        "delta_to_previous_quantity": {
          "number_of_delta_units": -2,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": -1,
          "delta_unit": {
            "value": 6,
            "unit": "QUANTITY_PIECES"
          },
          "custom_unit_id": "635fb71a67743cd6f905a124"
        }
      },
      "timestamp": "2019-08-24T14:50:00Z"
    }
  ],
  "resolutions": [
    // 2 - Booking a `Discard` of `2 KOL` due to damaged goods
    {
      "id": "635fb73267743cd6f905a132",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:20:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:20:00Z"
        }
      ],
      "adjustments": [
        // 3 - Reverting the `Discard`
        {
          "id": "635fb73267743cd6f905a133",
          "type": "DECREASE",
          "affected_stock": {
            "number_of_units": 2,
            "unit": {
              "value": 6,
              "unit": "QUANTITY_PIECES"
            },
            "custom_unit_id": "635fb71a67743cd6f905a124"
          },
          "reason": {
              "@type": "PlatformDefinedGoodsInResolutionAdjustmentReason",
              "name": "HUMAN_ERROR"
          },
          "status": "BOOKED",
          "status_log": [
            {
              "status": "PLANNED",
              "timestamp": "2019-08-24T14:30:00Z"
            },
            {
              "status": "BOOKED",
              "timestamp": "2019-08-24T14:30:00Z"
            }
          ]
        }
      ]
    },

    // 4 - Booking another `Discard` of `1 KOL` due to damaged goods
    {
      "id": "635fb73267743cd6f905a134",
      "affected_stock": {
        "number_of_units": 1,
        "unit": {
          "value": 6,
          "unit": "QUANTITY_PIECES"
        },
        "custom_unit_id": "635fb71a67743cd6f905a124"
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "STATE_OF_GOODS"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:40:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:40:00Z"
        }
      ]
    }
  ]
}

Case 4 - regular delivery, collect, reset to planned, overdelivery, collect + discard

The following JSON payloads shows a GoodsInItem with an expected quantity of 10 pcs after the following operations have been performed by the user:

  1. Set received quantity to 10 pcs
  2. Book a Collect of all 10 pcs
  3. Reset of the goods-in to PLANNED
  4. Set received quantity to 12 pcs
  5. Book a Collect for 10 pcs
  6. Book a Discard for 2 pcs
{
  "id": "635f9c9f5fc3a61ae8df7861",
  "product_id": "635f9ca66496bb9e6bb94f44",
  "unit": {
    "value": 1,
    "unit": "QUANTITY_PIECES"
  },
  "expected_number_of_units": 10,
  "received_number_of_units": 12,
  "resolved_number_of_units": 12,
  "received_values_change_log": [
    // 1 - Setting received quantity to `10 pcs`
    {
      "id": "644a8908cd019709e4a27953",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 10,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 0,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:10:00Z"
    }

    // 3 - Reset goods-in to PLANNED
    {
      "id": "644a8e708fdb955f3cc69cb5",
      "type": "RESET_TO_PLANNED",
      "details": {
        "@type": "ResetToPlannedChangeDetail",
      },
      "timestamp": "2019-08-24T14:30:00Z"
    }

    // 4 - Setting received quantity to `12 pcs`
    {
      "id": "644a8e7c9f304ffb76e102ae",
      "type": "SET_RECEIVED_NUMBER_OF_UNITS",
      "details": {
        "@type": "SetReceivedNumberOfUnitsChangeDetail",
        "new_received_number_of_units": 12,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        },
        "delta_to_previous_quantity": {
          "number_of_delta_units": 12,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        },
        "delta_to_expected_quantity": {
          "number_of_delta_units": 2,
          "delta_unit": {
            "value": 1,
            "unit": "QUANTITY_PIECES"
          }
        }
      },
      "timestamp": "2019-08-24T14:40:00Z"
    }
  ],
  "resolutions": [
    // 2 - Booking a `Collect` of `10 pcs`
    {
      "id": "644a89bddfe12d88c0433adc",
      "affected_stock": {
        "number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "ANNULLED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:20:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:20:00Z"
        },
        {
          // 3 - Reset goods-in to PLANNED causes annullment of previously booked resolutions
          "status": "ANNULLED",
          "timestamp": "2019-08-24T14:30:00Z"
        }
      ],
      "adjustments": [
        // 3 - Reset goods-in to PLANNED causes annullment of previously booked resolutions
        {
          "id": "644a8aa84669fd2b1186e9ad",
          "type": "DECREASE",
          "affected_stock": {
            "number_of_units": 10,
            "unit": {
              "value": 1,
              "unit": "QUANTITY_PIECES"
            }
          },
          "status": "BOOKED",
          "status_log": [
            {
              "status": "PLANNED",
              "timestamp": "2019-08-24T14:30:00Z"
            },
            {
              "status": "BOOKED",
              "timestamp": "2019-08-24T14:30:00Z"
            }
          ]
        }
      ]
    }
    
    // 5 - Booking a `Collect` of `10 pcs`
    {
      "id": "644a899c889e61f23f436c8b",
      "affected_stock": {
        "number_of_units": 10,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "details": {
        "@type": "GoodsInItemCollectResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T14:50:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T14:50:00Z"
        }
      ]
    }

    // 6 - Booking a `Discard` of `2 pcs`
    {
      "id": "644a89d991790cf2ea45b29a",
      "affected_stock": {
        "number_of_units": 2,
        "unit": {
          "value": 1,
          "unit": "QUANTITY_PIECES"
        }
      },
      "reason": {
        "@type": "PlatformDefinedGoodsInExceptionalResolutionReason",
        "name": "NOT_ORDERED"
      },
      "details": {
        "@type": "GoodsInItemDiscardResolutionDetails"
      },
      "status": "BOOKED",
      "status_log": [
        {
          "status": "PLANNED",
          "timestamp": "2019-08-24T15:00:00Z"
        },
        {
          "status": "BOOKED",
          "timestamp": "2019-08-24T15:00:00Z"
        }
      ]
    },
  ]
}