From 396e94e334b7d62c9be3f165509b4faeb2876bd7 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Wed, 21 Jul 2021 16:53:33 +0500 Subject: [PATCH] =?UTF-8?q?CF2-29:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=D1=81=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=D0=BC=D0=B8=20=D0=BF=D0=BE=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6?= =?UTF-8?q?=D0=B8=D0=BD=D0=B5=20+=20openApi=20=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=81=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Well.jsx | 9 +- src/pages/WellAnalysis.jsx | 159 ++++++++++++++++++ src/services/api/index.ts | 2 + src/services/api/models/DataSaubBaseDto.ts | 2 + src/services/api/models/OperationDto.ts | 12 ++ .../models/OperationDtoPaginationContainer.ts | 12 ++ .../api/models/OperationDurationDto.ts | 2 +- src/services/api/services/AnalyticsService.ts | 58 +++++-- 8 files changed, 242 insertions(+), 14 deletions(-) create mode 100644 src/pages/WellAnalysis.jsx create mode 100644 src/services/api/models/OperationDto.ts create mode 100644 src/services/api/models/OperationDtoPaginationContainer.ts diff --git a/src/components/Well.jsx b/src/components/Well.jsx index 64e6ecc..66fc623 100644 --- a/src/components/Well.jsx +++ b/src/components/Well.jsx @@ -6,6 +6,7 @@ import Archive from "../pages/Archive"; import Messages from "../pages/Messages"; import Report from "../pages/Report"; import Analysis from "../pages/Analysis"; +import WellAnalysis from "../pages/WellAnalysis"; import TelemetryView from "../pages/TelemetryView"; const { Content } = Layout @@ -33,9 +34,12 @@ export default function Well() { Анализ }> - Файлы + Операции по скважине }> + Файлы + + }> Архив @@ -58,6 +62,9 @@ export default function Well() { + + + diff --git a/src/pages/WellAnalysis.jsx b/src/pages/WellAnalysis.jsx new file mode 100644 index 0000000..f0f5b6f --- /dev/null +++ b/src/pages/WellAnalysis.jsx @@ -0,0 +1,159 @@ +import {Table, Select, DatePicker, ConfigProvider} from 'antd'; +import {AnalyticsService} from '../services/api' +import {useState, useEffect} from 'react' +import {useParams} from 'react-router-dom' +import notify from '../components/notify' +import LoaderPortal from '../components/LoaderPortal' +import locale from "antd/lib/locale/ru_RU"; +import moment from 'moment' +import '../styles/message.css' + +const {Option} = Select +const pageSize = 26 +const {RangePicker} = DatePicker; + +const columns = [ + { + title: 'Название операции', + key: 'name', + dataIndex: 'name', + }, + { + title: 'Дата начала операции', + key: 'beginDate', + dataIndex: 'beginDate', + render: (item) => moment.utc(item).local().format('DD MMM YYYY, HH:mm:ss') + }, + { + title: 'Дата окончания операции', + key: 'endDate', + dataIndex: 'endDate', + render: (item) => moment.utc(item).local().format('DD MMM YYYY, HH:mm:ss') + }, + { + title: 'Глубина скважины в начале операции', + key: 'beginWellDepth', + dataIndex: 'startWellDepth', + }, + { + title: 'Глубина скважины в конце операции', + key: 'endWellDepth', + dataIndex: 'endWellDepth', + } +]; + +const filterOptions = [ + {label: 'Невозможно определить операцию', value: 1}, + {label: 'Роторное бурение', value: 2}, + {label: 'Слайдирование', value: 3}, + {label: 'Подъем с проработкой', value: 4}, + {label: 'Спуск с проработкой', value: 5}, + {label: 'Подъем с промывкой', value: 6}, + {label: 'Спуск с промывкой', value: 7}, + {label: 'Спуск в скважину', value: 8}, + {label: 'Спуск с вращением', value: 9}, + {label: 'Подъем из скважины', value: 10}, + {label: 'Подъем с вращением', value: 11}, + {label: 'Промывка в покое', value: 12}, + {label: 'Промывка с вращением', value: 13}, + {label: 'Удержание в клиньях', value: 14}, + {label: 'Неподвижное состояние', value: 15}, + {label: 'Вращение без циркуляции', value: 16}, + {label: 'На поверхности', value: 17} +] + +export default function WellAnalysis() { + let {id} = useParams() + + const [page, setPage] = useState(1) + const [range, setRange] = useState([]) + const [categories, setCategories] = useState([]) + const [pagination, setPagination] = useState(null) + const [operations, setOperations] = useState([]) + + const [loader, setLoader] = useState(false) + + const children = filterOptions.map((line) => ) + + const onChangeRange = (range) => { + setRange(range) + } + + useEffect(() => { + const GetOperations = async () => { + setLoader(true) + try { + let begin = null + let end = null + if (range?.length > 1) { + begin = range[0].toISOString() + end = range[1].toISOString() + } + + await AnalyticsService.getOperationsByWell( + `${id}`, + (page-1) * pageSize, + pageSize, + categories, + begin, + end).then((paginatedOperations) => { + setOperations(paginatedOperations?.items.map(o => { + return { + key: o.id, + begin: o.date, + ...o + } + })) + + setPagination({ + total: paginatedOperations?.count, + current: Math.floor(paginatedOperations?.skip / pageSize), + }) + } + ) + } catch (ex) { + notify(`Не удалось загрузить операции по скважине "${id}"`, 'error') + console.log(ex) + } + setLoader(false) + } + GetOperations() + }, [id, categories, range]) + + return(<> +
+

Фильтр операций

+ + + + +
+ + setPage(page) + }} + rowKey={(record) => record.id} + /> + + ) + } \ No newline at end of file diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 6af8497..c10cc8c 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -13,6 +13,8 @@ export type { DepositDto } from './models/DepositDto'; export type { EventDto } from './models/EventDto'; export type { MessageDto } from './models/MessageDto'; export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; +export type { OperationDto } from './models/OperationDto'; +export type { OperationDtoPaginationContainer } from './models/OperationDtoPaginationContainer'; export type { OperationDurationDto } from './models/OperationDurationDto'; export type { TelemetryInfoDto } from './models/TelemetryInfoDto'; export type { TelemetryMessageDto } from './models/TelemetryMessageDto'; diff --git a/src/services/api/models/DataSaubBaseDto.ts b/src/services/api/models/DataSaubBaseDto.ts index 0a9e94f..e12e1c5 100644 --- a/src/services/api/models/DataSaubBaseDto.ts +++ b/src/services/api/models/DataSaubBaseDto.ts @@ -38,4 +38,6 @@ export type DataSaubBaseDto = { flow?: number | null; flowIdle?: number | null; flowDeltaLimitMax?: number | null; + idFeedRegulator?: number | null; + mseState?: number | null; } \ No newline at end of file diff --git a/src/services/api/models/OperationDto.ts b/src/services/api/models/OperationDto.ts new file mode 100644 index 0000000..9481988 --- /dev/null +++ b/src/services/api/models/OperationDto.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type OperationDto = { + id?: number; + name?: string | null; + beginDate?: string; + endDate?: string; + startWellDepth?: number; + endWellDepth?: number; +} \ No newline at end of file diff --git a/src/services/api/models/OperationDtoPaginationContainer.ts b/src/services/api/models/OperationDtoPaginationContainer.ts new file mode 100644 index 0000000..64fcf00 --- /dev/null +++ b/src/services/api/models/OperationDtoPaginationContainer.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { OperationDto } from './OperationDto'; + +export type OperationDtoPaginationContainer = { + skip?: number; + take?: number; + count?: number; + items?: Array | null; +} \ No newline at end of file diff --git a/src/services/api/models/OperationDurationDto.ts b/src/services/api/models/OperationDurationDto.ts index 7f061a0..5be7a04 100644 --- a/src/services/api/models/OperationDurationDto.ts +++ b/src/services/api/models/OperationDurationDto.ts @@ -3,6 +3,6 @@ /* eslint-disable */ export type OperationDurationDto = { - processName?: string | null; + operationName?: string | null; duration?: number; } \ No newline at end of file diff --git a/src/services/api/services/AnalyticsService.ts b/src/services/api/services/AnalyticsService.ts index e9d0d87..a3913d0 100644 --- a/src/services/api/services/AnalyticsService.ts +++ b/src/services/api/services/AnalyticsService.ts @@ -1,6 +1,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ +import type { OperationDtoPaginationContainer } from '../models/OperationDtoPaginationContainer'; import type { OperationDurationDto } from '../models/OperationDurationDto'; import type { WellDepthToDayDto } from '../models/WellDepthToDayDto'; import type { WellDepthToIntervalDto } from '../models/WellDepthToIntervalDto'; @@ -8,6 +9,39 @@ import { request as __request } from '../core/request'; export class AnalyticsService { + /** + * Возвращает список операций на скважине за все время + * @param wellId id скважины + * @param skip для пагинации кол-во записей пропустить + * @param take для пагинации кол-во записей + * @param categoryids + * @param begin + * @param end + * @returns OperationDtoPaginationContainer Success + * @throws ApiError + */ + public static async getOperationsByWell( +wellId: number, +skip: number, +take: number = 32, +categoryids?: Array, +begin?: string, +end?: string, +): Promise { + const result = await __request({ + method: 'GET', + path: `/api/analytics/${wellId}/operationsByWell`, + query: { + 'skip': skip, + 'take': take, + 'categoryids': categoryids, + 'begin': begin, + 'end': end, + }, + }); + return result.body; + } + /** * Возвращает данные по скважине "глубина-день" * @param wellId id скважины @@ -27,22 +61,22 @@ wellId: number, /** * Возвращает данные по глубине скважины за период * @param wellId id скважины - * @param intervalHoursTimestamp количество секунд в необходимом интервале времени - * @param workBeginTimestamp количество секунд в времени начала смены + * @param intervalSeconds количество секунд в необходимом интервале времени + * @param workBeginSeconds количество секунд в времени начала смены * @returns WellDepthToIntervalDto Success * @throws ApiError */ public static async getWellDepthToInterval( wellId: number, -intervalHoursTimestamp?: number, -workBeginTimestamp?: number, +intervalSeconds?: number, +workBeginSeconds?: number, ): Promise> { const result = await __request({ method: 'GET', path: `/api/analytics/${wellId}/wellDepthToInterval`, query: { - 'intervalHoursTimestamp': intervalHoursTimestamp, - 'workBeginTimestamp': workBeginTimestamp, + 'intervalSeconds': intervalSeconds, + 'workBeginSeconds': workBeginSeconds, }, }); return result.body; @@ -75,22 +109,22 @@ end?: string, /** * Возвращает детальные данные по операциям на скважине за период * @param wellId id скважины - * @param intervalHoursTimestamp количество секунд в необходимом интервале времени - * @param workBeginTimestamp количество секунд в времени начала смены + * @param intervalSeconds количество секунд в необходимом интервале времени + * @param workBeginSeconds количество секунд в времени начала смены * @returns OperationDurationDto Success * @throws ApiError */ public static async getOperationsToInterval( wellId: number, -intervalHoursTimestamp?: number, -workBeginTimestamp?: number, +intervalSeconds?: number, +workBeginSeconds?: number, ): Promise> { const result = await __request({ method: 'GET', path: `/api/analytics/${wellId}/operationsToInterval`, query: { - 'intervalHoursTimestamp': intervalHoursTimestamp, - 'workBeginTimestamp': workBeginTimestamp, + 'intervalSeconds': intervalSeconds, + 'workBeginSeconds': workBeginSeconds, }, }); return result.body;