Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client

This commit is contained in:
Yuan 2023-08-16 15:52:47 +08:00
commit 38e85d3dfd
11 changed files with 188 additions and 24 deletions

View File

@ -2,6 +2,7 @@ import { api } from 'src/boot/axios';
const platformUriBase = '/mock/platform/status'; const platformUriBase = '/mock/platform/status';
const stationUriBase = '/mock/rtu/status'; const stationUriBase = '/mock/rtu/status';
const serverUriBase = '/mock/server/send';
export interface mockPlatformParams { export interface mockPlatformParams {
emergstop: boolean; emergstop: boolean;
@ -71,3 +72,14 @@ export function mockSignalApi(
) { ) {
return api.post(`/mock/signal/status/${lineId}`, data); 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);
}

View File

@ -21,6 +21,16 @@
:options="optionsChoose" :options="optionsChoose"
label="车站控制模式转换" label="车站控制模式转换"
/> />
<q-checkbox
v-model="stationModel.ipRtuStusDown"
label="是否通信中断"
@update:model-value="onUpdate"
/>
<q-checkbox
v-model="stationModel.ipRtuStusInLocalCtrl"
label="是否站控"
@update:model-value="onUpdate"
/>
</q-form> </q-form>
</template> </template>
@ -64,6 +74,8 @@ function onUpdate() {
id: station.id, id: station.id,
}; };
const lineId = lineStore.lineId as number; const lineId = lineStore.lineId as number;
data.ipRtuStusDown = stationModel.ipRtuStusDown;
data.ipRtuStusInLocalCtrl = stationModel.ipRtuStusInLocalCtrl;
if (station) { if (station) {
switch (controlChange.value) { switch (controlChange.value) {
case '中控': case '中控':

View File

@ -17,7 +17,7 @@ import {
import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import { KilometerSystem } from 'src/graphics/signal/Signal'; import { KilometerSystem } from 'src/graphics/signal/Signal';
import { useLineStore } from 'src/stores/line-store'; 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 { export class StationData extends GraphicDataBase implements IStationData {
constructor(data?: graphicData.Station) { constructor(data?: graphicData.Station) {
@ -88,8 +88,12 @@ export class StationState extends GraphicStateBase implements IStationState {
} }
get code(): string { get code(): string {
if (this.states.id.length === 1) {
return '0' + this.states.id;
} else {
return this.states.id; return this.states.id;
} }
}
get ipRtuStusDown(): boolean { get ipRtuStusDown(): boolean {
return this.states.ipRtuStusDown; return this.states.ipRtuStusDown;
} }
@ -138,12 +142,18 @@ export class StationState extends GraphicStateBase implements IStationState {
const resetConfig: MenuItemOptions = { const resetConfig: MenuItemOptions = {
name: '重置状态', name: '重置状态',
}; };
const buleShow: MenuItemOptions = {
name: '蓝显',
};
const cancelBuleShow: MenuItemOptions = {
name: '取消蓝显',
};
const StationOperateMenu: ContextMenu = ContextMenu.init({ const StationOperateMenu: ContextMenu = ContextMenu.init({
name: '车站操作菜单', name: '车站操作菜单',
groups: [ groups: [
{ {
items: [resetConfig], items: [resetConfig, buleShow, cancelBuleShow],
}, },
], ],
}); });
@ -188,6 +198,28 @@ export class StationOperateInteraction extends GraphicInteractionPlugin<Station>
ipRtuStusInEmergencyCtrl: false, ipRtuStusInEmergencyCtrl: false,
id: station.id, 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 = () => { resetConfig.handler = () => {
const dataCopy = JSON.parse(JSON.stringify(data)); const dataCopy = JSON.parse(JSON.stringify(data));
mockStationApi(lineId, dataCopy) mockStationApi(lineId, dataCopy)

View File

@ -10,6 +10,7 @@ import {
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin'; import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
import { SectionConsts } from '../section/Section'; import { SectionConsts } from '../section/Section';
import { Station } from '../station/Station';
export interface ILogicSectionData extends GraphicData { export interface ILogicSectionData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
@ -97,9 +98,15 @@ export class LogicSection extends JlGraphic implements ILineGraphic {
if (this.datas.points.length < 2) { if (this.datas.points.length < 2) {
throw new Error('Link坐标数据异常'); throw new Error('Link坐标数据异常');
} }
const station = this.queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type
);
let lineColor = SectionConsts.idleColor; let lineColor = SectionConsts.idleColor;
if (this.states.cbtcOccupied) { if (station?.states.ipRtuStusDown) {
lineColor = SectionConsts.blueShowColor;
} else if (this.states.cbtcOccupied) {
lineColor = SectionConsts.cbtcOccupiedColor; lineColor = SectionConsts.cbtcOccupiedColor;
} else if (this.states.ciOccupied) { } else if (this.states.ciOccupied) {
lineColor = SectionConsts.ciOccupiedColor; lineColor = SectionConsts.ciOccupiedColor;
@ -130,7 +137,6 @@ export class LogicSection extends JlGraphic implements ILineGraphic {
}); });
this.speedLimitGraphic.clear(); this.speedLimitGraphic.clear();
if (this.states.speedLimit > 0) { if (this.states.speedLimit > 0) {
console.log(this.states.speedLimit);
this.speedLimitGraphic.lineStyle(1, SectionConsts.speedLimitLineColor); this.speedLimitGraphic.lineStyle(1, SectionConsts.speedLimitLineColor);
const [pointsL, pointsR] = this.getSpeedLimitPoints(); const [pointsL, pointsR] = this.getSpeedLimitPoints();
this.speedLimitGraphic.moveTo(pointsL[0].x, pointsL[0].y); this.speedLimitGraphic.moveTo(pointsL[0].x, pointsL[0].y);

View File

@ -76,6 +76,7 @@ export enum PlatformColorEnum {
doorGreen = '0x00FF00', //屏蔽门的颜色 doorGreen = '0x00FF00', //屏蔽门的颜色
doorRed = '0xff0000', doorRed = '0xff0000',
doorBlue = '0x4048C4', doorBlue = '0x4048C4',
blueShowColor = '0x3149c3',
} }
const platformConsts = { const platformConsts = {
@ -136,13 +137,15 @@ export class doorGraphic extends Container {
this.addChild(this.doorGraphic); this.addChild(this.doorGraphic);
this.addChild(this.doorCloseGraphic); this.addChild(this.doorCloseGraphic);
} }
draw(stateData: IPlatformState): void { draw(stateData: IPlatformState, ipRtuStusDown: boolean): void {
const doorGraphic = this.doorGraphic; const doorGraphic = this.doorGraphic;
const doorCloseGraphic = this.doorCloseGraphic; const doorCloseGraphic = this.doorCloseGraphic;
doorGraphic.clear(); doorGraphic.clear();
doorCloseGraphic.clear(); doorCloseGraphic.clear();
let lineColor = PlatformColorEnum.doorGreen; let lineColor = PlatformColorEnum.doorGreen;
if (stateData.psdCut) { if (ipRtuStusDown) {
lineColor = PlatformColorEnum.blueShowColor;
} else if (stateData.psdCut) {
lineColor = PlatformColorEnum.doorRed; lineColor = PlatformColorEnum.doorRed;
} }
doorGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor)); doorGraphic.lineStyle(platformConsts.lineWidth, new Color(lineColor));
@ -369,9 +372,13 @@ export class Platform extends JlGraphic {
return this.datas.code; return this.datas.code;
} }
doRepaint(): void { doRepaint(): void {
const station = this.queryStore.queryByCodeAndType<Station>(
this.states.rtuId > 9 ? '' + this.states.rtuId : '0' + this.states.rtuId,
Station.Type
);
this.doorGraphic.clear(); this.doorGraphic.clear();
if (this.datas.hasdoor) { if (this.datas.hasdoor) {
this.doorGraphic.draw(this.states); this.doorGraphic.draw(this.states, !!station?.states.ipRtuStusDown);
} }
this.platformGraphic.draw(this.states); this.platformGraphic.draw(this.states);
this.besideGraphic.draw(); this.besideGraphic.draw();
@ -408,6 +415,10 @@ export class Platform extends JlGraphic {
(-platformConsts.height * 10) / 11 (-platformConsts.height * 10) / 11
); );
} }
if (station?.states.ipRtuStusDown) {
return;
}
this.changeState(); this.changeState();
} }
changeState(): void { changeState(): void {

View File

@ -60,6 +60,7 @@ export const SectionConsts = {
atcInvalidColor: '#954', //atc报告失效 atcInvalidColor: '#954', //atc报告失效
blockedColor: '#606', //封锁 blockedColor: '#606', //封锁
overlapColor: '#ff0', //overlap overlapColor: '#ff0', //overlap
blueShowColor: '0x3149c3',
speedLimitLineColor: '#ff0', //限速线色 speedLimitLineColor: '#ff0', //限速线色
lineWidth: 5, lineWidth: 5,
}; };

View File

@ -13,7 +13,7 @@ export enum LampEnum {
greenLamp = '0X00FF00', greenLamp = '0X00FF00',
yellowLamp = '0XFFFF00', yellowLamp = '0XFFFF00',
whiteLamp = '0XFFFFFF', whiteLamp = '0XFFFFFF',
blueLamp = '0X0033FF', blueLamp = '0x3149c3',
} }
const lampConsts = { const lampConsts = {
@ -79,6 +79,13 @@ export class LampMainBody extends JlGraphic {
} }
this.chagneState(this.states); this.chagneState(this.states);
} }
setBlueShow() {
this.stopAnmiation();
this.lamps.forEach((lamp) => {
lamp.createLamp(LampEnum.blueLamp);
lamp.logicModeClear();
});
}
doRepaint() { doRepaint() {
// this.paint(this.lampNum, this.mirror, this.states); // this.paint(this.lampNum, this.mirror, this.states);
} }

View File

@ -9,6 +9,7 @@ import { calculateMirrorPoint } from 'src/jl-graphic';
import { LampMainBody } from './LampMainBody'; import { LampMainBody } from './LampMainBody';
import { drawArrow } from '../CommonGraphics'; import { drawArrow } from '../CommonGraphics';
import { SignalCode } from './SignalCode'; import { SignalCode } from './SignalCode';
import { Station } from '../station/Station';
export interface KilometerSystem { export interface KilometerSystem {
get coordinateSystem(): string; get coordinateSystem(): string;
@ -150,14 +151,22 @@ export class Signal extends JlGraphic {
doRepaint(): void { doRepaint(): void {
this.paint(); this.paint();
this.fleetMode.clear(); this.fleetMode.clear();
this.humanControl.clear();
const station = this.queryStore.queryByCodeAndType<Station>(
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) { if (this.states.fleetMode) {
this.createFleetMode(); this.createFleetMode();
} }
this.humanControl.clear();
if (this.states.autoRouteDisable) { if (this.states.autoRouteDisable) {
this.createHumanControl(); this.createHumanControl();
} }
} }
}
createFleetMode(): void { createFleetMode(): void {
const mirror = this.datas.mirror; const mirror = this.datas.mirror;
this.fleetMode.beginFill(SignalColorEnum.fleetModeColor, 1); this.fleetMode.beginFill(SignalColorEnum.fleetModeColor, 1);

View File

@ -6,7 +6,11 @@ import {
JlGraphicTemplate, JlGraphicTemplate,
VectorText, VectorText,
} from 'src/jl-graphic'; } 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 { export interface IStationData extends GraphicData {
get code(): string; // 车站索引 get code(): string; // 车站索引
@ -155,6 +159,7 @@ export class Station extends JlGraphic {
codeGraph: VectorText = new VectorText(''); //车站名 codeGraph: VectorText = new VectorText(''); //车站名
kilometerGraph: VectorText = new VectorText(''); //公里标 kilometerGraph: VectorText = new VectorText(''); //公里标
controlGraphic: constrolGraphic = new constrolGraphic(); controlGraphic: constrolGraphic = new constrolGraphic();
_ipRtuStusDown = false;
constructor() { constructor() {
super(Station.Type); super(Station.Type);
this.addChild(this.codeGraph); this.addChild(this.codeGraph);
@ -212,6 +217,44 @@ export class Station extends JlGraphic {
if (this.datas.hasControl) { if (this.datas.hasControl) {
controlGraphic.draw(this.states); controlGraphic.draw(this.states);
} }
if (this.states.ipRtuStusDown !== this._ipRtuStusDown) {
this._ipRtuStusDown = this.states.ipRtuStusDown;
this.handleBlueShow();
}
}
handleBlueShow() {
const signals = this.queryStore.queryByType<Signal>(Signal.Type);
const logicSections = this.queryStore.queryByType<LogicSection>(
LogicSection.Type
);
const turnouts = this.queryStore.queryByType<Turnout>(Turnout.Type);
const platfroms = this.queryStore.queryByType<Platform>(Platform.Type);
const trains = this.queryStore.queryByType<Train>(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();
}
});
} }
} }

View File

@ -14,6 +14,7 @@ import { TrainWindow } from '../trainWindow/TrainWindow';
import { Turnout } from '../turnout/Turnout'; import { Turnout } from '../turnout/Turnout';
import { LogicSection } from '../logicSection/LogicSection'; import { LogicSection } from '../logicSection/LogicSection';
import { Section } from '../section/Section'; import { Section } from '../section/Section';
import { Station } from '../station/Station';
export interface ITrainData extends GraphicData { export interface ITrainData extends GraphicData {
get code(): string; // 车号 get code(): string; // 车号
@ -230,6 +231,8 @@ export class TrainBody extends Container {
} }
clear() { clear() {
// this.codeRact.clear(); // this.codeRact.clear();
this.codeAGraph.text = '';
this.codeBGraph.text = '';
} }
getBodyWH(): bodyWH { getBodyWH(): bodyWH {
const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints(); const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints();
@ -354,6 +357,15 @@ export class Train extends JlGraphic {
} }
doRepaint(): void { doRepaint(): void {
const station = this.queryStore.queryByCodeAndType<Station>(
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); this.trainbody.doRepaint(this.states);
const bodyWH = this.trainbody.getBodyWH(); const bodyWH = this.trainbody.getBodyWH();
this.trainHead.doRepaint(this.states, bodyWH); this.trainHead.doRepaint(this.states, bodyWH);

View File

@ -20,6 +20,7 @@ import {
} from '../CommonGraphics'; } from '../CommonGraphics';
import { KilometerSystem } from '../signal/Signal'; import { KilometerSystem } from '../signal/Signal';
import Vector2 from 'src/jl-graphic/math/Vector2'; import Vector2 from 'src/jl-graphic/math/Vector2';
import { Station } from '../station/Station';
export interface ITurnoutData extends GraphicData { export interface ITurnoutData extends GraphicData {
get code(): string; get code(): string;
@ -52,6 +53,7 @@ export const TurnoutConsts = {
lockedColor: '#fff', //锁闭 && 故障锁闭 lockedColor: '#fff', //锁闭 && 故障锁闭
atcInvalidColor: '#954', //atc报告失效 atcInvalidColor: '#954', //atc报告失效
overlapColor: '#ff0', //overlap overlapColor: '#ff0', //overlap
blueShowColor: '0x3149c3',
lineWidth: 5, lineWidth: 5,
forkLenth: 20, forkLenth: 20,
labelFontSize: 12, labelFontSize: 12,
@ -136,6 +138,15 @@ export class TurnoutSection extends Graphics {
} }
break; break;
} }
const station = this.turnout.queryStore.queryByCodeAndType<Station>(
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 gap = this.port === TurnoutPort.A ? 0 : TurnoutConsts.forkLenth;
const start = getForkPoint(gap, pList[0]); const start = getForkPoint(gap, pList[0]);
this.clear() this.clear()
@ -378,7 +389,13 @@ export class Turnout extends JlGraphic {
doRepaint(): void { doRepaint(): void {
//线条颜色 //线条颜色
if (this.states.ipSingleSwitchStusCbtcOccupied) { const station = this.queryStore.queryByCodeAndType<Station>(
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; this.lineColor = TurnoutConsts.cbtcOccupiedColor;
} else if (this.states.ipSingleSwitchStusCiOccupied) { } else if (this.states.ipSingleSwitchStusCiOccupied) {
this.lineColor = TurnoutConsts.ciOccupiedColor; this.lineColor = TurnoutConsts.ciOccupiedColor;
@ -394,7 +411,6 @@ export class Turnout extends JlGraphic {
} else { } else {
this.lineColor = TurnoutConsts.idleColor; this.lineColor = TurnoutConsts.idleColor;
} }
this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint()); this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint());
this.graphics.fork.paint(); this.graphics.fork.paint();
@ -415,6 +431,12 @@ export class Turnout extends JlGraphic {
this.graphics.label.style.fill = TurnoutLabelColor.WHITE; 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) { if (this.states.ipSingleSwitchStusBlocked2) {
this.graphics.labelRect.clear().lineStyle(1, '#f00'); this.graphics.labelRect.clear().lineStyle(1, '#f00');
@ -426,11 +448,12 @@ export class Turnout extends JlGraphic {
width, width,
height height
); );
} else {
this.graphics.labelRect.clear();
} }
this.graphics.speedLimit.clear(); if (station?.states.ipRtuStusDown) {
return;
}
if ( if (
(this.states.speedLimit && this.states.speedLimit > 0) || (this.states.speedLimit && this.states.speedLimit > 0) ||
this.states.ipSingleSwitchStusTsrBmMain || this.states.ipSingleSwitchStusTsrBmMain ||
@ -479,10 +502,6 @@ export class Turnout extends JlGraphic {
]); ]);
} }
this.animation('flash')?.resume(); this.animation('flash')?.resume();
} else {
this.graphics.fork.visible = true;
this.graphics.sections.forEach((s) => (s.visible = true));
this.removeAnimation('flash');
} }
} }