屏蔽门操作
This commit is contained in:
parent
e92fd12c31
commit
834ba6931e
@ -266,9 +266,12 @@ export async function screenDoorOperate(data: {
|
||||
simulationId: string;
|
||||
mapId: number;
|
||||
deviceId: number;
|
||||
operation: number;
|
||||
asdCodes?: number[];
|
||||
group?: number;
|
||||
operation: request.Psd.Operation;
|
||||
param: {
|
||||
asdCodes: number[];
|
||||
force: request.Psd.Force;
|
||||
fault: request.Psd.Fault;
|
||||
};
|
||||
}) {
|
||||
return await api.post(`${UriBase}/psd/operation`, data);
|
||||
}
|
||||
|
164
src/components/draw-app/dialogs/ScreenDoorOperation.vue
Normal file
164
src/components/draw-app/dialogs/ScreenDoorOperation.vue
Normal file
@ -0,0 +1,164 @@
|
||||
<!-- eslint-disable vue/no-mutating-props -->
|
||||
<template>
|
||||
<draggable-dialog
|
||||
v-model="showSectionOperation"
|
||||
seamless
|
||||
title="屏蔽门设置参数"
|
||||
:width="380"
|
||||
:height="0"
|
||||
>
|
||||
<template v-slot:footer>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<q-form ref="myForm" @submit="onCreate" class="q-gutter-md">
|
||||
<q-input
|
||||
dense
|
||||
outlined
|
||||
readonly
|
||||
label="名称"
|
||||
v-model="props.code"
|
||||
/>
|
||||
<div
|
||||
class="q-gutter-sm"
|
||||
style="border: 1px solid #ccc; border-radius: 3px"
|
||||
>
|
||||
<div>屏蔽门强制:</div>
|
||||
<q-radio
|
||||
v-for="option in screenDoorForceOption"
|
||||
:key="option.value"
|
||||
v-model="screenDoorForce"
|
||||
:val="option.value"
|
||||
:label="option.label"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="q-gutter-sm"
|
||||
style="border: 1px solid #ccc; border-radius: 3px"
|
||||
>
|
||||
<div>设置故障:</div>
|
||||
<q-radio
|
||||
v-for="option in screenDoorFaultOption"
|
||||
:key="option.value"
|
||||
v-model="screenDoorFault"
|
||||
:val="option.value"
|
||||
:label="option.label"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="q-gutter-sm"
|
||||
style="border: 1px solid #ccc; border-radius: 3px"
|
||||
>
|
||||
<div>选择子门:</div>
|
||||
<template :key="item" v-for="item in asdOptions">
|
||||
<q-checkbox
|
||||
v-model="asdCodes"
|
||||
:val="item"
|
||||
:label="item < 10 ? '0' + item : item + ''"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<q-card-actions align="right" class="text-primary">
|
||||
<q-btn
|
||||
flat
|
||||
label="取消"
|
||||
@click="showTurnoutOperation = false"
|
||||
v-close-popup
|
||||
/>
|
||||
<q-btn flat label="确认" type="submit" />
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</template>
|
||||
</draggable-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { QForm } from 'quasar';
|
||||
import { screenDoorOperate } from 'src/api/Simulation';
|
||||
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
|
||||
import { request } from 'src/protos/request';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
sonDoorAmount: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const lineStore = useLineStore();
|
||||
const showSectionOperation = ref(true);
|
||||
const screenDoorForce = ref<request.Psd.Force>(0);
|
||||
const screenDoorForceOption = [
|
||||
{
|
||||
label: '无强制',
|
||||
value: request.Psd.Force.F_NONE,
|
||||
},
|
||||
{
|
||||
label: '强制开门',
|
||||
value: request.Psd.Force.F_ASD_KM,
|
||||
},
|
||||
{
|
||||
label: '强制关门',
|
||||
value: request.Psd.Force.F_ASD_GM,
|
||||
},
|
||||
];
|
||||
const screenDoorFault = ref<request.Psd.Fault>(0);
|
||||
const screenDoorFaultOption = [
|
||||
{
|
||||
label: '无故障',
|
||||
value: request.Psd.Fault.FA_NONE,
|
||||
},
|
||||
{
|
||||
label: '设置故障物',
|
||||
value: request.Psd.Fault.FA_Obstacle,
|
||||
},
|
||||
];
|
||||
const asdCodes = ref<number[]>([]);
|
||||
const asdOptions = ref<number[]>([]);
|
||||
|
||||
onMounted(() => {
|
||||
for (let i = 1; i <= props.sonDoorAmount; i++) {
|
||||
asdOptions.value.push(i);
|
||||
}
|
||||
});
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
function onCreate() {
|
||||
myForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
const obj = {
|
||||
simulationId: lineStore?.simulationId || '',
|
||||
mapId: lineStore.mapId as number,
|
||||
deviceId: props.id,
|
||||
operation: request.Psd.Operation.SetParams,
|
||||
param: {
|
||||
asdCodes: asdCodes.value,
|
||||
force: screenDoorForce.value,
|
||||
fault: screenDoorFault.value,
|
||||
},
|
||||
};
|
||||
screenDoorOperate(obj).catch((e) =>
|
||||
errorNotify('屏蔽门操作失败:' + e.title, e)
|
||||
);
|
||||
showSectionOperation.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
lineStore.deviceOpreratDialogInstance = null;
|
||||
});
|
||||
</script>
|
||||
<style scoped></style>
|
@ -110,17 +110,6 @@
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
<!-- <q-card-actions align="center">
|
||||
<q-btn label="修改" type="submit" color="primary" @click="submitState" />
|
||||
<q-btn
|
||||
label="重置"
|
||||
type="reset"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-ml-sm"
|
||||
@click="onReset"
|
||||
/>
|
||||
</q-card-actions> -->
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@ -128,66 +117,21 @@ import { useLineStore } from 'src/stores/line-store';
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import { ScreenDoor } from 'src/graphics/screenDoor/ScreenDoor';
|
||||
import { request } from 'src/protos/request';
|
||||
// import { state } from 'src/protos/device_state';
|
||||
import { screenDoorOperate } from 'src/api/Simulation';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
import { ScreenDoorState } from 'src/drawApp/graphics/ScreenDoorInteraction';
|
||||
import ScreenDoorOperation from 'src/components/draw-app/dialogs/ScreenDoorOperation.vue';
|
||||
import { Dialog } from 'quasar';
|
||||
|
||||
// string code = 1; //滑动门的编号
|
||||
// bool kmdw = 2; //开门到位(实际位置)
|
||||
// bool gmdw = 3; //关门到位(实际位置)
|
||||
// bool mgj = 4; //门关继电器
|
||||
const lineStore = useLineStore();
|
||||
const screenDoorState = ref<ScreenDoorState>(new ScreenDoorState());
|
||||
const code = ref('');
|
||||
const sonDoorAmount = ref(0);
|
||||
const selectAsd = ref(false);
|
||||
const asdCodes = ref<number[]>([]);
|
||||
const asdOptions = ref<number[]>([]);
|
||||
let asdOperation: null | request.Psd.Operation = null;
|
||||
const operationOptions = ref<
|
||||
{ label: string; value: request.Psd.Operation; group?: number }[]
|
||||
>([]);
|
||||
|
||||
const options = [
|
||||
// {
|
||||
// label: '四编组开门',
|
||||
// value: request.Psd.Operation.Km,
|
||||
// },
|
||||
// {
|
||||
// label: '取消四编组开门',
|
||||
// value: request.Psd.Operation.CancelKm,
|
||||
// },
|
||||
const operationOptions = [
|
||||
{
|
||||
label: '关门',
|
||||
value: request.Psd.Operation.Gm,
|
||||
},
|
||||
{
|
||||
label: '取消关门',
|
||||
value: request.Psd.Operation.CancelGm,
|
||||
},
|
||||
// {
|
||||
// label: '强制四编组开门',
|
||||
// value: request.Psd.Operation.ForceKm,
|
||||
// },
|
||||
{
|
||||
label: '强制关门',
|
||||
value: request.Psd.Operation.Gm,
|
||||
},
|
||||
{
|
||||
label: '滑动门无法开门',
|
||||
value: request.Psd.Operation.AsdCannotOpen,
|
||||
},
|
||||
{
|
||||
label: '取消滑动门无法开门',
|
||||
value: request.Psd.Operation.CancelAsdCannotOpen,
|
||||
},
|
||||
{
|
||||
label: '滑动门无法关闭',
|
||||
value: request.Psd.Operation.AsdCannotClose,
|
||||
},
|
||||
{
|
||||
label: '取消滑动门无法关闭',
|
||||
value: request.Psd.Operation.CancelAsdCannotClose,
|
||||
label: '设置参数',
|
||||
value: request.Psd.Operation.SetParams,
|
||||
},
|
||||
];
|
||||
|
||||
@ -203,30 +147,7 @@ watch(
|
||||
);
|
||||
function initScreenDoorState(screenDoor: ScreenDoor) {
|
||||
code.value = screenDoor.datas.code;
|
||||
operationOptions.value = [];
|
||||
asdOptions.value = [];
|
||||
if (lineStore.screenDoorGroupList.length) {
|
||||
lineStore.screenDoorGroupList.forEach((item) => {
|
||||
operationOptions.value.push({
|
||||
label: `${item.trainGroupAmount}编组开门`,
|
||||
value: request.Psd.Operation.Km,
|
||||
group: item.trainGroupAmount,
|
||||
});
|
||||
operationOptions.value.push({
|
||||
label: `取消${item.trainGroupAmount}编组开门`,
|
||||
value: request.Psd.Operation.CancelKm,
|
||||
group: item.trainGroupAmount,
|
||||
});
|
||||
operationOptions.value.push({
|
||||
label: `强制${item.trainGroupAmount}编组开门`,
|
||||
value: request.Psd.Operation.ForceKm,
|
||||
group: item.trainGroupAmount,
|
||||
});
|
||||
});
|
||||
}
|
||||
options.forEach((option) => {
|
||||
operationOptions.value.push(option);
|
||||
});
|
||||
sonDoorAmount.value = screenDoor.datas.sonDoorAmount;
|
||||
if (screenDoor.datas.sonDoorAmount) {
|
||||
for (let i = 1; i <= screenDoor.datas.sonDoorAmount; i++) {
|
||||
asdOptions.value.push(i);
|
||||
@ -234,66 +155,28 @@ function initScreenDoorState(screenDoor: ScreenDoor) {
|
||||
}
|
||||
screenDoorState.value = screenDoor.states.clone() as ScreenDoorState;
|
||||
}
|
||||
// function submitState() {
|
||||
// if (lineStore.simulationId) {
|
||||
// }
|
||||
// }
|
||||
// function onReset() {
|
||||
// if (lineStore.selectedGraphics) {
|
||||
// initScreenDoorState(lineStore.selectedGraphics[0] as ScreenDoor);
|
||||
// }
|
||||
// }
|
||||
|
||||
function doScreenDoorOperation(item: {
|
||||
label: string;
|
||||
value: request.Psd.Operation;
|
||||
group?: number;
|
||||
}) {
|
||||
const list = [
|
||||
request.Psd.Operation.CancelAsdCannotClose,
|
||||
request.Psd.Operation.AsdCannotClose,
|
||||
request.Psd.Operation.AsdCannotOpen,
|
||||
request.Psd.Operation.CancelAsdCannotOpen,
|
||||
];
|
||||
if (list.includes(item.value)) {
|
||||
selectAsd.value = true;
|
||||
asdOperation = item.value;
|
||||
} else {
|
||||
const simulationId = useLineStore().simulationId || '';
|
||||
const mapId = useLineStore().mapId as number;
|
||||
screenDoorOperate({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: +screenDoorState.value.code,
|
||||
operation: item.value,
|
||||
group: item.group,
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
if (!lineStore.simulationId) return;
|
||||
if (item.label == '设置参数') {
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
lineStore.deviceOpreratDialogInstance = Dialog.create({
|
||||
component: ScreenDoorOperation,
|
||||
componentProps: {
|
||||
id: +screenDoorState.value.code,
|
||||
code: code.value,
|
||||
sonDoorAmount: sonDoorAmount.value,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
}).onCancel(() => {
|
||||
lineStore.deviceOpreratDialogInstance = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
function closeAsdOperation() {
|
||||
asdCodes.value = [];
|
||||
selectAsd.value = false;
|
||||
}
|
||||
function handleAsdOperation() {
|
||||
selectAsd.value = true;
|
||||
const simulationId = useLineStore().simulationId || '';
|
||||
const mapId = useLineStore().mapId as number;
|
||||
screenDoorOperate({
|
||||
simulationId,
|
||||
mapId,
|
||||
deviceId: +screenDoorState.value.code,
|
||||
operation: asdOperation as request.Psd.Operation,
|
||||
asdCodes: asdCodes.value,
|
||||
})
|
||||
.catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
})
|
||||
.finally(() => {
|
||||
asdCodes.value = [];
|
||||
});
|
||||
selectAsd.value = false;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (lineStore.selectedGraphics) {
|
||||
|
@ -9,11 +9,16 @@ import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import {
|
||||
ContextMenu,
|
||||
GraphicInteractionPlugin,
|
||||
IGraphicScene,
|
||||
JlGraphic,
|
||||
MenuItemOptions,
|
||||
} from 'jl-graphic';
|
||||
import { loadScreenDoorConfig } from '../commonApp';
|
||||
import { Dialog } from 'quasar';
|
||||
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||
import ScreenDoorOperation from 'src/components/draw-app/dialogs/ScreenDoorOperation.vue';
|
||||
|
||||
export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
|
||||
constructor(data?: graphicData.ScreenDoor) {
|
||||
@ -60,7 +65,8 @@ export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
|
||||
|
||||
export class ScreenDoorState
|
||||
extends GraphicStateBase
|
||||
implements IScreenDoorState {
|
||||
implements IScreenDoorState
|
||||
{
|
||||
constructor(proto?: state.PsdState) {
|
||||
let states;
|
||||
if (proto) {
|
||||
@ -99,11 +105,21 @@ export class ScreenDoorState
|
||||
}
|
||||
}
|
||||
|
||||
const setSceenDoorParam: MenuItemOptions = { name: '设置参数' };
|
||||
const sceenDoorOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '屏蔽门操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [setSceenDoorParam],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class ScreenDoorOperateInteraction extends GraphicInteractionPlugin<ScreenDoor> {
|
||||
static Name = 'screen_door_operate_menu';
|
||||
constructor(app: IGraphicScene) {
|
||||
super(ScreenDoorOperateInteraction.Name, app);
|
||||
// app.registerMenu();
|
||||
app.registerMenu(sceenDoorOperateMenu);
|
||||
}
|
||||
static init(app: IGraphicScene) {
|
||||
return new ScreenDoorOperateInteraction(app);
|
||||
@ -118,14 +134,37 @@ export class ScreenDoorOperateInteraction extends GraphicInteractionPlugin<Scree
|
||||
g.cursor = 'pointer';
|
||||
g.selectable = true;
|
||||
g.on('_leftclick', this.onLeftClick, this);
|
||||
g.on('rightclick', this.onContextMenu, this);
|
||||
}
|
||||
|
||||
unbind(g: ScreenDoor): void {
|
||||
g.selectable = false;
|
||||
g.eventMode = 'none';
|
||||
g.off('_leftclick', this.onLeftClick, this);
|
||||
g.off('rightclick', this.onContextMenu, this);
|
||||
}
|
||||
onLeftClick() {
|
||||
useLineStore().stateProCountIncrease();
|
||||
}
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const screenDoor = target.getGraphic<ScreenDoor>();
|
||||
if (!screenDoor) return;
|
||||
this.app.updateSelected(screenDoor);
|
||||
const lineStore = useLineStore();
|
||||
setSceenDoorParam.handler = async () => {
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
lineStore.deviceOpreratDialogInstance = Dialog.create({
|
||||
component: ScreenDoorOperation,
|
||||
componentProps: {
|
||||
id: screenDoor.id,
|
||||
code: screenDoor.datas.code,
|
||||
sonDoorAmount: screenDoor.datas.sonDoorAmount,
|
||||
},
|
||||
cancel: true,
|
||||
persistent: true,
|
||||
});
|
||||
};
|
||||
sceenDoorOperateMenu.open(e.global);
|
||||
}
|
||||
}
|
||||
|
@ -6330,7 +6330,6 @@ export namespace state {
|
||||
constructor(data?: any[] | {
|
||||
simulationId?: string;
|
||||
state?: SimulationStatus.SimulationState;
|
||||
description?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -6341,9 +6340,6 @@ export namespace state {
|
||||
if ("state" in data && data.state != undefined) {
|
||||
this.state = data.state;
|
||||
}
|
||||
if ("description" in data && data.description != undefined) {
|
||||
this.description = data.description;
|
||||
}
|
||||
}
|
||||
}
|
||||
get simulationId() {
|
||||
@ -6353,21 +6349,14 @@ export namespace state {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get state() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, SimulationStatus.SimulationState.PAUSE) as SimulationStatus.SimulationState;
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, SimulationStatus.SimulationState.Init) as SimulationStatus.SimulationState;
|
||||
}
|
||||
set state(value: SimulationStatus.SimulationState) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get description() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set description(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
simulationId?: string;
|
||||
state?: SimulationStatus.SimulationState;
|
||||
description?: string;
|
||||
}): SimulationStatus {
|
||||
const message = new SimulationStatus({});
|
||||
if (data.simulationId != null) {
|
||||
@ -6376,16 +6365,12 @@ export namespace state {
|
||||
if (data.state != null) {
|
||||
message.state = data.state;
|
||||
}
|
||||
if (data.description != null) {
|
||||
message.description = data.description;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
simulationId?: string;
|
||||
state?: SimulationStatus.SimulationState;
|
||||
description?: string;
|
||||
} = {};
|
||||
if (this.simulationId != null) {
|
||||
data.simulationId = this.simulationId;
|
||||
@ -6393,9 +6378,6 @@ export namespace state {
|
||||
if (this.state != null) {
|
||||
data.state = this.state;
|
||||
}
|
||||
if (this.description != null) {
|
||||
data.description = this.description;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -6404,10 +6386,8 @@ export namespace state {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.simulationId.length)
|
||||
writer.writeString(1, this.simulationId);
|
||||
if (this.state != SimulationStatus.SimulationState.PAUSE)
|
||||
if (this.state != SimulationStatus.SimulationState.Init)
|
||||
writer.writeEnum(2, this.state);
|
||||
if (this.description.length)
|
||||
writer.writeString(3, this.description);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -6423,9 +6403,6 @@ export namespace state {
|
||||
case 2:
|
||||
message.state = reader.readEnum();
|
||||
break;
|
||||
case 3:
|
||||
message.description = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -6440,10 +6417,11 @@ export namespace state {
|
||||
}
|
||||
export namespace SimulationStatus {
|
||||
export enum SimulationState {
|
||||
PAUSE = 0,
|
||||
START = 1,
|
||||
ERROR = 2,
|
||||
DESTROY = 3
|
||||
Init = 0,
|
||||
Running = 1,
|
||||
Pause = 2,
|
||||
Error = 3,
|
||||
Destroy = 4
|
||||
}
|
||||
}
|
||||
export class SimulationThirdPartyApiService extends pb_1.Message {
|
||||
|
@ -1127,21 +1127,16 @@ export namespace request {
|
||||
export namespace Psd {
|
||||
export enum Operation {
|
||||
Undefined = 0,
|
||||
Km = 1,
|
||||
CancelKm = 2,
|
||||
Gm = 3,
|
||||
CancelGm = 4,
|
||||
ForceKm = 5,
|
||||
ForceGm = 6,
|
||||
CancelForce = 10,
|
||||
AsdCannotOpen = 11,
|
||||
CancelAsdCannotOpen = 12,
|
||||
AsdCannotClose = 13,
|
||||
CancelAsdCannotClose = 14,
|
||||
QDTC = 15,
|
||||
CancelQDTC = 16,
|
||||
TZTC = 17,
|
||||
CancelTZTC = 18
|
||||
SetParams = 1
|
||||
}
|
||||
export enum Force {
|
||||
F_NONE = 0,
|
||||
F_ASD_KM = 1,
|
||||
F_ASD_GM = 2
|
||||
}
|
||||
export enum Fault {
|
||||
FA_NONE = 0,
|
||||
FA_Obstacle = 1
|
||||
}
|
||||
}
|
||||
export class PsdOperationReq extends pb_1.Message {
|
||||
@ -1151,11 +1146,10 @@ export namespace request {
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Psd.Operation;
|
||||
asdCodes?: number[];
|
||||
group?: number;
|
||||
param?: PsdParam;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("simulationId" in data && data.simulationId != undefined) {
|
||||
this.simulationId = data.simulationId;
|
||||
@ -1169,11 +1163,8 @@ export namespace request {
|
||||
if ("operation" in data && data.operation != undefined) {
|
||||
this.operation = data.operation;
|
||||
}
|
||||
if ("asdCodes" in data && data.asdCodes != undefined) {
|
||||
this.asdCodes = data.asdCodes;
|
||||
}
|
||||
if ("group" in data && data.group != undefined) {
|
||||
this.group = data.group;
|
||||
if ("param" in data && data.param != undefined) {
|
||||
this.param = data.param;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1201,25 +1192,21 @@ export namespace request {
|
||||
set operation(value: Psd.Operation) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get asdCodes() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, []) as number[];
|
||||
get param() {
|
||||
return pb_1.Message.getWrapperField(this, PsdParam, 5) as PsdParam;
|
||||
}
|
||||
set asdCodes(value: number[]) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
set param(value: PsdParam) {
|
||||
pb_1.Message.setWrapperField(this, 5, value);
|
||||
}
|
||||
get group() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
|
||||
}
|
||||
set group(value: number) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
get has_param() {
|
||||
return pb_1.Message.getField(this, 5) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
simulationId?: string;
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Psd.Operation;
|
||||
asdCodes?: number[];
|
||||
group?: number;
|
||||
param?: ReturnType<typeof PsdParam.prototype.toObject>;
|
||||
}): PsdOperationReq {
|
||||
const message = new PsdOperationReq({});
|
||||
if (data.simulationId != null) {
|
||||
@ -1234,11 +1221,8 @@ export namespace request {
|
||||
if (data.operation != null) {
|
||||
message.operation = data.operation;
|
||||
}
|
||||
if (data.asdCodes != null) {
|
||||
message.asdCodes = data.asdCodes;
|
||||
}
|
||||
if (data.group != null) {
|
||||
message.group = data.group;
|
||||
if (data.param != null) {
|
||||
message.param = PsdParam.fromObject(data.param);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -1248,8 +1232,7 @@ export namespace request {
|
||||
mapId?: number;
|
||||
deviceId?: number;
|
||||
operation?: Psd.Operation;
|
||||
asdCodes?: number[];
|
||||
group?: number;
|
||||
param?: ReturnType<typeof PsdParam.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.simulationId != null) {
|
||||
data.simulationId = this.simulationId;
|
||||
@ -1263,11 +1246,8 @@ export namespace request {
|
||||
if (this.operation != null) {
|
||||
data.operation = this.operation;
|
||||
}
|
||||
if (this.asdCodes != null) {
|
||||
data.asdCodes = this.asdCodes;
|
||||
}
|
||||
if (this.group != null) {
|
||||
data.group = this.group;
|
||||
if (this.param != null) {
|
||||
data.param = this.param.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -1283,10 +1263,8 @@ export namespace request {
|
||||
writer.writeUint32(3, this.deviceId);
|
||||
if (this.operation != Psd.Operation.Undefined)
|
||||
writer.writeEnum(4, this.operation);
|
||||
if (this.asdCodes.length)
|
||||
writer.writePackedInt32(5, this.asdCodes);
|
||||
if (this.group != 0)
|
||||
writer.writeInt32(6, this.group);
|
||||
if (this.has_param)
|
||||
writer.writeMessage(5, this.param, () => this.param.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -1309,10 +1287,7 @@ export namespace request {
|
||||
message.operation = reader.readEnum();
|
||||
break;
|
||||
case 5:
|
||||
message.asdCodes = reader.readPackedInt32();
|
||||
break;
|
||||
case 6:
|
||||
message.group = reader.readInt32();
|
||||
reader.readMessage(message.param, () => message.param = PsdParam.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
@ -1326,4 +1301,117 @@ export namespace request {
|
||||
return PsdOperationReq.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class PsdParam extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
asdCodes?: number[];
|
||||
force?: Psd.Force;
|
||||
fault?: Psd.Fault;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("asdCodes" in data && data.asdCodes != undefined) {
|
||||
this.asdCodes = data.asdCodes;
|
||||
}
|
||||
if ("force" in data && data.force != undefined) {
|
||||
this.force = data.force;
|
||||
}
|
||||
if ("fault" in data && data.fault != undefined) {
|
||||
this.fault = data.fault;
|
||||
}
|
||||
}
|
||||
}
|
||||
get asdCodes() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, []) as number[];
|
||||
}
|
||||
set asdCodes(value: number[]) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get force() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, Psd.Force.F_NONE) as Psd.Force;
|
||||
}
|
||||
set force(value: Psd.Force) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get fault() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, Psd.Fault.FA_NONE) as Psd.Fault;
|
||||
}
|
||||
set fault(value: Psd.Fault) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
asdCodes?: number[];
|
||||
force?: Psd.Force;
|
||||
fault?: Psd.Fault;
|
||||
}): PsdParam {
|
||||
const message = new PsdParam({});
|
||||
if (data.asdCodes != null) {
|
||||
message.asdCodes = data.asdCodes;
|
||||
}
|
||||
if (data.force != null) {
|
||||
message.force = data.force;
|
||||
}
|
||||
if (data.fault != null) {
|
||||
message.fault = data.fault;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
asdCodes?: number[];
|
||||
force?: Psd.Force;
|
||||
fault?: Psd.Fault;
|
||||
} = {};
|
||||
if (this.asdCodes != null) {
|
||||
data.asdCodes = this.asdCodes;
|
||||
}
|
||||
if (this.force != null) {
|
||||
data.force = this.force;
|
||||
}
|
||||
if (this.fault != null) {
|
||||
data.fault = this.fault;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.asdCodes.length)
|
||||
writer.writePackedInt32(1, this.asdCodes);
|
||||
if (this.force != Psd.Force.F_NONE)
|
||||
writer.writeEnum(2, this.force);
|
||||
if (this.fault != Psd.Fault.FA_NONE)
|
||||
writer.writeEnum(3, this.fault);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PsdParam {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PsdParam();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.asdCodes = reader.readPackedInt32();
|
||||
break;
|
||||
case 2:
|
||||
message.force = reader.readEnum();
|
||||
break;
|
||||
case 3:
|
||||
message.fault = reader.readEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): PsdParam {
|
||||
return PsdParam.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user