纸通宝新交易版
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.
 
 

155 lines
14 KiB

*** Settings ***
Library RequestsLibrary
Library Collections
Library DateTime
Library String
*** Test Cases ***
get_order_list
#获取订单列表
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/get/supply-chain-instance-list params=supplyChainInstanceId=${supplyChainInstanceId}&pageNum=1&pageSize=10
${transactionType} Get From Dictionary ${reps.json()['data']['records'][0]} transactionType #订单类型,1:直卖;2:代卖
Set Global Variable ${transactionType}
confirm_order
#预约送货
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/get/supply-reservation-order-detail params=supplyChainInstanceId=${supplyChainInstanceId}
${id} Get From Dictionary ${reps.json()['data']} id #预约唯一标识
${arrivalTime} Get From Dictionary ${reps.json()['data']} arrivalTime #送货时间
${placeOrderRemark} Get From Dictionary ${reps.json()['data']} placeOrderRemark #订单备注
${paperMillReservationOrderId} Get From Dictionary ${reps.json()['data']} paperMillReservationOrderId #送货单号
${placeOrderRemark} Set Variable If '${placeOrderRemark}'=='${null}' null ${placeOrderRemark}
${paperMillReservationOrderId} Set Variable If '${paperMillReservationOrderId}'=='${null}' null ${paperMillReservationOrderId}
Set Global Variable ${id}
Set Global Variable ${arrivalTime}
Set Global Variable ${placeOrderRemark}
Set Global Variable ${paperMillReservationOrderId}
#预约订单
${data} Set Variable { \ \ \ \ "arrivalTime":"${arrivalTime}", \ \ \ \ "placeOrderRemark":"${placeOrderRemark}", \ \ \ \ "id":"${id}", \ \ \ \ "paperMillReservationOrderId":"${paperMillReservationOrderId}" }
${reps} POST On Session order ztb-supply-chain-service/admin/confirm/supply-reservation-order ${data.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful
sleep 2
Direc_Upload_weight
#上传磅单--直卖
${DataTime} Get Current Date result_format=%Y-%m-%d %H:%M:%S
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/get/order-detail params=supplyChainInstanceId=${supplyChainInstanceId}
${id} Get From Dictionary ${reps.json()['data']} id #磅单唯一标识
${type} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][0]} type #账期类型:常规
${name} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][0]} name #付款账期
${value} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][0]} value #付款账期时常
${orderId} Get From Dictionary ${reps.json()['data']['orderList'][0]} id #采购订单编号
${roleList} Get From List ${reps.json()['data']['orderList'][0]['roleList']} 0 #组织类型
${adjustFee} Get From Dictionary ${reps.json()['data']['orderList'][0]} adjustFee #应付调节费
${RebateType} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][1]} type #返点不开票
${RebateName} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][1]} name #返点策略
${RebateValue} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][1]} value #采购返点
${displayName} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][0]} displayName #付款展示名称
${supplyChainId} Get From Dictionary ${reps.json()['data']['reservationOrder']} supplyChainId #采购策略id
${transactionType} Get From Dictionary ${reps.json()['data']} transactionType #订单类型
${RebateDisplayname} Get From Dictionary ${reps.json()['data']['orderList'][0]['contractTermList'][1]} displayName #返点展示名称
${RebateValue} Set Variable If '${RebateValue}'=='${null}' null ${RebateValue}
${paymentDueDate} Add Time To Date ${DataTime} ${value} days
${paymentDueDate} Get Substring ${paymentDueDate} 0 19
${adjustFee} Evaluate random.randint(1000,2000) random #应付调节费
${reciverble_adjustFee} Evaluate random.randint(1000,2000) random #应收调节费
${netWeight} Evaluate random.randint(15000,23000) random #净重(公斤)
${settlementWeight} Evaluate random.randint(8600,15000) random #结算重量(公斤)
${qualityInspectionSheetDeductionRulesList} Set Variable \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":101, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.002 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":103, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.001 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":104, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.001 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":102, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.002 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":105, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.003 \ \ \ \ \ \ \ \ \ \ \ \ }
Set Global Variable ${id}
Set Global Variable ${type}
Set Global Variable ${name}
Set Global Variable ${value}
Set Global Variable ${orderId}
Set Global Variable ${DataTime}
Set Global Variable ${roleList}
Set Global Variable ${adjustFee}
Set Global Variable ${RebateType}
Set Global Variable ${RebateName}
Set Global Variable ${RebateValue}
Set Global Variable ${displayName}
Set Global Variable ${supplyChainId}
Set Global Variable ${paymentDueDate}
Set Global Variable ${transactionType}
Set Global Variable ${RebateDisplayname}
#采购策略品类信息
${reps} GET On Session order ztb-supply-chain-service/user/list/paper-mill-purchase/scrap-paper-category-price params=supplyChainId=${supplyChainId}&dateTime=${DataTime}
${categorylist} Get From Dictionary ${reps.json()} data #品类列表
${categoryInfo} Evaluate random.choice(${categorylist}) random
${categoryPrice} Get From Dictionary ${categoryInfo} categoryPrice #品类报价
${paperMillCategoryId} Get From Dictionary ${categoryInfo} paperMillCategoryId #品类id
${categoryDisplayName} Get From Dictionary ${categoryInfo} categoryDisplayName #供应链品类展示名称
${paperMillCategoryName} Get From Dictionary ${categoryInfo} paperMillCategoryName #纸厂品类名称
${categoryName} Set Variable If '${transactionType}'==${1} ${paperMillCategoryName} ${categoryDisplayName}
#上传磅单图片
${filepath} Evaluate open('./21042217001449712.png','rb')
${image} Evaluate open('./21042217001449712.png','rb')
${file} Create Dictionary filepath=${filepath} image=${image}
Create Session order ${ztbops}
${reps} POST On Session order recycle-user-center/upload/image files=${file}
${pictures} Get From Dictionary ${reps.json()} data
Should Be Equal As Strings ${reps.json()['message']} successful
Set Global Variable ${pictures}
#选择磅单日期
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/user/list/paper-mill-purchase/scrap-paper-category-price params=supplyChainId=${supplyChainId}&dateTime=${DataTime}
Should Be Equal As Strings ${reps.json()['message']} successful
#计算订单总金额
Create Session order ${ztbscops} ${ztbsc_header}
${data} Set Variable { \ \ \ \ "netWeight":${netWeight}, \ \ \ \ "calculateContractList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "contractTermList":[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${displayName}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${name}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${type}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":"${value}" \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${RebateDisplayname}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${RebateName}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${RebateType}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":${RebateValue} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ \ \ \ \ "roleList":[${roleList}], \ \ \ \ \ \ \ \ \ \ \ \ "adjustFee":${adjustFee} \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "qualityInspectionSheetItem":{ \ \ \ \ \ \ \ \ "settlementWeight":${settlementWeight}, \ \ \ \ \ \ \ \ "unitPrice":"${categoryPrice}" \ \ \ \ }, \ \ \ \ "qualityInspectionSheetDeductionRulesList":[ \ \ \ \ \ \ \ \ ${qualityInspectionSheetDeductionRulesList} \ \ \ \ ] }
${reps} POST On Session order ztb-supply-chain-service/calculate/order-price ${data.encode('utf-8')}
${price} Get From Dictionary ${reps.json()['data']['calculateContractList'][0]} price #采购单价
${amount} Get From Dictionary ${reps.json()['data']['calculateContractList'][0]} amount #应付金额
${deductedPoint} Get From Dictionary ${reps.json()['data']} deductedPoint #扣点
${totalDeduction} Get From Dictionary ${reps.json()['data']} totalDeduction #补贴与扣款
Set Global Variable ${price}
Set Global Variable ${amount}
Set Global Variable ${deductedPoint}
Set Global Variable ${totalDeduction}
#判断重复订单
${reps} GET On Session order ztb-supply-chain-service/user/get/repeat-order params=id=${id}&plateNumber=${plateNumber}&settlementWeight=5000&weightingDateTime=${DataTime}
Should Be Equal As Strings ${reps.json()['message']} successful
#提交磅单
${weightData} Set Variable { \ \ \ \ "order":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "id":"${orderId}", \ \ \ \ \ \ \ \ \ \ \ \ "paymentDueDate":"${paymentDueDate}", \ \ \ \ \ \ \ \ \ \ \ \ "adjustFee":${adjustFee} \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "plateNumber":"${plateNumber}", \ \ \ \ "supplyChainId":"${supplyChainId}", \ \ \ \ "qualityInspectionSheet":{ \ \ \ \ \ \ \ \ "qualityInspectionSheetDeductionRulesList":[ \ \ \ \ \ \ \ \ \ \ \ \ ${qualityInspectionSheetDeductionRulesList} \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ "qualityInspectionSheetItem":{ \ \ \ \ \ \ \ \ \ \ \ \ "paperMillScrapPaperCategoryId":"${paperMillCategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillScrapPaperCategoryName":"${categoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "unitPrice":"${categoryPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "settlementWeight":${settlementWeight} \ \ \ \ \ \ \ \ } \ \ \ \ }, \ \ \ \ "supplyChainInstanceId":"${supplyChainInstanceId}", \ \ \ \ "weightNote":{ \ \ \ \ \ \ \ \ "imageUrlList":[ \ \ \ \ \ \ \ \ \ \ \ \ "${pictures}" \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ "weightingDateTime":"${DataTime}", \ \ \ \ \ \ \ \ "netWeight":${netWeight} \ \ \ \ }, \ \ \ \ "paperMillWeightNoteImageIdList":[ \ \ \ \ \ ] }
${reps} POST On Session order ztb-supply-chain-service/admin/save/weight-note ${weightData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful
sleep 0.5
Order_audit
#订单审核
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/get/supply-order-audit-list params=auditStatus=0&supplyChainInstanceId=${supplyChainInstanceId}&pageNum=1&pageSize=10
${AuditId} Get From Dictionary ${reps.json()['data']['records'][0]} id #审核单唯一标识
Set Global Variable ${AuditId}
#确认审核--审核通过
${auditData} Set Variable { \ \ \ \ "id":"${AuditId}", \ \ \ \ "auditStatus":1 }
${reps} POST On Session order ztb-supply-chain-service/admin/audit/supply-order ${auditData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful
sleep 1
Order_settlement
#订单结算
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/get/payment-order-list params=status=0&supplyChainInstanceId=${supplyChainInstanceId}&pageNum=1&pageSize=10
${settlementId} Get From Dictionary ${reps.json()['data']['records'][0]} id #审核单唯一标识
Set Global Variable ${settlementId}
#确认结算--结算通过
${settlementData} Set Variable { \ \ \ \ "status":1, \ \ \ \ "id":"${settlementId}" }
${reps} POST On Session order ztb-supply-chain-service/admin/audit/payment-order ${settlementData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful
sleep 1
Order_payment
#付款
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/list/scrap-paper-supply-payment-order params=status=1&supplyChainInstanceId=${supplyChainInstanceId}&pageNum=1&pageSize=10
${paymentId} Get From Dictionary ${reps.json()['data']['records'][0]} id #付款单唯一标识
Set Global Variable ${paymentId}
#确认付款--付款通过
${paymentData} Set Variable { \ \ \ \ "dtoList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "id":"${paymentId}", \ \ \ \ \ \ \ \ \ \ \ \ "status":2 \ \ \ \ \ \ \ \ } \ \ \ \ ] }
${reps} POST On Session order ztb-supply-chain-service/admin/operate/payment ${paymentData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful
sleep 2