scene4_mainflow.py 16.93 KiB
from testcase.test_scene1.scene1_mainflow import *
SIT_URL = 'http://scdev.cmic.com.cn:8088/beta/'#SIT环境地址
#通行证
usr1,pwd1 = 'bj_01','Gyxc1234'
usr2,pwd2 = 'bj_02','Gyxc1234'
usr3,pwd3 = 'bj_03','Gyxc1234'
usr4,pwd4 = 'bj_04','Gyxc1234'
usr5,pwd5 = 'bj_05','Gyxc1234'
outwarehouse= '103356'#调拨出库仓
inwarehouse= '103396'#调拨入库仓
salesman = '杨春刚'#业务员名称
productcode = 10005528#商品编码
STASHIP_TEMP = 24#启运温度
ARRIVAL_TEMP = 24#到货温度
STASHIP_DATE = '2023-10-01'#启运日期
STASHIP_TIME = '00:00:00'#启运时间
ARRIVAL_TIME = '00:00:00'#启运时间
TRANS_MACHINE = '冷冻车'#运输工具
errmsg4 = '流程四:调拨出库-入库-红冲流程异常,请检查!'#流程异常提示信息
class TransferOut():
    def data_add_allocate(self):
        ###打开调拨出库单###
        wait.until(ec.presence_of_element_located((By.XPATH,'//span[text()="调拨出库单"]')))
        order_link = chrome.find_element_by_xpath('//span[text()="调拨出库单"]')
        chrome.execute_script("arguments[0].click();", order_link)
        chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]'))
        sleep(0.5)
        # 点击新建按钮
        wait.until(ec.visibility_of_element_located((By.XPATH,'//span[text()="新建"]')))
        sleep(0.5)
        chrome.find_element_by_xpath('//span[text()="新建"]').click()
        sleep(4)
        chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
        sleep(2)
        ###获取订单号###
        global orderno1
        orderno1 = chrome.find_element_by_xpath('//div[text() = "调拨出库订单号 "]/following-sibling::div/span').text
        print('调拨出库订单号为:', orderno1)
        #点击业务员名称并输入查询条件,查询出结果
        chrome.find_element_by_xpath(
            '//div[text()="业务员 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
        sleep(1)
        chrome.find_element_by_xpath('//input[@placeholder="模糊检索:业务员名称,业务员编码,部门名称,部门编码,部门类型"]').send_keys(salesman)
        sleep(1)
        chrome.find_element_by_xpath('//input[@placeholder="模糊检索:业务员名称,业务员编码,部门名称,部门编码,部门类型"]').send_keys(Keys.ENTER)
        sleep(1)
        #勾选查询出的业务员并点击确定按钮
        btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="053bd01a610bae0ff25d8a6dca563b2fa"]')
        chrome.execute_script("arguments[0].click();", btn_div)
        sleep(1)
        chrome.find_element_by_xpath('(//span[@class="ensureBtn"]/button[1])').click()
        sleep(1)
        # 切到仓库信息页
        chrome.find_element_by_xpath('//div[text()="仓库信息"]').click()
        sleep(1)
        #点击调拨出库仓库名称,输入仓库名并查询出结果
        chrome.find_element_by_xpath('//div[text()="调拨出库仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click()
        sleep(1)
        chrome.find_element_by_xpath('//input[@placeholder="模糊检索:调拨出库仓库编码,调拨出库仓库名称,是否WMS仓"]').send_keys(outwarehouse)
        chrome.find_element_by_xpath('//input[@placeholder="模糊检索:调拨出库仓库编码,调拨出库仓库名称,是否WMS仓"]').send_keys(Keys.ENTER)
        sleep(1)
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
#勾选查询出的仓库并点击确定按钮 btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="0bc65b238650bc6abf44397198474a21d"]') chrome.execute_script("arguments[0].click();", btn_div) sleep(1) chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click() sleep(1) #点击调拨入库仓库名称,输入仓库名并查询出结果 chrome.find_element_by_xpath('//div[text()="调拨入库仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i').click() sleep(1) chrome.find_element_by_xpath('//input[@placeholder="模糊检索:调拨入库仓库编码,调拨入库仓库名称,是否WMS"]').send_keys(inwarehouse) chrome.find_element_by_xpath('//input[@placeholder="模糊检索:调拨入库仓库编码,调拨入库仓库名称,是否WMS"]').send_keys(Keys.ENTER) sleep(1) #勾选查询出的仓库并点击确定按钮 btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="026f9c1311022a92efbee8ec9597317f3"]') chrome.execute_script("arguments[0].click();", btn_div) sleep(1) chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[2]').click() sleep(1) ###子表信息录入### chrome.find_element_by_xpath('//div[text()="主体信息"]').click() sleep(1) # 点击添加商品并输入商品编码,查询出结果 chrome.find_element_by_xpath('//span[text()="添加商品"]').click() sleep(1) chrome.find_element_by_xpath( '//input[@placeholder="模糊检索:商品编码,商品全称,规格型号,主计量单位,采购计量单位,厂家物料编码,存储条件,存储条件说明,生产企业编码,行类型,件包数,产品备注,产品描述,商品性质,是否免备案"]').send_keys(productcode) sleep(0.5) chrome.find_element_by_xpath( '//input[@placeholder="模糊检索:商品编码,商品全称,规格型号,主计量单位,采购计量单位,厂家物料编码,存储条件,存储条件说明,生产企业编码,行类型,件包数,产品备注,产品描述,商品性质,是否免备案"]').send_keys(Keys.ENTER) sleep(2) # 勾选查询出的商品并点击确定按钮 chrome.find_element_by_xpath( '//th[@class="el-table_15_column_135 multiple-column el-table-column--selection is-leaf headerCellClassName el-table__cell"]/div/label/span/span').click() sleep(0.5) chrome.find_element_by_xpath('(//div[@class="el-dialog__body"]/div[2]/span/button[1]/span)[4]').click() sleep(3) ###填写数量价格### for i in range(1): wait.until(ec.visibility_of_element_located( (By.XPATH, '(//td[@colid="col_108" and @f="F_QUANTITY_ORD" and @i=%s])' % i))) # 定位数量框并输入数量 element = chrome.find_element_by_xpath('(//td[@colid="col_108" and @f="F_QUANTITY_ORD" and @i=%s])' % i) chrome.execute_script("arguments[0].click();", element) sleep(0.5) chrome.find_element_by_class_name('awsui-input-number-right').send_keys('1') sleep(1) # 点击其它地方让数量框失焦,让数量真正填入数量框(平台设计如此,不用纠结为啥要此步) chrome.find_element_by_xpath('(//td[@colid="col_110" and @f="F_PURUNIT_CODE" and @i=%s])' % i).click() sleep(1) def return_sttorder(self): # 返回采购单号 return orderno1 class TransferIn(): def transfer_in(self,orderno): # 打开菜单 order_link = chrome.find_element_by_xpath('//span[text()="调拨入库单"]') chrome.execute_script("arguments[0].click();", order_link) sleep(5) chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]')) sleep(1) # 切换到已办页面 chrome.find_element_by_xpath('//li[text()="已办"]').click() sleep(0.5) wait.until_not(ec.presence_of_element_located((By.CLASS_NAME, 'el-loading-mask')))
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
# 输入orderno并查询出订单 chrome.find_element_by_xpath('//label[text()="调拨出库单号"]/parent::div/div/div/div/input').send_keys(orderno) sleep(0.5) chrome.find_element_by_xpath('//label[text()="调拨出库单号"]/parent::div/div/div/div/input').send_keys(Keys.ENTER) wait.until(ec.presence_of_element_located((By.XPATH, '//div[text()="%s"]'%orderno))) sleep(0.5) #获取调拨入库单 global orderno2 orderno2 = chrome.find_element_by_xpath( '//td[@class="vxe-body--column col_68 col--ellipsis dw-click-cell"]/div/div').text print('调拨入库单号为:', orderno2) status = chrome.find_element_by_xpath('//td[@class="vxe-body--column col_74 col--ellipsis"]/div/div').text assert status == '待收货', f'调拨入库单状态不正确,当前状态为:"{status}",正确状态为"待收货"!' print('调拨入库单自动审核成功,状态为:待收货!') def return_ottorder(self): return orderno2 class Instore1(Instore): def goods_check(self, orderno, type=2): # 仓库验收 # 调用query_click进入表单视图 PurchaseOrder.query_click(self, '仓库验收', orderno, 'vxe-body--column col_19 col--left col--ellipsis dw-click-cell') wait.until(ec.visibility_of_element_located((By.XPATH, '//span[text()="提交"]'))) sleep(1.5) # 浏览器页面右滑 chrome.execute_script( "document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollLeft = 5500") sleep(1) # chrome.execute_script("document.getElementsByClassName('vxe-table--footer-wrapper body--wrapper')[0].scrollLeft = 2000") # chrome.execute_script("document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollTop = %s*30;" % i) # 填写商品信息 for i in range(1): #填写启运温度 chrome.find_element_by_xpath('(//td[@colid="col_185" and @f="F_STASHIP_TEMP" and @i=%s])' % i).click() sleep(0.5) chrome.find_element_by_class_name('el-input__inner').send_keys(STASHIP_TEMP) sleep(0.5) #填写到货温度 chrome.find_element_by_xpath('(//td[@colid="col_186" and @f="F_ARRIVAL_TEMP" and @i=%s])' % i).click() sleep(0.5) chrome.find_element_by_class_name('el-input__inner').send_keys(ARRIVAL_TEMP) sleep(0.5) #填写启运日期 chrome.find_element_by_xpath('(//td[@colid="col_187" and @f="F_STASHIP_DATE" and @i=%s])' % i).click() sleep(0.5) chrome.find_element_by_class_name('el-input__inner').send_keys(STASHIP_DATE) sleep(0.5) #填写启运时间 chrome.find_element_by_xpath('(//td[@colid="col_188" and @f="F_STASHIP_TIME" and @i=%s])' % i).click() sleep(0.5) chrome.find_element_by_class_name('el-input__inner').send_keys(STASHIP_TIME) sleep(0.5) #填写到货时间 chrome.find_element_by_xpath('(//td[@colid="col_190" and @f="F_ARRIVAL_TIME" and @i=%s])' % i).click() sleep(0.5) chrome.find_element_by_class_name('el-input__inner').send_keys(ARRIVAL_TIME) sleep(0.5) #填写运输工具 chrome.find_element_by_xpath('(//td[@colid="col_191" and @f="F_TRANS_MACHINE" and @i=%s])' % i).click() sleep(0.5) # chrome.find_element_by_class_name('el-input__inner').send_keys(TRANS_MACHINE) chrome.find_element_by_xpath('//li[text()="%s"]'%TRANS_MACHINE).click()