stand2026_10_06
This commit is contained in:
1 parent
73015386e9
commit
30292794ae
25 files changed
+657
-157
No files matched your search
@@ -1,3 +1,5 @@
|
|||||||
|
import { SignalCreateDto } from "./signals";
|
||||||
|
|
||||||
export enum ComponentTypes {
|
export enum ComponentTypes {
|
||||||
UNKNOWN = "unknown",
|
UNKNOWN = "unknown",
|
||||||
ANTRIEB = "Antrieb",
|
ANTRIEB = "Antrieb",
|
||||||
@@ -9,6 +11,7 @@ export enum ComponentTypes {
|
|||||||
DREHZALHL = "Drehzahl",
|
DREHZALHL = "Drehzahl",
|
||||||
VORORT = "Vorortbedienung",
|
VORORT = "Vorortbedienung",
|
||||||
UEBERWACHUNG = "Überwachung",
|
UEBERWACHUNG = "Überwachung",
|
||||||
|
FUELLSTAND = "Fuellstand",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +27,6 @@ export class ComponentResponseDto {
|
|||||||
postfix?: string;
|
postfix?: string;
|
||||||
index?:number;
|
index?:number;
|
||||||
type!: ComponentTypes;
|
type!: ComponentTypes;
|
||||||
signalIds!: string[];
|
|
||||||
properties?: Record<string, unknown>;
|
properties?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +36,6 @@ export class ComponentUpdateDto {
|
|||||||
postfix?: string;
|
postfix?: string;
|
||||||
index?:number;
|
index?:number;
|
||||||
type?: ComponentTypes;
|
type?: ComponentTypes;
|
||||||
signalIds?: string[];
|
|
||||||
properties?: Record<string, unknown>;
|
properties?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,5 @@ export class ComponentCreateDto {
|
|||||||
postfix?: string;
|
postfix?: string;
|
||||||
index?:number;
|
index?:number;
|
||||||
type!: ComponentTypes;
|
type!: ComponentTypes;
|
||||||
signalIds?: string[];
|
|
||||||
properties?: Record<string, unknown>;
|
properties?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ export enum UnitTypeDto {
|
|||||||
BRECHER = 'Brecher',
|
BRECHER = 'Brecher',
|
||||||
WEICHE = 'Weiche',
|
WEICHE = 'Weiche',
|
||||||
SIEB = 'Sieb',
|
SIEB = 'Sieb',
|
||||||
|
ANTRIEB = 'Antrieb',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ export class UnitResponseDto {
|
|||||||
anlageId?: string;
|
anlageId?: string;
|
||||||
bmk?: string;
|
bmk?: string;
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
|
postfix?: string;
|
||||||
info?: string;
|
info?: string;
|
||||||
type!: UnitTypeDto;
|
type!: UnitTypeDto;
|
||||||
groupId!: string;
|
groupId!: string;
|
||||||
@@ -28,20 +30,22 @@ export class UnitResponseDto {
|
|||||||
export class UnitCreateDto {
|
export class UnitCreateDto {
|
||||||
name!: string;
|
name!: string;
|
||||||
anlageId?: string;
|
anlageId?: string;
|
||||||
bmk!: string;
|
bmk?: string;
|
||||||
prefix!: string;
|
prefix?: string;
|
||||||
info!: string;
|
postfix?: string;
|
||||||
|
info?: string;
|
||||||
type!: UnitTypeDto;
|
type!: UnitTypeDto;
|
||||||
groupId!: string;
|
groupId?: string;
|
||||||
components!: ComponentResponseDto[];
|
components?: ComponentResponseDto[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UnitUpdateBaseDto {
|
export class UnitUpdateBaseDto {
|
||||||
name?: string;
|
name?: string;
|
||||||
anlageId?: string;
|
anlageId?: string;
|
||||||
bmk!: string;
|
bmk?: string;
|
||||||
prefix!: string;
|
prefix?: string;
|
||||||
info!: string;
|
postfix?: string;
|
||||||
|
info?: string;
|
||||||
|
|
||||||
type?: UnitTypeDto;
|
type?: UnitTypeDto;
|
||||||
groupId?: string;
|
groupId?: string;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export class DrawDto {
|
|||||||
px_width!:number;
|
px_width!:number;
|
||||||
offset_x!:number;
|
offset_x!:number;
|
||||||
offset_y!:number;
|
offset_y!:number;
|
||||||
|
xaml?:string
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,6 @@ export class Component {
|
|||||||
@Prop({ required: true })
|
@Prop({ required: true })
|
||||||
type!: string;
|
type!: string;
|
||||||
|
|
||||||
@Prop({
|
|
||||||
type: [{ type: Types.ObjectId, ref: 'Signal' }],
|
|
||||||
default: [],
|
|
||||||
})
|
|
||||||
signalIds!: Types.ObjectId[];
|
|
||||||
|
|
||||||
@Prop({ type: Object })
|
@Prop({ type: Object })
|
||||||
properties?: Record<string, unknown>;
|
properties?: Record<string, unknown>;
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ export type GroupDocument = HydratedDocument<Group>;
|
|||||||
|
|
||||||
@Schema({ timestamps: true })
|
@Schema({ timestamps: true })
|
||||||
export class Group {
|
export class Group {
|
||||||
|
@Prop({ required: true })
|
||||||
|
anlageId!: Types.ObjectId;
|
||||||
|
|
||||||
@Prop({ required: true })
|
@Prop({ required: true })
|
||||||
name!: string;
|
name!: string;
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export class Unit {
|
|||||||
@Prop({ required: true })
|
@Prop({ required: true })
|
||||||
name!: string;
|
name!: string;
|
||||||
|
|
||||||
@Prop({ required: false })
|
@Prop({ required: true })
|
||||||
anlageId?: string;
|
anlageId!: Types.ObjectId;
|
||||||
|
|
||||||
@Prop()
|
@Prop()
|
||||||
bmk?: string;
|
bmk?: string;
|
||||||
@@ -24,6 +24,9 @@ export class Unit {
|
|||||||
@Prop()
|
@Prop()
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
|
|
||||||
|
@Prop()
|
||||||
|
postfix?: string;
|
||||||
|
|
||||||
@Prop()
|
@Prop()
|
||||||
info?: string;
|
info?: string;
|
||||||
|
|
||||||
@@ -34,8 +37,8 @@ export class Unit {
|
|||||||
})
|
})
|
||||||
type!: UnitTypeDto;
|
type!: UnitTypeDto;
|
||||||
|
|
||||||
@Prop({ type: Types.ObjectId, ref: 'Group', required: true, index: true, })
|
@Prop({ type: Types.ObjectId, ref: 'Group', index: true, })
|
||||||
groupId!: Types.ObjectId;
|
groupId?: Types.ObjectId;
|
||||||
|
|
||||||
@Prop({
|
@Prop({
|
||||||
type: [ComponentSchema],
|
type: [ComponentSchema],
|
||||||
|
|||||||
@@ -7,7 +7,13 @@ import { VisualizationsModule } from './visualizations/visualizations.module';
|
|||||||
import { ComponentsModule } from './components/components.module';
|
import { ComponentsModule } from './components/components.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [GroupsModule, UnitsModule, SignalsModule, IosModule, VisualizationsModule, ComponentsModule],
|
imports: [
|
||||||
|
GroupsModule,
|
||||||
|
UnitsModule,
|
||||||
|
SignalsModule,
|
||||||
|
IosModule,
|
||||||
|
VisualizationsModule,
|
||||||
|
ComponentsModule],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class AnlagenModule {}
|
export class AnlagenModule {}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Controller, Get, Param } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
|
||||||
import { ComponentsService } from './components.service';
|
import { ComponentsService } from './components.service';
|
||||||
|
import { ComponentCreateDto, ComponentUpdateDto } from 'src/_dto/anlagen/components';
|
||||||
|
|
||||||
@Controller('rk2/components')
|
@Controller('rk2/components')
|
||||||
export class ComponentsController {
|
export class ComponentsController {
|
||||||
@@ -10,4 +11,25 @@ export class ComponentsController {
|
|||||||
return this.service.findOne(id);
|
return this.service.findOne(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post(':compId')
|
||||||
|
create(@Param('compId') compId: string, @Body() dto: ComponentCreateDto) {
|
||||||
|
console.log(dto)
|
||||||
|
return this.service.create(compId, dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Patch(':compId')
|
||||||
|
update(@Param('compId') compId: string, @Body() dto: ComponentUpdateDto) {
|
||||||
|
console.log(dto)
|
||||||
|
return this.service.update(compId, dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete(':compId')
|
||||||
|
remove(@Param('compId') compId: string) {
|
||||||
|
return this.service.delete(compId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete(':compId/deleteProp/:propName')
|
||||||
|
deleteProp(@Param('compId') compId: string,@Param('propName') propName: string) {
|
||||||
|
return this.service.deletePropertie(compId,propName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { forwardRef, Module } from '@nestjs/common';
|
||||||
import { ComponentsService } from './components.service';
|
import { ComponentsService } from './components.service';
|
||||||
import { ComponentsController } from './components.controller';
|
import { ComponentsController } from './components.controller';
|
||||||
import { MongooseModule } from '@nestjs/mongoose';
|
import { MongooseModule } from '@nestjs/mongoose';
|
||||||
import { Unit, UnitSchema } from 'src/_schemas/anlagen/units';
|
import { Unit, UnitSchema } from 'src/_schemas/anlagen/units';
|
||||||
|
import { SignalsModule } from '../signals/signals.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [ComponentsController],
|
controllers: [ComponentsController],
|
||||||
providers: [ComponentsService],
|
providers: [ComponentsService],
|
||||||
imports: [MongooseModule.forFeature([{ name: Unit.name, schema: UnitSchema }], "anlagen")],
|
imports: [
|
||||||
|
MongooseModule.forFeature([{ name: Unit.name, schema: UnitSchema }], "anlagen"),
|
||||||
|
forwardRef(() => SignalsModule)
|
||||||
|
],
|
||||||
|
exports: [ComponentsService]
|
||||||
})
|
})
|
||||||
export class ComponentsModule { }
|
export class ComponentsModule { }
|
||||||
|
|
||||||
@@ -1,19 +1,24 @@
|
|||||||
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common';
|
||||||
import { InjectModel } from '@nestjs/mongoose';
|
import { InjectModel } from '@nestjs/mongoose';
|
||||||
import { Model, Types } from 'mongoose';
|
import { Model, Types } from 'mongoose';
|
||||||
import { ComponentOfUnitDto, ComponentResponseDto, ComponentTypes } from 'src/_dto/anlagen/components';
|
import { ComponentCreateDto, ComponentOfUnitDto, ComponentResponseDto, ComponentTypes, ComponentUpdateDto } from 'src/_dto/anlagen/components';
|
||||||
import { UnitResponseDto } from 'src/_dto/anlagen/units';
|
|
||||||
import { Component } from 'src/_schemas/anlagen/component';
|
import { Component } from 'src/_schemas/anlagen/component';
|
||||||
import { Unit } from 'src/_schemas/anlagen/units';
|
import { Unit } from 'src/_schemas/anlagen/units';
|
||||||
|
import { SignalsService } from '../signals/signals.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ComponentsService {
|
export class ComponentsService {
|
||||||
constructor(@InjectModel(Unit.name, "anlagen") private model: Model<Unit>) { }
|
constructor(
|
||||||
|
@InjectModel(Unit.name, "anlagen") private model: Model<Unit>,
|
||||||
|
@Inject(forwardRef(() => SignalsService))
|
||||||
|
private readonly signalsService: SignalsService,
|
||||||
|
) { }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
//--- Find BY component id
|
//--- Find BY component id
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
async findOne(id: string): Promise<ComponentOfUnitDto> {
|
async findOne(id: string): Promise<ComponentOfUnitDto> {
|
||||||
if(!Types.ObjectId.isValid(id)) throw new NotFoundException('id ist kein ObjectId')
|
if (!Types.ObjectId.isValid(id)) throw new NotFoundException('id ist kein ObjectId')
|
||||||
|
|
||||||
|
|
||||||
const item = await this.model.findOne({ 'components._id': id }).exec();
|
const item = await this.model.findOne({ 'components._id': id }).exec();
|
||||||
@@ -28,6 +33,119 @@ export class ComponentsService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// Create Component
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
async create(unitId: string, dto: ComponentCreateDto): Promise<ComponentResponseDto> {
|
||||||
|
if (!Types.ObjectId.isValid(unitId)) throw new NotFoundException('id ist kein ObjectId')
|
||||||
|
|
||||||
|
const componentId = new Types.ObjectId();
|
||||||
|
|
||||||
|
const create = {
|
||||||
|
_id: componentId,
|
||||||
|
...dto,
|
||||||
|
name: dto.name ? dto.name : "unbenannt",
|
||||||
|
type: dto.type ? dto.type : ComponentTypes.UNKNOWN
|
||||||
|
}
|
||||||
|
|
||||||
|
const item = await this.model.findByIdAndUpdate(unitId,
|
||||||
|
{ $push: { components: create } },
|
||||||
|
{ returnDocument: 'after' }).exec();
|
||||||
|
|
||||||
|
if (!item) throw new NotFoundException(`After Push component: Keine Unit mit der Componenten Id: ${unitId} gefunden`)
|
||||||
|
|
||||||
|
const newComp = await this.findOne(componentId.toString())
|
||||||
|
if (!newComp || !newComp.component) throw new NotFoundException(`Componente wurde nicht erzeugt UnitId: ${unitId}`)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return newComp.component
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async delete(compId: string): Promise<any> {
|
||||||
|
if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('id ist kein ObjectId')
|
||||||
|
|
||||||
|
|
||||||
|
const item = await this.model.findOneAndUpdate({ 'components._id': compId },
|
||||||
|
{
|
||||||
|
$pull: {
|
||||||
|
components: { _id: compId }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ returnDocument: 'after' }).exec();
|
||||||
|
|
||||||
|
|
||||||
|
if (!item) throw new NotFoundException(`Keine Unit mit der Componenten Id: ${compId} gefunden`)
|
||||||
|
let delSigResult = await this.signalsService.removeSignalsOfComponent(compId);
|
||||||
|
console.log(item._id,delSigResult)
|
||||||
|
return item
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async update(compId: string, dto: ComponentUpdateDto): Promise<any> {
|
||||||
|
if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('id ist kein ObjectId')
|
||||||
|
|
||||||
|
|
||||||
|
const update: Record<string, any> = {};
|
||||||
|
if (dto.name !== undefined) { update['components.$.name'] = dto.name };
|
||||||
|
if (dto.postfix !== undefined) { update['components.$.postfix'] = dto.postfix };
|
||||||
|
if (dto.prefix !== undefined) { update['components.$.prefix'] = dto.prefix };
|
||||||
|
if (dto.index !== undefined) { update['components.$.index'] = dto.index };
|
||||||
|
|
||||||
|
if (dto.properties) {
|
||||||
|
for (const [key, value] of Object.entries(dto.properties)) {
|
||||||
|
update[`components.$.properties.${key}`] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(update);
|
||||||
|
const item = await this.model.findOneAndUpdate({ 'components._id': compId },
|
||||||
|
{ $set: update },
|
||||||
|
{ returnDocument: 'after' }).exec();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return item
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async deletePropertie(compId: string, propertieName: string): Promise<any> {
|
||||||
|
if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('id ist kein ObjectId')
|
||||||
|
|
||||||
|
const deleteProp: Record<string, any> = {};
|
||||||
|
deleteProp[`components.$.properties.${propertieName}`] = '';
|
||||||
|
|
||||||
|
|
||||||
|
const item = await this.model.findOneAndUpdate(
|
||||||
|
{ 'components._id': compId },
|
||||||
|
{
|
||||||
|
$unset: deleteProp
|
||||||
|
},
|
||||||
|
{ returnDocument: 'after' }
|
||||||
|
).exec();;
|
||||||
|
|
||||||
|
|
||||||
|
return item
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async createSignalRef(compId: string, signalId: string): Promise<ComponentOfUnitDto> {
|
||||||
|
if (!Types.ObjectId.isValid(compId)) throw new NotFoundException('Create Component id ist kein ObjectId')
|
||||||
|
|
||||||
|
|
||||||
|
const item = await this.model.findOneAndUpdate({ 'components._id': compId },
|
||||||
|
{ $addToSet: { 'components.$.signalIds': new Types.ObjectId(signalId) } },
|
||||||
|
{ returnDocument: 'after' }).exec();
|
||||||
|
|
||||||
|
|
||||||
|
if (!item) throw new NotFoundException(`Keine Unit mit der Componenten Id: ${compId} gefunden`)
|
||||||
|
let retValue = this.findOne(compId)
|
||||||
|
|
||||||
|
|
||||||
|
return retValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
toDto(component: Component): ComponentResponseDto {
|
toDto(component: Component): ComponentResponseDto {
|
||||||
@@ -38,7 +156,6 @@ export class ComponentsService {
|
|||||||
id: component._id!.toString(),
|
id: component._id!.toString(),
|
||||||
name: component.name,
|
name: component.name,
|
||||||
type: this.getComponentType(component.type.toString()),
|
type: this.getComponentType(component.type.toString()),
|
||||||
signalIds: component.signalIds.map((signal) => signal.toString()),
|
|
||||||
properties: component.properties
|
properties: component.properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class GroupsController {
|
|||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
remove(@Param('id') id: string) {
|
remove(@Param('id') id: string) {
|
||||||
|
console.log('Delete Group')
|
||||||
return this.service.remove(id);
|
return this.service.remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,13 @@ import { GroupsController } from './groups.controller';
|
|||||||
import { GroupsService } from './groups.service';
|
import { GroupsService } from './groups.service';
|
||||||
import { MongooseModule } from '@nestjs/mongoose';
|
import { MongooseModule } from '@nestjs/mongoose';
|
||||||
import { Group, GroupSchema } from 'src/_schemas/anlagen/groups';
|
import { Group, GroupSchema } from 'src/_schemas/anlagen/groups';
|
||||||
|
import { AnlageModule } from 'src/rk-anlagen/anlage/anlage.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [MongooseModule.forFeature([{ name: Group.name, schema: GroupSchema }],"anlagen")],
|
imports: [
|
||||||
|
MongooseModule.forFeature([{ name: Group.name, schema: GroupSchema }],"anlagen"),
|
||||||
|
AnlageModule
|
||||||
|
],
|
||||||
controllers: [GroupsController],
|
controllers: [GroupsController],
|
||||||
providers: [GroupsService]
|
providers: [GroupsService]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,14 +3,18 @@ import { InjectModel } from '@nestjs/mongoose';
|
|||||||
import { Model, Types } from 'mongoose';
|
import { Model, Types } from 'mongoose';
|
||||||
import { GroupCreateDto, GroupResponseDto, GroupUpdateDto } from 'src/_dto/anlagen/groups';
|
import { GroupCreateDto, GroupResponseDto, GroupUpdateDto } from 'src/_dto/anlagen/groups';
|
||||||
import { Group, GroupDocument } from 'src/_schemas/anlagen/groups';
|
import { Group, GroupDocument } from 'src/_schemas/anlagen/groups';
|
||||||
|
import { AnlageService } from 'src/rk-anlagen/anlage/anlage.service';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GroupsService {
|
export class GroupsService {
|
||||||
constructor(@InjectModel(Group.name,"anlagen") private model: Model<Group>) { }
|
constructor(
|
||||||
|
@InjectModel(Group.name,"anlagen") private model: Model<Group>,
|
||||||
|
private readonly anlageService: AnlageService) { }
|
||||||
|
|
||||||
async findAll(): Promise<GroupResponseDto[]> {
|
async findAll(): Promise<GroupResponseDto[]> {
|
||||||
const responsData = await this.model.find().exec();
|
let anlageId = (await this.anlageService.getSelected()).id;
|
||||||
|
const responsData = await this.model.find({anlageId:new Types.ObjectId(anlageId)}).exec();
|
||||||
|
|
||||||
return responsData.map((item) => this.toDto(item));
|
return responsData.map((item) => this.toDto(item));
|
||||||
}
|
}
|
||||||
@@ -28,14 +32,16 @@ export class GroupsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async create(dto: GroupCreateDto):Promise<GroupResponseDto> {
|
async create(dto: GroupCreateDto):Promise<GroupResponseDto> {
|
||||||
const newItem = new this.model(this.toDocument(dto));
|
let anlageId = (await this.anlageService.getSelected()).id;
|
||||||
|
const newItem = new this.model(this.toDocument(anlageId,dto));
|
||||||
const result = await newItem.save();
|
const result = await newItem.save();
|
||||||
return this.toDto(result);
|
return this.toDto(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async update(id: string, dto: GroupUpdateDto) {
|
async update(id: string, dto: GroupUpdateDto) {
|
||||||
let update = this.toDocument(dto);
|
let anlageId = (await this.anlageService.getSelected()).id;
|
||||||
|
let update = this.toDocument(anlageId,dto);
|
||||||
console.log(update);
|
console.log(update);
|
||||||
const changedItem = await this.model.findByIdAndUpdate(id, {
|
const changedItem = await this.model.findByIdAndUpdate(id, {
|
||||||
$set: {
|
$set: {
|
||||||
@@ -68,9 +74,10 @@ export class GroupsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toDocument(dto: GroupCreateDto|GroupUpdateDto) {
|
toDocument(anlageid:string,dto: GroupCreateDto|GroupUpdateDto) {
|
||||||
return {
|
return {
|
||||||
name: dto.name,
|
name: dto.name,
|
||||||
|
anlageId: new Types.ObjectId(anlageid),
|
||||||
container: dto.container,
|
container: dto.container,
|
||||||
nr: dto.nr,
|
nr: dto.nr,
|
||||||
parentId: dto.parentId ? new Types.ObjectId(dto.parentId) : null
|
parentId: dto.parentId ? new Types.ObjectId(dto.parentId) : null
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { forwardRef, Module } from '@nestjs/common';
|
||||||
import { SignalsService } from './signals.service';
|
import { SignalsService } from './signals.service';
|
||||||
import { SignalsController } from './signals.controller';
|
import { SignalsController } from './signals.controller';
|
||||||
import { MongooseModule } from '@nestjs/mongoose';
|
import { MongooseModule } from '@nestjs/mongoose';
|
||||||
import { Signal, SignalSchema } from 'src/_schemas/anlagen/singnals';
|
import { Signal, SignalSchema } from 'src/_schemas/anlagen/singnals';
|
||||||
import { AnlageModule } from 'src/rk-anlagen/anlage/anlage.module';
|
import { AnlageModule } from 'src/rk-anlagen/anlage/anlage.module';
|
||||||
|
import { ComponentsModule } from '../components/components.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
MongooseModule.forFeature([{ name: Signal.name, schema: SignalSchema }], "anlagen"),
|
MongooseModule.forFeature([{ name: Signal.name, schema: SignalSchema }], "anlagen"),
|
||||||
AnlageModule
|
AnlageModule,
|
||||||
|
forwardRef(() =>ComponentsModule)
|
||||||
],
|
],
|
||||||
providers: [SignalsService],
|
providers: [SignalsService],
|
||||||
controllers: [SignalsController]
|
controllers: [SignalsController],
|
||||||
|
exports:[SignalsService]
|
||||||
})
|
})
|
||||||
export class SignalsModule { }
|
export class SignalsModule { }
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common';
|
||||||
import { InjectModel } from '@nestjs/mongoose';
|
import { InjectModel } from '@nestjs/mongoose';
|
||||||
import { Model, Types } from 'mongoose';
|
import { Model, Types } from 'mongoose';
|
||||||
import { SignalCreateDto, SignalResponseDto, SignalUpdateDto } from 'src/_dto/anlagen/signals';
|
import { SignalCreateDto, SignalResponseDto, SignalUpdateDto } from 'src/_dto/anlagen/signals';
|
||||||
import { Signal, SignalDocument } from 'src/_schemas/anlagen/singnals';
|
import { Signal, SignalDocument } from 'src/_schemas/anlagen/singnals';
|
||||||
import { AnlageService } from 'src/rk-anlagen/anlage/anlage.service';
|
import { AnlageService } from 'src/rk-anlagen/anlage/anlage.service';
|
||||||
|
import { ComponentsService } from '../components/components.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SignalsService {
|
export class SignalsService {
|
||||||
constructor(
|
constructor(
|
||||||
@InjectModel(Signal.name, "anlagen") private model: Model<Signal>,
|
@InjectModel(Signal.name, "anlagen") private model: Model<Signal>,
|
||||||
private readonly anlageService: AnlageService
|
private readonly anlageService: AnlageService,
|
||||||
|
@Inject(forwardRef(() => ComponentsService))
|
||||||
|
private readonly componentService: ComponentsService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
async findAll(): Promise<SignalResponseDto[]> {
|
async findAll(): Promise<SignalResponseDto[]> {
|
||||||
@@ -24,8 +27,8 @@ export class SignalsService {
|
|||||||
return this.toDto(item);
|
return this.toDto(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
async findByComponent(componentId:string): Promise<SignalResponseDto[]> {
|
async findByComponent(componentId: string): Promise<SignalResponseDto[]> {
|
||||||
const responsData = await this.model.find({componentId:new Types.ObjectId(componentId)}).exec();
|
const responsData = await this.model.find({ componentId: new Types.ObjectId(componentId) }).exec();
|
||||||
|
|
||||||
return responsData.map((item) => this.toDto(item));
|
return responsData.map((item) => this.toDto(item));
|
||||||
}
|
}
|
||||||
@@ -34,12 +37,15 @@ export class SignalsService {
|
|||||||
async create(dto: SignalCreateDto): Promise<SignalResponseDto> {
|
async create(dto: SignalCreateDto): Promise<SignalResponseDto> {
|
||||||
let currentAnlage = await this.anlageService.getSelected();
|
let currentAnlage = await this.anlageService.getSelected();
|
||||||
|
|
||||||
if(!currentAnlage) throw new NotFoundException('Es ist keine Anlage ausgewählt');
|
if (!currentAnlage) throw new NotFoundException('Es ist keine Anlage ausgewählt');
|
||||||
|
|
||||||
|
|
||||||
const newItem = new this.model(this.toDocument(dto,currentAnlage.id));
|
const newItem = new this.model(this.toDocument(dto, currentAnlage.id));
|
||||||
|
|
||||||
const result = await newItem.save();
|
const result = await newItem.save();
|
||||||
|
|
||||||
|
// Id in Componente anlagen
|
||||||
|
if (dto.componentId)
|
||||||
|
this.componentService.createSignalRef(dto.componentId?.toString(), newItem._id.toString())
|
||||||
return this.toDto(result);
|
return this.toDto(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,9 +53,9 @@ export class SignalsService {
|
|||||||
async update(id: string, dto: SignalUpdateDto) {
|
async update(id: string, dto: SignalUpdateDto) {
|
||||||
let currentAnlage = await this.anlageService.getSelected();
|
let currentAnlage = await this.anlageService.getSelected();
|
||||||
let anlage = dto.anlageId ? dto.anlageId : currentAnlage.id;
|
let anlage = dto.anlageId ? dto.anlageId : currentAnlage.id;
|
||||||
if(!anlage) throw new NotFoundException('Anlage Id muss gesetzt sein')
|
if (!anlage) throw new NotFoundException('Anlage Id muss gesetzt sein')
|
||||||
|
|
||||||
let update = this.toDocument(dto,anlage);
|
let update = this.toDocument(dto, anlage);
|
||||||
console.log(update);
|
console.log(update);
|
||||||
const changedItem = await this.model.findByIdAndUpdate(id, {
|
const changedItem = await this.model.findByIdAndUpdate(id, {
|
||||||
$set: {
|
$set: {
|
||||||
@@ -70,6 +76,13 @@ export class SignalsService {
|
|||||||
return this.toDto(removedItem);
|
return this.toDto(removedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async removeSignalsOfComponent(compId: string) {
|
||||||
|
const removedItem = await this.model.deleteMany({ componentId: new Types.ObjectId(compId) });
|
||||||
|
|
||||||
|
|
||||||
|
return removedItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
toDto(dbData: SignalDocument): SignalResponseDto {
|
toDto(dbData: SignalDocument): SignalResponseDto {
|
||||||
@@ -84,7 +97,7 @@ export class SignalsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toDocument(dto: SignalCreateDto | SignalUpdateDto,anlage:string) {
|
toDocument(dto: SignalCreateDto | SignalUpdateDto, anlage: string) {
|
||||||
return {
|
return {
|
||||||
anlageId: new Types.ObjectId(anlage),
|
anlageId: new Types.ObjectId(anlage),
|
||||||
name: dto.name,
|
name: dto.name,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
|
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common';
|
||||||
import { UnitsService } from './units.service';
|
import { UnitsService } from './units.service';
|
||||||
import { UnitCreateDto, UnitUpdateBaseDto } from 'src/_dto/anlagen/units';
|
import { UnitCreateDto, UnitUpdateBaseDto } from 'src/_dto/anlagen/units';
|
||||||
import { ComponentCreateDto, ComponentUpdateDto } from 'src/_dto/anlagen/components';
|
|
||||||
|
|
||||||
|
|
||||||
@Controller('rk2/units')
|
@Controller('rk2/units')
|
||||||
@@ -31,18 +31,10 @@ export class UnitsController {
|
|||||||
|
|
||||||
@Patch(':id')
|
@Patch(':id')
|
||||||
update(@Param('id') id: string, @Body() dto: UnitUpdateBaseDto) {
|
update(@Param('id') id: string, @Body() dto: UnitUpdateBaseDto) {
|
||||||
|
|
||||||
return this.service.update(id, dto);
|
return this.service.update(id, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id/component/:compId')
|
|
||||||
updateComp(@Param('id') id: string,@Param('compId') compId: string, @Body() dto: ComponentUpdateDto) {
|
|
||||||
return this.service.updateComponent(id,compId, dto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Patch(':id/addComponent')
|
|
||||||
updateUnitAddComp(@Param('id') id: string, @Body() dto: ComponentCreateDto) {
|
|
||||||
return this.service.addComponent(id,dto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
remove(@Param('id') id: string) {
|
remove(@Param('id') id: string) {
|
||||||
|
|||||||
@@ -16,17 +16,13 @@ export class UnitsService {
|
|||||||
|
|
||||||
async findAllExp(): Promise<any[]> {
|
async findAllExp(): Promise<any[]> {
|
||||||
let currentAnlage = await this.anlageService.getSelected();
|
let currentAnlage = await this.anlageService.getSelected();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let items = await this.model.aggregate<any>(Unit_query_get(currentAnlage.id));
|
let items = await this.model.aggregate<any>(Unit_query_get(currentAnlage.id));
|
||||||
|
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- Find ALL
|
//--- Find ALL
|
||||||
async findAll(): Promise<UnitResponseDto[]> {
|
async findAll(): Promise<UnitResponseDto[]> {
|
||||||
|
|
||||||
const responsData = await this.model.find().exec();
|
const responsData = await this.model.find().exec();
|
||||||
|
|
||||||
return responsData.map((item) => this.toDto(item));
|
return responsData.map((item) => this.toDto(item));
|
||||||
@@ -42,39 +38,39 @@ export class UnitsService {
|
|||||||
|
|
||||||
//--- Create new Unit
|
//--- Create new Unit
|
||||||
async create(dto: UnitCreateDto): Promise<UnitResponseDto> {
|
async create(dto: UnitCreateDto): Promise<UnitResponseDto> {
|
||||||
let { components, ...base } = dto;
|
let anlageId = dto.anlageId ? new Types.ObjectId(dto.anlageId) : new Types.ObjectId((await this.anlageService.getSelected()).id);
|
||||||
components = components.map((c) => ({ name: c.name, signalIds: c.signalIds, type: c.type, properties: c.properties, id: c.id == "" ? undefined : c.id }))
|
|
||||||
let cComponents = components.map((c) => this.handleComponents(c));
|
let { components,groupId, ...base } = dto;
|
||||||
console.log(base);
|
let newGroupId = groupId != undefined && Types.ObjectId.isValid(groupId) ? new Types.ObjectId(groupId) : undefined
|
||||||
const newItem = new this.model({ ...base, components: cComponents });
|
// components = components ? components.map((c) => ({ name: c.name, type: c.type, properties: c.properties, id: c.id == "" ? undefined : c.id })):undefined
|
||||||
|
// let cComponents = components.map((c) => this.handleComponents(c));
|
||||||
|
|
||||||
|
const newItem = new this.model({ ...base, groupId:newGroupId, anlageId:anlageId });
|
||||||
const result = await newItem.save();
|
const result = await newItem.save();
|
||||||
return this.toDto(result);
|
return this.toDto(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- Update a Unit
|
//--- Update a Unit
|
||||||
async update(id: string, dto: UnitUpdateBaseDto) {
|
async update(id: string, dto: UnitUpdateBaseDto) {
|
||||||
|
let anlageId = dto.anlageId && Types.ObjectId.isValid(dto.anlageId) ? new Types.ObjectId(dto.anlageId) : new Types.ObjectId((await this.anlageService.getSelected()).id);
|
||||||
|
|
||||||
let update = {
|
let update = {
|
||||||
|
...( { anlageId: anlageId }),
|
||||||
...(dto.name !== undefined && { name: dto.name }),
|
...(dto.name !== undefined && { name: dto.name }),
|
||||||
...(dto.groupId !== undefined && { groupId: dto.groupId }),
|
...(dto.groupId !== undefined && Types.ObjectId.isValid(dto.groupId) && { groupId: new Types.ObjectId(dto.groupId) }),
|
||||||
|
...(dto.prefix !== undefined && { prefix: dto.prefix }),
|
||||||
|
...(dto.postfix !== undefined && { postfix: dto.postfix }),
|
||||||
|
...(dto.bmk !== undefined && { bmk: dto.bmk }),
|
||||||
...(dto.type !== undefined && { type: dto.type.toString() }),
|
...(dto.type !== undefined && { type: dto.type.toString() }),
|
||||||
...(dto.components !== undefined && { components: dto.components.map((c) => this.handleComponents(c)) }),
|
...(dto.components !== undefined ? { components: dto.components.map((c) => this.handleComponents(c)) } : { components: [] }),
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(update.components);
|
const item = await this.model.findByIdAndUpdate({ _id: id }, { $set: { ...update } }, { returnDocument: 'after', runValidators: true });
|
||||||
const changedItem = await this.model.findByIdAndUpdate({ _id: id }, {
|
|
||||||
$set: {
|
|
||||||
...update,
|
|
||||||
|
|
||||||
}
|
if (!item) throw new NotFoundException('The updated Unit are not found');
|
||||||
}
|
|
||||||
, { returnDocument: 'after', runValidators: true });
|
|
||||||
|
|
||||||
|
return this.toDto(item);
|
||||||
|
|
||||||
const newUnit = await this.findOne(id);
|
|
||||||
if (!newUnit) throw new NotFoundException('The updated Unit are not found');
|
|
||||||
|
|
||||||
return newUnit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- Remove
|
//--- Remove
|
||||||
@@ -86,63 +82,8 @@ export class UnitsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--- Update Components of a Unit
|
|
||||||
async updateComponent(unitId: string, componentId: string, dto: ComponentUpdateDto) {
|
|
||||||
|
|
||||||
const unit = await this.model
|
|
||||||
.findOneAndUpdate(
|
|
||||||
{
|
|
||||||
_id: unitId,
|
|
||||||
'components._id': componentId,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$set: {
|
|
||||||
'components.$.name': dto.name,
|
|
||||||
'components.$.type': dto.type,
|
|
||||||
'components.$.properties': dto.properties,
|
|
||||||
'components.$.signalIds': dto.signalIds,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
new: true,
|
|
||||||
after: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.exec();
|
|
||||||
|
|
||||||
if (!unit) {
|
|
||||||
throw new NotFoundException(
|
|
||||||
`Unit oder Component nicht gefunden`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--- Update Components of a Unit
|
|
||||||
async addComponent(unitId: string, dto: ComponentCreateDto) {
|
|
||||||
let currentUnit = await this.model.findById(unitId).exec();
|
|
||||||
if (!currentUnit) throw new NotFoundException('Unit id ncht gefunden');
|
|
||||||
|
|
||||||
let signale = dto.signalIds ? dto.signalIds.map((s) => new Types.ObjectId(s)) : [];
|
|
||||||
let pros = { ...dto.properties };
|
|
||||||
currentUnit.components = [...currentUnit.components, {
|
|
||||||
name: dto.name,
|
|
||||||
signalIds: [...signale], //dto.signalIds ? dto.signalIds.map((s)=>new ObjectId(s)): [],
|
|
||||||
type: dto.type,
|
|
||||||
properties: { ...pros }
|
|
||||||
}]
|
|
||||||
|
|
||||||
|
|
||||||
const unit = await this.model.findOneAndUpdate({ _id: unitId }, currentUnit, { new: true, runValidators: true, }).exec();
|
|
||||||
|
|
||||||
if (!unit) {
|
|
||||||
throw new NotFoundException(
|
|
||||||
`Unit oder Component nicht gefunden`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
toDto(dbData: Unit): UnitResponseDto {
|
toDto(dbData: Unit): UnitResponseDto {
|
||||||
|
|
||||||
@@ -151,8 +92,10 @@ export class UnitsService {
|
|||||||
{
|
{
|
||||||
id: c._id!.toString(),
|
id: c._id!.toString(),
|
||||||
name: c.name,
|
name: c.name,
|
||||||
|
index: c.index,
|
||||||
|
prefix: c.prefix,
|
||||||
|
postfix: c.postfix,
|
||||||
type: this.getComponentType(c.type.toString()),
|
type: this.getComponentType(c.type.toString()),
|
||||||
signalIds: c.signalIds.map((signal) => signal.toString()),
|
|
||||||
properties: c.properties
|
properties: c.properties
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@@ -161,17 +104,15 @@ export class UnitsService {
|
|||||||
name: dbData.name,
|
name: dbData.name,
|
||||||
bmk: dbData.bmk,
|
bmk: dbData.bmk,
|
||||||
prefix: dbData.prefix,
|
prefix: dbData.prefix,
|
||||||
|
postfix: dbData.postfix,
|
||||||
info: dbData.info,
|
info: dbData.info,
|
||||||
anlageId: dbData.anlageId,
|
anlageId: dbData.anlageId ? dbData.anlageId.toString() : '',
|
||||||
type: dbData.type,
|
type: dbData.type,
|
||||||
groupId: dbData.groupId.toString(),
|
groupId: dbData.groupId ? dbData.groupId.toString() : '',
|
||||||
components: comop
|
components: comop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getToUpdateComponents(currentDbComp: Component[], updateComp: ComponentResponseDto[]) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getComponentType(name: string) {
|
getComponentType(name: string) {
|
||||||
let retValue = Object.values(ComponentTypes).find((c) => c === name)
|
let retValue = Object.values(ComponentTypes).find((c) => c === name)
|
||||||
@@ -184,7 +125,6 @@ export class UnitsService {
|
|||||||
_id: new Types.ObjectId(compDto.id),
|
_id: new Types.ObjectId(compDto.id),
|
||||||
name: compDto.name,
|
name: compDto.name,
|
||||||
type: compDto.type?.toString(),
|
type: compDto.type?.toString(),
|
||||||
signalIds: compDto.signalIds.map((s) => new Types.ObjectId(s)),
|
|
||||||
properties: { ...compDto.properties }
|
properties: { ...compDto.properties }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,21 +147,20 @@ export class UnitsService {
|
|||||||
return comps.map((c) => ({
|
return comps.map((c) => ({
|
||||||
name: c.name,
|
name: c.name,
|
||||||
type: c.type?.toString(),
|
type: c.type?.toString(),
|
||||||
signalIds: c.signalIds ? c.signalIds.map((s) => new Types.ObjectId(s)) : [],
|
|
||||||
properties: { ...c.properties }
|
properties: { ...c.properties }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleComponents(component: ComponentResponseDto): Component {
|
handleComponents(component: ComponentResponseDto): Component {
|
||||||
let { id, name, signalIds, type, properties } = component;
|
let { id, name, type, properties,postfix,prefix,index } = component;
|
||||||
|
|
||||||
const cid = (id && Types.ObjectId.isValid(id)) ? new Types.ObjectId(id) : undefined;
|
const cid = (id && Types.ObjectId.isValid(id)) ? new Types.ObjectId(id) : undefined;
|
||||||
const cSignalIds = signalIds ? this.handleSignals(signalIds) : [];
|
|
||||||
const cProperties = properties ? this.handleProperties(properties) : {};
|
const cProperties = properties ? this.handleProperties(properties) : {};
|
||||||
const cName = name;
|
const cName = name;
|
||||||
const cType = type;
|
|
||||||
|
|
||||||
return { name: cName, type: cType, signalIds: cSignalIds, properties: cProperties, _id: cid }
|
|
||||||
|
return { name: cName,postfix,prefix,index, type, properties: cProperties, _id: cid }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ export class DrawController {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Get('anlageDurmin')
|
||||||
|
getAnlageDurmin(@Query() optionen: DrawShapeOptionenDto): DrawDto {
|
||||||
|
return this.service.getAnlageDurmin() as DrawDto;
|
||||||
|
}
|
||||||
|
|
||||||
@Get('graphic')
|
@Get('graphic')
|
||||||
getGraphic(@Query() optionen: DrawShapeOptionenDto): DrawDto {
|
getGraphic(@Query() optionen: DrawShapeOptionenDto): DrawDto {
|
||||||
return this.service.gurtfoerderer(optionen) as DrawDto;
|
return this.service.gurtfoerderer(optionen) as DrawDto;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { DrawVentil } from 'src/graphics/elements/drawVentil';
|
|||||||
import { DrawWasserZufuhr } from 'src/graphics/elements/drawWasserZufuhr';
|
import { DrawWasserZufuhr } from 'src/graphics/elements/drawWasserZufuhr';
|
||||||
import { DrawBehaelterMulti } from 'src/graphics/elements/drawBehaelterMulti';
|
import { DrawBehaelterMulti } from 'src/graphics/elements/drawBehaelterMulti';
|
||||||
import { DrawMotor } from 'src/graphics/elements/drawMotor';
|
import { DrawMotor } from 'src/graphics/elements/drawMotor';
|
||||||
|
import { DrawAnlageDurmin } from 'src/graphics/elements/drawAnlageDurmin2';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [],
|
||||||
@@ -44,7 +45,8 @@ import { DrawMotor } from 'src/graphics/elements/drawMotor';
|
|||||||
DrawVentil,
|
DrawVentil,
|
||||||
DrawWasserZufuhr,
|
DrawWasserZufuhr,
|
||||||
DrawBehaelterMulti,
|
DrawBehaelterMulti,
|
||||||
DrawMotor
|
DrawMotor,
|
||||||
|
DrawAnlageDurmin
|
||||||
],
|
],
|
||||||
exports: [DrawService]
|
exports: [DrawService]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { DrawVentil } from 'src/graphics/elements/drawVentil';
|
|||||||
import { DrawWasserZufuhr } from 'src/graphics/elements/drawWasserZufuhr';
|
import { DrawWasserZufuhr } from 'src/graphics/elements/drawWasserZufuhr';
|
||||||
import { DrawBehaelterMulti } from 'src/graphics/elements/drawBehaelterMulti';
|
import { DrawBehaelterMulti } from 'src/graphics/elements/drawBehaelterMulti';
|
||||||
import { DrawMotor } from 'src/graphics/elements/drawMotor';
|
import { DrawMotor } from 'src/graphics/elements/drawMotor';
|
||||||
|
import { DrawAnlageDurmin } from 'src/graphics/elements/drawAnlageDurmin2';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DrawService {
|
export class DrawService {
|
||||||
@@ -44,12 +45,15 @@ export class DrawService {
|
|||||||
private readonly buildWasserZufuhr: DrawWasserZufuhr,
|
private readonly buildWasserZufuhr: DrawWasserZufuhr,
|
||||||
private readonly buildBehaelterMulti: DrawBehaelterMulti,
|
private readonly buildBehaelterMulti: DrawBehaelterMulti,
|
||||||
private readonly buildMotor: DrawMotor,
|
private readonly buildMotor: DrawMotor,
|
||||||
|
private readonly buildAnlageDurmin: DrawAnlageDurmin,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
getAnlageDurmin(){
|
||||||
|
return this.buildAnlageDurmin.getDrawObject({})
|
||||||
|
}
|
||||||
|
|
||||||
sieb(options?: DrawShapeOptionenDto, rawSvg?: boolean) {
|
sieb(options?: DrawShapeOptionenDto, rawSvg?: boolean) {
|
||||||
if (rawSvg) return this.buildSieb.getSvg(options);
|
if (rawSvg) return this.buildSieb.getSvg(options);
|
||||||
|
|||||||
@@ -0,0 +1,336 @@
|
|||||||
|
import { PathCommand } from "../lib/types/path.types";
|
||||||
|
import { DrawLine } from '../lib/drawLine'
|
||||||
|
import { DrawPath } from '../lib/drawPath'
|
||||||
|
import { DrawGroup } from '../lib/drawGroup'
|
||||||
|
import { DrawEllipse } from "../lib/drawEllipse";
|
||||||
|
|
||||||
|
import { cal_rotation_dim } from '../lib/drawFunktions'
|
||||||
|
import { Injectable } from "@nestjs/common";
|
||||||
|
import { DrawDto, DrawShapeOptionenDto } from "src/_dto/draw.dto";
|
||||||
|
import { DrawHeader } from "../lib/drawHeader";
|
||||||
|
|
||||||
|
interface Para {
|
||||||
|
scale?: number,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DrawAnlageDurmin {
|
||||||
|
|
||||||
|
obj_height = 1100;
|
||||||
|
obj_width = 1700;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
createSiloSued(data: { length: number, height: number, wand: number, posX: number, posY: number }) {
|
||||||
|
let { height, length, posX, posY, wand } = data;
|
||||||
|
|
||||||
|
const pSilo: PathCommand[] = [
|
||||||
|
{ type: "M", x: posX, y: posY },
|
||||||
|
{ relative: true, type: "V", y: height }, // --
|
||||||
|
{ relative: true, type: "H", x: length }, // --
|
||||||
|
{ relative: true, type: "V", y: -height }, // T
|
||||||
|
{ relative: true, type: "H", x: -wand }, // --
|
||||||
|
{ relative: true, type: "V", y: height - wand }, //
|
||||||
|
{ relative: true, type: "H", x: -(length - (wand * 2)) }, // --
|
||||||
|
{ relative: true, type: "V", y: -(height - wand) }, //
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
return pSilo;
|
||||||
|
}
|
||||||
|
|
||||||
|
createSiloNord(data: { length: number, height: number, wand: number, posX: number, posY: number }) {
|
||||||
|
let { height, length, posX, posY, wand } = data;
|
||||||
|
|
||||||
|
const pSilo: PathCommand[] = [
|
||||||
|
{ type: "M", x: posX, y: posY },
|
||||||
|
{ relative: true, type: "V", y: height }, // --
|
||||||
|
{ relative: true, type: "H", x: wand }, // --
|
||||||
|
{ relative: true, type: "V", y: -(height - wand) }, // T
|
||||||
|
{ relative: true, type: "H", x: length - (wand * 2) }, // innen oben
|
||||||
|
{ relative: true, type: "V", y: height - wand }, //
|
||||||
|
{ relative: true, type: "H", x: wand }, // --
|
||||||
|
{ relative: true, type: "V", y: -height }, //
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
return pSilo;
|
||||||
|
}
|
||||||
|
|
||||||
|
createSiloWest(data: { length: number, height: number, wand: number, posX: number, posY: number }) {
|
||||||
|
let { height, length, posX, posY, wand } = data;
|
||||||
|
|
||||||
|
const pSilo: PathCommand[] = [
|
||||||
|
{ type: "M", x: posX, y: posY },
|
||||||
|
{ relative: true, type: "V", y: length }, // --
|
||||||
|
{ relative: true, type: "H", x: height }, // --
|
||||||
|
{ relative: true, type: "V", y: -wand }, // T
|
||||||
|
{ relative: true, type: "H", x: -(height - wand) }, // innen oben
|
||||||
|
{ relative: true, type: "V", y: -(length - 2 * wand) }, //
|
||||||
|
{ relative: true, type: "H", x: height - wand }, // --
|
||||||
|
{ relative: true, type: "V", y: -wand }, //
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
return pSilo;
|
||||||
|
}
|
||||||
|
|
||||||
|
createFahrschine(data: { length: number, height: number, abstand: number, posX: number, posY: number, nordSued: boolean }) {
|
||||||
|
let { height, length, posX, posY, abstand, nordSued } = data;
|
||||||
|
if (nordSued) {
|
||||||
|
height = data.length;
|
||||||
|
length = data.height;
|
||||||
|
}
|
||||||
|
const pSchine1: PathCommand[] = [
|
||||||
|
{ type: "M", x: posX, y: posY },
|
||||||
|
{ relative: true, type: "V", y: height }, // --
|
||||||
|
{ relative: true, type: "H", x: length }, // --
|
||||||
|
{ relative: true, type: "V", y: -height }, // T
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
let abstand_x = nordSued ? abstand : 0;
|
||||||
|
let abstand_y = nordSued ? 0 : abstand;
|
||||||
|
const pSchine2: PathCommand[] = [
|
||||||
|
{ type: "M", x: posX + abstand_x, y: posY + abstand_y },
|
||||||
|
{ relative: true, type: "V", y: height }, // --
|
||||||
|
{ relative: true, type: "H", x: length }, // --
|
||||||
|
{ relative: true, type: "V", y: -height }, // T
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
return [pSchine1, pSchine2];
|
||||||
|
}
|
||||||
|
|
||||||
|
createBand(data: { width: number, height: number, posX: number, posY: number, nordSued: boolean }) {
|
||||||
|
let { height, width, posX, posY, nordSued } = data;
|
||||||
|
|
||||||
|
if (nordSued) {
|
||||||
|
height = data.width;
|
||||||
|
width = data.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pBand1: PathCommand[] = [
|
||||||
|
{ type: "M", x: 0, y: 0 },
|
||||||
|
{ relative: true, type: "V", y: height }, // --
|
||||||
|
{ relative: true, type: "H", x: width }, // --
|
||||||
|
{ relative: true, type: "V", y: -height }, // T
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
let offsetX = nordSued ? 10 : 0;
|
||||||
|
let offsetY = nordSued ? 0 : 10;
|
||||||
|
let belt2Pos = {width:width-offsetX,height:height-offsetY}
|
||||||
|
|
||||||
|
const pBand2: PathCommand[] = [
|
||||||
|
{ type: "M", x: offsetX/2, y: offsetY/2 },
|
||||||
|
{ relative: true, type: "V", y: belt2Pos.height }, // --
|
||||||
|
{ relative: true, type: "H", x: belt2Pos.width }, // --
|
||||||
|
{ relative: true, type: "V", y: -belt2Pos.height }, // T
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
let boxWidth = nordSued ? width : 10;
|
||||||
|
let boxHeight = nordSued ? 10: height;
|
||||||
|
|
||||||
|
let boxValues = {width:boxWidth,height:boxHeight}
|
||||||
|
const pBandBoxStart: PathCommand[] = [
|
||||||
|
{ type: "M", x: 0, y: 0 },
|
||||||
|
{ relative: true, type: "V", y: boxValues.height }, // --
|
||||||
|
{ relative: true, type: "H", x: boxValues.width }, // --
|
||||||
|
{ relative: true, type: "V", y: -boxValues.height }, // T
|
||||||
|
{ type: "Z" }
|
||||||
|
];
|
||||||
|
|
||||||
|
const group = new DrawGroup({});
|
||||||
|
group.setAtrr({ translate_y: posY, translate_x: posX })
|
||||||
|
|
||||||
|
const belt1 = new DrawPath(pBand1);
|
||||||
|
belt1.setAtrr({fill:"#404040", stroke:"#404040"})
|
||||||
|
|
||||||
|
const belt2 = new DrawPath(pBand2);
|
||||||
|
belt2.setAtrr({fill:"#808080", stroke:"#808080"})
|
||||||
|
|
||||||
|
const beltBoxStart = new DrawPath(pBandBoxStart);
|
||||||
|
beltBoxStart.setAtrr({fill:"#101010", stroke:"#101010"})
|
||||||
|
|
||||||
|
group.add(beltBoxStart)
|
||||||
|
group.add(belt2)
|
||||||
|
group.add(belt1)
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
create(optionen?: DrawShapeOptionenDto): DrawGroup {
|
||||||
|
|
||||||
|
let color = "#000000";
|
||||||
|
|
||||||
|
|
||||||
|
const silo_h = 196;
|
||||||
|
const silo_b = 196;
|
||||||
|
const silo_wand = 8;
|
||||||
|
|
||||||
|
const posSiloSued = 1700 - 300;
|
||||||
|
|
||||||
|
|
||||||
|
const siloWestPos = { x: 200, y: 100 }
|
||||||
|
const siloSuedPos = { x: 700, y: siloWestPos.y + (silo_b*3) + (silo_b/2) - (silo_h/2) }
|
||||||
|
const siloNordPos = { x: 700, y: siloWestPos.y + (silo_b*1) + (silo_b/2) - (silo_h/2) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const obj_h = this.obj_height;
|
||||||
|
const obj_w = this.obj_width;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const groupInhalt = new DrawGroup({});
|
||||||
|
const group1 = new DrawGroup({});
|
||||||
|
|
||||||
|
|
||||||
|
// Silo Süd
|
||||||
|
let silo_posX = siloSuedPos.x;
|
||||||
|
let silo_posY = siloSuedPos.y;
|
||||||
|
|
||||||
|
const zBa2S1 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa2S2 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa2S3 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa2S4 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa2S5 = new DrawPath(this.createSiloSued({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
zBa2S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa2S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa2S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa2S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa2S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
|
||||||
|
// Schiene
|
||||||
|
let [pBa1Schiene1, pBa1Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloSuedPos.x - 30, posY: siloSuedPos.y + (silo_h/2) - 25, nordSued: false });
|
||||||
|
const zBa1Schine1 = new DrawPath(pBa1Schiene1);
|
||||||
|
const zBa1Schine2 = new DrawPath(pBa1Schiene2);
|
||||||
|
|
||||||
|
|
||||||
|
// Silo Nord
|
||||||
|
silo_posX = siloNordPos.x;
|
||||||
|
silo_posY = siloNordPos.y;
|
||||||
|
|
||||||
|
const zBa1S1 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa1S2 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa1S3 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa1S4 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posX += silo_b - silo_wand;
|
||||||
|
const zBa1S5 = new DrawPath(this.createSiloNord({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
zBa1S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa1S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa1S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa1S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa1S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
|
||||||
|
// Schiene
|
||||||
|
let [pBa2Schiene1, pBa2Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloNordPos.x - 30, posY: siloNordPos.y + (silo_h/2) - 25, nordSued: false });
|
||||||
|
const zBa2Schine1 = new DrawPath(pBa2Schiene1);
|
||||||
|
const zBa2Schine2 = new DrawPath(pBa2Schiene2);
|
||||||
|
|
||||||
|
// Silo West
|
||||||
|
silo_posX = siloWestPos.x;
|
||||||
|
silo_posY = siloWestPos.y;
|
||||||
|
|
||||||
|
const zBa3S1 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posY += silo_b - silo_wand;
|
||||||
|
const zBa3S2 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posY += silo_b - silo_wand;
|
||||||
|
const zBa3S3 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posY += silo_b - silo_wand;
|
||||||
|
const zBa3S4 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
silo_posY += silo_b - silo_wand;
|
||||||
|
const zBa3S5 = new DrawPath(this.createSiloWest({ posX: silo_posX, posY: silo_posY, length: silo_b, height: silo_h, wand: silo_wand }));
|
||||||
|
zBa3S1.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa3S2.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa3S3.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa3S4.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
zBa3S5.setAtrr({ fill: "#303030", storkWidth: 1, stroke: "#303030" })
|
||||||
|
|
||||||
|
// Schiene
|
||||||
|
let [pBa3Schiene1, pBa3Schiene2] = this.createFahrschine({ length: silo_b * 5 + 50, height: 4, abstand: 50, posX: siloWestPos.x + (silo_h/2) - 25, posY: siloWestPos.y - 30, nordSued: true });
|
||||||
|
const zBa3Schine1 = new DrawPath(pBa3Schiene1);
|
||||||
|
const zBa3Schine2 = new DrawPath(pBa3Schiene2);
|
||||||
|
|
||||||
|
this.obj_height = obj_h //+ 30;
|
||||||
|
this.obj_width = obj_w;
|
||||||
|
|
||||||
|
group1.add(this.createBand({posX:600,posY:200,width:100,height:40,nordSued:false}))
|
||||||
|
group1.add(this.createBand({posX:500,posY:100,width:100,height:40,nordSued:true}))
|
||||||
|
group1.add(zBa1Schine1);
|
||||||
|
group1.add(zBa1Schine2);
|
||||||
|
group1.add(zBa1S1);
|
||||||
|
group1.add(zBa1S2);
|
||||||
|
group1.add(zBa1S3);
|
||||||
|
group1.add(zBa1S4);
|
||||||
|
group1.add(zBa1S5);
|
||||||
|
|
||||||
|
group1.add(zBa2Schine1);
|
||||||
|
group1.add(zBa2Schine2);
|
||||||
|
group1.add(zBa2S1);
|
||||||
|
group1.add(zBa2S2);
|
||||||
|
group1.add(zBa2S3);
|
||||||
|
group1.add(zBa2S4);
|
||||||
|
group1.add(zBa2S5);
|
||||||
|
|
||||||
|
|
||||||
|
group1.add(zBa3Schine1);
|
||||||
|
group1.add(zBa3Schine2);
|
||||||
|
group1.add(zBa3S1);
|
||||||
|
group1.add(zBa3S2);
|
||||||
|
group1.add(zBa3S3);
|
||||||
|
group1.add(zBa3S4);
|
||||||
|
group1.add(zBa3S5);
|
||||||
|
|
||||||
|
groupInhalt.add(group1)
|
||||||
|
|
||||||
|
groupInhalt.setAtrr({ translate_y: 11, translate_x: 11 })
|
||||||
|
return groupInhalt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getDrawObject(optionen?: DrawShapeOptionenDto): DrawDto {
|
||||||
|
const groupSvg = this.create(optionen)
|
||||||
|
const getXaml = true;
|
||||||
|
const svg = groupSvg.getChildString(!getXaml, 0)
|
||||||
|
const xaml = groupSvg.getChildString(getXaml, 0)
|
||||||
|
return {
|
||||||
|
name: "anlageDurmin",
|
||||||
|
height: this.obj_height,
|
||||||
|
length: this.obj_width,
|
||||||
|
px_height: this.obj_height,
|
||||||
|
px_width: this.obj_width,
|
||||||
|
raster: 1,
|
||||||
|
scale: 1,
|
||||||
|
offset_x: 0,
|
||||||
|
offset_y: 0,
|
||||||
|
svg,
|
||||||
|
xaml
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getSvg(optionen?: DrawShapeOptionenDto): string {
|
||||||
|
const groupSvg = this.create(optionen)
|
||||||
|
const xaml = optionen && optionen.xaml ? true : false;
|
||||||
|
const header = new DrawHeader({ lenght: this.obj_width, height: this.obj_height });
|
||||||
|
header.add(groupSvg);
|
||||||
|
|
||||||
|
return header.getChildString(xaml, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -56,13 +56,14 @@ export class DrawGroup extends DrawContainer {
|
|||||||
let translate_x = this.attributes.get('translate_x') as number;
|
let translate_x = this.attributes.get('translate_x') as number;
|
||||||
let translate_y = this.attributes.get('translate_y') as number;
|
let translate_y = this.attributes.get('translate_y') as number;
|
||||||
let transformStr = ""
|
let transformStr = ""
|
||||||
|
let rotateString = "";
|
||||||
if (translate_x || translate_y) {
|
if (translate_x || translate_y) {
|
||||||
let x = translate_x ? translate_x : 0;
|
let x = translate_x ? translate_x : 0;
|
||||||
let y = translate_y ? translate_y : 0;
|
let y = translate_y ? translate_y : 0;
|
||||||
transformStr = `translate(${x} ${y}) `
|
transformStr = `translate(${x} ${y}) `
|
||||||
|
rotateString = `transform="${transformStr}"`
|
||||||
}
|
}
|
||||||
|
|
||||||
let rotateString = "";
|
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
rotateString = `transform="${transformStr}rotate(${rotate.winkel} ${rotate.posX} ${rotate.posY})"`
|
rotateString = `transform="${transformStr}rotate(${rotate.winkel} ${rotate.posX} ${rotate.posY})"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ export interface LineToCommand extends PathBaseCommand {
|
|||||||
|
|
||||||
/** Horizontal Line-To */
|
/** Horizontal Line-To */
|
||||||
export interface HorizontalLineToCommand extends PathBaseCommand {
|
export interface HorizontalLineToCommand extends PathBaseCommand {
|
||||||
type: "H";
|
type: "H" | "h";
|
||||||
x: number;
|
x: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Vertical Line-To */
|
/** Vertical Line-To */
|
||||||
export interface VerticalLineToCommand extends PathBaseCommand {
|
export interface VerticalLineToCommand extends PathBaseCommand {
|
||||||
type: "V";
|
type: "V" | "v";
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,38 @@
|
|||||||
|
### Units
|
||||||
|
GET http://localhost:3000/rk2/units/6a8c116adbe08c3d75e3aefd
|
||||||
|
|
||||||
|
|
||||||
### Get By Ids
|
### Get By Ids
|
||||||
GET http://localhost:3000/rk2/components/6a901cc6939c157328d3e3e7
|
GET http://localhost:3000/rk2/components/6a9687c9115d604d8f1f05ce
|
||||||
|
|
||||||
|
### Add Component
|
||||||
|
### Create
|
||||||
|
POST http://localhost:3000/rk2/components/6a8c116adbe08c3d75e3aefd
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"ES1",
|
||||||
|
"type":"Endschalter",
|
||||||
|
"properties":{"name2":"kind2"}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
### Delete Component
|
||||||
|
### Delete
|
||||||
|
DELETE http://localhost:3000/rk2/components/6a9687c9115d604d8f1f05ce
|
||||||
|
|
||||||
|
### Delete Propertie
|
||||||
|
### Create
|
||||||
|
DELETE http://localhost:3000/rk2/components/6a968b22b46fd50d5cbe7bcc/deleteProp/name2
|
||||||
|
|
||||||
|
|
||||||
|
### Change Component
|
||||||
|
PATCH http://localhost:3000/rk2/components/6a968b22b46fd50d5cbe7bcc
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"name":"ES2",
|
||||||
|
"type":"Endschalter",
|
||||||
|
"properties":{"name2":"kind2"}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
### Anlage 1659 --> 6995c44ebb286cf2c27da0d8
|
### Anlage 1659 --> 6995c44ebb286cf2c27da0d8
|
||||||
### Test Group --> 6996c2cf14624b2583af43e9
|
### Test Group --> 6996c2cf14624b2583af43e9
|
||||||
|
|
||||||
|
### Get All
|
||||||
|
GET http://localhost:3000/draw/anlageDurmin
|
||||||
|
|
||||||
### Get All
|
### Get All
|
||||||
GET http://localhost:3000/draw/ellipse
|
GET http://localhost:3000/draw/ellipse
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user