纸通宝工厂版
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.
 
 

144 lines
11 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 #纸品最高价格
Set Global Variable ${categoryId}
Set Global Variable ${categoryName}
Set Global Variable ${defaultUnitPrice}
Set Global Variable ${highestUnitPrice}
#获取供应商
${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
${ChannelName} Get From Dictionary ${ChannelInfo} name #客户name
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}
ReceiptOrder
#创建厂内收货订单--手工单
Create Session ztbf ${ztbClient} ${client_header}
${unitPrice} Set Variable 1.8
${netWeight} Set Variable 11000
${settleWeight} Set Variable 11000
${settlePrice} Evaluate ${unitPrice}*${settleWeight}
${data} Set Variable { \ \ \ \ "deductType":1, \ \ \ \ "isWithoutTare":0, \ \ \ \ "status":null, \ \ \ \ "factoryCustomerId":"${CustomerId}", \ \ \ \ "factoryCustomerName":"${name}", \ \ \ \ "netWeight":"${netWeight}", \ \ \ \ "settleWeight":"${settleWeight}", \ \ \ \ "plateNumber":"55555", \ \ \ \ "productInfoList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "productId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "productName":"${categoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "konePrice":"指导价格:${defaultUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "highestUnitPrice":"${highestUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "lowestUnitPrice":0, \ \ \ \ \ \ \ \ \ \ \ \ "settleWeight":"${settleWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "settlePrice":"${settlePrice}" \ \ \ \ \ \ \ \ } \ \ \ \ ] }
${reps} POST On Session ztbf ztb-factory/save/scrap-paper-onside-receipt-order ${data.encode('utf-8')}
${OrderId} Get From Dictionary ${reps.json()} data
Set Global Variable ${OrderId}
#审核过磅单
${auditData} Set Variable {"id":"${OrderId}"}
${reps} POST On Session ztbf ztb-factory/factory/audit-pass/order ${auditData.encode('utf-8')}
#支付订单:现金、银行卡支付
${paymentData} Set Variable {"settleType":2,"ids":["${OrderId}"]}
${reps} POST On Session ztbf ztb-factory/wechat-applet/merge-receiving-pay-order/pay ${paymentData.encode('utf-8')}
${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}'==''
ReceiptWeigh
#厂内收货--刷卡过磅
#获取客户列表
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}
${name} Get From Dictionary ${CustomerInfo} name #客户姓名
${cardNo} Get From Dictionary ${CustomerInfo} cardNo #客户卡ID
${CustomerId} Get From Dictionary ${CustomerInfo} id #客户唯一标识
Exit For Loop If '${CustomerId}'=='136'
END
#刷卡过磅--过毛重
${weight} Set Variable 2410
${weighData} Set Variable {"cardNo":"${cardNo}","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}公斤,请下地磅
#定价详情
${reps} GET On Session ztbf ztb-factory/factory/wechat-applet/get/order-detail/${orderId}
${plateNumber} Get From Dictionary ${reps.json()['data']} plateNumber #车牌号
${isWithoutTare} Get From Dictionary ${reps.json()['data']} isWithoutTare #是否无皮过磅,0否1是
${proportionOfProduct} Get From Dictionary ${reps.json()['data']} proportionOfProduct
${plateNumber} Set Variable If '${plateNumber}'=='${None}' null ${plateNumber}
#确定定价
${unitPrice} Set Variable 1.88
${submitData} Set Variable { \ \ \ \ "id":"${orderId}", \ \ \ \ "productInfoDtoList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "productId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "productName":"${categoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "unitPrice":"2.1", \ \ \ \ \ \ \ \ \ \ \ \ "proportionOfProduct":"${proportionOfProduct}", \ \ \ \ \ \ \ \ \ \ \ \ "konePrice":"指导价格:${defaultUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "highestUnitPrice":"${highestUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "lowestUnitPrice":0 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "plateNumber":${plateNumber}, \ \ \ \ "factoryCustomerId":"${CustomerId}", \ \ \ \ "deductType":1, \ \ \ \ "inspectionRemark":"确定定价", \ \ \ \ "isWithoutTare":"${isWithoutTare}" }
${reps} POST On Session ztbf ztb-factory/factory/submit/order-price ${submitData.encode('utf-8')}
#刷卡过磅--过皮重
${weightTare} Set Variable 2000
${weighData} Set Variable {"cardNo":"${cardNo}","weight":${weightTare}}
${reps} POST On Session ztbf ztb-factory/factory-customer/save/order ${weighData.encode('utf-8')}
${orderId} Get From Dictionary ${reps.json()['data']} id #订单id
Should Be Equal As Strings ${reps.json()["message"]} 皮重称重成功,${weightTare}公斤,正在打印磅单
#过磅审核
${auditData} Set Variable {"id":"${OrderId}"}
${reps} POST On Session ztbf ztb-factory/factory/audit-pass/order ${auditData.encode('utf-8')}
#支付订单--千鸟代付
${paymentData} Set Variable {"settleType":3,"ids":["${OrderId}"]}
${reps} POST On Session ztbf ztb-factory/wechat-applet/merge-receiving-pay-order/pay ${paymentData.encode('utf-8')}
Print_weight_order
#打印磅单
Create Session ztbf ${ztbClient} ${client_header}
${data} Set Variable {"id":"${OrderId}","printType":1}
${reps} POST On Session ztbf ztb-factory/print/weight-order ${data.encode('utf-8')}