Acheminement direct du producteur au crématorium
graph LR
AO(NO STATE) -->|createBspaoh| A(INITIAL)
A -->|"signBspaoh (EMISSION)"| B(SIGNED_BY_PRODUCER)
B -->|updateBspaoh| B
B -->|"signBspaoh (TRANSPORT)"| C(SENT)
C -->|updateBspaoh| C
C -->|"signBspaoh (RECEPTION)"| D(RECEIVED)
D -->|updateBspaoh| D
D -->|"signBspaoh (OPERATION)"| PROCESSED
Les informations du BSPAOH (émetteur, transporteur, crématorium, déchets) sont remplies.
mutation CreateDraftBspaoh($input: BspaohInput!) {
  createDraftBspaoh(input: $input) {
    id
    status
    isDraft
  }
}
{
  "input": {
    "waste": {
      "type": "PAOH",
      "code": "18 01 02",
      "adr": "code adr",
      "packagings": [
        {
          "type": "BIG_BOX",
          "volume": 11,
          "quantity": 1,
          "containerNumber": "x-1",
          "consistence": "SOLIDE",
          "identificationCodes": [
            "ba-1, ba-2"
          ]
        },
        {
          "type": "LITTLE_BOX",
          "volume": 11,
          "quantity": 1,
          "containerNumber": "x-2",
          "consistence": "LIQUIDE",
          "identificationCodes": [
            "ca-1"
          ]
        }
      ]
    },
    "emitter": {
      "company": {
        "siret": "SIRET_PRODUCTEUR",
        "name": "Hopital Saint Denis",
        "address": "40 rue du médecin, 93200 Saint Denis",
        "mail": "contact@hsd.fr",
        "contact": "Docteur Brun",
        "phone": "06 06 06 06 06"
      },
      "emission": {
        "detail": {
          "weight": {
            "value": 1,
            "isEstimate": false
          }
        }
      }
    },
    "destination": {
      "company": {
        "siret": "SIRET_CREMATORIUM",
        "name": "Traiteur Inc",
        "address": "14 rue des acacias, 68100 Mulhouse",
        "mail": "contact@traiteur.co",
        "contact": "Bob Lapointe",
        "phone": "07 01 00 00 00"
      },
      "cap": "numerodecap"
    },
    "transporter": {
      "company": {
        "siret": "SIRET_TRANSPORTEUR",
        "name": "Transport Inc",
        "address": "6 rue des 7 chemins, 07100 ANNONAY",
        "mail": "contact@transport.co",
        "phone": "07 00 00 00 00",
        "contact": "John Antoine"
      }
    }
  }
}
L'émetteur publie le PAOH
mutation PublishBspaoh($id: ID!) {
  publishBspaoh(id: $id) {
    id
    status
    isDraft
  }
}
{
  "id": "ID_BSD"
}
L'émetteur signe le PAOH
mutation SignBspaoh($id: ID!, $input: BspaohSignatureInput!) {
  signBspaoh(id: $id, input: $input) {
    id
    status
  }
}
{
  "id": "ID_BSD",
  "input": {
    "type": "EMISSION",
    "author": "Marcel Producteur"
  }
}
Les informations de transport sont complétées
mutation UpdateBspaoh($id: ID!, $input: BspaohInput!) {
  updateBspaoh(id: $id, input: $input) {
    id
    status
    transporter {
      transport {
        takenOverAt
      }
    }
  }
}
{
  "id": "ID_BSD",
  "input": {
    "transporter": {
      "transport": {
        "mode": "ROAD",
        "plates": [
          "XX-000-XX"
        ],
        "takenOverAt": "2020-12-03T15:43:00"
      }
    }
  }
}
Le transporteur signe le PAOH
mutation SignBspaoh($id: ID!, $input: BspaohSignatureInput!) {
  signBspaoh(id: $id, input: $input) {
    id
    status
  }
}
{
  "id": "ID_BSD",
  "input": {
    "type": "TRANSPORT",
    "author": "Jason Statham"
  }
}
Les informations de réception sont complétées
mutation UpdateBspaoh($id: ID!, $input: BspaohInput!) {
  updateBspaoh(id: $id, input: $input) {
    id
    status
    transporter {
      transport {
        takenOverAt
      }
    }
  }
}
{
  "id": "ID_BSD",
  "input": {
    "destination": {
      "reception": {
        "date": "2020-12-03T15:44:00",
        "detail": {
          "receivedWeight": {
            "value": 22
          }
        },
        "acceptation": {
          "status": "ACCEPTED",
          "packagings": [
            {
              "acceptation": "ACCEPTED",
              "id": "packaging_0"
            },
            {
              "acceptation": "ACCEPTED",
              "id": "packaging_1"
            }
          ]
        }
      }
    }
  }
}
Le crématorium signe les informations de réception
mutation SignBspaoh($id: ID!, $input: BspaohSignatureInput!) {
  signBspaoh(id: $id, input: $input) {
    id
    status
  }
}
{
  "id": "ID_BSD",
  "input": {
    "type": "RECEPTION",
    "author": "Bob"
  }
}
Les informations de l'opération sont complétées
mutation UpdateBspaoh($id: ID!, $input: BspaohInput!) {
  updateBspaoh(id: $id, input: $input) {
    id
    status
    transporter {
      transport {
        takenOverAt
      }
    }
  }
}
{
  "id": "ID_BSD",
  "input": {
    "destination": {
      "operation": {
        "code": "R 1",
        "date": "2022-12-03T15:44:00"
      }
    }
  }
}
Le traiteur signe les informations de l'opération
mutation SignBspaoh($id: ID!, $input: BspaohSignatureInput!) {
  signBspaoh(id: $id, input: $input) {
    id
    status
  }
}
{
  "id": "ID_BSD",
  "input": {
    "type": "OPERATION",
    "author": "John"
  }
}