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

184 lines
20 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
Agent_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 #磅单唯一标识
${saleId} Get From Dictionary ${reps.json()['data']['orderList'][1]} id #销售订单编号
${adjustFee} Get From Dictionary ${reps.json()['data']['orderList'][0]} adjustFee #应付调节费
${purchaseId} Get From Dictionary ${reps.json()['data']['orderList'][0]} id #采购订单编号
${storeOrgId} Get From Dictionary ${reps.json()['data']['reservationOrder']} storeOrgId #店长组织id
${supplyChainId} Get From Dictionary ${reps.json()['data']['reservationOrder']} supplyChainId #采购策略id
${paperMillOrgId} Get From Dictionary ${reps.json()['data']['reservationOrder']} paperMillOrgId #纸厂组织id
${Agent_roleList} Get From Dictionary ${reps.json()['data']['orderList'][0]} roleList #代理商组织类型
${transactionType} Get From Dictionary ${reps.json()['data']} transactionType #订单类型
${Papermill_roleList} Get From Dictionary ${reps.json()['data']['orderList'][1]} roleList #造纸厂织类型
${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.001 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":103, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.001 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":104, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.001 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":102, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.001 \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyName":105, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "strategyType":1011, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":0.001 \ \ \ \ \ \ \ \ \ \ \ \ }
Set Global Variable ${id}
Set Global Variable ${saleId}
Set Global Variable ${DataTime}
Set Global Variable ${adjustFee}
Set Global Variable ${purchaseId}
Set Global Variable ${storeOrgId}
Set Global Variable ${supplyChainId}
Set Global Variable ${paperMillOrgId}
Set Global Variable ${Agent_roleList}
Set Global Variable ${transactionType}
Set Global Variable ${Papermill_roleList}
#采购策略品类信息
${reps} GET On Session order ztb-supply-chain-service/list/scrap-paper-category/by-supply_chain_id params=supplyChainId=${supplyChainId}
${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/get/supply-chain/by-weighting-date-time params=paperMillOrgId=${paperMillOrgId}&storeOrgId=${storeOrgId}&weightingDateTime=${DataTime}&supplyChainInstanceId=${supplyChainInstanceId}
${contractList} Get From Dictionary ${reps.json()['data']} contractList #供应链合同信息
${agent_sellingFee} Get From Dictionary ${contractList[0]['contractTermList'][0]} displayName #代理商代卖费
${agent_sellingName} Get From Dictionary ${contractList[0]['contractTermList'][0]} name #代理商代卖费标识
${agent_sellingType} Get From Dictionary ${contractList[0]['contractTermList'][0]} type #代理商代卖费类型
${agent_sellingValue} Get From Dictionary ${contractList[0]['contractTermList'][0]} value #代理商代卖费数据
${agent_Paymentname} Get From Dictionary ${contractList[0]['contractTermList'][1]} name #代理商付款账期标识
${agent_Paymenttype} Get From Dictionary ${contractList[0]['contractTermList'][1]} type #代理商付款账期类型
${agent_Paymentvalue} Get From Dictionary ${contractList[0]['contractTermList'][1]} value #代理商付款账期数据
${agent_Paymentperiod} Get From Dictionary ${contractList[0]['contractTermList'][1]} displayName #代理商付款账期
${agent_Rebatename} Get From Dictionary ${contractList[0]['contractTermList'][2]} name #代理商返点策略标识
${agent_Rebatetype} Get From Dictionary ${contractList[0]['contractTermList'][2]} type #代理商返点策略类型
${agent_Rebatevalue} Get From Dictionary ${contractList[0]['contractTermList'][2]} value #代理商返点策略数据
${agent_Rebatestrategy} Get From Dictionary ${contractList[0]['contractTermList'][2]} displayName #代理商返点策略
${papermill_Paymentname} Get From Dictionary ${contractList[1]['contractTermList'][0]} name #造纸厂付款账期标识
${papermill_Paymenttype} Get From Dictionary ${contractList[1]['contractTermList'][0]} type #造纸厂付款账期类型
${papermill_Paymentvalue} Get From Dictionary ${contractList[1]['contractTermList'][0]} value #造纸厂付款账期数据
${papermill_Paymentperiod} Get From Dictionary ${contractList[1]['contractTermList'][0]} displayName #造纸厂付款账期
${papermill_Rebatename} Get From Dictionary ${contractList[1]['contractTermList'][1]} name #造纸厂返点策略标识
${papermill_Rebatetype} Get From Dictionary ${contractList[1]['contractTermList'][1]} type #造纸厂返点策略类型
${papermill_Rebatevalue} Get From Dictionary ${contractList[1]['contractTermList'][1]} value #造纸厂返点策略数据
${papermill_Rebatestrategy} Get From Dictionary ${contractList[1]['contractTermList'][1]} displayName #造纸厂返点策略
${agent_Rebatevalue} Set Variable If '${agent_Rebatevalue}'=='${null}' null ${agent_Rebatevalue}
${papermill_Rebatevalue} Set Variable If '${papermill_Rebatevalue}'=='${null}' null ${papermill_Rebatevalue}
${agent_paymentDueDate} Add Time To Date ${DataTime} ${agent_Paymentvalue} days
${agent_paymentDueDate} Get Substring ${agent_paymentDueDate} 0 19 #代理商计划付款时间
${papermill_paymentDueDate} Add Time To Date ${DataTime} ${papermill_Paymentvalue} days
${papermill_paymentDueDate} Get Substring ${papermill_paymentDueDate} 0 19 #造纸厂计划付款时间
#计算订单总金额
Create Session order ${ztbscops} ${ztbsc_header}
${data} Set Variable { \ \ \ \ "netWeight":${netWeight}, \ \ \ \ "calculateContractList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "contractTermList":[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${agent_sellingFee}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${agent_sellingName}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${agent_sellingType}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":"${agent_sellingValue}" \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${agent_Paymentperiod}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${agent_Paymentname}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${agent_Paymenttype}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":${agent_Paymentvalue} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${agent_Rebatestrategy}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${agent_Rebatename}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${agent_Rebatetype}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":${agent_Rebatevalue} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ \ \ \ \ "roleList":${Agent_roleList}, \ \ \ \ \ \ \ \ \ \ \ \ "adjustFee":${reciverble_adjustFee} \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "contractTermList":[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${papermill_Paymentperiod}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${papermill_Paymentname}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${papermill_Paymenttype}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":"${papermill_Paymentvalue}" \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "displayName":"${papermill_Rebatestrategy}", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":${papermill_Rebatename}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":${papermill_Rebatetype}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":"${papermill_Rebatevalue}" \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ \ \ \ \ "roleList":${Papermill_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')}
${salePrice} Get From Dictionary ${reps.json()['data']['calculateContractList'][1]} price #销售单价
${Agent_amount} Get From Dictionary ${reps.json()['data']['calculateContractList'][0]} amount #代理商应付金额
${deductedPoint} Get From Dictionary ${reps.json()['data']} deductedPoint #扣点
${purchasePrice} Get From Dictionary ${reps.json()['data']['calculateContractList'][0]} price #采购单价
${totalDeduction} Get From Dictionary ${reps.json()['data']} totalDeduction #补贴与扣款
${Agent_receivable} Get From Dictionary ${reps.json()['data']['calculateContractList'][1]} amount #代理商应收金额
Set Global Variable ${salePrice}
Set Global Variable ${Agent_amount}
Set Global Variable ${purchasePrice}
Set Global Variable ${deductedPoint}
Set Global Variable ${totalDeduction}
Set Global Variable ${Agent_receivable}
#判断重复订单
${reps} GET On Session order ztb-supply-chain-service/user/get/repeat-order params=id=${id}&plateNumber=${plateNumber}&settlementWeight=11300&weightingDateTime=${DataTime}
Should Be Equal As Strings ${reps.json()['message']} successful
#提交磅单
${weightData} Set Variable { \ \ \ \ "order":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "id":"${purchaseId}", \ \ \ \ \ \ \ \ \ \ \ \ "paymentDueDate":"${agent_paymentDueDate}", \ \ \ \ \ \ \ \ \ \ \ \ "adjustFee":${adjustFee} \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "id":"${saleId}", \ \ \ \ \ \ \ \ \ \ \ \ "paymentDueDate":"${papermill_paymentDueDate}", \ \ \ \ \ \ \ \ \ \ \ \ "adjustFee":${reciverble_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
Order_receivable
#收款管理
Create Session order ${ztbscops} ${ztbsc_header}
${reps} GET On Session order ztb-supply-chain-service/admin/get/receivable-order-page params=status=1&supplyChainInstanceId=${supplyChainInstanceId}&pageNum=1&pageSize=10
${receivableId} Get From Dictionary ${reps.json()['data']['records'][0]} id #收款单唯一标识
${unpaidAmount} Get From Dictionary ${reps.json()['data']['records'][0]} unpaidAmount #未收金额
${payableAmount} Get From Dictionary ${reps.json()['data']['records'][0]} payableAmount #应收金额
#确认收款--收款通过
${receivableData} Set Variable { \ \ \ \ "id":"${receivableId}", \ \ \ \ "unpaidAmount":${unpaidAmount}, \ \ \ \ "unpaidAmountBackup":${unpaidAmount}, \ \ \ \ "payableAmount":${payableAmount}, \ \ \ \ "paidAmount":${payableAmount}, \ \ \ \ "lastPaymentTime":"${DataTime}", \ \ \ \ "remark":"测试收款", \ \ \ \ "bankFlowNo":"${DataTime}" }
${reps} POST On Session order ztb-supply-chain-service/admin/confirm/receivable-order ${receivableData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful