Commit 856f593d authored by 章 登恒's avatar 章 登恒
Browse files

commit

parent 419144b5
import datetime
import logging
import threading
import time
import traceback
......@@ -508,7 +509,25 @@ class Outstore(PurchaseOrder):#出库三步曲
PurchaseOrder.button_click1(self,type,el2='//p[text()="流程结束"]')
print('出库复核成功')
class ExceptionHandling():
def handle(self,errmsg,e):
#获取项目路径
pro_path = get_pro_path()
#截图
imgInfo = getErrorPhoto(chrome)
#获取信息
imgName = imgInfo[0]
image_path = imgInfo[1]
info = errmsg+repr(e)
now = get_time()
# writeFile_append(pro_path + '/logs/logerror%s.txt' % now, info)
#发邮件
send_email1(image_path, info)
#写日志
fmt_str = '%(asctime)s %(thread)d %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=fmt_str, filename=pro_path + '/logs/logerror%s.txt' % now)
logging.error(errmsg)
logging.error(traceback.format_exc())
if __name__ == '__main__':
try:
......@@ -542,17 +561,9 @@ if __name__ == '__main__':
step5.switch_loggin(usr5,pwd5)
step5.outbound_review(rejpurchord)#出库复核
except Exception as e:
print('errmsg')
step6 =ExceptionHandling()
traceback.print_exc()
pro_path = get_pro_path()
imgInfo = getErrorPhoto(chrome)
imgName = imgInfo[0]
image_path = imgInfo[1]
print(imgName, image_path)
print(repr(e))
info = errmsg+repr(e)
now = get_time()
writeFile_append(pro_path + '/logs/logerror%s.txt' % now, info)
send_email1(image_path, info)
step6.handle(errmsg,e)
finally:
chrome.quit()
......@@ -35,7 +35,7 @@ salcust = 1000486
productcode = 10156326#商品编码
productdate = '2023-10-01'#生产日期
expirdate = '2026-09-30'#失效日期
errmsg = '流程三:特一级/经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息
errmsg = '流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'#流程异常提示信息
class QuickPurchase():#快速采购单界面操作
def data_add_quickpurchase(self):#填写表单数据
......@@ -222,14 +222,13 @@ class SalesOrder():
status = chrome.find_element_by_xpath('//td[@class="vxe-body--column col_107 col--ellipsis"]/div/div').text
assert status == '待出库',f'销售订单推送WMS失败,当前状态为:"{status}",正确状态为"待出库"!'
print('销售订单推送WMS成功')
# chrome.execute_script("document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollLeft = 7900")
if __name__ == '__main__':
try:
step1 = LoginSys()
step1 = LoginSys1()
step2_1 = QuickPurchase()
step2_2 = PurchaseOrder()
step3 = SalesOrder()
......@@ -243,18 +242,10 @@ if __name__ == '__main__':
step2_2.button_click2()
step3.push_wms(qkpchno)
except (Exception,AssertionError) as e:
print('errmsg')
step6 =ExceptionHandling()
traceback.print_exc()
pro_path = get_pro_path()
imgInfo = getErrorPhoto(chrome)
imgName = imgInfo[0]
image_path = imgInfo[1]
print(imgName, image_path)
print(repr(e))
info = errmsg+repr(e)
now = get_time()
writeFile_append(pro_path + '/logs/logerror%s.txt' % now, info)
send_email1(image_path, info)
step6.handle(errmsg,e)
finally:
chrome.quit()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment