纸通宝新交易版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

86 lines
5.1 KiB

*** Settings ***
Documentation \#移动端下单
Library String
Library DateTime
Library urllib3
Library Collections
Library RequestsLibrary
*** Test Cases ***
get_paper-mill-city
#获取纸厂所在城市
Create Session ZTBT ${ztbclient} ${client_headerT}
${reps} Get On Session ZTBT ztb-supply-chain-service/user/get/paper-mill/city-list
${data} Get From Dictionary ${reps.json()} data #城市列表
FOR ${items} IN @{data}
${cityId} Get From Dictionary ${items} id #城市id
${cityName} Get From Dictionary ${items} name #城市name
Exit For Loop If '${cityName}'=='长沙市'
END
Set Global Variable ${cityId}
get_papermill_list
#获取纸厂交易列表
Create Session papermilllist ${ztbclient} ${client_headerT}
${reps} Get On Session papermilllist ztb-supply-chain-service/user/packer/get/paper-mill-list params=cityId=${cityId}&enableSalesAgent=1&pageNum=1&pageSize=20&listType=0
Should Be Equal As Strings ${reps.json()["message"]} successful
${records} Get From Dictionary ${reps.json()["data"]} records #获取代卖纸厂列表
FOR ${item} IN @{records}
${address} Get From Dictionary ${item} address #获取纸厂地址
${paperMillId} Get From Dictionary ${item} id #获取纸厂id
${papermillname} Get From Dictionary ${item} name #获取纸厂name
${cumulativeWeight} Get From Dictionary ${item} cumulativeWeight #累计已代卖吨数
${paperCategoryList} Get From Dictionary ${item} paperCategoryList #获取纸厂品类列表
Exit For Loop If '${paperMillId}'=='723518259730714624'
END
${value} Evaluate random.choice(${paperCategoryList}) random
${categoryid} Get From Dictionary ${value} id #纸厂品类id
${categoryName} Get From Dictionary ${value} name #纸厂品类name
${quotedPrice} Get From Dictionary ${value} quotedPrice #纸厂品类价格
Set Global Variable ${categoryid}
Set Global Variable ${quotedPrice}
Set Global Variable ${paperMillId}
Set Global Variable ${categoryName}
Set Global Variable ${papermillname}
get-carinfo
#获取使用过的车辆信息
Create Session get-carinfo ${ztbclient} ${client_headerT}
${reps} Get On Session get-carinfo ztb-supply-chain-service/user/get/supply-reservation-order-org-vehicle-info-record-list
${carNumber} Set Variable ${reps.json()['data']} #获取车辆列表
${plateNumber1} Evaluate random.choice(${carNumber}) random
#log to console \nvalue:${plateNumber1}
${plateNumber} Get From Dictionary ${plateNumber1} plateNumber #车辆信息
Set Global Variable ${plateNumber}
financial_service_provider
#支付渠道--直卖
Create Session order ${ztbclient} ${client_headerT}
${reps} GET On Session order ztb-supply-chain-service/user/get/paper-mill-financial-service-provider-list params=paperMillId=${paperMillId}&paperMillCategoryId=${categoryid}&taxPoint=2051
${serviceId} Get From Dictionary ${reps.json()['data'][0]} id #采购策略id
Set Global Variable ${serviceId}
createorder
#提交下单
${datatime} get current date result_format=%Y-%m-%d
#${DT} Add Time To Date ${datatime} -1 day
#${str} Get Substring ${DT} 0 10
${data} Set Variable { \ \ \ \ "paperMillId":"${paperMillId}", \ \ \ \ "paperMillScrapPaperCategoryId":"${categoryid}", \ \ \ \ "estimatedCategoryPrice":"${quotedPrice}", \ \ \ \ "estimatedTotalVolume":30000, \ \ \ \ "paperMillFinancialServiceProviderId":"${serviceId}", \ \ \ \ "customerName":"${realName}", \ \ \ \ "arrivalTime":"${datatime}", \ \ \ \ "plateNumbers":[ \ \ \ \ \ \ \ \ "${plateNumber}" \ \ \ \ ], \ \ \ \ "salesTaxPoint":${salesTaxPoint}}
log ${data}
Create Session createorder ${ztbclient} ${client_headerT}
${reps} Post On Session createorder ztb-supply-chain-service/user/create/supply-reservation-order ${data.encode('utf-8')}
Should Be Equal As Strings ${reps.json()["message"]} successful
Set Global Variable ${datatime}
sleep 1
order_list
#获取订单列表
Create Session orderlist ${ztbclient} ${client_headerT}
${reps} GET On Session orderlist ztb-supply-chain-service/get/packer/order-list params=status=&pageNum=1&pageSize=15
${orderlist} Get From Dictionary ${reps.json()['data']} records #组织交易订单列表
FOR ${item} IN @{orderlist}
${plateNumber1} Get From Dictionary ${item['packerOrderList'][0]} plateNumber #获取订单车牌号
${supplyChainInstanceId} Get From Dictionary ${item['packerOrderList'][0]} supplyChainInstanceId #获取物流编号
Exit For Loop If '${plateNumber1}'=='${plateNumber}'
END
Set Global Variable ${supplyChainInstanceId}