import { Type } from "class-transformer"; import { ConfigManager } from "src/app/babylon/controller/config-manager"; import { TsTool } from "src/app/babylon/tool/ts-tool"; import { FacilityType } from "../../model-data/model-data-facility"; import { FacilityDatasByType } from "../../model-data/model-edit-data"; import { PropertyData_JYJ } from "../facility/property-data/in/property-data-jyj"; import { PropertyData_SYGX } from "../facility/property-data/in/property-data-sygx"; import { PropertyData_YG } from "../facility/property-data/in/property-data-yg"; import { PropertyData_YQHSGX } from "../facility/property-data/in/property-data-yqhsgx"; /** * 需要导出的数据 */ export class ExportData { // @Type(() => ExportData_JYJ) 加油机: ExportData_JYJ[] = []; // @Type(() => ExportData_YG) 油罐: ExportData_YG[] = []; // @Type(() => ExportData_SYGX) 输油管线: ExportData_SYGX[] = []; // @Type(() => ExportData_YQHS) 油气回收: ExportData_YQHS[] = []; // @Type(() => ExportData_XFSB) 消防设备: ExportData_XFSB[] = []; constructor(facilityByTypes: FacilityDatasByType[]) { for (let i = 0; i < facilityByTypes.length; i++) { let facilities = facilityByTypes[i].facilities; if (facilities == null) { continue; } let type = facilityByTypes[i].facilityType; if (TsTool.stringContain(type, "XF_")) { if (facilityByTypes[i].facilities.length > 0) { this.消防设备.push(new ExportData_XFSB(facilityByTypes[i])); } } for (let j = 0; j < facilities.length; j++) { switch (type) { case FacilityType.JY_JYJ: this.加油机.push(new ExportData_JYJ(facilities[j].propertyData as PropertyData_JYJ)); break; case FacilityType.JY_YG: this.油罐.push(new ExportData_YG(facilities[j].propertyData as PropertyData_YG)); break; case FacilityType.JY_SYGX: this.输油管线.push(new ExportData_SYGX(facilities[j].propertyData as PropertyData_SYGX)); break; case FacilityType.JY_YQHSGX: this.油气回收.push(new ExportData_YQHS(facilities[j].propertyData as PropertyData_YQHSGX)); break; } } } } } /** * 加油机信息 */ export class ExportData_JYJ { 名称: string; 品牌: string; 油枪数量: string; 油品品号: string; 油枪编号: string; 油泵类型: string; 流量: string; 功率: string; constructor(jyj_property: PropertyData_JYJ) { this.名称 = jyj_property.name; this.品牌 = jyj_property.brand; this.油枪数量 = jyj_property.oilGunNum; this.油品品号 = jyj_property.oilProductNo; this.油枪编号 = jyj_property.oilGunNo; this.油泵类型 = jyj_property.oilPumpType; this.流量 = jyj_property.flow; this.功率 = jyj_property.power; } } /** * 油罐信息 */ export class ExportData_YG { 名称: string; 油品品号: string; 油枪编号: string; 油罐容积: string; 安全容积: string; 罐区: string; 油罐类型: string; constructor(yg_property: PropertyData_YG) { this.名称 = yg_property.name; this.油品品号 = yg_property.oilProductNo; this.油枪编号 = yg_property.oilGunNo; this.油罐容积 = yg_property.oilTankVolume; this.安全容积 = yg_property.safeVolume; this.罐区 = yg_property.tankFarm; this.油罐类型 = yg_property.oilTankType; } } /** * 输油管线 */ export class ExportData_SYGX { 名称: string; 连接的加油机: string; 连接的油罐: string; constructor(sygx_property: PropertyData_SYGX) { this.名称 = sygx_property.name; this.连接的加油机 = sygx_property.linkJYJ; this.连接的油罐 = sygx_property.linkYG; } } /** * 油气回收 */ export class ExportData_YQHS { 名称: string; 油气回收系统类型: string; 油气回收泵类型: string; constructor(yqhs_property: PropertyData_YQHSGX) { this.名称 = yqhs_property.name; this.油气回收系统类型 = yqhs_property.VRUType; this.油气回收泵类型 = yqhs_property.VRUPumpType; } } /** * 导出的消防设备信息 */ export class ExportData_XFSB { 名称: string; 数目: string; constructor(facByType: FacilityDatasByType) { this.名称 = ConfigManager.getFacilityTypeName(facByType.facilityType); this.数目 = "0"; if (facByType.facilities != null) { this.数目 = facByType.facilities.length.toString(); } this.数目 += ConfigManager.getFacilityNumUnit(facByType.facilityType); } }