From dd63c7dfe29606a6479e161c18a63647c1322522 Mon Sep 17 00:00:00 2001 From: LG_lai Date: Mon, 23 Oct 2023 15:12:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=8E=E6=B6=88=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 003-CreateOrder/Order.robot | 48 ++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/003-CreateOrder/Order.robot b/003-CreateOrder/Order.robot index e8a4e05..61c1c35 100644 --- a/003-CreateOrder/Order.robot +++ b/003-CreateOrder/Order.robot @@ -4,6 +4,8 @@ Library urllib3 Library Collections Library RequestsLibrary Library DatabaseLibrary +Library JSONLibrary +Library HttpLibrary.HTTP *** Test Cases *** spuDetail @@ -20,6 +22,7 @@ spuDetail ${factoryId} Get From Dictionary ${SPUData} factoryId #盒子归属工厂id Exit For Loop If '${name}'=='内托' END + Set Global Variable ${url} Set Global Variable ${name} Set Global Variable ${spuId} Set Global Variable ${orgId} @@ -32,6 +35,21 @@ spuDetail ${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 #获取盒型参数信息 + ${spuDetail} Update Value To Json ${spuDetail} $..value null #修改value字段key为null + ${spuDetail} Update Value To Json ${spuDetail} $..remark null #修改remark字段key为null + ${spuDetail} Update Value To Json ${spuDetail} $..partNum null #修改partNum字段key为null + ${spuDetail} Update Value To Json ${spuDetail} $..displayName null #修改displayName字段key为null + ${spuDetail} Update Value To Json ${spuDetail} $..spuCategoryName null #修改spuCategoryName字段key为null + ${spuDetail} Update Value To Json ${spuDetail} $..measureFormulaId null #修改measureFormulaId字段key为null + #${spuDetail} Evaluate type(${spuDetail}) + #${spuDetail} + log ${spuDetail} + ${spuCategoryId} Get From Dictionary ${spuDetail} spuCategoryId + ${SpuSize} Get From List ${spuDetail["spuSpecItemList"]} 1 #SPU尺寸参数 + ${SpuMaterial} Get From List ${spuDetail["spuSpecItemList"]} 0 #SPU材质参数 + ${SpuTechnology} Get From List ${spuDetail["spuSpecItemList"]} 2 #SPU工艺参数 + ${spuSpecItemList} Create List + Append To List ${spuSpecItemList} ${SpuMaterial} ${SpuSize} ${SpuTechnology} ${productMeasureDesc} Get From Dictionary ${quote} productMeasureDesc #计价尺寸 ${Long} Set Variable ${productMeasureDesc[0:3]} #截取长 ${Weight} Set Variable ${productMeasureDesc[4:7]} #截取宽 @@ -39,18 +57,32 @@ spuDetail ${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}] + ${SpuSizeNormal} Update Value To Json ${SpuSize} $.value 1-250*300 #spu正常计价 + ${SpuSizeQuotation} Update Value To Json ${SpuSize} $.value 1-166*350 #spu低消计价 + ${Value} Get Value From Json ${spuDetail} $..value + ${remark} Get Value From Json ${spuDetail} $..remark + ${partNum} Get Value From Json ${spuDetail} $..partNum + ${displayName} Get Value From Json ${spuDetail} $..displayName + ${spuCategoryName} Get Value From Json ${spuDetail} $..spuCategoryName + ${measureFormulaId} Get Value From Json ${spuDetail} $..measureFormulaId + #${NormalSpuItemList} Create List + #${QuotationSpuItemList} Create List + #Append To List ${NormalSpuItemList} ${SpuSizeNormal} + #Append To List ${QuotationSpuItemList} ${SpuSizeQuotation} Should Be Equal ${amount} ${TotalPrice} Set Global Variable ${quote} + Set Global Variable ${SpuSize} + Set Global Variable ${SpuMaterial} Set Global Variable ${spuDetail} - #Set Global Variable ${operateRenderSpuItemList} + Set Global Variable ${spuCategoryId} + Set Global Variable ${SpuTechnology} + Set Global Variable ${spuSpecItemList} + #Set Global Variable ${NormalSpuItemList} + #Set Global Variable ${QuotationSpuItemList} + Set Global Variable ${SpuSizeQuotation} 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 + ${spuQotation} Set Variable { \ \ \ \ "spuId":"${spuId}", \ \ \ \ "basic":false, \ \ \ \ "spuDetail":{ \ \ \ \ \ \ \ \ "id":"${spuId}", \ \ \ \ \ \ \ \ "name":"内托", \ \ \ \ \ \ \ \ "orgId":"${orgId}", \ \ \ \ \ \ \ \ "factoryId":"${factoryId}", \ \ \ \ \ \ \ \ "quantity":1000, \ \ \ \ \ \ \ \ "profitRate":0, \ \ \ \ \ \ \ \ "freight":0, \ \ \ \ \ \ \ \ "invoiceTaxPoint":0, \ \ \ \ \ \ \ \ "adjustPaperSeparateCalculation":true, \ \ \ \ \ \ \ \ "service":1, \ \ \ \ \ \ \ \ "printingType":2, \ \ \ \ \ \ \ \ "algorithmType":2, \ \ \ \ \ \ \ \ "spuCategoryId":"${spuCategoryId}", \ \ \ \ \ \ \ \ "spuCategoryName":null, \ \ \ \ \ \ \ \ "imageUrlList":[ \ \ \ \ \ \ \ \ \ \ \ \ "${url}" \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ "spuSpecItemList":"${spuSpecItemList}" \ \ \ \ }, \ \ \ \ "operateRenderSpuItemList":["${SpuSizeQuotation}"] } + ${reps} POST On Session factory printing-packaging-factory-service/user/render/spu-detail ${spuQotation.encode('utf-8')}