纸通宝工厂版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

113 lines
8.9 KiB

*** Settings ***
Library Collections
Library RequestsLibrary
*** Test Cases ***
getInformation
#获取所有废纸分类
Create Session ztbf ${ztbClient} ${client_header}
${reps} GET On Session ztbf ztb-factory/factory/get/all-product params=pageNum=1&pageSize=100
${records} Get From Dictionary ${reps.json()['data']} records #废纸分类列表
FOR ${items} IN @{records}
${id} Get From Dictionary ${items} id
${name} Get From Dictionary ${items} name
${smallProductCategoryInfoList} Get From Dictionary ${items} smallProductCategoryInfoList
Exit For Loop If '${id}'=='101010101'
END
${CategoryInfo} Evaluate random.choice(${smallProductCategoryInfoList}) random #随机获取品类
${categoryId} Get From Dictionary ${CategoryInfo} id #纸品id
${categoryName} Get From Dictionary ${CategoryInfo} categoryName #纸品name
${defaultUnitPrice} Get From Dictionary ${CategoryInfo} defaultUnitPrice #纸品指导价格
${highestUnitPrice} Get From Dictionary ${CategoryInfo} highestUnitPrice #纸品最高价格
${productcategoryId} Get From Dictionary ${CategoryInfo} categoryId #纸品品类id
Set Global Variable ${categoryId}
Set Global Variable ${categoryName}
Set Global Variable ${defaultUnitPrice}
Set Global Variable ${highestUnitPrice}
Set Global Variable ${productcategoryId}
#获取供应商
${reps} GET On Session ztbf ztb-factory/factory/get/customer-list params=name=&pageNum=1&pageSize=1500
${customerList} Get From Dictionary ${reps.json()['data']} records #供应商列表
${CustomerInfo} Evaluate random.choice(${customerList}) random #随机获取供应商信息
${name} Get From Dictionary ${CustomerInfo} name #供应商姓名
${CustomerId} Get From Dictionary ${CustomerInfo} id #供应商唯一标识
${customerSettleType} Get From Dictionary ${CustomerInfo} customerSettleType
Set Global Variable ${name}
Set Global Variable ${CustomerId}
Set Global Variable ${customerSettleType}
#获取厂外收货供应商列表
Create Session ztbf ${ztbClient} ${client_header}
${reps} GET On Session ztbf ztb-factory/factory/get/customer-list params=name=&pageNum=1&pageSize=1500
${customerList} Get From Dictionary ${reps.json()['data']} records #供应商列表
FOR ${CustomerInfo} IN @{customerList}
${Offsitename} Get From Dictionary ${CustomerInfo} name #供应商姓名
${OffsitecardNo} Get From Dictionary ${CustomerInfo} cardNo #供应商卡ID
${OffsiteCustomerId} Get From Dictionary ${CustomerInfo} id #供应商唯一标识
Exit For Loop If '${OffsiteCustomerId}'=='133'
END
Set Global Variable ${Offsitename}
Set Global Variable ${OffsitecardNo}
Set Global Variable ${OffsiteCustomerId}
#获取客户信息
${reps} GET On Session ztbf ztb-factory/factorydeliverychannel/get/self-factory-delivery-channel-list params=pageNum=1&pageSize=20
${ChannelList} Get From Dictionary ${reps.json()['data']} records #客户列表
${ChannelInfo} Evaluate random.choice(${ChannelList}) random #随机获取客户信息
${ChannelId} Get From Dictionary ${ChannelInfo} id #客户id
${factoryId} Get From Dictionary ${ChannelInfo} factoryId #工厂id
${ChannelName} Get From Dictionary ${ChannelInfo} name #客户name
Set Global Variable ${factoryId}
Set Global Variable ${ChannelId}
Set Global Variable ${ChannelName}
#获取员工
${reps} GET On Session ztbf recycle-user-center/get/self-department-member-list params=enterpriseId=null&isPassFromBackstage=1
${MemberList} Get From Dictionary ${reps.json()['data']} records #获取员工列表
${MemberInfo} Evaluate random.choice(${MemberList}) random #随机获取员工信息
${enterpriseMemberId} Get From Dictionary ${MemberInfo} enterpriseMemberId #企业员工id
${enterpriseMemberName} Get From Dictionary ${MemberInfo} enterpriseMemberName #企业员工name
Set Global Variable ${enterpriseMemberId}
Set Global Variable ${enterpriseMemberName}
#上传图片
${filepath} Evaluate open('./21042217001449712.png','rb')
${image} Evaluate open('./21042217001449712.png','rb')
${file_data} Create Dictionary file=${filepath} image=${image}
${type} Create Dictionary type=image
Create Session order ${ztbClient} ${Header}
${reps} POST On Session order recycle-user-center/file-uploading/upload/image data=${type} files=${file_data}
${Image} Get From Dictionary ${reps.json()} data #获取图片阿里云地址
Set Global Variable ${Image}
OutboundOrder
#出货--手工单
Create Session ztbf ${ztbClient} ${client_header}
${netWeight} Set Variable 5000 #净重(公斤)
${unitPrice} Set Variable 2.02 #单价(元/公斤)
${konePrice} Evaluate ${defaultUnitPrice}*1000 #指导价格
${plateNumber} Set Variable 沪H22222 #车牌号
${estimatedAmount} Evaluate ${netWeight}*${unitPrice}
${OutData} Set Variable { \ \ \ \ "isHandworkOrder":1, \ \ \ \ "estimatedAmount":"${estimatedAmount}", \ \ \ \ "deliveryChannelType":1, \ \ \ \ "factoryDeliveryChannelId":"${ChannelId}", \ \ \ \ "consigneeName":"${ChannelName}", \ \ \ \ "plateNumber":"${plateNumber}", \ \ \ \ "outboundDeliveryOrderProductItemList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "productId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "productName":"${categoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "productCategoryId":"${productcategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "konePrice":"指导价格:${konePrice}", \ \ \ \ \ \ \ \ \ \ \ \ "highestUnitPrice":"${highestUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "lowestUnitPrice":0, \ \ \ \ \ \ \ \ \ \ \ \ "netWeight":"${netWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "settleWeight":null, \ \ \ \ \ \ \ \ \ \ \ \ "deductPercent":null, \ \ \ \ \ \ \ \ \ \ \ \ "estimatedAmount":"${estimatedAmount}" \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "weightNoteImageUrls":[ \ \ \ \ \ ] }
${reps} POST On Session ztbf ztb-factory/save/outbound-delivery-order ${OutData.encode('utf-8')}
#待审核列表
${reps} GET On Session ztbf ztb-factory/get/outbound-delivery-order-list params=pageNum=1&pageSize=15&status=0
${weightNoteList} Get From Dictionary ${reps.json()['data']} records #待审核列表
FOR ${items} IN @{weightNoteList}
${OrderId} Get From Dictionary ${items} id #出货订单id
${productId} Get From Dictionary ${items} productId #纸品id
Exit For Loop If '${productId}'=='${categoryId}'
END
#磅单审核通过
${auditData} Set Variable {"id":"${OrderId}","auditStatus":1}
${reps} POST On Session ztbf ztb-factory/audit/outbount-delivery-order ${auditData.encode('utf-8')}
#待付款列表
${reps} GET On Session ztbf ztb-factory/get/outbound-delivery-order-list params=pageNum=1&pageSize=15&status=1
${deliveryList} Get From Dictionary ${reps.json()['data']} records
FOR ${items} IN @{deliveryList}
${id} Get From Dictionary ${items} id #订单编号
${productItemId} Get From Dictionary ${items['productItemList'][0]} id #订单项编号
Exit For Loop If '${id}'=='${OrderId}'
END
#确认付款
${paperMillNetWeight} Set Variable 13 #纸厂净重(吨)
${deductPercent} Set Variable 2.1 #扣点(%)
${settleWeight} Evaluate ${paperMillNetWeight}-${paperMillNetWeight}*${deductPercent}/1000 #结算重量(吨)
${PayData} Set Variable { \ \ \ \ "id":"${OrderId}", \ \ \ \ "categoryId":"${categoryId}", \ \ \ \ "otherFee":0, \ \ \ \ "subsidy":0, \ \ \ \ "proxyPaySurcharge":0, \ \ \ \ "freight":0, \ \ \ \ "outboundDeliveryOrderProductItemList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "settlementProductId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "id":"${productItemId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillNetWeight":"${paperMillNetWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "settleWeight":"${settleWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "deductPercent":"${deductPercent}", \ \ \ \ \ \ \ \ \ \ \ \ "settleUnitPrice":"${unitPrice}" \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "factoryId":"${factoryId}" }
${reps} POST On Session ztbf ztb-factory/confirm/outbound-delivery-order-receipt ${PayData.encode('utf-8')}