from testcase.test_scene11.scene11_mainflow import *

def test_scene11_mainflow():

    print('\n流程十一：经销商要货-销售-销退流程开始！！！')
    # step1 = LoginSys()
    # step1.loginsys(SIT_URL, usr2, pwd2)

    step2_1 = DealerPurchaseRequisition()
    step2_2 = PurchaseOrder()
    step3 = DivisionPurchase()
    step4 = SalesOrder()
    step5_1 = Outstore()
    step5_2 = Outstore1()
    step6 = SalesReject()
    step7_1 = Instore()
    step7_2 = Instore1()
    step2_2.switch_loggin(usr2,pwd2)
    step2_1.data_add_requisition()
    jyhtorder = step2_1.return_jyhtorder()
    step2_2.button_click1()
    print('经销商要货申请提交成功')
    step2_2.switch_loggin(usr1,pwd1)
    step2_2.query_click('经销商要货申请',jyhtorder,'vxe-body--column col_20 col--center col--ellipsis dw-click-cell','要货申请单号')
    step2_2.button_click2()
    step2_2.switch_loggin(usr2,pwd2)
    step3.divisionpurchase()
    step2_2.closetab()
    step2_2.query_click('销售订单',jyhtorder,'vxe-body--column col_19 col--center col--ellipsis dw-click-cell','要货申请订单号')
    sotorderno = step4.return_sotorderno()
    step4.button_click1(type=3)
    step2_2.switch_loggin(usr1,pwd1)
    step2_2.query_click('销售订单',jyhtorder,'vxe-body--column col_19 col--center col--ellipsis dw-click-cell','要货申请订单号')
    step4.button_click2(msg1='发送成功')
    step2_2.switch_loggin(usr4,pwd4)
    step5_1.deliver_goods(sotorderno)#仓库发货
    step5_1.picking_goods(sotorderno)#仓库拣货
    step2_2.switch_loggin(usr5,pwd5)
    step5_2.outbound_review1(sotorderno)#出库复核
    step2_2.switch_loggin(usr2,pwd2)
    step6.relate_order(sotorderno)#关联原单采退并提交
    sftorderno = step6.return_sftorderno()
    step2_2.switch_loggin(usr1,pwd1)
    step2_2.query_click('销售退货单',sftorderno,'vxe-body--column col_19 col--ellipsis dw-click-cell','销退订单号')
    step4.button_click2(msg1='发送成功')#审批采退单
    step2_2.switch_loggin(usr4,pwd4)
    step7_1.take_over_goods(sftorderno)#仓库收货
    step2_2.switch_loggin(usr5,pwd5)
    step7_2.goods_check(sftorderno,type=3)    #仓库验收
    step2_2.switch_loggin(usr4,pwd4)
    step7_1.goods_grounding(sftorderno)#仓库上架
    print('流程十一：经销商要货-销售-销退流程结束！！！')

