Ejemplo n.º 1
0
    def cancel_approval(self):
        self.current_case = 'case 1'
        _login = login.Login()
        _login.login(self.userinfo_super['username'],
                     self.userinfo_super['password'],
                     self.userinfo_super['role'])
        self.cookie = _login.cookie
        self.csrf = _login.csrf
        # a =0
        list = []
        for userinfo in self.userinfo_list:
            print(userinfo['username'])
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
            _ApprovalOppo.open_opportunitie_approval()

            _AddOppo = AddOppo.AddOpportunities(self.cookie, self.csrf)
            # 8个用户新增一条商机
            opportunitie_id = _AddOppo.add_opportunities(
                approve_status='applying', DepartmentId=0)
            _ApprovalOppo.cancel_opportunities_approval(opportunitie_id)
            list.append(opportunitie_id)
        print(list)
        a = list
        # a = [1233194, 1233195, 1233196, 1233197, 1233198, 1233199, 1233200, 1233201]

        b = 1
        for userinfo in self.userinfo_list:
            print(userinfo['username'])
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _UpdateOpportunity = UpdateOpportunity.UpdateOpportunities(
                self.cookie, self.csrf)
            for i in range(b):
                for j in range(6):
                    _UpdateOpportunity.add_opportunities_revisit_log(
                        a[b - 1 - i], date_list=self.date_list[j], data='审批撤销')
            b = b + 1
Ejemplo n.º 2
0
    def deny_approval(self):
        self.current_case = 'case 1'
        _login = login.Login()
        _login.login(self.userinfo_super['username'],
                     self.userinfo_super['password'],
                     self.userinfo_super['role'])
        self.cookie = _login.cookie
        self.csrf = _login.csrf
        _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
        _ApprovalOppo.open_opportunitie_approval()
        # a =0
        list = []
        for userinfo in self.userinfo_list:
            print(userinfo['username'])
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _AddOppo = AddOppo.AddOpportunities(self.cookie, self.csrf)
            # 8个用户新增一条关闭审批的商机
            ##添加 审批通过后驳回
            opportunitie_id = _AddOppo.add_opportunities()
            _ApprovalOppo.approve_opportunity(opportunitie_id)
            _ApprovalOppo.deny_opportunities_approval(opportunitie_id)
            list.append(opportunitie_id)
            # print(list)
        a = list
        # a = [1233194, 1233195, 1233196, 1233197, 1233198, 1233199, 1233200, 1233201]

        b = 1
        for userinfo in self.userinfo_list:
            print(userinfo['username'])
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _UpdateOpportunity = UpdateOpportunity.UpdateOpportunities(
                self.cookie, self.csrf)
            for i in range(b):
                for j in range(6):
                    _UpdateOpportunity.add_opportunities_revisit_log(
                        a[b - 1 - i], date_list=self.date_list[j], data='审批驳回')
            b = b + 1
Ejemplo n.º 3
0
    def approvaled(self):
        self.current_case = 'case 1'
        _login = login.Login()
        _login.login(self.userinfo_super['username'],
                     self.userinfo_super['password'],
                     self.userinfo_super['role'])
        self.cookie = _login.cookie
        self.csrf = _login.csrf
        _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
        _ApprovalOppo.close_opportunitie_approval()

        list = []
        for userinfo in self.userinfo_list:
            print(userinfo['username'])
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _AddOppo = AddOppo.AddOpportunities(self.cookie, self.csrf)
            # #8个用户新增一条关闭审批的商机
            #添加 用户1商机
            opportunitie_id = _AddOppo.add_opportunities()
            list.append(opportunitie_id)
            print(list)

        a = list

        b = 1
        for userinfo in self.userinfo_list:
            print(userinfo['username'])
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _UpdateOpportunity = UpdateOpportunity.UpdateOpportunities(
                self.cookie, self.csrf)
            for i in range(b):
                for j in range(6):
                    _UpdateOpportunity.add_opportunities_revisit_log(
                        a[b - 1 - i], date_list=self.date_list[j], data='关闭审批')
            b = b + 1
Ejemplo n.º 4
0
    def case_1(self):
        stage = self.stage
        stage_win = self.stage_win
        self.current_case = 'case 1'
        _login = login.Login()
        a = 0
        _login.login(self.userinfo_super['username'],
                     self.userinfo_super['password'],
                     self.userinfo_super['role'])
        self.cookie = _login.cookie
        self.csrf = _login.csrf
        _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
        _ApprovalOppo.close_opportunitie_approval()

        for userinfo in self.userinfo_list:
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _AddOppo = AddOppo.AddOpportunities(self.cookie, self.csrf)
            _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
            a = a + 1
            for i in range(6):
                if userinfo['username'] == '13799999999' and i >= 3:
                    # if userinfo['username'] == '13660139206' and i >= 3:
                    #添加商机审批关闭 268893为赢单
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        stage=stage_win,
                        DepartmentId=1)
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][1] *
                        (i + 1),
                        stage=stage_win,
                        DepartmentId=1)
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        stage=stage[i],
                        DepartmentId=1)
                else:
                    # 添加商机审批关闭 268893为赢单
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        stage=stage_win)
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][1] *
                        (i + 1),
                        stage=stage_win)
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        stage=stage[i])

        _login.login(self.userinfo_super['username'],
                     self.userinfo_super['password'],
                     self.userinfo_super['role'])
        self.cookie = _login.cookie
        self.csrf = _login.csrf
        _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
        _ApprovalOppo.open_opportunitie_approval()
        a = 0
        for userinfo in self.userinfo_list:
            _login.login(userinfo['username'], userinfo['password'],
                         userinfo['role'])
            self.cookie = _login.cookie
            self.csrf = _login.csrf
            _AddOppo = AddOppo.AddOpportunities(self.cookie, self.csrf)
            _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
            a = a + 1
            for i in range(6):
                if userinfo['username'] == '13799999999' and i >= 3:
                    # if userinfo['username'] == '13660139206' and i >= 3:
                    # 待审批的商机
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        approve_status='applying',
                        stage=stage_win,
                        DepartmentId=1)

                    # 审批通过的商机
                    _ApprovalOppo.approve_opportunity(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win,
                            DepartmentId=1))
                    _ApprovalOppo.approve_opportunity(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][1] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win,
                            DepartmentId=1))
                    _ApprovalOppo.approve_opportunity(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage[i],
                            DepartmentId=1))

                    # 审批通过后否决
                    oppo_id = _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        approve_status='applying',
                        stage=stage_win,
                        DepartmentId=1)
                    _ApprovalOppo.approve_opportunity(oppo_id)
                    _ApprovalOppo.deny_opportunities_approval(oppo_id)

                    # # 审批否决的商机
                    _ApprovalOppo.deny_opportunities_approval(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win,
                            DepartmentId=1))

                    # # 商机撤销
                    _ApprovalOppo.cancel_opportunities_approval(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win,
                            DepartmentId=1))

                else:
                    # 待审批的商机
                    _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        approve_status='applying',
                        stage=stage_win)

                    # 审批通过的商机
                    _ApprovalOppo.approve_opportunity(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win))
                    _ApprovalOppo.approve_opportunity(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][1] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win))
                    _ApprovalOppo.approve_opportunity(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage[i]))

                    # 审批通过后否决
                    oppo_id = _AddOppo.add_opportunities(
                        sign_date=self.sign_date_list[i],
                        total_amount=self.total_amount_list[a - 1][0] *
                        (i + 1),
                        approve_status='applying',
                        stage=stage_win)
                    _ApprovalOppo.approve_opportunity(oppo_id)
                    _ApprovalOppo.deny_opportunities_approval(oppo_id)

                    # # 审批否决的商机
                    _ApprovalOppo.deny_opportunities_approval(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win))

                    # # 商机撤销
                    _ApprovalOppo.cancel_opportunities_approval(
                        _AddOppo.add_opportunities(
                            sign_date=self.sign_date_list[i],
                            total_amount=self.total_amount_list[a - 1][0] *
                            (i + 1),
                            approve_status='applying',
                            stage=stage_win))
Ejemplo n.º 5
0
    def case_1(self):
        self.current_case = 'case 1'
        _login = login.Login()
        _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role'])
        self.cookie =_login.cookie
        self.csrf = _login.csrf
        _ApprovalOppo =ApprovalOppo.Approvals(self.cookie,self.csrf)
        _ApprovalOppo.close_opportunitie_approval()
        # #独立
        # # stage = [268994, 268992, 268991, 268990, 268989, 308555, 308556, 308557, 3085558, 308559, 308560, 308561, '']
        # 钉钉test
        stage = [222996, 222995, 222994, 222993, 222992, 222991, 222990, 308557, 3085558, 308559, 308560, 308561, '']
        stage_win = '222997'
        #钉钉staging
        # stage = [199480, 199479, 199478, 199477, 199476, 199475, 308557, 3085558, 308559, 308560, 308561, '']
        # stage_win = '199481'
        a =0
        for userinfo in self.userinfo_list:
            _login.login(userinfo['username'], userinfo['password'], userinfo['role'])
            print (userinfo['username'])
            self.cookie =_login.cookie
            self.csrf = _login.csrf
            _AddOppo = AddOppo.AddOpportunities(self.cookie,self.csrf)
            _ApprovalOppo =ApprovalOppo.Approvals(self.cookie,self.csrf)
            a= a+1
            for i in range(6):
                if userinfo['username'] == '13799999999' and i >= 3:
                    for b in range(a):
                    #添加商机审批关闭 268893为赢单
                        _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][0] * (i + 1), stage=stage_win,DepartmentId=1)
                    _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][0] * (i + 1), stage=stage[i],DepartmentId=1)
                else:
                    for b in range(a):
                    # 添加商机审批关闭 268893为赢单
                        _AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),stage=stage_win)
                    _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][0] * (i + 1), stage=stage[i])


        _login.login(self.userinfo_super['username'], self.userinfo_super['password'],self.userinfo_super['role'])
        self.cookie = _login.cookie
        self.csrf = _login.csrf
        _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
        _ApprovalOppo.open_opportunitie_approval()
        a = 0
        for userinfo in self.userinfo_list:
            _login.login(userinfo['username'], userinfo['password'], userinfo['role'])
            self.cookie =_login.cookie
            self.csrf = _login.csrf
            _AddOppo = AddOppo.AddOpportunities(self.cookie, self.csrf)
            _ApprovalOppo = ApprovalOppo.Approvals(self.cookie, self.csrf)
            a= a+1
            for i in range(6):
                    if userinfo['username'] == '13799999999' and i >= 3:
                        # 待审批的商机
                        _AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win,DepartmentId=1)
                        _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][0] * (i+1), approve_status='applying',stage=stage[i],DepartmentId=1)
                        for b in range(a):
                        # 审批通过的商机
                            _ApprovalOppo.approve_opportunity(_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win,DepartmentId=1))
                        _ApprovalOppo.approve_opportunity(_AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage[i],DepartmentId=1))
    #
                        # 审批通过后否决
                        oppo_id=_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win,DepartmentId=1)
                        _ApprovalOppo.approve_opportunity(oppo_id)
                        _ApprovalOppo.deny_opportunities_approval(oppo_id)

                        # 审批通过后否决
                        oppo_id = _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],
                                                             total_amount=self.total_amount_list[a - 1][0] * (i + 1),
                                                             approve_status='applying', stage=stage[i], DepartmentId=1)
                        _ApprovalOppo.approve_opportunity(oppo_id)
                        _ApprovalOppo.deny_opportunities_approval(oppo_id)


                        # # 审批否决的商机
                        _ApprovalOppo.deny_opportunities_approval(_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win,DepartmentId=1))
                        _ApprovalOppo.deny_opportunities_approval(_AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage[i],DepartmentId=1))

                        # # 商机撤销
                        _ApprovalOppo.cancel_opportunities_approval(_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win,DepartmentId=1))
                        _ApprovalOppo.cancel_opportunities_approval(_AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage[i],DepartmentId=1))

                    else:
                        # 待审批的商机
                        _AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win)
                        _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][0] * (i+1), approve_status='applying',stage=stage[i])
                        for b in range(a):
                            # 审批通过的商机
                            _ApprovalOppo.approve_opportunity(_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win))
                        _ApprovalOppo.approve_opportunity(_AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage[i]))
    #
                        # 审批通过后否决
                        oppo_id=_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win)
                        _ApprovalOppo.approve_opportunity(oppo_id)
                        _ApprovalOppo.deny_opportunities_approval(oppo_id)

                        oppo_id = _AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][0] * (i + 1),
                                                             approve_status='applying', stage=stage[i])
                        _ApprovalOppo.approve_opportunity(oppo_id)
                        _ApprovalOppo.deny_opportunities_approval(oppo_id)

                        # # 审批否决的商机
                        _ApprovalOppo.deny_opportunities_approval(_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win))
                        _ApprovalOppo.deny_opportunities_approval(_AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage[i]))

                        # # 商机撤销
                        _ApprovalOppo.cancel_opportunities_approval(_AddOppo.add_opportunities(sign_date =self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage_win))
                        _ApprovalOppo.cancel_opportunities_approval(_AddOppo.add_opportunities(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a-1][0]*(i+1),approve_status='applying',stage=stage[i]))