Code Duplication    Length = 80-80 lines in 4 locations

myems-api/excelexporters/storeload.py 1 location

@@ 223-302 (lines=80) @@
220
221
        return filename
222
223
    if has_energy_data_flag:
224
        ws['B6'].font = title_font
225
        ws['B6'] = name + ' 统计分析'
226
227
        category = reporting_period_data['names']
228
229
        # table_title
230
        ws['B7'].fill = table_fill
231
        ws['B7'].font = title_font
232
        ws['B7'].alignment = c_c_alignment
233
        ws['B7'] = '报告期'
234
        ws['B7'].border = f_border
235
236
        ws['C7'].font = title_font
237
        ws['C7'].alignment = c_c_alignment
238
        ws['C7'] = '平均负荷'
239
        ws['C7'].border = f_border
240
241
        ws['D7'].font = title_font
242
        ws['D7'].alignment = c_c_alignment
243
        ws['D7'] = '最大负荷'
244
        ws['D7'].border = f_border
245
246
        ws['E7'].font = title_font
247
        ws['E7'].alignment = c_c_alignment
248
        ws['E7'] = '负荷系数'
249
        ws['E7'].border = f_border
250
251
        # table_data
252
253
        for i, value in enumerate(category):
254
            row = i * 2 + 8
255
            ws['B' + str(row)].font = name_font
256
            ws['B' + str(row)].alignment = c_c_alignment
257
            ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )"
258
            ws['B' + str(row)].border = f_border
259
260
            ws['B' + str(row + 1)].font = name_font
261
            ws['B' + str(row + 1)].alignment = c_c_alignment
262
            ws['B' + str(row + 1)] = "环比"
263
            ws['B' + str(row + 1)].border = f_border
264
265
            ws['C' + str(row)].font = name_font
266
            ws['C' + str(row)].alignment = c_c_alignment
267
            ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \
268
                if reporting_period_data['averages'][i] is not None else ''
269
            ws['C' + str(row)].border = f_border
270
            ws['C' + str(row)].number_format = '0.00'
271
272
            ws['C' + str(row + 1)].font = name_font
273
            ws['C' + str(row + 1)].alignment = c_c_alignment
274
            ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \
275
                if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%'
276
            ws['C' + str(row + 1)].border = f_border
277
278
            ws['D' + str(row)].font = name_font
279
            ws['D' + str(row)].alignment = c_c_alignment
280
            ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \
281
                if reporting_period_data['maximums'][i] is not None else ''
282
            ws['D' + str(row)].border = f_border
283
            ws['D' + str(row)].number_format = '0.00'
284
285
            ws['D' + str(row + 1)].font = name_font
286
            ws['D' + str(row + 1)].alignment = c_c_alignment
287
            ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \
288
                if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%'
289
            ws['D' + str(row + 1)].border = f_border
290
291
            ws['E' + str(row)].font = name_font
292
            ws['E' + str(row)].alignment = c_c_alignment
293
            ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \
294
                if reporting_period_data['factors'][i] is not None else ''
295
            ws['E' + str(row)].border = f_border
296
            ws['E' + str(row)].number_format = '0.00'
297
298
            ws['E' + str(row + 1)].font = name_font
299
            ws['E' + str(row + 1)].alignment = c_c_alignment
300
            ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \
301
                if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%'
302
            ws['E' + str(row + 1)].border = f_border
303
304
    #################################################
305
    # Second: 报告期单位面积消耗

myems-api/excelexporters/equipmentload.py 1 location

@@ 183-262 (lines=80) @@
180
181
        return filename
182
183
    if has_energy_data_flag:
184
        ws['B6'].font = title_font
185
        ws['B6'] = name + ' 统计分析'
186
187
        category = reporting_period_data['names']
188
189
        # table_title
190
        ws['B7'].fill = table_fill
191
        ws['B7'].font = title_font
192
        ws['B7'].alignment = c_c_alignment
193
        ws['B7'] = '报告期'
194
        ws['B7'].border = f_border
195
196
        ws['C7'].font = title_font
197
        ws['C7'].alignment = c_c_alignment
198
        ws['C7'] = '平均负荷'
199
        ws['C7'].border = f_border
200
201
        ws['D7'].font = title_font
202
        ws['D7'].alignment = c_c_alignment
203
        ws['D7'] = '最大负荷'
204
        ws['D7'].border = f_border
205
206
        ws['E7'].font = title_font
207
        ws['E7'].alignment = c_c_alignment
208
        ws['E7'] = '负荷系数'
209
        ws['E7'].border = f_border
210
211
        # table_data
212
213
        for i, value in enumerate(category):
214
            row = i * 2 + 8
215
            ws['B' + str(row)].font = name_font
216
            ws['B' + str(row)].alignment = c_c_alignment
217
            ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )"
218
            ws['B' + str(row)].border = f_border
219
220
            ws['B' + str(row + 1)].font = name_font
221
            ws['B' + str(row + 1)].alignment = c_c_alignment
222
            ws['B' + str(row + 1)] = "环比"
223
            ws['B' + str(row + 1)].border = f_border
224
225
            ws['C' + str(row)].font = name_font
226
            ws['C' + str(row)].alignment = c_c_alignment
227
            ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \
228
                if reporting_period_data['averages'][i] is not None else ''
229
            ws['C' + str(row)].border = f_border
230
            ws['C' + str(row)].number_format = '0.00'
231
232
            ws['C' + str(row + 1)].font = name_font
233
            ws['C' + str(row + 1)].alignment = c_c_alignment
234
            ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \
235
                if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%'
236
            ws['C' + str(row + 1)].border = f_border
237
238
            ws['D' + str(row)].font = name_font
239
            ws['D' + str(row)].alignment = c_c_alignment
240
            ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \
241
                if reporting_period_data['maximums'][i] is not None else ''
242
            ws['D' + str(row)].border = f_border
243
            ws['D' + str(row)].number_format = '0.00'
244
245
            ws['D' + str(row + 1)].font = name_font
246
            ws['D' + str(row + 1)].alignment = c_c_alignment
247
            ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \
248
                if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%'
249
            ws['D' + str(row + 1)].border = f_border
250
251
            ws['E' + str(row)].font = name_font
252
            ws['E' + str(row)].alignment = c_c_alignment
253
            ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \
254
                if reporting_period_data['factors'][i] is not None else ''
255
            ws['E' + str(row)].border = f_border
256
            ws['E' + str(row)].number_format = '0.00'
257
258
            ws['E' + str(row + 1)].font = name_font
259
            ws['E' + str(row + 1)].alignment = c_c_alignment
260
            ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \
261
                if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%'
262
            ws['E' + str(row + 1)].border = f_border
263
264
    ########################################################
265
    # Third: 详细数据

myems-api/excelexporters/combinedequipmentload.py 1 location

@@ 177-256 (lines=80) @@
174
175
        return filename
176
177
    if has_energy_data_flag:
178
        ws['B6'].font = title_font
179
        ws['B6'] = name + ' 负荷分析'
180
181
        category = reporting_period_data['names']
182
183
        # table_title
184
        ws['B7'].fill = table_fill
185
        ws['B7'].font = title_font
186
        ws['B7'].alignment = c_c_alignment
187
        ws['B7'] = '报告期'
188
        ws['B7'].border = f_border
189
190
        ws['C7'].font = title_font
191
        ws['C7'].alignment = c_c_alignment
192
        ws['C7'] = '平均负荷'
193
        ws['C7'].border = f_border
194
195
        ws['D7'].font = title_font
196
        ws['D7'].alignment = c_c_alignment
197
        ws['D7'] = '最大负荷'
198
        ws['D7'].border = f_border
199
200
        ws['E7'].font = title_font
201
        ws['E7'].alignment = c_c_alignment
202
        ws['E7'] = '负荷系数'
203
        ws['E7'].border = f_border
204
205
        # table_data
206
207
        for i, value in enumerate(category):
208
            row = i * 2 + 8
209
            ws['B' + str(row)].font = name_font
210
            ws['B' + str(row)].alignment = c_c_alignment
211
            ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )"
212
            ws['B' + str(row)].border = f_border
213
214
            ws['B' + str(row + 1)].font = name_font
215
            ws['B' + str(row + 1)].alignment = c_c_alignment
216
            ws['B' + str(row + 1)] = "环比"
217
            ws['B' + str(row + 1)].border = f_border
218
219
            ws['C' + str(row)].font = name_font
220
            ws['C' + str(row)].alignment = c_c_alignment
221
            ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \
222
                if reporting_period_data['averages'][i] is not None else ''
223
            ws['C' + str(row)].border = f_border
224
            ws['C' + str(row)].number_format = '0.00'
225
226
            ws['C' + str(row + 1)].font = name_font
227
            ws['C' + str(row + 1)].alignment = c_c_alignment
228
            ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \
229
                if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%'
230
            ws['C' + str(row + 1)].border = f_border
231
232
            ws['D' + str(row)].font = name_font
233
            ws['D' + str(row)].alignment = c_c_alignment
234
            ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \
235
                if reporting_period_data['maximums'][i] is not None else ''
236
            ws['D' + str(row)].border = f_border
237
            ws['D' + str(row)].number_format = '0.00'
238
239
            ws['D' + str(row + 1)].font = name_font
240
            ws['D' + str(row + 1)].alignment = c_c_alignment
241
            ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \
242
                if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%'
243
            ws['D' + str(row + 1)].border = f_border
244
245
            ws['E' + str(row)].font = name_font
246
            ws['E' + str(row)].alignment = c_c_alignment
247
            ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \
248
                if reporting_period_data['factors'][i] is not None else ''
249
            ws['E' + str(row)].border = f_border
250
            ws['E' + str(row)].number_format = '0.00'
251
252
            ws['E' + str(row + 1)].font = name_font
253
            ws['E' + str(row + 1)].alignment = c_c_alignment
254
            ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \
255
                if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%'
256
            ws['E' + str(row + 1)].border = f_border
257
258
    ####################################################################################################################
259
    # Third: 详细数据

myems-api/excelexporters/shopfloorload.py 1 location

@@ 223-302 (lines=80) @@
220
221
        return filename
222
223
    if has_energy_data_flag:
224
        ws['B6'].font = title_font
225
        ws['B6'] = name + ' 统计分析'
226
227
        category = reporting_period_data['names']
228
229
        # table_title
230
        ws['B7'].fill = table_fill
231
        ws['B7'].font = title_font
232
        ws['B7'].alignment = c_c_alignment
233
        ws['B7'] = '报告期'
234
        ws['B7'].border = f_border
235
236
        ws['C7'].font = title_font
237
        ws['C7'].alignment = c_c_alignment
238
        ws['C7'] = '平均负荷'
239
        ws['C7'].border = f_border
240
241
        ws['D7'].font = title_font
242
        ws['D7'].alignment = c_c_alignment
243
        ws['D7'] = '最大负荷'
244
        ws['D7'].border = f_border
245
246
        ws['E7'].font = title_font
247
        ws['E7'].alignment = c_c_alignment
248
        ws['E7'] = '负荷系数'
249
        ws['E7'].border = f_border
250
251
        # table_data
252
253
        for i, value in enumerate(category):
254
            row = i * 2 + 8
255
            ws['B' + str(row)].font = name_font
256
            ws['B' + str(row)].alignment = c_c_alignment
257
            ws['B' + str(row)] = reporting_period_data['names'][i] + " (" + reporting_period_data['units'][i] + "/H )"
258
            ws['B' + str(row)].border = f_border
259
260
            ws['B' + str(row + 1)].font = name_font
261
            ws['B' + str(row + 1)].alignment = c_c_alignment
262
            ws['B' + str(row + 1)] = "环比"
263
            ws['B' + str(row + 1)].border = f_border
264
265
            ws['C' + str(row)].font = name_font
266
            ws['C' + str(row)].alignment = c_c_alignment
267
            ws['C' + str(row)] = round(reporting_period_data['averages'][i], 2) \
268
                if reporting_period_data['averages'][i] is not None else ''
269
            ws['C' + str(row)].border = f_border
270
            ws['C' + str(row)].number_format = '0.00'
271
272
            ws['C' + str(row + 1)].font = name_font
273
            ws['C' + str(row + 1)].alignment = c_c_alignment
274
            ws['C' + str(row + 1)] = str(round(reporting_period_data['averages_increment_rate'][i] * 100, 2)) + "%" \
275
                if reporting_period_data['averages_increment_rate'][i] is not None else '0.00%'
276
            ws['C' + str(row + 1)].border = f_border
277
278
            ws['D' + str(row)].font = name_font
279
            ws['D' + str(row)].alignment = c_c_alignment
280
            ws['D' + str(row)] = round(reporting_period_data['maximums'][i], 2) \
281
                if reporting_period_data['maximums'][i] is not None else ''
282
            ws['D' + str(row)].border = f_border
283
            ws['D' + str(row)].number_format = '0.00'
284
285
            ws['D' + str(row + 1)].font = name_font
286
            ws['D' + str(row + 1)].alignment = c_c_alignment
287
            ws['D' + str(row + 1)] = str(round(reporting_period_data['maximums_increment_rate'][i] * 100, 2)) + "%" \
288
                if reporting_period_data['maximums_increment_rate'][i] is not None else '0.00%'
289
            ws['D' + str(row + 1)].border = f_border
290
291
            ws['E' + str(row)].font = name_font
292
            ws['E' + str(row)].alignment = c_c_alignment
293
            ws['E' + str(row)] = round(reporting_period_data['factors'][i], 2) \
294
                if reporting_period_data['factors'][i] is not None else ''
295
            ws['E' + str(row)].border = f_border
296
            ws['E' + str(row)].number_format = '0.00'
297
298
            ws['E' + str(row + 1)].font = name_font
299
            ws['E' + str(row + 1)].alignment = c_c_alignment
300
            ws['E' + str(row + 1)] = str(round(reporting_period_data['factors_increment_rate'][i] * 100, 2)) + "%" \
301
                if reporting_period_data['factors_increment_rate'][i] is not None else '0.00%'
302
            ws['E' + str(row + 1)].border = f_border
303
304
    #################################################
305
    # Second: 报告期单位面积消耗