Pārlūkot izejas kodu

slslssl

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 4 gadi atpakaļ
vecāks
revīzija
e1b8dff45d
3 mainītis faili ar 24 papildinājumiem un 16 dzēšanām
  1. 2 2
      apscheduler_elab.py
  2. 19 13
      jianye_report.py
  3. 3 1
      report_file_utils.py

+ 2 - 2
apscheduler_elab.py

@@ -13,9 +13,9 @@ class Config(object):
         day_work_three: 4
         day_work_four: 5
     """
-    jianye__house_hour = 8
+    jianye__house_hour = 6
     jianye_house_minute = 30
-    jianye_brand_hour = 8
+    jianye_brand_hour = 6
     jianye_brand_minute = 30
 
     JOBS = [

+ 19 - 13
jianye_report.py

@@ -354,13 +354,13 @@ class JianYeReport(object):
             # 发送邮件
             for mail in send_mail_info:
                 try:
-                    for m in self.customer_mails:
-                        result = mail_util.send_mail_by_admin(mail[0], mail[1], m, mail[3], mail[4])
-                        if result:
-                            # name, mail, report_name, push_time, send_status, status, error_message
-                            send_mail_log.append([mail[5], mail[2], mail[3], 1, 'success'])
-                        else:
-                            send_mail_log.append([mail[5], mail[2], mail[3], -1, 'fail'])
+                    # for m in self.customer_mails:
+                    result = mail_util.send_mail_by_admin(mail[0], mail[1], mail[2], mail[3], mail[4])
+                    if result:
+                        # name, mail, report_name, push_time, send_status, status, error_message
+                        send_mail_log.append([mail[5], mail[2], mail[3], 1, 'success'])
+                    else:
+                        send_mail_log.append([mail[5], mail[2], mail[3], -1, 'fail'])
                 except Exception as e:
                     print(str(e))
                     message['error1'] = str(e)
@@ -468,13 +468,19 @@ class JianYeReport(object):
                 try:
                     if new_mail:
                         result = mail_util.send_mail_by_admin(mail[0], mail[1], new_mail, mail[3], mail[4])
+                        if result:
+                            # name, mail, report_name, push_time, send_status, status, error_message
+                            send_mail_log.append([mail[5], mail[2], mail[3], 1, 'success'])
+                        else:
+                            send_mail_log.append([mail[5], mail[2], mail[3], -1, 'fail'])
                     else:
-                        result = mail_util.send_mail_by_admin(mail[0], mail[1], mail[7], mail[3], mail[4])
-                    if result:
-                        # name, mail, report_name, push_time, send_status, status, error_message
-                        send_mail_log.append([mail[5], mail[2], mail[3], 1, 'success'])
-                    else:
-                        send_mail_log.append([mail[5], mail[2], mail[3], -1, 'fail'])
+                        for m in self.customer_mails:
+                            result = mail_util.send_mail_by_admin(mail[0], mail[1], m, mail[3], mail[4])
+                            if result:
+                                # name, mail, report_name, push_time, send_status, status, error_message
+                                send_mail_log.append([mail[5], mail[2], mail[3], 1, 'success'])
+                            else:
+                                send_mail_log.append([mail[5], mail[2], mail[3], -1, 'fail'])
                 except Exception as e:
                     print(str(e))
                     message['邮件发送失败'] = str(e)

+ 3 - 1
report_file_utils.py

@@ -8,6 +8,7 @@ class ReportFileUtils:
                        200,
                        bold=False,
                        format_str='', align='')
+        self.simple_style = xlwt.XFStyle()
     pass
 
     def set_style(self, name, height, bold=False, format_str='', align='center'):
@@ -96,8 +97,9 @@ class ReportFileUtils:
                 if value is None:
                     value = 0
                 ws.col(col).width = 150 * 30  # 定义列宽
+                style = self.simple_style if y >= 2 else self.default_style
                 ws.write(start_row, col, str(value),
-                         style=self.default_style)
+                         style=style)
                 y += 1
             start_row += 1