Grafana dashboard: Datamark.by
Description: Сбор метрик личного кабинета "Электронный знак"

Работает на Powershell 5 начиная с Win7SP1/Win8.1/Win2012.  

Команды:
* **Get-DatamarkBYOrders** - сбор метрик по заказам
* **Get-DatamarkBYShips** - сбор метрик по отгрузкам
* **Get-DatamarkBYMetrics** - сбор всех метрик  

Параметры:
* **username** - имя пользователя
* **password** - пароль
* **hash** - имя файла, содержащего зашифрованные имя пользователя и пароль
* **days_from** - начало даты запроса метрик в днях от текущей даты
* **days_to** - конец даты запроса метрик в днях от текущей даты
* **uri** - адрес API  

При перовом запуске команд с параметрами username и password будет создаваться два файла, имена которых являются хэши данных аутентификации и токена. Расположение файлов зависит от имени пользователя, под которым запускается служба сборщика метрик Telegraf (для пользователя "Локальная система" это каталог "Windows\System32"). Для того, чтобы не хранить данные аутентификации (логин и пароль) в конфигурационном файле сборщика метрик Telegraf, необходимо в качестве параметра hash указать имя файла (один из двух файлов с наименьшим размером).  

Telegraf config:
```
[global_tags]

[agent]
  interval = "10s"
  round_interval = true
  metric_buffer_limit = 5000
  flush_buffer_when_full = true
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  debug = false
  quiet = false
  logfile = "/Program Files/Telegraf/telegraf.log"
  hostname = ""

[[outputs.influxdb]]
  urls = ["http://docker:8086"] # required
  database = "telegraf" # required
  precision = "s"
  timeout = "5s"
  username = "username"
  password = "password"
  [outputs.influxdb.tagdrop]
    influxdb_tag = ["*"]
	
[[outputs.influxdb]]
  urls = ["http://docker:8086"]
  database = "datamarkby"
  precision = "s"
  timeout = "5s"
  username = "username"
  password = "password"
  [outputs.influxdb.tagpass]
    influxdb_tag = ["datamarkby"]

[[inputs.exec]]
  interval = "1h"
  commands = [
    "powershell Get-DatamarkBYOrders -hash 'hash'",
    "powershell Get-DatamarkBYShips -hash 'hash' -days_from 30"
  ]
  timeout = "5m"
  name_suffix = ""
  data_format = "influx"
  [inputs.exec.tags]
    influxdb_tag = "datamarkby"
```

{
  "__inputs": [
    {
      "name": "DS_DATAMARK.BY",
      "label": "datamark.by",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "VAR_CODE_COST",
      "type": "constant",
      "label": "Стоимость КМ",
      "value": "0.03",
      "description": ""
    },
    {
      "name": "VAR_CODES_PER_SHIP",
      "type": "constant",
      "label": "Кол-во кодов на отгрузку",
      "value": "7000",
      "description": ""
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.5.4"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "limit": 100,
        "name": "Annotations & Alerts",
        "showIn": 0,
        "type": "dashboard"
      }
    ]
  },
  "description": "Сбор метрик личного кабинета \"Электронный знак\"",
  "editable": true,
  "gnetId": 14316,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1619745912884,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": false,
      "keepTime": false,
      "tags": [],
      "targetBlank": true,
      "title": "Личный кабинет",
      "tooltip": "Личный кабинет системы маркировки товаров \"Электронный знак\"",
      "type": "link",
      "url": "https://i.datamark.by/auth"
    },
    {
      "asDropdown": false,
      "icon": "doc",
      "includeVars": false,
      "keepTime": false,
      "tags": [],
      "targetBlank": true,
      "title": "Документация API",
      "tooltip": "Документация API системы маркировки товаров \"Электронный знак\"",
      "type": "link",
      "url": "https://api-docs.datamark.by"
    }
  ],
  "panels": [
    {
      "datasource": "${DS_DATAMARK.BY}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "groupBy": [],
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT count(distinct(\"id\")) FROM \"datamarkby_orders\" WHERE (\"label_type\" =~ /^$label_type$/ AND \"gtin\" =~ /^$gtin_orders$/ AND \"status\" = $status_orders) AND $timeFilter",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "distinct"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=~",
              "value": "/^$label_type$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=",
              "value": "$status_orders"
            }
          ]
        }
      ],
      "title": "Количество заказов",
      "type": "stat"
    },
    {
      "datasource": "${DS_DATAMARK.BY}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "bars",
            "fillOpacity": 10,
            "gradientMode": "hue",
            "hideFrom": {
              "graph": false,
              "legend": false,
              "tooltip": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": true
          },
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Кодов по заказам"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.axisPlacement",
                "value": "left"
              },
              {
                "id": "unit",
                "value": "none"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Кодов по отгрузкам"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.axisPlacement",
                "value": "left"
              },
              {
                "id": "unit",
                "value": "none"
              }
            ]
          },
          {
            "matcher": {
              "id": "byFrameRefID",
              "options": "C"
            },
            "properties": [
              {
                "id": "custom.drawStyle",
                "value": "line"
              },
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "blue",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.fillOpacity",
                "value": 0
              },
              {
                "id": "custom.scaleDistribution",
                "value": {
                  "log": 2,
                  "type": "log"
                }
              },
              {
                "id": "custom.lineInterpolation",
                "value": "smooth"
              }
            ]
          },
          {
            "matcher": {
              "id": "byFrameRefID",
              "options": "D"
            },
            "properties": [
              {
                "id": "custom.drawStyle",
                "value": "line"
              },
              {
                "id": "custom.lineInterpolation",
                "value": "smooth"
              },
              {
                "id": "custom.fillOpacity",
                "value": 0
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "custom.scaleDistribution",
                "value": {
                  "log": 2,
                  "type": "log"
                }
              },
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "green",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byFrameRefID",
              "options": "E"
            },
            "properties": [
              {
                "id": "custom.drawStyle",
                "value": "line"
              },
              {
                "id": "custom.lineInterpolation",
                "value": "smooth"
              },
              {
                "id": "custom.fillOpacity",
                "value": 0
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "custom.scaleDistribution",
                "value": {
                  "log": 2,
                  "type": "log"
                }
              },
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Свободные СН"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "purple",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.drawStyle",
                "value": "points"
              },
              {
                "id": "custom.pointSize",
                "value": 10
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 16,
        "w": 13,
        "x": 4,
        "y": 0
      },
      "id": 5,
      "options": {
        "graph": {},
        "legend": {
          "calcs": [
            "min",
            "max",
            "mean",
            "sum",
            "last"
          ],
          "displayMode": "table",
          "placement": "bottom"
        },
        "tooltipOptions": {
          "mode": "multi"
        }
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "alias": "Кодов по заказам",
          "groupBy": [
            {
              "params": [
                "$timeinterval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") FROM \"datamarkby_orders\" WHERE (\"gtin\" =~ /^$gtin_orders$/ AND \"label_type\" =~ /^$label_type$/ AND \"status\" = $status_orders) AND $timeFilter GROUP BY time($timeinterval) fill(none)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            },
            {
              "condition": "AND",
              "key": "label_type",
              "operator": "=~",
              "value": "/^$label_type$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            }
          ]
        },
        {
          "alias": "Кодов по отгрузкам",
          "groupBy": [
            {
              "params": [
                "$timeinterval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") FROM \"datamarkby_ships\" WHERE (\"gtin\" =~ /^$gtin_ships$/ AND \"status\" = $status_ships AND \"user_to_name\" =~ /^$user_to_name$/) AND $timeFilter GROUP BY time($timeinterval) fill(none)",
          "rawQuery": true,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_ships$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            }
          ]
        },
        {
          "alias": "Отгружено на сумму $tag_currency",
          "groupBy": [
            {
              "params": [
                "$timeinterval"
              ],
              "type": "time"
            },
            {
              "params": [
                "currency"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"price\") FROM \"datamarkby_ships\" WHERE (\"gtin\" !~ /./ AND \"status\" = $status_ships AND \"user_to_name\" =~ /^$user_to_name$/ AND \"real_count\" != $codes_per_ship) AND $timeFilter GROUP BY time($timeinterval), \"currency\" fill(none)",
          "rawQuery": true,
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "price"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_ships$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/0.*/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            }
          ]
        },
        {
          "alias": "Стоимость заказанных КМ",
          "groupBy": [
            {
              "params": [
                "$timeinterval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") * $code_cost FROM \"datamarkby_orders\" WHERE (\"gtin\" =~ /^$gtin_orders$/ AND \"status\" = 30 AND \"label_type\" = '7') AND $timeFilter GROUP BY time($timeinterval) fill(none)",
          "rawQuery": true,
          "refId": "D",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "* $code_cost"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=",
              "value": "30"
            },
            {
              "condition": "AND",
              "key": "label_type",
              "operator": "=",
              "value": "7"
            }
          ]
        },
        {
          "alias": "Стоимость отгруженных КМ",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") * $code_cost FROM \"datamarkby_ships\" WHERE (\"gtin\" =~ /^$gtin_orders$/ AND \"gtin\" =~ /0.*/ AND \"status\" = $status_ships  AND \"user_to_name\" =~ /^$user_to_name$/) AND $timeFilter GROUP BY time($timeinterval) fill(none)",
          "rawQuery": true,
          "refId": "E",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        },
        {
          "alias": "Свободные СН",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT mean(\"diff\") FROM (SELECT mean(\"count5\") - mean(\"count7\") AS \"diff\" FROM (SELECT sum(\"count\") AS \"count5\" FROM \"datamarkby_orders\" WHERE (\"label_type\" = '5') AND $timeFilter GROUP BY time($timeinterval) fill(none)), (SELECT sum(\"count\") AS \"count7\" FROM \"datamarkby_orders\" WHERE (\"label_type\" = '7') AND $timeFilter GROUP BY time($timeinterval) fill(none))) WHERE \"diff\" > 0 GROUP BY time($timeinterval) fill(none)",
          "rawQuery": true,
          "refId": "F",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Количество и стоимость кодов по заказам и отгрузкам",
      "type": "timeseries"
    },
    {
      "datasource": "${DS_DATAMARK.BY}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "displayMode": "auto",
            "filterable": false
          },
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Количество"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 16,
        "w": 7,
        "x": 17,
        "y": 0
      },
      "id": 7,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": false,
            "displayName": "Метрика"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "alias": "Заказы серийных номеров",
          "groupBy": [
            {
              "params": [
                "label_type"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT count(distinct(\"id\")) FROM \"datamarkby_orders\" WHERE (\"label_type\" = '5' AND \"status\" =$status_orders) AND $timeFilter",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=",
              "value": "5"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            }
          ]
        },
        {
          "alias": "Заказы кодов агрегации",
          "groupBy": [
            {
              "params": [
                "label_type"
              ],
              "type": "tag"
            }
          ],
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT count(distinct(\"id\")) FROM \"datamarkby_orders\" WHERE (\"label_type\" = '6' AND \"status\" =$status_orders) AND $timeFilter",
          "rawQuery": true,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=",
              "value": "6"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            }
          ]
        },
        {
          "alias": "Заказы кодов маркировки",
          "groupBy": [
            {
              "params": [
                "label_type"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT count(distinct(\"id\")) FROM \"datamarkby_orders\" WHERE (\"label_type\" = '7' AND \"status\" = $status_orders AND \"gtin\" =~ /^$gtin_orders$/) AND $timeFilter",
          "rawQuery": true,
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=",
              "value": "7"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            }
          ]
        },
        {
          "alias": "Заказанные серийные номера",
          "groupBy": [
            {
              "params": [
                "label_type"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") FROM \"datamarkby_orders\" WHERE (\"label_type\" = '5' AND \"status\" = $status_orders) AND $timeFilter GROUP BY \"label_type\"",
          "rawQuery": true,
          "refId": "D",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=",
              "value": "5"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            }
          ]
        },
        {
          "alias": "Заказанные коды агрегации",
          "groupBy": [
            {
              "params": [
                "label_type"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") FROM \"datamarkby_orders\" WHERE (\"label_type\" = '6' AND \"status\" = $status_orders) AND $timeFilter GROUP BY \"label_type\"",
          "rawQuery": true,
          "refId": "E",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=",
              "value": "6"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            }
          ]
        },
        {
          "alias": "Заказанные коды маркировки",
          "groupBy": [
            {
              "params": [
                "label_type"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") FROM \"datamarkby_orders\" WHERE (\"label_type\" = '7' AND \"status\" = $status_orders AND \"gtin\" =~ /^$gtin_orders$/) AND $timeFilter GROUP BY \"label_type\"",
          "rawQuery": true,
          "refId": "F",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "label_type",
              "operator": "=",
              "value": "7"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_orders$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            }
          ]
        },
        {
          "alias": "Стоимость заказанных КМ",
          "groupBy": [],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") * $code_cost FROM \"datamarkby_orders\" WHERE (\"gtin\" =~ /^$gtin_orders$/ AND \"status\" = 30 AND \"label_type\" = '7') AND $timeFilter",
          "rawQuery": true,
          "refId": "G",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "* $code_cost"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=",
              "value": "30"
            },
            {
              "condition": "AND",
              "key": "label_type",
              "operator": "=",
              "value": "7"
            }
          ]
        },
        {
          "alias": "Отгружено кодов",
          "groupBy": [],
          "hide": false,
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"real_count\") FROM \"datamarkby_ships\" WHERE (\"status\" = $status_ships AND \"user_to_name\" =~ /^$user_to_name$/) AND $timeFilter",
          "rawQuery": true,
          "refId": "H",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "real_count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            }
          ]
        },
        {
          "alias": "Принято кодов",
          "groupBy": [],
          "hide": false,
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"received_count\") FROM \"datamarkby_ships\" WHERE (\"status\" = $status_ships AND \"user_to_name\" =~ /^$user_to_name$/) AND $timeFilter",
          "rawQuery": true,
          "refId": "I",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "received_count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            }
          ]
        },
        {
          "alias": "Отгружено на сумму валюты $tag_currency",
          "groupBy": [
            {
              "params": [
                "currency"
              ],
              "type": "tag"
            }
          ],
          "hide": false,
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"price\") FROM \"datamarkby_ships\" WHERE (\"status\" = $status_ships AND \"user_to_name\" =~ /^$user_to_name$/ AND \"gtin\" !~ /./ AND \"real_count\" != $codes_per_ship) AND $timeFilter GROUP BY \"currency\"",
          "rawQuery": true,
          "refId": "J",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "price"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_ships$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/0.*/"
            }
          ]
        },
        {
          "alias": "Стоимость отгруженных КМ",
          "groupBy": [],
          "hide": false,
          "measurement": "datamarkby_orders",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") * $code_cost FROM \"datamarkby_ships\" WHERE (\"gtin\" =~ /^$gtin_orders$/ AND \"gtin\" =~ /0.*/ AND \"status\" = $status_ships  AND \"user_to_name\" =~ /^$user_to_name$/) AND $timeFilter",
          "rawQuery": true,
          "refId": "K",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "* $code_cost"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_orders$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=",
              "value": "30"
            },
            {
              "condition": "AND",
              "key": "label_type",
              "operator": "=",
              "value": "7"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Статистика",
      "transformations": [
        {
          "id": "seriesToRows",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {},
            "renameByName": {
              "Metric": "Метрика",
              "Value": "Количество",
              "datamarkby_orders.count": "Значение"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_DATAMARK.BY}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 4,
        "x": 0,
        "y": 6
      },
      "id": 3,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto"
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "groupBy": [],
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT count(distinct(\"id\")) FROM \"datamarkby_ships\" WHERE (\"gtin\" =~ /^$gtin_ships$/ AND \"user_to_name\" =~ /^$user_to_name$/ AND \"status\" = $status_ships ) AND $timeFilter",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "id"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "count"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_ships$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            }
          ]
        }
      ],
      "title": "Количество отгрузок",
      "type": "stat"
    },
    {
      "datasource": null,
      "fieldConfig": {
        "defaults": {},
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 12
      },
      "id": 9,
      "options": {
        "content": "<center><h1><b><font color=#73BF69>${count_gtin_orders}</font></b> в заказах<br>\r\n<b><font color=#F2495C>${count_gtin_ships}</font></b> в отгрузках",
        "mode": "html"
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Количество GTIN",
      "type": "text"
    },
    {
      "datasource": "${DS_DATAMARK.BY}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "none"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "GTIN"
            },
            "properties": [
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Товар"
            },
            "properties": [
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Валюта"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Российский рубль",
                    "to": "",
                    "type": 1,
                    "value": "rub643"
                  },
                  {
                    "from": "",
                    "id": 2,
                    "text": "Белорусский рубль",
                    "to": "",
                    "type": 1,
                    "value": "byn933"
                  }
                ]
              },
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Отгружено"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Стоимость КМ"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 120
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 16
      },
      "id": 11,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Отгружено"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "gtin"
              ],
              "type": "tag"
            },
            {
              "params": [
                "name"
              ],
              "type": "tag"
            },
            {
              "params": [
                "currency"
              ],
              "type": "tag"
            }
          ],
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"count\") AS \"Отгружено\", sum(\"count\") * $code_cost AS \"Стоимость КМ\" FROM \"datamarkby_ships\" WHERE (\"status\" = $status_ships AND \"user_to_name\" =~ /^$user_to_name$/ AND \"gtin\" =~ /0.*/) AND $timeFilter GROUP BY \"gtin\", \"name\", \"currency\"",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "Отгружено"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "* $code_cost"
                ],
                "type": "math"
              },
              {
                "params": [
                  "Стоимость КМ"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/0.*/"
            }
          ]
        }
      ],
      "title": "Отгружено по GTIN",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {
              "Time": 0,
              "currency": 6,
              "gtin": 1,
              "name": 2,
              "На сумму": 5,
              "Отгружено": 3,
              "Стоимость КМ": 4
            },
            "renameByName": {
              "currency": "Валюта",
              "gtin": "GTIN",
              "name": "Товар",
              "sum": "Отгружено"
            }
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": "${DS_DATAMARK.BY}",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Контрагент"
            },
            "properties": [
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Валюта"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Российский рубль",
                    "to": "",
                    "type": 1,
                    "value": "rub643"
                  },
                  {
                    "from": "",
                    "id": 2,
                    "text": "Белорусский рубль",
                    "to": "",
                    "type": 1,
                    "value": "byn933"
                  }
                ]
              },
              {
                "id": "custom.filterable",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Отгружено"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 100
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Стоимость КМ"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 120
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 16
      },
      "id": 12,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Отгружено"
          }
        ]
      },
      "pluginVersion": "7.5.4",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "user_to_name"
              ],
              "type": "tag"
            },
            {
              "params": [
                "currency"
              ],
              "type": "tag"
            }
          ],
          "measurement": "datamarkby_ships",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT sum(\"real_count\") AS \"Отгружено\", sum(\"real_count\") * $code_cost AS \"Стоимость КМ\" FROM \"datamarkby_ships\" WHERE (\"status\" = $status_ships AND \"gtin\" !~ /./ AND \"user_to_name\" =~ /^$user_to_name$/) AND $timeFilter GROUP BY \"user_to_name\", \"currency\"",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "table",
          "select": [
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "Отгружено"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "count"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "sum"
              },
              {
                "params": [
                  "* $code_cost"
                ],
                "type": "math"
              },
              {
                "params": [
                  "Стоимость КМ"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": [
            {
              "key": "gtin",
              "operator": "=~",
              "value": "/^$gtin_ships$/"
            },
            {
              "condition": "AND",
              "key": "status",
              "operator": "=~",
              "value": "/^$status_ships$/"
            },
            {
              "condition": "AND",
              "key": "gtin",
              "operator": "=~",
              "value": "/0.*/"
            },
            {
              "condition": "AND",
              "key": "user_to_name",
              "operator": "=~",
              "value": "/^$user_to_name$/"
            }
          ]
        }
      ],
      "title": "Отгружено по контрагентам",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "indexByName": {
              "Time": 0,
              "currency": 5,
              "user_to_name": 1,
              "На сумму": 4,
              "Отгружено": 2,
              "Стоимость КМ": 3
            },
            "renameByName": {
              "currency": "Валюта",
              "gtin": "GTIN",
              "name": "Товар",
              "sum": "Отгружено",
              "user_to_name": "Контрагент",
              "Отгружено": ""
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "schemaVersion": 27,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": ".*",
        "current": {
          "selected": true,
          "tags": [],
          "text": [
            "Код маркировки"
          ],
          "value": [
            "7"
          ]
        },
        "description": "5 - Серийный номер; 6 - Код агрегации; 7 - Код маркировки.",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Тип кода",
        "multi": true,
        "name": "label_type",
        "options": [
          {
            "selected": false,
            "text": "All",
            "value": "$__all"
          },
          {
            "selected": false,
            "text": "Серийный номер",
            "value": "5"
          },
          {
            "selected": false,
            "text": "Код агрегации",
            "value": "6"
          },
          {
            "selected": true,
            "text": "Код маркировки",
            "value": "7"
          }
        ],
        "query": "Серийный номер : 5, Код агрегации : 6, Код маркировки : 7",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": ".*",
        "current": {
          "selected": false,
          "text": "Готово",
          "value": "30"
        },
        "description": "10 - В очереди; 15 - Отправлен в \"Честный знак\"; 20 - Отправлен в \"Электронный знак\"; 30 - Готово; 40 - Отменено.",
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Статус заказов",
        "multi": false,
        "name": "status_orders",
        "options": [
          {
            "selected": false,
            "text": "В очереди",
            "value": "10"
          },
          {
            "selected": false,
            "text": "Отправлен в \"Честный знак\"",
            "value": "15"
          },
          {
            "selected": false,
            "text": "Отправлен в \"Электронный знак\"",
            "value": "20"
          },
          {
            "selected": true,
            "text": "Готово",
            "value": "30"
          },
          {
            "selected": false,
            "text": "Отменено",
            "value": "40"
          }
        ],
        "query": "В очереди : 10, Отправлен в \"Честный знак\" : 15, Отправлен в \"Электронный знак\" : 20, Готово : 30, Отменено : 40",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_DATAMARK.BY}",
        "definition": "SHOW TAG VALUES FROM \"datamarkby_orders\" WITH KEY = \"gtin\"",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "GTIN заказов",
        "multi": true,
        "name": "gtin_orders",
        "options": [],
        "query": "SHOW TAG VALUES FROM \"datamarkby_orders\" WITH KEY = \"gtin\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": true
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_DATAMARK.BY}",
        "definition": "SHOW TAG VALUES CARDINALITY FROM \"datamarkby_orders\" WITH KEY = \"gtin\"",
        "description": null,
        "error": null,
        "hide": 2,
        "includeAll": false,
        "label": "Кол-во GTIN в заказах",
        "multi": false,
        "name": "count_gtin_orders",
        "options": [],
        "query": "SHOW TAG VALUES CARDINALITY FROM \"datamarkby_orders\" WITH KEY = \"gtin\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {
          "selected": true,
          "text": "Принят",
          "value": "20"
        },
        "description": "0 - Создан; 5 - В обработке; 10 - В пути; 12 - Отгружен; 15 - Ошибка; 17 - Ожидает приемку; 19 - Приемка; 20 - Принят; 30 - Отменен.",
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Статус отгрузок",
        "multi": false,
        "name": "status_ships",
        "options": [
          {
            "selected": false,
            "text": "Создан",
            "value": "0"
          },
          {
            "selected": false,
            "text": "В обработке",
            "value": "5"
          },
          {
            "selected": false,
            "text": "В пути",
            "value": "10"
          },
          {
            "selected": false,
            "text": "Отгружен",
            "value": "12"
          },
          {
            "selected": false,
            "text": "Ошибка",
            "value": "15"
          },
          {
            "selected": false,
            "text": "Ожидает приемку",
            "value": "17"
          },
          {
            "selected": false,
            "text": "Приемка",
            "value": "19"
          },
          {
            "selected": true,
            "text": "Принят",
            "value": "20"
          },
          {
            "selected": false,
            "text": "Отменен",
            "value": "30"
          }
        ],
        "query": "Создан : 0, В обработке : 5, В пути : 10, Отгружен : 12, Ошибка : 15, Ожидает приемку : 17, Приемка : 19, Принят : 20, Отменен : 30",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_DATAMARK.BY}",
        "definition": "SHOW TAG VALUES FROM \"datamarkby_ships\" WITH KEY = \"gtin\"",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "GTIN отгрузок",
        "multi": true,
        "name": "gtin_ships",
        "options": [],
        "query": "SHOW TAG VALUES FROM \"datamarkby_ships\" WITH KEY = \"gtin\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_DATAMARK.BY}",
        "definition": "SHOW TAG VALUES CARDINALITY FROM \"datamarkby_ships\" WITH KEY = \"gtin\"",
        "description": null,
        "error": null,
        "hide": 2,
        "includeAll": false,
        "label": "Кол-во GTIN в отгрузках",
        "multi": false,
        "name": "count_gtin_ships",
        "options": [],
        "query": "SHOW TAG VALUES CARDINALITY FROM \"datamarkby_ships\" WITH KEY = \"gtin\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": ".*",
        "current": {},
        "datasource": "${DS_DATAMARK.BY}",
        "definition": "SHOW TAG VALUES FROM \"datamarkby_ships\" WITH KEY = \"user_to_name\"",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Контрагент",
        "multi": true,
        "name": "user_to_name",
        "options": [],
        "query": "SHOW TAG VALUES FROM \"datamarkby_ships\" WITH KEY = \"user_to_name\"",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "description": "Стоимость кода маркировки в BYN",
        "error": null,
        "hide": 2,
        "label": "Стоимость КМ",
        "name": "code_cost",
        "query": "${VAR_CODE_COST}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_CODE_COST}",
          "text": "${VAR_CODE_COST}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_CODE_COST}",
            "text": "${VAR_CODE_COST}",
            "selected": false
          }
        ]
      },
      {
        "description": "На одну отгрузку не может быть добавлено кодов больше заданного. Используется для подсчета суммы накладной в случае нескольких отгрузок.",
        "error": null,
        "hide": 2,
        "label": "Кол-во кодов на отгрузку",
        "name": "codes_per_ship",
        "query": "${VAR_CODES_PER_SHIP}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_CODES_PER_SHIP}",
          "text": "${VAR_CODES_PER_SHIP}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_CODES_PER_SHIP}",
            "text": "${VAR_CODES_PER_SHIP}",
            "selected": false
          }
        ]
      },
      {
        "auto": false,
        "auto_count": 30,
        "auto_min": "10s",
        "current": {
          "selected": false,
          "text": "7d",
          "value": "7d"
        },
        "description": "Интервал группировки заказов и отгрузок",
        "error": null,
        "hide": 0,
        "label": "Группировать по",
        "name": "timeinterval",
        "options": [
          {
            "selected": false,
            "text": "1m",
            "value": "1m"
          },
          {
            "selected": false,
            "text": "1h",
            "value": "1h"
          },
          {
            "selected": false,
            "text": "12h",
            "value": "12h"
          },
          {
            "selected": false,
            "text": "1d",
            "value": "1d"
          },
          {
            "selected": true,
            "text": "7d",
            "value": "7d"
          },
          {
            "selected": false,
            "text": "30d",
            "value": "30d"
          }
        ],
        "query": "1m,1h,12h,1d,7d,30d",
        "queryValue": "",
        "refresh": 2,
        "skipUrlSync": false,
        "type": "interval"
      }
    ]
  },
  "time": {
    "from": "now-6M",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "utc",
  "title": "Datamark.by",
  "uid": "djcpSc9Mk",
  "version": 19
}