*** Settings *** Library String Library urllib3 Library Collections Library RequestsLibrary *** Test Cases *** OffsiteOrder #创建厂外收货订单 Create Session ztbf ${ztbClient} ${client_header} ${unitPrice} Evaluate round(random.uniform(${defaultUnitPrice},${highestUnitPrice}),2) random #单价(公斤) ${Number} Evaluate random.randint(00000,99999) random ${plateNumber} Set Variable 粤M${Number} #车牌号 ${equipmentRemark} Set Variable NP-003 #设备 ${ReceiptData} Set Variable { \ \ \ \ "productCategoryInfos":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "productId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "productCategoryName":"${categoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "konePrice":"指导价格:${defaultUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "highestUnitPrice":"${highestUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "lowestUnitPrice":0 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "predictDeliveryToFactoryTime":null, \ \ \ \ "factoryCustomerId":"${OffsiteCustomerId}", \ \ \ \ "factoryCustomerName":"${Offsitename}", \ \ \ \ "plateNumber":"${plateNumber}", \ \ \ \ "driverId":"${enterpriseMemberId}", \ \ \ \ "driverName":"${enterpriseMemberName}" } ${reps} POST On Session ztbf ztb-factory/create/scrap-paper-offsite-receipt-order ${ReceiptData.encode('utf-8')} #外出收货订单列表 ${reps} GET On Session ztbf ztb-factory/get/scrap-paper-offsite-receipt-order-list params=orderStatus=0&orderType=2&pageNum=1&pageSize=15 ${OrderList} Get From Dictionary ${reps.json()['data']} records #订单列表 FOR ${items} IN @{OrderList} ${driverId} Get From Dictionary ${items} driverId #司机id ${OffsiteOrderId} Get From Dictionary ${items} orderId #订单编号 Exit For Loop If '${driverId}'=='${enterpriseMemberId}' END #外出收货订单详情 ${reps} GET On Session ztbf ztb-factory/get/scrap-paper-offsite-receipt-order-detail params=id=${OffsiteOrderId} ${scrapPaperPurchaseOrderId} Get From Dictionary ${reps.json()['data']['productCategoryInfos'][0]} scrapPaperPurchaseOrderId #收货订单id #提交订单 ${offsiteTareWeight} Evaluate random.randint(200,500) random #皮重(公斤) ${offsiteGrossWeight} Evaluate random.randint(500,1500) random #毛重(公斤) ${netWeight} Evaluate ${offsiteGrossWeight}-${offsiteTareWeight} ${ReceiptWeight} Set Variable { \ \ \ \ "scrapPaperReceiptId":"${OffsiteOrderId}", \ \ \ \ "offsiteGrossWeight":"${offsiteGrossWeight}", \ \ \ \ "offsiteTareWeight":"${offsiteTareWeight}", \ \ \ \ "weightNoteList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "grossWeight":null, \ \ \ \ \ \ \ \ \ \ \ \ "tareWeight":null, \ \ \ \ \ \ \ \ \ \ \ \ "weightNoteImage":null, \ \ \ \ \ \ \ \ \ \ \ \ "netWeight":"${netWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "scrapPaperPurchaseOrderId":"${scrapPaperPurchaseOrderId}" \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "orderImageList":[ \ \ \ \ \ \ \ \ "${Image}", \ \ \ \ \ \ \ \ "${Image}", \ \ \ \ \ \ \ \ "${Image}" \ \ \ \ ] } ${reps} POST On Session ztbf ztb-factory/submit/scrap-paper-offsite-receipt-weight-note ${ReceiptWeight.encode('utf-8')} #确认定价 ${OrderPrice} Set Variable { \ \ \ \ "scrapPaperReceiptId":"${OffsiteOrderId}", \ \ \ \ "productCategorySettleInfoDtoList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "productId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "scrapPaperPurchaseOrderId":"${scrapPaperPurchaseOrderId}", \ \ \ \ \ \ \ \ \ \ \ \ "deductWeight":null, \ \ \ \ \ \ \ \ \ \ \ \ "deductPercent":null, \ \ \ \ \ \ \ \ \ \ \ \ "settleUnitPrice":"${unitPrice}" \ \ \ \ \ \ \ \ } \ \ \ \ ] } ${reps} POST On Session ztbf ztb-factory/submit/scrap-paper-offsite-receipt-order-price ${OrderPrice.encode('utf-8')} #刷卡过毛重 ${weight} Set Variable ${offsiteGrossWeight} ${weighData} Set Variable {"cardNo":"${OffsitecardNo}","weight":${weight}} ${reps} POST On Session ztbf ztb-factory/factory-customer/save/order ${weighData.encode('utf-8')} ${orderId} Get From Dictionary ${reps.json()['data']} id #订单id Set Global Variable ${orderId} Should Be Equal As Strings ${reps.json()["message"]} 毛重称重成功,${weight}公斤,请下地磅 #过磅审核通过 ${ReceiptData} Set Variable {"scrapPaperReceiptId":"${OffsiteOrderId}"} ${reps} POST On Session ztbf ztb-factory/renew/scrap-paper-offsite-receipt-order-price ${ReceiptData.encode('utf-8')} #非代付 #获取客户所有未支付订单 ${reps} GET On Session ztbf ztb-factory/get/scrap-paper-offsite-receipt-order-list params=factoryCustomerId=${OffsiteCustomerId}&statusList=4%2C%2042&pageSize=100 ${orderList} Get From Dictionary ${reps.json()['data']} records #客户所有订单列表 ${List} Create List FOR ${items} IN @{orderList} ${orderId} Get From Dictionary ${items} orderId #客户订单id Append To List ${List} ${orderId} END ${str} Convert To String ${List} ${List} Replace String ${str} ' " #支付订单 ${paymentData} Set Variable { \ \ \ \ "settleType":2, \ \ \ \ "ids":${List}} ${reps} POST On Session ztbf ztb-factory/wechat-applet/merge-receiving-pay-order/pay ${paymentData.encode('utf-8')}