from testcase.test_scene1.scene1_mainflow import *


def test_scene1_mainflow():
    print('\n流程一：采购_采退开始！！！')
    step1 = LoginSys()
    step2 = PurchaseOrder()
    step3 = Instore()
    step4 = PurchaseReject()
    step5 = Outstore()
    step1.loginsys(SIT_URL, usr2, pwd2)  # 登录系统
    step2.data_add_purchase()  # 填写表单数据
    step2.button_click1()  # 1为保存，否则为提交
    step2.switch_loggin(usr1, pwd1)  # 切换登录
    step2.approve_order()  # 1为审核通过，否则为审核驳回
    purchord = step2.return_pchno()  # 获取采购订单号
    step3.switch_loggin(usr4, pwd4)
    step3.take_over_goods(purchord)  # 仓库收货：1为收货单据撤回，2为提交，其余为保存
    step3.switch_loggin(usr5, pwd5)
    step3.goods_check(purchord)  # 仓库验收：1为保存，否则为提交
    step3.switch_loggin(usr4, pwd4)
    step3.goods_grounding(purchord)  # 仓库上架：1为保存，否则为提交
    step4.switch_loggin(usr2, pwd2)
    step4.relate_order(purchord)  # 创建采退单1为保存，否则为提交
    rejpurchord = step4.return_rejpchno()  # 获取采退单号
    step4.switch_loggin(usr1, pwd1)
    step4.approve_order(rejpurchord)  # 审核/驳回采退单：type=1为审核通过，否则为审核驳回
    step4.switch_loggin(usr4, pwd4)
    step5.deliver_goods(rejpurchord)  # 仓库发货
    step5.picking_goods(rejpurchord)  # 仓库拣货
    step5.switch_loggin(usr5, pwd5)
    step5.outbound_review(rejpurchord)  # 出库复核
    print('流程一：采购_采退结束！！！')
