Commit 8481cd3a authored by 章 登恒's avatar 章 登恒
Browse files

commit

parent f4e55e56
......@@ -29,6 +29,9 @@ usr3,pwd3 = 'bj_03','Gyxc1234'
usr4,pwd4 = 'bj_04','Gyxc1234'
usr5,pwd5 = 'bj_05','Gyxc1234'
warehousename = '北京强生非WMS仓'#仓库名称
contractnumber = 41007#合同号
salesman = '杨春刚'#业务员名称
productcode = 10156326#商品编码
class LoginSys():
......@@ -49,6 +52,7 @@ class LoginSys():
class PurchaseOrder():
def data_add(self):
chrome.implicitly_wait(10)
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]'))
......@@ -59,8 +63,9 @@ class PurchaseOrder():
sleep(2)
# 获取订单号
orderno = chrome.find_element_by_xpath('//div[text() = "订单号 "]/following-sibling::div/span').text
print(orderno)
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()
......@@ -76,18 +81,92 @@ class PurchaseOrder():
#填写合同信息
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()
'//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(
'38443')
'//input[@placeholder="模糊检索:合同协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码"]').send_keys(
contractnumber)
sleep(1)
chrome.find_element_by_xpath(
'//input[@placeholder="模糊检索:合同号,合同协议号,对方编码,项目名称,项目编码,业态编码,参考部门,参考部门编码,参考业务员,参考业务员编码,产品线名称,产品线编码,合同类型,合同属性"]').send_keys(
'//input[@placeholder="模糊检索:合同协议号,合同号,项目编码,项目名称,业态编码,对方编码,产品线编码"]').send_keys(
Keys.ENTER)
sleep(1)
# chrome.find_element_by_xpath(
# '//div[@class="multiple-header string_col" and text()="38443"]/ancestor-or-self::td/preceding-sibling::td/div/label/span/span').click()
btn_div= chrome.find_element_by_xpath('//span/input[@type="radio" and @value="03992a2172b8f7327a077e60ac1da11b8"]')
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="模糊检索:业务员编码,业务员名称,部门编码,部门名称"]').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="06c32a810e3dabf2a50d1ab040c7951c8"]')
chrome.execute_script("arguments[0].click();", btn_div)
sleep(1)
chrome.find_element_by_xpath('(//span[@class="ensureBtn"]/button[1])[3]').click()
sleep(1)
#其他信息页签
chrome.find_element_by_xpath('//div[text()="其他信息"]').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(
'//div[@class="multiple-header string_col" and text()="38443"]/ancestor-or-self::td/preceding-sibling::td/div/label/span/span').click()
chrome.find_element_by_xpath('(//button[@class="el-button el-button--primary el-button--default"])[3]').click()
'//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]').send_keys(Keys.ENTER)
sleep(2)
chrome.find_element_by_xpath(
'//th[@class="el-table_15_column_199 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(4)
#填写数量价格
for i in range(1):
element = chrome.find_element_by_xpath('(//td[@colid="col_164" 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_171" and @f="F_PURUNIT_TXT" and @i=%s])' % i).click()
sleep(1)
def returnpchno(self):
return orderno1
def closetab(self):
chrome.switch_to.default_content()
sleep(1)
# chrome.switch_to.frame(chrome.find_element_by_xpath('(//iframe[@class="metro-main-frame"])[2]'))
# chrome.switch_to.frame(chrome.find_element_by_xpath('//iframe[contains(@name,"awsui-dialog-iframe")]'))
# chrome.find_element_by_class_name('awsui-tabs-icon close').click()
chrome.find_element_by_xpath('//span[@class="awsui-tabs-icon close"]').click()
def button_click(self,type=1):
if type == 1:
chrome.find_element_by_xpath('//span[text()="保存"]').click()
print('订单保存成功')
else:
chrome.find_element_by_xpath('//span[text()="提交"]').click()
print('订单提交成功')
sleep(10)
self.closetab()
......@@ -98,4 +177,5 @@ if __name__ == '__main__':
step1 = LoginSys()
step2 = PurchaseOrder()
step1.loginsys(SIT_URL,usr2,pwd2)
step2.data_add()
\ No newline at end of file
step2.data_add()
step2.button_click()
\ No newline at end of file
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