From cde1cc2334c4b9187bb465c47fd9ebfd02a8e3d4 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 14 Aug 2023 10:55:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=BD=A6=E7=AB=99=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deviceStates/StationProperty.vue | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/components/state-app/deviceStates/StationProperty.vue b/src/components/state-app/deviceStates/StationProperty.vue index 96a780a..60545e4 100644 --- a/src/components/state-app/deviceStates/StationProperty.vue +++ b/src/components/state-app/deviceStates/StationProperty.vue @@ -21,6 +21,20 @@ :options="optionsChoose" label="车站控制模式转换" /> + + @@ -36,6 +50,17 @@ const stationModel = reactive(new StationState()); const optionsChoose = ['中控', '站控且允许转到中控', '站控且不允许转到中控']; const controlChange = ref(''); +const ipRtuStusDown = ref(''); +const ipRtuStusInLocalCtrl = ref(''); +const optionsChooseCommon = ['是', '否']; +enum showSelect { + 是 = 'true', + 否 = 'false', +} +enum showSelectData { + true = '是', + false = '否', +} lineStore.$subscribe; watch( @@ -43,6 +68,12 @@ watch( (val) => { if (val && val.type == Station.Type) { stationModel.copyFrom((val as Station).states as StationState); + ipRtuStusDown.value = (showSelectData as never)[ + stationModel.ipRtuStusDown + '' + ]; + ipRtuStusInLocalCtrl.value = (showSelectData as never)[ + stationModel.ipRtuStusInLocalCtrl + '' + ]; } } ); @@ -51,11 +82,23 @@ onMounted(() => { const station = lineStore.selectedGraphic as Station; if (station) { stationModel.copyFrom((station as Station).states as StationState); + ipRtuStusDown.value = (showSelectData as never)[ + stationModel.ipRtuStusDown + '' + ]; + ipRtuStusInLocalCtrl.value = (showSelectData as never)[ + stationModel.ipRtuStusInLocalCtrl + '' + ]; } }); function onUpdate() { const station = lineStore.selectedGraphic as Station; + stationModel.ipRtuStusDown = JSON.parse( + (showSelect as never)[ipRtuStusDown.value] + ); + stationModel.ipRtuStusInLocalCtrl = JSON.parse( + (showSelect as never)[ipRtuStusInLocalCtrl.value] + ); const data = { ipRtuStusDown: false, ipRtuStusInLocalCtrl: false, @@ -64,6 +107,10 @@ function onUpdate() { id: station.id, }; const lineId = lineStore.lineId as number; + data.ipRtuStusDown = JSON.parse((showSelect as never)[ipRtuStusDown.value]); + data.ipRtuStusInLocalCtrl = JSON.parse( + (showSelect as never)[ipRtuStusInLocalCtrl.value] + ); if (station) { switch (controlChange.value) { case '中控': From 5082d847bf270e05222162bbde302d0a01d71e5c Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 14 Aug 2023 13:22:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deviceStates/StationProperty.vue | 51 +++---------------- 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/src/components/state-app/deviceStates/StationProperty.vue b/src/components/state-app/deviceStates/StationProperty.vue index 60545e4..48b23de 100644 --- a/src/components/state-app/deviceStates/StationProperty.vue +++ b/src/components/state-app/deviceStates/StationProperty.vue @@ -21,19 +21,15 @@ :options="optionsChoose" label="车站控制模式转换" /> - - @@ -50,17 +46,6 @@ const stationModel = reactive(new StationState()); const optionsChoose = ['中控', '站控且允许转到中控', '站控且不允许转到中控']; const controlChange = ref(''); -const ipRtuStusDown = ref(''); -const ipRtuStusInLocalCtrl = ref(''); -const optionsChooseCommon = ['是', '否']; -enum showSelect { - 是 = 'true', - 否 = 'false', -} -enum showSelectData { - true = '是', - false = '否', -} lineStore.$subscribe; watch( @@ -68,12 +53,6 @@ watch( (val) => { if (val && val.type == Station.Type) { stationModel.copyFrom((val as Station).states as StationState); - ipRtuStusDown.value = (showSelectData as never)[ - stationModel.ipRtuStusDown + '' - ]; - ipRtuStusInLocalCtrl.value = (showSelectData as never)[ - stationModel.ipRtuStusInLocalCtrl + '' - ]; } } ); @@ -82,23 +61,11 @@ onMounted(() => { const station = lineStore.selectedGraphic as Station; if (station) { stationModel.copyFrom((station as Station).states as StationState); - ipRtuStusDown.value = (showSelectData as never)[ - stationModel.ipRtuStusDown + '' - ]; - ipRtuStusInLocalCtrl.value = (showSelectData as never)[ - stationModel.ipRtuStusInLocalCtrl + '' - ]; } }); function onUpdate() { const station = lineStore.selectedGraphic as Station; - stationModel.ipRtuStusDown = JSON.parse( - (showSelect as never)[ipRtuStusDown.value] - ); - stationModel.ipRtuStusInLocalCtrl = JSON.parse( - (showSelect as never)[ipRtuStusInLocalCtrl.value] - ); const data = { ipRtuStusDown: false, ipRtuStusInLocalCtrl: false, @@ -107,10 +74,8 @@ function onUpdate() { id: station.id, }; const lineId = lineStore.lineId as number; - data.ipRtuStusDown = JSON.parse((showSelect as never)[ipRtuStusDown.value]); - data.ipRtuStusInLocalCtrl = JSON.parse( - (showSelect as never)[ipRtuStusInLocalCtrl.value] - ); + data.ipRtuStusDown = stationModel.ipRtuStusDown; + data.ipRtuStusInLocalCtrl = stationModel.ipRtuStusInLocalCtrl; if (station) { switch (controlChange.value) { case '中控': From 15c3ae9a167d60e177b86b3ac1b3960dca357766 Mon Sep 17 00:00:00 2001 From: fan Date: Wed, 16 Aug 2023 14:02:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=93=9D=E6=98=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/PlatformApi.ts | 12 ++++++ src/drawApp/graphics/StationInteraction.ts | 38 ++++++++++++++++-- src/graphics/logicSection/LogicSection.ts | 10 ++++- src/graphics/platform/Platform.ts | 17 ++++++-- src/graphics/section/Section.ts | 1 + src/graphics/signal/LampMainBody.ts | 9 ++++- src/graphics/signal/Signal.ts | 19 ++++++--- src/graphics/station/Station.ts | 45 +++++++++++++++++++++- src/graphics/train/Train.ts | 12 ++++++ src/graphics/turnout/Turnout.ts | 37 +++++++++++++----- 10 files changed, 176 insertions(+), 24 deletions(-) diff --git a/src/api/PlatformApi.ts b/src/api/PlatformApi.ts index 860e81e..0f7d859 100644 --- a/src/api/PlatformApi.ts +++ b/src/api/PlatformApi.ts @@ -2,6 +2,7 @@ import { api } from 'src/boot/axios'; const platformUriBase = '/mock/platform/status'; const stationUriBase = '/mock/rtu/status'; +const serverUriBase = '/mock/server/send'; export interface mockPlatformParams { emergstop: boolean; @@ -71,3 +72,14 @@ export function mockSignalApi( ) { return api.post(`/mock/signal/status/${lineId}`, data); } + +export function mockServerApi(data: { + deviceType: string; + messageId: string; + lineId: number; + rtuId: number; + deviceName: string; + deviceStatus: number; +}) { + return api.post(serverUriBase, data); +} diff --git a/src/drawApp/graphics/StationInteraction.ts b/src/drawApp/graphics/StationInteraction.ts index 135c9df..8718cf3 100644 --- a/src/drawApp/graphics/StationInteraction.ts +++ b/src/drawApp/graphics/StationInteraction.ts @@ -17,7 +17,7 @@ import { import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; import { KilometerSystem } from 'src/graphics/signal/Signal'; import { useLineStore } from 'src/stores/line-store'; -import { mockStationApi } from 'src/api/PlatformApi'; +import { mockServerApi, mockStationApi } from 'src/api/PlatformApi'; export class StationData extends GraphicDataBase implements IStationData { constructor(data?: graphicData.Station) { @@ -88,7 +88,11 @@ export class StationState extends GraphicStateBase implements IStationState { } get code(): string { - return this.states.id; + if (this.states.id.length === 1) { + return '0' + this.states.id; + } else { + return this.states.id; + } } get ipRtuStusDown(): boolean { return this.states.ipRtuStusDown; @@ -138,12 +142,18 @@ export class StationState extends GraphicStateBase implements IStationState { const resetConfig: MenuItemOptions = { name: '重置状态', }; +const buleShow: MenuItemOptions = { + name: '蓝显', +}; +const cancelBuleShow: MenuItemOptions = { + name: '取消蓝显', +}; const StationOperateMenu: ContextMenu = ContextMenu.init({ name: '车站操作菜单', groups: [ { - items: [resetConfig], + items: [resetConfig, buleShow, cancelBuleShow], }, ], }); @@ -188,6 +198,28 @@ export class StationOperateInteraction extends GraphicInteractionPlugin ipRtuStusInEmergencyCtrl: false, id: station.id, }; + buleShow.handler = () => { + const data = { + deviceType: 'DEVICE_TYPE_RTU', + messageId: 'DEVICE_STATUS_CHANGE', + lineId: 3, + rtuId: station.states.rtuId, + deviceName: station.states.rtuId + '', + deviceStatus: 32768, + }; + mockServerApi(data); + }; + cancelBuleShow.handler = () => { + const data = { + deviceType: 'DEVICE_TYPE_RTU', + messageId: 'DEVICE_STATUS_CHANGE', + lineId: 3, + rtuId: station.states.rtuId, + deviceName: station.states.rtuId + '', + deviceStatus: 1, + }; + mockServerApi(data); + }; resetConfig.handler = () => { const dataCopy = JSON.parse(JSON.stringify(data)); mockStationApi(lineId, dataCopy) diff --git a/src/graphics/logicSection/LogicSection.ts b/src/graphics/logicSection/LogicSection.ts index 7af7479..55d9d75 100644 --- a/src/graphics/logicSection/LogicSection.ts +++ b/src/graphics/logicSection/LogicSection.ts @@ -10,6 +10,7 @@ import { } from 'src/jl-graphic'; import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin'; import { SectionConsts } from '../section/Section'; +import { Station } from '../station/Station'; export interface ILogicSectionData extends GraphicData { get code(): string; // 编号 @@ -97,9 +98,15 @@ export class LogicSection extends JlGraphic implements ILineGraphic { if (this.datas.points.length < 2) { throw new Error('Link坐标数据异常'); } + const station = this.queryStore.queryByCodeAndType( + this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, + Station.Type + ); let lineColor = SectionConsts.idleColor; - if (this.states.cbtcOccupied) { + if (station?.states.ipRtuStusDown) { + lineColor = SectionConsts.blueShowColor; + } else if (this.states.cbtcOccupied) { lineColor = SectionConsts.cbtcOccupiedColor; } else if (this.states.ciOccupied) { lineColor = SectionConsts.ciOccupiedColor; @@ -130,7 +137,6 @@ export class LogicSection extends JlGraphic implements ILineGraphic { }); this.speedLimitGraphic.clear(); if (this.states.speedLimit > 0) { - console.log(this.states.speedLimit); this.speedLimitGraphic.lineStyle(1, SectionConsts.speedLimitLineColor); const [pointsL, pointsR] = this.getSpeedLimitPoints(); this.speedLimitGraphic.moveTo(pointsL[0].x, pointsL[0].y); diff --git a/src/graphics/platform/Platform.ts b/src/graphics/platform/Platform.ts index 2e4f1c3..c269244 100644 --- a/src/graphics/platform/Platform.ts +++ b/src/graphics/platform/Platform.ts @@ -76,6 +76,7 @@ export enum PlatformColorEnum { doorGreen = '0x00FF00', //屏蔽门的颜色 doorRed = '0xff0000', doorBlue = '0x4048C4', + blueShowColor = '0x3149c3', } const platformConsts = { @@ -136,13 +137,15 @@ export class doorGraphic extends Container { this.addChild(this.doorGraphic); this.addChild(this.doorCloseGraphic); } - draw(stateData: IPlatformState): void { + draw(stateData: IPlatformState, ipRtuStusDown: boolean): void { const doorGraphic = this.doorGraphic; const doorCloseGraphic = this.doorCloseGraphic; doorGraphic.clear(); doorCloseGraphic.clear(); let lineColor = PlatformColorEnum.doorGreen; - if (stateData.psdCut) { + if (ipRtuStusDown) { + lineColor = PlatformColorEnum.blueShowColor; + } else if (stateData.psdCut) { lineColor = PlatformColorEnum.doorRed; } doorGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor)); @@ -369,9 +372,13 @@ export class Platform extends JlGraphic { return this.datas.code; } doRepaint(): void { + const station = this.queryStore.queryByCodeAndType( + this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, + Station.Type + ); this.doorGraphic.clear(); if (this.datas.hasdoor) { - this.doorGraphic.draw(this.states); + this.doorGraphic.draw(this.states, !!station?.states.ipRtuStusDown); } this.platformGraphic.draw(this.states); this.besideGraphic.draw(); @@ -408,6 +415,10 @@ export class Platform extends JlGraphic { (-platformConsts.height * 10) / 11 ); } + + if (station?.states.ipRtuStusDown) { + return; + } this.changeState(); } changeState(): void { diff --git a/src/graphics/section/Section.ts b/src/graphics/section/Section.ts index 66cc020..f17f721 100644 --- a/src/graphics/section/Section.ts +++ b/src/graphics/section/Section.ts @@ -60,6 +60,7 @@ export const SectionConsts = { atcInvalidColor: '#954', //atc报告失效 blockedColor: '#606', //封锁 overlapColor: '#ff0', //overlap + blueShowColor: '0x3149c3', speedLimitLineColor: '#ff0', //限速线色 lineWidth: 5, }; diff --git a/src/graphics/signal/LampMainBody.ts b/src/graphics/signal/LampMainBody.ts index e1419b5..9a7c322 100644 --- a/src/graphics/signal/LampMainBody.ts +++ b/src/graphics/signal/LampMainBody.ts @@ -13,7 +13,7 @@ export enum LampEnum { greenLamp = '0X00FF00', yellowLamp = '0XFFFF00', whiteLamp = '0XFFFFFF', - blueLamp = '0X0033FF', + blueLamp = '0x3149c3', } const lampConsts = { @@ -79,6 +79,13 @@ export class LampMainBody extends JlGraphic { } this.chagneState(this.states); } + setBlueShow() { + this.stopAnmiation(); + this.lamps.forEach((lamp) => { + lamp.createLamp(LampEnum.blueLamp); + lamp.logicModeClear(); + }); + } doRepaint() { // this.paint(this.lampNum, this.mirror, this.states); } diff --git a/src/graphics/signal/Signal.ts b/src/graphics/signal/Signal.ts index 01b5659..81cef92 100644 --- a/src/graphics/signal/Signal.ts +++ b/src/graphics/signal/Signal.ts @@ -9,6 +9,7 @@ import { calculateMirrorPoint } from 'src/jl-graphic'; import { LampMainBody } from './LampMainBody'; import { drawArrow } from '../CommonGraphics'; import { SignalCode } from './SignalCode'; +import { Station } from '../station/Station'; export interface KilometerSystem { get coordinateSystem(): string; @@ -150,12 +151,20 @@ export class Signal extends JlGraphic { doRepaint(): void { this.paint(); this.fleetMode.clear(); - if (this.states.fleetMode) { - this.createFleetMode(); - } this.humanControl.clear(); - if (this.states.autoRouteDisable) { - this.createHumanControl(); + const station = this.queryStore.queryByCodeAndType( + this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, + Station.Type + ); + if (station?.states.ipRtuStusDown) { + this.lampMainBody.setBlueShow(); + } else { + if (this.states.fleetMode) { + this.createFleetMode(); + } + if (this.states.autoRouteDisable) { + this.createHumanControl(); + } } } createFleetMode(): void { diff --git a/src/graphics/station/Station.ts b/src/graphics/station/Station.ts index fea15d4..6069af1 100644 --- a/src/graphics/station/Station.ts +++ b/src/graphics/station/Station.ts @@ -6,7 +6,11 @@ import { JlGraphicTemplate, VectorText, } from 'src/jl-graphic'; -import { KilometerSystem } from '../signal/Signal'; +import { LogicSection } from '../logicSection/LogicSection'; +import { Platform } from '../platform/Platform'; +import { KilometerSystem, Signal } from '../signal/Signal'; +import { Train } from '../train/Train'; +import { Turnout } from '../turnout/Turnout'; export interface IStationData extends GraphicData { get code(): string; // 车站索引 @@ -155,6 +159,7 @@ export class Station extends JlGraphic { codeGraph: VectorText = new VectorText(''); //车站名 kilometerGraph: VectorText = new VectorText(''); //公里标 controlGraphic: constrolGraphic = new constrolGraphic(); + _ipRtuStusDown = false; constructor() { super(Station.Type); this.addChild(this.codeGraph); @@ -212,6 +217,44 @@ export class Station extends JlGraphic { if (this.datas.hasControl) { controlGraphic.draw(this.states); } + if (this.states.ipRtuStusDown !== this._ipRtuStusDown) { + this._ipRtuStusDown = this.states.ipRtuStusDown; + this.handleBlueShow(); + } + } + handleBlueShow() { + const signals = this.queryStore.queryByType(Signal.Type); + const logicSections = this.queryStore.queryByType( + LogicSection.Type + ); + const turnouts = this.queryStore.queryByType(Turnout.Type); + const platfroms = this.queryStore.queryByType(Platform.Type); + const trains = this.queryStore.queryByType(Train.Type); + signals.forEach((signal) => { + if (signal.states.rtuId === this.states.rtuId) { + signal.doRepaint(); + } + }); + logicSections.forEach((logicSection) => { + if (logicSection.states.rtuId === this.states.rtuId) { + logicSection.doRepaint(); + } + }); + turnouts.forEach((turnout) => { + if (turnout.states.rtuId === this.states.rtuId) { + turnout.doRepaint(); + } + }); + platfroms.forEach((platform) => { + if (platform.states.rtuId === this.states.rtuId) { + platform.doRepaint(); + } + }); + trains.forEach((train) => { + if (train.states.rtuId === this.states.rtuId) { + train.doRepaint(); + } + }); } } diff --git a/src/graphics/train/Train.ts b/src/graphics/train/Train.ts index 6fcb0bf..94eb1c3 100644 --- a/src/graphics/train/Train.ts +++ b/src/graphics/train/Train.ts @@ -14,6 +14,7 @@ import { TrainWindow } from '../trainWindow/TrainWindow'; import { Turnout } from '../turnout/Turnout'; import { LogicSection } from '../logicSection/LogicSection'; import { Section } from '../section/Section'; +import { Station } from '../station/Station'; export interface ITrainData extends GraphicData { get code(): string; // 车号 @@ -230,6 +231,8 @@ export class TrainBody extends Container { } clear() { // this.codeRact.clear(); + this.codeAGraph.text = ''; + this.codeBGraph.text = ''; } getBodyWH(): bodyWH { const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints(); @@ -354,6 +357,15 @@ export class Train extends JlGraphic { } doRepaint(): void { + const station = this.queryStore.queryByCodeAndType( + this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, + Station.Type + ); + if (station?.states.ipRtuStusDown) { + this.trainHead.clear(); + this.trainbody.clear(); + return; + } this.trainbody.doRepaint(this.states); const bodyWH = this.trainbody.getBodyWH(); this.trainHead.doRepaint(this.states, bodyWH); diff --git a/src/graphics/turnout/Turnout.ts b/src/graphics/turnout/Turnout.ts index 885cc8d..2bc9875 100644 --- a/src/graphics/turnout/Turnout.ts +++ b/src/graphics/turnout/Turnout.ts @@ -20,6 +20,7 @@ import { } from '../CommonGraphics'; import { KilometerSystem } from '../signal/Signal'; import Vector2 from 'src/jl-graphic/math/Vector2'; +import { Station } from '../station/Station'; export interface ITurnoutData extends GraphicData { get code(): string; @@ -52,6 +53,7 @@ export const TurnoutConsts = { lockedColor: '#fff', //锁闭 && 故障锁闭 atcInvalidColor: '#954', //atc报告失效 overlapColor: '#ff0', //overlap + blueShowColor: '0x3149c3', lineWidth: 5, forkLenth: 20, labelFontSize: 12, @@ -136,6 +138,15 @@ export class TurnoutSection extends Graphics { } break; } + const station = this.turnout.queryStore.queryByCodeAndType( + this.turnout.states.rtuId > 9 + ? '' + this.turnout.states.rtuId + : '0' + this.turnout.states.rtuId, + Station.Type + ); + if (station?.states.ipRtuStusDown) { + lineColor = TurnoutConsts.blueShowColor; + } const gap = this.port === TurnoutPort.A ? 0 : TurnoutConsts.forkLenth; const start = getForkPoint(gap, pList[0]); this.clear() @@ -378,7 +389,13 @@ export class Turnout extends JlGraphic { doRepaint(): void { //线条颜色 - if (this.states.ipSingleSwitchStusCbtcOccupied) { + const station = this.queryStore.queryByCodeAndType( + this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId, + Station.Type + ); + if (station?.states.ipRtuStusDown) { + this.lineColor = TurnoutConsts.blueShowColor; + } else if (this.states.ipSingleSwitchStusCbtcOccupied) { this.lineColor = TurnoutConsts.cbtcOccupiedColor; } else if (this.states.ipSingleSwitchStusCiOccupied) { this.lineColor = TurnoutConsts.ciOccupiedColor; @@ -394,7 +411,6 @@ export class Turnout extends JlGraphic { } else { this.lineColor = TurnoutConsts.idleColor; } - this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint()); this.graphics.fork.paint(); @@ -415,6 +431,12 @@ export class Turnout extends JlGraphic { this.graphics.label.style.fill = TurnoutLabelColor.WHITE; } + this.graphics.labelRect.clear(); + this.graphics.speedLimit.clear(); + this.graphics.fork.visible = true; + this.graphics.sections.forEach((s) => (s.visible = true)); + this.removeAnimation('flash'); + //文字框 if (this.states.ipSingleSwitchStusBlocked2) { this.graphics.labelRect.clear().lineStyle(1, '#f00'); @@ -426,11 +448,12 @@ export class Turnout extends JlGraphic { width, height ); - } else { - this.graphics.labelRect.clear(); } - this.graphics.speedLimit.clear(); + if (station?.states.ipRtuStusDown) { + return; + } + if ( (this.states.speedLimit && this.states.speedLimit > 0) || this.states.ipSingleSwitchStusTsrBmMain || @@ -479,10 +502,6 @@ export class Turnout extends JlGraphic { ]); } this.animation('flash')?.resume(); - } else { - this.graphics.fork.visible = true; - this.graphics.sections.forEach((s) => (s.visible = true)); - this.removeAnimation('flash'); } }