Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accountingQuantity and onhandQuantity are null on raise economicEvent #22

Open
sbocconi opened this issue Jan 7, 2022 · 2 comments
Open

Comments

@sbocconi
Copy link

sbocconi commented Jan 7, 2022

mutation($event:EconomicEventCreateParams!, $newInventoriedResource:EconomicResourceCreateParams) {
                createEconomicEvent(event:$event, newInventoriedResource:$newInventoriedResource) {
                    economicEvent {
                        id
                        provider {
                            id
                            name
                            note
                        }
                        resourceQuantity {
                            hasNumericalValue
                            hasUnit {
                                label
                                symbol
                            }
                        }
                        toResourceInventoriedAs {
                            id
                            name
                          	onhandQuantity {
                                hasNumericalValue
                                hasUnit {
                                    label
                                    symbol
                                }
                            }
                            accountingQuantity {
                                hasNumericalValue
                                hasUnit {
                                    label
                                    symbol
                                }
                            }
                        }
                    }
            }
}

with variables;

{
        "event": {
            "note": "update event",
            "action": "raise",
            "provider": "01FP094V38QGMK08N6VEM8HREN", 
            "receiver": "01FP094V38QGMK08N6VEM8HREN", 
            "resourceInventoriedAs": "http://cleanlease.nl/zs/6663",
            "resourceQuantity": {
              "hasUnit": "01FRTRG75V5WDG8GQ8A81MJ8D5", 
              "hasNumericalValue": 1 
            }
        },
        "newInventoriedResource": { 
            "name": "Gown"
        }
    }

I get the following output:

{
  "data": {
    "createEconomicEvent": {
      "economicEvent": {
        "id": "01FRTSNWDTCH7AKPYH2RPW6PQH",
        "provider": {
          "id": "01FP094V38QGMK08N6VEM8HREN",
          "name": "AGENT_OLVG",
          "note": "Simulation Agent"
        },
        "resourceQuantity": {
          "hasNumericalValue": 1,
          "hasUnit": {
            "label": "u_piece",
            "symbol": "om2:one"
          }
        },
        "toResourceInventoriedAs": {
          "accountingQuantity": null,
          "id": "01FRTSNWCSHJVPW5R026GTMXN1",
          "name": "Gown",
          "onhandQuantity": null
        }
      }
    }
  }
}

Is it normal that accountingQuantity and onhandQuantity are null?

@fosterlynn
Copy link

Is it normal that accountingQuantity and onhandQuantity are null?

No, at least accountingQuantity on a resource should be a quantity, even if it is zero something. But if I am following correctly, you are using raise with toResourceInventoriedAs? If so, the problem could be that raise (and most event actions) assume resourceInventoriedAs. Just a guess.

@sbocconi
Copy link
Author

Hi @fosterlynn, thank you for your reply.

I use toResourceInventoriedAs because resourceInventoriedAs returns null (or maybe I am using it wrongly).

This call

mutation($event:EconomicEventCreateParams!, $newInventoriedResource:EconomicResourceCreateParams) {
                createEconomicEvent(event:$event, newInventoriedResource:$newInventoriedResource) {
                    economicEvent {
                        id
                        provider {
                            id
                            name
                            note
                        }
                        resourceQuantity {
                            hasNumericalValue
                            hasUnit {
                                label
                                symbol
                            }
                        }
                        toResourceInventoriedAs {
                            id
                            name
                          	onhandQuantity {
                                hasNumericalValue
                                hasUnit {
                                    label
                                    symbol
                                }
                            }
                            accountingQuantity {
                                hasNumericalValue
                                hasUnit {
                                    label
                                    symbol
                                }
                            }
                        }
                        resourceInventoriedAs {
                            id
                            name
                            onhandQuantity {
                                hasNumericalValue
                                hasUnit {
                                    label
                                    symbol
                                }
                            }
                            accountingQuantity {
                                hasNumericalValue
                                hasUnit {
                                    label
                                    symbol
                                }
                            }
                        }
                    }
            }
}

with variables:

{
        "event": {
            "note": "update event",
            "action": "raise",
            "provider": "01FP094V38QGMK08N6VEM8HREN", 
            "receiver": "01FP094V38QGMK08N6VEM8HREN", 
            "resourceInventoriedAs": "http://cleanlease.nl/zs/6663",
            "resourceQuantity": {
              "hasUnit": "01FRTRG75V5WDG8GQ8A81MJ8D5", 
              "hasNumericalValue": 1 
            }
        },
        "newInventoriedResource": { 
            "name": "Gown"
        }
    }

returns the following:

{
  "data": {
    "createEconomicEvent": {
      "economicEvent": {
        "id": "01FS6SP3TCNC9VWXZJJTB3HV8E",
        "provider": {
          "id": "01FP094V38QGMK08N6VEM8HREN",
          "name": "AGENT_OLVG",
          "note": "Simulation Agent"
        },
        "resourceInventoriedAs": null,
        "resourceQuantity": {
          "hasNumericalValue": 1,
          "hasUnit": {
            "label": "u_piece",
            "symbol": "om2:one"
          }
        },
        "toResourceInventoriedAs": {
          "accountingQuantity": null,
          "id": "01FS6SP3SC1QFS3GK7GMG3Q9P5",
          "name": "Gown",
          "onhandQuantity": null
        }
      }
    }
  }
}

so resourceInventoriedAs is just null. I guess this is not the expected behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants