纸通宝交易版
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.
 
 

188 lines
13 KiB

*** 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 #代卖费结算方式
${paperCategoryId} Get From Dictionary ${reps.json()["data"]} paperCategoryId #纸厂品类ID
${unitPrice} Get From Dictionary ${reps.json()["data"]} paperCategoryPrice #品类单价
${publicSubsidies} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} publicSubsidies #公开补贴
${millSupplierId} Get From Dictionary ${reps.json()["data"]} millSupplierId #纸厂供应商ID
${paperMillSupplierName} Get From Dictionary ${reps.json()["data"]} paperMillSupplierName #纸厂供应商名称
${settleUtiPrice} Evaluate ${unitPrice}+${publicSubsidies} #结算单价
${contractId} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} contractId #合同id
log ${contractId}
Set Global Variable ${contractId}
Set Global Variable ${unitSurcharge}
Set Global Variable ${paperCategoryId}
Set Global Variable ${settleUtiPrice}
log ${reps.json()}
Set Global Variable ${unitPrice}
Set Global Variable ${publicSubsidies}
Set Global Variable ${millSupplierId}
Set Global Variable ${paperMillSupplierName}
Set Global Variable ${proxySellerSettleType}
Set Global Variable ${contractId}
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
log ${reps.json()}
#@{data} Get From Dictionary ${reps.json()} data
${name} Get From Dictionary ${reps.json()["data"][5]} name #资金来源名称
${id} Get From Dictionary ${reps.json()["data"][5]} id #资金来源id
Set Global Variable ${name}
Set Global Variable ${id}
#FOR ${isDefault} IN @{data}
#${isDefault} Set Variable 1
#Run Keyword If ${isDefault}==1 log ${reps.json()["data"][5]["name"]}
#Set Global Variable ${isDefault}
#\ Run Keyword If '${isDefault}'==5 log @{data}
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}
Set Global Variable ${dataTime}
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 #纸厂补贴是否含税
${receivableSettlementRules} Get From Dictionary ${reps.json()["data"]} settleRules #应收金额结算规则
${settlePriceIncludeTaxSettleRules} Get From Dictionary ${reps.json()["data"]} settlePriceIncludeTaxSettleRules #含税结算单价结算规则
Set Global Variable ${advanceFund}
Set Global Variable ${buyerEnterpriseId}
Set Global Variable ${taxRefundRate}
Set Global Variable ${proxyPaySurcharge}
Set Global Variable ${hasInvoice}
Set Global Variable ${accountPeriodType}
Set Global Variable ${settleRules}
Set Global Variable ${settlePriceIncludeTaxSettleRules}
Set Global Variable ${isSubsidyAndDeductIncludeTax}
Set Global Variable ${receivableSettlementRules}
Set Global Variable ${settlePriceIncludeTaxSettleRules}
Upload_pictures
#上传图片
#${dict} Create Dictionary Content-Type=image/jpeg filename=20210803.jpg
#Create Session ZTBT ${URL} ${dict}
${filepath} Evaluate open('E:/lyl/图片/21042217001449712.png','rb')
${image} Evaluate open('E:/lyl/图片/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}
#${datatime}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/repeat/proxy-order params=orderItemId=${orderItemId}&plateNumber=${carList}&settleWeight=13550&weighingDate=${datatime}&orderType=${orderType}
log ${reps.json()}
Should Be Equal As Strings ${reps.json()["message"]} successful
weightnote
#提交磅单
Create Session ZTBT ${URL} ${header}
${datatime} Get Current Date result_format=%Y-%m-%d
${data} Set Variable { \ \ \ \ "deductedPoint":9.666666666666666, \ \ \ \ "imageUrl":["${pictures}"], \ \ \ \ "orderItemId":"${orderItemId}", \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ "paperCategoryId":"${paperCategoryId}", \ \ \ \ "millSupplierId":"${millSupplierId}", \ \ \ \ "millSupplierName":"${paperMillSupplierName}", \ \ \ \ "settleUtiPriceIncludeTax":2.2677065, \ \ \ \ "settleUtiPriceIncludeTaxType":1, \ \ \ \ "receivableAdjustMoney":"10", \ \ \ \ "refundSubsidy":0.002, \ \ \ \ "adjustMoney":"30", \ \ \ \ "collectionCharges":0, \ \ \ \ "advanceFund":0, \ \ \ \ "contractId":"${contractId}", \ \ \ \ "warehouseName":"${所属仓库}", \ \ \ \ "weightDay":"${datatime}", \ \ \ \ "settleDay":"${datatime}", \ \ \ \ "transactionMainEnterpriseName":"${交易主体}", \ \ \ \ "proxySellerSettleType":"${proxySellerSettleType}", \ \ \ \ "receivableSettlementRules":"${receivableSettlementRules}", \ \ \ \ "isInvoice":"${hasInvoice}", \ \ \ \ "invoicePoint":"${taxRefundRate}", \ \ \ \ "deductionNotes":"2021年8月9号", \ \ \ \ "plateNumber":"${carList}", \ \ \ \ "settlePriceIncludeTaxSettleRules":"${settlePriceIncludeTaxSettleRules}", \ \ \ \ "settleUtiPrice":"${settleUtiPrice}", \ \ \ \ "netWeight":15000, \ \ \ \ "activitySettleType":null, \ \ \ \ "unitSurcharge":"${unitSurcharge}", \ \ \ \ "deliveryImageUrls":[], \ \ \ \ "publicSubsidies":"${publicSubsidies}", \ \ \ \ "isSubsidyAndDeductIncludeTax":1, \ \ \ \ "orderId":"621039556547973120", \ \ \ \ "settleWeight":13550, \ \ \ \ "deductedWeight":1.45, \ \ \ \ "orderType":"${orderType}", \ \ \ \ "otherAmountList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "unitType":1, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":0.001, \ \ \ \ \ \ \ \ \ \ \ \ "title":"freightSubsidies", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":1 \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "unitType":1, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":0.001, \ \ \ \ \ \ \ \ \ \ \ \ "title":"otherSubsidies", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":1 \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "unitType":1, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":0.001, \ \ \ \ \ \ \ \ \ \ \ \ "title":"contrabandPenalty", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":0 \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "unitType":1, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":0.001, \ \ \ \ \ \ \ \ \ \ \ \ "title":"nonStandardPenalty", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":0 \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "unitType":1, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":0.001, \ \ \ \ \ \ \ \ \ \ \ \ "title":"otherPenalty", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":0 \ \ \ \ \ \ \ \ } \ \ \ \ ] \ }
log ${data}
${reps} Post On Session ZTBT recycle-service/admin/proxy-sell/save/weightnote data=${data.encode('utf-8')}
log ${reps.json()["data"]}
${weightNoteId} Get From Dictionary ${reps.json()["data"]} weightNoteId
Set Global Variable ${weightNoteId}
Should Be Equal As Strings ${reps.json()["message"]} successful
audit_weightnote
Create Session ZTBT ${URL} ${header}
${repsonse} Post On Session ZTBT recycle-service/admin/customer-service/audit/weightnote/${weightNoteId}
log ${repsonse.json()}
get_proxy-order
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/proxy-order/${orderId} params=orderId=${orderId}&orderItemId=${orderItemId}
log ${reps.json()}
Should Be Equal As Strings ${reps.json()["message"]} successful