Browse Source

Order

pull/1/head
赖勇兰 4 years ago
commit
b51286bcef
11 changed files with 404 additions and 0 deletions
  1. 17
      001.robot
  2. 35
      Background_system/New_paper_mill.robot
  3. 134
      Background_system/Upload-weightnote.robot
  4. 59
      Background_system/appointment.robot
  5. 18
      Background_system/contract.robot
  6. 21
      Background_system/weblogin.robot
  7. 36
      Client/APPlogin.robot
  8. 53
      Client/Createorder.robot
  9. 0
      Client/__init__.robot
  10. 28
      Client/factory.robot
  11. 3
      __init__.robot

17
001.robot

@ -0,0 +1,17 @@
*** Variables ***
${num} [1,2,3]
*** Test Cases ***
001
#取列表中的随机数
#${value} Evaluate random.choice(${num}) random
#log to console \nvalue: ${value}
FOR ${var} IN ${num}
\ Exit For Loop If ${var}==2
\ log ${var}
*** Keywords ***
list
[Arguments] ${list}
${value} Evaluate random.choice(${num}) random
log to console \nvalue: ${value}

35
Background_system/New_paper_mill.robot

@ -0,0 +1,35 @@
*** Settings ***
Library RequestsLibrary
Library Collections
*** Variables ***
${header} {'X-APP-ID':'470236309865238555','Authorization':'Token 6b08add42d6bcf73abb935b2adf83525','Content-Type':'application/json'}
${URL} http://api-ops-ztb-test.qniao.cn
*** Test Cases ***
get_paperMill_list
#获取纸厂列表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/paperMill/get/paper-mill-list params=pageNum=1&pageSize=20
log ${reps}
get_regions
#获取区域
paperMill_logo
#上传纸厂logo
#${dict} Create Dictionary Content-Type=image/jpeg filename=20210803.jpg
#Create Session ZTBT ${URL} ${dict}
${filepath} Evaluate open('E:/lyl/pict/20210803.png','rb')
${image} Evaluate open('E:/lyl/pict/20210803.png','rb')
${file} Create Dictionary filepath=${filepath} image=${image}
Create Session ZTBT ${URL}
log ${file}
${result} Post On Session ZTBT recycle-user-center/upload/image files=${file}
${pictures} Get From Dictionary ${result.json()} data
log ${result.content}
Set Global Variable ${pictures}
New_paper_mill
*** Keywords ***

134
Background_system/Upload-weightnote.robot

@ -0,0 +1,134 @@
*** Settings ***
Library Collections
Library RequestsLibrary
Library DateTime
Library requests
*** Variables ***
${header} {'X-APP-ID':'470236309865238555','Authorization':'Token 6b08add42d6bcf73abb935b2adf83525','Content-Type':'application/json'}
${URL} http://api-ops-ztb-test.qniao.cn
${filepath} E:\lyl\图片\ChMkKWCUz0SIX9MmADmjEvANMxkAAOa3QAAAAAAOaMq795.jpg
*** Test Cases ***
get-order-item-list
#查找预约的订单列表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/proxy-order-item-list params=orderType=${orderType} &pageNum=1&pageSize=10&status=51&orderId=${orderId}
log ${reps.json()}
${orderItemId} Get From Dictionary ${reps.json()["data"]["records"][0]} orderItemId #订单项编号
Set Global Variable ${orderItemId}
Should Be Equal As Strings ${reps.json()["data"]["records"][0]["orderId"]} ${orderId}
get-order-item-details
#查看订单列表详情
Create Session ZTBT ${URL} ${header}
#${data} Set Variable orderId=${orderId} orderItemId=${orderItemId}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/proxy-order/${orderId} params=orderId=${orderId}&orderItemId=${orderItemId}
${contractId} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} contractId #当前订单下单时的合同id
${unitSurcharge} Get From Dictionary ${reps.json()["data"]} unitSurcharge #代卖费
${proxySellerSettleType} Get From Dictionary ${reps.json()["data"]} proxySellerSettleType #代卖费结算方式
log ${contractId}
Set Global Variable ${contractId} ${unitSurcharge}
log ${reps.json()}
get-Transaction subject
#获取交易主体
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/transaction-main-enterprise/list/name
${交易} Get From Dictionary ${reps.json()} data
#随机获取交易主体
${交易主体} Evaluate random.choice(${交易}) random
log to console \nvalue:${交易主体}
Set Global Variable ${交易主体}
get-Warehouse
#获取所属仓库
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/transaction-main-enterprise/get/warehouse-name
${仓库} Get From Dictionary ${reps.json()} data
#随机获取仓库
${所属仓库} Evaluate random.choice(${仓库}) random
log to console \nvalue:${所属仓库}
Set Global Variable ${所属仓库}
get-Source of funds
#获取资金来源
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/fund-source/get/list
${isDefault} Set Variable 1
Run Keyword If ${isDefault}==1 log ${reps.json()["data"][5]["name"]}
Set Global Variable ${isDefault}
get-contract-list
#获取订单纸厂的所有合同信息
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT /recycle-service/admin/contract/get/selectable-contract-list params=orderItemId=${orderItemId}
log ${reps.json()}
get-supplier
#获取纸厂供应商
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/paper-mill-merchant/${paperMillId} params=paperMillId=${paperMillId}
log ${reps.json()}
get-category price
#获取下单品类,上传磅单时的价格
Create Session ZTBT ${URL} ${header}
${dataTime} Get Current Date result_format=%Y-%m-%d
${reps} Get On Session ZTBT recycle-service/admin/proxy-sell/get-category-price-by-date params=orderItemId=${orderItemId}&weightDay=${dataTime}
log ${reps.json()}
${price} Get From Dictionary ${reps.json()["data"][0]} price #下单品类价格
${publicSubsidies} Get From Dictionary ${reps.json()["data"][0]} publicSubsidies #下单品类公开补贴
Set Global Variable ${price}
Set Global Variable ${publicSubsidies}
get_paper-mill-category
#获取当前纸厂的所有纸品品类
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/paperMill/get/paper-mill-category/${paperMillId} params=id=${paperMillId}
log ${reps.json()}
get_contract_by_id
#获取下单时绑定的合同
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/contract/get/detail-by-id params=id=${contractId}
log ${reps.json()}
#获取垫资费、企业ID、应收金额结算规则、含税结算单价结算规则
${advanceFund} Get From Dictionary ${reps.json()["data"]} advanceFund #垫资费
${buyerEnterpriseId} Get From Dictionary ${reps.json()["data"]} buyerEnterpriseId #企业id
${settleRules} Get From Dictionary ${reps.json()["data"]} settleRules #应收金额结算规则
${settlePriceIncludeTaxSettleRules} Get From Dictionary ${reps.json()["data"]} settlePriceIncludeTaxSettleRules #含税结算单价结算规则
${taxRefundRate} Get From Dictionary ${reps.json()["data"]} taxRefundRate #税点
${proxyPaySurcharge} Get From Dictionary ${reps.json()["data"]} proxyPaySurcharge #代收费
${hasInvoice} Get From Dictionary ${reps.json()["data"]} hasInvoice #是否开票
${accountPeriodType} Get From Dictionary ${reps.json()["data"]} accountPeriodType #账期类型
${isSubsidyAndDeductIncludeTax} Get From Dictionary ${reps.json()["data"]} isSubsidyAndDeductIncludeTax #纸厂补贴是否含税
Set Global Variable ${advanceFund} ${taxRefundRate} ${proxyPaySurcharge} ${hasInvoice} ${accountPeriodType} ${settleRules} ${settlePriceIncludeTaxSettleRules}
Set Global Variable ${buyerEnterpriseId} ${isSubsidyAndDeductIncludeTax}
Upload_pictures
#上传图片
#${dict} Create Dictionary Content-Type=image/jpeg filename=20210803.jpg
#Create Session ZTBT ${URL} ${dict}
${filepath} Evaluate open('E:/lyl/pict/21042217001449712.png','rb')
${image} Evaluate open('E:/lyl/pict/21042217001449712.png','rb')
${file} Create Dictionary filepath=${filepath} image=${image}
Create Session ZTBT ${URL}
log ${file}
${result} Post On Session ZTBT recycle-user-center/upload/image files=${file}
${pictures} Get From Dictionary ${result.json()} data
log ${result.content}
Set Global Variable ${pictures}
get_repeat_proxy-order
#获取重复订单信息
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/repeat/proxy-order params=orderItemId=${orderItemId}&plateNumber=${plateNumber}&settleWeight=9000&weighingDate=${datatime}&orderType=${orderType}
log ${reps.json()}
Should Be Equal As Strings ${reps.json()["message"]} successful
Submit_pound
#提交磅单
Create Session ZTBT ${URL} ${header}
${data} Set Variable
${reps} Post On Session ZTBT

59
Background_system/appointment.robot

@ -0,0 +1,59 @@
*** Settings ***
Library RequestsLibrary
Library Collections
Library DateTime
*** Variables ***
${header} {'X-APP-ID':'470236309865238555','Authorization':'Token 6b08add42d6bcf73abb935b2adf83525','Content-Type':'application/json'}
${URL} http://api-ops-ztb-test.qniao.cn
*** Test Cases ***
reservation-list
#${header} Create Dictionary X-APP-ID=470236309865238555 Authorization=Token 6b08add42d6bcf73abb935b2adf83525
#获取预约列表信息
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
${reps_data} Get On Session ZTBT recycle-service/admin/customer-service/get/paper-mill-order-reservation-list params=pageNum=1&pageSize=20&status=
log ${reps_data.json()}
#获取订单编号${orderId}、纸厂id${paperMillId}、订单类型${orderType}
${orderId} Get From Dictionary ${reps_data.json()["data"]["records"][0]} orderId #订单编号
${paperMillId} Get From Dictionary ${reps_data.json()["data"]["records"][0]} paperMillId #纸厂id
${id} Get From Dictionary ${reps_data.json()["data"]["records"][0]} id #预约id
${orderType} Get From Dictionary ${reps_data.json()["data"]["records"][0]} orderType #订单类型
${carNoList} Get From Dictionary ${reps_data.json()["data"]["records"][0]} carNoList #车辆信息
${paperMillName} Get From Dictionary ${reps_data.json()["data"]["records"][0]} paperMillName #纸厂名称
${sellerReservationDate} Get From Dictionary ${reps_data.json()["data"]["records"][0]} sellerReservationDate #送货时间
#随机获取车辆信息
${carList} Evaluate random.choice(${carNoList}) random
log to console \nvalue:${carList}
Should Be Equal As Strings ${reps_data.json()["message"]} successful
Set Global Variable ${orderId} ${paperMillId} ${id} ${paperMillName} ${sellerReservationDate} ${orderType} ${carList}
get-factory-list
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
${reps} Get On Session ZTBT recycle-service/admin/paperMill/get/paper-mill-list params=pageNum=1&pageSize=20&name=
${id} Get From Dictionary ${reps.json()["data"]["records"][0]} id
log ${id}
Set Suite Variable ${id}
get-supplier
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/paper-mill-merchant/${paperMillId} params=paperMillId=${paperMillId}
log ${reps.json()}
#获取供应商id和name
${data} Get From Dictionary ${reps.json()} data
${value} Evaluate random.choice(${data}) random
log to console \nvalue: ${value}
${supplier_id} Get From Dictionary ${value} id #供应商id
${millSupplierName} Get From Dictionary ${value} name #供应商名称
Set Suite Variable ${supplier_id}
Set Suite Variable ${millSupplierName}
Submit-appointment
#${headers} Create Dictionary Content-Type=application/json X-APP-ID=470236309865238555 Authorization=Token 6b08add42d6bcf73abb935b2adf83525
#提交预约信息
Create Session ZTBT ${URL} ${header}
${datatime} get current date result_format=%Y-%m-%d
${data} Set Variable {"attention":"${orderId}","buyerReservationDate":"${datatime}", "id":"${id}","millDeliveryOrderId":"${orderId}","millSupplierId":"${supplier_id}","millSupplierName":"${millSupplierName}","proxySellerSettleType":1,"scrapeOrderId":"${orderId}"}
log ${data}
${reps} Post On Session ZTBT recycle-service/admin/customer-service/update/reservation ${data.encode('utf-8')}
Should Be Equal As Strings ${reps.json()["message"]} successful

18
Background_system/contract.robot

@ -0,0 +1,18 @@
*** Settings ***
Library DateTime
Library Collections
Library RequestsLibrary
*** Variables ***
${URL} http://api-ops-ztb-test.qniao.cn
${header} {'X-APP-ID':'470236309865238555','Authorization':'Token 6b08add42d6bcf73abb935b2adf83525','Content-Type':'application/json'}
*** Test Cases ***
get_contract_list
#获取合同列表
Create Session ZTBT ${URL} ${header}
${response} Get On Session ZTBT recycle-service/admin/contract/get/page-list params=pageNum=1&pageSize=20&status=1
log ${response.json()}
get_contract_by_paperMilldName
#通过纸厂查找合同

21
Background_system/weblogin.robot

@ -0,0 +1,21 @@
*** Settings ***
Library RequestsLibrary
*** Test Cases ***
pwlogin
${header} Create Dictionary Content-Type=application/x-www-form-urlencoded X-APP-ID=470236309865238555
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
&{data} Create Dictionary username=laiyonglan@qniao.cn password=qn123456
log ${data}
${reps} Post On Session ZTBT recycle-service/admin/login data=${data}
log ${reps.json()}
${gettoken} Set Variable Token 6b08add42d6bcf73abb935b2adf83525
Should Be Equal As Strings ${reps.json()["message"]} 登陆成功
Set Global Variable ${gettoken}
login-info
${header} Create Dictionary X-APP-ID=470236309865238555 Authorization=Token 6b08add42d6bcf73abb935b2adf83525
Create Session login-info http://api-ops-ztb-test.qniao.cn ${header}
${reps_data} Get On Session login-info recycle-service/admin/employee/get/login-info
log ${reps_data}
Should Be Equal As Strings ${reps_data.json()["message"]} successful

36
Client/APPlogin.robot

@ -0,0 +1,36 @@
*** Settings ***
Suite Setup
Library RequestsLibrary
Library Collections
*** Variables ***
${header} {'content-type':'application/json','X-APP-ID':'470236309865238528'}
*** Test Cases ***
userlogin
[Setup]
#验证码登录
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT http://api-client-uec-test.qniao.cn ${header}
${data} Create Dictionary account=15014242835 captcha=888888 accountType=2
${respones} POST On Session ZTBT /uec/authorize/by-captcha json=${data}
log ${respones.status_code}
log ${respones.json()}
#${gettoken} Get From Dictionary ${respones.json()["data"]} token
#log ${respones.json()["data"]["token"]}
#Set Global Variable ${gettoken}
[Teardown]
login-token
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT http://api-client-ztb-test.qniao.cn ${header}
${token} Create Dictionary loginToken=d6SX3ESr8Jb2tYq/89Ft7Il1BXlAwuqExhT0SidZaW5Qvn46CGIPL5/MAlzIPOqJCEf163PPtJkxGAlYXRd5Fg==
${reps} Post On Session ZTBT recycle-user-center/authorize/get/product-line-token/by/login-token json=${token}
${gettoken} Get From Dictionary ${reps.json()["data"]} token
log ${reps.json()["data"]["token"]}
Set Global Variable ${gettoken}
getuserinfo
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session userinfo https://api-client-uec-test.qniao.cn ${header}
${reps} Get On Session userinfo /uec/get/user-info

53
Client/Createorder.robot

@ -0,0 +1,53 @@
*** Settings ***
Library RequestsLibrary
Library Collections
Library DateTime
*** Variables ***
${header} {'content-type':'application/json','X-APP-ID':'470236309865238528'}
*** Test Cases ***
get-factorylist
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session factorylist http://api-client-ztb-test.qniao.cn ${header}
${reps} Get On Session factorylist recycle-service/get/paper-mill-paper-category-price-list params=cityId=&enableSalesAgent=1&pageNum=1&pageSize=10&listType=0
#log ${reps.json()}
#Set Global Variable ${reps}
Should Be Equal As Strings ${reps.json()["message"]} successful
log ${reps.json()["data"]["records"]}
${categoryid} Get From Dictionary ${reps.json()["data"]["records"][0]["paperCategoryList"][1]} categoryId #纸厂品类id
${unitPrice} Get From Dictionary ${reps.json()["data"]["records"][0]["paperCategoryList"][1]} unitPrice #纸厂品类价格
Set Global Variable ${categoryid} ${unitPrice}
get-carinfo
#获取使用过的车辆信息
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session get-carinfo http://api-client-ztb-test.qniao.cn ${header}
${reps} Get On Session get-carinfo recycle-service/proxy-sell/get/his-car-info
log ${reps.json()}
${carNumber} Get From Dictionary ${reps.json()["data"]} records
${plateNumber1} Evaluate random.choice(${carNumber}) random
log to console \nvalue:${plateNumber1}
${plateNumber} Get From Dictionary ${plateNumber1} plateNumber #车辆信息
Set Global Variable ${plateNumber}
choose-factory
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session choose-factory https://api-client-ztb-test.qniao.cn ${header}
${reps} Get On Session choose-factory recycle-service/get/paper-mill-paper-category-price-details/612629674392162304
log ${reps.json()["data"]}
Should Be Equal As Strings ${reps.json()["message"]} successful
createorder
#下单
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=QNT ${gettoken}
${datatime} get current date result_format=%Y-%m-%d
log ${datatime}
${data} Set Variable {"paperCategoryId":"${categoryid}" ,"unitPrice":${unitPrice},"totalEstimatedWeight":30000,"customerName":"赖勇兰","deliveryTime":"${datatime}","carInfos":[{"plateNumber":"${plateNumber}"}]}
log ${data}
Create Session createorder http://api-client-ztb-test.qniao.cn ${header}
${reps} Post On Session createorder recycle-service/proxy-sell/create/order ${data.encode('utf-8')}
log ${reps.json()}
Should Be Equal As Strings ${reps.json()["message"]} successful
Set Global Variable ${datatime}
#sleep 10

0
Client/__init__.robot

28
Client/factory.robot

@ -0,0 +1,28 @@
*** Settings ***
Library RequestsLibrary
Library Collections
*** Variables ***
${header} {'Content-Type': 'application/json','X-APP-ID':'503258978847953924'}
*** Test Cases ***
login
${header} Create Dictionary Content-Type=application/json X-APP-ID=503258978847953924
Create Session ZTBF http://api-client-uec-test.qniao.cn ${header}
${data} Create Dictionary account=13517986787 captcha=888888 accountType=2
log ${data}
#${data} Set Variable {"account":"13517986787","accountType":2,"captcha":"888888","signType":1,"sign":"c2d5ef09b96575e04503461af4bc7044","signStr":"{\"account\":\"13517986787\",\"accountType\":2,\"captcha\":\"888888\",\"signType\":1}"}
${respones} POST On Session ZTBF /uec/authorize/by-captcha json=${data}
${gettoken} Get From Dictionary ${respones.json()["data"]} token
Set Global Variable ${gettoken}
login-token
${header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847953924 Authorization=QNT ${gettoken}
Create Session ZTB https://api-client-ztb-test.qniao.cn ${header}
${data} Set Variable {"loginToken":"iHP4V/g6O5DXHixyNrf7tiEqeqolNkEcjrvrx0L2SEViRwIt3pF89Av3SPmQ/4DDkNTf2tJix8dVTigIo/0C2A==","signType":1,"sign":"485c081cb954d1fd6d448c939e9f5b1d","signStr":"{\"loginToken\":\"iHP4V/g6O5DXHixyNrf7tiEqeqolNkEcjrvrx0L2SEViRwIt3pF89Av3SPmQ/4DDkNTf2tJix8dVTigIo/0C2A==\",\"signType\":1}"}
${respones} POST On Session ZTB recycle-user-center/authorize/get/product-line-token/by/login-token ${data}
员工管理
${header} Create Dictionary X-APP-ID=503258978847953924 X-FACTORY-ID=615992051053498368 Authorization=QNT ${gettoken}
Create Session ZTBF https://api-client-ztb-test.qniao.cn ${header}
${reps} Get On Session ZTBF recycle-user-center/get/self-department-role-list

3
__init__.robot

@ -0,0 +1,3 @@
*** Settings ***
Suite Setup
Library RequestsLibrary
Loading…
Cancel
Save