diff --git a/003-CreateOrder/Order.robot b/003-CreateOrder/Order.robot new file mode 100644 index 0000000..e8a4e05 --- /dev/null +++ b/003-CreateOrder/Order.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation 拼版下单 +Library urllib3 +Library Collections +Library RequestsLibrary +Library DatabaseLibrary + +*** Test Cases *** +spuDetail + #拼版订单 + #获取spu列表 + Create Session factory ${yytClient} ${ClientHeader} + ${reps} GET On Session factory printing-packaging-factory-service/user/get/all-spu-list params=printingType=2&status=1 + ${records} Get From Dictionary ${reps.json()['data']} records #盒型列表 + FOR ${SPUData} IN @{records} + ${url} Get From Dictionary ${SPUData['imageUrlList'][0]} url #盒型图片 + ${name} Get From Dictionary ${SPUData} name #盒型名称 + ${spuId} Get From Dictionary ${SPUData} id #盒型id + ${orgId} Get From Dictionary ${SPUData} orgId #盒子归属组织id + ${factoryId} Get From Dictionary ${SPUData} factoryId #盒子归属工厂id + Exit For Loop If '${name}'=='内托' + END + Set Global Variable ${name} + Set Global Variable ${spuId} + Set Global Variable ${orgId} + Set Global Variable ${factoryId} + #盒型详情 + ${SPUDetail} Set Variable {"spuId":"${spuId}","basic":true} + ${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail ${SPUDetail.encode('utf-8')} + ${quote} Get From Dictionary ${reps.json()['data']} quote #获取报价基础信息 + ${amount} Get From Dictionary ${quote} amount #获取盒型报价 + ${quantity} Get From Dictionary ${quote} count + #${quantity} evaluate random.choice(['1000','2000','3000','4000','5000']) random #数量随机数:1000~5000 + ${spuDetail} Get From Dictionary ${reps.json()['data']} spuDetail #获取盒型参数信息 + ${productMeasureDesc} Get From Dictionary ${quote} productMeasureDesc #计价尺寸 + ${Long} Set Variable ${productMeasureDesc[0:3]} #截取长 + ${Weight} Set Variable ${productMeasureDesc[4:7]} #截取宽 + ${Material} Evaluate ${Long}*${Weight}/1000000*1.85*${quantity} #材料费 + ${Technology} Evaluate round(${Long}*${Weight}/100*0.00003*${quantity},2) #工艺费 + ${TotalPrice} Evaluate ${Material}+${Technology} #总价 + ${Price} Set Variable If '${TotalPrice}'<='125' 125 ${TotalPrice} #判断是否小于等于低消 + ${spuSpecItemList} Get From Dictionary ${reps.json()['data']['spuDetail']} spuSpecItemList #SPU项参数 + ${Size} Get From List ${spuSpecItemList} 1 #SPU尺寸参数 + #${SpuSizeNormal} #spu正常计价 + #${SpuSizeAttenuation} #spu低消 + #${operateRenderSpuItemList} Set Variable [${SpuSize}] + Should Be Equal ${amount} ${TotalPrice} + Set Global Variable ${quote} + Set Global Variable ${spuDetail} + #Set Global Variable ${operateRenderSpuItemList} + +Quotation + #选择盒型参数-低消 + Create Session factory ${yytClient} ${ClientHeader} + ${spuQotation} Set Variable { \ \ \ \ "spuId":"${spuId}", \ \ \ \ "basic":false, \ \ \ \ "spuDetail":"${spuDetail}", \ \ \ \ "operateRenderSpuItemList":"${operateRenderSpuItemList}" } + ${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail