From 5ad3bd5e07896dffb6c8e8e65ea80e28954de48b Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 29 Nov 2021 10:55:57 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D1=8B=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/api/index.ts | 6 +- src/services/api/models/SetpointInfoDto.ts | 12 ++ .../api/models/SetpointsRequestDto.ts | 19 +++ src/services/api/models/WellDto.ts | 1 + .../services/ClusterOperationStatService.ts | 25 ---- ...StatService.ts => OperationStatService.ts} | 35 +++++- src/services/api/services/SetpointsService.ts | 118 ++++++++++++++++++ 7 files changed, 188 insertions(+), 28 deletions(-) create mode 100644 src/services/api/models/SetpointInfoDto.ts create mode 100644 src/services/api/models/SetpointsRequestDto.ts delete mode 100644 src/services/api/services/ClusterOperationStatService.ts rename src/services/api/services/{WellOperationStatService.ts => OperationStatService.ts} (63%) create mode 100644 src/services/api/services/SetpointsService.ts diff --git a/src/services/api/index.ts b/src/services/api/index.ts index 288bdbe..1e4e6e8 100644 --- a/src/services/api/index.ts +++ b/src/services/api/index.ts @@ -23,6 +23,8 @@ export type { FilePublishInfoDto } from './models/FilePublishInfoDto'; export type { MeasureDto } from './models/MeasureDto'; export type { MessageDto } from './models/MessageDto'; export type { MessageDtoPaginationContainer } from './models/MessageDtoPaginationContainer'; +export type { SetpointInfoDto } from './models/SetpointInfoDto'; +export type { SetpointsRequestDto } from './models/SetpointsRequestDto'; export type { StatClusterDto } from './models/StatClusterDto'; export type { StatOperationsDto } from './models/StatOperationsDto'; export type { StatOperationsDtoPlanFactBase } from './models/StatOperationsDtoPlanFactBase'; @@ -63,7 +65,6 @@ export { AdminUserRoleService } from './services/AdminUserRoleService'; export { AdminUserService } from './services/AdminUserService'; export { AdminWellService } from './services/AdminWellService'; export { AuthService } from './services/AuthService'; -export { ClusterOperationStatService } from './services/ClusterOperationStatService'; export { ClusterService } from './services/ClusterService'; export { DepositService } from './services/DepositService'; export { DrillFlowChartService } from './services/DrillFlowChartService'; @@ -72,13 +73,14 @@ export { DrillParamsService } from './services/DrillParamsService'; export { FileService } from './services/FileService'; export { MeasureService } from './services/MeasureService'; export { MessageService } from './services/MessageService'; +export { OperationStatService } from './services/OperationStatService'; export { ReportService } from './services/ReportService'; export { RequerstTrackerService } from './services/RequerstTrackerService'; +export { SetpointsService } from './services/SetpointsService'; export { TelemetryAnalyticsService } from './services/TelemetryAnalyticsService'; export { TelemetryDataSaubService } from './services/TelemetryDataSaubService'; export { TelemetryDataSpinService } from './services/TelemetryDataSpinService'; export { TelemetryService } from './services/TelemetryService'; export { WellCompositeService } from './services/WellCompositeService'; export { WellOperationService } from './services/WellOperationService'; -export { WellOperationStatService } from './services/WellOperationStatService'; export { WellService } from './services/WellService'; diff --git a/src/services/api/models/SetpointInfoDto.ts b/src/services/api/models/SetpointInfoDto.ts new file mode 100644 index 0000000..35fdd0a --- /dev/null +++ b/src/services/api/models/SetpointInfoDto.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type SetpointInfoDto = { + displayName?: string | null; + name?: string | null; + units?: string | null; + comment?: string | null; + max?: number; + min?: number; +} diff --git a/src/services/api/models/SetpointsRequestDto.ts b/src/services/api/models/SetpointsRequestDto.ts new file mode 100644 index 0000000..189d138 --- /dev/null +++ b/src/services/api/models/SetpointsRequestDto.ts @@ -0,0 +1,19 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { UserDto } from './UserDto'; +import type { WellDto } from './WellDto'; + +export type SetpointsRequestDto = { + id?: number; + idWell?: number; + idAuthor?: number; + idState?: number; + uploadDate?: string; + obsolescenceSec?: number; + setpoints?: Record | null; + comment?: string | null; + well?: WellDto; + author?: UserDto; +} diff --git a/src/services/api/models/WellDto.ts b/src/services/api/models/WellDto.ts index ebc03bc..a55bf12 100644 --- a/src/services/api/models/WellDto.ts +++ b/src/services/api/models/WellDto.ts @@ -13,6 +13,7 @@ export type WellDto = { longitude?: number | null; wellType?: string | null; idWellType?: number; + idCluster?: number | null; idState?: number; lastTelemetryDate?: string; telemetry?: TelemetryDto; diff --git a/src/services/api/services/ClusterOperationStatService.ts b/src/services/api/services/ClusterOperationStatService.ts deleted file mode 100644 index a15eb9b..0000000 --- a/src/services/api/services/ClusterOperationStatService.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ClusterRopStatDto } from '../models/ClusterRopStatDto'; -import { request as __request } from '../core/request'; - -export class ClusterOperationStatService { - - /** - * Формирует данные по среднему и максимальному МСП на кусту - * @param idWell id скважины с данного куста (через нее будут полуены данные) - * @returns ClusterRopStatDto Success - * @throws ApiError - */ - public static async getClusterRopStat( - idWell: number, - ): Promise { - const result = await __request({ - method: 'GET', - path: `/api/cluster/${idWell}/ropStat`, - }); - return result.body; - } - -} \ No newline at end of file diff --git a/src/services/api/services/WellOperationStatService.ts b/src/services/api/services/OperationStatService.ts similarity index 63% rename from src/services/api/services/WellOperationStatService.ts rename to src/services/api/services/OperationStatService.ts index 6019a8d..81867f1 100644 --- a/src/services/api/services/WellOperationStatService.ts +++ b/src/services/api/services/OperationStatService.ts @@ -1,12 +1,45 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ +import type { ClusterRopStatDto } from '../models/ClusterRopStatDto'; import type { StatClusterDto } from '../models/StatClusterDto'; import type { StatWellDto } from '../models/StatWellDto'; import type { WellOperationDtoPlanFactPredictBase } from '../models/WellOperationDtoPlanFactPredictBase'; import { request as __request } from '../core/request'; -export class WellOperationStatService { +export class OperationStatService { + + /** + * Формирует данные по среднему и максимальному МСП на кусту по id скважины + * @param idWell id скважины с данного куста (через нее будут полуены данные) + * @returns ClusterRopStatDto Success + * @throws ApiError + */ + public static async getClusterRopStatByIdWell( + idWell: number, + ): Promise { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/ropStat`, + }); + return result.body; + } + + /** + * Формирует данные по среднему и максимальному МСП на кусту по uid панели + * @param uid id передающей данные панели + * @returns ClusterRopStatDto Success + * @throws ApiError + */ + public static async getClusterRopStatByUid( + uid: string, + ): Promise { + const result = await __request({ + method: 'GET', + path: `/api/telemetry/${uid}/ropStat`, + }); + return result.body; + } /** * Получает статстику по скважинам куста diff --git a/src/services/api/services/SetpointsService.ts b/src/services/api/services/SetpointsService.ts new file mode 100644 index 0000000..bdbf786 --- /dev/null +++ b/src/services/api/services/SetpointsService.ts @@ -0,0 +1,118 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { SetpointInfoDto } from '../models/SetpointInfoDto'; +import type { SetpointsRequestDto } from '../models/SetpointsRequestDto'; +import { request as __request } from '../core/request'; + +export class SetpointsService { + + /** + * Получает список запросов на изменение уставок. + * @param idWell + * @returns SetpointInfoDto Success + * @throws ApiError + */ + public static async getSetpointsNamesByIdWell( + idWell: number, + ): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/setpointsNames`, + }); + return result.body; + } + + /** + * Добавляет запрос на изменение заданий панели оператора. + * @param idWell + * @param requestBody + * @returns number Success + * @throws ApiError + */ + public static async insert( + idWell: number, + requestBody?: SetpointsRequestDto, + ): Promise { + const result = await __request({ + method: 'POST', + path: `/api/well/${idWell}/setpoints`, + body: requestBody, + }); + return result.body; + } + + /** + * Получает список запросов на изменение уставок. + * @param idWell + * @returns SetpointsRequestDto Success + * @throws ApiError + */ + public static async getByIdWell( + idWell: number, + ): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/well/${idWell}/setpoints`, + }); + return result.body; + } + + /** + * Отчет о принятии, или отклонении уставок оператором. + * После уставка будет не изменяемой. + * @param uid + * @param id + * @param requestBody можно передать только новый state eg.: {state:3} - принято + * @returns SetpointsRequestDto Success + * @throws ApiError + */ + public static async updateByTelemetryUid( + uid: string, + id: number, + requestBody?: SetpointsRequestDto, + ): Promise { + const result = await __request({ + method: 'PUT', + path: `/api/telemetry/${uid}/setpoints/${id}`, + body: requestBody, + }); + return result.body; + } + + /** + * Получает запросы на изменение уставок панели. + * !!SIDE EFFECT: изменяет состояние запросов уставок на отправлено, это не позволит удалить эти уставки после отправки на панель. + * @param uid + * @returns SetpointsRequestDto Success + * @throws ApiError + */ + public static async getByTelemetryUid( + uid: string, + ): Promise> { + const result = await __request({ + method: 'GET', + path: `/api/telemetry/${uid}/setpoints`, + }); + return result.body; + } + + /** + * Пробует удалить запрос на изменение уставок. Это будет выполнено, если запрос еще не был отправлен на панель. + * @param idWell + * @param id + * @returns any Success + * @throws ApiError + */ + public static async tryDeleteByIdWell( + idWell: number, + id: number, + ): Promise { + const result = await __request({ + method: 'DELETE', + path: `/api/well/${idWell}/setpoints/${id}`, + }); + return result.body; + } + +} \ No newline at end of file