diff --git a/README.md b/README.md index 930f42ae..551206e7 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,6 @@ MyEMS项目由下列组件构成: [安装 admin UI](./admin/README.md) -### MyEMS BACnet/IP 数据采集服务 (Python) - -[安装 myems-bacnet](../myems-bacnet/README.md) - ### MyEMS Modbus TCP 数据采集服务 (Python) [安装 myems-modbus-tcp](./myems-modbus-tcp/README.md) @@ -73,6 +69,7 @@ git clone https://gitee.com/myems/myems.git # for generate the static direction: 'build' cd myems/web +npm install npm run build cd myems @@ -218,6 +215,11 @@ docker-compose up -d ![MyEMS Space EnergyCategory3](/docs/images/myems-space-energycategory3.gif) ![MyEMS Large Screen Dashboard](/docs/images/myems-large-screen-dashboard.gif) + +## MyEMS路线图 + +社区版[路线图](https://github.com/orgs/MyEMS/projects) + ## MyEMS镜像 [1]. http://github.com/MyEMS/myems diff --git a/README_DE.md b/README_DE.md index ad2d717d..8e94c70e 100644 --- a/README_DE.md +++ b/README_DE.md @@ -39,10 +39,6 @@ Dieses Projekt besteht aus folgenden Komponenten: [Installieren admin UI](./admin/README.md) -### MyEMS BACnet/IP Acquisition Service (Python) - -[Installieren myems-bacnet](../myems-bacnet/README.md) - ### MyEMS Modbus TCP Acquisition Service (Python) [Installieren myems-modbus-tcp](./myems-modbus-tcp/README.md) @@ -217,6 +213,12 @@ docker-compose up -d ![MyEMS Space EnergyCategory3](/docs/images/myems-space-energycategory3.gif) ![MyEMS Großbild-Dashboard](/docs/images/myems-large-screen-dashboard.gif) + +## MyEMS Straßenkarte + +Community Edition [Straßenkarte](https://github.com/orgs/MyEMS/projects) + + ## MyEMS Spiegel [1]. http://github.com/MyEMS/myems diff --git a/README_EN.md b/README_EN.md index 5545125f..8eafe3b4 100644 --- a/README_EN.md +++ b/README_EN.md @@ -39,10 +39,6 @@ This project is compose of following components: [Install admin UI](./admin/README.md) -### MyEMS BACnet/IP Acquisition Service (Python) - -[Install myems-bacnet](../myems-bacnet/README.md) - ### MyEMS Modbus TCP Acquisition Service (Python) [Install myems-modbus-tcp](./myems-modbus-tcp/README.md) @@ -220,6 +216,11 @@ docker-compose up -d ![MyEMS Large Screen Dashboard](/docs/images/myems-large-screen-dashboard.gif) +## MyEMS Roadmap + +Community Edition [Roadmap](https://github.com/orgs/MyEMS/projects) + + ## MyEMS Mirrors [1]. http://github.com/MyEMS/myems diff --git a/admin/app/translations.js b/admin/app/translations.js index 680c90bd..84e99af0 100644 --- a/admin/app/translations.js +++ b/admin/app/translations.js @@ -9,7 +9,6 @@ function config($translateProvider) { MY_EMS_NAME: 'MyEMS', LANGUAGE: 'Language', FULLSCREEN: 'Full Screen', - ENTER_SYSTEM: 'Enter System', EXITFULLSCREEN: 'Exit Full Screen', LOGOUT: 'Logout', COMMON: { @@ -25,42 +24,7 @@ function config($translateProvider) { SENSOR: 'Sensor', ENERGY_FLOW_DIAGRAM: 'Energy Flow Diagram', MENU: 'Menu', - PERIOD: { - LABEL: 'Date period', - YEAR: 'Year', - MONTH: 'Month', - DAY: 'Day', - HOUR: 'Hour', - }, DATE: 'Date Range', - ANALYSIS: { - LABEL: 'Analysis Type', - ENERGY: 'Energy', - COST: 'Cost' - }, - ENERGYFLOW: { - LABEL: 'Energy Flow Type', - INCOME: 'Input', - OUTPUT: 'Output' - }, - COMPARE: { - LABEL: 'Compare Type', - TREND: 'Trend', - COMPARE: 'Compare', - }, - STATISTICS: { - LABEL: 'EnPI Type', - COMMON: 'Common', - KEYDEVICE: 'Equipment Attribute', - WORKINGDAY: 'Working Day', - STATUS: 'Equipment Status', - CPU: 'CPU' - }, - CHARTTYPE: { - LABEL: 'Chart Type', - COLUMN: 'Column', - LINE: 'Line' - }, TARIFF: { TOPPEAK: 'Top-peak', ONPEAK: 'On-peak', @@ -68,18 +32,6 @@ function config($translateProvider) { MIDPEAK: 'Mid-peak' } }, - REPORT: { - REPORT: 'Report', - REPORT_LIST: 'Report List', - CREATE_TIME: 'Create Time', - FILE_NAME: 'File Name', - TABLE: { - ENERGYDATA: 'Detailed Data', - TIME: 'Time', - HOUR: 'Hour', - TOTAL: 'Total' - } - }, FDD: { ID: 'ID', RULE: 'Rule', @@ -87,7 +39,6 @@ function config($translateProvider) { TEXT_MESSAGE: 'Text Message', WEB_MESSAGE: 'Web Message', WECHAT_MESSAGE: 'Wechat Message', - RECIPIENT: 'Recipient', ALARM_LIST: 'Alarm List', RULE_LIST: 'Rule List', @@ -203,9 +154,6 @@ function config($translateProvider) { ADD_TARIFF: 'Add Tariff', ADD_CATEGORY: 'Add Energy Category', ADD_ENERGY_ITEM: 'Add Energy Item', - ADD_TARIFF: 'Add Tariff', - ADD_EMAIL_RECIPIENT: 'Add Recipient', - ADD_SMS_RECIPIENT: 'Add Recipient', ADD_CONTACT: 'Add Contact', ADD_EMAIL_SERVER: 'Add Email Server', ADD_GSM_MODEM: 'Add GSM Modem', @@ -221,8 +169,6 @@ function config($translateProvider) { EDIT_TARIFF: 'Edit Tariff', EDIT_CATEGORY: 'Edit Energy Category', EDIT_TARIFF: 'Edit Tariff', - EDIT_EMAIL_RECIPIENT: 'Edit Recipient', - EDIT_SMS_RECIPIENT: 'Edit Recipient', EDIT_CONTACT: 'Edit Contact', EDIT_EMAIL_SERVER: 'Edit Email Server', EDIT_GSM_MODEM: 'Edit GSM Modem', @@ -242,17 +188,14 @@ function config($translateProvider) { BIND_POINT: 'Point Point', BIND_SENSOR: 'Bind Sensor', BIND_TARIFF: 'Point Tariff', - PHONE_ID_FORMAT: 'Please Add The Country Code:0086+Phone Number', INPUT_NAME: 'Please Input Name', INPUT_AREA: 'Please Input Area', INPUT_UNIT: 'Please Input Unit', INPUT_CONTACT: 'Please Input Contact', INPUT_EXPRESSION: 'Please Input Expression', - INPUT_SERIAL_NUMBER: 'Please Input Serial Number', INPUT_KGCE: 'Please Input KGCE', INPUT_KGCO2E: 'Please Input KGCO2E', - INPUT_TAG: 'Please Input Tag', INPUT_HOST: 'Please Input Host', INPUT_PORT: 'Please Input Port', INPUT_USER_NAME: 'Please Input User Name', @@ -265,7 +208,6 @@ function config($translateProvider) { INVALID_FROM_ADDR: 'Invalid From Addr', INVALID_BAUD_RATE: 'Invalid Baud Rate', NOT_NULLABLE: 'Please Input Required', - MASTER_METER: 'Master Meter', METER: 'Meter', VIRTUAL_METER: 'Virtual Meter', OFFLINE_METER: 'Offline Meter', @@ -279,7 +221,6 @@ function config($translateProvider) { SENSOR_LIST: 'Sensor List', METER_TYPE: 'Meter Type', METER_NAME: 'Meter Name', - METER_STATUS: 'Meter Status', TRASH: 'Trash', DRAG_TO_BIND: 'Drag to left to bind', DRAG_TO_UNBIND: 'Drag to trash to unbind', @@ -289,7 +230,6 @@ function config($translateProvider) { AREA: 'Area', UNIT: 'Unit', CONTACT: 'Contact', - ENERGY_SYSTEM_CONTACT: 'Energy System Contact', TIMEZONE: 'Timezone', TARIFF: 'Tariff', @@ -298,11 +238,6 @@ function config($translateProvider) { ENERGY_ITEM: 'Energy Item', STATUS: 'Status', UPLOAD_TIME: 'Uploaded Time', - SERIAL_NUMBER: 'Serial Number', - COEF: 'Coef', - TAG: 'Tag', - BASELINE_CPU: 'CPU Baseline', - BASELINE_COST: 'Cost Baseline', EXPRESSION: 'Expression', VARIABLE_NAME: 'Variable Name', POINT: 'Point', @@ -322,30 +257,17 @@ function config($translateProvider) { START_AMOUNT: 'Start Amount', END_AMOUNT: 'End Amount', - GSM: 'GSM', - SMS: 'SMS', PORT: 'Port', + SMS: 'SMS', SERIAL_PORT: 'Serial Port', BAUD_RATE: 'Baud Rate', FROM_ADDR: 'From Address', HOST: 'Host', USER_NAME: 'User Name', - SUSPENDED: 'Suspended', - IDLING: 'Idling', - RUNNING: 'Running', - SROSS: 'shutdown rate of standard status on non-working days', - USER: 'User', - TEAM: 'Team', - ADD_TEAM: 'Add Team', - EDIT_TEAM: 'Edit Team', SEARCH: 'Search...', - METER_DATA: 'Meter Data', - START_ENERGY: 'Start Energy Value', - END_ENERGY: 'End Energy Value', - DIFF_VALUE: 'Diff Value', RESTORE: 'Restore', RESTORE_SUCCESS: 'Restore Success', @@ -411,7 +333,6 @@ function config($translateProvider) { LAST_SEEN_DATETIME: 'Last Seen Datetime', INPUT_PROTOCOL: 'Please Input Protocol', INPUT_CONNECTION: 'Please Input Connection', - }, POINT: { OBJECT_TYPE: 'Object Type', @@ -634,9 +555,7 @@ function config($translateProvider) { }, TOASTER: { FAILURE_TITLE: 'Error', - FAILURE: 'Failure', ERROR: 'error', - OPTIONS_ERROR: 'Options Error', SUCCESS: 'success', SUCCESS_TITLE: 'Success', LOGIN_SUCCESS: 'Login Success.', @@ -701,7 +620,6 @@ function config($translateProvider) { STORE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: 'Store and Offline Meter Relationship Not Found', STORE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: 'Store and Virtual Meter Relationship Not Found', ASSOCIATED_POINTS_NOT_FOUND: 'Associated Points Not Found', - COMPLEX_NOT_FOUND: 'Complex Not Found', COST_CENTER_NOT_FOUND: 'Cost Center Not Found', COST_CENTER_EXTERNAL_ID_EXISTS: 'Cost Center External ID exists', COST_CENTER_NAME_EXISTS: 'Cost Center name exists', @@ -728,10 +646,6 @@ function config($translateProvider) { SPACE_ALREADY_ASSOCIATED_WITH_METER: 'Space already Associated with Meter', SPACE_ALREADY_ASSOCIATED_WITH_OFFLINE_METER: 'Space already Associated with Offline Meter', SPACE_ALREADY_ASSOCIATED_WITH_VIRTUAL_METER: 'Space already Associated with Virtual Meter', - SPACE_AND_METER_RELATIONSHIP_NOT_FOUND: 'Space and Meter Relationship Not Found', - SPACE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: 'Space and Offline Meter Relationship Not Found', - SPACE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: 'Space and Virtual Meter Relationship Not Found', - GSM_CONFIG_NOT_FOUND: 'GSM Config Not Found', KNOWLEDGE_FILE_NOT_FOUND: 'Knowledge File Not Found', INVALID_: 'Invalid ', INVALID_TENANT_ID: 'Invalid Tenant ID', @@ -742,23 +656,15 @@ function config($translateProvider) { INVALID_DATA_SOURCE_ID: 'Invalid Data Source ID', INVALID_DATA_SOURCE_NAME: 'Invalid Data Source Name', INVALID_DATA_SOURCE_PROTOCOL: 'Invalid Data Source Protocol.', - // INVALID_DATE_(EXPECTED_FORMAT:_YYYY-MM-DD): 'Invalid Date (expected format: YYYY-MM-DD', - INVALID_DATE: 'Invalid Date (expected format: YYYY-MM-DD)', - INVALID_DATETIME_DATA: 'Invalid Datetime Data', INVALID_EMAIL_MESSAGE_ID: 'Invalid Email Message ID', - INVALID_EMAIL_RECIPIENT_ID: 'Invalid Email Recipient ID', INVALID_ENERGY_CATEGORY_ID: 'Invalid Energy Category ID', INVALID_EQUIPMENT_ID: 'Invalid Equipment ID', INVALID_COMBINED_EQUIPMENT_ID: 'Invalid Combined Equipment ID', INVALID_SPACE_ID: 'Invalid Space ID', - INVALID_GSM_CONFIG_ID: 'Invalid GSM Config ID', INVALID_KNOWLEDGE_FILE_ID: 'Invalid Knowledge File ID', - INVALID_ID: 'Invalid ID', - INVALID_MESSAGE_ID: 'Invalid Message ID', INVALID_METER_ID: 'Invalid Meter ID', INVALID_METER_UUID: 'Invalid Meter UUID', INVALID_COST_FILE_ID: 'Invalid Cost File ID', - INVALID_OFFLINE_METER_FILE__ID: 'Invalid Offline Meter File ID', INVALID_OFFLINE_METER_FILE_ID: 'Invalid Offline Meter File ID', INVALID_OFFLINE_METER_ID: 'Invalid Offline Meter ID', INVALID_PART_ID: 'Invalid Part ID', @@ -766,7 +672,6 @@ function config($translateProvider) { INVALID_POINT_ID: 'Invalid Point ID', INVALID_PRIVILEGE_ID_: 'Invalid Privilege ID ', INVALID_PRIVILEGE_ID: 'Invalid Privilege ID', - INVALID_PRIVILEGE_TO_RESET_PASSWORD: 'Invalid Privilege to Reset Password', INVALID_PRODUCT_ID: 'Invalid Product ID', INVALID_PRODUCT_SHIFT_ID: 'Invalid Product Shift ID', INVALID_RULE_ID: 'Invalid Rule ID', @@ -784,36 +689,14 @@ function config($translateProvider) { INVALID_VIRTUAL_METER_ID: 'Invalid Virtual Meter ID', INVALID_VIRTUAL_METER_NAME: 'Invalid Virtual Meter Name', INVALID_WEB_MESSAGE_ID: 'Invalid Web Message ID', - INVALID_COOKIES_PLEASE_RE_LOGIN: 'Invalid cookies, Please Re-Login', INVALID_EMAIL: 'Invalid email', - INVALID_EMS_CONTACT_EMAIL_VALUE: 'Invalid ems_contact_email value', - INVALID_EMS_CONTACT_NAME_VALUE: 'Invalid ems_contact_name value', - INVALID_EMS_CONTACT_PHONE_VALUE: 'Invalid ems_contact_phone value', - INVALID_END_DATE_TIME: 'Invalid end date(full expected format: YYYY-MM-DDTHH:MM:SS)', - INVALID_END_DATE_TIME_YMD: 'Invalid end date time (expected format: YYYY-MM-DD)', - INVALID_END_DATE_TIME_YMDHMS: 'Invalid end date time (expected format: YYYY-MM-DDTHH:MM:SS)', INVALID_EQUATION_IN_EXPRESSION: 'Invalid equation in expression', INVALID_EXPRESSION_OBJECT: 'Invalid expression object', - INVALID_EXTERNAL_ID_VALUE: 'Invalid External ID value', INVALID_IS_COUNTED_VALUE: 'Invalid is_counted value', - INVALID_IS_EQUIPMENT_STATUS_COUNTED_VALUE: 'Invalid is_equipment_status_counted value', - INVALID_IS_COMBINED_EQUIPMENT_STATUS_COUNTED_VALUE: 'Invalid is_combined_equipment_status_counted value', INVALID_IS_OUTPUT_VALUE: 'Invalid is_output value', INVALID_IS_OUTPUT_COUNTED_VALUE: 'Invalid is_output_counted value', - INVALID_IS_PRODUCT_COUNTED_VALUE: 'Invalid is_product_counted value', INVALID_PARTS_PER_HOUR_VALUE: 'Invalid parts_per_hour value', INVALID_PASSWORD: 'Invalid password', - INVALID_PERIOD: 'Invalid period', - INVALID_PERIOD_FORMAT: 'Invalid period (expected \'year\', \'month\', \'day\' or \'hour\')', - INVALID_PRIVILEGES_VALUE: 'Invalid privileges value', - INVALID_PRODUCTID_ID: 'Invalid productid ID', - INVALID_SERIAL_NUMBER_VALUE: 'Invalid serial_number value', - INVALID_START_DATE_TIME: 'Invalid start date time (full expected format: YYYY-MM-DDTHH:MM:SS)', - INVALID_START_DATE_TIME_YMD: 'Invalid start date time (expected format: YYYY-MM-DD)', - INVALID_START_DATE_TIME_YMDHMS: 'Invalid start date time (expected format: YYYY-MM-DDTHH:MM:SS)', - INVALID_SUSPENDED_VALUE: 'Invalid suspended value', - INVALID_USE_LIFE_END_VALUE: 'Invalid use_life_end value', - INVALID_USE_LIFE_START_VALUE: 'Invalid use_life_start value', INVALID_VARIABLE_METER_ID: 'Invalid variable meter id', INVALID_VARIABLE_METER_TYPE: 'Invalid variable meter type', INVALID_VARIABLE_NAME: 'Invalid variable name', @@ -827,69 +710,44 @@ function config($translateProvider) { LINE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: 'Line and Offline Meter Relationship Not Found', LINE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: 'Line and Virtual Meter Relationship Not Found', METER_NOT_FOUND: 'Meter Not Found', - METER_POINT_RELATIONSHIP_EXISTED: 'Meter Point Relationship Existed', - METER_POINT_RELATIONSHIP_NOT_FOUND: 'Meter Point Relationship Not Found', METER_OF_VARIABLE_NOT_FOUND: 'Meter of Variable Not Found', COST_FILE_NOT_FOUND: 'Cost File Not Found', OFFLINE_METER_FILE_NOT_FOUND: 'Offline Meter File Not Found', OFFLINE_METER_NOT_FOUND: 'Offline Meter Not Found', OFFLINE_METER_OF_VARIABLE_NOT_FOUND: 'Offline Meter of Variable Not Found', - PLEASE_RE_LOGIN: 'Please Re-Login', POINT_NOT_FOUND: 'Point Not Found', PRIVILEGE_NOT_FOUND: 'Privilege Not Found', PRODUCT_NOT_FOUND: 'Product Not Found', PRODUCT_OUTPUT_NOT_FOUND: 'Product Output Not Found', PRODUCT_SHIFT_NOT_FOUND: 'Product Shift Not Found', RULE_NOT_FOUND: 'Rule Not Found', - SMS_RECIPIENT_NOT_FOUND: 'SMS Recipient Not Found', - START_DATE_SHOULD_BE_EARLY_THAN_END_DATE: 'Start date should be early than end date', START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME: 'Start datetime should be early than end datetime', TARIFF_IN_USE: 'Tariff In Use', TARIFF_NOT_EMPTY: 'Tariff Not Empty', TARIFF_NOT_FOUND: 'Tariff Not Found', - TARIFF_ALREADY_ASSOCIATED_WITH_COSTCENTER: 'Tariff already Associated with Cost Center', - TARIFF_ALREADY_ASSOCIATED_WITH_SPACE: 'Tariff already Associated with Space', TARIFF_IS_NOT_ASSOCIATED_WITH_COST_CENTER: 'Tariff is not associated with Cost Center', - TARIFF_IS_NOT_ASSOCIATED_WITH_SPACE: 'Tariff is not associated with Space', - POINT_ALREADY_ASSOCIATED_WITH_SPACE: 'Point already Associated with Space', - POINT_IS_NOT_ASSOCIATED_WITH_SPACE: 'Point is not associated with Space', - TEAM_NOT_FOUND: 'Team Not Found', TEXT_MESSAGE_NOT_FOUND: 'Text Message Not Found', - THERE_IS_RELATIONSHIP_WITH_TENANTS: 'There is relationship with Tenants', - THERE_IS_RELATIONSHIP_WITH_STORES: 'There is relationship with Stores', - THERE_IS_RELATIONSHIP_WITH_COMPANIES: 'There is relationship with companies', THERE_IS_RELATIONSHIP_WITH_EQUIPMENTS: 'There is relationship with equipments', - THERE_IS_RELATIONSHIP_WITH_COMBINED_EQUIPMENTS: 'There is relationship with combined equipments', THERE_IS_RELATIONSHIP_WITH_SPACES: 'There is relationship with spacees', THERE_IS_RELATIONSHIP_WITH_LINES: 'There is relationship with lines', - THERE_IS_RELATIONSHIP_WITH_METERS: 'There is relationship with meters', - THERE_IS_RELATIONSHIP_WITH_OFFLINE_METERS: 'There is relationship with offline meters', - THERE_IS_RELATIONSHIP_WITH_TEAMS: 'There is relationship with teams', THERE_IS_RELATIONSHIP_WITH_USERS: 'There is relationship with users', - THERE_IS_RELATIONSHIP_WITH_VIRTUAL_METERS: 'There is relationship with virtual meters', TIMEZONE_NOT_FOUND: 'Timezone Not Found', USER_NOT_FOUND: 'User Not Found', USER_SESSION_TIMEOUT: 'User Session Timeout', USER_SESSION_NOT_FOUND: 'User session Not Found', - VIRTUAL_METER_NAME_ALREADY_EXISTS: 'Virtual Meter Name already Exists', VIRTUAL_METER_NOT_FOUND: 'Virtual Meter Not Found', VIRTUAL_METER_OF_VARIABLE_NOT_FOUND: 'Virtual Meter of Variable Not Found', WEB_MESSAGE_NOT_FOUND: 'Web Message Not Found', - WEBMESSAGE_NOT_FOUND: 'Web Message Not Found', }, }) .translations('cn', { MY_EMS_NAME: 'MyEMS', LANGUAGE: '语 言', FULLSCREEN: '全屏显示', - ENTER_SYSTEM: '进入管理系统', EXITFULLSCREEN: '退出全屏', LOGOUT: '退出', COMMON: { EXECUTE: '执行', - EDIT: '修改', - DELETE: '删除', - ACTION: '操作', PLACEHOLDER: '请选择或搜索...', SPACE: '空间', EQUIPMENT: '设备', @@ -897,46 +755,10 @@ function config($translateProvider) { TENANT: '租户', STORE: '门店', SHOPFLOOR: '车间', - DATA_SOURCE: '数据源', SENSOR: '传感器', ENERGY_FLOW_DIAGRAM: '能流图', MENU: '菜单', - PERIOD: { - LABEL: '选择范围', - YEAR: '年', - MONTH: '月', - DAY: '日', - HOUR: '时', - }, DATE: '日期', - ANALYSIS: { - LABEL: '显示方式', - ENERGY: '能耗', - COST: '费用' - }, - ENERGYFLOW: { - LABEL: '能源流向', - INCOME: '流入', - OUTPUT: '流出' - }, - COMPARE: { - LABEL: '比较方式', - TREND: '趋势', - COMPARE: '比较' - }, - STATISTICS: { - LABEL: '分析方式', - COMMON: '常规分析', - KEYDEVICE: '按设备属性', - WORKINGDAY: '按生产日非生产日', - STATUS: '按设备状态能耗', - CPU: '按单台能耗', - }, - CHARTTYPE: { - LABEL: '图表显示方式', - COLUMN: '柱状图', - LINE: '曲线图' - }, TARIFF: { TOPPEAK: '尖', ONPEAK: '峰', @@ -944,18 +766,6 @@ function config($translateProvider) { MIDPEAK: '平' } }, - REPORT: { - REPORT: '报表', - REPORT_LIST: '报表列表', - CREATE_TIME: '创建时间', - FILE_NAME: '文件名', - TABLE: { - ENERGYDATA: '详细数据', - TIME: '时间', - HOUR: '时', - TOTAL: '汇总' - } - }, FDD: { ID: 'ID', RULE: '规则', @@ -963,7 +773,6 @@ function config($translateProvider) { TEXT_MESSAGE: '短信信息', WEB_MESSAGE: '网页信息', WECHAT_MESSAGE: '微信信息', - RECIPIENT: '收件人', ALARM_LIST: '查看报警列表', RULE_LIST: '规则列表', @@ -1073,14 +882,11 @@ function config($translateProvider) { ADD_METER: '添加计量表', ADD_VIRTUAL_METER: '添加虚拟表', ADD_OFFLINE_METER: '添加离线表', - ADD_POINT: '添加点位', + ADD_POINT: '添加数据点', ADD_COSTCENTER: '添加成本中心', ADD_TARIFF: '添加费率', ADD_CATEGORY: '添加能源分类', ADD_ENERGY_ITEM: '添加能耗分项', - ADD_TARIFF: '添加费率', - ADD_EMAIL_RECIPIENT: '添加收件人', - ADD_SMS_RECIPIENT: '添加联系人', ADD_CONTACT: '添加联系人', ADD_EMAIL_SERVER: '添加邮件服务器', ADD_GSM_MODEM: '添加短信模块', @@ -1091,19 +897,14 @@ function config($translateProvider) { EDIT_METER: '编辑计量表', EDIT_VIRTUAL_METER: '编辑虚拟表', EDIT_OFFLINE_METER: '编辑离线表', - EDIT_POINT: '编辑点位', + EDIT_POINT: '编辑数据点', EDIT_COSTCENTER: '编辑成本中心', EDIT_TARIFF: '编辑费率', EDIT_CATEGORY: '编辑能源分类', EDIT_ENERGY_ITEM: '编辑能耗分项', - EDIT_EMAIL_RECIPIENT: '编辑收件人', - EDIT_SMS_RECIPIENT: '编辑联系人', EDIT_CONTACT: '编辑联系人', EDIT_EMAIL_SERVER: '编辑邮箱服务器', EDIT_GSM_MODEM: '编辑短信模块', - EDIT_PARAM_COMBINED_EQUIPMENT: '编辑组合设备参数', - EDIT_PARAM_EQUIPMENT: '编辑设备参数', - EDIT_PARAM_SPACE: '编辑空间参数', REQUIRES_AUTHENTICATION: '需要身份验证', SELECT_SPACE: '请选择用能单位', @@ -1122,17 +923,14 @@ function config($translateProvider) { BIND_POINT: '绑定数据点', BIND_SENSOR: '绑定传感器', BIND_TARIFF: '绑定费率', - PHONE_ID_FORMAT: '请添加国家码:如0086+手机号码', INPUT_NAME: '请输入名称', INPUT_AREA: '请输入面积', INPUT_UNIT: '请输入单位', INPUT_CONTACT: '请输入联系人', INPUT_EXPRESSION: '请输入表达式', - INPUT_SERIAL_NUMBER: '请输入序列号', INPUT_KGCE: '请输入标准煤系数', INPUT_KGCO2E: '请输入二氧化碳排放系数', - INPUT_TAG: '请输入标签', INPUT_HOST: '请输入服务器', INPUT_PORT: '请输入端口号', INPUT_USER_NAME: '请输入用户名', @@ -1146,7 +944,6 @@ function config($translateProvider) { INVALID_FROM_ADDR: '发件人地址不正确', INVALID_BAUD_RATE: '波特率不正确', NOT_NULLABLE: '不允许为空', - MASTER_METER: '总表', METER: '计量表', VIRTUAL_METER: '虚拟表', OFFLINE_METER: '离线表', @@ -1161,7 +958,6 @@ function config($translateProvider) { SENSOR_LIST: '传感器列表', METER_TYPE: '计量表类型', METER_NAME: '计量表名', - METER_STATUS: '计量表状态', TRASH: '回收桶', DRAG_TO_BIND: '请拖拽完成绑定', DRAG_TO_UNBIND: '请拖拽至回收桶解除绑定', @@ -1170,7 +966,6 @@ function config($translateProvider) { AREA: '面积', UNIT: '单位', CONTACT: '联系人', - ENERGY_SYSTEM_CONTACT: '能耗系统联系人', TIMEZONE: '时区', TARIFF: '费率', @@ -1179,11 +974,6 @@ function config($translateProvider) { ENERGY_ITEM: '能耗分项', STATUS: '状态', UPLOAD_TIME: '上传时间', - SERIAL_NUMBER: '编号', - COEF: '折标系数', - TAG: '标签', - BASELINE_CPU: '单耗基线', - BASELINE_COST: '单耗费用基线', EXPRESSION: '表达式', VARIABLE_NAME: '变量名', POINT: '数据点', @@ -1204,7 +994,6 @@ function config($translateProvider) { END_AMOUNT: '结束量', PORT: '端口', - GSM: 'GSM', SMS: '短信', SERIAL_PORT: '串口地址', BAUD_RATE: '波特率', @@ -1212,24 +1001,9 @@ function config($translateProvider) { HOST: '服务器', USER_NAME: '用户名', - SUSPENDED: '待机', - IDLING: '空运转', - RUNNING: '运行', - PARAM_COMBINED_EQUIPMENT: '组合设备参数管理', - PARAM_EQUIPMENT: '设备参数管理', - PARAM_SPACE: '空间参数管理', - SROSS: '非生产日标准状态下关闭率', - USER: '用户', - TEAM: '班组', - ADD_TEAM: '添加班组', - EDIT_TEAM: '编辑班组', SEARCH: '搜索...', - METER_DATA: '计量表数据', - START_ENERGY: '起始能耗值', - END_ENERGY: '结束能耗值', - DIFF_VALUE: '差值', RESTORE: '恢复', RESTORE_SUCCESS: '恢复成功', @@ -1524,10 +1298,8 @@ function config($translateProvider) { DELETE: '删除', }, TOASTER: { - FAILURE: '失败', FAILURE_TITLE: '错误', ERROR: 'error', - OPTIONS_ERROR: '选项错误', SUCCESS: 'success', SUCCESS_TITLE: '成功', LOGIN_SUCCESS: '登录成功。', @@ -1593,7 +1365,6 @@ function config($translateProvider) { STORE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: '未找到门店和离线表关系', STORE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: '未找到门店和虚拟表关系', ASSOCIATED_POINTS_NOT_FOUND: '未找到数据点', - COMPLEX_NOT_FOUND: '未找到复杂产品', COST_CENTER_NOT_FOUND: '未找到成本中心', COST_CENTER_EXTERNAL_ID_EXISTS: '成本中心外部ID已存在', COST_CENTER_NAME_EXISTS: '成本中心名称存在', @@ -1621,10 +1392,6 @@ function config($translateProvider) { SPACE_ALREADY_ASSOCIATED_WITH_METER: '空间已经与计量表相关联', SPACE_ALREADY_ASSOCIATED_WITH_OFFLINE_METER: '空间已经与离线表相关联', SPACE_ALREADY_ASSOCIATED_WITH_VIRTUAL_METER: '空间已经与虚拟表相关联', - SPACE_AND_METER_RELATIONSHIP_NOT_FOUND: '未找到空间和计量表的关系', - SPACE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: '未找到空间和离线表关系', - SPACE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: '未找到空间和虚拟表关系', - GSM_CONFIG_NOT_FOUND: '未找到GSM配置', KNOWLEDGE_FILE_NOT_FOUND: '未找到知识文件', INVALID_: '无效', INVALID_TENANT_ID: '无效的租户ID', @@ -1634,30 +1401,22 @@ function config($translateProvider) { INVALID_DATA_SOURCE_ID: '无效的数据源ID', INVALID_DATA_SOURCE_NAME: '无效的数据源名称', INVALID_DATA_SOURCE_PROTOCOL: '无效的数据源协议。', - INVALID_DATE: '无效的日期(预期格式:YYYY-MM-DD)', - INVALID_DATETIME_DATA: '无效的日期时间数据', INVALID_EMAIL_MESSAGE_ID: '无效的电子邮件ID', - INVALID_EMAIL_RECIPIENT_ID: '无效的电子邮件收件人ID', INVALID_ENERGY_CATEGORY_ID: '无效的能源分类ID', INVALID_ENERGY_ITEM_ID: '无效的能耗分项ID', INVALID_COMBINED_EQUIPMENT_ID: '无效的设备ID', INVALID_EQUIPMENT_ID: '无效的设备ID', INVALID_SPACE_ID: '无效的空间ID', - INVALID_GSM_CONFIG_ID: '无效的GSM配置ID', INVALID_KNOWLEDGE_FILE_ID: '无效的知识文件ID', - INVALID_ID: '无效的ID', - INVALID_MESSAGE_ID: '无效的消息ID', INVALID_METER_ID: '无效的计量表ID', INVALID_METER_UUID: '无效的计量表UUID', INVALID_COST_FILE_ID: '无效的成本文件ID', - INVALID_OFFLINE_METER_FILE__ID: '无效的离线表文件ID', INVALID_OFFLINE_METER_FILE_ID: '无效的离线表文件ID', INVALID_OFFLINE_METER_ID: '无效的离线表ID', INVALID_PASSWORD: '无效的密码', INVALID_POINT_ID: '无效的点ID', INVALID_PRIVILEGE_ID_: '无效的权限ID', INVALID_PRIVILEGE_ID: '无效的权限ID', - INVALID_PRIVILEGE_TO_RESET_PASSWORD: '无效的重置密码权限', INVALID_RULE_ID: '无效的规则ID', INVALID_TARIFF_BLOCK_PRICING: '无效的阶梯费率价格', INVALID_TARIFF_ID: '无效的费率ID', @@ -1669,79 +1428,37 @@ function config($translateProvider) { INVALID_VIRTUAL_METER_ID: '无效的虚拟表ID', INVALID_VIRTUAL_METER_NAME: '无效的虚拟表名称', INVALID_WEB_MESSAGE_ID: '无效的网页信息ID', - INVALID_COOKIES_PLEASE_RE_LOGIN: '无效的Cookie,请重新登录', INVALID_EMAIL: '无效的邮箱', - INVALID_EMS_CONTACT_EMAIL_VALUE: '无效的ems_contact_email值', - INVALID_EMS_CONTACT_NAME_VALUE: '无效的ems_contact_name值', - INVALID_EMS_CONTACT_PHONE_VALUE: '无效的ems_contact_phone值', - INVALID_END_DATE_TIME: '无效的结束日期(完整预期格式:YYYY-MM-DDTHH:MM:SS)', - INVALID_END_DATE_TIME_YMD: '无效的结束日期时间(预期格式:YYYY-MM-DDTHH)', - INVALID_END_DATE_TIME_YMDHMS: '无效的结束日期时间(预期格式:YYYY-MM-DDTHH:MM:SS)', INVALID_EQUATION_IN_EXPRESSION: '无效的表达式公式', INVALID_EXPRESSION_OBJECT: '无效的表达式对象', - INVALID_EXTERNAL_ID_VALUE: '无效的外部ID', INVALID_IS_COUNTED_VALUE: '无效的is_counted值', - INVALID_IS_COMBINED_EQUIPMENT_STATUS_COUNTED_VALUE: '无效的is_equipment_status_counted值', - INVALID_IS_EQUIPMENT_STATUS_COUNTED_VALUE: '无效的is_equipment_status_counted值', INVALID_IS_OUTPUT_VALUE: '无效的is_output值', INVALID_IS_OUTPUT_COUNTED_VALUE: '无效的is_output_counted值', - INVALID_IS_PRODUCT_COUNTED_VALUE: '无效的is_product_counted值', - INVALID_PERIOD: '无效的时间期', - INVALID_PERIOD_FORMAT: '无效的时间期格式(预期格式\'年\',\'月\',\'天\'或\'小时\')', - INVALID_PRIVILEGES_VALUE: '无效的时间期', - INVALID_PRODUCTID_ID: '无效的产品ID', - INVALID_SERIAL_NUMBER_VALUE: '无效的serial_number值', - INVALID_START_DATE_TIME: '无效的开始日期时间(完整的预期格式:YYYY-MM-DDTHH:MM:SS)', - INVALID_START_DATE_TIME_YMD: '无效的开始日期时间(预期格式:YYYY-MM-DD)', - INVALID_START_DATE_TIME_YMDHMS: '无效的开始日期时间(预期格式:YYYY-MM-DDTHH:MM:SS)', - INVALID_SUSPENDED_VALUE: '无效的暂停值', - INVALID_USE_LIFE_END_VALUE: '无效的设备使用期结束值', - INVALID_USE_LIFE_START_VALUE: '无效的设备使用期起始值', INVALID_VARIABLE_METER_ID: '无效的变量meter_id', INVALID_VARIABLE_METER_TYPE: '无效的变量meter_type', INVALID_VARIABLE_NAME: '无效的变量名称', METER_NOT_FOUND: '未找到计量表', - METER_POINT_RELATIONSHIP_EXISTED: '存在计量表和点的关系', - METER_POINT_RELATIONSHIP_NOT_FOUND: '未找到计量表和点的关系', METER_OF_VARIABLE_NOT_FOUND: '未找到变量关联的计量表', COST_FILE_NOT_FOUND: '未找到成本文件', OFFLINE_METER_FILE_NOT_FOUND: '未找到离线表文件', OFFLINE_METER_NOT_FOUND: '未找到离线表', OFFLINE_METER_OF_VARIABLE_NOT_FOUND: '未找到变量关联的离线表', - PLEASE_RE_LOGIN: '请重新登录', POINT_NOT_FOUND: '未找到数据点', PRIVILEGE_NOT_FOUND: '未找到权限', RULE_NOT_FOUND: '未找到规则', - SMS_RECIPIENT_NOT_FOUND: '未找到短信收件人', - START_DATE_SHOULD_BE_EARLY_THAN_END_DATE: '开始日期应早于结束日期', START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME: '开始日期时间应早于结束日期时间', TARIFF_IN_USE: '费率正在使用中', TARIFF_NOT_EMPTY: '费率不为空', TARIFF_NOT_FOUND: '未找到费率', - TARIFF_ALREADY_ASSOCIATED_WITH_COSTCENTER: '费率已经与成本中心关联', - TARIFF_ALREADY_ASSOCIATED_WITH_SPACE: '费率已经与空间联系', TARIFF_IS_NOT_ASSOCIATED_WITH_COST_CENTER: '费率与成本中心未关联', - TARIFF_IS_NOT_ASSOCIATED_WITH_SPACE: '费率与空间未关联', - POINT_ALREADY_ASSOCIATED_WITH_SPACE: '数据点已经与空间联系', - POINT_IS_NOT_ASSOCIATED_WITH_SPACE: '数据点与空间未关联', - TEAM_NOT_FOUND: '未找到班组', TEXT_MESSAGE_NOT_FOUND: '未找到短信', - THERE_IS_RELATIONSHIP_WITH_TENANTS: '与租户有关系', - THERE_IS_RELATIONSHIP_WITH_STORES: '与门店有关系', - THERE_IS_RELATIONSHIP_WITH_COMPANIES: '与公司有关系', - THERE_IS_RELATIONSHIP_WITH_COMBINED_EQUIPMENTS: '与组合设备有关系', THERE_IS_RELATIONSHIP_WITH_EQUIPMENTS: '与设备有关系', THERE_IS_RELATIONSHIP_WITH_SPACES: '与空间有关系', - THERE_IS_RELATIONSHIP_WITH_METERS: '与计量表有关系', - THERE_IS_RELATIONSHIP_WITH_OFFLINE_METERS: '与离线表有关系', - THERE_IS_RELATIONSHIP_WITH_TEAMS: '与班组有关系', THERE_IS_RELATIONSHIP_WITH_USERS: '与用户有关系', - THERE_IS_RELATIONSHIP_WITH_VIRTUAL_METERS: '与虚拟表有关系', TIMEZONE_NOT_FOUND: '未找到时区', USER_NOT_FOUND: '未找到用户', USER_SESSION_TIMEOUT: '用户会话超时', USER_SESSION_NOT_FOUND: '未找到用户会话', - VIRTUAL_METER_NAME_ALREADY_EXISTS: '虚拟表名称已存在', VIRTUAL_METER_NOT_FOUND: '未找到虚拟表', VIRTUAL_METER_OF_VARIABLE_NOT_FOUND: '未找到变量的虚拟表', WEB_MESSAGE_NOT_FOUND: '未找到网页信息', @@ -1751,14 +1468,10 @@ function config($translateProvider) { MY_EMS_NAME: 'MyEMS', LANGUAGE: 'Sprache', FULLSCREEN: 'Vollbildanzeige', - ENTER_SYSTEM: 'Geben Sie das Managementsystem ein', EXITFULLSCREEN: 'Beenden Sie den Vollbildmodus', LOGOUT: 'ausfallen', COMMON: { EXECUTE: 'durchgeführt', - EDIT: 'ändern', - DELETE: 'löschen', - ACTION: 'Betriebs', PLACEHOLDER: 'Bitte auswählen oder suchen ...', SPACE: 'Raum', EQUIPMENT: 'Ausrüstung', @@ -1766,46 +1479,10 @@ function config($translateProvider) { TENANT: 'Mieter', STORE: 'Geschäft', SHOPFLOOR: 'Werkstatt', - DATA_SOURCE: 'Datenquelle', SENSOR: 'Sensor', ENERGY_FLOW_DIAGRAM: 'Energieflussdiagramm', MENU: 'Menü', - PERIOD: { - LABEL: 'Bereich auswählen', - YEAR: 'Jahr', - MONTH: 'Monat', - DAY: 'Tag', - HOUR: 'Zeit', - }, DATE: 'Datum', - ANALYSIS: { - LABEL: 'Anzeigemethode', - ENERGY: 'Energieverbrauch', - COST: 'Kosten' - }, - ENERGYFLOW: { - LABEL: 'Energiefluss', - INCOME: 'Zufluss', - OUTPUT: 'Abfluss' - }, - COMPARE: { - LABEL: 'Vergleichsmethode', - TREND: 'Trend', - COMPARE: 'Vergleichen Sie' - }, - STATISTICS: { - LABEL: 'Analyse Methode', - COMMON: 'Routineanalyse', - KEYDEVICE: 'Nach Geräteattribut', - WORKINGDAY: 'Tag ohne Produktion', - STATUS: 'Energieverbrauch nach Gerätestatus', - CPU: 'Energieverbrauch pro Einheit', - }, - CHARTTYPE: { - LABEL: 'Diagrammanzeigemodus', - COLUMN: 'Histogramm', - LINE: 'Graph' - }, TARIFF: { TOPPEAK: 'Trinkgeld', ONPEAK: 'Gipfel', @@ -1813,18 +1490,6 @@ function config($translateProvider) { MIDPEAK: 'Niveau' } }, - REPORT: { - REPORT: 'Bericht', - REPORT_LIST: 'Berichtsliste', - CREATE_TIME: 'Erstellungszeitpunkt', - FILE_NAME: 'Dateinamen', - TABLE: { - ENERGYDATA: 'detaillierte Daten', - TIME: 'Zeit', - HOUR: 'Zeit', - TOTAL: 'Zusammenfassung' - } - }, FDD: { ID: 'ID', RULE: 'Regel', @@ -1832,7 +1497,6 @@ function config($translateProvider) { TEXT_MESSAGE: 'SMS-Nachricht', WEB_MESSAGE: 'Webseiteninformationen', WECHAT_MESSAGE: 'WeChat Informationen', - RECIPIENT: 'Empfänger', ALARM_LIST: 'Zeigen Sie die Alarmliste an', RULE_LIST: 'Liste der Regeln', @@ -1947,9 +1611,6 @@ function config($translateProvider) { ADD_TARIFF: 'Rate hinzufügen', ADD_CATEGORY: 'Energieklassifizierung hinzufügen', ADD_ENERGY_ITEM: 'Unterelemente zum Energieverbrauch hinzufügen', - ADD_TARIFF: 'Rate hinzufügen', - ADD_EMAIL_RECIPIENT: 'Empfänger hinzufügen', - ADD_SMS_RECIPIENT: 'Kontakt hinzufügen', ADD_CONTACT: 'Kontakt hinzufügen', ADD_EMAIL_SERVER: 'Mail-Server hinzufügen', ADD_GSM_MODEM: 'SMS-Modul hinzufügen', @@ -1965,14 +1626,9 @@ function config($translateProvider) { EDIT_TARIFF: 'Bearbeitungsrate', EDIT_CATEGORY: 'Energieklassifizierung bearbeiten', EDIT_ENERGY_ITEM: 'Unterelemente zum Energieverbrauch bearbeiten', - EDIT_EMAIL_RECIPIENT: 'Empfänger bearbeiten', - EDIT_SMS_RECIPIENT: 'Kontakt bearbeiten', EDIT_CONTACT: 'Kontakt bearbeiten', EDIT_EMAIL_SERVER: 'Postfachserver bearbeiten', EDIT_GSM_MODEM: 'SMS-Modul bearbeiten', - EDIT_PARAM_COMBINED_EQUIPMENT: 'Bearbeiten Sie die Parameter des Kombinationsgeräts', - EDIT_PARAM_EQUIPMENT: 'Geräteparameter bearbeiten', - EDIT_PARAM_SPACE: 'Raumparameter bearbeiten', REQUIRES_AUTHENTICATION: 'Authentifizierung erforderlich', SELECT_SPACE: 'Bitte wählen Sie eine Energieeinheit', @@ -1991,17 +1647,14 @@ function config($translateProvider) { BIND_POINT: 'Datenpunkte binden', BIND_SENSOR: 'Bindungssensor', BIND_TARIFF: 'Bindungsrate', - PHONE_ID_FORMAT: 'Bitte geben Sie die Landesvorwahl ein: z. B. 0086 + Handynummer', INPUT_NAME: 'Bitte geben Sie einen Namen ein', INPUT_AREA: 'Bitte betreten Sie den Bereich', INPUT_UNIT: 'Bitte geben Sie eine Einheit ein', INPUT_CONTACT: 'Bitte geben Sie einen Kontakt ein', INPUT_EXPRESSION: 'Bitte geben Sie einen Ausdruck ein', - INPUT_SERIAL_NUMBER: 'Bitte geben sie die Seriennummer ein', INPUT_KGCE: 'Bitte geben Sie den Standardkohlekoeffizienten ein', INPUT_KGCO2E: 'Bitte geben Sie den CO2-Emissionsfaktor ein', - INPUT_TAG: 'Bitte geben Sie ein Etikett ein', INPUT_HOST: 'Bitte geben Sie den Server ein', INPUT_PORT: 'Bitte geben Sie die Portnummer ein', INPUT_USER_NAME: 'Bitte geben sie einen Benutzernamen ein', @@ -2015,7 +1668,6 @@ function config($translateProvider) { INVALID_FROM_ADDR: 'Falsche Absenderadresse', INVALID_BAUD_RATE: 'Falsche Baudrate', NOT_NULLABLE: 'Darf nicht leer sein', - MASTER_METER: 'Übersichtstabelle', METER: 'Meter', VIRTUAL_METER: 'Virtuelle Tabelle', OFFLINE_METER: 'Offline-Tabelle', @@ -2030,7 +1682,6 @@ function config($translateProvider) { SENSOR_LIST: 'Sensorliste', METER_TYPE: 'Zählertyp', METER_NAME: 'Zählername', - METER_STATUS: 'Messgerätestatus', TRASH: 'recyceln können', DRAG_TO_BIND: 'Bitte ziehen und ablegen, um die Bindung abzuschließen', DRAG_TO_UNBIND: 'Bitte ziehen Sie in den Papierkorb, um die Bindung aufzuheben', @@ -2039,7 +1690,6 @@ function config($translateProvider) { AREA: 'Bereich', UNIT: 'Einheit', CONTACT: 'Gesprächspartner', - ENERGY_SYSTEM_CONTACT: 'Kontakt zum Energiesystem', TIMEZONE: 'Zeitzone', TARIFF: 'Bewertung', @@ -2048,11 +1698,6 @@ function config($translateProvider) { ENERGY_ITEM: 'Unterpunkt Energieverbrauch', STATUS: 'Status', UPLOAD_TIME: 'Upload-Zeit', - SERIAL_NUMBER: 'Ordnungsnummer', - COEF: 'Umrechnungsfaktor', - TAG: 'Etikette', - BASELINE_CPU: 'Basislinie für den Verbrauch von Einheiten', - BASELINE_COST: 'Stückkostenbasis', EXPRESSION: 'Ausdruck', VARIABLE_NAME: 'Variablennamen', POINT: 'Datenpunkt', @@ -2073,7 +1718,6 @@ function config($translateProvider) { END_AMOUNT: 'Endbetrag', PORT: 'Hafen', - GSM: 'GSM', SMS: 'SMS', SERIAL_PORT: 'Adresse der seriellen Schnittstelle', BAUD_RATE: 'Baudrate', @@ -2081,25 +1725,9 @@ function config($translateProvider) { HOST: 'Server', USER_NAME: 'Nutzername', - SUSPENDED: 'Bereithalten', - IDLING: 'Probelauf', - RUNNING: 'Lauf', - PARAM_COMBINED_EQUIPMENT: 'Parameterverwaltung für Kombinationsgeräte', - PARAM_EQUIPMENT: 'Verwaltung von Geräteparametern', - PARAM_SPACE: 'Räumliche Parameterverwaltung', - SROSS: 'Schlusskurs unter Standardbedingungen an Nichtproduktionstagen', - USER: 'Nutzer', - - TEAM: 'Mannschaft', - ADD_TEAM: 'Füge ein Team hinzu', - EDIT_TEAM: 'Team bearbeiten', SEARCH: 'suchen nach...', - METER_DATA: 'Zählerdaten', - START_ENERGY: 'Anfangsenergieverbrauchswert', - END_ENERGY: 'Ende des Energieverbrauchs', - DIFF_VALUE: 'Unterschied', RESTORE: 'wiederherstellen', RESTORE_SUCCESS: 'Erfolgreiche Genesung', @@ -2393,10 +2021,8 @@ function config($translateProvider) { DELETE: 'löschen', }, TOASTER: { - FAILURE: 'Fehler', FAILURE_TITLE: 'Error', ERROR: 'Error', - OPTIONS_ERROR: 'Falsche Option', SUCCESS: 'Erfolg', SUCCESS_TITLE: 'Erfolg', LOGIN_SUCCESS: 'Anmeldung erfolgreich.', @@ -2462,7 +2088,6 @@ function config($translateProvider) { STORE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: 'Die Beziehung zwischen dem Geschäft und der Offline-Tabelle wurde nicht gefunden', STORE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: 'Die Beziehung zwischen dem Geschäft und der virtuellen Tabelle wurde nicht gefunden', ASSOCIATED_POINTS_NOT_FOUND: 'Datenpunkt nicht gefunden', - COMPLEX_NOT_FOUND: 'Kein komplexes Produkt gefunden', COST_CENTER_NOT_FOUND: 'Kostenstelle nicht gefunden', COST_CENTER_EXTERNAL_ID_EXISTS: 'Externe Kostenstellen-ID ist bereits vorhanden', COST_CENTER_NAME_EXISTS: 'Kostenstellenname existiert', @@ -2490,10 +2115,6 @@ function config($translateProvider) { SPACE_ALREADY_ASSOCIATED_WITH_METER: 'Der Raum ist bereits dem Zähler zugeordnet', SPACE_ALREADY_ASSOCIATED_WITH_OFFLINE_METER: 'Der Speicherplatz ist bereits der Offline-Tabelle zugeordnet', SPACE_ALREADY_ASSOCIATED_WITH_VIRTUAL_METER: 'Der Speicherplatz ist bereits der virtuellen Tabelle zugeordnet', - SPACE_AND_METER_RELATIONSHIP_NOT_FOUND: 'Die Beziehung zwischen dem Raum und dem Zähler wurde nicht gefunden', - SPACE_AND_OFFLINE_METER_RELATIONSHIP_NOT_FOUND: 'Speicherplatz und Offline-Tabellenbeziehung nicht gefunden', - SPACE_AND_VIRTUAL_METER_RELATIONSHIP_NOT_FOUND: 'Speicherplatz und virtuelle Tabellenbeziehung nicht gefunden', - GSM_CONFIG_NOT_FOUND: 'GSM-Konfiguration nicht gefunden', KNOWLEDGE_FILE_NOT_FOUND: 'Wissensdatei nicht gefunden', INVALID_: 'ungültig', INVALID_TENANT_ID: 'Ungültige Mieter-ID', @@ -2503,30 +2124,22 @@ function config($translateProvider) { INVALID_DATA_SOURCE_ID: 'Ungültige Datenquellen-ID', INVALID_DATA_SOURCE_NAME: 'Ungültiger Datenquellenname', INVALID_DATA_SOURCE_PROTOCOL: 'Ungültiges Datenquellenprotokoll.', - INVALID_DATE: 'Ungültiges Datum (voraussichtliches Format: JJJJ-MM-TT)', - INVALID_DATETIME_DATA: 'Ungültige Datums- und Uhrzeitdaten', INVALID_EMAIL_MESSAGE_ID: 'Ungültige E-Mail-ID', - INVALID_EMAIL_RECIPIENT_ID: 'Ungültige E-Mail-Empfänger-ID', INVALID_ENERGY_CATEGORY_ID: 'Ungültige Energieklassifizierungs-ID', INVALID_ENERGY_ITEM_ID: 'Ungültige Energieverbrauchs-Artikel-ID', INVALID_COMBINED_EQUIPMENT_ID: 'Ungültige Geräte-ID', INVALID_EQUIPMENT_ID: 'Ungültige Geräte-ID', INVALID_SPACE_ID: 'Ungültige Leerzeichen-ID', - INVALID_GSM_CONFIG_ID: 'Ungültige GSM-Konfigurations-ID', INVALID_KNOWLEDGE_FILE_ID: 'Ungültige ID der Wissensdatei', - INVALID_ID: 'Ungültige ID', - INVALID_MESSAGE_ID: 'Ungültige Nachrichten ID', INVALID_METER_ID: 'Ungültige Zähler-ID', INVALID_METER_UUID: 'Ungültige UUID des Messgeräts', INVALID_COST_FILE_ID: 'Ungültige Kostendatei-ID', - INVALID_OFFLINE_METER_FILE__ID: 'Ungültige Offline-Tabellendatei-ID', INVALID_OFFLINE_METER_FILE_ID: 'Ungültige Offline-Tabellendatei-ID', INVALID_OFFLINE_METER_ID: 'Ungültige Offline-Tabellen-ID', INVALID_PASSWORD: 'Ungültiges Passwort', INVALID_POINT_ID: 'Ungültige Punkt-ID', INVALID_PRIVILEGE_ID_: 'Ungültige Berechtigungs-ID', INVALID_PRIVILEGE_ID: 'Ungültige Berechtigungs-ID', - INVALID_PRIVILEGE_TO_RESET_PASSWORD: 'Ungültige Berechtigung zum Zurücksetzen des Kennworts', INVALID_RULE_ID: 'Ungültige Regel-ID', INVALID_TARIFF_BLOCK_PRICING: 'Ungültiger Staffelpreis', INVALID_TARIFF_ID: 'Ungültige Tarif-ID', @@ -2538,74 +2151,33 @@ function config($translateProvider) { INVALID_VIRTUAL_METER_ID: 'Ungültige ID der virtuellen Tabelle', INVALID_VIRTUAL_METER_NAME: 'Ungültiger Name der virtuellen Tabelle', INVALID_WEB_MESSAGE_ID: 'Ungültige Seiteninformations-ID', - INVALID_COOKIES_PLEASE_RE_LOGIN: 'Ungültiger Cookie, bitte erneut anmelden', INVALID_EMAIL: 'Ungültige E-Mail', - INVALID_EMS_CONTACT_EMAIL_VALUE: 'Ungültiger Wert für ems_contact_email', - INVALID_EMS_CONTACT_NAME_VALUE: 'Ungültiger Wert für ems_contact_name', - INVALID_EMS_CONTACT_PHONE_VALUE: 'Ungültiger Wert für ems_contact_phone', - INVALID_END_DATE_TIME: 'Ungültiges Enddatum (volles erwartetes Format: JJJJ-MM-TTTHH: MM: SS)', - INVALID_END_DATE_TIME_YMD: 'Ungültige Enddatumzeit (erwartetes Format: JJJJ-MM-TTTHH)', - INVALID_END_DATE_TIME_YMDHMS: 'Ungültige Enddatumzeit (erwartetes Format: JJJJ-MM-TTTHH: MM: SS)', INVALID_EQUATION_IN_EXPRESSION: 'Ungültige Ausdrucksformel', INVALID_EXPRESSION_OBJECT: 'Ungültiges Ausdrucksobjekt', - INVALID_EXTERNAL_ID_VALUE: 'Ungültige externe ID', INVALID_IS_COUNTED_VALUE: 'Ungültiger is_counted-Wert', - INVALID_IS_COMBINED_EQUIPMENT_STATUS_COUNTED_VALUE: 'Ungültiger Wert für is_equipment_status_counted', - INVALID_IS_EQUIPMENT_STATUS_COUNTED_VALUE: 'Ungültiger Wert für is_equipment_status_counted', INVALID_IS_OUTPUT_VALUE: 'Ungültiger is_output-Wert', INVALID_IS_OUTPUT_COUNTED_VALUE: 'Ungültiger is_output_counted-Wert', - INVALID_IS_PRODUCT_COUNTED_VALUE: 'Ungültiger is_product_counted-Wert', - INVALID_PERIOD: 'Ungültiger Zeitraum', - INVALID_PERIOD_FORMAT: 'Ungültiges Zeitraumformat (erwartetes Format \'year\', \'month\', \'day\' or \'hour\')', - INVALID_PRIVILEGES_VALUE: 'Ungültiger Zeitraum', - INVALID_PRODUCTID_ID: 'Ungültige Produkt-ID', - INVALID_SERIAL_NUMBER_VALUE: 'Ungültiger Wert für serial_number', - INVALID_START_DATE_TIME: 'Ungültige Startzeit (vollständiges erwartetes Format: JJJJ-MM-TTTHH: MM: SS)', - INVALID_START_DATE_TIME_YMD: 'Ungültige Startzeit (erwartetes Format: JJJJ-MM-TT)', - INVALID_START_DATE_TIME_YMDHMS: 'Ungültige Startzeit (erwartetes Format: JJJJ-MM-TTTHH: MM: SS)', - INVALID_SUSPENDED_VALUE: 'Ungültiger Pausenwert', - INVALID_USE_LIFE_END_VALUE: 'Ungültiger Wert für die Lebensdauer des Geräts', - INVALID_USE_LIFE_START_VALUE: 'Ungültiger Startwert der Gerätelebensdauer', INVALID_VARIABLE_METER_ID: 'Ungültige Variable meter_id', INVALID_VARIABLE_METER_TYPE: 'Ungültige Variable meter_type', INVALID_VARIABLE_NAME: 'Ungültiger Variablenname', METER_NOT_FOUND: 'Kein Zähler gefunden', - METER_POINT_RELATIONSHIP_EXISTED: 'Es gibt eine Beziehung zwischen Metern und Punkten', - METER_POINT_RELATIONSHIP_NOT_FOUND: 'Die Beziehung zwischen dem Messgerät und dem Punkt wurde nicht gefunden', METER_OF_VARIABLE_NOT_FOUND: 'Kein mit der Variablen verknüpftes Messgerät gefunden', COST_FILE_NOT_FOUND: 'Kostendatei nicht gefunden', OFFLINE_METER_FILE_NOT_FOUND: 'Offline-Tabellendatei nicht gefunden', OFFLINE_METER_NOT_FOUND: 'Offline-Tabelle nicht gefunden', OFFLINE_METER_OF_VARIABLE_NOT_FOUND: 'Die der Variablen zugeordnete Offline-Tabelle wurde nicht gefunden', - PLEASE_RE_LOGIN: 'Bitte melden Sie sich erneut an', POINT_NOT_FOUND: 'Datenpunkt nicht gefunden', PRIVILEGE_NOT_FOUND: 'Berechtigung nicht gefunden', RULE_NOT_FOUND: 'Regel nicht gefunden', - SMS_RECIPIENT_NOT_FOUND: 'SMS-Empfänger nicht gefunden', - START_DATE_SHOULD_BE_EARLY_THAN_END_DATE: 'Das Startdatum sollte vor dem Enddatum liegen', START_DATETIME_SHOULD_BE_EARLY_THAN_END_DATETIME: 'Das Startdatum und die Startzeit sollten vor dem Enddatum und der Endzeit liegen', TARIFF_IN_USE: 'Rate wird verwendet', TARIFF_NOT_EMPTY: 'Die Rate ist nicht leer', TARIFF_NOT_FOUND: 'Rate nicht gefunden', - TARIFF_ALREADY_ASSOCIATED_WITH_COSTCENTER: 'Der Tarif ist bereits der Kostenstelle zugeordnet', - TARIFF_ALREADY_ASSOCIATED_WITH_SPACE: 'Die Rate wurde mit dem Speicherplatz verknüpft', TARIFF_IS_NOT_ASSOCIATED_WITH_COST_CENTER: 'Der Tarif ist nicht mit der Kostenstelle verknüpft', - TARIFF_IS_NOT_ASSOCIATED_WITH_SPACE: 'Rate und Platz sind nicht miteinander verbunden', - POINT_ALREADY_ASSOCIATED_WITH_SPACE: 'Datenpunkte wurden mit dem Raum verknüpft', - POINT_IS_NOT_ASSOCIATED_WITH_SPACE: 'Datenpunkte sind nicht mit Leerzeichen verknüpft', - TEAM_NOT_FOUND: 'Kein Team gefunden', TEXT_MESSAGE_NOT_FOUND: 'SMS nicht gefunden', - THERE_IS_RELATIONSHIP_WITH_TENANTS: 'Haben Sie eine Beziehung mit dem Mieter', - THERE_IS_RELATIONSHIP_WITH_STORES: 'Hat eine Beziehung zum Geschäft', - THERE_IS_RELATIONSHIP_WITH_COMPANIES: 'Haben Sie eine Beziehung mit dem Unternehmen', - THERE_IS_RELATIONSHIP_WITH_COMBINED_EQUIPMENTS: 'Bezogen auf kombinierte Ausrüstung', THERE_IS_RELATIONSHIP_WITH_EQUIPMENTS: 'Bezogen auf Ausrüstung', THERE_IS_RELATIONSHIP_WITH_SPACES: 'Hat eine Beziehung zum Raum', - THERE_IS_RELATIONSHIP_WITH_METERS: 'Bezogen auf Meter', - THERE_IS_RELATIONSHIP_WITH_OFFLINE_METERS: 'Bezogen auf Offline-Tabelle', - THERE_IS_RELATIONSHIP_WITH_TEAMS: 'Habe eine Beziehung zum Team', THERE_IS_RELATIONSHIP_WITH_USERS: 'Haben Sie eine Beziehung zu Benutzern', - THERE_IS_RELATIONSHIP_WITH_VIRTUAL_METERS: 'Bezogen auf virtuelle Tabelle', TIMEZONE_NOT_FOUND: 'Zeitzone nicht gefunden', USER_NOT_FOUND: 'Benutzer wurde nicht gefunden', USER_SESSION_TIMEOUT: 'Zeitlimit für Benutzersitzung', diff --git a/database/README.md b/database/README.md index f38ad61b..4d94e6d4 100644 --- a/database/README.md +++ b/database/README.md @@ -15,7 +15,7 @@ Providing database schema and scripts for MyEMS. ### Installation -Execute the scripts in MySQL commandline as below, or execute in orther MySQL client tools such as MySQL Workbench, Navicat, DBaver, phpMyAdmin, etc. +Execute the following scripts in MySQL commandline, or execute in other MySQL client tools such as MySQL Workbench, Navicat, DBaver, phpMyAdmin, etc. ``` mysql -u root -p < myems_billing_baseline_db.sql mysql -u root -p < myems_billing_db.sql @@ -27,7 +27,10 @@ mysql -u root -p < myems_reporting_db.sql mysql -u root -p < myems_system_db.sql mysql -u root -p < myems_user_db.sql ``` - +To insert demo data execute the following scripts, +``` +mysql -u root -p < demo/myems_system_db.sql +``` #### Change COLLATE for MySQL server before version 8.0 ``` sudo nano /etc/mysql/my.cnf diff --git a/database/demo/myems_system_db.sql b/database/demo/myems_system_db.sql new file mode 100644 index 00000000..37fc3acf --- /dev/null +++ b/database/demo/myems_system_db.sql @@ -0,0 +1,1139 @@ +-- MyEMS System Database Demo Data + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_combined_equipments` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_combined_equipments` +(`id`, `name`, `uuid`, `is_input_counted`, `is_output_counted`, `cost_center_id`, `description` ) +VALUES +(1, '组合式设备1', '48aab70f-2e32-4518-9986-a6b7395acf58', true, false, 1, 'description'), +(2, '组合式设备2', 'c235e68c-e1be-4d7a-84e7-976c83ff6e44', true, false, 1, 'description'); + +COMMIT; + + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_combined_equipments_equipments` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_combined_equipments_equipments` +(`id`, `combined_equipment_id`, `equipment_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_combined_equipments_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_combined_equipments_meters` +(`id`, `combined_equipment_id`, `meter_id`, `is_output`) +VALUES +(1, 1, 1, false); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_combined_equipments_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_combined_equipments_offline_meters` +(`id`, `combined_equipment_id`, `offline_meter_id`, `is_output`) +VALUES +(1, 1, 1, false); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_combined_equipments_parameters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_combined_equipments_parameters` +(`id`, `combined_equipment_id`, `name`, `parameter_type`, `constant`, `point_id`, `numerator_meter_uuid`, `denominator_meter_uuid`) +VALUES +(1, 1, 'serial number', 'constant', 'bfa8b106', NULL, NULL, NULL), +(2, 1, 'manufacturer', 'constant', 'York', NULL, NULL, NULL), +(3, 1, 'maintainer', 'constant', 'Johnson Controls', NULL, NULL, NULL), +(4, 1, 'use life start', 'constant', '2016-01-01', NULL, NULL, NULL), +(5, 1, 'use life end', 'constant', '2025-12-31', NULL, NULL, NULL), +(6, 1, 'model number', 'constant', 'CH01', NULL, NULL, NULL), +(7, 1, 'nominal cooling capacity', 'constant', '90.000 kW', NULL, NULL, NULL), +(8, 1, 'nominal cooling input power', 'constant', '100.000 kW', NULL, NULL, NULL), +(9, 1, 'nominal cooling cop', 'constant', '5', NULL, NULL, NULL), +(10, 1, 'nominal cooling operating current', 'constant', '120.000 A', NULL, NULL, NULL), +(11, 1, 'rated input power', 'constant', '100.000 kW', NULL, NULL, NULL), +(12, 1, 'nominal chilled water flow rate', 'constant', '30 m2/h', NULL, NULL, NULL), +(13, 1, 'nominal cooling water flow_rate', 'constant', '50 m2/h', NULL, NULL, NULL), +(14, 1, 'status', 'point', NULL, 1, NULL, NULL), +(15, 1, 'inlet chilled water temperature', 'point', NULL, 2, NULL, NULL), +(16, 1, 'chilled_water instantaneous flow rate', 'point', NULL, 3, NULL, NULL), +(17, 1, 'instantaneous power', 'point', NULL, 4, NULL, NULL), +(18, 1, 'COP', 'fraction', NULL, NULL, 'a4e0dbf0-528a-4cbb-88cc-563527900d40', '89ff5118-d0c2-4dd8-8098-a8698189b2ea'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_combined_equipments_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_combined_equipments_virtual_meters` +(`id`, `combined_equipment_id`, `virtual_meter_id`, `is_output`) +VALUES +(1, 1, 1, false); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_contacts` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; +INSERT INTO `myems_system_db`.`tbl_contacts`(`id`, `name`, `uuid`, `email`, `phone`, `description`) +VALUES +(1, 'John', '5c5ce6e8-8d00-46b3-9602-4e1520a8b43f', 'john@myems.io', '+8613888888888', 'Building #1'), +(2, 'Sample Tenant', '102b654d-e831-4365-bb1e-dbd55e897851', 'sample.tenant@myems.io', '+8613666666666', 'Sample Tenant'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_cost_centers` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_cost_centers` +(`id`, `name`, `uuid`, `external_id`) +VALUES +(1, '成本中心', 'd97b9736-c4f9-4005-a534-6af3487303ad', NULL); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_cost_centers_tariffs` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; +INSERT INTO `myems_system_db`.`tbl_cost_centers_tariffs` +(`id`, `cost_center_id`, `tariff_id`) +VALUES +(1, 1, 1), +(2, 1, 2), +(3, 1, 3); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_data_sources` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_data_sources` +(`id`, `name`, `uuid`,`gateway_id`, `protocol`, `connection`) +VALUES +(1, '示例ModbusTCP数据源', 1, 'b3ace9d4-b63b-419b-818f-0f6d1d0603a4', 'modbus-tcp', '{"host":"10.111.212.191", "port":502}'), +(2, '示例ModbusRTU数据源', 1, 'b903f0af-9115-448c-9d46-8caf5f9995f3', 'modbus-tru', '{"port": "/dev/ttyUSB0","slaveaddress": 1, "baudrate": 9600,"bytesize": 8,"parity": "N","stopbits": 1,"timeout": 0.05,"mode": "rtu"}''), +(3, '示例Bacnet/IP数据源', 1, 'e2d5b30b-b554-4ebe-8ce7-f377ab380d19', 'bacnet-ip', '{"host":"10.111.212.200", "port":47808}'), +(4, '示例S7数据源', 1, '9eb0d705-d02a-43f8-9c62-7e5ef508b255', 's7', '{"host":"10.111.212.202", "port":102, "rack": 0, "slot": 2}'), +(5, '示例ControlLogix数据源', 1, 'd1dc9792-7861-4dd3-9b01-07511dae16c1', 'control-logix', '{"host":"10.111.212.203","port":44818,"processorslot":3}'); +(6, '示例OPU UA数据源', 1, '56e1c642-8032-495b-af2e-18a77ca75e0f', 'opc-ua', '{"url":"opc.tcp://10.111.212.5:49320/OPCUA/SimulationServer/"}'); +(7, '示例天气数据源', 1, '9bff8e95-c7c9-4002-b040-08a96ae196b5', 'weather', '{"base_url":"WEATHER_API_URL", "location":"beijing", "key":"APPKEY"}'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_distribution_circuits` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_distribution_circuits` +(`id`, `name`, `uuid`, `distribution_system_id`, `distribution_room`, `switchgear`, `peak_load`, `peak_current`, `customers`, `meters`) +VALUES +(1, '51W91', '52f7abe1-ba0e-47a6-a327-4faac42a1d11', 1, 'EW1', '51AL9', 30, 53.6, '地下室应急照明', 'ALE-1102, ALE-1082'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_distribution_circuits_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_distribution_circuits_points` +(`id`, `distribution_circuit_id`, `point_id`) +VALUES (1, 1, 1); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_distribution_systems` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_distribution_systems` +(`id`, `name`, `uuid`, `svg`, `description`) +VALUES +(1, '示例配电系统', '95652719-56fa-44cc-9bef-7aa47664d4ff', 'Four separate rectangles', 'demo distribution system'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_energy_categories` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_energy_categories` +(`id`, `name`, `uuid`, `unit_of_measure`, `kgce`, `kgco2e`) +VALUES +(1, '电', '6d0753ed-8b43-4332-b6fd-d2f5813831d3', 'kWh', 0.1229, 0.928), +(2, '自来水', '3dbfa598-fccc-4d60-bf11-14bd55540c66', 'm³', 0.0857, 0.910), +(3, '天然气', '6d0753ed-8b43-4332-b6fd-d2f5813831d3', 'm³', 1.3300, 2.1622), +(4,'4℃冷冻水','d2a3021a-4911-4611-856e-80133000f1d5','m³',1.000,1.000), +(5,'7℃冷冻水','c1ad0696-e1ab-4e0c-a342-b194c0bc27e0','m³',1.000,1.000), +(6,'蒸汽','ac91a5c4-4ae5-4a73-8e3f-044591f42eef','T',1.000,1.000), +(7,'压缩空气','ff238e98-cd35-47c5-88a3-00617587775d','m³',1.000,1.000), +(8,'循环水','7e159a34-b2e6-4fd3-ba76-897d134abe06','m³',1.000,1.000), +(9, '热量','549f9cad-8db7-49d2-9473-95e37a3fc46a','KJ',1.000,1.000), +(10, '冷量','05aa257b-3cf6-4f19-808d-92e7dbf52b16','KJ',1.000,1.000), +(11, '中水','df6161b6-4a1b-46e7-b7c8-337b5b52d717','m³',1.000,1.000); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_energy_items` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_energy_items` +(`id`, `name`, `uuid`, `energy_category_id`) +VALUES +(1, '空调用电', 'c5eac07a-e889-4a56-aa1b-a0b688c4e953', 1), +(2, '动力用电', '6875e4e0-a2ec-47a5-a88e-becb10e9603a', 1), +(3, '照明用电', '79918598-6477-4130-a85c-4cb87d0eac23', 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_energy_flow_diagrams` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams` +(`id`, `name`, `uuid`) +VALUES +(1, '低压配电系统', '3ccbc9c6-9575-4212-a63a-a688d1154302'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_energy_flow_diagrams_links` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams_links` +(`id`, `energy_flow_diagram_id`, `name`) +VALUES +(1, 1, 1, 3, '5ca47bc5-22c2-47fc-b906-33222191ea40'), +(2, 1, 2, 4, '5d4d2f06-6200-4671-b182-4cf32cd9228f'), +(3, 1, 2, 5, '7897665b-66ac-481d-9c31-2ab2ecbda16c'), +(4, 1, 2, 6, 'f0c278ec-eb32-4c5e-a35f-88643b00c367'), +(5, 1, 3, 7, '9918aa6c-79e9-4579-8f2e-a76eb9fe4e3e'), +(6, 1, 3, 8, '831cbc8c-1429-4840-946e-f0b389b2253e'), +(7, 1, 4, 9, 'd2fc8464-3f13-42a9-8a57-63f95f677f0f'), +(8, 1, 4, 10, '7e4b3831-887b-40e2-b7f8-4d77c6f206a9'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_energy_flow_diagrams_nodes` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams_nodes` +(`id`, `energy_flow_diagram_id`, `name`) +VALUES +(1, 1, '10KV进线#1'), +(2, 1, '10KV进线#2'), +(3, 1, '租区'), +(4, 1, '公区'), +(5, 1, '酒店'), +(6, 1, '车库'), +(7, 1, '餐饮'), +(8, 1, '零售'), +(9, 1, '照明'), +(10, 1, '电梯'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_equipments` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_equipments` +(`id`, `name`, `uuid`, `is_input_counted`, `is_output_counted`, `cost_center_id`, `description` ) +VALUES +(1, '设备1', 'bfa8b106-89a1-49ca-9b2b-a481ac41a873', true, false, 1, 'description'), +(2, '设备2', 'ad5798ec-d827-43d9-bf08-fc7516f9c4c8', true, false, 1, 'description'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_equipments_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_equipments_meters` +(`id`, `equipment_id`, `meter_id`, `is_output`) +VALUES +(1, 1, 1, false); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_equipments_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_equipments_offline_meters` +(`id`, `equipment_id`, `offline_meter_id`, `is_output`) +VALUES +(1, 1, 1, false); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_equipments_parameters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_equipments_parameters` +(`id`, `equipment_id`, `name`, `parameter_type`, `constant`, `point_id`, `numerator_meter_uuid`, `denominator_meter_uuid`) +VALUES +(1, 1, 'serial number', 'constant', 'bfa8b106', NULL, NULL, NULL), +(2, 1, 'manufacturer', 'constant', 'York', NULL, NULL, NULL), +(3, 1, 'maintainer', 'constant', 'Johnson Controls', NULL, NULL, NULL), +(4, 1, 'use life start', 'constant', '2016-01-01', NULL, NULL, NULL), +(5, 1, 'use life end', 'constant', '2025-12-31', NULL, NULL, NULL), +(6, 1, 'model number', 'constant', 'CH01', NULL, NULL, NULL), +(7, 1, 'nominal cooling capacity', 'constant', '90.000 kW', NULL, NULL, NULL), +(8, 1, 'nominal cooling input power', 'constant', '100.000 kW', NULL, NULL, NULL), +(9, 1, 'nominal cooling cop', 'constant', '5', NULL, NULL, NULL), +(10, 1, 'nominal cooling operating current', 'constant', '120.000 A', NULL, NULL, NULL), +(11, 1, 'rated input power', 'constant', '100.000 kW', NULL, NULL, NULL), +(12, 1, 'nominal chilled water flow rate', 'constant', '30 m2/h', NULL, NULL, NULL), +(13, 1, 'nominal cooling water flow_rate', 'constant', '50 m2/h', NULL, NULL, NULL), +(14, 1, 'status', 'point', NULL, 1, NULL, NULL), +(15, 1, 'inlet chilled water temperature', 'point', NULL, 2, NULL, NULL), +(16, 1, 'chilled_water instantaneous flow rate', 'point', NULL, 3, NULL, NULL), +(17, 1, 'instantaneous power', 'point', NULL, 4, NULL, NULL), +(18, 1, 'COP', 'fraction', NULL, NULL, 'a4e0dbf0-528a-4cbb-88cc-563527900d40', '89ff5118-d0c2-4dd8-8098-a8698189b2ea'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_equipments_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_equipments_virtual_meters` +(`id`, `equipment_id`, `virtual_meter_id`, `is_output`) +VALUES +(1, 1, 1, false); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_expressions` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_expressions` +(`id`, `uuid`, `virtual_meter_id`, `equation`) +VALUES +(1, '3fff2cfb-f755-44c8-a919-6135205a8573', 1, 'x1+x2-x3'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_gateways` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_gateways` +(`id`, `name`, `uuid`, `token`, `last_seen_datetime_utc`) +VALUES +(1, 'MyEMS Gateway 1', 'dc681934-5053-4660-98ed-266c54227231', '983427af-1c35-42ba-8b4d-288675550225', null), +(2, 'MyEMS Gateway 2', '8f75c0ab-9296-49c7-9058-8139febd0c31', 'd3860971-e6e0-4c98-9eba-5492869c5b19', null); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_knowledge_files` +-- --------------------------------------------------------------------------------------------------------------------- + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_meters` +(`id`, `name`, `uuid`, `energy_category_id`, `is_counted`, `hourly_low_limit`, `hourly_high_limit`, `cost_center_id`, `energy_item_id`, `master_meter_id`, `description`) +VALUES +(1, '示例表1', '5ca47bc5-22c2-47fc-b906-33222191ea40', 1, true, 0.000, 999.999, 1, 1, null, 'meter1'), +(2, '示例表2', '5ca47bc5-22c2-47fc-b906-33222191ea40', 1, true, 0.000, 999.999, 1, 1, 1, 'meter2'), +(3, '示例表3', '6db58cd6-33d3-58ed-a095-22333202fb51', 1, true, 0.000, 999.999, 1, 1, 1, 'meter3'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_meters_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_meters_points` +(`id`, `meter_id`, `point_id`) +VALUES (1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_offline_meters` +(`id`, `name`, `uuid`, `energy_category_id`, `is_counted`, `max_hourly_value`, `cost_center_id`, `energy_item_id`, `description`) +VALUES +(1, '示例离线表', '62f473e0-1a35-41f3-9c30-8110d75d65bb', 1, true, 999.99, 1, 1, 'offlinemeter1'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_points` +-- --------------------------------------------------------------------------------------------------------------------- +-- List of Object Type +-- ENERGY_VALUE +-- ANALOG_VALUE +-- DIGITAL_VALUE + +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_points` +(`id`, `name`, `data_source_id`, `object_type`, `units`, `high_limit`, `low_limit`, `ratio`, `is_trend`, `address`, `description` ) +VALUES +(1, 'Active Energy Import Tariff 1', 1, 'ENERGY_VALUE', 'kWh', 99999999999, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":801, \"number_of_registers\":4, \"format\":\"=d\", \"swap_adjacent_bytes\":false}', null), + +(2, 'Working hours counter', 1, 'ANALOG_VALUE', 'S', 999999999, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":209, \"number_of_registers\":2, \"format\":\"=L\", \"swap_adjacent_bytes\":true}', null), + +(3, 'Current a', 1, 'ANALOG_VALUE', 'A', 5, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":13, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), + +(4, 'Active Power a', 1, 'ANALOG_VALUE', 'W', 3450, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":25, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), + +(5, 'Power Factor a', 1, 'ANALOG_VALUE', 'W', 1, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":37, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), + +(6, '示例ModbusTCP数据点6', 2, 'ENERGY_VALUE', 'Wh', 99999999999, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":40001, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), + +(7, '示例数据点7', 2, 'ANALOG_VALUE', 'V', 690, 0, 1.000, true, + '{\"slave_id\":1, \"function_code\":3, \"offset\":40002, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), + +(8, 'BACnet示例数据点1', 3, 'ANALOG_VALUE', 'V', 690, 0, 1.000, true, + '{\"object_type\":\"analogValue\", \"object_id\":3004860, \"property_name\":\"presentValue\", \"property_array_index\":null}', null), +-- BACnet Object Type +-- analogValue, analogInput, analogOutput, binaryValue, binaryInput, binaryOutput + +(9, 'S7示例数据点1', 4, 'ANALOG_VALUE', 'kWh', 99999999999, 0, 1.000, true, + '{\"area\":\"DB\", \"db_number\":700, \"start\":8, \"size\":4', null); +-- # S7 Area +-- 'PE', 'PA', 'MK', 'DB', 'CT', 'TM' + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_sensors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_sensors` +(`id`, `name`, `uuid`, `description`) +VALUES +(1, '示例传感器', 'ba450606-6f39-41e0-8caf-75b528635511', 'sensor description'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_sensors_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_sensors_points` +(`id`, `sensor_id`, `point_id`) +VALUES (1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors` +(`id`, `name`, `uuid` , `area`, `contact_id`, `is_input_counted`, `cost_center_id`, `description`) +VALUES +(1, 'MyEMS Shopfloor', 'd03837fd-9d30-44fe-9443-154f7c7e15f1', 99999.999, 1, true, 1, 'MyEMS Project'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors_equipments` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors_equipments` +(`id`, `shopfloor_id`, `equipment_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors_meters` +(`id`, `shopfloor_id`, `meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors_offline_meters` +(`id`, `shopfloor_id`, `offline_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors_sensors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors_sensors` +(`id`, `shopfloor_id`, `sensor_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors_virtual_meters` +(`id`, `shopfloor_id`, `virtual_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_shopfloors_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_shopfloors_points` +(`id`, `shopfloor_id`, `point_id`) +VALUES +(1, 3, 2000001), +(2, 3, 2000002), +(3, 3, 2000003), +(4, 3, 2000006); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces` +(`id`, `name`, `uuid`, `parent_space_id`, `area`, `timezone_id`, `contact_id`, `is_input_counted`, `is_output_counted`, `cost_center_id`, `description`) +VALUES +(2, 'MyEMS Building #1', '8f25b33b-db93-49b3-b0f8-b01e0c19df29', 1, 88888.888, 56, 1, true, true, 1, 'MyEMS Project'), +(3, 'MyEMS Building #2', '195d7ea8-17b4-4e9c-bb37-546428155438', 1, 66666.666, 56, 1, true, true, 1, 'MyEMS Project'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_combined_equipments` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_combined_equipments` +(`id`, `space_id`, `combined_equipment_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_equipments` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_equipments` +(`id`, `space_id`, `equipment_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_meters` +(`id`, `space_id`, `meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_offline_meters` +(`id`, `space_id`, `offline_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_sensors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_sensors` +(`id`, `space_id`, `sensor_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_shopfloors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_shopfloors` +(`id`, `space_id`, `shopfloor_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_stores` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_stores` +(`id`, `space_id`, `store_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_tenants` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_tenants` +(`id`, `space_id`, `tenant_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_virtual_meters` +(`id`, `space_id`, `virtual_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_spaces_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_spaces_points` +(`id`, `space_id`, `point_id`) +VALUES +(1, 3, 2000001), +(2, 3, 2000002), +(3, 3, 2000003), +(4, 3, 2000006); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tariffs` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tariffs` +(`id`, `name`, `uuid`, `energy_category_id`, `tariff_type`, `unit_of_price`, `valid_from_datetime_utc`, `valid_through_datetime_utc`) +VALUES +(1, '2020分时电价1-6', '590efb36-8587-42a9-ae6f-c715d21496d6', 1, 'timeofuse', '元/千瓦时', '2019-12-31 16:00:00', '2020-06-30 15:59:59'), +(2, '2020分时电价7-9', 'f5966640-18fc-437a-9efd-cbc0c58b6373', 1, 'timeofuse', '元/千瓦时', '2020-06-30 16:00:00', '2020-09-30 15:59:59'), +(3, '2020分时电价10-12', '21727a1b-4b27-4186-b72e-db46e6e2d980', 1, 'timeofuse', '元/千瓦时', '2020-09-30 16:00:00', '2020-12-31 15:59:59'), +(4, '2021分时电价1-6', 'fe65e443-0ec2-4a16-823e-2365885e2598', 1, 'timeofuse', '元/千瓦时', '2020-12-31 16:00:00', '2021-06-30 15:59:59'), +(5, '2021分时电价7-9', 'd1285c81-4612-4d7c-9436-ed11b4e7abe4', 1, 'timeofuse', '元/千瓦时', '2021-06-30 16:00:00', '2021-09-30 15:59:59'), +(6, '2021分时电价10-12', 'e6c275b4-47eb-4f5d-bc59-edbe45c2a407', 1, 'timeofuse', '元/千瓦时', '2021-09-30 16:00:00', '2021-12-31 15:59:59'), +(7, '2022分时电价1-6', 'ca359f72-48ad-46a7-82af-cecbe98450e8', 1, 'timeofuse', '元/千瓦时', '2021-12-31 16:00:00', '2022-06-30 15:59:59'), +(8, '2022分时电价7-9', '9fdda603-0f8f-4452-ad59-c5df54bc35f4', 1, 'timeofuse', '元/千瓦时', '2022-06-30 16:00:00', '2022-09-30 15:59:59'), +(9, '2022分时电价10-12', 'fb0442e7-4d44-4bfd-8b20-cad3f77a2480', 1, 'timeofuse', '元/千瓦时', '2022-09-30 16:00:00', '2022-12-31 15:59:59'), +(10, '2023分时电价1-6', '3fa6e1f2-7d08-4f5a-bcbf-beb041d569c0', 1, 'timeofuse', '元/千瓦时', '2022-12-31 16:00:00', '2023-06-30 15:59:59'), +(11, '2023分时电价7-9', '787240fb-1694-403e-a0a7-83d7be1cc0b8', 1, 'timeofuse', '元/千瓦时', '2023-06-30 16:00:00', '2023-09-30 15:59:59'), +(12, '2023分时电价10-12', 'a07fdf76-edcf-4124-96e7-ab733a5a4b70', 1, 'timeofuse', '元/千瓦时', '2023-09-30 16:00:00', '2023-12-31 15:59:59'), +(13, '自来水', '6fcbc77e-effb-4d43-9b30-77b062435d34', 2, 'timeofuse', '元/m³', '2019-12-31 16:00:00', '2023-12-31 15:59:59'), +(14, '天然气', '6a4c56ff-b3e1-4555-9b1c-87d05bcfa4d9', 3, 'timeofuse', '元/m³', '2019-12-31 16:00:00', '2023-12-31 15:59:59'), +(15, '分量阶梯电价', 'd1b81d2f-d387-43d3-affd-d796b7236b60', 1, 'block', '元/千瓦时', '2019-12-31 16:00:00', '2023-12-31 15:59:59'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tariffs_timeofuses` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tariffs_timeofuses` +(`id`, `tariff_id`, `start_time_of_day`, `end_time_of_day`, `peak_type`, `price`) +VALUES +-- '2020分时电价1-6' +(1, 1, '00:00:00', '05:59:59', 'offpeak', 0.345), +(2, 1, '06:00:00', '07:59:59', 'midpeak', 0.708), +(3, 1, '08:00:00', '10:59:59', 'onpeak', 1.159), +(4, 1, '11:00:00', '17:59:59', 'midpeak', 0.708), +(5, 1, '18:00:00', '20:59:59', 'onpeak', 1.159), +(6, 1, '21:00:00', '21:59:59', 'midpeak', 0.708), +(7, 1, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2020分时电价7-9' +(8, 2, '00:00:00', '05:59:59', 'offpeak', 0.345), +(9, 2, '06:00:00', '07:59:59', 'midpeak', 0.708), +(10, 2, '08:00:00', '10:59:59', 'offpeak', 1.159), +(11, 2, '11:00:00', '12:59:59', 'midpeak', 0.708), +(12, 2, '13:00:00', '14:59:59', 'onpeak', 1.159), +(13, 2, '15:00:00', '17:59:59', 'midpeak', 0.708), +(14, 2, '18:00:00', '20:59:59', 'onpeak', 1.159), +(15, 2, '21:00:00', '21:59:59', 'midpeak', 0.708), +(16, 2, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2020分时电价10-12' +(17, 3, '00:00:00', '05:59:59', 'offpeak', 0.345), +(18, 3, '06:00:00', '07:59:59', 'midpeak', 0.708), +(19, 3, '08:00:00', '10:59:59', 'onpeak', 1.159), +(20, 3, '11:00:00', '17:59:59', 'midpeak', 0.708), +(21, 3, '18:00:00', '20:59:59', 'onpeak', 1.159), +(22, 3, '21:00:00', '21:59:59', 'midpeak', 0.708), +(23, 3, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2021分时电价1-6' +(24, 4, '00:00:00', '05:59:59', 'offpeak', 0.345), +(25, 4, '06:00:00', '07:59:59', 'midpeak', 0.708), +(26, 4, '08:00:00', '10:59:59', 'onpeak', 1.159), +(27, 4, '11:00:00', '17:59:59', 'midpeak', 0.708), +(28, 4, '18:00:00', '20:59:59', 'onpeak', 1.159), +(29, 4, '21:00:00', '21:59:59', 'midpeak', 0.708), +(30, 4, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2021分时电价7-9' +(31, 5, '00:00:00', '05:59:59', 'offpeak', 0.345), +(32, 5, '06:00:00', '07:59:59', 'midpeak', 0.708), +(33, 5, '08:00:00', '10:59:59', 'offpeak', 1.159), +(34, 5, '11:00:00', '12:59:59', 'midpeak', 0.708), +(35, 5, '13:00:00', '14:59:59', 'onpeak', 1.159), +(36, 5, '15:00:00', '17:59:59', 'midpeak', 0.708), +(37, 5, '18:00:00', '20:59:59', 'onpeak', 1.159), +(38, 5, '21:00:00', '21:59:59', 'midpeak', 0.708), +(39, 5, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2021分时电价10-12' +(40, 6, '00:00:00', '05:59:59', 'offpeak', 0.345), +(41, 6, '06:00:00', '07:59:59', 'midpeak', 0.708), +(42, 6, '08:00:00', '10:59:59', 'onpeak', 1.159), +(43, 6, '11:00:00', '17:59:59', 'midpeak', 0.708), +(44, 6, '18:00:00', '20:59:59', 'onpeak', 1.159), +(45, 6, '21:00:00', '21:59:59', 'midpeak', 0.708), +(46, 6, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2022分时电价1-6' +(47, 7, '00:00:00', '05:59:59', 'offpeak', 0.345), +(48, 7, '06:00:00', '07:59:59', 'midpeak', 0.708), +(49, 7, '08:00:00', '10:59:59', 'onpeak', 1.159), +(50, 7, '11:00:00', '17:59:59', 'midpeak', 0.708), +(51, 7, '18:00:00', '20:59:59', 'onpeak', 1.159), +(52, 7, '21:00:00', '21:59:59', 'midpeak', 0.708), +(53, 7, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2022分时电价7-9' +(54, 8, '00:00:00', '05:59:59', 'offpeak', 0.345), +(55, 8, '06:00:00', '07:59:59', 'midpeak', 0.708), +(56, 8, '08:00:00', '10:59:59', 'offpeak', 1.159), +(57, 8, '11:00:00', '12:59:59', 'midpeak', 0.708), +(58, 8, '13:00:00', '14:59:59', 'onpeak', 1.159), +(59, 8, '15:00:00', '17:59:59', 'midpeak', 0.708), +(60, 8, '18:00:00', '20:59:59', 'onpeak', 1.159), +(61, 8, '21:00:00', '21:59:59', 'midpeak', 0.708), +(62, 8, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2022分时电价10-12' +(63, 9, '00:00:00', '05:59:59', 'offpeak', 0.345), +(64, 9, '06:00:00', '07:59:59', 'midpeak', 0.708), +(65, 9, '08:00:00', '10:59:59', 'onpeak', 1.159), +(66, 9, '11:00:00', '17:59:59', 'midpeak', 0.708), +(67, 9, '18:00:00', '20:59:59', 'onpeak', 1.159), +(68, 9, '21:00:00', '21:59:59', 'midpeak', 0.708), +(69, 9, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2023分时电价1-6' +(70, 10, '00:00:00', '05:59:59', 'offpeak', 0.345), +(71, 10, '06:00:00', '07:59:59', 'midpeak', 0.708), +(72, 10, '08:00:00', '10:59:59', 'onpeak', 1.159), +(73, 10, '11:00:00', '17:59:59', 'midpeak', 0.708), +(74, 10, '18:00:00', '20:59:59', 'onpeak', 1.159), +(75, 10, '21:00:00', '21:59:59', 'midpeak', 0.708), +(76, 10, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2023分时电价7-9' +(77, 11, '00:00:00', '05:59:59', 'offpeak', 0.345), +(78, 11, '06:00:00', '07:59:59', 'midpeak', 0.708), +(79, 11, '08:00:00', '10:59:59', 'offpeak', 1.159), +(80, 11, '11:00:00', '12:59:59', 'midpeak', 0.708), +(81, 11, '13:00:00', '14:59:59', 'onpeak', 1.159), +(82, 11, '15:00:00', '17:59:59', 'midpeak', 0.708), +(83, 11, '18:00:00', '20:59:59', 'onpeak', 1.159), +(84, 11, '21:00:00', '21:59:59', 'midpeak', 0.708), +(85, 11, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '2023分时电价10-12' +(86, 12, '00:00:00', '05:59:59', 'offpeak', 0.345), +(87, 12, '06:00:00', '07:59:59', 'midpeak', 0.708), +(88, 12, '08:00:00', '10:59:59', 'onpeak', 1.159), +(89, 12, '11:00:00', '17:59:59', 'midpeak', 0.708), +(90, 12, '18:00:00', '20:59:59', 'onpeak', 1.159), +(91, 12, '21:00:00', '21:59:59', 'midpeak', 0.708), +(92, 12, '22:00:00', '23:59:59', 'offpeak', 0.345), +-- '自来水' +-- 'Water' +(93, 13, '00:00:00', '23:59:59', 'midpeak', 5.95), +-- '天然气' +-- 'Natual Gas' +(94, 14, '00:00:00', '23:59:59', 'midpeak', 3.50); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tariffs_blocks` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tariffs_blocks` +(`id`, `tariff_id`, `start_amount`, `end_amount`, `price`) +VALUES +-- '分量阶梯电价' +-- 'Block tariff of electrical' +(1, 15, 0, 10000, 0.345), +(2, 15, 10000, 30000, 0.456), +(3, 15, 30000, 100000, 0.567), +(4, 15, 100000, 1000000000, 0.678); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_stores` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_stores` +(`id`, `name`, `uuid`, `address`, `latitude`, `longitude`, `area`, `store_type_id`, `is_input_counted`, `contact_id`, `cost_center_id`, `description`) +VALUES +(1, '麦当劳(祈年大街得来速店)', 'd8a24322-4bab-4ba2-aedc-5d55a84c3db8', '北京市东城区东打磨厂街7号', 39.899493, 116.412041, 500.000, 1, true, 1, 1, 'MacDonalds'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_store_types` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_store_types` +(`id`, `name`, `uuid`, `description`, `simplified_code`) +VALUES +(1, 'Restaurant', '494d7d5e-e139-4629-b957-99ea4caf0401', '餐饮', 'RS'), +(2, 'Retail', '1f556579-9d5c-45ce-9bd8-f2dc1d033470', '零售', 'RT'), +(3, 'Hotel', 'cae697aa-ceca-435d-91bf-492b46607eb0', '酒店', 'HT'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_stores_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_stores_meters` +(`id`, `store_id`, `meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_stores_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_stores_offline_meters` +(`id`, `store_id`, `offline_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_stores_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_stores_points` +(`id`, store_id`, `point_id`) +VALUES +(1, 3, 2000001), +(2, 3, 2000002), +(3, 3, 2000003), +(4, 3, 2000006); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_stores_sensors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_stores_sensors` +(`id`, `store_id`, `sensor_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_stores_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_stores_virtual_meters` +(`id`, `store_id`, `virtual_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenants` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenants` +(`id`, `name`, `uuid`, `buildings`, `floors`, `rooms`, `area`, `tenant_type_id`, `is_input_counted`, `is_key_tenant`, + `lease_number`, `lease_start_datetime_utc`, `lease_end_datetime_utc`, `is_in_lease`, `contact_id`, `cost_center_id`, `description`) +VALUES +(1, 'Starbucks星巴克', '6b0da806-a4cd-431a-8116-2915e90aaf8b', 'Building #1', 'L1 L2 L3', '1201b+2247+3F', 418.8, 9, true, true, + '6b0da806', '2019-12-31 16:00:00', '2022-12-31 16:00:00', true, 1, 1, 'my description'); +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenant_types` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenant_types` +(`id`, `name`, `uuid`, `description`, `simplified_code`) +VALUES +(1, '餐饮租户', '83fffba1-9e22-4397-a93a-3742772c3753', 'Food and Beverage', 'FNB'), +(2, '燃气餐饮租户', 'ad95ed16-1c57-49a9-a85e-71e389393089', 'Food and Beverage (Gas)', 'FNBGas'), +(3, '电餐饮租户', '1dc21e83-4333-40f8-9e25-ea049becba37', 'Food and Beverage (Electrical)', 'FNBElec'), +(4, '高照度租户', '4208a60d-d8e6-4fe5-8cea-a55109e9b397', 'High Illuminance Tenant', 'HighIllu'), +(5, '主力租户', 'fc4ae534-544a-4a22-b83b-9f4aa99494aa', 'Anchor Tenant', 'ANCH'), +(6, '普通商业租户', '6d1dca30-1cbe-463d-8a78-cdd5e0f8ac8b', 'Normal Tenant', 'Normal'), +(7, '其他商业租户', '2078e1c0-3936-4ae7-9253-08e0aa1d84b6', 'Other Retail Tenants', 'Other'), +(8, '整层办公租户', 'b2a580a3-edc9-4838-ae1d-7b7265860a9a', 'Whole Floor Office Tenant', 'WhFlr'), +(9, '非整层办公租户', '55bbcba7-d8a0-44a0-9a9f-2f085e3cb044', 'None-Whole Floor Office Tenant', 'NonWhFlr'); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenants_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenants_meters` +(`id`, `tenant_id`, `meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenants_offline_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenants_offline_meters` +(`id`, `tenant_id`, `offline_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenants_points` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenants_points` +(`id`, tenant_id`, `point_id`) +VALUES +(1, 3, 2000001), +(2, 3, 2000002), +(3, 3, 2000003), +(4, 3, 2000006); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenants_sensors` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenants_sensors` +(`id`, `tenant_id`, `sensor_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_tenants_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_tenants_virtual_meters` +(`id`, `tenant_id`, `virtual_meter_id`) +VALUES +(1, 1, 1); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_virtual_meters` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; + +INSERT INTO `myems_system_db`.`tbl_virtual_meters` +(`id`, `name`, `uuid`, `energy_category_id`, `is_counted`, `cost_center_id`, `energy_item_id`, `description`) +VALUES +(1, '示例虚拟表', '3fff2cfb-f755-44c8-a919-6135205a8573', 1, true, 1, 1, `virtual description`); + +COMMIT; + +-- --------------------------------------------------------------------------------------------------------------------- +-- Demo Data for table `myems_system_db`.`tbl_variables` +-- --------------------------------------------------------------------------------------------------------------------- +START TRANSACTION; +USE `myems_system_db`; +-- meter_type = {'meter', 'virtual_meter', 'offline_meter'} +INSERT INTO `myems_system_db`.`tbl_variables` +(`id`, `name`, `expression_id`, `meter_type`, `meter_id`) +VALUES +(1, 'x', 1, 'meter', 1), +(2, 'y', 1, 'meter', 2), +(3, 'z', 1, 'meter', 3); + +COMMIT; + diff --git a/database/myems_system_db.sql b/database/myems_system_db.sql index 92e3493c..5725960d 100644 --- a/database/myems_system_db.sql +++ b/database/myems_system_db.sql @@ -24,21 +24,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_combined_equipments` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_combined_equipments_index_1` ON `myems_system_db`.`tbl_combined_equipments` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_combined_equipments` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_combined_equipments` --- (`id`, `name`, `uuid`, `is_input_counted`, `is_output_counted`, `cost_center_id`, `description` ) --- VALUES --- (1, '组合式设备1', '48aab70f-2e32-4518-9986-a6b7395acf58', true, false, 1, 'description'), --- (2, '组合式设备2', 'c235e68c-e1be-4d7a-84e7-976c83ff6e44', true, false, 1, 'description'); - --- COMMIT; - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_combined_equipments_equipments` -- --------------------------------------------------------------------------------------------------------------------- @@ -51,18 +36,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_combined_equipments_equipments PRIMARY KEY (`id`)); CREATE INDEX `tbl_combined_equipments_equipments_index_1` ON `myems_system_db`.`tbl_combined_equipments_equipments` (`combined_equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_combined_equipments_equipments` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_combined_equipments_equipments` --- (`id`, `combined_equipment_id`, `equipment_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_combined_equipments_meters` @@ -77,18 +50,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_combined_equipments_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_combined_equipments_meters_index_1` ON `myems_system_db`.`tbl_combined_equipments_meters` (`combined_equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_combined_equipments_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_combined_equipments_meters` --- (`id`, `combined_equipment_id`, `meter_id`, `is_output`) --- VALUES --- (1, 1, 1, false); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_combined_equipments_offline_meters` @@ -103,18 +64,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_combined_equipments_offline_me PRIMARY KEY (`id`)); CREATE INDEX `tbl_combined_equipments_offline_meters_index_1` ON `myems_system_db`.`tbl_combined_equipments_offline_meters` (`combined_equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_combined_equipments_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_combined_equipments_offline_meters` --- (`id`, `combined_equipment_id`, `offline_meter_id`, `is_output`) --- VALUES --- (1, 1, 1, false); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_combined_equipments_parameters` @@ -133,36 +82,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_combined_equipments_parameters PRIMARY KEY (`id`)); CREATE INDEX `tbl_combined_equipment_parameters_index_1` ON `myems_system_db`.`tbl_combined_equipments_parameters` (`combined_equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_combined_equipments_parameters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_combined_equipments_parameters` --- (`id`, `combined_equipment_id`, `name`, `parameter_type`, `constant`, `point_id`, `numerator_meter_uuid`, `denominator_meter_uuid`) --- VALUES --- (1, 1, 'serial number', 'constant', 'bfa8b106', NULL, NULL, NULL), --- (2, 1, 'manufacturer', 'constant', 'York', NULL, NULL, NULL), --- (3, 1, 'maintainer', 'constant', 'Johnson Controls', NULL, NULL, NULL), --- (4, 1, 'use life start', 'constant', '2016-01-01', NULL, NULL, NULL), --- (5, 1, 'use life end', 'constant', '2025-12-31', NULL, NULL, NULL), --- (6, 1, 'model number', 'constant', 'CH01', NULL, NULL, NULL), --- (7, 1, 'nominal cooling capacity', 'constant', '90.000 kW', NULL, NULL, NULL), --- (8, 1, 'nominal cooling input power', 'constant', '100.000 kW', NULL, NULL, NULL), --- (9, 1, 'nominal cooling cop', 'constant', '5', NULL, NULL, NULL), --- (10, 1, 'nominal cooling operating current', 'constant', '120.000 A', NULL, NULL, NULL), --- (11, 1, 'rated input power', 'constant', '100.000 kW', NULL, NULL, NULL), --- (12, 1, 'nominal chilled water flow rate', 'constant', '30 m2/h', NULL, NULL, NULL), --- (13, 1, 'nominal cooling water flow_rate', 'constant', '50 m2/h', NULL, NULL, NULL), --- (14, 1, 'status', 'point', NULL, 1, NULL, NULL), --- (15, 1, 'inlet chilled water temperature', 'point', NULL, 2, NULL, NULL), --- (16, 1, 'chilled_water instantaneous flow rate', 'point', NULL, 3, NULL, NULL), --- (17, 1, 'instantaneous power', 'point', NULL, 4, NULL, NULL), --- (18, 1, 'COP', 'fraction', NULL, NULL, 'a4e0dbf0-528a-4cbb-88cc-563527900d40', '89ff5118-d0c2-4dd8-8098-a8698189b2ea'); --- --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_combined_equipments_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -175,18 +94,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_combined_equipments_virtual_me `is_output` BOOL NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_combined_equipments_virtual_meters_index_1` ON `myems_system_db`.`tbl_combined_equipments_virtual_meters` (`combined_equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_combined_equipments_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_combined_equipments_virtual_meters` --- (`id`, `combined_equipment_id`, `virtual_meter_id`, `is_output`) --- VALUES --- (1, 1, 1, false); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_contacts` @@ -202,17 +109,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_contacts` ( `description` VARCHAR(255) , PRIMARY KEY (`id`)); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_contacts` --- --------------------------------------------------------------------------------------------------------------------- - START TRANSACTION; - USE `myems_system_db`; - INSERT INTO `myems_system_db`.`tbl_contacts`(`id`, `name`, `uuid`, `email`, `phone`, `description`) - VALUES - (1, 'John', '5c5ce6e8-8d00-46b3-9602-4e1520a8b43f', 'john@myems.io', '+8613888888888', 'Building #1'), - (2, 'Sample Tenant', '102b654d-e831-4365-bb1e-dbd55e897851', 'sample.tenant@myems.io', '+8613666666666', 'Sample Tenant'); - COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_cost_centers` -- --------------------------------------------------------------------------------------------------------------------- @@ -226,18 +122,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_cost_centers` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_cost_centers_index_1` ON `myems_system_db`.`tbl_cost_centers` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_cost_centers` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_cost_centers` -(`id`, `name`, `uuid`, `external_id`) -VALUES -(1, '成本中心', 'd97b9736-c4f9-4005-a534-6af3487303ad', NULL); -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_cost_centers_tariffs` -- --------------------------------------------------------------------------------------------------------------------- @@ -249,19 +133,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_cost_centers_tariffs` ( `tariff_id` BIGINT NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_cost_centers_tariffs_index_1` ON `myems_system_db`.`tbl_cost_centers_tariffs` (`cost_center_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_cost_centers_tariffs` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- INSERT INTO `myems_system_db`.`tbl_cost_centers_tariffs` --- (`id`, `cost_center_id`, `tariff_id`) --- VALUES --- (1, 1, 1), --- (2, 1, 2), --- (3, 1, 3); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_data_sources` @@ -281,24 +152,6 @@ CREATE INDEX `tbl_data_sources_index_1` ON `myems_system_db`.`tbl_data_sources` CREATE INDEX `tbl_data_sources_index_2` ON `myems_system_db`.`tbl_data_sources` (`gateway_id`); CREATE INDEX `tbl_data_sources_index_3` ON `myems_system_db`.`tbl_data_sources` (`protocol`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_data_sources` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_data_sources` --- (`id`, `name`, `uuid`,`gateway_id`, `protocol`, `connection`) --- VALUES --- (1, '示例ModbusTCP数据源', 1, 'b3ace9d4-b63b-419b-818f-0f6d1d0603a4', 'modbus-tcp', '{"host":"10.111.212.191", "port":502}'), --- (2, '示例ModbusRTU数据源', 1, 'b903f0af-9115-448c-9d46-8caf5f9995f3', 'modbus-tru', '{"port": "/dev/ttyUSB0","slaveaddress": 1, "baudrate": 9600,"bytesize": 8,"parity": "N","stopbits": 1,"timeout": 0.05,"mode": "rtu"}''), --- (3, '示例Bacnet/IP数据源', 1, 'e2d5b30b-b554-4ebe-8ce7-f377ab380d19', 'bacnet-ip', '{"host":"10.111.212.200", "port":47808}'), --- (4, '示例S7数据源', 1, '9eb0d705-d02a-43f8-9c62-7e5ef508b255', 's7', '{"host":"10.111.212.202", "port":102, "rack": 0, "slot": 2}'), --- (5, '示例ControlLogix数据源', 1, 'd1dc9792-7861-4dd3-9b01-07511dae16c1', 'control-logix', '{"host":"10.111.212.203","port":44818,"processorslot":3}'); --- (6, '示例OPU UA数据源', 1, '56e1c642-8032-495b-af2e-18a77ca75e0f', 'opc-ua', '{"url":"opc.tcp://10.111.212.5:49320/OPCUA/SimulationServer/"}'); --- (7, '示例天气数据源', 1, '9bff8e95-c7c9-4002-b040-08a96ae196b5', 'weather', '{"base_url":"WEATHER_API_URL", "location":"beijing", "key":"APPKEY"}'); --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_distribution_circuits` -- --------------------------------------------------------------------------------------------------------------------- @@ -318,19 +171,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_distribution_circuits` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_distribution_circuits_index_1` ON `myems_system_db`.`tbl_distribution_circuits` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_distribution_circuits` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_distribution_circuits` --- (`id`, `name`, `uuid`, `distribution_system_id`, `distribution_room`, `switchgear`, `peak_load`, `peak_current`, `customers`, `meters`) --- VALUES --- (1, '51W91', '52f7abe1-ba0e-47a6-a327-4faac42a1d11', 1, 'EW1', '51AL9', 30, 53.6, '地下室应急照明', 'ALE-1102, ALE-1082'); --- --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_distribution_circuits_points` -- --------------------------------------------------------------------------------------------------------------------- @@ -342,44 +182,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_distribution_circuits_points` `point_id` BIGINT NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_distribution_circuits_points_index_1` ON `myems_system_db`.`tbl_distribution_circuits_points` (`distribution_circuit_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_distribution_circuits_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_distribution_circuits_points` --- (`id`, `distribution_circuit_id`, `point_id`) --- VALUES (1, 1, 1); --- COMMIT; - - --- --------------------------------------------------------------------------------------------------------------------- --- Table `myems_system_db`.`tbl_distribution_systems` --- --------------------------------------------------------------------------------------------------------------------- -DROP TABLE IF EXISTS `myems_system_db`.`tbl_distribution_systems` ; - -CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_distribution_systems` ( - `id` BIGINT NOT NULL AUTO_INCREMENT, - `name` VARCHAR(255) NOT NULL, - `uuid` CHAR(36) NOT NULL, - `svg` LONGTEXT NOT NULL, - `description` VARCHAR(255), - PRIMARY KEY (`id`)); -CREATE INDEX `tbl_distribution_systems_index_1` ON `myems_system_db`.`tbl_distribution_systems` (`name`); - --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_distribution_systems` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_distribution_systems` --- (`id`, `name`, `uuid`, `svg`, `description`) --- VALUES --- (1, '示例配电系统', '95652719-56fa-44cc-9bef-7aa47664d4ff', 'Four separate rectangles', 'demo distribution system'); --- --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_energy_categories` @@ -396,28 +198,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_categories` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_energy_categories_index_1` ON `myems_system_db`.`tbl_energy_categories` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_energy_categories` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_energy_categories` -(`id`, `name`, `uuid`, `unit_of_measure`, `kgce`, `kgco2e`) -VALUES -(1, '电', '6d0753ed-8b43-4332-b6fd-d2f5813831d3', 'kWh', 0.1229, 0.928), -(2, '自来水', '3dbfa598-fccc-4d60-bf11-14bd55540c66', 'm³', 0.0857, 0.910), -(3, '天然气', '6d0753ed-8b43-4332-b6fd-d2f5813831d3', 'm³', 1.3300, 2.1622), -(4,'4℃冷冻水','d2a3021a-4911-4611-856e-80133000f1d5','m³',1.000,1.000), -(5,'7℃冷冻水','c1ad0696-e1ab-4e0c-a342-b194c0bc27e0','m³',1.000,1.000), -(6,'蒸汽','ac91a5c4-4ae5-4a73-8e3f-044591f42eef','T',1.000,1.000), -(7,'压缩空气','ff238e98-cd35-47c5-88a3-00617587775d','m³',1.000,1.000), -(8,'循环水','7e159a34-b2e6-4fd3-ba76-897d134abe06','m³',1.000,1.000), -(9, '热量','549f9cad-8db7-49d2-9473-95e37a3fc46a','KJ',1.000,1.000), -(10, '冷量','05aa257b-3cf6-4f19-808d-92e7dbf52b16','KJ',1.000,1.000), -(11, '中水','df6161b6-4a1b-46e7-b7c8-337b5b52d717','m³',1.000,1.000); -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_energy_items` -- --------------------------------------------------------------------------------------------------------------------- @@ -431,22 +211,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_items` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_energy_items_index_1` ON `myems_system_db`.`tbl_energy_items` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_energy_items` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_energy_items` -(`id`, `name`, `uuid`, `energy_category_id`) -VALUES -(1, '空调用电', 'c5eac07a-e889-4a56-aa1b-a0b688c4e953', 1), -(2, '动力用电', '6875e4e0-a2ec-47a5-a88e-becb10e9603a', 1), -(3, '照明用电', '79918598-6477-4130-a85c-4cb87d0eac23', 1); - -COMMIT; - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_energy_flow_diagrams` -- --------------------------------------------------------------------------------------------------------------------- @@ -459,19 +223,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_flow_diagrams` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_energy_flow_diagrams_index_1` ON `myems_system_db`.`tbl_energy_flow_diagrams` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_energy_flow_diagrams` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams` --- (`id`, `name`, `uuid`) --- VALUES --- (1, '低压配电系统', '3ccbc9c6-9575-4212-a63a-a688d1154302'); --- --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_energy_flow_diagrams_links` -- --------------------------------------------------------------------------------------------------------------------- @@ -486,26 +237,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_flow_diagrams_links` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_energy_flow_diagrams_links_index_1` ON `myems_system_db`.`tbl_energy_flow_diagrams_links` (`energy_flow_diagram_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_energy_flow_diagrams_links` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams_links` --- (`id`, `energy_flow_diagram_id`, `name`) --- VALUES --- (1, 1, 1, 3, '5ca47bc5-22c2-47fc-b906-33222191ea40'), --- (2, 1, 2, 4, '5d4d2f06-6200-4671-b182-4cf32cd9228f'), --- (3, 1, 2, 5, '7897665b-66ac-481d-9c31-2ab2ecbda16c'), --- (4, 1, 2, 6, 'f0c278ec-eb32-4c5e-a35f-88643b00c367'), --- (5, 1, 3, 7, '9918aa6c-79e9-4579-8f2e-a76eb9fe4e3e'), --- (6, 1, 3, 8, '831cbc8c-1429-4840-946e-f0b389b2253e'), --- (7, 1, 4, 9, 'd2fc8464-3f13-42a9-8a57-63f95f677f0f'), --- (8, 1, 4, 10, '7e4b3831-887b-40e2-b7f8-4d77c6f206a9'); --- --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_energy_flow_diagrams_nodes` -- --------------------------------------------------------------------------------------------------------------------- @@ -518,28 +249,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_flow_diagrams_nodes` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_energy_flow_diagrams_nodes_index_1` ON `myems_system_db`.`tbl_energy_flow_diagrams_nodes` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_energy_flow_diagrams_nodes` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_energy_flow_diagrams_nodes` --- (`id`, `energy_flow_diagram_id`, `name`) --- VALUES --- (1, 1, '10KV进线#1'), --- (2, 1, '10KV进线#2'), --- (3, 1, '租区'), --- (4, 1, '公区'), --- (5, 1, '酒店'), --- (6, 1, '车库'), --- (7, 1, '餐饮'), --- (8, 1, '零售'), --- (9, 1, '照明'), --- (10, 1, '电梯'); --- --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_equipments` -- --------------------------------------------------------------------------------------------------------------------- @@ -556,21 +265,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_equipments` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_equipments_index_1` ON `myems_system_db`.`tbl_equipments` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_equipments` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_equipments` --- (`id`, `name`, `uuid`, `is_input_counted`, `is_output_counted`, `cost_center_id`, `description` ) --- VALUES --- (1, '设备1', 'bfa8b106-89a1-49ca-9b2b-a481ac41a873', true, false, 1, 'description'), --- (2, '设备2', 'ad5798ec-d827-43d9-bf08-fc7516f9c4c8', true, false, 1, 'description'); - --- COMMIT; - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_equipments_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -584,19 +278,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_equipments_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_equipments_meters_index_1` ON `myems_system_db`.`tbl_equipments_meters` (`equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_equipments_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_equipments_meters` --- (`id`, `equipment_id`, `meter_id`, `is_output`) --- VALUES --- (1, 1, 1, false); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_equipments_offline_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -610,19 +291,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_equipments_offline_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_equipments_offline_meters_index_1` ON `myems_system_db`.`tbl_equipments_offline_meters` (`equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_equipments_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_equipments_offline_meters` --- (`id`, `equipment_id`, `offline_meter_id`, `is_output`) --- VALUES --- (1, 1, 1, false); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_equipments_parameters` -- --------------------------------------------------------------------------------------------------------------------- @@ -640,36 +308,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_equipments_parameters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_equipment_parameters_index_1` ON `myems_system_db`.`tbl_equipments_parameters` (`equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_equipments_parameters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- --- INSERT INTO `myems_system_db`.`tbl_equipments_parameters` --- (`id`, `equipment_id`, `name`, `parameter_type`, `constant`, `point_id`, `numerator_meter_uuid`, `denominator_meter_uuid`) --- VALUES --- (1, 1, 'serial number', 'constant', 'bfa8b106', NULL, NULL, NULL), --- (2, 1, 'manufacturer', 'constant', 'York', NULL, NULL, NULL), --- (3, 1, 'maintainer', 'constant', 'Johnson Controls', NULL, NULL, NULL), --- (4, 1, 'use life start', 'constant', '2016-01-01', NULL, NULL, NULL), --- (5, 1, 'use life end', 'constant', '2025-12-31', NULL, NULL, NULL), --- (6, 1, 'model number', 'constant', 'CH01', NULL, NULL, NULL), --- (7, 1, 'nominal cooling capacity', 'constant', '90.000 kW', NULL, NULL, NULL), --- (8, 1, 'nominal cooling input power', 'constant', '100.000 kW', NULL, NULL, NULL), --- (9, 1, 'nominal cooling cop', 'constant', '5', NULL, NULL, NULL), --- (10, 1, 'nominal cooling operating current', 'constant', '120.000 A', NULL, NULL, NULL), --- (11, 1, 'rated input power', 'constant', '100.000 kW', NULL, NULL, NULL), --- (12, 1, 'nominal chilled water flow rate', 'constant', '30 m2/h', NULL, NULL, NULL), --- (13, 1, 'nominal cooling water flow_rate', 'constant', '50 m2/h', NULL, NULL, NULL), --- (14, 1, 'status', 'point', NULL, 1, NULL, NULL), --- (15, 1, 'inlet chilled water temperature', 'point', NULL, 2, NULL, NULL), --- (16, 1, 'chilled_water instantaneous flow rate', 'point', NULL, 3, NULL, NULL), --- (17, 1, 'instantaneous power', 'point', NULL, 4, NULL, NULL), --- (18, 1, 'COP', 'fraction', NULL, NULL, 'a4e0dbf0-528a-4cbb-88cc-563527900d40', '89ff5118-d0c2-4dd8-8098-a8698189b2ea'); --- --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_equipments_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -682,18 +320,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_equipments_virtual_meters` ( `is_output` BOOL NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_equipments_virtual_meters_index_1` ON `myems_system_db`.`tbl_equipments_virtual_meters` (`equipment_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_equipments_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_equipments_virtual_meters` --- (`id`, `equipment_id`, `virtual_meter_id`, `is_output`) --- VALUES --- (1, 1, 1, false); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_expressions` @@ -708,18 +334,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_expressions` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_expressions_index_1` ON `myems_system_db`.`tbl_expressions` (`virtual_meter_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_expressions` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_expressions` --- (`id`, `uuid`, `virtual_meter_id`, `equation`) --- VALUES --- (1, '3fff2cfb-f755-44c8-a919-6135205a8573', 1, 'x1+x2-x3'); --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_gateways` -- --------------------------------------------------------------------------------------------------------------------- @@ -734,20 +348,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_gateways` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_gateways_index_1` ON `myems_system_db`.`tbl_gateways` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_gateways` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_gateways` -(`id`, `name`, `uuid`, `token`, `last_seen_datetime_utc`) -VALUES -(1, 'MyEMS Gateway 1', 'dc681934-5053-4660-98ed-266c54227231', '983427af-1c35-42ba-8b4d-288675550225', null), -(2, 'MyEMS Gateway 2', '8f75c0ab-9296-49c7-9058-8139febd0c31', 'd3860971-e6e0-4c98-9eba-5492869c5b19', null); - -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_knowledge_files` -- --------------------------------------------------------------------------------------------------------------------- @@ -777,8 +377,8 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_menus` ( `parent_menu_id` BIGINT, `is_hidden` BOOL NOT NULL, PRIMARY KEY (`id`)); - -INSERT INTO myems_system_db.tbl_menus (id,name,route, parent_menu_id,is_hidden) + +INSERT INTO myems_system_db.tbl_menus (id,name,route, parent_menu_id,is_hidden) VALUES (100,'Space Data','/space',NULL,0), (101,'Energy Category Data','/space/energycategory',100,0), @@ -869,9 +469,6 @@ VALUES (1100,'Advanced Reporting','/advancedreporting',NULL,0), (1200,'Knowledge Base','/knowledgebase',NULL,0); - - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -893,20 +490,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_meters` ( CREATE INDEX `tbl_meters_index_1` ON `myems_system_db`.`tbl_meters` (`name`); CREATE INDEX `tbl_meters_index_2` ON `myems_system_db`.`tbl_meters` (`energy_category_id`); CREATE INDEX `tbl_meters_index_3` ON `myems_system_db`.`tbl_meters` (`energy_item_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_meters` --- (`id`, `name`, `uuid`, `energy_category_id`, `is_counted`, `hourly_low_limit`, `hourly_high_limit`, `cost_center_id`, `energy_item_id`, `master_meter_id`, `description`) --- VALUES --- (1, '示例表1', '5ca47bc5-22c2-47fc-b906-33222191ea40', 1, true, 0.000, 999.999, 1, 1, null, 'meter1'), --- (2, '示例表2', '5ca47bc5-22c2-47fc-b906-33222191ea40', 1, true, 0.000, 999.999, 1, 1, 1, 'meter2'), --- (3, '示例表3', '6db58cd6-33d3-58ed-a095-22333202fb51', 1, true, 0.000, 999.999, 1, 1, 1, 'meter3'); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_meters_points` @@ -919,17 +502,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_meters_points` ( `point_id` BIGINT NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_meters_points_index_1` ON `myems_system_db`.`tbl_meters_points` (`meter_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_meters_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_meters_points` --- (`id`, `meter_id`, `point_id`) --- VALUES (1, 1, 1); --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_offline_meters` @@ -951,17 +523,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_offline_meters` ( CREATE INDEX `tbl_offline_meters_index_1` ON `myems_system_db`.`tbl_offline_meters` (`name`); CREATE INDEX `tbl_offline_meters_index_2` ON `myems_system_db`.`tbl_offline_meters` (`energy_category_id`); CREATE INDEX `tbl_offline_meters_index_3` ON `myems_system_db`.`tbl_offline_meters` (`energy_item_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_offline_meters` --- (`id`, `name`, `uuid`, `energy_category_id`, `is_counted`, `max_hourly_value`, `cost_center_id`, `energy_item_id`, `description`) --- VALUES --- (1, '示例离线表', '62f473e0-1a35-41f3-9c30-8110d75d65bb', 1, true, 999.99, 1, 1, 'offlinemeter1'); --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_points` @@ -985,52 +546,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_points` ( CREATE INDEX `tbl_points_index_1` ON `myems_system_db`.`tbl_points` (`name`); CREATE INDEX `tbl_points_index_2` ON `myems_system_db`.`tbl_points` (`data_source_id`); CREATE INDEX `tbl_points_index_3` ON `myems_system_db`.`tbl_points` (`id`, `object_type`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_points` --- --------------------------------------------------------------------------------------------------------------------- --- List of Object Type --- ENERGY_VALUE --- ANALOG_VALUE --- DIGITAL_VALUE - --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_points` --- (`id`, `name`, `data_source_id`, `object_type`, `units`, `high_limit`, `low_limit`, `ratio`, `is_trend`, `address`, `description` ) --- VALUES --- (1, 'Active Energy Import Tariff 1', 1, 'ENERGY_VALUE', 'kWh', 99999999999, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":801, \"number_of_registers\":4, \"format\":\"=d\", \"swap_adjacent_bytes\":false}', null), - --- (2, 'Working hours counter', 1, 'ANALOG_VALUE', 'S', 999999999, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":209, \"number_of_registers\":2, \"format\":\"=L\", \"swap_adjacent_bytes\":true}', null), - --- (3, 'Current a', 1, 'ANALOG_VALUE', 'A', 5, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":13, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), - --- (4, 'Active Power a', 1, 'ANALOG_VALUE', 'W', 3450, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":25, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), - --- (5, 'Power Factor a', 1, 'ANALOG_VALUE', 'W', 1, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":37, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), - --- (6, '示例ModbusTCP数据点6', 2, 'ENERGY_VALUE', 'Wh', 99999999999, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":40001, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), - --- (7, '示例数据点7', 2, 'ANALOG_VALUE', 'V', 690, 0, 1.000, true, --- '{\"slave_id\":1, \"function_code\":3, \"offset\":40002, \"number_of_registers\":2, \"format\":\"=f\", \"swap_adjacent_bytes\":false}', null), - --- (8, 'BACnet示例数据点1', 3, 'ANALOG_VALUE', 'V', 690, 0, 1.000, true, --- '{\"object_type\":\"analogValue\", \"object_id\":3004860, \"property_name\":\"presentValue\", \"property_array_index\":null}', null), --- BACnet Object Type --- analogValue, analogInput, analogOutput, binaryValue, binaryInput, binaryOutput - --- (9, 'S7示例数据点1', 4, 'ANALOG_VALUE', 'kWh', 99999999999, 0, 1.000, true, --- '{\"area\":\"DB\", \"db_number\":700, \"start\":8, \"size\":4', null); --- # S7 Area --- 'PE', 'PA', 'MK', 'DB', 'CT', 'TM' - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_sensors` @@ -1044,17 +559,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_sensors` ( `description` VARCHAR(255), PRIMARY KEY (`id`)); CREATE INDEX `tbl_sensors_index_1` ON `myems_system_db`.`tbl_sensors` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_sensors` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_sensors` --- (`id`, `name`, `uuid`, `description`) --- VALUES --- (1, '示例传感器', 'ba450606-6f39-41e0-8caf-75b528635511', 'sensor description'); --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_sensors_points` @@ -1067,16 +571,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_sensors_points` ( `point_id` BIGINT NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_sensors_points_index_1` ON `myems_system_db`.`tbl_sensors_points` (`sensor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_sensors_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_sensors_points` --- (`id`, `sensor_id`, `point_id`) --- VALUES (1, 1, 1); --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors` @@ -1095,19 +589,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_index_1` ON `myems_system_db`.`tbl_shopfloors` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_shopfloors` -(`id`, `name`, `uuid` , `area`, `contact_id`, `is_input_counted`, `cost_center_id`, `description`) -VALUES - (1, 'MyEMS Shopfloor', 'd03837fd-9d30-44fe-9443-154f7c7e15f1', 99999.999, 1, true, 1, 'MyEMS Project'); -COMMIT; - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors_equipments` -- --------------------------------------------------------------------------------------------------------------------- @@ -1120,19 +601,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors_equipments` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_equipments_index_1` ON `myems_system_db`.`tbl_shopfloors_equipments` (`shopfloor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors_equipments` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_shopfloors_equipments` --- (`id`, `shopfloor_id`, `equipment_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1145,19 +613,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_meters_index_1` ON `myems_system_db`.`tbl_shopfloors_meters` (`shopfloor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_shopfloors_meters` --- (`id`, `shopfloor_id`, `meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors_offline_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1170,19 +625,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors_offline_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_offline_meters_index_1` ON `myems_system_db`.`tbl_shopfloors_offline_meters` (`shopfloor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_shopfloors_offline_meters` --- (`id`, `shopfloor_id`, `offline_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors_sensors` -- --------------------------------------------------------------------------------------------------------------------- @@ -1195,19 +637,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors_sensors` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_sensors_index_1` ON `myems_system_db`.`tbl_shopfloors_sensors` (`shopfloor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors_sensors` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_shopfloors_sensors` --- (`id`, `shopfloor_id`, `sensor_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1220,19 +649,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors_virtual_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_virtual_meters_index_1` ON `myems_system_db`.`tbl_shopfloors_virtual_meters` (`shopfloor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_shopfloors_virtual_meters` --- (`id`, `shopfloor_id`, `virtual_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_shopfloors_points` -- --------------------------------------------------------------------------------------------------------------------- @@ -1245,23 +661,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_shopfloors_points` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_shopfloors_points_index_1` ON `myems_system_db`.`tbl_shopfloors_points` (`shopfloor_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_shopfloors_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_shopfloors_points` --- (`id`, `shopfloor_id`, `point_id`) --- VALUES --- (1, 3, 2000001), --- (2, 3, 2000002), --- (3, 3, 2000003), --- (4, 3, 2000006); - --- COMMIT; - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces` -- --------------------------------------------------------------------------------------------------------------------- @@ -1284,7 +683,7 @@ CREATE INDEX `tbl_spaces_index_1` ON `myems_system_db`.`tbl_spaces` (`name`); CREATE INDEX `tbl_spaces_index_2` ON `myems_system_db`.`tbl_spaces` (`parent_space_id`); -- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces` +-- Default Data for table `myems_system_db`.`tbl_spaces` -- --------------------------------------------------------------------------------------------------------------------- START TRANSACTION; USE `myems_system_db`; @@ -1292,10 +691,8 @@ USE `myems_system_db`; INSERT INTO `myems_system_db`.`tbl_spaces` (`id`, `name`, `uuid`, `parent_space_id`, `area`, `timezone_id`, `contact_id`, `is_input_counted`, `is_output_counted`, `cost_center_id`, `description`) VALUES - -- DO NOT deleted the record which ID is 1. It's the root space. - (1, 'MyEMS Headquarter', '9dfb7cff-f19f-4a1e-8c79-3adf6425bfd9', NULL, 99999.999, 56, 1, true, true, 1, 'MyEMS Project'), - (2, 'MyEMS Building #1', '8f25b33b-db93-49b3-b0f8-b01e0c19df29', 1, 88888.888, 56, 1, true, true, 1, 'MyEMS Project'), - (3, 'MyEMS Building #2', '195d7ea8-17b4-4e9c-bb37-546428155438', 1, 66666.666, 56, 1, true, true, 1, 'MyEMS Project'); +-- DO NOT deleted the record which ID is 1. It's the root space. +(1, 'MyEMS Headquarter', '9dfb7cff-f19f-4a1e-8c79-3adf6425bfd9', NULL, 99999.999, 56, 1, true, true, 1, 'MyEMS Project'); COMMIT; -- --------------------------------------------------------------------------------------------------------------------- @@ -1310,19 +707,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_combined_equipments` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_combined_equipments_index_1` ON `myems_system_db`.`tbl_spaces_combined_equipments` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_combined_equipments` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_combined_equipments` --- (`id`, `space_id`, `combined_equipment_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_equipments` -- --------------------------------------------------------------------------------------------------------------------- @@ -1335,19 +719,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_equipments` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_equipments_index_1` ON `myems_system_db`.`tbl_spaces_equipments` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_equipments` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_equipments` --- (`id`, `space_id`, `equipment_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1360,19 +731,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_meters_index_1` ON `myems_system_db`.`tbl_spaces_meters` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_meters` --- (`id`, `space_id`, `meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_offline_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1385,19 +743,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_offline_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_offline_meters_index_1` ON `myems_system_db`.`tbl_spaces_offline_meters` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_offline_meters` --- (`id`, `space_id`, `offline_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_sensors` -- --------------------------------------------------------------------------------------------------------------------- @@ -1410,19 +755,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_sensors` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_sensors_index_1` ON `myems_system_db`.`tbl_spaces_sensors` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_sensors` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_sensors` --- (`id`, `space_id`, `sensor_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_shopfloors` -- --------------------------------------------------------------------------------------------------------------------- @@ -1435,19 +767,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_shopfloors` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_sensors_index_1` ON `myems_system_db`.`tbl_spaces_shopfloors` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_shopfloors` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_shopfloors` --- (`id`, `space_id`, `shopfloor_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_stores` -- --------------------------------------------------------------------------------------------------------------------- @@ -1460,19 +779,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_stores` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_stores_index_1` ON `myems_system_db`.`tbl_spaces_stores` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_stores` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_stores` --- (`id`, `space_id`, `store_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_tenants` -- --------------------------------------------------------------------------------------------------------------------- @@ -1485,19 +791,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_tenants` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_tenants_index_1` ON `myems_system_db`.`tbl_spaces_tenants` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_tenants` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_tenants` --- (`id`, `space_id`, `tenant_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1510,19 +803,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_virtual_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_virtual_meters_index_1` ON `myems_system_db`.`tbl_spaces_virtual_meters` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaes_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaes_virtual_meters` --- (`id`, `space_id`, `virtual_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_spaces_points` -- --------------------------------------------------------------------------------------------------------------------- @@ -1535,22 +815,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_spaces_points` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_spaces_points_index_1` ON `myems_system_db`.`tbl_spaces_points` (`space_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_spaces_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_spaces_points` --- (`id`, `space_id`, `point_id`) --- VALUES --- (1, 3, 2000001), --- (2, 3, 2000002), --- (3, 3, 2000003), --- (4, 3, 2000006); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tariffs` -- --------------------------------------------------------------------------------------------------------------------- @@ -1569,33 +833,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tariffs` ( CREATE INDEX `tbl_tariffs_parameters_index_1` ON `myems_system_db`.`tbl_tariffs` (`name`); CREATE INDEX `tbl_tariffs_parameters_index_2` ON `myems_system_db`.`tbl_tariffs` (`energy_category_id`, `valid_from_datetime_utc`, `valid_through_datetime_utc`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tariffs` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_tariffs` -(`id`, `name`, `uuid`, `energy_category_id`, `tariff_type`, `unit_of_price`, `valid_from_datetime_utc`, `valid_through_datetime_utc`) -VALUES -(1, '2020分时电价1-6', '590efb36-8587-42a9-ae6f-c715d21496d6', 1, 'timeofuse', '元/千瓦时', '2019-12-31 16:00:00', '2020-06-30 15:59:59'), -(2, '2020分时电价7-9', 'f5966640-18fc-437a-9efd-cbc0c58b6373', 1, 'timeofuse', '元/千瓦时', '2020-06-30 16:00:00', '2020-09-30 15:59:59'), -(3, '2020分时电价10-12', '21727a1b-4b27-4186-b72e-db46e6e2d980', 1, 'timeofuse', '元/千瓦时', '2020-09-30 16:00:00', '2020-12-31 15:59:59'), -(4, '2021分时电价1-6', 'fe65e443-0ec2-4a16-823e-2365885e2598', 1, 'timeofuse', '元/千瓦时', '2020-12-31 16:00:00', '2021-06-30 15:59:59'), -(5, '2021分时电价7-9', 'd1285c81-4612-4d7c-9436-ed11b4e7abe4', 1, 'timeofuse', '元/千瓦时', '2021-06-30 16:00:00', '2021-09-30 15:59:59'), -(6, '2021分时电价10-12', 'e6c275b4-47eb-4f5d-bc59-edbe45c2a407', 1, 'timeofuse', '元/千瓦时', '2021-09-30 16:00:00', '2021-12-31 15:59:59'), -(7, '2022分时电价1-6', 'ca359f72-48ad-46a7-82af-cecbe98450e8', 1, 'timeofuse', '元/千瓦时', '2021-12-31 16:00:00', '2022-06-30 15:59:59'), -(8, '2022分时电价7-9', '9fdda603-0f8f-4452-ad59-c5df54bc35f4', 1, 'timeofuse', '元/千瓦时', '2022-06-30 16:00:00', '2022-09-30 15:59:59'), -(9, '2022分时电价10-12', 'fb0442e7-4d44-4bfd-8b20-cad3f77a2480', 1, 'timeofuse', '元/千瓦时', '2022-09-30 16:00:00', '2022-12-31 15:59:59'), -(10, '2023分时电价1-6', '3fa6e1f2-7d08-4f5a-bcbf-beb041d569c0', 1, 'timeofuse', '元/千瓦时', '2022-12-31 16:00:00', '2023-06-30 15:59:59'), -(11, '2023分时电价7-9', '787240fb-1694-403e-a0a7-83d7be1cc0b8', 1, 'timeofuse', '元/千瓦时', '2023-06-30 16:00:00', '2023-09-30 15:59:59'), -(12, '2023分时电价10-12', 'a07fdf76-edcf-4124-96e7-ab733a5a4b70', 1, 'timeofuse', '元/千瓦时', '2023-09-30 16:00:00', '2023-12-31 15:59:59'), -(13, '自来水', '6fcbc77e-effb-4d43-9b30-77b062435d34', 2, 'timeofuse', '元/m³', '2019-12-31 16:00:00', '2023-12-31 15:59:59'), -(14, '天然气', '6a4c56ff-b3e1-4555-9b1c-87d05bcfa4d9', 3, 'timeofuse', '元/m³', '2019-12-31 16:00:00', '2023-12-31 15:59:59'), -(15, '分量阶梯电价', 'd1b81d2f-d387-43d3-affd-d796b7236b60', 1, 'block', '元/千瓦时', '2019-12-31 16:00:00', '2023-12-31 15:59:59'); - -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tariffs_timeofuses` -- --------------------------------------------------------------------------------------------------------------------- @@ -1611,128 +848,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tariffs_timeofuses` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tariffs_timeofuses_index_1` ON `myems_system_db`.`tbl_tariffs_timeofuses` (`tariff_id`, `start_time_of_day`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tariffs_timeofuses` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_tariffs_timeofuses` -(`id`, `tariff_id`, `start_time_of_day`, `end_time_of_day`, `peak_type`, `price`) -VALUES --- '2020分时电价1-6' -(1, 1, '00:00:00', '05:59:59', 'offpeak', 0.345), -(2, 1, '06:00:00', '07:59:59', 'midpeak', 0.708), -(3, 1, '08:00:00', '10:59:59', 'onpeak', 1.159), -(4, 1, '11:00:00', '17:59:59', 'midpeak', 0.708), -(5, 1, '18:00:00', '20:59:59', 'onpeak', 1.159), -(6, 1, '21:00:00', '21:59:59', 'midpeak', 0.708), -(7, 1, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2020分时电价7-9' -(8, 2, '00:00:00', '05:59:59', 'offpeak', 0.345), -(9, 2, '06:00:00', '07:59:59', 'midpeak', 0.708), -(10, 2, '08:00:00', '10:59:59', 'offpeak', 1.159), -(11, 2, '11:00:00', '12:59:59', 'midpeak', 0.708), -(12, 2, '13:00:00', '14:59:59', 'onpeak', 1.159), -(13, 2, '15:00:00', '17:59:59', 'midpeak', 0.708), -(14, 2, '18:00:00', '20:59:59', 'onpeak', 1.159), -(15, 2, '21:00:00', '21:59:59', 'midpeak', 0.708), -(16, 2, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2020分时电价10-12' -(17, 3, '00:00:00', '05:59:59', 'offpeak', 0.345), -(18, 3, '06:00:00', '07:59:59', 'midpeak', 0.708), -(19, 3, '08:00:00', '10:59:59', 'onpeak', 1.159), -(20, 3, '11:00:00', '17:59:59', 'midpeak', 0.708), -(21, 3, '18:00:00', '20:59:59', 'onpeak', 1.159), -(22, 3, '21:00:00', '21:59:59', 'midpeak', 0.708), -(23, 3, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2021分时电价1-6' -(24, 4, '00:00:00', '05:59:59', 'offpeak', 0.345), -(25, 4, '06:00:00', '07:59:59', 'midpeak', 0.708), -(26, 4, '08:00:00', '10:59:59', 'onpeak', 1.159), -(27, 4, '11:00:00', '17:59:59', 'midpeak', 0.708), -(28, 4, '18:00:00', '20:59:59', 'onpeak', 1.159), -(29, 4, '21:00:00', '21:59:59', 'midpeak', 0.708), -(30, 4, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2021分时电价7-9' -(31, 5, '00:00:00', '05:59:59', 'offpeak', 0.345), -(32, 5, '06:00:00', '07:59:59', 'midpeak', 0.708), -(33, 5, '08:00:00', '10:59:59', 'offpeak', 1.159), -(34, 5, '11:00:00', '12:59:59', 'midpeak', 0.708), -(35, 5, '13:00:00', '14:59:59', 'onpeak', 1.159), -(36, 5, '15:00:00', '17:59:59', 'midpeak', 0.708), -(37, 5, '18:00:00', '20:59:59', 'onpeak', 1.159), -(38, 5, '21:00:00', '21:59:59', 'midpeak', 0.708), -(39, 5, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2021分时电价10-12' -(40, 6, '00:00:00', '05:59:59', 'offpeak', 0.345), -(41, 6, '06:00:00', '07:59:59', 'midpeak', 0.708), -(42, 6, '08:00:00', '10:59:59', 'onpeak', 1.159), -(43, 6, '11:00:00', '17:59:59', 'midpeak', 0.708), -(44, 6, '18:00:00', '20:59:59', 'onpeak', 1.159), -(45, 6, '21:00:00', '21:59:59', 'midpeak', 0.708), -(46, 6, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2022分时电价1-6' -(47, 7, '00:00:00', '05:59:59', 'offpeak', 0.345), -(48, 7, '06:00:00', '07:59:59', 'midpeak', 0.708), -(49, 7, '08:00:00', '10:59:59', 'onpeak', 1.159), -(50, 7, '11:00:00', '17:59:59', 'midpeak', 0.708), -(51, 7, '18:00:00', '20:59:59', 'onpeak', 1.159), -(52, 7, '21:00:00', '21:59:59', 'midpeak', 0.708), -(53, 7, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2022分时电价7-9' -(54, 8, '00:00:00', '05:59:59', 'offpeak', 0.345), -(55, 8, '06:00:00', '07:59:59', 'midpeak', 0.708), -(56, 8, '08:00:00', '10:59:59', 'offpeak', 1.159), -(57, 8, '11:00:00', '12:59:59', 'midpeak', 0.708), -(58, 8, '13:00:00', '14:59:59', 'onpeak', 1.159), -(59, 8, '15:00:00', '17:59:59', 'midpeak', 0.708), -(60, 8, '18:00:00', '20:59:59', 'onpeak', 1.159), -(61, 8, '21:00:00', '21:59:59', 'midpeak', 0.708), -(62, 8, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2022分时电价10-12' -(63, 9, '00:00:00', '05:59:59', 'offpeak', 0.345), -(64, 9, '06:00:00', '07:59:59', 'midpeak', 0.708), -(65, 9, '08:00:00', '10:59:59', 'onpeak', 1.159), -(66, 9, '11:00:00', '17:59:59', 'midpeak', 0.708), -(67, 9, '18:00:00', '20:59:59', 'onpeak', 1.159), -(68, 9, '21:00:00', '21:59:59', 'midpeak', 0.708), -(69, 9, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2023分时电价1-6' -(70, 10, '00:00:00', '05:59:59', 'offpeak', 0.345), -(71, 10, '06:00:00', '07:59:59', 'midpeak', 0.708), -(72, 10, '08:00:00', '10:59:59', 'onpeak', 1.159), -(73, 10, '11:00:00', '17:59:59', 'midpeak', 0.708), -(74, 10, '18:00:00', '20:59:59', 'onpeak', 1.159), -(75, 10, '21:00:00', '21:59:59', 'midpeak', 0.708), -(76, 10, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2023分时电价7-9' -(77, 11, '00:00:00', '05:59:59', 'offpeak', 0.345), -(78, 11, '06:00:00', '07:59:59', 'midpeak', 0.708), -(79, 11, '08:00:00', '10:59:59', 'offpeak', 1.159), -(80, 11, '11:00:00', '12:59:59', 'midpeak', 0.708), -(81, 11, '13:00:00', '14:59:59', 'onpeak', 1.159), -(82, 11, '15:00:00', '17:59:59', 'midpeak', 0.708), -(83, 11, '18:00:00', '20:59:59', 'onpeak', 1.159), -(84, 11, '21:00:00', '21:59:59', 'midpeak', 0.708), -(85, 11, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '2023分时电价10-12' -(86, 12, '00:00:00', '05:59:59', 'offpeak', 0.345), -(87, 12, '06:00:00', '07:59:59', 'midpeak', 0.708), -(88, 12, '08:00:00', '10:59:59', 'onpeak', 1.159), -(89, 12, '11:00:00', '17:59:59', 'midpeak', 0.708), -(90, 12, '18:00:00', '20:59:59', 'onpeak', 1.159), -(91, 12, '21:00:00', '21:59:59', 'midpeak', 0.708), -(92, 12, '22:00:00', '23:59:59', 'offpeak', 0.345), --- '自来水' --- 'Water' -(93, 13, '00:00:00', '23:59:59', 'midpeak', 5.95), --- '天然气' --- 'Natual Gas' -(94, 14, '00:00:00', '23:59:59', 'midpeak', 3.50); -COMMIT; - - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tariffs_blocks` -- --------------------------------------------------------------------------------------------------------------------- @@ -1747,24 +862,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tariffs_blocks` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tariffs_blocks_index_1` ON `myems_system_db`.`tbl_tariffs_blocks` (`tariff_id`, `start_amount`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tariffs_blocks` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_tariffs_blocks` -(`id`, `tariff_id`, `start_amount`, `end_amount`, `price`) -VALUES --- '分量阶梯电价' --- 'Block tariff of electrical' -(1, 15, 0, 10000, 0.345), -(2, 15, 10000, 30000, 0.456), -(3, 15, 30000, 100000, 0.567), -(4, 15, 100000, 1000000000, 0.678); - -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_stores` -- --------------------------------------------------------------------------------------------------------------------- @@ -1786,18 +883,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_stores` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_stores_index_1` ON `myems_system_db`.`tbl_stores` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_stores` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_stores` -(`id`, `name`, `uuid`, `address`, `latitude`, `longitude`, `area`, `store_type_id`, `is_input_counted`, `contact_id`, `cost_center_id`, `description`) -VALUES - (1, '麦当劳(祈年大街得来速店)', 'd8a24322-4bab-4ba2-aedc-5d55a84c3db8', '北京市东城区东打磨厂街7号', 39.899493, 116.412041, 500.000, 1, true, 1, 1, 'MacDonalds'); -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_store_types` -- --------------------------------------------------------------------------------------------------------------------- @@ -1812,22 +897,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_store_types` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_store_types_index_1` ON `myems_system_db`.`tbl_store_types` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_store_types` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_store_types` -(`id`, `name`, `uuid`, `description`, `simplified_code`) -VALUES -(1, 'Restaurant', '494d7d5e-e139-4629-b957-99ea4caf0401', '餐饮', 'RS'), -(2, 'Retail', '1f556579-9d5c-45ce-9bd8-f2dc1d033470', '零售', 'RT'), -(3, 'Hotel', 'cae697aa-ceca-435d-91bf-492b46607eb0', '酒店', 'HT'); - - -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_stores_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1840,19 +909,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_stores_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_stores_meters_index_1` ON `myems_system_db`.`tbl_stores_meters` (`store_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_stores_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_stores_meters` --- (`id`, `store_id`, `meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_stores_offline_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1864,18 +920,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_stores_offline_meters` ( `offline_meter_id` BIGINT NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_stores_offline_meters_index_1` ON `myems_system_db`.`tbl_stores_offline_meters` (`store_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_stores_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_stores_offline_meters` --- (`id`, `store_id`, `offline_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_stores_points` @@ -1889,22 +933,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_stores_points` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_stores_points_index_1` ON `myems_system_db`.`tbl_stores_points` (`store_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_stores_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_stores_points` --- (`id`, store_id`, `point_id`) --- VALUES --- (1, 3, 2000001), --- (2, 3, 2000002), --- (3, 3, 2000003), --- (4, 3, 2000006); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_stores_sensors` -- --------------------------------------------------------------------------------------------------------------------- @@ -1917,19 +945,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_stores_sensors` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_stores_sensors_index_1` ON `myems_system_db`.`tbl_stores_sensors` (`store_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_stores_sensors` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_stores_sensors` --- (`id`, `store_id`, `sensor_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_stores_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -1942,19 +957,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_stores_virtual_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_stores_virtual_meters_index_1` ON `myems_system_db`.`tbl_stores_virtual_meters` (`store_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_stores_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_stores_virtual_meters` --- (`id`, `store_id`, `virtual_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenants` -- --------------------------------------------------------------------------------------------------------------------- @@ -1981,20 +983,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenants` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenants_index_1` ON `myems_system_db`.`tbl_tenants` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenants` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_tenants` -(`id`, `name`, `uuid`, `buildings`, `floors`, `rooms`, `area`, `tenant_type_id`, `is_input_counted`, `is_key_tenant`, - `lease_number`, `lease_start_datetime_utc`, `lease_end_datetime_utc`, `is_in_lease`, `contact_id`, `cost_center_id`, `description`) -VALUES - (1, 'Starbucks星巴克', '6b0da806-a4cd-431a-8116-2915e90aaf8b', 'Building #1', 'L1 L2 L3', '1201b+2247+3F', 418.8, 9, true, true, - '6b0da806', '2019-12-31 16:00:00', '2022-12-31 16:00:00', true, 1, 1, 'my description'); -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenant_types` -- --------------------------------------------------------------------------------------------------------------------- @@ -2009,28 +997,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenant_types` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenant_types_index_1` ON `myems_system_db`.`tbl_tenant_types` (`name`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenant_types` --- --------------------------------------------------------------------------------------------------------------------- -START TRANSACTION; -USE `myems_system_db`; - -INSERT INTO `myems_system_db`.`tbl_tenant_types` -(`id`, `name`, `uuid`, `description`, `simplified_code`) -VALUES -(1, '餐饮租户', '83fffba1-9e22-4397-a93a-3742772c3753', 'Food and Beverage', 'FNB'), -(2, '燃气餐饮租户', 'ad95ed16-1c57-49a9-a85e-71e389393089', 'Food and Beverage (Gas)', 'FNBGas'), -(3, '电餐饮租户', '1dc21e83-4333-40f8-9e25-ea049becba37', 'Food and Beverage (Electrical)', 'FNBElec'), -(4, '高照度租户', '4208a60d-d8e6-4fe5-8cea-a55109e9b397', 'High Illuminance Tenant', 'HighIllu'), -(5, '主力租户', 'fc4ae534-544a-4a22-b83b-9f4aa99494aa', 'Anchor Tenant', 'ANCH'), -(6, '普通商业租户', '6d1dca30-1cbe-463d-8a78-cdd5e0f8ac8b', 'Normal Tenant', 'Normal'), -(7, '其他商业租户', '2078e1c0-3936-4ae7-9253-08e0aa1d84b6', 'Other Retail Tenants', 'Other'), -(8, '整层办公租户', 'b2a580a3-edc9-4838-ae1d-7b7265860a9a', 'Whole Floor Office Tenant', 'WhFlr'), -(9, '非整层办公租户', '55bbcba7-d8a0-44a0-9a9f-2f085e3cb044', 'None-Whole Floor Office Tenant', 'NonWhFlr'); - - -COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenants_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -2043,19 +1009,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenants_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenants_meters_index_1` ON `myems_system_db`.`tbl_tenants_meters` (`tenant_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenants_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_tenants_meters` --- (`id`, `tenant_id`, `meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenants_offline_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -2067,18 +1020,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenants_offline_meters` ( `offline_meter_id` BIGINT NOT NULL, PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenants_offline_meters_index_1` ON `myems_system_db`.`tbl_tenants_offline_meters` (`tenant_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenants_offline_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_tenants_offline_meters` --- (`id`, `tenant_id`, `offline_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenants_points` @@ -2092,22 +1033,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenants_points` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenants_points_index_1` ON `myems_system_db`.`tbl_tenants_points` (`tenant_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenants_points` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_tenants_points` --- (`id`, tenant_id`, `point_id`) --- VALUES --- (1, 3, 2000001), --- (2, 3, 2000002), --- (3, 3, 2000003), --- (4, 3, 2000006); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenants_sensors` -- --------------------------------------------------------------------------------------------------------------------- @@ -2120,19 +1045,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenants_sensors` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenants_sensors_index_1` ON `myems_system_db`.`tbl_tenants_sensors` (`tenant_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenants_sensors` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_tenants_sensors` --- (`id`, `tenant_id`, `sensor_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_tenants_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -2145,19 +1057,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_tenants_virtual_meters` ( PRIMARY KEY (`id`)); CREATE INDEX `tbl_tenants_virtual_meters_index_1` ON `myems_system_db`.`tbl_tenants_virtual_meters` (`tenant_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_tenants_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_tenants_virtual_meters` --- (`id`, `tenant_id`, `virtual_meter_id`) --- VALUES --- (1, 1, 1); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_timezones` -- --------------------------------------------------------------------------------------------------------------------- @@ -2274,6 +1173,7 @@ VALUES (93, 'Kamchatka Standard Time', '(GMT+12:00) Petropavlovsk-Kamchatsky', '+12:00'); COMMIT; + -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_virtual_meters` -- --------------------------------------------------------------------------------------------------------------------- @@ -2293,19 +1193,6 @@ CREATE INDEX `tbl_virtual_meters_index_1` ON `myems_system_db`.`tbl_virtual_met CREATE INDEX `tbl_virtual_meters_index_2` ON `myems_system_db`.`tbl_virtual_meters` (`energy_category_id`); CREATE INDEX `tbl_virtual_meters_index_3` ON `myems_system_db`.`tbl_virtual_meters` (`energy_item_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_virtual_meters` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; - --- INSERT INTO `myems_system_db`.`tbl_virtual_meters` --- (`id`, `name`, `uuid`, `energy_category_id`, `is_counted`, `cost_center_id`, `energy_item_id`, `description`) --- VALUES --- (1, '示例虚拟表', '3fff2cfb-f755-44c8-a919-6135205a8573', 1, true, 1, 1, `virtual description`); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_variables` -- --------------------------------------------------------------------------------------------------------------------- @@ -2321,23 +1208,6 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_variables` ( CREATE INDEX `tbl_variables_index_1` ON `myems_system_db`.`tbl_variables` (`expression_id`); CREATE INDEX `tbl_variables_index_2` ON `myems_system_db`.`tbl_variables` (`meter_id`, `meter_type`, `expression_id`); --- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_variables` --- --------------------------------------------------------------------------------------------------------------------- --- START TRANSACTION; --- USE `myems_system_db`; --- -- id 1 --- -- meter_type = {'meter', 'virtual_meter', 'offline_meter'} --- -- --- INSERT INTO `myems_system_db`.`tbl_variables` --- (`id`, `name`, `expression_id`, `meter_type`, `meter_id`) --- VALUES --- (1, 'x', 1, 'meter', 1), --- (2, 'y', 1, 'meter', 2), --- (3, 'z', 1, 'meter', 3); - --- COMMIT; - -- --------------------------------------------------------------------------------------------------------------------- -- Table `myems_system_db`.`tbl_versions` -- --------------------------------------------------------------------------------------------------------------------- @@ -2350,7 +1220,7 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_versions` ( PRIMARY KEY (`id`)); -- --------------------------------------------------------------------------------------------------------------------- --- Example Data for table `myems_system_db`.`tbl_versions` +-- Data for table `myems_system_db`.`tbl_versions` -- --------------------------------------------------------------------------------------------------------------------- START TRANSACTION; USE `myems_system_db`; diff --git a/myems-api/excelexporters/combinedequipmentbatch.py b/myems-api/excelexporters/combinedequipmentbatch.py index 5a55dbfa..fcc253da 100644 --- a/myems-api/excelexporters/combinedequipmentbatch.py +++ b/myems-api/excelexporters/combinedequipmentbatch.py @@ -1,7 +1,7 @@ import base64 import uuid import os -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -103,12 +103,6 @@ def generate_excel(report, space_name, reporting_start_datetime_local, reporting wrap_text=True, shrink_to_fit=False, indent=0) - c_r_alignment = Alignment(vertical='bottom', - horizontal='center', - text_rotation=0, - wrap_text=True, - shrink_to_fit=False, - indent=0) # Img img = Image("excelexporters/myems.png") diff --git a/myems-api/excelexporters/combinedequipmentcost.py b/myems-api/excelexporters/combinedequipmentcost.py index 34e609e3..73b93e96 100644 --- a/myems-api/excelexporters/combinedequipmentcost.py +++ b/myems-api/excelexporters/combinedequipmentcost.py @@ -2,13 +2,7 @@ import base64 import uuid import os from decimal import Decimal - -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -119,18 +113,11 @@ def generate_excel(report, wrap_text=True, shrink_to_fit=False, indent=0) - c_r_alignment = Alignment(vertical='bottom', - horizontal='center', - text_rotation=0, - wrap_text=True, - shrink_to_fit=False, - indent=0) # Img img = Image("excelexporters/myems.png") img.width = img.width * 0.85 img.height = img.height * 0.85 - # img = Image("myems.png") ws.add_image(img, 'B1') # Title @@ -167,8 +154,6 @@ def generate_excel(report, return filename - ################################################# - reporting_period_data = report['reporting_period'] has_energy_data_flag = True @@ -241,8 +226,6 @@ def generate_excel(report, for i in range(6, 9 + 1): ws.row_dimensions[i].height = 0.1 - ################################################# - has_ele_peak_flag = True if "toppeaks" not in reporting_period_data.keys() or \ reporting_period_data['toppeaks'] is None or \ @@ -511,7 +494,7 @@ def generate_excel(report, col = 'B' - every_day_total = Decimal(0.0) + periodic_sum = Decimal(0.0) for j in range(0, ca_len): col = chr(ord('C') + j) @@ -519,14 +502,14 @@ def generate_excel(report, ws[col + str(current_row_number)].font = title_font ws[col + str(current_row_number)].alignment = c_c_alignment value = round(reporting_period_data['values'][j][i], 2) - every_day_total += value + periodic_sum += value ws[col + str(current_row_number)] = value ws[col + str(current_row_number)].border = f_border end_col = chr(ord(col) + 1) ws[end_col + str(current_row_number)].font = title_font ws[end_col + str(current_row_number)].alignment = c_c_alignment - ws[end_col + str(current_row_number)] = round(every_day_total, 2) + ws[end_col + str(current_row_number)] = round(periodic_sum, 2) ws[end_col + str(current_row_number)].border = f_border current_row_number += 1 diff --git a/myems-api/excelexporters/combinedequipmentefficiency.py b/myems-api/excelexporters/combinedequipmentefficiency.py index 712d5a46..5754f5a9 100644 --- a/myems-api/excelexporters/combinedequipmentefficiency.py +++ b/myems-api/excelexporters/combinedequipmentefficiency.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/combinedequipmentenergycategory.py b/myems-api/excelexporters/combinedequipmentenergycategory.py index 5466d80b..fc94cb1c 100644 --- a/myems-api/excelexporters/combinedequipmentenergycategory.py +++ b/myems-api/excelexporters/combinedequipmentenergycategory.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/combinedequipmentenergyitem.py b/myems-api/excelexporters/combinedequipmentenergyitem.py index 3dffad35..c1962e7f 100644 --- a/myems-api/excelexporters/combinedequipmentenergyitem.py +++ b/myems-api/excelexporters/combinedequipmentenergyitem.py @@ -1,11 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/combinedequipmentincome.py b/myems-api/excelexporters/combinedequipmentincome.py index 9b585da9..cde96e0c 100644 --- a/myems-api/excelexporters/combinedequipmentincome.py +++ b/myems-api/excelexporters/combinedequipmentincome.py @@ -2,13 +2,7 @@ import base64 import uuid import os from decimal import Decimal - -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -434,9 +428,9 @@ def generate_excel(report, row = str(table_row + 1 + j) ws[col + row].font = title_font ws[col + row].alignment = c_c_alignment - every_day_sum = reporting_period_values_every_day_sum(reporting_period_data, j, ca_len) - total_sum += every_day_sum - ws[col + row] = round(every_day_sum, 2) + periodic_sum = reporting_period_values_periodic_sum(reporting_period_data, j, ca_len) + total_sum += periodic_sum + ws[col + row] = round(periodic_sum, 2) ws[col + row].border = f_border row = str(table_row + 1 + len(time)) @@ -713,12 +707,12 @@ def generate_excel(report, return filename -def reporting_period_values_every_day_sum(reporting_period_data, every_day_index, ca_len): - every_day_sum = 0 +def reporting_period_values_periodic_sum(reporting_period_data, periodic_index, ca_len): + periodic_sum = 0 for i in range(0, ca_len): - every_day_sum += reporting_period_data['values'][i][every_day_index] + periodic_sum += reporting_period_data['values'][i][periodic_index] - return every_day_sum + return periodic_sum def get_parameters_timestamps_lists_max_len(parameters_timestamps_lists): diff --git a/myems-api/excelexporters/combinedequipmentload.py b/myems-api/excelexporters/combinedequipmentload.py index 36ed4005..5fe4a2ce 100644 --- a/myems-api/excelexporters/combinedequipmentload.py +++ b/myems-api/excelexporters/combinedequipmentload.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -85,7 +82,6 @@ def generate_excel(report, # Font name_font = Font(name='Constantia', size=15, bold=True) title_font = Font(name='宋体', size=15, bold=True) - # data_font = Font(name='Franklin Gothic Book', size=11) table_fill = PatternFill(fill_type='solid', fgColor='1F497D') f_border = Border(left=Side(border_style='medium', color='00000000'), @@ -162,98 +158,93 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 负荷分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 负荷分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '平均负荷' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '平均负荷' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '最大负荷' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '最大负荷' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '负荷系数' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '负荷系数' + ws['E7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ - if reporting_period_data['averages'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ + if reporting_period_data['averages'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ - if reporting_period_data['factors'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ + if reporting_period_data['factors'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/combinedequipmentoutput.py b/myems-api/excelexporters/combinedequipmentoutput.py index 6584c092..9cd67dc2 100644 --- a/myems-api/excelexporters/combinedequipmentoutput.py +++ b/myems-api/excelexporters/combinedequipmentoutput.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/combinedequipmentsaving.py b/myems-api/excelexporters/combinedequipmentsaving.py index fd94cefa..1ab26d64 100644 --- a/myems-api/excelexporters/combinedequipmentsaving.py +++ b/myems-api/excelexporters/combinedequipmentsaving.py @@ -2,13 +2,7 @@ import base64 import uuid import os from decimal import Decimal - -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/combinedequipmentstatistics.py b/myems-api/excelexporters/combinedequipmentstatistics.py index 085e11d7..2b212ed9 100644 --- a/myems-api/excelexporters/combinedequipmentstatistics.py +++ b/myems-api/excelexporters/combinedequipmentstatistics.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -162,152 +159,146 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '算术平均数' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '算术平均数' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '中位数' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '中位数' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '最小值' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '最小值' + ws['E7'].border = f_border - ws['F7'].font = title_font - ws['F7'].alignment = c_c_alignment - ws['F7'] = '最大值' - ws['F7'].border = f_border + ws['F7'].font = title_font + ws['F7'].alignment = c_c_alignment + ws['F7'] = '最大值' + ws['F7'].border = f_border - ws['G7'].font = title_font - ws['G7'].alignment = c_c_alignment - ws['G7'] = '样本标准差' - ws['G7'].border = f_border + ws['G7'].font = title_font + ws['G7'].alignment = c_c_alignment + ws['G7'] = '样本标准差' + ws['G7'].border = f_border - ws['H7'].font = title_font - ws['H7'].alignment = c_c_alignment - ws['H7'] = '样本方差' - ws['H7'].border = f_border + ws['H7'].font = title_font + ws['H7'].alignment = c_c_alignment + ws['H7'] = '样本方差' + ws['H7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = reporting_period_data['means'][i] \ - if reporting_period_data['means'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = reporting_period_data['means'][i] \ + if reporting_period_data['means'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = reporting_period_data['medians'][i] \ - if reporting_period_data['medians'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = reporting_period_data['medians'][i] \ + if reporting_period_data['medians'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = reporting_period_data['minimums'][i] \ - if reporting_period_data['minimums'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = reporting_period_data['minimums'][i] \ + if reporting_period_data['minimums'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border - ws['F' + str(row)].font = name_font - ws['F' + str(row)].alignment = c_c_alignment - ws['F' + str(row)] = reporting_period_data['maximums'][i] \ - if reporting_period_data['maximums'][i] is not None else '' - ws['F' + str(row)].border = f_border - ws['F' + str(row)].number_format = '0.00' + ws['F' + str(row)].font = name_font + ws['F' + str(row)].alignment = c_c_alignment + ws['F' + str(row)] = reporting_period_data['maximums'][i] \ + if reporting_period_data['maximums'][i] is not None else '' + ws['F' + str(row)].border = f_border + ws['F' + str(row)].number_format = '0.00' - ws['F' + str(row + 1)].font = name_font - ws['F' + str(row + 1)].alignment = c_c_alignment - ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['F' + str(row + 1)].border = f_border + ws['F' + str(row + 1)].font = name_font + ws['F' + str(row + 1)].alignment = c_c_alignment + ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['F' + str(row + 1)].border = f_border - ws['G' + str(row)].font = name_font - ws['G' + str(row)].alignment = c_c_alignment - ws['G' + str(row)] = reporting_period_data['stdevs'][i] \ - if reporting_period_data['stdevs'][i] is not None else '' - ws['G' + str(row)].border = f_border - ws['G' + str(row)].number_format = '0.00' + ws['G' + str(row)].font = name_font + ws['G' + str(row)].alignment = c_c_alignment + ws['G' + str(row)] = reporting_period_data['stdevs'][i] \ + if reporting_period_data['stdevs'][i] is not None else '' + ws['G' + str(row)].border = f_border + ws['G' + str(row)].number_format = '0.00' - ws['G' + str(row + 1)].font = name_font - ws['G' + str(row + 1)].alignment = c_c_alignment - ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' - ws['G' + str(row + 1)].border = f_border + ws['G' + str(row + 1)].font = name_font + ws['G' + str(row + 1)].alignment = c_c_alignment + ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' + ws['G' + str(row + 1)].border = f_border - ws['H' + str(row)].font = name_font - ws['H' + str(row)].alignment = c_c_alignment - ws['H' + str(row)] = reporting_period_data['variances'][i] \ - if reporting_period_data['variances'][i] is not None else '' - ws['H' + str(row)].border = f_border - ws['H' + str(row)].number_format = '0.00' + ws['H' + str(row)].font = name_font + ws['H' + str(row)].alignment = c_c_alignment + ws['H' + str(row)] = reporting_period_data['variances'][i] \ + if reporting_period_data['variances'][i] is not None else '' + ws['H' + str(row)].border = f_border + ws['H' + str(row)].number_format = '0.00' - ws['H' + str(row + 1)].font = name_font - ws['H' + str(row + 1)].alignment = c_c_alignment - ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' - ws['H' + str(row + 1)].border = f_border + ws['H' + str(row + 1)].font = name_font + ws['H' + str(row + 1)].alignment = c_c_alignment + ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' + ws['H' + str(row + 1)].border = f_border #################################################################################################################### # Second: 详细数据 diff --git a/myems-api/excelexporters/equipmentbatch.py b/myems-api/excelexporters/equipmentbatch.py index 9a794fac..21d88f68 100644 --- a/myems-api/excelexporters/equipmentbatch.py +++ b/myems-api/excelexporters/equipmentbatch.py @@ -1,7 +1,7 @@ import base64 import uuid import os -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/equipmentcost.py b/myems-api/excelexporters/equipmentcost.py index bbf5e808..c08ec647 100644 --- a/myems-api/excelexporters/equipmentcost.py +++ b/myems-api/excelexporters/equipmentcost.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -90,7 +85,6 @@ def generate_excel(report, # Font name_font = Font(name='Constantia', size=15, bold=True) title_font = Font(name='宋体', size=15, bold=True) - data_font = Font(name='Franklin Gothic Book', size=11) table_fill = PatternFill(fill_type='solid', fgColor='1F497D') f_border = Border(left=Side(border_style='medium', color='00000000'), @@ -98,9 +92,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'),) b_c_alignment = Alignment(vertical='bottom', horizontal='center', @@ -445,7 +437,6 @@ def generate_excel(report, for i in range(0, len(time)): col = 'B' row = str(table_row+1 + i) - # col = chr(ord('B') + i) ws[col + row].font = title_font ws[col + row].alignment = c_c_alignment ws[col + row] = time[i] diff --git a/myems-api/excelexporters/equipmentefficiency.py b/myems-api/excelexporters/equipmentefficiency.py index 88fa80c3..9f669828 100644 --- a/myems-api/excelexporters/equipmentefficiency.py +++ b/myems-api/excelexporters/equipmentefficiency.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -88,7 +83,6 @@ def generate_excel(report, # Font name_font = Font(name='Constantia', size=15, bold=True) title_font = Font(name='宋体', size=15, bold=True) - data_font = Font(name='Franklin Gothic Book', size=11) table_fill = PatternFill(fill_type='solid', fgColor='1F497D') f_border = Border(left=Side(border_style='medium', color='00000000'), @@ -96,9 +90,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'),) b_c_alignment = Alignment(vertical='bottom', horizontal='center', @@ -118,12 +110,6 @@ def generate_excel(report, wrap_text=True, shrink_to_fit=False, indent=0) - c_r_alignment = Alignment(vertical='bottom', - horizontal='center', - text_rotation=0, - wrap_text=True, - shrink_to_fit=False, - indent=0) # Img img = Image("excelexporters/myems.png") img.width = img.width * 0.85 diff --git a/myems-api/excelexporters/equipmentenergycategory.py b/myems-api/excelexporters/equipmentenergycategory.py index ac207d72..3c172e44 100644 --- a/myems-api/excelexporters/equipmentenergycategory.py +++ b/myems-api/excelexporters/equipmentenergycategory.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -90,7 +85,6 @@ def generate_excel(report, # Font name_font = Font(name='Constantia', size=15, bold=True) title_font = Font(name='宋体', size=15, bold=True) - data_font = Font(name='Franklin Gothic Book', size=11) table_fill = PatternFill(fill_type='solid', fgColor='1F497D') f_border = Border(left=Side(border_style='medium', color='00000000'), @@ -98,9 +92,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'), ) b_c_alignment = Alignment(vertical='bottom', horizontal='center', diff --git a/myems-api/excelexporters/equipmentenergyitem.py b/myems-api/excelexporters/equipmentenergyitem.py index dc454a56..9502b505 100644 --- a/myems-api/excelexporters/equipmentenergyitem.py +++ b/myems-api/excelexporters/equipmentenergyitem.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -95,9 +90,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'), ) b_c_alignment = Alignment(vertical='bottom', horizontal='center', diff --git a/myems-api/excelexporters/equipmentincome.py b/myems-api/excelexporters/equipmentincome.py index e01d84a2..eb8dc492 100644 --- a/myems-api/excelexporters/equipmentincome.py +++ b/myems-api/excelexporters/equipmentincome.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from decimal import * from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -95,9 +90,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'), ) b_c_alignment = Alignment(vertical='bottom', horizontal='center', @@ -432,9 +425,9 @@ def generate_excel(report, row = str(table_row + 1 + j) ws[col + row].font = title_font ws[col + row].alignment = c_c_alignment - every_day_sum = reporting_period_values_every_day_sum(reporting_period_data, j, ca_len) - total_sum += every_day_sum - ws[col + row] = round(every_day_sum, 2) + periodic_sum = reporting_period_values_periodic_sum(reporting_period_data, j, ca_len) + total_sum += periodic_sum + ws[col + row] = round(periodic_sum, 2) ws[col + row].border = f_border row = str(table_row + 1 + len(time)) @@ -637,12 +630,12 @@ def generate_excel(report, return filename -def reporting_period_values_every_day_sum(reporting_period_data, every_day_index, ca_len): - every_day_sum = 0 +def reporting_period_values_periodic_sum(reporting_period_data, periodic_index, ca_len): + periodic_sum = 0.0 for i in range(0, ca_len): - every_day_sum += reporting_period_data['values'][i][every_day_index] + periodic_sum += reporting_period_data['values'][i][periodic_index] - return every_day_sum + return periodic_sum def timestamps_data_all_equal_0(lists): diff --git a/myems-api/excelexporters/equipmentload.py b/myems-api/excelexporters/equipmentload.py index 998ad8b9..1695c698 100644 --- a/myems-api/excelexporters/equipmentload.py +++ b/myems-api/excelexporters/equipmentload.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -92,9 +89,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'), ) b_c_alignment = Alignment(vertical='bottom', horizontal='center', @@ -161,98 +156,92 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '平均负荷' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '平均负荷' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '最大负荷' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '最大负荷' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '负荷系数' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '负荷系数' + ws['E7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ - if reporting_period_data['averages'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ + if reporting_period_data['averages'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ - if reporting_period_data['factors'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ + if reporting_period_data['factors'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/equipmentoutput.py b/myems-api/excelexporters/equipmentoutput.py index 9fbbf077..b7b3b55b 100644 --- a/myems-api/excelexporters/equipmentoutput.py +++ b/myems-api/excelexporters/equipmentoutput.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -95,9 +90,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'), ) b_c_alignment = Alignment(vertical='bottom', horizontal='center', diff --git a/myems-api/excelexporters/equipmentsaving.py b/myems-api/excelexporters/equipmentsaving.py index 5ee81bf7..fa178a42 100644 --- a/myems-api/excelexporters/equipmentsaving.py +++ b/myems-api/excelexporters/equipmentsaving.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from decimal import Decimal +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -95,9 +91,7 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) + b_border = Border(bottom=Side(border_style='medium', color='00000000'), ) b_c_alignment = Alignment(vertical='bottom', horizontal='center', @@ -743,7 +737,7 @@ def generate_excel(report, def sum_list(lists): - total = 0 + total = Decimal(0.0) for i in range(0, len(lists)): total += lists[i] diff --git a/myems-api/excelexporters/equipmentstatistics.py b/myems-api/excelexporters/equipmentstatistics.py index 011caa43..b4157a53 100644 --- a/myems-api/excelexporters/equipmentstatistics.py +++ b/myems-api/excelexporters/equipmentstatistics.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -160,152 +157,146 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '算术平均数' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '算术平均数' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '中位数' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '中位数' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '最小值' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '最小值' + ws['E7'].border = f_border - ws['F7'].font = title_font - ws['F7'].alignment = c_c_alignment - ws['F7'] = '最大值' - ws['F7'].border = f_border + ws['F7'].font = title_font + ws['F7'].alignment = c_c_alignment + ws['F7'] = '最大值' + ws['F7'].border = f_border - ws['G7'].font = title_font - ws['G7'].alignment = c_c_alignment - ws['G7'] = '样本标准差' - ws['G7'].border = f_border + ws['G7'].font = title_font + ws['G7'].alignment = c_c_alignment + ws['G7'] = '样本标准差' + ws['G7'].border = f_border - ws['H7'].font = title_font - ws['H7'].alignment = c_c_alignment - ws['H7'] = '样本方差' - ws['H7'].border = f_border + ws['H7'].font = title_font + ws['H7'].alignment = c_c_alignment + ws['H7'] = '样本方差' + ws['H7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = reporting_period_data['means'][i] \ - if reporting_period_data['means'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = reporting_period_data['means'][i] \ + if reporting_period_data['means'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = reporting_period_data['medians'][i] \ - if reporting_period_data['medians'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = reporting_period_data['medians'][i] \ + if reporting_period_data['medians'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = reporting_period_data['minimums'][i] \ - if reporting_period_data['minimums'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = reporting_period_data['minimums'][i] \ + if reporting_period_data['minimums'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border - ws['F' + str(row)].font = name_font - ws['F' + str(row)].alignment = c_c_alignment - ws['F' + str(row)] = reporting_period_data['maximums'][i] \ - if reporting_period_data['maximums'][i] is not None else '' - ws['F' + str(row)].border = f_border - ws['F' + str(row)].number_format = '0.00' + ws['F' + str(row)].font = name_font + ws['F' + str(row)].alignment = c_c_alignment + ws['F' + str(row)] = reporting_period_data['maximums'][i] \ + if reporting_period_data['maximums'][i] is not None else '' + ws['F' + str(row)].border = f_border + ws['F' + str(row)].number_format = '0.00' - ws['F' + str(row + 1)].font = name_font - ws['F' + str(row + 1)].alignment = c_c_alignment - ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['F' + str(row + 1)].border = f_border + ws['F' + str(row + 1)].font = name_font + ws['F' + str(row + 1)].alignment = c_c_alignment + ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['F' + str(row + 1)].border = f_border - ws['G' + str(row)].font = name_font - ws['G' + str(row)].alignment = c_c_alignment - ws['G' + str(row)] = reporting_period_data['stdevs'][i] \ - if reporting_period_data['stdevs'][i] is not None else '' - ws['G' + str(row)].border = f_border - ws['G' + str(row)].number_format = '0.00' + ws['G' + str(row)].font = name_font + ws['G' + str(row)].alignment = c_c_alignment + ws['G' + str(row)] = reporting_period_data['stdevs'][i] \ + if reporting_period_data['stdevs'][i] is not None else '' + ws['G' + str(row)].border = f_border + ws['G' + str(row)].number_format = '0.00' - ws['G' + str(row + 1)].font = name_font - ws['G' + str(row + 1)].alignment = c_c_alignment - ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' - ws['G' + str(row + 1)].border = f_border + ws['G' + str(row + 1)].font = name_font + ws['G' + str(row + 1)].alignment = c_c_alignment + ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' + ws['G' + str(row + 1)].border = f_border - ws['H' + str(row)].font = name_font - ws['H' + str(row)].alignment = c_c_alignment - ws['H' + str(row)] = reporting_period_data['variances'][i] \ - if reporting_period_data['variances'][i] is not None else '' - ws['H' + str(row)].border = f_border - ws['H' + str(row)].number_format = '0.00' + ws['H' + str(row)].font = name_font + ws['H' + str(row)].alignment = c_c_alignment + ws['H' + str(row)] = reporting_period_data['variances'][i] \ + if reporting_period_data['variances'][i] is not None else '' + ws['H' + str(row)].border = f_border + ws['H' + str(row)].number_format = '0.00' - ws['H' + str(row + 1)].font = name_font - ws['H' + str(row + 1)].alignment = c_c_alignment - ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' - ws['H' + str(row + 1)].border = f_border + ws['H' + str(row + 1)].font = name_font + ws['H' + str(row + 1)].alignment = c_c_alignment + ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' + ws['H' + str(row + 1)].border = f_border #################################################################################################################### # Second: 详细数据 diff --git a/myems-api/excelexporters/equipmenttracking.py b/myems-api/excelexporters/equipmenttracking.py index cc2a7808..b4b8a79b 100644 --- a/myems-api/excelexporters/equipmenttracking.py +++ b/myems-api/excelexporters/equipmenttracking.py @@ -1,14 +1,9 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - Reference, -) -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook -from openpyxl.chart.label import DataLabelList ######################################################################################################################## diff --git a/myems-api/excelexporters/meterbatch.py b/myems-api/excelexporters/meterbatch.py index 04c31f7f..b7d4c3b6 100644 --- a/myems-api/excelexporters/meterbatch.py +++ b/myems-api/excelexporters/meterbatch.py @@ -1,7 +1,7 @@ import base64 import uuid import os -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -103,12 +103,6 @@ def generate_excel(report, space_name, reporting_start_datetime_local, reporting wrap_text=True, shrink_to_fit=False, indent=0) - c_r_alignment = Alignment(vertical='bottom', - horizontal='center', - text_rotation=0, - wrap_text=True, - shrink_to_fit=False, - indent=0) # Img img = Image("excelexporters/myems.png") diff --git a/myems-api/excelexporters/metercost.py b/myems-api/excelexporters/metercost.py index ba0892e4..8d2ba216 100644 --- a/myems-api/excelexporters/metercost.py +++ b/myems-api/excelexporters/metercost.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - LineChart, - Reference, - Series -) +from openpyxl.chart import LineChart, Reference, Series from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/meterenergy.py b/myems-api/excelexporters/meterenergy.py index 1f78af32..eca930c9 100644 --- a/myems-api/excelexporters/meterenergy.py +++ b/myems-api/excelexporters/meterenergy.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - LineChart, - Reference, -) -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.chart import LineChart, Reference +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook from openpyxl.chart.label import DataLabelList diff --git a/myems-api/excelexporters/metersubmetersbalance.py b/myems-api/excelexporters/metersubmetersbalance.py index 5074cd49..2a8e0646 100644 --- a/myems-api/excelexporters/metersubmetersbalance.py +++ b/myems-api/excelexporters/metersubmetersbalance.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - LineChart, - Reference, -) -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.chart import LineChart, Reference +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook from openpyxl.chart.label import DataLabelList diff --git a/myems-api/excelexporters/metertracking.py b/myems-api/excelexporters/metertracking.py index d9065dce..346404ca 100644 --- a/myems-api/excelexporters/metertracking.py +++ b/myems-api/excelexporters/metertracking.py @@ -1,14 +1,9 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - Reference, -) -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook -from openpyxl.chart.label import DataLabelList ######################################################################################################################## diff --git a/myems-api/excelexporters/metertrend.py b/myems-api/excelexporters/metertrend.py index 6fe7b004..6429bc84 100644 --- a/myems-api/excelexporters/metertrend.py +++ b/myems-api/excelexporters/metertrend.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/myems.png b/myems-api/excelexporters/myems.png index df17679a..89343f6e 100644 Binary files a/myems-api/excelexporters/myems.png and b/myems-api/excelexporters/myems.png differ diff --git a/myems-api/excelexporters/offlinemetercost.py b/myems-api/excelexporters/offlinemetercost.py index a7753006..e390cf6c 100644 --- a/myems-api/excelexporters/offlinemetercost.py +++ b/myems-api/excelexporters/offlinemetercost.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - LineChart, - Reference, - Series -) +from openpyxl.chart import LineChart, Reference, Series from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/offlinemeterenergy.py b/myems-api/excelexporters/offlinemeterenergy.py index 2cee35b0..6b76a26a 100644 --- a/myems-api/excelexporters/offlinemeterenergy.py +++ b/myems-api/excelexporters/offlinemeterenergy.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - BarChart, - LineChart, - Reference, -) -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.chart import LineChart, Reference +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook from openpyxl.chart.label import DataLabelList diff --git a/myems-api/excelexporters/shopfloorbatch.py b/myems-api/excelexporters/shopfloorbatch.py index 7f7c3ff9..c8c1ec13 100644 --- a/myems-api/excelexporters/shopfloorbatch.py +++ b/myems-api/excelexporters/shopfloorbatch.py @@ -1,7 +1,7 @@ import base64 import uuid import os -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/shopfloorcost.py b/myems-api/excelexporters/shopfloorcost.py index f97b6866..864bd3fc 100644 --- a/myems-api/excelexporters/shopfloorcost.py +++ b/myems-api/excelexporters/shopfloorcost.py @@ -1,11 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -522,7 +518,7 @@ def generate_excel(report, col = 'B' - every_day_total = 0 + periodic_sum = 0.0 for j in range(0, ca_len): col = chr(ord('C') + j) @@ -530,14 +526,14 @@ def generate_excel(report, ws[col + str(current_row_number)].font = title_font ws[col + str(current_row_number)].alignment = c_c_alignment value = round(reporting_period_data['values'][j][i], 2) - every_day_total += value + periodic_sum += value ws[col + str(current_row_number)] = value ws[col + str(current_row_number)].border = f_border end_col = chr(ord(col) + 1) ws[end_col + str(current_row_number)].font = title_font ws[end_col + str(current_row_number)].alignment = c_c_alignment - ws[end_col + str(current_row_number)] = round(every_day_total, 2) + ws[end_col + str(current_row_number)] = round(periodic_sum, 2) ws[end_col + str(current_row_number)].border = f_border current_row_number += 1 diff --git a/myems-api/excelexporters/shopfloorenergycategory.py b/myems-api/excelexporters/shopfloorenergycategory.py index 8ad2428e..71083f4d 100644 --- a/myems-api/excelexporters/shopfloorenergycategory.py +++ b/myems-api/excelexporters/shopfloorenergycategory.py @@ -1,11 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/shopfloorenergyitem.py b/myems-api/excelexporters/shopfloorenergyitem.py index 94a905fd..0474b821 100644 --- a/myems-api/excelexporters/shopfloorenergyitem.py +++ b/myems-api/excelexporters/shopfloorenergyitem.py @@ -1,11 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -116,12 +112,6 @@ def generate_excel(report, wrap_text=True, shrink_to_fit=False, indent=0) - c_r_alignment = Alignment(vertical='bottom', - horizontal='center', - text_rotation=0, - wrap_text=True, - shrink_to_fit=False, - indent=0) # Img img = Image("excelexporters/myems.png") img.width = img.width * 0.85 diff --git a/myems-api/excelexporters/shopfloorload.py b/myems-api/excelexporters/shopfloorload.py index 5ba01f90..5cedfbcf 100644 --- a/myems-api/excelexporters/shopfloorload.py +++ b/myems-api/excelexporters/shopfloorload.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -161,98 +158,92 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '平均负荷' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '平均负荷' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '最大负荷' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '最大负荷' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '负荷系数' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '负荷系数' + ws['E7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ - if reporting_period_data['averages'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ + if reporting_period_data['averages'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ - if reporting_period_data['factors'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ + if reporting_period_data['factors'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border #################################################################################################################### # Second: 报告期单位面积消耗 @@ -261,58 +252,57 @@ def generate_excel(report, # per_unit_area_start_row_number + 2 ~ per_unit_area_start_row_number + 2 + ca_len : table_data #################################################################################################################### - if has_energy_data_flag: - names = reporting_period_data['names'] - ca_len = len(names) - per_unit_area_start_row_number = 9 + ca_len * 2 + names = reporting_period_data['names'] + ca_len = len(names) + per_unit_area_start_row_number = 9 + ca_len * 2 - ws['B' + str(per_unit_area_start_row_number)].font = title_font - ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['shopfloor']['area']) + 'M²' + ws['B' + str(per_unit_area_start_row_number)].font = title_font + ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['shopfloor']['area']) + 'M²' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill - ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' - ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border + # table_title + ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill + ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' + ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['C' + str(per_unit_area_start_row_number + 1)] = '平均负荷' - ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['C' + str(per_unit_area_start_row_number + 1)] = '平均负荷' + ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['D' + str(per_unit_area_start_row_number + 1)] = '最大负荷' - ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['D' + str(per_unit_area_start_row_number + 1)] = '最大负荷' + ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row_data = per_unit_area_start_row_number + 2 + i - ws['B' + str(row_data)].font = name_font - ws['B' + str(row_data)].alignment = c_c_alignment - ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ - i] + "/H/M²)" - ws['B' + str(row_data)].border = f_border + for i, value in enumerate(category): + row_data = per_unit_area_start_row_number + 2 + i + ws['B' + str(row_data)].font = name_font + ws['B' + str(row_data)].alignment = c_c_alignment + ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ + i] + "/H/M²)" + ws['B' + str(row_data)].border = f_border - ws['C' + str(row_data)].font = name_font - ws['C' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['averages_per_unit_area'][i] \ - or reporting_period_data['averages_per_unit_area'][i] == 0: - ws['C' + str(row_data)] = round(reporting_period_data['averages_per_unit_area'][i], 2) - ws['C' + str(row_data)].border = f_border - ws['C' + str(row_data)].number_format = '0.00' + ws['C' + str(row_data)].font = name_font + ws['C' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['averages_per_unit_area'][i] \ + or reporting_period_data['averages_per_unit_area'][i] == 0: + ws['C' + str(row_data)] = round(reporting_period_data['averages_per_unit_area'][i], 2) + ws['C' + str(row_data)].border = f_border + ws['C' + str(row_data)].number_format = '0.00' - ws['D' + str(row_data)].font = name_font - ws['D' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['maximums_per_unit_area'][i] \ - or reporting_period_data['maximums_per_unit_area'][i] == 0: - ws['D' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) - ws['D' + str(row_data)].border = f_border - ws['D' + str(row_data)].number_format = '0.00' + ws['D' + str(row_data)].font = name_font + ws['D' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['maximums_per_unit_area'][i] \ + or reporting_period_data['maximums_per_unit_area'][i] == 0: + ws['D' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) + ws['D' + str(row_data)].border = f_border + ws['D' + str(row_data)].number_format = '0.00' #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/shopfloorsaving.py b/myems-api/excelexporters/shopfloorsaving.py index b83f4811..61025b36 100644 --- a/myems-api/excelexporters/shopfloorsaving.py +++ b/myems-api/excelexporters/shopfloorsaving.py @@ -1,11 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, -) +from decimal import Decimal +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -782,7 +779,7 @@ def generate_excel(report, def sum_list(lists): - total = 0 + total = Decimal(0) for i in range(0, len(lists)): total += lists[i] diff --git a/myems-api/excelexporters/shopfloorstatistics.py b/myems-api/excelexporters/shopfloorstatistics.py index 43e925a9..0f201519 100644 --- a/myems-api/excelexporters/shopfloorstatistics.py +++ b/myems-api/excelexporters/shopfloorstatistics.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -160,152 +157,146 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '算术平均数' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '算术平均数' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '中位数' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '中位数' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '最小值' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '最小值' + ws['E7'].border = f_border - ws['F7'].font = title_font - ws['F7'].alignment = c_c_alignment - ws['F7'] = '最大值' - ws['F7'].border = f_border + ws['F7'].font = title_font + ws['F7'].alignment = c_c_alignment + ws['F7'] = '最大值' + ws['F7'].border = f_border - ws['G7'].font = title_font - ws['G7'].alignment = c_c_alignment - ws['G7'] = '样本标准差' - ws['G7'].border = f_border + ws['G7'].font = title_font + ws['G7'].alignment = c_c_alignment + ws['G7'] = '样本标准差' + ws['G7'].border = f_border - ws['H7'].font = title_font - ws['H7'].alignment = c_c_alignment - ws['H7'] = '样本方差' - ws['H7'].border = f_border + ws['H7'].font = title_font + ws['H7'].alignment = c_c_alignment + ws['H7'] = '样本方差' + ws['H7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i*2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i*2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ - if reporting_period_data['means'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ + if reporting_period_data['means'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ - if reporting_period_data['medians'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ + if reporting_period_data['medians'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ - if reporting_period_data['minimums'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ + if reporting_period_data['minimums'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border - ws['F' + str(row)].font = name_font - ws['F' + str(row)].alignment = c_c_alignment - ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['F' + str(row)].border = f_border - ws['F' + str(row)].number_format = '0.00' + ws['F' + str(row)].font = name_font + ws['F' + str(row)].alignment = c_c_alignment + ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['F' + str(row)].border = f_border + ws['F' + str(row)].number_format = '0.00' - ws['F' + str(row + 1)].font = name_font - ws['F' + str(row + 1)].alignment = c_c_alignment - ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['F' + str(row + 1)].border = f_border + ws['F' + str(row + 1)].font = name_font + ws['F' + str(row + 1)].alignment = c_c_alignment + ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['F' + str(row + 1)].border = f_border - ws['G' + str(row)].font = name_font - ws['G' + str(row)].alignment = c_c_alignment - ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ - if reporting_period_data['stdevs'][i] is not None else '' - ws['G' + str(row)].border = f_border - ws['G' + str(row)].number_format = '0.00' + ws['G' + str(row)].font = name_font + ws['G' + str(row)].alignment = c_c_alignment + ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ + if reporting_period_data['stdevs'][i] is not None else '' + ws['G' + str(row)].border = f_border + ws['G' + str(row)].number_format = '0.00' - ws['G' + str(row + 1)].font = name_font - ws['G' + str(row + 1)].alignment = c_c_alignment - ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' - ws['G' + str(row + 1)].border = f_border + ws['G' + str(row + 1)].font = name_font + ws['G' + str(row + 1)].alignment = c_c_alignment + ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' + ws['G' + str(row + 1)].border = f_border - ws['H' + str(row)].font = name_font - ws['H' + str(row)].alignment = c_c_alignment - ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ - if reporting_period_data['variances'][i] is not None else '' - ws['H' + str(row)].border = f_border - ws['H' + str(row)].number_format = '0.00' + ws['H' + str(row)].font = name_font + ws['H' + str(row)].alignment = c_c_alignment + ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ + if reporting_period_data['variances'][i] is not None else '' + ws['H' + str(row)].border = f_border + ws['H' + str(row)].number_format = '0.00' - ws['H' + str(row + 1)].font = name_font - ws['H' + str(row + 1)].alignment = c_c_alignment - ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' - ws['H' + str(row + 1)].border = f_border + ws['H' + str(row + 1)].font = name_font + ws['H' + str(row + 1)].alignment = c_c_alignment + ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' + ws['H' + str(row + 1)].border = f_border #################################################################################################################### # Second: 报告期消耗 # 9 + ca_len * 2: title @@ -313,111 +304,110 @@ def generate_excel(report, # per_unit_area_start_row_number + 2 ~ per_unit_area_start_row_number + 2 + ca_len : table_data #################################################################################################################### - if has_energy_data_flag: - names = reporting_period_data['names'] - ca_len = len(names) + names = reporting_period_data['names'] + ca_len = len(names) - per_unit_area_start_row_number = 9 + ca_len * 2 + per_unit_area_start_row_number = 9 + ca_len * 2 - ws['B' + str(per_unit_area_start_row_number)].font = title_font - ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['shopfloor']['area']) + 'M²' + ws['B' + str(per_unit_area_start_row_number)].font = title_font + ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['shopfloor']['area']) + 'M²' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill - ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' - ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border + # table_title + ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill + ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' + ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' - ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' + ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' - ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' + ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' - ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' + ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' - ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' + ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' - ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' + ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' - ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' + ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row_data = per_unit_area_start_row_number + 2 + i - ws['B' + str(row_data)].font = name_font - ws['B' + str(row_data)].alignment = c_c_alignment - ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ - i] + "/M²)" - ws['B' + str(row_data)].border = f_border + for i, value in enumerate(category): + row_data = per_unit_area_start_row_number + 2 + i + ws['B' + str(row_data)].font = name_font + ws['B' + str(row_data)].alignment = c_c_alignment + ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ + i] + "/M²)" + ws['B' + str(row_data)].border = f_border - ws['C' + str(row_data)].font = name_font - ws['C' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['means_per_unit_area'][i] \ - or reporting_period_data['means_per_unit_area'][i] == 0: - ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) - ws['C' + str(row_data)].border = f_border - ws['C' + str(row_data)].number_format = '0.00' + ws['C' + str(row_data)].font = name_font + ws['C' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['means_per_unit_area'][i] \ + or reporting_period_data['means_per_unit_area'][i] == 0: + ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) + ws['C' + str(row_data)].border = f_border + ws['C' + str(row_data)].number_format = '0.00' - ws['D' + str(row_data)].font = name_font - ws['D' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['medians_per_unit_area'][i] \ - or reporting_period_data['medians_per_unit_area'][i] == 0: - ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) - ws['D' + str(row_data)].border = f_border - ws['D' + str(row_data)].number_format = '0.00' + ws['D' + str(row_data)].font = name_font + ws['D' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['medians_per_unit_area'][i] \ + or reporting_period_data['medians_per_unit_area'][i] == 0: + ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) + ws['D' + str(row_data)].border = f_border + ws['D' + str(row_data)].number_format = '0.00' - ws['E' + str(row_data)].font = name_font - ws['E' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['minimums_per_unit_area'][i] \ - or reporting_period_data['minimums_per_unit_area'][i] == 0: - ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) - ws['E' + str(row_data)].border = f_border - ws['E' + str(row_data)].number_format = '0.00' + ws['E' + str(row_data)].font = name_font + ws['E' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['minimums_per_unit_area'][i] \ + or reporting_period_data['minimums_per_unit_area'][i] == 0: + ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) + ws['E' + str(row_data)].border = f_border + ws['E' + str(row_data)].number_format = '0.00' - ws['F' + str(row_data)].font = name_font - ws['F' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['maximums_per_unit_area'][i] \ - or reporting_period_data['maximums_per_unit_area'][i] == 0: - ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) - ws['F' + str(row_data)].border = f_border - ws['F' + str(row_data)].number_format = '0.00' + ws['F' + str(row_data)].font = name_font + ws['F' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['maximums_per_unit_area'][i] \ + or reporting_period_data['maximums_per_unit_area'][i] == 0: + ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) + ws['F' + str(row_data)].border = f_border + ws['F' + str(row_data)].number_format = '0.00' - ws['G' + str(row_data)].font = name_font - ws['G' + str(row_data)].alignment = c_c_alignment - if (reporting_period_data['stdevs_per_unit_area'][i]) \ - or reporting_period_data['stdevs_per_unit_area'][i] == 0: - ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) - ws['G' + str(row_data)].border = f_border - ws['G' + str(row_data)].number_format = '0.00' + ws['G' + str(row_data)].font = name_font + ws['G' + str(row_data)].alignment = c_c_alignment + if (reporting_period_data['stdevs_per_unit_area'][i]) \ + or reporting_period_data['stdevs_per_unit_area'][i] == 0: + ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) + ws['G' + str(row_data)].border = f_border + ws['G' + str(row_data)].number_format = '0.00' - ws['H' + str(row_data)].font = name_font - ws['H' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['variances_per_unit_area'][i] \ - or reporting_period_data['variances_per_unit_area'][i] == 0: - ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) - ws['H' + str(row_data)].border = f_border - ws['H' + str(row_data)].number_format = '0.00' + ws['H' + str(row_data)].font = name_font + ws['H' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['variances_per_unit_area'][i] \ + or reporting_period_data['variances_per_unit_area'][i] == 0: + ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) + ws['H' + str(row_data)].border = f_border + ws['H' + str(row_data)].number_format = '0.00' #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/spacecost.py b/myems-api/excelexporters/spacecost.py index ccbf31e5..4f9cc231 100644 --- a/myems-api/excelexporters/spacecost.py +++ b/myems-api/excelexporters/spacecost.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from decimal import Decimal +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -520,9 +516,9 @@ def generate_excel(report, row = str(table_row + 1 + j) ws[col + row].font = title_font ws[col + row].alignment = c_c_alignment - every_day_sum = reporting_period_values_every_day_sum(reporting_period_data, j, ca_len) - total_sum += every_day_sum - ws[col + row] = round(every_day_sum, 2) + periodic_sum = reporting_period_values_periodic_sum(reporting_period_data, j, ca_len) + total_sum += periodic_sum + ws[col + row] = round(periodic_sum, 2) ws[col + row].border = f_border row = str(table_row + 1 + len(time)) @@ -591,20 +587,20 @@ def generate_excel(report, ws['B' + row].border = f_border col = '' - every_day_sum = 0 + periodic_sum = 0 for j in range(0, ca_len): col = chr(ord('C') + j) ws[col + row].font = name_font ws[col + row].alignment = c_c_alignment - every_day_sum += child['subtotals_array'][j][i] + periodic_sum += child['subtotals_array'][j][i] ws[col + row] = round(child['subtotals_array'][j][i], 2) ws[col + row].border = f_border col = chr(ord(col) + 1) ws[col + row].font = name_font ws[col + row].alignment = c_c_alignment - ws[col + row] = round(every_day_sum, 2) + ws[col + row] = round(periodic_sum, 2) ws[col + row].border = f_border table_end_row_number = current_row_number @@ -831,12 +827,12 @@ def generate_excel(report, return filename -def reporting_period_values_every_day_sum(reporting_period_data, every_day_index, ca_len): - every_day_sum = 0 +def reporting_period_values_periodic_sum(reporting_period_data, periodic_index, ca_len): + periodic_sum = Decimal(0.0) for i in range(0, ca_len): - every_day_sum += reporting_period_data['values'][i][every_day_index] + periodic_sum += reporting_period_data['values'][i][periodic_index] - return every_day_sum + return periodic_sum def timestamps_data_all_equal_0(lists): diff --git a/myems-api/excelexporters/spaceefficiency.py b/myems-api/excelexporters/spaceefficiency.py index 4f860aab..f7eb898f 100644 --- a/myems-api/excelexporters/spaceefficiency.py +++ b/myems-api/excelexporters/spaceefficiency.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/spaceenergycategory.py b/myems-api/excelexporters/spaceenergycategory.py index 95ce2b2e..1a1b1750 100644 --- a/myems-api/excelexporters/spaceenergycategory.py +++ b/myems-api/excelexporters/spaceenergycategory.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -119,12 +114,6 @@ def generate_excel(report, wrap_text=True, shrink_to_fit=False, indent=0) - c_r_alignment = Alignment(vertical='bottom', - horizontal='center', - text_rotation=0, - wrap_text=True, - shrink_to_fit=False, - indent=0) # Img img = Image("excelexporters/myems.png") diff --git a/myems-api/excelexporters/spaceenergyitem.py b/myems-api/excelexporters/spaceenergyitem.py index 927eb683..95312e78 100644 --- a/myems-api/excelexporters/spaceenergyitem.py +++ b/myems-api/excelexporters/spaceenergyitem.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/spaceincome.py b/myems-api/excelexporters/spaceincome.py index b2d280bd..13416705 100644 --- a/myems-api/excelexporters/spaceincome.py +++ b/myems-api/excelexporters/spaceincome.py @@ -2,12 +2,7 @@ import base64 import uuid import os from decimal import Decimal -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -449,9 +444,9 @@ def generate_excel(report, row = str(table_row + 1 + j) ws[col + row].font = title_font ws[col + row].alignment = c_c_alignment - every_day_sum = reporting_period_values_every_day_sum(reporting_period_data, j, ca_len) - total_sum += every_day_sum - ws[col + row] = round(every_day_sum, 2) + periodic_sum = reporting_period_values_periodic_sum(reporting_period_data, j, ca_len) + total_sum += periodic_sum + ws[col + row] = round(periodic_sum, 2) ws[col + row].border = f_border row = str(table_row + 1 + len(time)) @@ -520,20 +515,20 @@ def generate_excel(report, ws['B' + row].border = f_border col = '' - every_day_sum = Decimal(0.0) + periodic_sum = Decimal(0.0) for j in range(0, ca_len): col = chr(ord('C') + j) ws[col + row].font = name_font ws[col + row].alignment = c_c_alignment - every_day_sum += child['subtotals_array'][j][i] + periodic_sum += child['subtotals_array'][j][i] ws[col + row] = round(child['subtotals_array'][j][i], 2) ws[col + row].border = f_border col = chr(ord(col) + 1) ws[col + row].font = name_font ws[col + row].alignment = c_c_alignment - ws[col + row] = round(every_day_sum, 2) + ws[col + row] = round(periodic_sum, 2) ws[col + row].border = f_border table_end_row_number = current_row_number @@ -763,12 +758,12 @@ def generate_excel(report, return filename -def reporting_period_values_every_day_sum(reporting_period_data, every_day_index, ca_len): - every_day_sum = Decimal(0.0) +def reporting_period_values_periodic_sum(reporting_period_data, periodic_index, ca_len): + periodic_sum = Decimal(0.0) for i in range(0, ca_len): - every_day_sum += reporting_period_data['values'][i][every_day_index] + periodic_sum += reporting_period_data['values'][i][periodic_index] - return every_day_sum + return periodic_sum def timestamps_data_all_equal_0(lists): diff --git a/myems-api/excelexporters/spaceload.py b/myems-api/excelexporters/spaceload.py index a1cce7f3..9e2a167c 100644 --- a/myems-api/excelexporters/spaceload.py +++ b/myems-api/excelexporters/spaceload.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/spaceoutput.py b/myems-api/excelexporters/spaceoutput.py index 4df47bc5..aaf0ba47 100644 --- a/myems-api/excelexporters/spaceoutput.py +++ b/myems-api/excelexporters/spaceoutput.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/spacesaving.py b/myems-api/excelexporters/spacesaving.py index d8ecd53c..812ba358 100644 --- a/myems-api/excelexporters/spacesaving.py +++ b/myems-api/excelexporters/spacesaving.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from decimal import Decimal +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -868,7 +864,7 @@ def generate_excel(report, def sum_list(lists): - total = 0 + total = Decimal(0) for i in range(0, len(lists)): total += lists[i] diff --git a/myems-api/excelexporters/spacestatistics.py b/myems-api/excelexporters/spacestatistics.py index b88b2637..c9f56d0e 100644 --- a/myems-api/excelexporters/spacestatistics.py +++ b/myems-api/excelexporters/spacestatistics.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -160,152 +157,146 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '算术平均数' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '算术平均数' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '中位数' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '中位数' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '最小值' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '最小值' + ws['E7'].border = f_border - ws['F7'].font = title_font - ws['F7'].alignment = c_c_alignment - ws['F7'] = '最大值' - ws['F7'].border = f_border + ws['F7'].font = title_font + ws['F7'].alignment = c_c_alignment + ws['F7'] = '最大值' + ws['F7'].border = f_border - ws['G7'].font = title_font - ws['G7'].alignment = c_c_alignment - ws['G7'] = '样本标准差' - ws['G7'].border = f_border + ws['G7'].font = title_font + ws['G7'].alignment = c_c_alignment + ws['G7'] = '样本标准差' + ws['G7'].border = f_border - ws['H7'].font = title_font - ws['H7'].alignment = c_c_alignment - ws['H7'] = '样本方差' - ws['H7'].border = f_border + ws['H7'].font = title_font + ws['H7'].alignment = c_c_alignment + ws['H7'] = '样本方差' + ws['H7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i*2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i*2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ - if reporting_period_data['means'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ + if reporting_period_data['means'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ - if reporting_period_data['medians'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ + if reporting_period_data['medians'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ - if reporting_period_data['minimums'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ + if reporting_period_data['minimums'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border - ws['F' + str(row)].font = name_font - ws['F' + str(row)].alignment = c_c_alignment - ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['F' + str(row)].border = f_border - ws['F' + str(row)].number_format = '0.00' + ws['F' + str(row)].font = name_font + ws['F' + str(row)].alignment = c_c_alignment + ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['F' + str(row)].border = f_border + ws['F' + str(row)].number_format = '0.00' - ws['F' + str(row + 1)].font = name_font - ws['F' + str(row + 1)].alignment = c_c_alignment - ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['F' + str(row + 1)].border = f_border + ws['F' + str(row + 1)].font = name_font + ws['F' + str(row + 1)].alignment = c_c_alignment + ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['F' + str(row + 1)].border = f_border - ws['G' + str(row)].font = name_font - ws['G' + str(row)].alignment = c_c_alignment - ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ - if reporting_period_data['stdevs'][i] is not None else '' - ws['G' + str(row)].border = f_border - ws['G' + str(row)].number_format = '0.00' + ws['G' + str(row)].font = name_font + ws['G' + str(row)].alignment = c_c_alignment + ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ + if reporting_period_data['stdevs'][i] is not None else '' + ws['G' + str(row)].border = f_border + ws['G' + str(row)].number_format = '0.00' - ws['G' + str(row + 1)].font = name_font - ws['G' + str(row + 1)].alignment = c_c_alignment - ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' - ws['G' + str(row + 1)].border = f_border + ws['G' + str(row + 1)].font = name_font + ws['G' + str(row + 1)].alignment = c_c_alignment + ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' + ws['G' + str(row + 1)].border = f_border - ws['H' + str(row)].font = name_font - ws['H' + str(row)].alignment = c_c_alignment - ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ - if reporting_period_data['variances'][i] is not None else '' - ws['H' + str(row)].border = f_border - ws['H' + str(row)].number_format = '0.00' + ws['H' + str(row)].font = name_font + ws['H' + str(row)].alignment = c_c_alignment + ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ + if reporting_period_data['variances'][i] is not None else '' + ws['H' + str(row)].border = f_border + ws['H' + str(row)].number_format = '0.00' - ws['H' + str(row + 1)].font = name_font - ws['H' + str(row + 1)].alignment = c_c_alignment - ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' - ws['H' + str(row + 1)].border = f_border + ws['H' + str(row + 1)].font = name_font + ws['H' + str(row + 1)].alignment = c_c_alignment + ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' + ws['H' + str(row + 1)].border = f_border #################################################################################################################### # Second: 报告期消耗 # 9 + ca_len * 2: title @@ -313,113 +304,112 @@ def generate_excel(report, # per_unit_area_start_row_number + 2 ~ per_unit_area_start_row_number + 2 + ca_len : table_data #################################################################################################################### - if has_energy_data_flag: - names = reporting_period_data['names'] - ca_len = len(names) + names = reporting_period_data['names'] + ca_len = len(names) - per_unit_area_start_row_number = 9 + ca_len * 2 + per_unit_area_start_row_number = 9 + ca_len * 2 - ws['B' + str(per_unit_area_start_row_number)].font = title_font - ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' - ws['D' + str(per_unit_area_start_row_number)].font = title_font - ws['D' + str(per_unit_area_start_row_number)] = str(report['space']['area']) + 'M²' + ws['B' + str(per_unit_area_start_row_number)].font = title_font + ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + ws['D' + str(per_unit_area_start_row_number)].font = title_font + ws['D' + str(per_unit_area_start_row_number)] = str(report['space']['area']) + 'M²' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill - ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' - ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border + # table_title + ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill + ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' + ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' - ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' + ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' - ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' + ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' - ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' + ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' - ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' + ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' - ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' + ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' - ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' + ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row_data = per_unit_area_start_row_number + 2 + i - ws['B' + str(row_data)].font = name_font - ws['B' + str(row_data)].alignment = c_c_alignment - ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ - i] + "/M²)" - ws['B' + str(row_data)].border = f_border + for i, value in enumerate(category): + row_data = per_unit_area_start_row_number + 2 + i + ws['B' + str(row_data)].font = name_font + ws['B' + str(row_data)].alignment = c_c_alignment + ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ + i] + "/M²)" + ws['B' + str(row_data)].border = f_border - ws['C' + str(row_data)].font = name_font - ws['C' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['means_per_unit_area'][i] \ - or reporting_period_data['means_per_unit_area'][i] == 0: - ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) - ws['C' + str(row_data)].border = f_border - ws['C' + str(row_data)].number_format = '0.00' + ws['C' + str(row_data)].font = name_font + ws['C' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['means_per_unit_area'][i] \ + or reporting_period_data['means_per_unit_area'][i] == 0: + ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) + ws['C' + str(row_data)].border = f_border + ws['C' + str(row_data)].number_format = '0.00' - ws['D' + str(row_data)].font = name_font - ws['D' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['medians_per_unit_area'][i] \ - or reporting_period_data['medians_per_unit_area'][i] == 0: - ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) - ws['D' + str(row_data)].border = f_border - ws['D' + str(row_data)].number_format = '0.00' + ws['D' + str(row_data)].font = name_font + ws['D' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['medians_per_unit_area'][i] \ + or reporting_period_data['medians_per_unit_area'][i] == 0: + ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) + ws['D' + str(row_data)].border = f_border + ws['D' + str(row_data)].number_format = '0.00' - ws['E' + str(row_data)].font = name_font - ws['E' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['minimums_per_unit_area'][i] \ - or reporting_period_data['minimums_per_unit_area'][i] == 0: - ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) - ws['E' + str(row_data)].border = f_border - ws['E' + str(row_data)].number_format = '0.00' + ws['E' + str(row_data)].font = name_font + ws['E' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['minimums_per_unit_area'][i] \ + or reporting_period_data['minimums_per_unit_area'][i] == 0: + ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) + ws['E' + str(row_data)].border = f_border + ws['E' + str(row_data)].number_format = '0.00' - ws['F' + str(row_data)].font = name_font - ws['F' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['maximums_per_unit_area'][i] \ - or reporting_period_data['maximums_per_unit_area'][i] == 0: - ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) - ws['F' + str(row_data)].border = f_border - ws['F' + str(row_data)].number_format = '0.00' + ws['F' + str(row_data)].font = name_font + ws['F' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['maximums_per_unit_area'][i] \ + or reporting_period_data['maximums_per_unit_area'][i] == 0: + ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) + ws['F' + str(row_data)].border = f_border + ws['F' + str(row_data)].number_format = '0.00' - ws['G' + str(row_data)].font = name_font - ws['G' + str(row_data)].alignment = c_c_alignment - if (reporting_period_data['stdevs_per_unit_area'][i]) \ - or reporting_period_data['stdevs_per_unit_area'][i] == 0: - ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) - ws['G' + str(row_data)].border = f_border - ws['G' + str(row_data)].number_format = '0.00' + ws['G' + str(row_data)].font = name_font + ws['G' + str(row_data)].alignment = c_c_alignment + if (reporting_period_data['stdevs_per_unit_area'][i]) \ + or reporting_period_data['stdevs_per_unit_area'][i] == 0: + ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) + ws['G' + str(row_data)].border = f_border + ws['G' + str(row_data)].number_format = '0.00' - ws['H' + str(row_data)].font = name_font - ws['H' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['variances_per_unit_area'][i] \ - or reporting_period_data['variances_per_unit_area'][i] == 0: - ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) - ws['H' + str(row_data)].border = f_border - ws['H' + str(row_data)].number_format = '0.00' + ws['H' + str(row_data)].font = name_font + ws['H' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['variances_per_unit_area'][i] \ + or reporting_period_data['variances_per_unit_area'][i] == 0: + ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) + ws['H' + str(row_data)].border = f_border + ws['H' + str(row_data)].number_format = '0.00' #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/storebatch.py b/myems-api/excelexporters/storebatch.py index b3c2e6a1..cce3aa6b 100644 --- a/myems-api/excelexporters/storebatch.py +++ b/myems-api/excelexporters/storebatch.py @@ -1,7 +1,7 @@ import base64 import uuid import os -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/storecost.py b/myems-api/excelexporters/storecost.py index 8948f31a..947081ac 100644 --- a/myems-api/excelexporters/storecost.py +++ b/myems-api/excelexporters/storecost.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - BarChart, - Reference, - LineChart, - ) +from openpyxl.chart import PieChart, Reference, LineChart from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -153,7 +148,6 @@ def generate_excel(report, "names" not in report['reporting_period'].keys() or len(report['reporting_period']['names']) == 0: filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename #################################################################################################################### @@ -467,7 +461,7 @@ def generate_excel(report, col = 'B' - every_day_total = 0 + periodic_sum = 0.0 for j in range(0, ca_len): col = chr(ord('C') + j) @@ -475,14 +469,14 @@ def generate_excel(report, ws[col + str(current_row_number)].font = title_font ws[col + str(current_row_number)].alignment = c_c_alignment value = round(reporting_period_data['values'][j][i], 2) - every_day_total += value + periodic_sum += value ws[col + str(current_row_number)] = value ws[col + str(current_row_number)].border = f_border end_col = chr(ord(col) + 1) ws[end_col + str(current_row_number)].font = title_font ws[end_col + str(current_row_number)].alignment = c_c_alignment - ws[end_col + str(current_row_number)] = round(every_day_total, 2) + ws[end_col + str(current_row_number)] = round(periodic_sum, 2) ws[end_col + str(current_row_number)].border = f_border current_row_number += 1 diff --git a/myems-api/excelexporters/storeenergycategory.py b/myems-api/excelexporters/storeenergycategory.py index e35fb6e5..2a7021de 100644 --- a/myems-api/excelexporters/storeenergycategory.py +++ b/myems-api/excelexporters/storeenergycategory.py @@ -1,11 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/storeenergyitem.py b/myems-api/excelexporters/storeenergyitem.py index 0ac20a0c..aab8d393 100644 --- a/myems-api/excelexporters/storeenergyitem.py +++ b/myems-api/excelexporters/storeenergyitem.py @@ -1,11 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/storeload.py b/myems-api/excelexporters/storeload.py index 5de1bb93..2afd9e8f 100644 --- a/myems-api/excelexporters/storeload.py +++ b/myems-api/excelexporters/storeload.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -161,98 +158,92 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '平均负荷' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '平均负荷' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '最大负荷' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '最大负荷' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '负荷系数' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '负荷系数' + ws['E7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ - if reporting_period_data['averages'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \ + if reporting_period_data['averages'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ - if reporting_period_data['factors'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \ + if reporting_period_data['factors'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border #################################################################################################################### # Second: 报告期单位面积消耗 @@ -261,58 +252,57 @@ def generate_excel(report, # per_unit_area_start_row_number + 2 ~ per_unit_area_start_row_number + 2 + ca_len : table_data #################################################################################################################### - if has_energy_data_flag: - names = reporting_period_data['names'] - ca_len = len(names) - per_unit_area_start_row_number = 9 + ca_len * 2 + names = reporting_period_data['names'] + ca_len = len(names) + per_unit_area_start_row_number = 9 + ca_len * 2 - ws['B' + str(per_unit_area_start_row_number)].font = title_font - ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['store']['area']) + 'M²' + ws['B' + str(per_unit_area_start_row_number)].font = title_font + ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['store']['area']) + 'M²' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill - ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' - ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border + # table_title + ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill + ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' + ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['C' + str(per_unit_area_start_row_number + 1)] = '平均负荷' - ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['C' + str(per_unit_area_start_row_number + 1)] = '平均负荷' + ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['D' + str(per_unit_area_start_row_number + 1)] = '最大负荷' - ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['D' + str(per_unit_area_start_row_number + 1)] = '最大负荷' + ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row_data = per_unit_area_start_row_number + 2 + i - ws['B' + str(row_data)].font = name_font - ws['B' + str(row_data)].alignment = c_c_alignment - ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ - i] + "/H/M²)" - ws['B' + str(row_data)].border = f_border + for i, value in enumerate(category): + row_data = per_unit_area_start_row_number + 2 + i + ws['B' + str(row_data)].font = name_font + ws['B' + str(row_data)].alignment = c_c_alignment + ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ + i] + "/H/M²)" + ws['B' + str(row_data)].border = f_border - ws['C' + str(row_data)].font = name_font - ws['C' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['averages_per_unit_area'][i] \ - or reporting_period_data['averages_per_unit_area'][i] == 0: - ws['C' + str(row_data)] = round(reporting_period_data['averages_per_unit_area'][i], 2) - ws['C' + str(row_data)].border = f_border - ws['C' + str(row_data)].number_format = '0.00' + ws['C' + str(row_data)].font = name_font + ws['C' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['averages_per_unit_area'][i] \ + or reporting_period_data['averages_per_unit_area'][i] == 0: + ws['C' + str(row_data)] = round(reporting_period_data['averages_per_unit_area'][i], 2) + ws['C' + str(row_data)].border = f_border + ws['C' + str(row_data)].number_format = '0.00' - ws['D' + str(row_data)].font = name_font - ws['D' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['maximums_per_unit_area'][i] \ - or reporting_period_data['maximums_per_unit_area'][i] == 0: - ws['D' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) - ws['D' + str(row_data)].border = f_border - ws['D' + str(row_data)].number_format = '0.00' + ws['D' + str(row_data)].font = name_font + ws['D' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['maximums_per_unit_area'][i] \ + or reporting_period_data['maximums_per_unit_area'][i] == 0: + ws['D' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) + ws['D' + str(row_data)].border = f_border + ws['D' + str(row_data)].number_format = '0.00' #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/storesaving.py b/myems-api/excelexporters/storesaving.py index 5bd56efb..b88eb0b9 100644 --- a/myems-api/excelexporters/storesaving.py +++ b/myems-api/excelexporters/storesaving.py @@ -1,11 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - Reference, -) +from decimal import Decimal +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -781,11 +778,9 @@ def generate_excel(report, def sum_list(lists): - total = 0 - + total = Decimal(0) for i in range(0, len(lists)): total += lists[i] - return total diff --git a/myems-api/excelexporters/storestatistics.py b/myems-api/excelexporters/storestatistics.py index 76cc1bb9..625a00bf 100644 --- a/myems-api/excelexporters/storestatistics.py +++ b/myems-api/excelexporters/storestatistics.py @@ -1,12 +1,8 @@ import base64 import os import uuid - from openpyxl import Workbook -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.drawing.image import Image from openpyxl.styles import PatternFill, Border, Side, Alignment, Font @@ -160,152 +156,146 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '算术平均数' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '算术平均数' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '中位数' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '中位数' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '最小值' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '最小值' + ws['E7'].border = f_border - ws['F7'].font = title_font - ws['F7'].alignment = c_c_alignment - ws['F7'] = '最大值' - ws['F7'].border = f_border + ws['F7'].font = title_font + ws['F7'].alignment = c_c_alignment + ws['F7'] = '最大值' + ws['F7'].border = f_border - ws['G7'].font = title_font - ws['G7'].alignment = c_c_alignment - ws['G7'] = '样本标准差' - ws['G7'].border = f_border + ws['G7'].font = title_font + ws['G7'].alignment = c_c_alignment + ws['G7'] = '样本标准差' + ws['G7'].border = f_border - ws['H7'].font = title_font - ws['H7'].alignment = c_c_alignment - ws['H7'] = '样本方差' - ws['H7'].border = f_border + ws['H7'].font = title_font + ws['H7'].alignment = c_c_alignment + ws['H7'] = '样本方差' + ws['H7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i * 2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i * 2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ - if reporting_period_data['means'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ + if reporting_period_data['means'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ - if reporting_period_data['medians'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ + if reporting_period_data['medians'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ - if reporting_period_data['minimums'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ + if reporting_period_data['minimums'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border - ws['F' + str(row)].font = name_font - ws['F' + str(row)].alignment = c_c_alignment - ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['F' + str(row)].border = f_border - ws['F' + str(row)].number_format = '0.00' + ws['F' + str(row)].font = name_font + ws['F' + str(row)].alignment = c_c_alignment + ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['F' + str(row)].border = f_border + ws['F' + str(row)].number_format = '0.00' - ws['F' + str(row + 1)].font = name_font - ws['F' + str(row + 1)].alignment = c_c_alignment - ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['F' + str(row + 1)].border = f_border + ws['F' + str(row + 1)].font = name_font + ws['F' + str(row + 1)].alignment = c_c_alignment + ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['F' + str(row + 1)].border = f_border - ws['G' + str(row)].font = name_font - ws['G' + str(row)].alignment = c_c_alignment - ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ - if reporting_period_data['stdevs'][i] is not None else '' - ws['G' + str(row)].border = f_border - ws['G' + str(row)].number_format = '0.00' + ws['G' + str(row)].font = name_font + ws['G' + str(row)].alignment = c_c_alignment + ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ + if reporting_period_data['stdevs'][i] is not None else '' + ws['G' + str(row)].border = f_border + ws['G' + str(row)].number_format = '0.00' - ws['G' + str(row + 1)].font = name_font - ws['G' + str(row + 1)].alignment = c_c_alignment - ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' - ws['G' + str(row + 1)].border = f_border + ws['G' + str(row + 1)].font = name_font + ws['G' + str(row + 1)].alignment = c_c_alignment + ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' + ws['G' + str(row + 1)].border = f_border - ws['H' + str(row)].font = name_font - ws['H' + str(row)].alignment = c_c_alignment - ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ - if reporting_period_data['variances'][i] is not None else '' - ws['H' + str(row)].border = f_border - ws['H' + str(row)].number_format = '0.00' + ws['H' + str(row)].font = name_font + ws['H' + str(row)].alignment = c_c_alignment + ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ + if reporting_period_data['variances'][i] is not None else '' + ws['H' + str(row)].border = f_border + ws['H' + str(row)].number_format = '0.00' - ws['H' + str(row + 1)].font = name_font - ws['H' + str(row + 1)].alignment = c_c_alignment - ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' - ws['H' + str(row + 1)].border = f_border + ws['H' + str(row + 1)].font = name_font + ws['H' + str(row + 1)].alignment = c_c_alignment + ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' + ws['H' + str(row + 1)].border = f_border #################################################################################################################### # Second: 报告期消耗 # 9 + ca_len * 2: title @@ -313,111 +303,110 @@ def generate_excel(report, # per_unit_area_start_row_number + 2 ~ per_unit_area_start_row_number + 2 + ca_len : table_data #################################################################################################################### - if has_energy_data_flag: - names = reporting_period_data['names'] - ca_len = len(names) + names = reporting_period_data['names'] + ca_len = len(names) - per_unit_area_start_row_number = 9 + ca_len * 2 + per_unit_area_start_row_number = 9 + ca_len * 2 - ws['B' + str(per_unit_area_start_row_number)].font = title_font - ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['store']['area']) + 'M²' + ws['B' + str(per_unit_area_start_row_number)].font = title_font + ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['store']['area']) + 'M²' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill - ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' - ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border + # table_title + ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill + ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' + ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' - ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' + ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' - ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' + ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' - ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' + ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' - ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' + ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' - ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' + ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' - ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' + ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row_data = per_unit_area_start_row_number + 2 + i - ws['B' + str(row_data)].font = name_font - ws['B' + str(row_data)].alignment = c_c_alignment - ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ - i] + "/M²)" - ws['B' + str(row_data)].border = f_border + for i, value in enumerate(category): + row_data = per_unit_area_start_row_number + 2 + i + ws['B' + str(row_data)].font = name_font + ws['B' + str(row_data)].alignment = c_c_alignment + ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ + i] + "/M²)" + ws['B' + str(row_data)].border = f_border - ws['C' + str(row_data)].font = name_font - ws['C' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['means_per_unit_area'][i] \ - or reporting_period_data['means_per_unit_area'][i] == 0: - ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) - ws['C' + str(row_data)].border = f_border - ws['C' + str(row_data)].number_format = '0.00' + ws['C' + str(row_data)].font = name_font + ws['C' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['means_per_unit_area'][i] \ + or reporting_period_data['means_per_unit_area'][i] == 0: + ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) + ws['C' + str(row_data)].border = f_border + ws['C' + str(row_data)].number_format = '0.00' - ws['D' + str(row_data)].font = name_font - ws['D' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['medians_per_unit_area'][i] \ - or reporting_period_data['medians_per_unit_area'][i] == 0: - ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) - ws['D' + str(row_data)].border = f_border - ws['D' + str(row_data)].number_format = '0.00' + ws['D' + str(row_data)].font = name_font + ws['D' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['medians_per_unit_area'][i] \ + or reporting_period_data['medians_per_unit_area'][i] == 0: + ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) + ws['D' + str(row_data)].border = f_border + ws['D' + str(row_data)].number_format = '0.00' - ws['E' + str(row_data)].font = name_font - ws['E' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['minimums_per_unit_area'][i] \ - or reporting_period_data['minimums_per_unit_area'][i] == 0: - ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) - ws['E' + str(row_data)].border = f_border - ws['E' + str(row_data)].number_format = '0.00' + ws['E' + str(row_data)].font = name_font + ws['E' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['minimums_per_unit_area'][i] \ + or reporting_period_data['minimums_per_unit_area'][i] == 0: + ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) + ws['E' + str(row_data)].border = f_border + ws['E' + str(row_data)].number_format = '0.00' - ws['F' + str(row_data)].font = name_font - ws['F' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['maximums_per_unit_area'][i] \ - or reporting_period_data['maximums_per_unit_area'][i] == 0: - ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) - ws['F' + str(row_data)].border = f_border - ws['F' + str(row_data)].number_format = '0.00' + ws['F' + str(row_data)].font = name_font + ws['F' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['maximums_per_unit_area'][i] \ + or reporting_period_data['maximums_per_unit_area'][i] == 0: + ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) + ws['F' + str(row_data)].border = f_border + ws['F' + str(row_data)].number_format = '0.00' - ws['G' + str(row_data)].font = name_font - ws['G' + str(row_data)].alignment = c_c_alignment - if (reporting_period_data['stdevs_per_unit_area'][i]) \ - or reporting_period_data['stdevs_per_unit_area'][i] == 0: - ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) - ws['G' + str(row_data)].border = f_border - ws['G' + str(row_data)].number_format = '0.00' + ws['G' + str(row_data)].font = name_font + ws['G' + str(row_data)].alignment = c_c_alignment + if (reporting_period_data['stdevs_per_unit_area'][i]) \ + or reporting_period_data['stdevs_per_unit_area'][i] == 0: + ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) + ws['G' + str(row_data)].border = f_border + ws['G' + str(row_data)].number_format = '0.00' - ws['H' + str(row_data)].font = name_font - ws['H' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['variances_per_unit_area'][i] \ - or reporting_period_data['variances_per_unit_area'][i] == 0: - ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) - ws['H' + str(row_data)].border = f_border - ws['H' + str(row_data)].number_format = '0.00' + ws['H' + str(row_data)].font = name_font + ws['H' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['variances_per_unit_area'][i] \ + or reporting_period_data['variances_per_unit_area'][i] == 0: + ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) + ws['H' + str(row_data)].border = f_border + ws['H' + str(row_data)].number_format = '0.00' #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/tenantbatch.py b/myems-api/excelexporters/tenantbatch.py index 65430b3b..2b7aa8d1 100644 --- a/myems-api/excelexporters/tenantbatch.py +++ b/myems-api/excelexporters/tenantbatch.py @@ -1,7 +1,7 @@ import base64 import uuid import os -from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font +from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/tenantbill.py b/myems-api/excelexporters/tenantbill.py index 87794946..9906730f 100644 --- a/myems-api/excelexporters/tenantbill.py +++ b/myems-api/excelexporters/tenantbill.py @@ -2,16 +2,10 @@ import base64 import uuid import os import datetime -from openpyxl.chart import ( - PieChart, - BarChart, - Reference, -) from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from decimal import Decimal from openpyxl.drawing.image import Image from openpyxl import Workbook -from openpyxl.chart.label import DataLabelList ######################################################################################################################## @@ -115,9 +109,6 @@ def generate_excel(report, bottom=Side(border_style='medium', color='00000000'), top=Side(border_style='medium', color='00000000') ) - b_border = Border( - bottom=Side(border_style='medium', color='00000000'), - ) c_c_alignment = Alignment(vertical='center', horizontal='center', diff --git a/myems-api/excelexporters/tenantcost.py b/myems-api/excelexporters/tenantcost.py index f5e5784e..748d9a2a 100644 --- a/myems-api/excelexporters/tenantcost.py +++ b/myems-api/excelexporters/tenantcost.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -471,7 +466,7 @@ def generate_excel(report, col = 'B' - every_day_total = 0 + periodic_sum = 0.0 for j in range(0, ca_len): col = chr(ord('C') + j) @@ -479,14 +474,14 @@ def generate_excel(report, ws[col + str(current_row_number)].font = title_font ws[col + str(current_row_number)].alignment = c_c_alignment value = round(reporting_period_data['values'][j][i], 2) - every_day_total += value + periodic_sum += value ws[col + str(current_row_number)] = value ws[col + str(current_row_number)].border = f_border end_col = chr(ord(col) + 1) ws[end_col + str(current_row_number)].font = title_font ws[end_col + str(current_row_number)].alignment = c_c_alignment - ws[end_col + str(current_row_number)] = round(every_day_total, 2) + ws[end_col + str(current_row_number)] = round(periodic_sum, 2) ws[end_col + str(current_row_number)].border = f_border current_row_number += 1 diff --git a/myems-api/excelexporters/tenantenergycategory.py b/myems-api/excelexporters/tenantenergycategory.py index af30eb05..145d1a97 100644 --- a/myems-api/excelexporters/tenantenergycategory.py +++ b/myems-api/excelexporters/tenantenergycategory.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, - ) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/tenantenergyitem.py b/myems-api/excelexporters/tenantenergyitem.py index 34523cad..2f1f9cc5 100644 --- a/myems-api/excelexporters/tenantenergyitem.py +++ b/myems-api/excelexporters/tenantenergyitem.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import PieChart, LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/tenantload.py b/myems-api/excelexporters/tenantload.py index 0cdbb565..0e0a2bb6 100644 --- a/myems-api/excelexporters/tenantload.py +++ b/myems-api/excelexporters/tenantload.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - PieChart, - LineChart, - BarChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/tenantsaving.py b/myems-api/excelexporters/tenantsaving.py index fb14c98f..8dec3b28 100644 --- a/myems-api/excelexporters/tenantsaving.py +++ b/myems-api/excelexporters/tenantsaving.py @@ -1,12 +1,8 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - PieChart, - BarChart, - Reference, -) +from decimal import Decimal +from openpyxl.chart import LineChart, PieChart, Reference from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook @@ -776,7 +772,7 @@ def generate_excel(report, def sum_list(lists): - total = 0 + total = Decimal(0) for i in range(0, len(lists)): total += lists[i] diff --git a/myems-api/excelexporters/tenantstatistics.py b/myems-api/excelexporters/tenantstatistics.py index 0fe3b89d..d110ab8e 100644 --- a/myems-api/excelexporters/tenantstatistics.py +++ b/myems-api/excelexporters/tenantstatistics.py @@ -1,10 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - Reference, -) +from openpyxl.chart import LineChart, Reference from openpyxl.chart.label import DataLabelList from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image @@ -160,152 +157,146 @@ def generate_excel(report, #################################################################################################################### reporting_period_data = report['reporting_period'] - has_energy_data_flag = True - if "names" not in reporting_period_data.keys() or \ reporting_period_data['names'] is None or \ len(reporting_period_data['names']) == 0: - has_energy_data_flag = False - filename = str(uuid.uuid4()) + '.xlsx' wb.save(filename) - return filename - if has_energy_data_flag: - ws['B6'].font = title_font - ws['B6'] = name + ' 统计分析' + ws['B6'].font = title_font + ws['B6'] = name + ' 统计分析' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B7'].fill = table_fill - ws['B7'].font = title_font - ws['B7'].alignment = c_c_alignment - ws['B7'] = '报告期' - ws['B7'].border = f_border + # table_title + ws['B7'].fill = table_fill + ws['B7'].font = title_font + ws['B7'].alignment = c_c_alignment + ws['B7'] = '报告期' + ws['B7'].border = f_border - ws['C7'].font = title_font - ws['C7'].alignment = c_c_alignment - ws['C7'] = '算术平均数' - ws['C7'].border = f_border + ws['C7'].font = title_font + ws['C7'].alignment = c_c_alignment + ws['C7'] = '算术平均数' + ws['C7'].border = f_border - ws['D7'].font = title_font - ws['D7'].alignment = c_c_alignment - ws['D7'] = '中位数' - ws['D7'].border = f_border + ws['D7'].font = title_font + ws['D7'].alignment = c_c_alignment + ws['D7'] = '中位数' + ws['D7'].border = f_border - ws['E7'].font = title_font - ws['E7'].alignment = c_c_alignment - ws['E7'] = '最小值' - ws['E7'].border = f_border + ws['E7'].font = title_font + ws['E7'].alignment = c_c_alignment + ws['E7'] = '最小值' + ws['E7'].border = f_border - ws['F7'].font = title_font - ws['F7'].alignment = c_c_alignment - ws['F7'] = '最大值' - ws['F7'].border = f_border + ws['F7'].font = title_font + ws['F7'].alignment = c_c_alignment + ws['F7'] = '最大值' + ws['F7'].border = f_border - ws['G7'].font = title_font - ws['G7'].alignment = c_c_alignment - ws['G7'] = '样本标准差' - ws['G7'].border = f_border + ws['G7'].font = title_font + ws['G7'].alignment = c_c_alignment + ws['G7'] = '样本标准差' + ws['G7'].border = f_border - ws['H7'].font = title_font - ws['H7'].alignment = c_c_alignment - ws['H7'] = '样本方差' - ws['H7'].border = f_border + ws['H7'].font = title_font + ws['H7'].alignment = c_c_alignment + ws['H7'] = '样本方差' + ws['H7'].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row = i*2 + 8 - ws['B' + str(row)].font = name_font - ws['B' + str(row)].alignment = c_c_alignment - ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" - ws['B' + str(row)].border = f_border + for i, value in enumerate(category): + row = i*2 + 8 + ws['B' + str(row)].font = name_font + ws['B' + str(row)].alignment = c_c_alignment + ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + " )" + ws['B' + str(row)].border = f_border - ws['B' + str(row + 1)].font = name_font - ws['B' + str(row + 1)].alignment = c_c_alignment - ws['B' + str(row + 1)] = "环比" - ws['B' + str(row + 1)].border = f_border + ws['B' + str(row + 1)].font = name_font + ws['B' + str(row + 1)].alignment = c_c_alignment + ws['B' + str(row + 1)] = "环比" + ws['B' + str(row + 1)].border = f_border - ws['C' + str(row)].font = name_font - ws['C' + str(row)].alignment = c_c_alignment - ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ - if reporting_period_data['means'][i] is not None else '' - ws['C' + str(row)].border = f_border - ws['C' + str(row)].number_format = '0.00' + ws['C' + str(row)].font = name_font + ws['C' + str(row)].alignment = c_c_alignment + ws['C' + str(row)] = round(reporting_period_data['means'][i], 2) \ + if reporting_period_data['means'][i] is not None else '' + ws['C' + str(row)].border = f_border + ws['C' + str(row)].number_format = '0.00' - ws['C' + str(row + 1)].font = name_font - ws['C' + str(row + 1)].alignment = c_c_alignment - ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' - ws['C' + str(row + 1)].border = f_border + ws['C' + str(row + 1)].font = name_font + ws['C' + str(row + 1)].alignment = c_c_alignment + ws['C' + str(row + 1)] = str(round(reporting_period_data['means_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['means_increment_rate'][i] is not None else '0.00%' + ws['C' + str(row + 1)].border = f_border - ws['D' + str(row)].font = name_font - ws['D' + str(row)].alignment = c_c_alignment - ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ - if reporting_period_data['medians'][i] is not None else '' - ws['D' + str(row)].border = f_border - ws['D' + str(row)].number_format = '0.00' + ws['D' + str(row)].font = name_font + ws['D' + str(row)].alignment = c_c_alignment + ws['D' + str(row)] = round(reporting_period_data['medians'][i], 2) \ + if reporting_period_data['medians'][i] is not None else '' + ws['D' + str(row)].border = f_border + ws['D' + str(row)].number_format = '0.00' - ws['D' + str(row + 1)].font = name_font - ws['D' + str(row + 1)].alignment = c_c_alignment - ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' - ws['D' + str(row + 1)].border = f_border + ws['D' + str(row + 1)].font = name_font + ws['D' + str(row + 1)].alignment = c_c_alignment + ws['D' + str(row + 1)] = str(round(reporting_period_data['medians_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['medians_increment_rate'][i] is not None else '0.00%' + ws['D' + str(row + 1)].border = f_border - ws['E' + str(row)].font = name_font - ws['E' + str(row)].alignment = c_c_alignment - ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ - if reporting_period_data['minimums'][i] is not None else '' - ws['E' + str(row)].border = f_border - ws['E' + str(row)].number_format = '0.00' + ws['E' + str(row)].font = name_font + ws['E' + str(row)].alignment = c_c_alignment + ws['E' + str(row)] = round(reporting_period_data['minimums'][i], 2) \ + if reporting_period_data['minimums'][i] is not None else '' + ws['E' + str(row)].border = f_border + ws['E' + str(row)].number_format = '0.00' - ws['E' + str(row + 1)].font = name_font - ws['E' + str(row + 1)].alignment = c_c_alignment - ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' - ws['E' + str(row + 1)].border = f_border + ws['E' + str(row + 1)].font = name_font + ws['E' + str(row + 1)].alignment = c_c_alignment + ws['E' + str(row + 1)] = str(round(reporting_period_data['minimums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['minimums_increment_rate'][i] is not None else '0.00%' + ws['E' + str(row + 1)].border = f_border - ws['F' + str(row)].font = name_font - ws['F' + str(row)].alignment = c_c_alignment - ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ - if reporting_period_data['maximums'][i] is not None else '' - ws['F' + str(row)].border = f_border - ws['F' + str(row)].number_format = '0.00' + ws['F' + str(row)].font = name_font + ws['F' + str(row)].alignment = c_c_alignment + ws['F' + str(row)] = round(reporting_period_data['maximums'][i], 2) \ + if reporting_period_data['maximums'][i] is not None else '' + ws['F' + str(row)].border = f_border + ws['F' + str(row)].number_format = '0.00' - ws['F' + str(row + 1)].font = name_font - ws['F' + str(row + 1)].alignment = c_c_alignment - ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' - ws['F' + str(row + 1)].border = f_border + ws['F' + str(row + 1)].font = name_font + ws['F' + str(row + 1)].alignment = c_c_alignment + ws['F' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%' + ws['F' + str(row + 1)].border = f_border - ws['G' + str(row)].font = name_font - ws['G' + str(row)].alignment = c_c_alignment - ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ - if reporting_period_data['stdevs'][i] is not None else '' - ws['G' + str(row)].border = f_border - ws['G' + str(row)].number_format = '0.00' + ws['G' + str(row)].font = name_font + ws['G' + str(row)].alignment = c_c_alignment + ws['G' + str(row)] = round(reporting_period_data['stdevs'][i], 2) \ + if reporting_period_data['stdevs'][i] is not None else '' + ws['G' + str(row)].border = f_border + ws['G' + str(row)].number_format = '0.00' - ws['G' + str(row + 1)].font = name_font - ws['G' + str(row + 1)].alignment = c_c_alignment - ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' - ws['G' + str(row + 1)].border = f_border + ws['G' + str(row + 1)].font = name_font + ws['G' + str(row + 1)].alignment = c_c_alignment + ws['G' + str(row + 1)] = str(round(reporting_period_data['stdevs_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['stdevs_increment_rate'][i] is not None else '0.00%' + ws['G' + str(row + 1)].border = f_border - ws['H' + str(row)].font = name_font - ws['H' + str(row)].alignment = c_c_alignment - ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ - if reporting_period_data['variances'][i] is not None else '' - ws['H' + str(row)].border = f_border - ws['H' + str(row)].number_format = '0.00' + ws['H' + str(row)].font = name_font + ws['H' + str(row)].alignment = c_c_alignment + ws['H' + str(row)] = round(reporting_period_data['variances'][i], 2) \ + if reporting_period_data['variances'][i] is not None else '' + ws['H' + str(row)].border = f_border + ws['H' + str(row)].number_format = '0.00' - ws['H' + str(row + 1)].font = name_font - ws['H' + str(row + 1)].alignment = c_c_alignment - ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ - if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' - ws['H' + str(row + 1)].border = f_border + ws['H' + str(row + 1)].font = name_font + ws['H' + str(row + 1)].alignment = c_c_alignment + ws['H' + str(row + 1)] = str(round(reporting_period_data['variances_increment_rate'][i] * 100, 2)) + "%" \ + if reporting_period_data['variances_increment_rate'][i] is not None else '0.00%' + ws['H' + str(row + 1)].border = f_border #################################################################################################################### # Second: 报告期消耗 # 9 + ca_len * 2: title @@ -313,111 +304,110 @@ def generate_excel(report, # per_unit_area_start_row_number + 2 ~ per_unit_area_start_row_number + 2 + ca_len : table_data #################################################################################################################### - if has_energy_data_flag: - names = reporting_period_data['names'] - ca_len = len(names) + names = reporting_period_data['names'] + ca_len = len(names) - per_unit_area_start_row_number = 9 + ca_len * 2 + per_unit_area_start_row_number = 9 + ca_len * 2 - ws['B' + str(per_unit_area_start_row_number)].font = title_font - ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['tenant']['area']) + 'M²' + ws['B' + str(per_unit_area_start_row_number)].font = title_font + ws['B' + str(per_unit_area_start_row_number)] = name + ' 单位面积值' + str(report['tenant']['area']) + 'M²' - category = reporting_period_data['names'] + category = reporting_period_data['names'] - # table_title - ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill - ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' - ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border + # table_title + ws['B' + str(per_unit_area_start_row_number + 1)].fill = table_fill + ws['B' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['B' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['B' + str(per_unit_area_start_row_number + 1)] = '报告期' + ws['B' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' - ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['C' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['C' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['C' + str(per_unit_area_start_row_number + 1)] = '算术平均数' + ws['C' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' - ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['D' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['D' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['D' + str(per_unit_area_start_row_number + 1)] = '中位数' + ws['D' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' - ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['E' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['E' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['E' + str(per_unit_area_start_row_number + 1)] = '最小值' + ws['E' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' - ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['F' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['F' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['F' + str(per_unit_area_start_row_number + 1)] = '最大值' + ws['F' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' - ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['G' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['G' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['G' + str(per_unit_area_start_row_number + 1)] = '样本标准差' + ws['G' + str(per_unit_area_start_row_number + 1)].border = f_border - ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font - ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment - ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' - ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border + ws['H' + str(per_unit_area_start_row_number + 1)].font = title_font + ws['H' + str(per_unit_area_start_row_number + 1)].alignment = c_c_alignment + ws['H' + str(per_unit_area_start_row_number + 1)] = '样本方差' + ws['H' + str(per_unit_area_start_row_number + 1)].border = f_border - # table_data + # table_data - for i, value in enumerate(category): - row_data = per_unit_area_start_row_number + 2 + i - ws['B' + str(row_data)].font = name_font - ws['B' + str(row_data)].alignment = c_c_alignment - ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ - i] + "/M²)" - ws['B' + str(row_data)].border = f_border + for i, value in enumerate(category): + row_data = per_unit_area_start_row_number + 2 + i + ws['B' + str(row_data)].font = name_font + ws['B' + str(row_data)].alignment = c_c_alignment + ws['B' + str(row_data)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][ + i] + "/M²)" + ws['B' + str(row_data)].border = f_border - ws['C' + str(row_data)].font = name_font - ws['C' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['means_per_unit_area'][i] \ - or reporting_period_data['means_per_unit_area'][i] == 0: - ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) - ws['C' + str(row_data)].border = f_border - ws['C' + str(row_data)].number_format = '0.00' + ws['C' + str(row_data)].font = name_font + ws['C' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['means_per_unit_area'][i] \ + or reporting_period_data['means_per_unit_area'][i] == 0: + ws['C' + str(row_data)] = round(reporting_period_data['means_per_unit_area'][i], 2) + ws['C' + str(row_data)].border = f_border + ws['C' + str(row_data)].number_format = '0.00' - ws['D' + str(row_data)].font = name_font - ws['D' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['medians_per_unit_area'][i] \ - or reporting_period_data['medians_per_unit_area'][i] == 0: - ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) - ws['D' + str(row_data)].border = f_border - ws['D' + str(row_data)].number_format = '0.00' + ws['D' + str(row_data)].font = name_font + ws['D' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['medians_per_unit_area'][i] \ + or reporting_period_data['medians_per_unit_area'][i] == 0: + ws['D' + str(row_data)] = round(reporting_period_data['medians_per_unit_area'][i], 2) + ws['D' + str(row_data)].border = f_border + ws['D' + str(row_data)].number_format = '0.00' - ws['E' + str(row_data)].font = name_font - ws['E' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['minimums_per_unit_area'][i] \ - or reporting_period_data['minimums_per_unit_area'][i] == 0: - ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) - ws['E' + str(row_data)].border = f_border - ws['E' + str(row_data)].number_format = '0.00' + ws['E' + str(row_data)].font = name_font + ws['E' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['minimums_per_unit_area'][i] \ + or reporting_period_data['minimums_per_unit_area'][i] == 0: + ws['E' + str(row_data)] = round(reporting_period_data['minimums_per_unit_area'][i], 2) + ws['E' + str(row_data)].border = f_border + ws['E' + str(row_data)].number_format = '0.00' - ws['F' + str(row_data)].font = name_font - ws['F' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['maximums_per_unit_area'][i] \ - or reporting_period_data['maximums_per_unit_area'][i] == 0: - ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) - ws['F' + str(row_data)].border = f_border - ws['F' + str(row_data)].number_format = '0.00' + ws['F' + str(row_data)].font = name_font + ws['F' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['maximums_per_unit_area'][i] \ + or reporting_period_data['maximums_per_unit_area'][i] == 0: + ws['F' + str(row_data)] = round(reporting_period_data['maximums_per_unit_area'][i], 2) + ws['F' + str(row_data)].border = f_border + ws['F' + str(row_data)].number_format = '0.00' - ws['G' + str(row_data)].font = name_font - ws['G' + str(row_data)].alignment = c_c_alignment - if (reporting_period_data['stdevs_per_unit_area'][i]) \ - or reporting_period_data['stdevs_per_unit_area'][i] == 0: - ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) - ws['G' + str(row_data)].border = f_border - ws['G' + str(row_data)].number_format = '0.00' + ws['G' + str(row_data)].font = name_font + ws['G' + str(row_data)].alignment = c_c_alignment + if (reporting_period_data['stdevs_per_unit_area'][i]) \ + or reporting_period_data['stdevs_per_unit_area'][i] == 0: + ws['G' + str(row_data)] = round(reporting_period_data['stdevs_per_unit_area'][i], 2) + ws['G' + str(row_data)].border = f_border + ws['G' + str(row_data)].number_format = '0.00' - ws['H' + str(row_data)].font = name_font - ws['H' + str(row_data)].alignment = c_c_alignment - if reporting_period_data['variances_per_unit_area'][i] \ - or reporting_period_data['variances_per_unit_area'][i] == 0: - ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) - ws['H' + str(row_data)].border = f_border - ws['H' + str(row_data)].number_format = '0.00' + ws['H' + str(row_data)].font = name_font + ws['H' + str(row_data)].alignment = c_c_alignment + if reporting_period_data['variances_per_unit_area'][i] \ + or reporting_period_data['variances_per_unit_area'][i] == 0: + ws['H' + str(row_data)] = round(reporting_period_data['variances_per_unit_area'][i], 2) + ws['H' + str(row_data)].border = f_border + ws['H' + str(row_data)].number_format = '0.00' #################################################################################################################### # Third: 详细数据 diff --git a/myems-api/excelexporters/virtualmetercost.py b/myems-api/excelexporters/virtualmetercost.py index 65962fd3..21194d60 100644 --- a/myems-api/excelexporters/virtualmetercost.py +++ b/myems-api/excelexporters/virtualmetercost.py @@ -1,12 +1,7 @@ import base64 import uuid import os -from openpyxl.chart import ( - LineChart, - BarChart, - Reference, - Series -) +from openpyxl.chart import LineChart, Reference, Series from openpyxl.styles import PatternFill, Border, Side, Alignment, Font from openpyxl.drawing.image import Image from openpyxl import Workbook diff --git a/myems-api/excelexporters/virtualmeterenergy.py b/myems-api/excelexporters/virtualmeterenergy.py index cab86ef2..15ec3269 100644 --- a/myems-api/excelexporters/virtualmeterenergy.py +++ b/myems-api/excelexporters/virtualmeterenergy.py @@ -1,14 +1,8 @@ import base64 import os import uuid - from openpyxl import Workbook -from openpyxl.chart import ( - LineChart, - BarChart, - Reference, - Series, -) +from openpyxl.chart import LineChart, Reference, Series from openpyxl.chart.label import DataLabelList from openpyxl.drawing.image import Image from openpyxl.styles import PatternFill, Border, Side, Alignment, Font