提交 c7489bcf authored 作者: 贺阳's avatar 贺阳

Merge branch 'develop' into feature/ocr识别pdf并删除指定内容

# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
...@@ -259,11 +259,13 @@ class OrderStateChangeRule(models.Model): ...@@ -259,11 +259,13 @@ class OrderStateChangeRule(models.Model):
# order_obj_arr = [] # order_obj_arr = []
try: try:
text_arr = [i.replace('-', '').replace(' ', '') for i in text_arr] text_arr = [i.replace('-', '').replace(' ', '') for i in text_arr]
ids = []
if text_arr:
sql = "select id from cc_bl where UPPER(REPLACE(REPLACE(REPLACE(bl_no, ' ', ''), '-', ''), '/', '')) in %s" sql = "select id from cc_bl where UPPER(REPLACE(REPLACE(REPLACE(bl_no, ' ', ''), '-', ''), '/', '')) in %s"
self._cr.execute(sql, (tuple(text_arr),)) self._cr.execute(sql, (tuple(text_arr),))
result = self._cr.fetchall() result = self._cr.fetchall()
ids = [i[0] for i in result] ids = [i[0] for i in result]
bl_objs = self.env['cc.bl'].sudo().search([('id', 'in', ids)]) if result else False bl_objs = self.env['cc.bl'].sudo().search([('id', 'in', ids)]) if ids else False
if bl_objs and attachment_tuple_arr: if bl_objs and attachment_tuple_arr:
file_objs = self.env['cc.clearance.file'].sudo().search( file_objs = self.env['cc.clearance.file'].sudo().search(
[('file_name', '=', '尾程交接POD(待大包数量和箱号)'), [('file_name', '=', '尾程交接POD(待大包数量和箱号)'),
...@@ -277,6 +279,28 @@ class OrderStateChangeRule(models.Model): ...@@ -277,6 +279,28 @@ class OrderStateChangeRule(models.Model):
# raise ValidationError('未连接redis') # raise ValidationError('未连接redis')
# else: # else:
# redis_conn.lpush('mail_push_package_list', json.dumps({'id': bl_obj.id, 'utc_time': utc_time.strftime("%Y-%m-%d %H:%M:%S")})) # redis_conn.lpush('mail_push_package_list', json.dumps({'id': bl_obj.id, 'utc_time': utc_time.strftime("%Y-%m-%d %H:%M:%S")}))
if not bl_objs:
mail_time = (datetime.utcnow() + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
content = f"""<p>您好:
邮箱在{mail_time}(+8)时间接收到主题为POD的邮件,但未识别到对应的提单,请检查
避免推送超时!</p>"""
# 给客户配置的每个邮箱都发送邮件
patrol_sender_email = self.env["ir.config_parameter"].sudo().get_param('patrol_sender_email') or ''
patrol_receiver_emails = self.env["ir.config_parameter"].sudo().get_param(
'patrol_receiver_emails') or ''
mail = self.env['mail.mail'].sudo().create({
"email_from": patrol_sender_email,
'subject': 'POD邮件未提取到提单',
'body_html': content,
'email_to': patrol_receiver_emails
# 'email_to': "1663490807@qq.com,820656583@qq.com"
})
mail.send()
for i in range(2):
if mail.failure_reason:
logging.info('邮件发送失败原因:%s' % mail.failure_reason)
mail.write({'state': 'outgoing'})
mail.send()
except Exception as err: except Exception as err:
logging.error('fetch_final_mail_dlv--error:%s' % str(err)) logging.error('fetch_final_mail_dlv--error:%s' % str(err))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论