*** Settings *** Documentation 上传磅单-一次付款活动 Library DateTime Library RequestsLibrary Library Collections 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()} ${records} Get From Dictionary ${reps.json()["data"]} records #获取订单列表 ${orderItemId_value} Evaluate random.choice(${records}) random #随机获取订单信息 log to console \nvalue: ${orderItemId_value} ${orderItemId} Get From Dictionary ${orderItemId_value} 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} ${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 ${paperMillId} Get From Dictionary ${reps.json()["data"]} paperMillId #纸厂id ${paperCategoryPrice} Get From Dictionary ${reps.json()["data"]} paperCategoryPrice #品类价格 ${publicSubsidies} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} publicSubsidies #公开补贴 ${activitySettleType} Get From Dictionary ${reps.json()["data"]} activitySettleType #活动订单结算方式 ${proxySellerSettleType} Get From Dictionary ${reps.json()["data"]} proxySellerSettleType #代卖费结算方式 ${交易主体id} Get From Dictionary ${reps.json()["data"]} transactionMainEnterpriseId #交易主体id ${交易主体name} Get From Dictionary ${reps.json()["data"]} transactionMainEnterpriseName #交易主体name ${unitSurcharge} Get From Dictionary ${reps.json()["data"]} unitSurcharge #代卖费单价 ${settleUtiPriceIncludeTaxType} Get From Dictionary ${reps.json()["data"]["orderItems"][0]} settleUtiPriceIncludeTaxType #含税补贴类型 ${publicSubsidies} Set Variable If '${publicSubsidies}'=='${null}' 0 ${publicSubsidies} ${settleUtiPrice}= Evaluate ${unitPrice}+${publicSubsidies} #结算单价 ${unitSurcharge} Set Variable If '${unitSurcharge}'=='${None}' 0 ${unitSurcharge} Set Global Variable ${contractId} Set Global Variable ${paperMillId} Set Global Variable ${paperCategoryPrice} Set Global Variable ${publicSubsidies} Set Global Variable ${activitySettleType} Set Global Variable ${proxySellerSettleType} Set Global Variable ${settleUtiPrice} Set Global Variable ${交易主体id} Set Global Variable ${交易主体name} Set Global Variable ${unitSurcharge} Set Global Variable ${settleUtiPriceIncludeTaxType} get_delivery-info #获取订单名片信息 Create Session ZTBT ${URL} ${header} ${reps} Get On Session ZTBT recycle-service/admin/proxy-sell/get/proxy-order/delivery-info/${orderItemId} log ${reps.json()} ${plateNumber} Get From Dictionary ${reps.json()["data"]} plateNumber #车牌号 ${settleUtiPrice} Get From Dictionary ${reps.json()["data"]} settleUtiPrice #结算单价 Set Global Variable ${plateNumber} Set Global Variable ${settleUtiPrice} 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 #垫资费 ${accountPeriod} Get From Dictionary ${reps.json()["data"]} accountPeriod #账期 ${buyerEnterpriseId} Get From Dictionary ${reps.json()["data"]} buyerEnterpriseId #企业id ${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} Set Global Variable ${advanceFund} Set Global Variable ${accountPeriod} Set Global Variable ${buyerEnterpriseId} Set Global Variable ${taxRefundRate} Set Global Variable ${proxyPaySurcharge} Set Global Variable ${hasInvoice} Set Global Variable ${accountPeriodType} Set Global Variable ${settlePriceIncludeTaxSettleRules} Set Global Variable ${isSubsidyAndDeductIncludeTax} Set Global Variable ${receivableSettlementRules} Set Global Variable ${settlePriceIncludeTaxSettleRules} 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-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-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_proxy-order_delivery-info #获取订单名片信息 Create Session ZTBT ${URL} ${header} ${reps} Get On Session ZTBT recycle-service/admin/proxy-sell/get/proxy-order/delivery-info/${orderItemId} log ${reps.json()} ${plateNumber} Get From Dictionary ${reps.json()["data"]} plateNumber #车牌号 ${settleUtiPrice} Get From Dictionary ${reps.json()["data"]} settleUtiPrice #结算单价 Set Global Variable ${plateNumber} Set Global Variable ${settleUtiPrice} 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()} Upload_pictures #上传图片 #${dict} Create Dictionary Content-Type=image/jpeg filename=20210803.jpg #Create Session ZTBT ${URL} ${dict} ${filepath} Evaluate open('E:/lyl/图片/16pic_6879381_b.jpg','rb') ${image} Evaluate open('E:/lyl/图片/16pic_6879381_b.jpg','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=14800&weighingDate=${datatime}&orderType=${orderType}&settlePrice=29466.6 ${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}" \ \ \ \ ], \ \ \ \ "scrapeOrderId":"", \ \ \ \ "orderItemId":"${orderItemId}", \ \ \ \ "unitPrice":"${paperCategoryPrice}", \ \ \ \ "paperCategoryId":"${categoryId}", \ \ \ \ "millSupplierId":"${supplier_id}", \ \ \ \ "millSupplierName":"${millSupplierName}", \ \ \ \ "settleUtiPriceIncludeTax":1.6608157894736841, \ \ \ \ "settleUtiPriceIncludeTaxType":"${settleUtiPriceIncludeTaxType}", \ \ \ \ "receivableAdjustMoney":"30", \ \ \ \ "refundSubsidy":0.002, \ \ \ \ "adjustMoney":"20", \ \ \ \ "collectionCharges":"${proxyPaySurcharge}", \ \ \ \ "advanceFund":"${advanceFund}", \ \ \ \ "transactionMainEnterpriseId":"${交易主体id}", \ \ \ \ "contractId":"${contractId}", \ \ \ \ "warehouseName":"${所属仓库}", \ \ \ \ "weightDay":"${datatime}", \ \ \ \ "settleDay":"${datatime}", \ \ \ \ "transactionMainEnterpriseName":"${交易主体name}", \ \ \ \ "proxySellerSettleType":"${proxySellerSettleType}", \ \ \ \ "receivableSettlementRules":"${receivableSettlementRules}", \ \ \ \ "isInvoice":"${hasInvoice}", \ \ \ \ "invoicePoint":"${taxRefundRate}", \ \ \ \ "deductionNotes":"${datatime}", \ \ \ \ "plateNumber":"${plateNumber}", \ \ \ \ "settlePriceIncludeTaxSettleRules":"${settlePriceIncludeTaxSettleRules}", \ \ \ \ "settleUtiPrice":"${settleUtiPrice}", \ \ \ \ "netWeight":15800, \ \ \ \ "activitySettleType":null, \ \ \ \ "unitSurcharge":"${unitSurcharge}", \ \ \ \ "deliveryImageUrls":[ \ \ \ \ \ ], \ \ \ \ "publicSubsidies":0, \ \ \ \ "orderId":"${orderId}", \ \ \ \ "nonStandardPenalty_car":"", \ \ \ \ "settleWeight":14800, \ \ \ \ "deductedWeight":0, \ \ \ \ "orderType":1, \ \ \ \ "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":2, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":15, \ \ \ \ \ \ \ \ \ \ \ \ "title":"otherPenalty", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":0 \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "unitType":1, \ \ \ \ \ \ \ \ \ \ \ \ "unitAmount":0.001, \ \ \ \ \ \ \ \ \ \ \ \ "title":"nonStandardPenalty", \ \ \ \ \ \ \ \ \ \ \ \ "isSubsidies":0 \ \ \ \ \ \ \ \ } \ \ \ \ ] } log ${data} ${reps} Post On Session ZTBT recycle-service/admin/proxy-sell/save/weightnote ${data.encode('utf-8')} log ${reps.json()} ${weightNoteId} Get From Dictionary ${reps.json()["data"]} weightNoteId #磅单编号 Set Global Variable ${weightNoteId} Should Be Equal As Strings ${reps.json()["message"]} successful Set Global Variable ${datatime} 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