*** Settings *** Documentation 上传磅单-常规 Test Timeout Library Collections Library RequestsLibrary Library DateTime Library requests *** Variables *** ${header} {'X-APP-ID':'470236309865238555','Authorization':'${gettoken}','Content-Type':'application/json'} ${URL} http://api-ops-ztb-test.qniao.cn *** 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 #订单项编号 ${bizOwnerName} Get From Dictionary ${reps.json()["data"]["records"][0]} bizOwnerName #业务归属人name ${bizOwnerId} Get From Dictionary ${reps.json()["data"]["records"][0]} bizOwnerId #业务归属人id Set Global Variable ${orderItemId} Should Be Equal ${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 #纸厂供应商名称 ${publicSubsidies} Set Variable If '${publicSubsidies}'=='${null}' 0 ${publicSubsidies} ${settleUtiPrice}= Evaluate ${unitPrice}+${publicSubsidies} #结算单价 ${unitSurcharge} Set Variable If '${unitSurcharge}'=='${None}' 0 ${unitSurcharge} ${contractId} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} contractId #合同id #${activitySettleType} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} activitySettleType #活动结算方式(0:70%,1:85%,2:全额) log ${contractId} Set Global Variable ${contractId} Set Global Variable ${unitSurcharge} Set Global Variable ${paperCategoryId} Set Global Variable ${settleUtiPrice} Set Global Variable ${unitPrice} Set Global Variable ${publicSubsidies} Set Global Variable ${millSupplierId} Set Global Variable ${paperMillSupplierName} Set Global Variable ${proxySellerSettleType} Set Global Variable ${contractId} #Set Global Variable ${activitySettleType} get-Transaction subject #获取交易主体 Create Session ZTBT ${URL} ${header} ${reps} Get On Session ZTBT recycle-service/admin/transaction-main-enterprise/list ${交易数据} Get From Dictionary ${reps.json()} data #随机获取交易主体 ${交易信息} Evaluate random.choice(${交易数据}) random log to console \nvalue:${交易信息} ${交易主体id} Get From Dictionary ${交易信息} id #交易主体id ${交易主体name} Get From Dictionary ${交易信息} name #交易主体name Set Global Variable ${交易主体id} Set Global Variable ${交易主体name} 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 FOR ${item} IN @{data} log ${item} ${isDefault} Get From Dictionary ${item} isDefault #获取启用状态 ${name} Get From Dictionary ${item} name #获取name ${id} Get From Dictionary ${item} id #获取id Exit For Loop If '${isDefault}'=='1' END Set Global Variable ${name} Set Global Variable ${id} 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 #含税结算单价结算规则 ${advanceFund} Set Variable If '${advanceFund}'=='${None}' 0 ${advanceFund} ${proxyPaySurcharge} Set Variable If '${proxyPaySurcharge}'=='${None}' 0 ${proxyPaySurcharge} ${taxRefundRate} Set Variable If '${taxRefundRate}'=='${None}' 0 ${taxRefundRate} 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} ${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/repeat/proxy-order params=orderItemId=${orderItemId}&plateNumber=${carList}&settleWeight=17550&weighingDate=${datatime}&orderType=${orderType}&settlePrice= 41953.05 ${records} Get From Dictionary ${reps.json()["data"]} records #获取重复订单列表 ${orderItemId_list} Create List #sleep 0.5 FOR ${items} IN @{records} ${orderItemId} Get From Dictionary ${items} orderItemId #重复订单项编号 Append To List ${orderItemId_list} '''${orderItemId}''' END Should Be Equal As Strings ${reps.json()["message"]} successful Set Global Variable ${orderItemId_list} repeat_proxy-order Create Session ZTBT ${URL} ${header} ${data} Set Variable { \ \ \ \ "orderItemId":"${orderItemId}", \ \ \ \ "remark":"${datatime}", \ \ \ \ "repeatOrderItem":${orderItemId_list} } ${reps} Post On Session ZTBT recycle-service/admin/customer-service/confirm/repeat/proxy-order ${data.encode('utf-8')} weightnote #提交磅单 Create Session ZTBT ${URL} ${header} ${datatime} Get Current Date result_format=%Y-%m-%d ${data} Set Variable { \ \ \ \ "deductedPoint":0, \ \ \ \ "imageUrl":[ \ \ \ \ \ \ \ \ "${pictures}" \ \ \ \ ], \ \ \ \ "orderItemId":"${orderItemId}", \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ "paperCategoryId":"${paperCategoryId}", \ \ \ \ "millSupplierId":"${supplier_id}", \ \ \ \ "millSupplierName":"${millSupplierName}", \ \ \ \ "settleUtiPriceIncludeTax":2.04012, \ \ \ \ "settleUtiPriceIncludeTaxType":1, \ \ \ \ "receivableAdjustMoney":"100", \ \ \ \ "refundSubsidy":0.002, \ \ \ \ "adjustMoney":"0", \ \ \ \ "collectionCharges":"${proxyPaySurcharge}", \ \ \ \ "advanceFund":"${advanceFund}", \ \ \ \ "contractId":"${contractId}", \ \ \ \ "warehouseName":"${所属仓库}", \ \ \ \ "weightDay":"${datatime}", \ \ \ \ "settleDay":"${datatime}", \ \ \ \ "transactionMainEnterpriseId":"${交易主体id}", \ \ \ \ \ "transactionMainEnterpriseName":"${交易主体name}", \ \ \ \ "proxySellerSettleType":"${proxySellerSettleType}", \ \ \ \ "receivableSettlementRules":"${receivableSettlementRules}", \ \ \ \ "isInvoice":"${hasInvoice}", \ \ \ \ "invoicePoint":"${taxRefundRate}", \ \ \ \ "deductionNotes":"${datatime}", \ \ \ \ "plateNumber":"${carList}", \ \ \ \ "settlePriceIncludeTaxSettleRules":"${settlePriceIncludeTaxSettleRules}", \ \ \ \ "settleUtiPrice":"${settleUtiPrice}", \ \ \ \ "netWeight":300, \ \ \ \ "activitySettleType":null, \ \ \ \ "unitSurcharge":"${unitSurcharge}", \ \ \ \ "deliveryImageUrls":[ \ \ \ \ \ ], \ \ \ \ "publicSubsidies":0, \ \ \ \ "isSubsidyAndDeductIncludeTax":0, \ \ \ \ "orderId":"${orderId}", \ \ \ \ "settleWeight":230, \ \ \ \ "deductedWeight":2, \ \ \ \ "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.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