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

100 lines
10 KiB

*** Settings ***
Library Collections
Library RequestsLibrary
*** Test Cases ***
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')}
OutboundDeviceOrder
#出货--刷卡单
#第一次刷卡过磅--皮重
Create Session ztbf ${ztbClient} ${client_header}
${OutFirstWeight} Set Variable 2000
${OutFirstWeightData} Set Variable { \ \ \ \ "cardNo":"${OutCarNo}", \ \ \ \ "weight":"${OutFirstWeight}" }
${reps} POST On Session ztbf ztb-factory/factory-customer/save/order ${OutFirstWeightData.encode('utf-8')}
${OutWeightId} Get From Dictionary ${reps.json()['data']} id #刷卡过磅id
Should Be Equal As Strings ${reps.json()['message']} 第一次过磅成功,${OutFirstWeight}公斤,请下地磅
#绑定磅单图片
${OutFirstBinding} Set Variable { \ \ \ \ "orderId":"${OutWeightId}", \ \ \ \ "imageUrl":"${OutboundImage}", \ \ \ \ "index":"1" }
${reps} POST On Session ztbf /ztb-factory/binding/order-image ${OutFirstBinding.encode('utf-8')}
sleep 0.5
#第二次刷卡过磅--毛重
${OutSecondWeight} Set Variable 4520
${OutSecondWeightData} Set Variable { \ \ \ \ "cardNo":"${OutCarNo}", \ \ \ \ "weight":"${OutSecondWeight}" }
${reps} POST On Session ztbf ztb-factory/factory-customer/save/order ${OutSecondWeightData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} 第二次过磅成功,${OutSecondWeight}公斤,请下地磅
#绑定磅单图片
${OutSecondBinding} Set Variable { \ \ \ \ "orderId":"${OutWeightId}", \ \ \ \ "imageUrl":"${OutboundImage}", \ \ \ \ "index":"1" }
${reps} POST On Session ztbf /ztb-factory/binding/order-image ${OutSecondBinding.encode('utf-8')}
sleep 0.5
#出货列表
${reps} GET On Session ztbf ztb-factory/get/outbound-delivery-order-list params=pageNum=1&pageSize=15
${OutList} Get From Dictionary ${reps.json()['data']} records #出货列表
FOR ${OutInfo} IN @{OutList}
${OutId} Get From Dictionary ${OutInfo} id #出货id
${status} Get From Dictionary ${OutInfo} status #出货订单状态
${factoryId} Get From Dictionary ${OutInfo} factoryId #出货工厂id
${createTime} Get From Dictionary ${OutInfo} createTime #出货订单创建时间
${orderNumber} Get From Dictionary ${OutInfo} orderNumber #出货订单
${weightNoteId} Get From Dictionary ${OutInfo} weightNoteId #出货磅单id
${NetWeight} Get From Dictionary ${OutInfo} outboundDeliveryNetWeight #出货总净重(公斤)
Exit For Loop If '${weightNoteId}'=='${OutWeightId}' #判断订单编号是否相等
END
#确认出货
${unitPrice} Set Variable 2.35 #出货品类单价
${plateNumber} Set Variable 川F66666 #出货车牌号
${estimatedAmount} Evaluate ${unitPrice}*${NetWeight} #预估金额(元)
${defaultUnitPrice} Set Variable ${defaultUnitPrice}*1000 #指导价格
${OutboundOrderData} Set Variable { \ \ \ \ "id":"${OutId}", \ \ \ \ "factoryId":"${factoryId}", \ \ \ \ "operaterId":null, \ \ \ \ "operaterName":null, \ \ \ \ "weightNoteId":"${weightNoteId}", \ \ \ \ "deliveryChannelType":1, \ \ \ \ "consigneeId":null, \ \ \ \ "consigneeName":"${ChannelName}", \ \ \ \ "productId":null, \ \ \ \ "productName":null, \ \ \ \ "packageQuantity":null, \ \ \ \ "status":"${status}", \ \ \ \ "plateNumber":"${plateNumber}", \ \ \ \ "driverName":null, \ \ \ \ "auditorName":null, \ \ \ \ "auditorId":null, \ \ \ \ "createTime":"${createTime}", \ \ \ \ "updadeTime":null, \ \ \ \ "agencySellOrderItemId":null, \ \ \ \ "unitPrice":null, \ \ \ \ "totalEstimatedAmount":0, \ \ \ \ "orderNumber":"${orderNumber}", \ \ \ \ "remark":null, \ \ \ \ "isHandworkOrder":0, \ \ \ \ "salesGuy":null, \ \ \ \ "receiptAddress":null, \ \ \ \ "roleName":null, \ \ \ \ "totalWeight":"${OutFirstWeight}", \ \ \ \ "netWeight":"${NetWeight}", \ \ \ \ "emptyWeight":"${OutSecondWeight}", \ \ \ \ "factoryDeliveryChannelId":"${ChannelId}", \ \ \ \ "estimatedAmount":"${estimatedAmount}", \ \ \ \ "outboundDeliveryOrderProductItemList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "productId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "productName":"${categoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "productCategoryId":"${productcategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "konePrice":"指导价格:${defaultUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "highestUnitPrice":"${highestUnitPrice}", \ \ \ \ \ \ \ \ \ \ \ \ "lowestUnitPrice":0, \ \ \ \ \ \ \ \ \ \ \ \ "settleWeight":null, \ \ \ \ \ \ \ \ \ \ \ \ "deductPercent":null, \ \ \ \ \ \ \ \ \ \ \ \ "estimatedAmount":"${estimatedAmount}", \ \ \ \ \ \ \ \ \ \ \ \ "proportionOfProduct":100 \ \ \ \ \ \ \ \ } \ \ \ \ ] }
${reps} POST On Session ztbf ztb-factory/relevancy/weight-note/and/outbound-delivery-order ${OutboundOrderData.encode('utf-8')}
#出货审核通过
${OutAuditData} Set Variable {"id":"${OutId}","auditStatus":1}
${reps} POST On Session ztbf ztb-factory/audit/outbount-delivery-order ${OutAuditData.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}'=='${OutId}'
END
#确认付款
${paperMillNetWeight} Set Variable 10 #纸厂净重(吨)
${deductPercent} Set Variable 2 #扣点(%)
${settleWeight} Evaluate ${paperMillNetWeight}-${paperMillNetWeight}*${deductPercent}/1000 #结算重量(吨)
${OutPayData} Set Variable { \ \ \ \ "id":"${OutId}", \ \ \ \ "categoryId":"${categoryId}", \ \ \ \ "outboundDeliveryOrderProductItemList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "settlementProductId":"${categoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "id":"${productItemId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillNetWeight":"${paperMillNetWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "settleWeight":"${settleWeight}", \ \ \ \ \ \ \ \ \ \ \ \ "deductPercent":"${deductPercent}", \ \ \ \ \ \ \ \ \ \ \ \ "settleUnitPrice":"${unitPrice}" \ \ \ \ \ \ \ \ } \ \ \ \ ] }
${reps} POST On Session ztbf ztb-factory/confirm/outbound-delivery-order-receipt ${OutPayData.encode('utf-8')}