diff --git a/000-Data/0-BaseUrl.robot b/000-Data/0-BaseUrl.robot new file mode 100644 index 0000000..decaa1c --- /dev/null +++ b/000-Data/0-BaseUrl.robot @@ -0,0 +1,34 @@ +*** Settings *** +Library DateTime +Library Collections +Library RequestsLibrary +Library DatabaseLibrary + +*** Test Cases *** +baseUrl + #工厂版baseurl + ${opsztb} Set Variable https://api-ops-ztb-test.qniao.cn #ztb后台系统ops域名 + ${opspsc} Set Variable https://api-ops-psc-test.qniao.cn #ztb后台PSC域名 + ${uecClient} Set Variable https://api-client-uec-test.qniao.cn #uec客户端域名 + ${ztbClient} Set Variable https://api-client-ztb-test.qniao.cn #ztb客户端域名 + Set Global Variable ${opsztb} + Set Global Variable ${opspsc} + Set Global Variable ${uecClient} + Set Global Variable ${ztbClient} + #登录header + ${ops_header} Set Variable {'content-type':'application/json','X-APP-ID':'470236309865238555','Authorization':'Token 6b08add42d6bcf73abb935b2adf83525'} #后台系统header + ${ops_login_header} Set Variable {'content-type':'application/x-www-form-urlencoded','X-APP-ID':'470236309865238555'} #后台系统登录header + ${client_login_header} Set Variable {'content-type':'application/json','X-APP-ID':'503258978847953926'} #客户端登录header + Set Global Variable ${ops_header} + Set Global Variable ${ops_login_header} + Set Global Variable ${client_login_header} + #登录账号 + ${account} Set Variable 15014242835 #客户端登录账号 + ${username} Set Variable laiyonglan@qniao.cn #后台系统登录账号 + Set Global Variable ${account} + Set Global Variable ${username} + #登录密码 + ${captcha} Set Variable 888888 #客户端登录验证码 + ${password} Set Variable qn123456 #后台系统登录密码 + Set Global Variable ${captcha} + Set Global Variable ${password} diff --git a/000-Data/1-ClientLogin.robot b/000-Data/1-ClientLogin.robot new file mode 100644 index 0000000..74c78d4 --- /dev/null +++ b/000-Data/1-ClientLogin.robot @@ -0,0 +1,53 @@ +*** Settings *** +Library urllib3 +Library Collections +Library RequestsLibrary + +*** Test Cases *** +uecLogin + Disable Warnings + Create Session ZTBT ${uecClient} ${client_login_header} + ${data} Create Dictionary account=${account} captcha=${captcha} accountType=2 + ${respones} POST On Session ZTBT uec/authorize/by-captcha json=${data} + ${token} Get From Dictionary ${respones.json()['data']} token + Set Global Variable ${token} + +login_token + #转换业务线token + Create Session login ${ztbClient} ${client_login_header} + #${token} Set Variable iHP4V/g6O5DXHixyNrf7tpO/qkx7j1gsqvbpL1KZGKDiXY1mwnWhhmm5IF9A8sfQJSFGoxXp/OFiB/d1FyzKGg== # + ${loginToken} Set Variable {"loginToken":"${token}"} + ${reps} Post On Session login recycle-user-center/authorize/get/product-line-token/by/login-token ${loginToken.encode('utf-8')} + ${TokenData} Get From Dictionary ${reps.json()} data #业务线token + ${client_firstlogin_header} Set Variable {'Content-Type':'application/json','Authorization':'QNT ${TokenData}','X-APP-ID':'503258978847953926'} #移动端首次登录header + Set Global Variable ${TokenData} + Set Global Variable ${client_firstlogin_header} + +user_info + #获取用户信息 + Create Session login ${ztbClient} ${client_firstlogin_header} + ${reps} GET On Session login recycle-user-center/user/get/user-info + ${userId} Get From Dictionary ${reps.json()['data']} userId #获取用户id + ${mobile} Get From Dictionary ${reps.json()['data']} mobile #获取用户手机号 + ${realName} Get From Dictionary ${reps.json()['data']} realName #获取用户真实姓名 + ${enterpriseInfos} Get From Dictionary ${reps.json()['data']} enterpriseInfos #获取用户所在企业信息 + FOR ${items} IN @{enterpriseInfos} + ${factoryInfos} Get From Dictionary ${items} factoryInfos #企业工厂信息 + ${enterpriseId} Get From Dictionary ${items} enterpriseId #企业id + ${organizationId} Get From Dictionary ${items} organizationId #企业组织id + ${enterpriseName} Get From Dictionary ${items} enterpriseName #企业name + Exit For Loop If '${enterpriseId}'=='738812239011778560' + END + FOR ${factoryInfo} IN @{factoryInfos} + ${factoryId} Get From Dictionary ${factoryInfo} factoryId #工厂id + ${factoryName} Get From Dictionary ${factoryInfo} factoryName #工厂name + Exit For Loop If '${factoryId}'=='738816441691803648' + END + ${client_header} Set Variable {'Content-Type':'application/json','Authorization':'QNT ${TokenData}','X-APP-ID':'503258978847953926','X-FACTORY-ID':'${factoryId}'} + ${Header} Set Variable {'Authorization':'QNT ${TokenData}','X-APP-ID':'503258978847953926','X-FACTORY-ID':'${factoryId}'} + Set Global Variable ${factoryId} + Set Global Variable ${factoryName} + Set Global Variable ${client_header} + Set Global Variable ${organizationId} + Set Global Variable ${enterpriseName} + Set Global Variable ${Header} diff --git a/000-Data/2-OpsLogin.robot b/000-Data/2-OpsLogin.robot new file mode 100644 index 0000000..7ab8935 --- /dev/null +++ b/000-Data/2-OpsLogin.robot @@ -0,0 +1,12 @@ +*** Settings *** +Library urllib3 +Library Collections +Library RequestsLibrary + +*** Test Cases *** +login + #后台系统登录 + Disable Warnings + Create Session ztbf ${opsztb} ${ops_login_header} + ${LoginData} Create Dictionary username=${username} password=${password} + ${reps} POST On Session ztbf recycle-service/admin/login params=${LoginData} diff --git a/001-Client/1-FactoryReceipt.robot b/001-Client/1-FactoryReceipt.robot new file mode 100644 index 0000000..65f772c --- /dev/null +++ b/001-Client/1-FactoryReceipt.robot @@ -0,0 +1,144 @@ +*** 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')} diff --git a/001-Client/2-FactoryOffsite.robot b/001-Client/2-FactoryOffsite.robot new file mode 100644 index 0000000..4a43129 --- /dev/null +++ b/001-Client/2-FactoryOffsite.robot @@ -0,0 +1,128 @@ +*** Settings *** +Library String +Library urllib3 +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} + +OffsiteOrder + #创建厂外收货订单 + Create Session ztbf ${ztbClient} ${client_header} + ${unitPrice} Set Variable 1.66 #单价(公斤) + ${plateNumber} Set Variable 粤M33333 #车牌号 + ${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} Set Variable 500 #皮重(公斤) + ${offsiteGrossWeight} Set Variable 1000 #毛重(公斤) + ${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=${CustomerId}&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')} diff --git a/001-Client/3-FactoryOutbound.robot b/001-Client/3-FactoryOutbound.robot new file mode 100644 index 0000000..026076c --- /dev/null +++ b/001-Client/3-FactoryOutbound.robot @@ -0,0 +1,113 @@ +*** 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')} diff --git a/002-FactoryBackstage/1-PaymentOperation.robot b/002-FactoryBackstage/1-PaymentOperation.robot new file mode 100644 index 0000000..988d3aa --- /dev/null +++ b/002-FactoryBackstage/1-PaymentOperation.robot @@ -0,0 +1,34 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library DateTime + +*** Test Cases *** +PaymentReview + #千鸟代付审核列表 + Create Session ztbf ${opsztb} ${ops_header} + ${reps} GET On Session ztbf ztb-factory/admin/get/agency-payment-order-audit-request-list params=status=&orderId=${orderId}&pageNum=1&pageSize=10 + ${AuditId} Get From Dictionary ${reps.json()['data']['records'][0]} id #代付审核id + #代付审核通过 + ${data} Set Variable { \ \ \ \ "id":"${AuditId}", \ \ \ \ "remark":"", \ \ \ \ "status":1 } + ${reps} POST On Session ztbf ztb-factory/admin/audit/agency-payment-order-audit-request ${data.encode('utf-8')} + +PaymentPayable + #代付应付 + Create Session ztbf ${opspsc} ${ops_header} + ${reps} GET On Session ztbf payment-settlement-center/admin/get/agency-payment-order-payable-list params=status=&pageNum=1&pageSize=10&orderId=${orderId} + ${PayId} Get From Dictionary ${reps.json()['data']['records'][0]} id #代付应付Id + #代付应付通过 + ${PayData} Set Variable { \ \ \ \ "id":"${PayId}", \ \ \ \ "isMergePayment":0, \ \ \ \ "auditStatus":1 } + ${reps} POST On Session ztbf payment-settlement-center/admin/audit/agency-payment-order-payable/${PayId} ${PayData.encode('utf-8')} + +PaymentReceivable + #代付应收 + Create Session ztbf ${opspsc} ${ops_header} + ${reps} GET On Session ztbf /payment-settlement-center/admin/get/agency-payment-order-receivable-list params=status=0&orderId=${orderId}&pageNum=1&pageSize=10 + ${ReceiveId} Get From Dictionary ${reps.json()['data']['records'][0]} id #代付应收id + ${receivablePrice} Get From Dictionary ${reps.json()['data']['records'][0]} receivablePrice #代付应收金额 + #确认收款 + ${Time} get current date result_format=%Y-%m-%d + ${ReceiveData} Set Variable { \ \ \ \ "id":"${ReceiveId}", \ \ \ \ "realReceivedPrice":"${receivablePrice}", \ \ \ \ "realReceivedTime":"${Time}" } + ${reps} POST On Session ztbf payment-settlement-center/admin/comfirm-receive/agency-payment-order-receivable-list ${ReceiveData.encode('utf-8')} diff --git a/21042217001449712.png b/21042217001449712.png new file mode 100644 index 0000000..fba0436 Binary files /dev/null and b/21042217001449712.png differ