继电器处理数据

This commit is contained in:
joylink_zhaoerwei 2023-12-13 10:22:24 +08:00
parent 9660338669
commit dff4cf833b
2 changed files with 88 additions and 2 deletions

View File

@ -235,6 +235,23 @@ export function saveDrawDatas(app: IDrawApp) {
storage.UniqueIdPrefix = UniqueIdPrefix; storage.UniqueIdPrefix = UniqueIdPrefix;
storage.ciCjList = ciCjList; storage.ciCjList = ciCjList;
storage.ciQdList = ciQdList; storage.ciQdList = ciQdList;
storage.deviceRelateRelayList.forEach((item) => {
item.combinationtypes.forEach((itemB) => {
itemB.newrefRelays = itemB.refRelays.map((item) => +item);
});
});
storage.ciCjList.cjList.forEach((item) => {
item.bitList.forEach((item) => {
item.refRelays.forEach((itemB) => {
itemB.newrelayId = +itemB.relayId;
});
});
});
storage.ciQdList.qdList.forEach((item) => {
item.bitList.forEach((itemB) => {
itemB.newrefRelays = itemB.refRelays.map((item) => +item);
});
});
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
console.log('保存数据', storage); console.log('保存数据', storage);
return base64; return base64;

View File

@ -795,9 +795,10 @@ export namespace relayCabinetGraphicData {
constructor(data?: any[] | { constructor(data?: any[] | {
code?: string; code?: string;
refRelays?: string[]; refRelays?: string[];
newrefRelays?: number[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("code" in data && data.code != undefined) { if ("code" in data && data.code != undefined) {
this.code = data.code; this.code = data.code;
@ -805,6 +806,9 @@ export namespace relayCabinetGraphicData {
if ("refRelays" in data && data.refRelays != undefined) { if ("refRelays" in data && data.refRelays != undefined) {
this.refRelays = data.refRelays; this.refRelays = data.refRelays;
} }
if ("newrefRelays" in data && data.newrefRelays != undefined) {
this.newrefRelays = data.newrefRelays;
}
} }
} }
get code() { get code() {
@ -819,9 +823,16 @@ export namespace relayCabinetGraphicData {
set refRelays(value: string[]) { set refRelays(value: string[]) {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
get newrefRelays() {
return pb_1.Message.getFieldWithDefault(this, 3, []) as number[];
}
set newrefRelays(value: number[]) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: { static fromObject(data: {
code?: string; code?: string;
refRelays?: string[]; refRelays?: string[];
newrefRelays?: number[];
}): Combinationtype { }): Combinationtype {
const message = new Combinationtype({}); const message = new Combinationtype({});
if (data.code != null) { if (data.code != null) {
@ -830,12 +841,16 @@ export namespace relayCabinetGraphicData {
if (data.refRelays != null) { if (data.refRelays != null) {
message.refRelays = data.refRelays; message.refRelays = data.refRelays;
} }
if (data.newrefRelays != null) {
message.newrefRelays = data.newrefRelays;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
code?: string; code?: string;
refRelays?: string[]; refRelays?: string[];
newrefRelays?: number[];
} = {}; } = {};
if (this.code != null) { if (this.code != null) {
data.code = this.code; data.code = this.code;
@ -843,6 +858,9 @@ export namespace relayCabinetGraphicData {
if (this.refRelays != null) { if (this.refRelays != null) {
data.refRelays = this.refRelays; data.refRelays = this.refRelays;
} }
if (this.newrefRelays != null) {
data.newrefRelays = this.newrefRelays;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -853,6 +871,8 @@ export namespace relayCabinetGraphicData {
writer.writeString(1, this.code); writer.writeString(1, this.code);
if (this.refRelays.length) if (this.refRelays.length)
writer.writeRepeatedString(2, this.refRelays); writer.writeRepeatedString(2, this.refRelays);
if (this.newrefRelays.length)
writer.writePackedUint32(3, this.newrefRelays);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -868,6 +888,9 @@ export namespace relayCabinetGraphicData {
case 2: case 2:
pb_1.Message.addToRepeatedField(message, 2, reader.readString()); pb_1.Message.addToRepeatedField(message, 2, reader.readString());
break; break;
case 3:
message.newrefRelays = reader.readPackedUint32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -1245,6 +1268,7 @@ export namespace relayCabinetGraphicData {
constructor(data?: any[] | { constructor(data?: any[] | {
relayId?: string; relayId?: string;
position?: CjDataItem.PostionType; position?: CjDataItem.PostionType;
newrelayId?: number;
}) { }) {
super(); 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, [], this.#one_of_decls);
@ -1255,6 +1279,9 @@ export namespace relayCabinetGraphicData {
if ("position" in data && data.position != undefined) { if ("position" in data && data.position != undefined) {
this.position = data.position; this.position = data.position;
} }
if ("newrelayId" in data && data.newrelayId != undefined) {
this.newrelayId = data.newrelayId;
}
} }
} }
get relayId() { get relayId() {
@ -1269,9 +1296,16 @@ export namespace relayCabinetGraphicData {
set position(value: CjDataItem.PostionType) { set position(value: CjDataItem.PostionType) {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
get newrelayId() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set newrelayId(value: number) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: { static fromObject(data: {
relayId?: string; relayId?: string;
position?: CjDataItem.PostionType; position?: CjDataItem.PostionType;
newrelayId?: number;
}): CjDataItem { }): CjDataItem {
const message = new CjDataItem({}); const message = new CjDataItem({});
if (data.relayId != null) { if (data.relayId != null) {
@ -1280,12 +1314,16 @@ export namespace relayCabinetGraphicData {
if (data.position != null) { if (data.position != null) {
message.position = data.position; message.position = data.position;
} }
if (data.newrelayId != null) {
message.newrelayId = data.newrelayId;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
relayId?: string; relayId?: string;
position?: CjDataItem.PostionType; position?: CjDataItem.PostionType;
newrelayId?: number;
} = {}; } = {};
if (this.relayId != null) { if (this.relayId != null) {
data.relayId = this.relayId; data.relayId = this.relayId;
@ -1293,6 +1331,9 @@ export namespace relayCabinetGraphicData {
if (this.position != null) { if (this.position != null) {
data.position = this.position; data.position = this.position;
} }
if (this.newrelayId != null) {
data.newrelayId = this.newrelayId;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -1303,6 +1344,8 @@ export namespace relayCabinetGraphicData {
writer.writeString(1, this.relayId); writer.writeString(1, this.relayId);
if (this.position != CjDataItem.PostionType.Q) if (this.position != CjDataItem.PostionType.Q)
writer.writeEnum(2, this.position); writer.writeEnum(2, this.position);
if (this.newrelayId != 0)
writer.writeUint32(3, this.newrelayId);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1318,6 +1361,9 @@ export namespace relayCabinetGraphicData {
case 2: case 2:
message.position = reader.readEnum(); message.position = reader.readEnum();
break; break;
case 3:
message.newrelayId = reader.readUint32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -1520,13 +1566,17 @@ export namespace relayCabinetGraphicData {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
refRelays?: string[]; refRelays?: string[];
newrefRelays?: number[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("refRelays" in data && data.refRelays != undefined) { if ("refRelays" in data && data.refRelays != undefined) {
this.refRelays = data.refRelays; this.refRelays = data.refRelays;
} }
if ("newrefRelays" in data && data.newrefRelays != undefined) {
this.newrefRelays = data.newrefRelays;
}
} }
} }
get refRelays() { get refRelays() {
@ -1535,22 +1585,36 @@ export namespace relayCabinetGraphicData {
set refRelays(value: string[]) { set refRelays(value: string[]) {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
get newrefRelays() {
return pb_1.Message.getFieldWithDefault(this, 2, []) as number[];
}
set newrefRelays(value: number[]) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: { static fromObject(data: {
refRelays?: string[]; refRelays?: string[];
newrefRelays?: number[];
}): QdData { }): QdData {
const message = new QdData({}); const message = new QdData({});
if (data.refRelays != null) { if (data.refRelays != null) {
message.refRelays = data.refRelays; message.refRelays = data.refRelays;
} }
if (data.newrefRelays != null) {
message.newrefRelays = data.newrefRelays;
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
refRelays?: string[]; refRelays?: string[];
newrefRelays?: number[];
} = {}; } = {};
if (this.refRelays != null) { if (this.refRelays != null) {
data.refRelays = this.refRelays; data.refRelays = this.refRelays;
} }
if (this.newrefRelays != null) {
data.newrefRelays = this.newrefRelays;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -1559,6 +1623,8 @@ export namespace relayCabinetGraphicData {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.refRelays.length) if (this.refRelays.length)
writer.writeRepeatedString(1, this.refRelays); writer.writeRepeatedString(1, this.refRelays);
if (this.newrefRelays.length)
writer.writePackedUint32(2, this.newrefRelays);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1571,6 +1637,9 @@ export namespace relayCabinetGraphicData {
case 1: case 1:
pb_1.Message.addToRepeatedField(message, 1, reader.readString()); pb_1.Message.addToRepeatedField(message, 1, reader.readString());
break; break;
case 2:
message.newrefRelays = reader.readPackedUint32();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }