Merge branch 'develop' into local-test

This commit is contained in:
fan 2024-05-20 15:48:01 +08:00
commit aee078290a
23 changed files with 685 additions and 374 deletions

View File

@ -23,7 +23,7 @@
"default-passive-events": "^2.0.0",
"echarts": "^5.4.3",
"google-protobuf": "^3.21.2",
"jl-graphic": "git+http://120.46.212.6:3000/joylink/graphic-pixi.git#v0.1.11",
"jl-graphic": "git+http://120.46.212.6:3000/joylink/graphic-pixi.git#v0.1.14",
"js-base64": "^3.7.5",
"pinia": "^2.0.11",
"quasar": "^2.6.0",

@ -1 +1 @@
Subproject commit 8919d6e5d6de5d46332eb5eb6b6c052215fa0ad2
Subproject commit 0ed6b1d451f617804d608ede072121a0f1e36fb5

View File

@ -79,18 +79,27 @@
lazy-rules
:rules="wheelDiameterRules"
/>
<q-card-actions align="right" class="text-primary">
<q-btn
flat
label="取消"
@click="showAddTrainOperation = false"
v-close-popup
/>
<q-btn flat label="确认" type="submit" :disable="!trainConfig" />
</q-card-actions>
</q-form>
</q-card-section>
</q-card>
<template v-slot:sticky-footer>
<div
style="
height: 45px;
line-height: 45px;
text-align: right;
background: #fff;
"
>
<q-btn
flat
label="取消"
@click="showAddTrainOperation = false"
v-close-popup
/>
<q-btn flat label="确认" @click="onCreate" :disable="!trainConfig" />
</div>
</template>
</draggable-dialog>
</template>

View File

@ -59,6 +59,7 @@ const relayCabinetStore = useRelayCabinetStore();
const $q = useQuasar();
const tableRef = ref<QTable>();
const deviceTypeMap = {
0: '区段',
1: '道岔',
5: '信号机',
6: '车站',

View File

@ -53,7 +53,7 @@ const props = defineProps({
required: true,
},
});
const connType = ref<number>(0);
const connType = ref<number | undefined>();
const connectOptions = ref<{ label: string; value: number }[]>([]);
const showLoadTransData = ref(true);
@ -85,7 +85,7 @@ function onCreate() {
updateTrainConn({
id: props.trainId + '',
simulationId: props.simulationId,
connType: connType.value,
connType: connType.value as number,
})
.then(() => {
successNotify('列车连接成功!');

View File

@ -23,7 +23,7 @@
v-model.number="model.trainEndsA.radarCheckSpeedDiff"
clearable
@clear="() => (model.trainEndsA.radarCheckSpeedDiff = 0)"
label="雷达测速差值(m/s)"
label="雷达测速差值(km/h)"
hint=""
/>
</div>
@ -45,7 +45,7 @@
v-model.number="model.trainEndsA.radarOutSpeed"
clearable
@clear="() => (model.trainEndsA.radarOutSpeed = 0)"
label="雷达速度输出(m/s)"
label="雷达速度输出(km/h)"
hint=""
/>
</div>
@ -82,7 +82,7 @@
v-model.number="model.trainEndsA.accOutSpeed"
clearable
@clear="() => (model.trainEndsA.accOutSpeed = 0)"
label="速传速度输出(m/s)"
label="速传速度输出(km/h)"
hint=""
/>
</div>
@ -137,7 +137,7 @@
v-model.number="model.trainEndsB.radarCheckSpeedDiff"
clearable
@clear="() => (model.trainEndsB.radarCheckSpeedDiff = 0)"
label="雷达测速差值(m/s)"
label="雷达测速差值(km/h)"
hint=""
/>
</div>
@ -159,7 +159,7 @@
v-model.number="model.trainEndsB.radarOutSpeed"
clearable
@clear="() => (model.trainEndsB.radarOutSpeed = 0)"
label="雷达速度输出(m/s)"
label="雷达速度输出(km/h)"
hint=""
/>
</div>
@ -196,7 +196,7 @@
v-model.number="model.trainEndsB.accOutSpeed"
clearable
@clear="() => (model.trainEndsB.accOutSpeed = 0)"
label="速传速度输出(m/s)"
label="速传速度输出(km/h)"
hint=""
/>
</div>

View File

@ -89,6 +89,7 @@ const optionsType = [
{ label: '车库门', value: graphicData.RelatedRef.DeviceType.GarageDoor },
{ label: '洗车机', value: graphicData.RelatedRef.DeviceType.CarWashing },
{ label: '防淹门', value: graphicData.RelatedRef.DeviceType.FloodGate },
{ label: '区段', value: graphicData.RelatedRef.DeviceType.Section },
];
const noShowType = [

View File

@ -338,44 +338,52 @@ const list4: KeyType[] = [
// { label: '2', key: 'tailSensorSpeed2', formatFn: speedFormat },
{ label: '1端速传1是否有效', key: 'aSpeedSensorEnableA', formatFn: upFormat },
{ label: '1端速传2是否有效', key: 'aSpeedSensorEnableB', formatFn: upFormat },
{ label: '1端速度输出', key: 'aAccOutSpeed', formatFn: msFormat },
{ label: '1端速度输出', key: 'aAccOutSpeed', formatFn: kmhFormat },
{ label: '2端速传1是否有效', key: 'bSpeedSensorEnableA', formatFn: upFormat },
{ label: '2端速传2是否有效', key: 'bSpeedSensorEnableB', formatFn: upFormat },
{ label: '2端速度输出', key: 'bAccOutSpeed', formatFn: msFormat },
{ label: '2端速度输出', key: 'bAccOutSpeed', formatFn: kmhFormat },
];
const list5: KeyType[] = [
// { label: '', key: 'headRadarSpeed', formatFn: speedFormat },
// { label: '', key: 'tailRadarSpeed', formatFn: speedFormat },
{ label: '1端雷达是否有效', key: 'aRadarEnable', formatFn: upFormat },
{ label: '1端雷达测速差值', key: 'aRadarCheckSpeedDiff', formatFn: msFormat },
{
label: '1端雷达检测时间(秒)',
label: '1端雷达测速差值',
key: 'aRadarCheckSpeedDiff',
formatFn: kmhFormat,
},
{
label: '1端雷达检测设置剩余时间(秒)',
key: 'aRadarCheckTime',
formatFn: timeFormat,
},
{ label: '1端雷达速度输出', key: 'aRadarOutSpeed', formatFn: msFormat },
{ label: '1端雷达速度输出', key: 'aRadarOutSpeed', formatFn: kmhFormat },
{ label: '2端雷达是否有效', key: 'bRadarEnable', formatFn: upFormat },
{ label: '2端雷达测速差值', key: 'bRadarCheckSpeedDiff', formatFn: msFormat },
{
label: '2端雷达检测时间',
label: '2端雷达测速差值',
key: 'bRadarCheckSpeedDiff',
formatFn: kmhFormat,
},
{
label: '2端雷达检测设置剩余时间',
key: 'bRadarCheckTime',
formatFn: timeFormat,
},
{ label: '2端雷达速度输出', key: 'bRadarOutSpeed', formatFn: msFormat },
{ label: '2端雷达速度输出', key: 'bRadarOutSpeed', formatFn: kmhFormat },
];
const list6: KeyType[] = [
{ label: '加速度', key: 'acceleration', formatFn: accelerationFormat },
{ label: '1端加速度计是否有效', key: 'aAccEnable', formatFn: upFormat },
{ label: '1端加速度测速差值', key: 'aAccCheckSpeedDiff', formatFn: msFormat },
{
label: '1端加速度持续时间',
label: '1端加速度持续设置剩余时间',
key: 'aAccCheckTime',
formatFn: timeFormat,
},
{ label: '2端加速度计是否有效', key: 'bAccEnable', formatFn: upFormat },
{ label: '2端加速度测速差值', key: 'bAccCheckSpeedDiff', formatFn: msFormat },
{
label: '2端加速度持续时间',
label: '2端加速度持续设置剩余时间',
key: 'bAccCheckTime',
formatFn: timeFormat,
},
@ -395,6 +403,9 @@ function percentFormat(v: number) {
function msFormat(v: number) {
return v + 'm/s';
}
function kmhFormat(v: number) {
return v + 'km/h';
}
function timeFormat(v: number) {
return v + 's';
}

View File

@ -40,6 +40,9 @@ export function getWebsocketUrl() {
host = 'joylink.club/bjrtsts-server';
port = '';
url = `${protocol}://${host}`;
} else if (process.env.URL_ENV == 'local_test') {
host = '192.168.33.233';
}
return `${url}/mqtt`;
}

View File

@ -107,7 +107,6 @@ export abstract class KeyInteraction<
mouseDownBeginRotation = 0;
changeRotation = 0;
keyInteractionConfig: IKeyInteractionConfig;
lastTimenRotation = 0;
constructor(
name: string,
app: IGraphicScene,
@ -155,7 +154,7 @@ export abstract class KeyInteraction<
this.mouseDownBeginPos = this.app.toCanvasCoordinates(e.global);
this.mouseDownBeginRotation = this.ratatingSprite.rotation;
this.changeRotation = this.mouseDownBeginRotation;
this.lastTimenRotation = this.ratatingSprite.rotation;
useTccStore().tccKeyLastRotation = this.ratatingSprite.rotation;
}
onMousemove(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
@ -204,8 +203,7 @@ export abstract class KeyInteraction<
this.changeRotation = this.mouseDownBeginRotation - Math.PI / 2;
}
}
if (this.lastTimenRotation !== this.changeRotation) {
this.lastTimenRotation = this.changeRotation;
if (this.ratatingSprite.rotation !== this.changeRotation) {
this.ratatingSprite.rotation = this.changeRotation;
useTccStore().onMouseUpFromTccKeyDir();
}

View File

@ -77,23 +77,23 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set devicePort(v: string) {
this.states.devicePort = v;
}
get pointTo(): boolean {
return this.states.pointTo;
get driftTo(): boolean {
return this.states.driftTo;
}
set pointTo(v: boolean) {
this.states.pointTo = v;
set driftTo(v: boolean) {
this.states.driftTo = v;
}
get runDirection(): boolean {
return this.states.runDirection;
get trainRunUp(): boolean {
return this.states.trainRunUp;
}
set runDirection(v: boolean) {
this.states.runDirection = v;
set trainRunUp(v: boolean) {
this.states.trainRunUp = v;
}
get headDirection(): boolean {
return this.states.headDirection;
get trainActiveDirection(): number {
return this.states.trainActiveDirection;
}
set headDirection(v: boolean) {
this.states.headDirection = v;
set trainActiveDirection(v: number) {
this.states.trainActiveDirection = v;
}
get trainKilometer(): number {
return this.states.trainKilometer;

View File

@ -470,6 +470,7 @@ function handleSubscribe(lineScene: IGraphicScene) {
states.push(new CarWashingState(item));
}
});
console.log(storage.allStatus.trainState, '====');
storage.allStatus.trainState.forEach((item) => {
// 列车
if (!item.show) {

View File

@ -40,12 +40,12 @@ export interface ITrainState extends GraphicState {
set headOffset(v: number);
get devicePort(): string;
set devicePort(v: string);
get pointTo(): boolean;
set pointTo(v: boolean);
get runDirection(): boolean;
set runDirection(v: boolean);
get headDirection(): boolean;
set headDirection(v: boolean);
get driftTo(): boolean;
set driftTo(v: boolean);
get trainRunUp(): boolean;
set trainRunUp(v: boolean);
get trainActiveDirection(): number;
set trainActiveDirection(v: number);
get trainKilometer(): number;
set trainKilometer(v: number);
get controlDelayTime(): number;
@ -335,10 +335,7 @@ export class TrainHead extends Container {
];
// 道岔时运行x轴是否在增大决定箭头方向
// 区段时是否从A到B决定箭头方向
if (
(states.devicePort && this.train.isSyntropy) ||
(!states.devicePort && states.pointTo)
) {
if (!this.train.arrowIsLeft) {
const aP: Array<number> = [];
arrowPoint.forEach((item, index) => {
if (index % 2 == 1) {
@ -349,25 +346,33 @@ export class TrainHead extends Container {
});
arrowPoint = aP;
}
if (
(states.devicePort && this.train.isSyntropy) ||
(!states.devicePort && states.pointTo)
) {
const pP: Array<number> = [];
pausePoint.forEach((item, index) => {
if (index % 2 == 1) {
const p = new Point(pausePoint[index - 1], item);
const newP = calculateMirrorPoint(new Point(0, 0), p);
pP.push(newP.x, newP.y);
}
});
pausePoint = pP;
this.pause.visible = true;
if (states.trainActiveDirection !== 0) {
let lineIsLeft;
if (states.driftTo === (states.trainActiveDirection === 1)) {
lineIsLeft = this.train.arrowIsLeft;
} else {
lineIsLeft = !this.train.arrowIsLeft;
}
if (!lineIsLeft) {
const pP: Array<number> = [];
pausePoint.forEach((item, index) => {
if (index % 2 == 1) {
const p = new Point(pausePoint[index - 1], item);
const newP = calculateMirrorPoint(new Point(0, 0), p);
pP.push(newP.x, newP.y);
}
});
pausePoint = pP;
}
const pColor = DiriveModelColorEnum.AM;
this.pause.lineStyle(pauseW, pColor, 1);
this.pause.moveTo(pausePoint[0], pausePoint[1]);
this.pause.lineTo(pausePoint[2], pausePoint[3]);
} else {
this.pause.visible = false;
}
const aColor = DiriveModelColorEnum.AM;
const pColor = DiriveModelColorEnum.AM;
this.pause.lineStyle(pauseW, pColor, 1);
this.pause.moveTo(pausePoint[0], pausePoint[1]);
this.pause.lineTo(pausePoint[2], pausePoint[3]);
const arrow = this.arrow;
arrow.beginFill(aColor, 1);
arrow.drawPolygon(arrowPoint);
@ -377,11 +382,11 @@ export class TrainHead extends Container {
} else {
this.arrow.visible = false;
}
if (states.tc1Active || states.tc2Active) {
this.pause.visible = true;
} else {
this.pause.visible = false;
}
// if (states.tc1Active || states.tc2Active) {
// this.pause.visible = true;
// } else {
// this.pause.visible = false;
// }
}
}
@ -488,14 +493,14 @@ export class Train extends JlGraphic {
trainHead: TrainHead;
trainbody: TrainBody;
statusTextMap: Map<string, StatusText> = new Map();
isSyntropy: boolean; //判断x坐标是否在增大
arrowIsLeft: boolean; // 箭头是否在列车body的相对左侧
constructor() {
super(Train.Type);
this.trainbody = new TrainBody(this);
this.trainHead = new TrainHead(this);
this.addChild(this.trainHead);
this.addChild(this.trainbody);
this.isSyntropy = false;
this.arrowIsLeft = true;
}
get datas(): ITrainData {
@ -562,14 +567,17 @@ export class Train extends JlGraphic {
}
allLength = getKmDistance(pKm, oKm);
const portP = points[points.length - 1];
const j = 10;
if (Math.abs(portP.x) < j) {
this.isSyntropy = this.states.runDirection;
} else {
if (this.states.pointTo) {
this.isSyntropy = 0 > portP.x;
if (portP.x === 0) {
if (this.states.driftTo) {
this.arrowIsLeft = 0 > portP.y;
} else {
this.isSyntropy = portP.x > 0;
this.arrowIsLeft = 0 < portP.y;
}
} else {
if (this.states.driftTo) {
this.arrowIsLeft = 0 < portP.x;
} else {
this.arrowIsLeft = portP.x < 0;
}
}
} else {
@ -610,7 +618,11 @@ export class Train extends JlGraphic {
allLength = getKmDistance(BKm, AKm);
const portS = points[0];
const portE = points[points.length - 1];
this.isSyntropy = portE.x > portS.x;
if (portE.x === portS.x) {
this.arrowIsLeft = portE.y < portS.y && !this.states.driftTo;
} else {
this.arrowIsLeft = portE.x > portS.x && !this.states.driftTo;
}
}
}
this.trainbody.doRepaint();
@ -637,9 +649,10 @@ export class Train extends JlGraphic {
}
const offset = this.states.headOffset / allLength; // 百分比偏移
let offsetL = totalLength * offset;
// 0.01为保证浮点数计算误差
const indexP = lengths.findIndex((l) => {
offsetL -= l;
return offsetL <= 0;
return offsetL <= 0.001;
});
const startP = points[indexP];
const endP = points[indexP + 1];

View File

@ -83,6 +83,7 @@
:width="tccCanvasWidth"
:height="tccCanvasHeight"
@hide="tccHide"
:title="`列车${tccStore.tccId}`"
>
<div id="tcc-app-container" class="overflow-hidden"></div>
</draggable-dialog>
@ -287,8 +288,8 @@ watch(
);
function tccHide() {
lineApp.getScene(`tcc${tccStore.tccId}`).unbindDom();
tccStore.clearTccParam();
lineApp.getScene('tcc').unbindDom();
}
watch(

View File

@ -793,6 +793,27 @@ const carWashingCjList = [
},
];
//区段继电器
const sectionCjList = [
{
code: 'GJ',
refDeviceCodesAndPos: [
[
{
code: 'GJ',
position: PostionType.Q,
},
],
[
{
code: 'GJ',
position: PostionType.H,
},
],
],
},
];
const DeviceType = graphicData.RelatedRef.DeviceType;
export const ciCjMap = new Map<string, CjData[]>([
[
@ -838,4 +859,5 @@ export const ciCjMap = new Map<string, CjData[]>([
[`${DeviceType.GarageDoor}+undefined`, garageDoorCjList],
[`${DeviceType.CarWashing}+undefined`, carWashingCjList],
[`${DeviceType.FloodGate}+undefined`, floodGateCjList],
[`${DeviceType.Section}+undefined`, sectionCjList],
]);

View File

@ -138,6 +138,14 @@ watch(changeScreenDoorGroup, (group) => {
});
});
//区段继电器
const sectionQdList = [
{
code: 'GJ',
refDeviceCodes: [['GJ']],
},
];
const DeviceType = graphicData.RelatedRef.DeviceType;
export const ciQdMap = new Map<string, QdData[]>([
[
@ -179,4 +187,5 @@ export const ciQdMap = new Map<string, QdData[]>([
[`${DeviceType.GarageDoor}+undefined`, garageDoorQdList],
[`${DeviceType.CarWashing}+undefined`, carWashingQdList],
[`${DeviceType.FloodGate}+undefined`, floodGateQdList],
[`${DeviceType.Section}+undefined`, sectionQdList],
]);

View File

@ -150,22 +150,42 @@ export function generateRelayLayout(relays: GenerateRelaysCongig[]) {
relayGroupElement.push(relays[i]);
} else if (
relays[i].deviceCode == relays[i - 1].deviceCode &&
relays[i].combinationCode == relays[i - 1].combinationCode
relays[i].combinationCode == relays[i - 1].combinationCode &&
relays[i].code != 'GJ' &&
relays[i].combinationCode != 'GJ'
) {
relayGroupElement.push(relays[i]);
} else if (relays[i].code == 'GJ' && relays[i].combinationCode == 'GJ') {
relayGroupElement.push(relays[i]);
} else {
relayGroup.push(relayGroupElement);
relayGroupElement = [];
relayGroupElement.push(relays[i]);
}
}
const lastCombination = relayGroupElement.filter(
(item) => item.deviceCode !== undefined
(item) =>
item.deviceCode !== undefined &&
item.code !== 'GJ' &&
item.combinationCode !== 'GJ'
);
const LSCombination = relayGroupElement.filter(
(item) => item.deviceCode == undefined
);
relayGroup.push(lastCombination, LSCombination);
const allSectionCombination = relayGroupElement.filter(
(item) => item.code == 'GJ' && item.combinationCode == 'GJ'
);
if (allSectionCombination.length) {
relayGroup.push(lastCombination);
for (let i = 0; i < allSectionCombination.length; i += 11) {
relayGroup.push(allSectionCombination.slice(i, i + 11));
}
relayGroup.push(LSCombination);
} else {
relayGroup.push(lastCombination, LSCombination);
}
const relayCabinet = generateRelayCabinet(relayGroup.length / 10);
for (let i = 0; i < relayCabinet.length; i++) {
generateRelaysFormat(

View File

@ -513,6 +513,19 @@ const carWashingCombinations = [
},
];
//区段继电器
const sectionCombinations = [
{
code: 'GJ',
refDeviceCodesAndModel: [
{
code: 'GJ',
model: RelayModelType.JWXC_1700,
},
],
},
];
const DeviceType = graphicData.RelatedRef.DeviceType;
export const combinationsMap = new Map<string, Combinationtype[]>([
[
@ -558,4 +571,5 @@ export const combinationsMap = new Map<string, Combinationtype[]>([
[`${DeviceType.GarageDoor}`, garageDoorCombinations],
[`${DeviceType.CarWashing}`, carWashingCombinations],
[`${DeviceType.FloodGate}`, floodGateCombinations],
[`${DeviceType.Section}`, sectionCombinations],
]);

View File

@ -197,6 +197,14 @@
label="集中站"
:rules="[(val) => val != '' || '集中站不能为空']"
></q-select>
<q-toggle
v-model="generaterRelayLayout.generateCJQD"
label="是否覆盖采集驱动数据"
/>
<q-toggle
v-model="generaterRelayLayout.generateSectionRelay"
label="是否生成区段继电器"
/>
<div class="q-gutter-sm q-pa-md row justify-center">
<q-btn
label="确定"
@ -469,7 +477,14 @@ const generaterRelayLayoutDialog = ref(false);
const generaterRelayLayout = ref<{
publishId: string;
centralizedStation: number;
}>({ publishId: '', centralizedStation: 0 });
generateCJQD: boolean;
generateSectionRelay: boolean;
}>({
publishId: '',
centralizedStation: 0,
generateCJQD: true,
generateSectionRelay: false,
});
let publishIdOption = ref<{ label: string; value: number }[]>();
let centralizedStationsOption = ref<{ label: string; value: number }[]>([
@ -804,6 +819,26 @@ function oneClickGeneraterRelayLayout() {
);
}
});
//
if (generaterRelayLayout.value.generateSectionRelay) {
storage.section.forEach((section) => {
if (section.sectionType == graphicData.Section.SectionType.Physical) {
const deviceCombinations = combinationsMap.get(
`${DeviceType.Section}`
);
if (
section.centralizedStations.includes(concentrationStation) &&
deviceCombinations
) {
creatDeviceRelateRelays(
deviceCombinations,
DeviceType.Section,
section.code
);
}
}
});
}
//--
const aboveCombinations = [
{
@ -827,180 +862,183 @@ function oneClickGeneraterRelayLayout() {
);
}
});
//
const deviceRelateRelayList = loadDeviceRelateRelayList();
const allCjData: relayCabinetGraphicData.CjData[] = [];
deviceRelateRelayList.forEach((deviceRelateRelay) => {
let deviceCiCjConfig;
if (deviceRelateRelay.deviceType !== DeviceType.CarWashing) {
deviceCiCjConfig = ciCjMap.get(
`${deviceRelateRelay.deviceType}+${allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
)}`
);
} else {
deviceCiCjConfig = ciCjMap.get(
`${deviceRelateRelay.deviceType}+undefined`
);
}
let copyDeviceCiCjConfig: CjData[] =
deviceCiCjConfig === undefined
? undefined
: JSON.parse(JSON.stringify(deviceCiCjConfig));
//EMP
if (
deviceRelateRelay.deviceType == DeviceType.station &&
deviceCiCjConfig
) {
const handleCopyDeviceCiCjConfig: CjData[] = [];
if (hasEMP_MKX_SPKS.hasEMP) {
const refDeviceCodesAndPos: {
code: string;
position: relayCabinetGraphicData.CjDataItem.PostionType;
}[][] = [];
deviceRelateRelay.combinationtypes[0].refRelays.forEach(
(relayId) => {
const code = generateRelays.find((g) => g.id == relayId)?.code;
if (code) {
refDeviceCodesAndPos.push(
[
{
code,
position: PostionType.Q,
},
],
[
{
code,
position: PostionType.H,
},
]
);
}
}
if (generaterRelayLayout.value.generateCJQD) {
//
const deviceRelateRelayList = loadDeviceRelateRelayList();
const allCjData: relayCabinetGraphicData.CjData[] = [];
deviceRelateRelayList.forEach((deviceRelateRelay) => {
let deviceCiCjConfig;
if (deviceRelateRelay.deviceType !== DeviceType.CarWashing) {
deviceCiCjConfig = ciCjMap.get(
`${deviceRelateRelay.deviceType}+${allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
)}`
);
} else {
deviceCiCjConfig = ciCjMap.get(
`${deviceRelateRelay.deviceType}+undefined`
);
handleCopyDeviceCiCjConfig?.push({
code: 'EMP',
refDeviceCodesAndPos,
});
}
if (hasEMP_MKX_SPKS.hasMKX) {
handleCopyDeviceCiCjConfig.push(deviceCiCjConfig[0]);
let copyDeviceCiCjConfig: CjData[] =
deviceCiCjConfig === undefined
? undefined
: JSON.parse(JSON.stringify(deviceCiCjConfig));
//EMP
if (
deviceRelateRelay.deviceType == DeviceType.station &&
deviceCiCjConfig
) {
const handleCopyDeviceCiCjConfig: CjData[] = [];
if (hasEMP_MKX_SPKS.hasEMP) {
const refDeviceCodesAndPos: {
code: string;
position: relayCabinetGraphicData.CjDataItem.PostionType;
}[][] = [];
deviceRelateRelay.combinationtypes[0].refRelays.forEach(
(relayId) => {
const code = generateRelays.find(
(g) => g.id == relayId
)?.code;
if (code) {
refDeviceCodesAndPos.push(
[
{
code,
position: PostionType.Q,
},
],
[
{
code,
position: PostionType.H,
},
]
);
}
}
);
handleCopyDeviceCiCjConfig?.push({
code: 'EMP',
refDeviceCodesAndPos,
});
}
if (hasEMP_MKX_SPKS.hasMKX) {
handleCopyDeviceCiCjConfig.push(deviceCiCjConfig[0]);
}
if (hasEMP_MKX_SPKS.hasSPKS) {
handleCopyDeviceCiCjConfig.push(deviceCiCjConfig[1]);
}
copyDeviceCiCjConfig = handleCopyDeviceCiCjConfig;
}
if (hasEMP_MKX_SPKS.hasSPKS) {
handleCopyDeviceCiCjConfig.push(deviceCiCjConfig[1]);
}
copyDeviceCiCjConfig = handleCopyDeviceCiCjConfig;
}
//
if (
deviceRelateRelay.deviceType == DeviceType.CarWashing &&
deviceCiCjConfig
) {
const duanNum = allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
) as string;
for (let i = 2; i <= +duanNum; i++) {
copyDeviceCiCjConfig[0].refDeviceCodesAndPos.push([
{
code: `TWJ${i}`,
position: PostionType.Q,
},
]);
copyDeviceCiCjConfig[1].refDeviceCodesAndPos.push(
[
//
if (
deviceRelateRelay.deviceType == DeviceType.CarWashing &&
deviceCiCjConfig
) {
const duanNum = allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
) as string;
for (let i = 2; i <= +duanNum; i++) {
copyDeviceCiCjConfig[0].refDeviceCodesAndPos.push([
{
code: `CFJ${i}`,
code: `TWJ${i}`,
position: PostionType.Q,
},
],
[
{
code: `CFJ${i}`,
position: PostionType.H,
},
]
);
]);
copyDeviceCiCjConfig[1].refDeviceCodesAndPos.push(
[
{
code: `CFJ${i}`,
position: PostionType.Q,
},
],
[
{
code: `CFJ${i}`,
position: PostionType.H,
},
]
);
}
}
}
copyDeviceCiCjConfig?.forEach((combinationtype) => {
combinationtype.refDeviceCodesAndPos.forEach((items) => {
const cjData: relayCabinetGraphicData.CjDataItem[] = [];
items.forEach((relay) => {
cjData.push(
new relayCabinetGraphicData.CjDataItem({
relayId: generateRelaysMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}+${combinationtype.code}+${relay.code}`
),
position: relay.position,
})
copyDeviceCiCjConfig?.forEach((combinationtype) => {
combinationtype.refDeviceCodesAndPos.forEach((items) => {
const cjData: relayCabinetGraphicData.CjDataItem[] = [];
items.forEach((relay) => {
cjData.push(
new relayCabinetGraphicData.CjDataItem({
relayId: generateRelaysMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}+${combinationtype.code}+${relay.code}`
),
position: relay.position,
})
);
});
allCjData.push(
new relayCabinetGraphicData.CjData({ refRelays: cjData })
);
});
allCjData.push(
new relayCabinetGraphicData.CjData({ refRelays: cjData })
);
});
});
});
creatCiCjListByCombinationtype(
32,
Math.ceil(allCjData.length / 32),
allCjData
);
creatCiCjListByCombinationtype(
32,
Math.ceil(allCjData.length / 32),
allCjData
);
//
const allQdData: relayCabinetGraphicData.QdData[] = [];
deviceRelateRelayList.forEach((deviceRelateRelay) => {
let deviceCiQdConfig: QdData[] | undefined;
let changeDeviceCiQdConfig: QdData[];
if (deviceRelateRelay.deviceType !== DeviceType.CarWashing) {
deviceCiQdConfig = ciQdMap.get(
`${deviceRelateRelay.deviceType}+${allDeviceModelMap.get(
//
const allQdData: relayCabinetGraphicData.QdData[] = [];
deviceRelateRelayList.forEach((deviceRelateRelay) => {
let deviceCiQdConfig: QdData[] | undefined;
let changeDeviceCiQdConfig: QdData[];
if (deviceRelateRelay.deviceType !== DeviceType.CarWashing) {
deviceCiQdConfig = ciQdMap.get(
`${deviceRelateRelay.deviceType}+${allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
)}`
);
changeDeviceCiQdConfig =
deviceCiQdConfig === undefined
? undefined
: JSON.parse(JSON.stringify(deviceCiQdConfig));
} else {
deviceCiQdConfig = ciQdMap.get(
`${deviceRelateRelay.deviceType}+undefined`
);
changeDeviceCiQdConfig =
deviceCiQdConfig === undefined
? undefined
: JSON.parse(JSON.stringify(deviceCiQdConfig));
const duanNum = allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
)}`
);
changeDeviceCiQdConfig =
deviceCiQdConfig === undefined
? undefined
: JSON.parse(JSON.stringify(deviceCiQdConfig));
} else {
deviceCiQdConfig = ciQdMap.get(
`${deviceRelateRelay.deviceType}+undefined`
);
changeDeviceCiQdConfig =
deviceCiQdConfig === undefined
? undefined
: JSON.parse(JSON.stringify(deviceCiQdConfig));
const duanNum = allDeviceModelMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
) as string;
for (let i = 2; i <= +duanNum; i++) {
changeDeviceCiQdConfig[0].refDeviceCodes.push([`TWJ${i}`]);
) as string;
for (let i = 2; i <= +duanNum; i++) {
changeDeviceCiQdConfig[0].refDeviceCodes.push([`TWJ${i}`]);
}
}
}
changeDeviceCiQdConfig?.forEach((combinationtype) => {
combinationtype.refDeviceCodes.forEach((items) => {
const qdData: number[] = [];
items.forEach((relayCode) => {
qdData.push(
generateRelaysMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}+${combinationtype.code}+${relayCode}`
) as number
changeDeviceCiQdConfig?.forEach((combinationtype) => {
combinationtype.refDeviceCodes.forEach((items) => {
const qdData: number[] = [];
items.forEach((relayCode) => {
qdData.push(
generateRelaysMap.get(
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}+${combinationtype.code}+${relayCode}`
) as number
);
});
allQdData.push(
new relayCabinetGraphicData.QdData({ refRelays: qdData })
);
});
allQdData.push(
new relayCabinetGraphicData.QdData({ refRelays: qdData })
);
});
});
});
creatCiQdListByCombinationtype(
32,
Math.ceil(allQdData.length / 32),
allQdData
);
creatCiQdListByCombinationtype(
32,
Math.ceil(allQdData.length / 32),
allQdData
);
}
//
generateRelayLayout(generateRelays);

View File

@ -25,6 +25,7 @@ export namespace common {
idlingD?: number;
stopSign?: number;
slide?: number;
trainLoad?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -80,6 +81,9 @@ export namespace common {
if ("slide" in data && data.slide != undefined) {
this.slide = data.slide;
}
if ("trainLoad" in data && data.trainLoad != undefined) {
this.trainLoad = data.trainLoad;
}
}
}
get davisParamA() {
@ -184,6 +188,12 @@ export namespace common {
set slide(value: number) {
pb_1.Message.setField(this, 18, value);
}
get trainLoad() {
return pb_1.Message.getFieldWithDefault(this, 19, 0) as number;
}
set trainLoad(value: number) {
pb_1.Message.setField(this, 19, value);
}
static fromObject(data: {
davisParamA?: number;
davisParamB?: number;
@ -202,6 +212,7 @@ export namespace common {
idlingD?: number;
stopSign?: number;
slide?: number;
trainLoad?: number;
}): TrainDynamicConfig {
const message = new TrainDynamicConfig({});
if (data.davisParamA != null) {
@ -255,6 +266,9 @@ export namespace common {
if (data.slide != null) {
message.slide = data.slide;
}
if (data.trainLoad != null) {
message.trainLoad = data.trainLoad;
}
return message;
}
toObject() {
@ -276,6 +290,7 @@ export namespace common {
idlingD?: number;
stopSign?: number;
slide?: number;
trainLoad?: number;
} = {};
if (this.davisParamA != null) {
data.davisParamA = this.davisParamA;
@ -328,6 +343,9 @@ export namespace common {
if (this.slide != null) {
data.slide = this.slide;
}
if (this.trainLoad != null) {
data.trainLoad = this.trainLoad;
}
return data;
}
serialize(): Uint8Array;
@ -368,6 +386,8 @@ export namespace common {
writer.writeInt32(17, this.stopSign);
if (this.slide != 0)
writer.writeFloat(18, this.slide);
if (this.trainLoad != 0)
writer.writeInt32(19, this.trainLoad);
if (!w)
return writer.getResultBuffer();
}
@ -428,6 +448,9 @@ export namespace common {
case 18:
message.slide = reader.readFloat();
break;
case 19:
message.trainLoad = reader.readInt32();
break;
default: reader.skipField();
}
}
@ -453,6 +476,8 @@ export namespace common {
accCheckTime?: number;
accOutSpeed?: number;
radarOutSpeed?: number;
radarCheckTimeOverAt?: number;
accCheckTimeOverAt?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -487,6 +512,12 @@ export namespace common {
if ("radarOutSpeed" in data && data.radarOutSpeed != undefined) {
this.radarOutSpeed = data.radarOutSpeed;
}
if ("radarCheckTimeOverAt" in data && data.radarCheckTimeOverAt != undefined) {
this.radarCheckTimeOverAt = data.radarCheckTimeOverAt;
}
if ("accCheckTimeOverAt" in data && data.accCheckTimeOverAt != undefined) {
this.accCheckTimeOverAt = data.accCheckTimeOverAt;
}
}
}
get speedSensorEnableA() {
@ -549,6 +580,18 @@ export namespace common {
set radarOutSpeed(value: number) {
pb_1.Message.setField(this, 10, value);
}
get radarCheckTimeOverAt() {
return pb_1.Message.getFieldWithDefault(this, 11, 0) as number;
}
set radarCheckTimeOverAt(value: number) {
pb_1.Message.setField(this, 11, value);
}
get accCheckTimeOverAt() {
return pb_1.Message.getFieldWithDefault(this, 12, 0) as number;
}
set accCheckTimeOverAt(value: number) {
pb_1.Message.setField(this, 12, value);
}
static fromObject(data: {
speedSensorEnableA?: boolean;
speedSensorEnableB?: boolean;
@ -560,6 +603,8 @@ export namespace common {
accCheckTime?: number;
accOutSpeed?: number;
radarOutSpeed?: number;
radarCheckTimeOverAt?: number;
accCheckTimeOverAt?: number;
}): TrainEndsState {
const message = new TrainEndsState({});
if (data.speedSensorEnableA != null) {
@ -592,6 +637,12 @@ export namespace common {
if (data.radarOutSpeed != null) {
message.radarOutSpeed = data.radarOutSpeed;
}
if (data.radarCheckTimeOverAt != null) {
message.radarCheckTimeOverAt = data.radarCheckTimeOverAt;
}
if (data.accCheckTimeOverAt != null) {
message.accCheckTimeOverAt = data.accCheckTimeOverAt;
}
return message;
}
toObject() {
@ -606,6 +657,8 @@ export namespace common {
accCheckTime?: number;
accOutSpeed?: number;
radarOutSpeed?: number;
radarCheckTimeOverAt?: number;
accCheckTimeOverAt?: number;
} = {};
if (this.speedSensorEnableA != null) {
data.speedSensorEnableA = this.speedSensorEnableA;
@ -637,6 +690,12 @@ export namespace common {
if (this.radarOutSpeed != null) {
data.radarOutSpeed = this.radarOutSpeed;
}
if (this.radarCheckTimeOverAt != null) {
data.radarCheckTimeOverAt = this.radarCheckTimeOverAt;
}
if (this.accCheckTimeOverAt != null) {
data.accCheckTimeOverAt = this.accCheckTimeOverAt;
}
return data;
}
serialize(): Uint8Array;
@ -663,6 +722,10 @@ export namespace common {
writer.writeInt32(9, this.accOutSpeed);
if (this.radarOutSpeed != 0)
writer.writeInt32(10, this.radarOutSpeed);
if (this.radarCheckTimeOverAt != 0)
writer.writeInt64(11, this.radarCheckTimeOverAt);
if (this.accCheckTimeOverAt != 0)
writer.writeInt64(12, this.accCheckTimeOverAt);
if (!w)
return writer.getResultBuffer();
}
@ -702,6 +765,12 @@ export namespace common {
case 10:
message.radarOutSpeed = reader.readInt32();
break;
case 11:
message.radarCheckTimeOverAt = reader.readInt64();
break;
case 12:
message.accCheckTimeOverAt = reader.readInt64();
break;
default: reader.skipField();
}
}

View File

@ -1146,9 +1146,9 @@ export namespace state {
headDeviceId?: number;
headOffset?: number;
devicePort?: string;
pointTo?: boolean;
runDirection?: boolean;
headDirection?: boolean;
driftTo?: boolean;
trainRunUp?: boolean;
trainActiveDirection?: number;
dynamicState?: TrainDynamicState;
vobcState?: TrainVobcState;
trainKilometer?: number;
@ -1163,6 +1163,7 @@ export namespace state {
btmState?: BTMState;
tcc?: TrainControlState;
connState?: TrainConnState;
pluseCount?: SensorSpeedPulseCount;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1191,14 +1192,14 @@ export namespace state {
if ("devicePort" in data && data.devicePort != undefined) {
this.devicePort = data.devicePort;
}
if ("pointTo" in data && data.pointTo != undefined) {
this.pointTo = data.pointTo;
if ("driftTo" in data && data.driftTo != undefined) {
this.driftTo = data.driftTo;
}
if ("runDirection" in data && data.runDirection != undefined) {
this.runDirection = data.runDirection;
if ("trainRunUp" in data && data.trainRunUp != undefined) {
this.trainRunUp = data.trainRunUp;
}
if ("headDirection" in data && data.headDirection != undefined) {
this.headDirection = data.headDirection;
if ("trainActiveDirection" in data && data.trainActiveDirection != undefined) {
this.trainActiveDirection = data.trainActiveDirection;
}
if ("dynamicState" in data && data.dynamicState != undefined) {
this.dynamicState = data.dynamicState;
@ -1242,6 +1243,9 @@ export namespace state {
if ("connState" in data && data.connState != undefined) {
this.connState = data.connState;
}
if ("pluseCount" in data && data.pluseCount != undefined) {
this.pluseCount = data.pluseCount;
}
}
}
get id() {
@ -1292,22 +1296,22 @@ export namespace state {
set devicePort(value: string) {
pb_1.Message.setField(this, 8, value);
}
get pointTo() {
get driftTo() {
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
}
set pointTo(value: boolean) {
set driftTo(value: boolean) {
pb_1.Message.setField(this, 9, value);
}
get runDirection() {
get trainRunUp() {
return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean;
}
set runDirection(value: boolean) {
set trainRunUp(value: boolean) {
pb_1.Message.setField(this, 10, value);
}
get headDirection() {
return pb_1.Message.getFieldWithDefault(this, 11, false) as boolean;
get trainActiveDirection() {
return pb_1.Message.getFieldWithDefault(this, 11, 0) as number;
}
set headDirection(value: boolean) {
set trainActiveDirection(value: number) {
pb_1.Message.setField(this, 11, value);
}
get dynamicState() {
@ -1418,6 +1422,15 @@ export namespace state {
get has_connState() {
return pb_1.Message.getField(this, 25) != null;
}
get pluseCount() {
return pb_1.Message.getWrapperField(this, SensorSpeedPulseCount, 26) as SensorSpeedPulseCount;
}
set pluseCount(value: SensorSpeedPulseCount) {
pb_1.Message.setWrapperField(this, 26, value);
}
get has_pluseCount() {
return pb_1.Message.getField(this, 26) != null;
}
static fromObject(data: {
id?: string;
up?: boolean;
@ -1427,9 +1440,9 @@ export namespace state {
headDeviceId?: number;
headOffset?: number;
devicePort?: string;
pointTo?: boolean;
runDirection?: boolean;
headDirection?: boolean;
driftTo?: boolean;
trainRunUp?: boolean;
trainActiveDirection?: number;
dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>;
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
@ -1444,6 +1457,7 @@ export namespace state {
btmState?: ReturnType<typeof BTMState.prototype.toObject>;
tcc?: ReturnType<typeof TrainControlState.prototype.toObject>;
connState?: ReturnType<typeof TrainConnState.prototype.toObject>;
pluseCount?: ReturnType<typeof SensorSpeedPulseCount.prototype.toObject>;
}): TrainState {
const message = new TrainState({});
if (data.id != null) {
@ -1470,14 +1484,14 @@ export namespace state {
if (data.devicePort != null) {
message.devicePort = data.devicePort;
}
if (data.pointTo != null) {
message.pointTo = data.pointTo;
if (data.driftTo != null) {
message.driftTo = data.driftTo;
}
if (data.runDirection != null) {
message.runDirection = data.runDirection;
if (data.trainRunUp != null) {
message.trainRunUp = data.trainRunUp;
}
if (data.headDirection != null) {
message.headDirection = data.headDirection;
if (data.trainActiveDirection != null) {
message.trainActiveDirection = data.trainActiveDirection;
}
if (data.dynamicState != null) {
message.dynamicState = TrainDynamicState.fromObject(data.dynamicState);
@ -1521,6 +1535,9 @@ export namespace state {
if (data.connState != null) {
message.connState = TrainConnState.fromObject(data.connState);
}
if (data.pluseCount != null) {
message.pluseCount = SensorSpeedPulseCount.fromObject(data.pluseCount);
}
return message;
}
toObject() {
@ -1533,9 +1550,9 @@ export namespace state {
headDeviceId?: number;
headOffset?: number;
devicePort?: string;
pointTo?: boolean;
runDirection?: boolean;
headDirection?: boolean;
driftTo?: boolean;
trainRunUp?: boolean;
trainActiveDirection?: number;
dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>;
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
@ -1550,6 +1567,7 @@ export namespace state {
btmState?: ReturnType<typeof BTMState.prototype.toObject>;
tcc?: ReturnType<typeof TrainControlState.prototype.toObject>;
connState?: ReturnType<typeof TrainConnState.prototype.toObject>;
pluseCount?: ReturnType<typeof SensorSpeedPulseCount.prototype.toObject>;
} = {};
if (this.id != null) {
data.id = this.id;
@ -1575,14 +1593,14 @@ export namespace state {
if (this.devicePort != null) {
data.devicePort = this.devicePort;
}
if (this.pointTo != null) {
data.pointTo = this.pointTo;
if (this.driftTo != null) {
data.driftTo = this.driftTo;
}
if (this.runDirection != null) {
data.runDirection = this.runDirection;
if (this.trainRunUp != null) {
data.trainRunUp = this.trainRunUp;
}
if (this.headDirection != null) {
data.headDirection = this.headDirection;
if (this.trainActiveDirection != null) {
data.trainActiveDirection = this.trainActiveDirection;
}
if (this.dynamicState != null) {
data.dynamicState = this.dynamicState.toObject();
@ -1626,6 +1644,9 @@ export namespace state {
if (this.connState != null) {
data.connState = this.connState.toObject();
}
if (this.pluseCount != null) {
data.pluseCount = this.pluseCount.toObject();
}
return data;
}
serialize(): Uint8Array;
@ -1648,12 +1669,12 @@ export namespace state {
writer.writeInt64(7, this.headOffset);
if (this.devicePort.length)
writer.writeString(8, this.devicePort);
if (this.pointTo != false)
writer.writeBool(9, this.pointTo);
if (this.runDirection != false)
writer.writeBool(10, this.runDirection);
if (this.headDirection != false)
writer.writeBool(11, this.headDirection);
if (this.driftTo != false)
writer.writeBool(9, this.driftTo);
if (this.trainRunUp != false)
writer.writeBool(10, this.trainRunUp);
if (this.trainActiveDirection != 0)
writer.writeUint32(11, this.trainActiveDirection);
if (this.has_dynamicState)
writer.writeMessage(12, this.dynamicState, () => this.dynamicState.serialize(writer));
if (this.has_vobcState)
@ -1682,6 +1703,8 @@ export namespace state {
writer.writeMessage(24, this.tcc, () => this.tcc.serialize(writer));
if (this.has_connState)
writer.writeMessage(25, this.connState, () => this.connState.serialize(writer));
if (this.has_pluseCount)
writer.writeMessage(26, this.pluseCount, () => this.pluseCount.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -1716,13 +1739,13 @@ export namespace state {
message.devicePort = reader.readString();
break;
case 9:
message.pointTo = reader.readBool();
message.driftTo = reader.readBool();
break;
case 10:
message.runDirection = reader.readBool();
message.trainRunUp = reader.readBool();
break;
case 11:
message.headDirection = reader.readBool();
message.trainActiveDirection = reader.readUint32();
break;
case 12:
reader.readMessage(message.dynamicState, () => message.dynamicState = TrainDynamicState.deserialize(reader));
@ -1766,6 +1789,9 @@ export namespace state {
case 25:
reader.readMessage(message.connState, () => message.connState = TrainConnState.deserialize(reader));
break;
case 26:
reader.readMessage(message.pluseCount, () => message.pluseCount = SensorSpeedPulseCount.deserialize(reader));
break;
default: reader.skipField();
}
}
@ -1778,6 +1804,96 @@ export namespace state {
return TrainState.deserialize(bytes);
}
}
export class SensorSpeedPulseCount extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
pulseCount1?: number;
pulseCount2?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("pulseCount1" in data && data.pulseCount1 != undefined) {
this.pulseCount1 = data.pulseCount1;
}
if ("pulseCount2" in data && data.pulseCount2 != undefined) {
this.pulseCount2 = data.pulseCount2;
}
}
}
get pulseCount1() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set pulseCount1(value: number) {
pb_1.Message.setField(this, 1, value);
}
get pulseCount2() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set pulseCount2(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
pulseCount1?: number;
pulseCount2?: number;
}): SensorSpeedPulseCount {
const message = new SensorSpeedPulseCount({});
if (data.pulseCount1 != null) {
message.pulseCount1 = data.pulseCount1;
}
if (data.pulseCount2 != null) {
message.pulseCount2 = data.pulseCount2;
}
return message;
}
toObject() {
const data: {
pulseCount1?: number;
pulseCount2?: number;
} = {};
if (this.pulseCount1 != null) {
data.pulseCount1 = this.pulseCount1;
}
if (this.pulseCount2 != null) {
data.pulseCount2 = this.pulseCount2;
}
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.pulseCount1 != 0)
writer.writeUint32(1, this.pulseCount1);
if (this.pulseCount2 != 0)
writer.writeUint32(2, this.pulseCount2);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SensorSpeedPulseCount {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SensorSpeedPulseCount();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.pulseCount1 = reader.readUint32();
break;
case 2:
message.pulseCount2 = reader.readUint32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): SensorSpeedPulseCount {
return SensorSpeedPulseCount.deserialize(bytes);
}
}
export class TrainDynamicState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@ -4085,9 +4201,9 @@ export namespace state {
headDeviceId?: number;
headOffset?: number;
devicePort?: string;
pointTo?: boolean;
runDirection?: boolean;
headDirection?: boolean;
driftTo?: boolean;
trainRunUp?: boolean;
trainActiveDirection?: number;
trainKilometer?: number;
controlDelayTime?: number;
wheelDiameter?: number;
@ -4175,14 +4291,14 @@ export namespace state {
if ("devicePort" in data && data.devicePort != undefined) {
this.devicePort = data.devicePort;
}
if ("pointTo" in data && data.pointTo != undefined) {
this.pointTo = data.pointTo;
if ("driftTo" in data && data.driftTo != undefined) {
this.driftTo = data.driftTo;
}
if ("runDirection" in data && data.runDirection != undefined) {
this.runDirection = data.runDirection;
if ("trainRunUp" in data && data.trainRunUp != undefined) {
this.trainRunUp = data.trainRunUp;
}
if ("headDirection" in data && data.headDirection != undefined) {
this.headDirection = data.headDirection;
if ("trainActiveDirection" in data && data.trainActiveDirection != undefined) {
this.trainActiveDirection = data.trainActiveDirection;
}
if ("trainKilometer" in data && data.trainKilometer != undefined) {
this.trainKilometer = data.trainKilometer;
@ -4411,22 +4527,22 @@ export namespace state {
set devicePort(value: string) {
pb_1.Message.setField(this, 8, value);
}
get pointTo() {
get driftTo() {
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
}
set pointTo(value: boolean) {
set driftTo(value: boolean) {
pb_1.Message.setField(this, 9, value);
}
get runDirection() {
get trainRunUp() {
return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean;
}
set runDirection(value: boolean) {
set trainRunUp(value: boolean) {
pb_1.Message.setField(this, 10, value);
}
get headDirection() {
return pb_1.Message.getFieldWithDefault(this, 11, false) as boolean;
get trainActiveDirection() {
return pb_1.Message.getFieldWithDefault(this, 11, 0) as number;
}
set headDirection(value: boolean) {
set trainActiveDirection(value: number) {
pb_1.Message.setField(this, 11, value);
}
get trainKilometer() {
@ -4807,9 +4923,9 @@ export namespace state {
headDeviceId?: number;
headOffset?: number;
devicePort?: string;
pointTo?: boolean;
runDirection?: boolean;
headDirection?: boolean;
driftTo?: boolean;
trainRunUp?: boolean;
trainActiveDirection?: number;
trainKilometer?: number;
controlDelayTime?: number;
wheelDiameter?: number;
@ -4895,14 +5011,14 @@ export namespace state {
if (data.devicePort != null) {
message.devicePort = data.devicePort;
}
if (data.pointTo != null) {
message.pointTo = data.pointTo;
if (data.driftTo != null) {
message.driftTo = data.driftTo;
}
if (data.runDirection != null) {
message.runDirection = data.runDirection;
if (data.trainRunUp != null) {
message.trainRunUp = data.trainRunUp;
}
if (data.headDirection != null) {
message.headDirection = data.headDirection;
if (data.trainActiveDirection != null) {
message.trainActiveDirection = data.trainActiveDirection;
}
if (data.trainKilometer != null) {
message.trainKilometer = data.trainKilometer;
@ -5093,9 +5209,9 @@ export namespace state {
headDeviceId?: number;
headOffset?: number;
devicePort?: string;
pointTo?: boolean;
runDirection?: boolean;
headDirection?: boolean;
driftTo?: boolean;
trainRunUp?: boolean;
trainActiveDirection?: number;
trainKilometer?: number;
controlDelayTime?: number;
wheelDiameter?: number;
@ -5180,14 +5296,14 @@ export namespace state {
if (this.devicePort != null) {
data.devicePort = this.devicePort;
}
if (this.pointTo != null) {
data.pointTo = this.pointTo;
if (this.driftTo != null) {
data.driftTo = this.driftTo;
}
if (this.runDirection != null) {
data.runDirection = this.runDirection;
if (this.trainRunUp != null) {
data.trainRunUp = this.trainRunUp;
}
if (this.headDirection != null) {
data.headDirection = this.headDirection;
if (this.trainActiveDirection != null) {
data.trainActiveDirection = this.trainActiveDirection;
}
if (this.trainKilometer != null) {
data.trainKilometer = this.trainKilometer;
@ -5388,12 +5504,12 @@ export namespace state {
writer.writeInt64(7, this.headOffset);
if (this.devicePort.length)
writer.writeString(8, this.devicePort);
if (this.pointTo != false)
writer.writeBool(9, this.pointTo);
if (this.runDirection != false)
writer.writeBool(10, this.runDirection);
if (this.headDirection != false)
writer.writeBool(11, this.headDirection);
if (this.driftTo != false)
writer.writeBool(9, this.driftTo);
if (this.trainRunUp != false)
writer.writeBool(10, this.trainRunUp);
if (this.trainActiveDirection != 0)
writer.writeUint32(11, this.trainActiveDirection);
if (this.trainKilometer != 0)
writer.writeInt64(12, this.trainKilometer);
if (this.controlDelayTime != 0)
@ -5546,13 +5662,13 @@ export namespace state {
message.devicePort = reader.readString();
break;
case 9:
message.pointTo = reader.readBool();
message.driftTo = reader.readBool();
break;
case 10:
message.runDirection = reader.readBool();
message.trainRunUp = reader.readBool();
break;
case 11:
message.headDirection = reader.readBool();
message.trainActiveDirection = reader.readUint32();
break;
case 12:
message.trainKilometer = reader.readInt64();
@ -9325,7 +9441,8 @@ export namespace state {
export enum Type {
Undefined = 0,
Dynamics = 1,
SemiPhysicalTrain = 2
SemiPhysicalTrain = 2,
Train_pc_sim = 3
}
export enum State {
Normal = 0,

View File

@ -5,10 +5,6 @@
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace request {
export enum DriverType {
ONE_END = 0,
TWO_END = 1
}
export class Relay extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
@ -1665,6 +1661,11 @@ export namespace request {
DIRECTION_KEY_SWITCH = 2,
HANDLER = 3
}
export enum Direction {
BACKWARD = 0,
FORWARD = 1,
NEUTRALWARD = 2
}
export class EmergentButton extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
@ -1736,7 +1737,6 @@ export namespace request {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
val?: boolean;
dt?: DriverType;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -1744,9 +1744,6 @@ export namespace request {
if ("val" in data && data.val != undefined) {
this.val = data.val;
}
if ("dt" in data && data.dt != undefined) {
this.dt = data.dt;
}
}
}
get val() {
@ -1755,36 +1752,22 @@ export namespace request {
set val(value: boolean) {
pb_1.Message.setField(this, 1, value);
}
get dt() {
return pb_1.Message.getFieldWithDefault(this, 2, DriverType.ONE_END) as DriverType;
}
set dt(value: DriverType) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
val?: boolean;
dt?: DriverType;
}): DriverKeySwitch {
const message = new DriverKeySwitch({});
if (data.val != null) {
message.val = data.val;
}
if (data.dt != null) {
message.dt = data.dt;
}
return message;
}
toObject() {
const data: {
val?: boolean;
dt?: DriverType;
} = {};
if (this.val != null) {
data.val = this.val;
}
if (this.dt != null) {
data.dt = this.dt;
}
return data;
}
serialize(): Uint8Array;
@ -1793,8 +1776,6 @@ export namespace request {
const writer = w || new pb_1.BinaryWriter();
if (this.val != false)
writer.writeBool(1, this.val);
if (this.dt != DriverType.ONE_END)
writer.writeEnum(2, this.dt);
if (!w)
return writer.getResultBuffer();
}
@ -1807,9 +1788,6 @@ export namespace request {
case 1:
message.val = reader.readBool();
break;
case 2:
message.dt = reader.readEnum();
break;
default: reader.skipField();
}
}

View File

@ -7,6 +7,7 @@ import { errorNotify } from 'src/utils/CommonNotify';
import { request } from 'src/protos/request';
import { TccHandle } from 'src/graphics/tccHandle/TccHandle';
import { TccKey } from 'src/graphics/tccKey/TccKey';
import { IGraphicApp } from 'jl-graphic';
export const useTccStore = defineStore('tcc', {
state: () => ({
@ -18,15 +19,16 @@ export const useTccStore = defineStore('tcc', {
tccHandleId: 0,
mouseDownOnTccKeyDir: false,
tccKeyDirId: 0,
tccKeyLastRotation: 0,
}),
actions: {
getTccScene() {
const lineApp = getLineApp();
if (!lineApp) throw Error('未初始化app');
try {
return lineApp.getScene('tcc');
return lineApp.getScene(`tcc${this.tccId}`);
} catch (error) {
const tccScene = initTccScene(lineApp, 'tcc');
const tccScene = initTccScene(lineApp, `tcc${this.tccId}`);
return tccScene;
}
},
@ -36,15 +38,14 @@ export const useTccStore = defineStore('tcc', {
this.isTccDialogOpen = true;
},
clearTccParam() {
this.tccId = 0;
this.trainControlMapId = 0;
this.isTccDialogOpen = false;
},
onMouseUpFromTccHandle() {
const simulationId = useLineStore().simulationId;
const tccHandle = this.getTccScene().queryStore.queryById<TccHandle>(
this.tccHandleId
);
const tccHandle = (getLineApp() as IGraphicApp)
.getScene(`tcc${this.tccId}`)
.queryStore.queryById<TccHandle>(this.tccHandleId);
if (!simulationId) return;
const handleVal = Number(
(-(tccHandle._tccHandle.y / 144) * 100).toFixed()
@ -62,9 +63,9 @@ export const useTccStore = defineStore('tcc', {
});
},
onMouseUpFromTccKeyDir() {
const tccKeyDir = this.getTccScene().queryStore.queryById<TccKey>(
this.tccKeyDirId
);
const tccKeyDir = (getLineApp() as IGraphicApp)
.getScene(`tcc${this.tccId}`)
.queryStore.queryById<TccKey>(this.tccKeyDirId);
let position = 0;
switch (tccKeyDir._tccKey.rotation) {
case Math.PI / 4:
@ -87,9 +88,14 @@ export const useTccStore = defineStore('tcc', {
dirKey: {
val: position,
},
}).catch((err) => {
errorNotify('操作失败', { message: err.origin.response.data.title });
});
})
.then(() => {
this.tccKeyLastRotation = tccKeyDir._tccKey.rotation;
})
.catch((err) => {
errorNotify('操作失败', { message: err.origin.response.data.title });
tccKeyDir._tccKey.rotation = this.tccKeyLastRotation;
});
},
},
});