根据段数动态生成洗车机继电器(考虑3段以上情况)
This commit is contained in:
parent
a07c75db68
commit
a3c639b414
@ -702,7 +702,7 @@ const garageDoorCjList = [
|
||||
const floodGateCjList = garageDoorCjList;
|
||||
|
||||
//洗车机
|
||||
const threecarWashingCjList = [
|
||||
const carWashingCjList = [
|
||||
{
|
||||
code: 'XCJ1',
|
||||
refDeviceCodesAndPos: [
|
||||
@ -718,18 +718,6 @@ const threecarWashingCjList = [
|
||||
position: PostionType.Q,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'TWJ2',
|
||||
position: PostionType.Q,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'TWJ3',
|
||||
position: PostionType.Q,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'TGQJ',
|
||||
@ -777,30 +765,6 @@ const threecarWashingCjList = [
|
||||
position: PostionType.H,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'CFJ2',
|
||||
position: PostionType.Q,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'CFJ2',
|
||||
position: PostionType.H,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'CFJ3',
|
||||
position: PostionType.Q,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'CFJ3',
|
||||
position: PostionType.H,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: 'JTJ',
|
||||
@ -829,24 +793,6 @@ const threecarWashingCjList = [
|
||||
},
|
||||
];
|
||||
|
||||
const twocarWashingCjList = threecarWashingCjList.map((cjData) => ({
|
||||
code: cjData.code,
|
||||
refDeviceCodesAndPos: cjData.refDeviceCodesAndPos
|
||||
.map((device) =>
|
||||
device.filter((item) => item.code !== 'TWJ3' && item.code !== 'CFJ3')
|
||||
)
|
||||
.filter((item) => item.length > 0),
|
||||
}));
|
||||
|
||||
const onecarWashingCjList = twocarWashingCjList.map((cjData) => ({
|
||||
code: cjData.code,
|
||||
refDeviceCodesAndPos: cjData.refDeviceCodesAndPos
|
||||
.map((device) =>
|
||||
device.filter((item) => item.code !== 'TWJ2' && item.code !== 'CFJ2')
|
||||
)
|
||||
.filter((item) => item.length > 0),
|
||||
}));
|
||||
|
||||
const DeviceType = graphicData.RelatedRef.DeviceType;
|
||||
export const ciCjMap = new Map<string, CjData[]>([
|
||||
[
|
||||
@ -890,8 +836,6 @@ export const ciCjMap = new Map<string, CjData[]>([
|
||||
[`${DeviceType.Breakers}+undefined`, breakersCjList],
|
||||
[`${DeviceType.PowerScreen}+undefined`, powerScreenCjList],
|
||||
[`${DeviceType.GarageDoor}+undefined`, garageDoorCjList],
|
||||
[`${DeviceType.CarWashing}+3`, threecarWashingCjList],
|
||||
[`${DeviceType.CarWashing}+2`, twocarWashingCjList],
|
||||
[`${DeviceType.CarWashing}+1`, onecarWashingCjList],
|
||||
[`${DeviceType.CarWashing}+undefined`, carWashingCjList],
|
||||
[`${DeviceType.FloodGate}+undefined`, floodGateCjList],
|
||||
]);
|
||||
|
@ -105,21 +105,7 @@ const garageDoorQdList = [
|
||||
|
||||
const floodGateQdList = garageDoorQdList;
|
||||
|
||||
const threecarWashingQdList = [
|
||||
{
|
||||
code: 'XCJ1',
|
||||
refDeviceCodes: [['XQJ'], ['TWJ1'], ['TWJ2'], ['TWJ3'], ['TGQJ']],
|
||||
},
|
||||
];
|
||||
|
||||
const twocarWashingQdList = [
|
||||
{
|
||||
code: 'XCJ1',
|
||||
refDeviceCodes: [['XQJ'], ['TWJ1'], ['TWJ2'], ['TGQJ']],
|
||||
},
|
||||
];
|
||||
|
||||
const onecarWashingQdList = [
|
||||
const carWashingQdList = [
|
||||
{
|
||||
code: 'XCJ1',
|
||||
refDeviceCodes: [['XQJ'], ['TWJ1'], ['TGQJ']],
|
||||
@ -191,8 +177,6 @@ export const ciQdMap = new Map<string, QdData[]>([
|
||||
[`${DeviceType.ScreenDoor}+down`, downScreenDoorQdList],
|
||||
[`${DeviceType.ScreenDoor}+up`, upScreenDoorQdList],
|
||||
[`${DeviceType.GarageDoor}+undefined`, garageDoorQdList],
|
||||
[`${DeviceType.CarWashing}+3`, threecarWashingQdList],
|
||||
[`${DeviceType.CarWashing}+2`, twocarWashingQdList],
|
||||
[`${DeviceType.CarWashing}+1`, onecarWashingQdList],
|
||||
[`${DeviceType.CarWashing}+undefined`, carWashingQdList],
|
||||
[`${DeviceType.FloodGate}+undefined`, floodGateQdList],
|
||||
]);
|
||||
|
@ -468,7 +468,7 @@ const garageDoorCombinations = [
|
||||
const floodGateCombinations = garageDoorCombinations;
|
||||
|
||||
//洗车机
|
||||
const threeCarWashingCombinations = [
|
||||
const carWashingCombinations = [
|
||||
{
|
||||
code: 'XCJ1',
|
||||
refDeviceCodesAndModel: [
|
||||
@ -480,14 +480,6 @@ const threeCarWashingCombinations = [
|
||||
code: 'TWJ1',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
},
|
||||
{
|
||||
code: 'TWJ2',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
},
|
||||
{
|
||||
code: 'TWJ3',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
},
|
||||
{
|
||||
code: 'TGQJ',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
@ -509,14 +501,6 @@ const threeCarWashingCombinations = [
|
||||
code: 'CFJ1',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
},
|
||||
{
|
||||
code: 'CFJ2',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
},
|
||||
{
|
||||
code: 'CFJ3',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
},
|
||||
{
|
||||
code: 'JTJ',
|
||||
model: RelayModelType.JWXC_1700,
|
||||
@ -529,24 +513,6 @@ const threeCarWashingCombinations = [
|
||||
},
|
||||
];
|
||||
|
||||
const twoCarWashingCombinations = threeCarWashingCombinations.map(
|
||||
(combination) => ({
|
||||
code: combination.code,
|
||||
refDeviceCodesAndModel: combination.refDeviceCodesAndModel.filter(
|
||||
(item) => item.code !== 'TWJ3' && item.code !== 'CFJ3'
|
||||
),
|
||||
})
|
||||
);
|
||||
|
||||
const oneCarWashingCombinations = twoCarWashingCombinations.map(
|
||||
(combination) => ({
|
||||
code: combination.code,
|
||||
refDeviceCodesAndModel: combination.refDeviceCodesAndModel.filter(
|
||||
(item) => item.code !== 'TWJ2' && item.code !== 'CFJ2'
|
||||
),
|
||||
})
|
||||
);
|
||||
|
||||
const DeviceType = graphicData.RelatedRef.DeviceType;
|
||||
export const combinationsMap = new Map<string, Combinationtype[]>([
|
||||
[
|
||||
@ -590,8 +556,6 @@ export const combinationsMap = new Map<string, Combinationtype[]>([
|
||||
[`${DeviceType.Breakers}`, breakersCombinations],
|
||||
[`${DeviceType.PowerScreen}`, powerScreenCombinations],
|
||||
[`${DeviceType.GarageDoor}`, garageDoorCombinations],
|
||||
[`${DeviceType.CarWashing + '+' + '3'}`, threeCarWashingCombinations],
|
||||
[`${DeviceType.CarWashing + '+' + '2'}`, twoCarWashingCombinations],
|
||||
[`${DeviceType.CarWashing + '+' + '1'}`, oneCarWashingCombinations],
|
||||
[`${DeviceType.CarWashing}`, carWashingCombinations],
|
||||
[`${DeviceType.FloodGate}`, floodGateCombinations],
|
||||
]);
|
||||
|
@ -260,7 +260,7 @@ import {
|
||||
import { generateRelayLayout, GenerateRelaysCongig } from './GeneraterDevice';
|
||||
import { getPublishMapInfoById, pageQuery } from 'src/api/PublishApi';
|
||||
import { ciCjMap, CjData, PostionType } from './GeneraterCiCjConfig';
|
||||
import { ciQdMap } from './GeneraterCiQdConfig';
|
||||
import { ciQdMap, QdData } from './GeneraterCiQdConfig';
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
@ -770,16 +770,31 @@ function oneClickGeneraterRelayLayout() {
|
||||
});
|
||||
//洗车机
|
||||
storage.carWashings.forEach((carWashing) => {
|
||||
const duanNum = carWashing.duanNum || 3;
|
||||
const duanNum = carWashing.duanNum || 1;
|
||||
const deviceCombinations = combinationsMap.get(
|
||||
`${DeviceType.CarWashing}+${duanNum}`
|
||||
`${DeviceType.CarWashing}`
|
||||
);
|
||||
let changeDeviceCombinations: Combinationtype[] = JSON.parse(
|
||||
JSON.stringify(deviceCombinations)
|
||||
);
|
||||
if (duanNum > 1) {
|
||||
for (let i = 2; i <= duanNum; i++) {
|
||||
changeDeviceCombinations[0].refDeviceCodesAndModel.push({
|
||||
code: `TWJ${i}`,
|
||||
model: RelayModelType.JWXC_1700,
|
||||
});
|
||||
changeDeviceCombinations[1].refDeviceCodesAndModel.push({
|
||||
code: `CFJ${i}`,
|
||||
model: RelayModelType.JWXC_1700,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (
|
||||
carWashing.centralizedStations.includes(concentrationStation) &&
|
||||
deviceCombinations
|
||||
changeDeviceCombinations
|
||||
) {
|
||||
creatDeviceRelateRelays(
|
||||
deviceCombinations,
|
||||
changeDeviceCombinations,
|
||||
DeviceType.CarWashing,
|
||||
carWashing.code
|
||||
);
|
||||
@ -817,14 +832,22 @@ function oneClickGeneraterRelayLayout() {
|
||||
const deviceRelateRelayList = loadDeviceRelateRelayList();
|
||||
const allCjData: relayCabinetGraphicData.CjData[] = [];
|
||||
deviceRelateRelayList.forEach((deviceRelateRelay) => {
|
||||
const deviceCiCjConfig = ciCjMap.get(
|
||||
`${deviceRelateRelay.deviceType}+${allDeviceModelMap.get(
|
||||
`${deviceRelateRelay.deviceType}+${deviceRelateRelay.code}`
|
||||
)}`
|
||||
);
|
||||
let copyDeviceCiCjConfig: CjData[] = JSON.parse(
|
||||
JSON.stringify(deviceCiCjConfig)
|
||||
);
|
||||
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 &&
|
||||
@ -870,6 +893,37 @@ function oneClickGeneraterRelayLayout() {
|
||||
}
|
||||
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(
|
||||
[
|
||||
{
|
||||
code: `CFJ${i}`,
|
||||
position: PostionType.Q,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
code: `CFJ${i}`,
|
||||
position: PostionType.H,
|
||||
},
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
copyDeviceCiCjConfig?.forEach((combinationtype) => {
|
||||
combinationtype.refDeviceCodesAndPos.forEach((items) => {
|
||||
const cjData: relayCabinetGraphicData.CjDataItem[] = [];
|
||||
@ -898,12 +952,35 @@ function oneClickGeneraterRelayLayout() {
|
||||
//根据生成的组合类型列表生成驱动列表
|
||||
const allQdData: relayCabinetGraphicData.QdData[] = [];
|
||||
deviceRelateRelayList.forEach((deviceRelateRelay) => {
|
||||
const deviceCiQdConfig = ciQdMap.get(
|
||||
`${deviceRelateRelay.deviceType}+${allDeviceModelMap.get(
|
||||
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}`
|
||||
)}`
|
||||
);
|
||||
deviceCiQdConfig?.forEach((combinationtype) => {
|
||||
) 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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user