Merge branch 'develop' of https://gitee.com/hyh123_a/myems into develop

pull/59/head
hyh123a 2021-08-06 16:12:00 +08:00
commit 1656d9b131
70 changed files with 2650 additions and 3443 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 Code0086+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-DDTHHMMSS',
INVALID_END_DATE_TIME_YMD: '无效的结束日期时间(预期格式:YYYY-MM-DDTHH)',
INVALID_END_DATE_TIME_YMDHMS: '无效的结束日期时间(预期格式:YYYY-MM-DDTHHMMSS)',
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-DDTHHMMSS',
INVALID_START_DATE_TIME_YMD: '无效的开始日期时间(预期格式:YYYY-MM-DD)',
INVALID_START_DATE_TIME_YMDHMS: '无效的开始日期时间(预期格式:YYYY-MM-DDTHHMMSS)',
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',

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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: 详细数据

View File

@ -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

View File

@ -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

View File

@ -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: 详细数据

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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',

View File

@ -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',

View File

@ -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):

View File

@ -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: 详细数据

View File

@ -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',

View File

@ -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]

View File

@ -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: 详细数据

View File

@ -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
########################################################################################################################

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
########################################################################################################################

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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']) + ''
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']) + ''
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: 详细数据

View File

@ -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]

View File

@ -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']) + ''
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']) + ''
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: 详细数据

View File

@ -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):

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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']) + ''
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']) + ''
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: 详细数据

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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']) + ''
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']) + ''
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: 详细数据

View File

@ -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

View File

@ -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']) + ''
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']) + ''
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: 详细数据

View File

@ -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

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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']) + ''
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']) + ''
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: 详细数据

View File

@ -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

View File

@ -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