Résumé
Manipulation de l'entité MeasureCounter (Mesure de compteur) en lecture/écriture/suppression via un objet métier depuis une application externe.
Tables
Les tables utilisées sont :
sw_data_measure : Table des mesures
Critères d'activation
WHK_MeasureCounter est défini dans la gestion des webhooks du studio.
Fonctionnement
verb: GET
resultType: simple
Bloc de code | ||
---|---|---|
| ||
"measurecounter":{
"codemeasurecounter": "6690000002407",
"measuretype_ID": "BOILER-VOLT",
"value": "15",
"measureDate": "2022-10-12 14:48:00",
"counter_ID": "2340004-CPT2",
"equipment_ID": "BOILER1"
} |
verb: GET
resultType: extended
Bloc de code | ||
---|---|---|
| ||
"measurecounter":{
"codemeasurecounter": "6690000002407",
"measuretype_ID": "BOILER-VOLT",
"value": "15",
"measureDate": "2022-10-12 14:48:00",
"counter_ID": "2340004-CPT2",
"equipment_ID": "BOILER1",
"interventionequipment_ID": "",
"comment": "",
"baseuser_ID": "25",
"generictype_ID_measureOrigin": "EXTERNAL",
"intervention_ID": ""
} |
verb: GET
resultType: extendedRelated
en complément du résultat pour resultType: extended on aura le détail pour les tables baseuser, generictype_measureOrigin, interventionequipment
Bloc de code | ||
---|---|---|
| ||
"related":[
{
"baseuser":{
"codebaseuser": "25",
"lastName": "MOREL",
"firstName": "Vincent",
"initials": "MV",
...
},
"generictype_measureOrigin": {
"codegenerictype": "EQUIPMENT_MEASURE_ORIGIN-EXTERNAL",
"label": "Externe",
"originalCode": "EXTERNAL",
"dataType": "EQUIPMENT_MEASURE_ORIGIN",
"description": "mesure réalisée en dehors de Weavy (Ex : IoT)",
"translationKey": "BO_MeasureOrigin_External",
"generictype_ID_parent": "",
"tag": "",
"orderNumber": ""
},
"interventionequipment": {
"codeinterventionequipment": "",
"intervention_ID": "",
"equipment_ID": "",
"addedByUser": "",
"contract_ID": "",
"symptom_ID": ""
}
}] |
verb: PUT
Méthode 1 : on connait le code compteur de l'équipement
Bloc de code | ||
---|---|---|
| ||
{
"measurecounter":{
"codemeasurecounter": "MEASURE1", /* Code globalement unique de la mesure (Varchar (255))*/
"measureDate": "2022-10-12 14:48:00", /* Date de la mesure (DateTime ())*/
"value": "15", /* Valeur de la mesure (Varchar (64))*/
"baseuser_ID": "25", /* Code collaborateur qui a fait la saisie (ForeignKey () - sw_data_baseuser.codebaseuser)*/
"counter_ID": "2340004-CPT2", /* Code compteur (ForeignKey () - sw_data_counter.codecounter)*/
"comment": "" /* Observation (Text (65535))*/
}
} |
Méthode 2 : on connait le code équipement et le code type de mesure
Bloc de code | ||
---|---|---|
| ||
{
"measurecounter":{
"codemeasurecounter": "MEASURE1", /* Code globalement unique de la mesure (Varchar (255))*/
"measureDate": "2022-10-12 14:48:00", /* Date de la mesure (DateTime ())*/
"value": "15", /* Valeur de la mesure (Varchar (64))*/
"baseuser_ID": "25", /* Code collaborateur qui a fait la saisie (ForeignKey () - sw_data_baseuser.codebaseuser)*/
"equipment_ID": "BOILER1", /* Code équipement (ForeignKey () - sw_data_equipment.codeequipment)*/
"measuretype_ID": "BOILER-VOLT", /* Code type de mesure (ForeignKey () - sw_data_measuretype.codemeasuretype)*/
"comment": "" /* Observation (Text (65535))*/
}
} |
Méthode 3 : on connait le code équipement et le code compteur externe
Bloc de code | ||
---|---|---|
| ||
{
"measurecounter":{
"codemeasurecounter": "MEASURE1", /* Code globalement unique de la mesure (Varchar (255))*/
"measureDate": "2022-10-12 14:48:00", /* Date de la mesure (DateTime ())*/
"value": "15", /* Valeur de la mesure (Varchar (64))*/
"baseuser_ID": "25", /* Code collaborateur qui a fait la saisie (ForeignKey () - sw_data_baseuser.codebaseuser)*/
"equipment_ID": "BOILER1", /* Code équipement (ForeignKey () - sw_data_equipment.codeequipment)*/
"externalCodeCounter": "VOLT", /* Code compteur externe (Varchar (255))*/
"comment": "" /* Observation (Text (65535))*/
}
} |
verb: LIST
resultType: simple, extended reprendre les définitions du GET
Bloc de code |
---|
"filters:" {
"codeMeasureCounter": "value", filter is equal
"measureDate": "value", filter is greater or equal to
"measureDateBetween": "value1|value2", filter is between value1 and value2
"codeEquipment": "value", filter is equal
"codeMeasureType": "value", filter is equal
"codeCounter": "value", filter is equal
"externalCodeCounter": "value" filter is equal
},
"orderBy": "value" |
Valeurs possibles pour le tri "orderBy" :
measureDateAsc : par date de mesure ascendant
measureDateDesc : par date de mesure descendant