屏蔽门状态字段调整

This commit is contained in:
joylink_zhaoerwei 2023-11-03 11:11:31 +08:00
parent 04b7391fe1
commit 4ac281cc78
4 changed files with 414 additions and 42 deletions

View File

@ -84,17 +84,17 @@ export class ScreenDoorState
get code(): string {
return this.states.id;
}
get openAsdCodes() {
return this.states.openAsdCodes;
get asdStates(): state.AsdState[] {
return this.states.asdStates;
}
set openAsdCodes(v: number[]) {
this.states.openAsdCodes = v;
set asdStates(v: state.AsdState[]) {
this.states.asdStates = v;
}
get close() {
return this.states.close;
return this.states.mgj;
}
set close(v: boolean) {
this.states.close = v;
this.states.mgj = v;
}
get states(): state.PsdState {
return this.getState<state.PsdState>();

View File

@ -9,6 +9,7 @@ import {
} from 'src/jl-graphic';
import { Platform } from '../platform/Platform';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { state } from 'src/protos/device_state';
export interface IScreenDoorData extends GraphicData {
get code(): string; // 编号
@ -25,8 +26,8 @@ export interface IScreenDoorData extends GraphicData {
}
export interface IScreenDoorState extends GraphicState {
get openAsdCodes(): number[]; //打开的屏蔽门的编号
set openAsdCodes(v: number[]);
get asdStates(): state.AsdState[]; //所有子门的状态
set asdStates(v: state.AsdState[]);
get close(): boolean; //屏蔽门整体的关闭(继电器)状态
set close(v: boolean);
}
@ -97,7 +98,10 @@ export class ScreenDoor extends JlGraphic {
this.datas.sonDoorAmount = this.datas?.sonDoorAmount || 30;
for (let i = 0; i < this.datas.sonDoorAmount; i++) {
const smallDoor = new smallDoorGraphic();
smallDoor.draw(this.datas, i, this.states.openAsdCodes.includes(i + 1));
const smallDoorState = this.states.asdStates.find(
(asdState) => +asdState.code == i + 1
)?.mgj;
smallDoor.draw(this.datas, i, smallDoorState as boolean);
doorGraphic.addChild(smallDoor);
}
}

View File

@ -2899,8 +2899,8 @@ export namespace state {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: string;
openAsdCodes?: number[];
close?: boolean;
asdStates?: AsdState[];
mgj?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
@ -2908,11 +2908,11 @@ export namespace state {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("openAsdCodes" in data && data.openAsdCodes != undefined) {
this.openAsdCodes = data.openAsdCodes;
if ("asdStates" in data && data.asdStates != undefined) {
this.asdStates = data.asdStates;
}
if ("close" in data && data.close != undefined) {
this.close = data.close;
if ("mgj" in data && data.mgj != undefined) {
this.mgj = data.mgj;
}
}
}
@ -2922,49 +2922,49 @@ export namespace state {
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
get openAsdCodes() {
return pb_1.Message.getFieldWithDefault(this, 2, []) as number[];
get asdStates() {
return pb_1.Message.getRepeatedWrapperField(this, AsdState, 2) as AsdState[];
}
set openAsdCodes(value: number[]) {
pb_1.Message.setField(this, 2, value);
set asdStates(value: AsdState[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get close() {
get mgj() {
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
}
set close(value: boolean) {
set mgj(value: boolean) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
id?: string;
openAsdCodes?: number[];
close?: boolean;
asdStates?: ReturnType<typeof AsdState.prototype.toObject>[];
mgj?: boolean;
}): PsdState {
const message = new PsdState({});
if (data.id != null) {
message.id = data.id;
}
if (data.openAsdCodes != null) {
message.openAsdCodes = data.openAsdCodes;
if (data.asdStates != null) {
message.asdStates = data.asdStates.map(item => AsdState.fromObject(item));
}
if (data.close != null) {
message.close = data.close;
if (data.mgj != null) {
message.mgj = data.mgj;
}
return message;
}
toObject() {
const data: {
id?: string;
openAsdCodes?: number[];
close?: boolean;
asdStates?: ReturnType<typeof AsdState.prototype.toObject>[];
mgj?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.openAsdCodes != null) {
data.openAsdCodes = this.openAsdCodes;
if (this.asdStates != null) {
data.asdStates = this.asdStates.map((item: AsdState) => item.toObject());
}
if (this.close != null) {
data.close = this.close;
if (this.mgj != null) {
data.mgj = this.mgj;
}
return data;
}
@ -2974,10 +2974,10 @@ export namespace state {
const writer = w || new pb_1.BinaryWriter();
if (this.id.length)
writer.writeString(1, this.id);
if (this.openAsdCodes.length)
writer.writePackedInt32(2, this.openAsdCodes);
if (this.close != false)
writer.writeBool(3, this.close);
if (this.asdStates.length)
writer.writeRepeatedMessage(2, this.asdStates, (item: AsdState) => item.serialize(writer));
if (this.mgj != false)
writer.writeBool(3, this.mgj);
if (!w)
return writer.getResultBuffer();
}
@ -2991,10 +2991,10 @@ export namespace state {
message.id = reader.readString();
break;
case 2:
message.openAsdCodes = reader.readPackedInt32();
reader.readMessage(message.asdStates, () => pb_1.Message.addToRepeatedWrapperField(message, 2, AsdState.deserialize(reader), AsdState));
break;
case 3:
message.close = reader.readBool();
message.mgj = reader.readBool();
break;
default: reader.skipField();
}
@ -3008,6 +3008,142 @@ export namespace state {
return PsdState.deserialize(bytes);
}
}
export class AsdState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code?: string;
kmdw?: boolean;
gmdw?: boolean;
mgj?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("kmdw" in data && data.kmdw != undefined) {
this.kmdw = data.kmdw;
}
if ("gmdw" in data && data.gmdw != undefined) {
this.gmdw = data.gmdw;
}
if ("mgj" in data && data.mgj != undefined) {
this.mgj = data.mgj;
}
}
}
get code() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 1, value);
}
get kmdw() {
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
}
set kmdw(value: boolean) {
pb_1.Message.setField(this, 2, value);
}
get gmdw() {
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
}
set gmdw(value: boolean) {
pb_1.Message.setField(this, 3, value);
}
get mgj() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set mgj(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
static fromObject(data: {
code?: string;
kmdw?: boolean;
gmdw?: boolean;
mgj?: boolean;
}): AsdState {
const message = new AsdState({});
if (data.code != null) {
message.code = data.code;
}
if (data.kmdw != null) {
message.kmdw = data.kmdw;
}
if (data.gmdw != null) {
message.gmdw = data.gmdw;
}
if (data.mgj != null) {
message.mgj = data.mgj;
}
return message;
}
toObject() {
const data: {
code?: string;
kmdw?: boolean;
gmdw?: boolean;
mgj?: boolean;
} = {};
if (this.code != null) {
data.code = this.code;
}
if (this.kmdw != null) {
data.kmdw = this.kmdw;
}
if (this.gmdw != null) {
data.gmdw = this.gmdw;
}
if (this.mgj != null) {
data.mgj = this.mgj;
}
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.code.length)
writer.writeString(1, this.code);
if (this.kmdw != false)
writer.writeBool(2, this.kmdw);
if (this.gmdw != false)
writer.writeBool(3, this.gmdw);
if (this.mgj != false)
writer.writeBool(4, this.mgj);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AsdState {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new AsdState();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.code = reader.readString();
break;
case 2:
message.kmdw = reader.readBool();
break;
case 3:
message.gmdw = reader.readBool();
break;
case 4:
message.mgj = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): AsdState {
return AsdState.deserialize(bytes);
}
}
export class KeyState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@ -3098,6 +3234,188 @@ export namespace state {
return KeyState.deserialize(bytes);
}
}
export class SpksState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: string;
open?: boolean;
xh?: boolean;
light?: boolean;
pl?: boolean;
pljxh?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("open" in data && data.open != undefined) {
this.open = data.open;
}
if ("xh" in data && data.xh != undefined) {
this.xh = data.xh;
}
if ("light" in data && data.light != undefined) {
this.light = data.light;
}
if ("pl" in data && data.pl != undefined) {
this.pl = data.pl;
}
if ("pljxh" in data && data.pljxh != undefined) {
this.pljxh = data.pljxh;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
get open() {
return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean;
}
set open(value: boolean) {
pb_1.Message.setField(this, 2, value);
}
get xh() {
return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean;
}
set xh(value: boolean) {
pb_1.Message.setField(this, 3, value);
}
get light() {
return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean;
}
set light(value: boolean) {
pb_1.Message.setField(this, 4, value);
}
get pl() {
return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean;
}
set pl(value: boolean) {
pb_1.Message.setField(this, 5, value);
}
get pljxh() {
return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean;
}
set pljxh(value: boolean) {
pb_1.Message.setField(this, 6, value);
}
static fromObject(data: {
id?: string;
open?: boolean;
xh?: boolean;
light?: boolean;
pl?: boolean;
pljxh?: boolean;
}): SpksState {
const message = new SpksState({});
if (data.id != null) {
message.id = data.id;
}
if (data.open != null) {
message.open = data.open;
}
if (data.xh != null) {
message.xh = data.xh;
}
if (data.light != null) {
message.light = data.light;
}
if (data.pl != null) {
message.pl = data.pl;
}
if (data.pljxh != null) {
message.pljxh = data.pljxh;
}
return message;
}
toObject() {
const data: {
id?: string;
open?: boolean;
xh?: boolean;
light?: boolean;
pl?: boolean;
pljxh?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.open != null) {
data.open = this.open;
}
if (this.xh != null) {
data.xh = this.xh;
}
if (this.light != null) {
data.light = this.light;
}
if (this.pl != null) {
data.pl = this.pl;
}
if (this.pljxh != null) {
data.pljxh = this.pljxh;
}
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.id.length)
writer.writeString(1, this.id);
if (this.open != false)
writer.writeBool(2, this.open);
if (this.xh != false)
writer.writeBool(3, this.xh);
if (this.light != false)
writer.writeBool(4, this.light);
if (this.pl != false)
writer.writeBool(5, this.pl);
if (this.pljxh != false)
writer.writeBool(6, this.pljxh);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SpksState {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SpksState();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readString();
break;
case 2:
message.open = reader.readBool();
break;
case 3:
message.xh = reader.readBool();
break;
case 4:
message.light = reader.readBool();
break;
case 5:
message.pl = reader.readBool();
break;
case 6:
message.pljxh = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): SpksState {
return SpksState.deserialize(bytes);
}
}
export class VariationStatus extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@ -3270,9 +3588,10 @@ export namespace state {
LightState?: LightState[];
psdState?: PsdState[];
KeyState?: KeyState[];
spksState?: SpksState[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("trainState" in data && data.trainState != undefined) {
this.trainState = data.trainState;
@ -3304,6 +3623,9 @@ export namespace state {
if ("KeyState" in data && data.KeyState != undefined) {
this.KeyState = data.KeyState;
}
if ("spksState" in data && data.spksState != undefined) {
this.spksState = data.spksState;
}
}
}
get trainState() {
@ -3366,6 +3688,12 @@ export namespace state {
set KeyState(value: KeyState[]) {
pb_1.Message.setRepeatedWrapperField(this, 10, value);
}
get spksState() {
return pb_1.Message.getRepeatedWrapperField(this, SpksState, 11) as SpksState[];
}
set spksState(value: SpksState[]) {
pb_1.Message.setRepeatedWrapperField(this, 11, value);
}
static fromObject(data: {
trainState?: ReturnType<typeof TrainState.prototype.toObject>[];
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
@ -3377,6 +3705,7 @@ export namespace state {
LightState?: ReturnType<typeof LightState.prototype.toObject>[];
psdState?: ReturnType<typeof PsdState.prototype.toObject>[];
KeyState?: ReturnType<typeof KeyState.prototype.toObject>[];
spksState?: ReturnType<typeof SpksState.prototype.toObject>[];
}): AllDevicesStatus {
const message = new AllDevicesStatus({});
if (data.trainState != null) {
@ -3409,6 +3738,9 @@ export namespace state {
if (data.KeyState != null) {
message.KeyState = data.KeyState.map(item => KeyState.fromObject(item));
}
if (data.spksState != null) {
message.spksState = data.spksState.map(item => SpksState.fromObject(item));
}
return message;
}
toObject() {
@ -3423,6 +3755,7 @@ export namespace state {
LightState?: ReturnType<typeof LightState.prototype.toObject>[];
psdState?: ReturnType<typeof PsdState.prototype.toObject>[];
KeyState?: ReturnType<typeof KeyState.prototype.toObject>[];
spksState?: ReturnType<typeof SpksState.prototype.toObject>[];
} = {};
if (this.trainState != null) {
data.trainState = this.trainState.map((item: TrainState) => item.toObject());
@ -3454,6 +3787,9 @@ export namespace state {
if (this.KeyState != null) {
data.KeyState = this.KeyState.map((item: KeyState) => item.toObject());
}
if (this.spksState != null) {
data.spksState = this.spksState.map((item: SpksState) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -3480,6 +3816,8 @@ export namespace state {
writer.writeRepeatedMessage(9, this.psdState, (item: PsdState) => item.serialize(writer));
if (this.KeyState.length)
writer.writeRepeatedMessage(10, this.KeyState, (item: KeyState) => item.serialize(writer));
if (this.spksState.length)
writer.writeRepeatedMessage(11, this.spksState, (item: SpksState) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -3519,6 +3857,9 @@ export namespace state {
case 10:
reader.readMessage(message.KeyState, () => pb_1.Message.addToRepeatedWrapperField(message, 10, KeyState.deserialize(reader), KeyState));
break;
case 11:
reader.readMessage(message.spksState, () => pb_1.Message.addToRepeatedWrapperField(message, 11, SpksState.deserialize(reader), SpksState));
break;
default: reader.skipField();
}
}

View File

@ -354,7 +354,11 @@ export namespace request {
CancelGm = 6,
ForceKm4 = 7,
ForceKm8 = 8,
ForceGm = 9
ForceGm = 9,
AsdCannotOpen = 10,
CancelAsdCannotOpen = 11,
AsdCannotClose = 12,
CancelAsdCannotClose = 13
}
}
export class PsdOperationReq extends pb_1.Message {
@ -364,9 +368,10 @@ export namespace request {
mapId?: number;
deviceId?: string;
operation?: Psd.Operation;
asdCodes?: number[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("simulationId" in data && data.simulationId != undefined) {
this.simulationId = data.simulationId;
@ -380,6 +385,9 @@ 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;
}
}
}
get simulationId() {
@ -406,11 +414,18 @@ 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[];
}
set asdCodes(value: number[]) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Psd.Operation;
asdCodes?: number[];
}): PsdOperationReq {
const message = new PsdOperationReq({});
if (data.simulationId != null) {
@ -425,6 +440,9 @@ export namespace request {
if (data.operation != null) {
message.operation = data.operation;
}
if (data.asdCodes != null) {
message.asdCodes = data.asdCodes;
}
return message;
}
toObject() {
@ -433,6 +451,7 @@ export namespace request {
mapId?: number;
deviceId?: string;
operation?: Psd.Operation;
asdCodes?: number[];
} = {};
if (this.simulationId != null) {
data.simulationId = this.simulationId;
@ -446,6 +465,9 @@ export namespace request {
if (this.operation != null) {
data.operation = this.operation;
}
if (this.asdCodes != null) {
data.asdCodes = this.asdCodes;
}
return data;
}
serialize(): Uint8Array;
@ -460,6 +482,8 @@ export namespace request {
writer.writeString(3, this.deviceId);
if (this.operation != Psd.Operation.Undefined)
writer.writeEnum(4, this.operation);
if (this.asdCodes.length)
writer.writePackedInt32(5, this.asdCodes);
if (!w)
return writer.getResultBuffer();
}
@ -481,6 +505,9 @@ export namespace request {
case 4:
message.operation = reader.readEnum();
break;
case 5:
message.asdCodes = reader.readPackedInt32();
break;
default: reader.skipField();
}
}