def testApproval_contract_one(self): print('=====') self.Login.login("13701649176", "111111", "1234") self.Login.get_csrf_by_home_html() self.cookie = self.Login.cookie self.csrf = self.Login.csrf Approval = ContractApproval.ContractApproval( self.cookie, self.csrf) Approval.open_contract_approval() Approval.open_first_approval("specified", 'editable', '3674') testAddContract = AddContract.AddContract( self.cookie, self.csrf) id = testAddContract.add_applying_contract()
def testApproval_one(self): print('=====') self.Login.login("18049903011", "Ik123456", "1234") self.Login.get_csrf_by_home_html() self.cookie = self.Login.cookie self.csrf = self.Login.csrf Approval = ContractApproval.ContractApproval(self.cookie, self.csrf) approval_role_first = [ 'superior', 'specified', 'specified_jointly', 'previous_superior' ] Approval.close_contract_approval() for i in range(len(approval_role_first)): if approval_role_first[i] == 'previous_superior': continue else: Approval.open_contract_approval() Approval.open_first_approval(approval_role_first[i], 'editable', '3971') testAddContract = AddContract.AddContract( self.cookie, self.csrf) id = testAddContract.add_applying_contract() testAddContract.contract_approval_two(id) def testApproval_contract_one(self): print('=====') self.Login.login("13701649176", "111111", "1234") self.Login.get_csrf_by_home_html() self.cookie = self.Login.cookie self.csrf = self.Login.csrf Approval = ContractApproval.ContractApproval( self.cookie, self.csrf) Approval.open_contract_approval() Approval.open_first_approval("specified", 'editable', '3674') testAddContract = AddContract.AddContract( self.cookie, self.csrf) id = testAddContract.add_applying_contract()
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 _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ContractsApproval.close_contract_approval() a = 0 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 _AddContract = AddContract.AddContract(self.cookie, self.csrf) _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _DeleteContracts = DeleteContract.DeleteContract( self.cookie, self.csrf) # contracts_list =_DeleteContracts.get_contract_ids() # print (contracts_list) a = a + 1 for i in range(6): if userinfo['username'] == '13799999999' and i >= 3: # print(i) # print(a) #添加合同 _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), DepartmentId=1) _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][1] * (i + 1), DepartmentId=1) #添加草稿 _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), DepartmentId=1, approve_status='draft') _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][1] * (i + 1), DepartmentId=1, approve_status='draft') else: # print(i) # print(a) # 添加合同 _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1)) _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][1] * (i + 1)) # 添加草稿 _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='draft') _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][1] * (i + 1), approve_status='draft') _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ContractsApproval.open_contract_approval() 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 _AddContract = AddContract.AddContract(self.cookie, self.csrf) _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) a = a + 1 for i in range(6): if userinfo['username'] == '13799999999' and i >= 3: # 待审批的合同 _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying', DepartmentId=1) # _AddContract.add_contracts(sign_date=self.sign_date_list[i], # total_amount=self.total_amount_list[a - 1][1] * (i + 1), # approve_status='applying',DepartmentId=1) # 审批通过的合同 _ContractsApproval.verify_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying', DepartmentId=1)[0]) _ContractsApproval.verify_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][1] * (i + 1), approve_status='applying', DepartmentId=1)[0]) # 审批通过后否决 contracts_id = _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying', DepartmentId=1)[0] _ContractsApproval.verify_contracts(contracts_id) print(_AddContract.contracts_id) _ContractsApproval.deny_contracts(contracts_id) # 审批否决的合同 _ContractsApproval.deny_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying', DepartmentId=1)[0]) # 合同撤销 _ContractsApproval.cancel_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying', DepartmentId=1)[0]) else: # 待审批的合同 _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying') # _AddContract.add_contracts(sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a-1][1]*(i+1),approve_status='applying') # 审批通过的合同 _ContractsApproval.verify_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying')[0]) _ContractsApproval.verify_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][1] * (i + 1), approve_status='applying')[0]) # 审批通过后否决 contracts_id = _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying')[0] _ContractsApproval.verify_contracts(contracts_id) print(_AddContract.contracts_id) _ContractsApproval.deny_contracts(contracts_id) # contracts_id=_AddContract.add_contracts(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][1] * (i + 1),approve_status='applying')[0] # _ContractsApproval.verify_contracts(contracts_id) # _ContractsApproval.deny_contracts(contracts_id) # 审批否决的合同 _ContractsApproval.deny_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying')[0]) # _ContractsApproval.deny_contracts(_AddContract.add_contracts(sign_date=self.sign_date_list[i],total_amount=self.total_amount_list[a - 1][1] * (i + 1),approve_status='applying')[0]) # 合同撤销 _ContractsApproval.cancel_contracts( _AddContract.add_contracts( sign_date=self.sign_date_list[i], total_amount=self.total_amount_list[a - 1][0] * (i + 1), approve_status='applying')[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 _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ContractsApproval.close_contract_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 _AddContract = AddContract.AddContract(self.cookie, self.csrf) _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _DeleteContracts = DeleteContract.DeleteContract( self.cookie, self.csrf) # contracts_list =_DeleteContracts.get_contract_ids() a = a + 1 for i in range(6): q1 = a q2 = a p1 = 15 * (i + 1) p2 = 10 * (i + 1) if userinfo['username'] == '13799999999' and i >= 3: # 添加合同 _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q2], price_list=[p1, p1], approve_status='approved', DepartmentId=1) _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g3, g2], quantity_list=[q2, q2], price_list=[p2, p2], approve_status='approved', DepartmentId=1) # #添加草稿 _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q2], price_list=[p1, p1], approve_status='draft', DepartmentId=1) else: #添加合同 _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q2], price_list=[p1, p1], approve_status='approved') _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g3, g2], quantity_list=[q2, q2], price_list=[p2, p2], approve_status='approved') #添加草稿 _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='draft') _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ContractsApproval.open_contract_approval() 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 _AddContract = AddContract.AddContract(self.cookie, self.csrf) _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) a = a + 1 for i in range(6): q1 = a q2 = a p1 = 15 * (i + 1) p2 = 10 * (i + 1) if userinfo['username'] == '13799999999' and i >= 3: # 待审批的合同 _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g1], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying', DepartmentId=1) # 审批通过的合同 _ContractsApproval.verify_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g3], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='approved', DepartmentId=1)) _ContractsApproval.verify_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g3, g2], quantity_list=[q1, q2], price_list=[p1, p2], approve_status='approved', DepartmentId=1)) # # 审批通过后否决 contracts_id = _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g1], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying', DepartmentId=1) _ContractsApproval.verify_contracts(contracts_id) _ContractsApproval.deny_contracts(contracts_id) # 审批否决的合同 _ContractsApproval.deny_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g3], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying', DepartmentId=1)) # 合同撤销 _ContractsApproval.cancel_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying', DepartmentId=1)) else: # 待审批的合同 _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying') # 审批通过的合同 _ContractsApproval.verify_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g3], quantity_list=[q1, q2], price_list=[p1, p2], approve_status='approved')) _ContractsApproval.verify_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g3, g2], quantity_list=[q1, q2], price_list=[p1, p2], approve_status='approved')) # 审批通过后否决 contracts_id = _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying') _ContractsApproval.verify_contracts(contracts_id) _ContractsApproval.deny_contracts(contracts_id) # 审批否决的合同 _ContractsApproval.deny_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g3], quantity_list=[q1, q1], price_list=[p1, p1], approve_status='applying')) # 合同撤销 _ContractsApproval.cancel_contracts( _AddContract.add_contracts_products_add( sign_date=self.sign_date_list[i], goods_id_list=[g1, g2], quantity_list=[q1, q2], price_list=[p1, p2], approve_status='applying'))
def add_data(self, a, DepartmentId): _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _AddReceivedPayments = AddReceivedPayments.AddReceivedPayment( self.cookie, self.csrf) _AddContract = AddContract.AddContract(self.cookie, self.csrf) #合同审批通过后,回款审批通过(P1-2) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.verify_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同审批通过后,回款审批否决(P1-3) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.verify_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同审批通过后,回款待审批(P1-4) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.verify_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 合同审批通过后,回款审批否决(P1-5) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') # id[0]为合同id id[1]为客户id _ContractsApproval.verify_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录通过后驳回 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]))) # 合同待审批,回款审批通过(P2-2) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同待审批,回款审批驳回(P2-3) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同待审批,回款待审批(P2-4) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 合同待审批,回款通过后驳回(P2-5) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') # id[0]为合同id id[1]为客户id for i in range(6): # 添加新增回款记录通过后驳回 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]))) # 合同否决,回款审批通过(P3-2) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.deny_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同否决,回款审批否决(P3-3) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.deny_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同否决,回款待审批(P3-4) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.deny_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 合同否决,回款通过后驳回(P3-5) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.deny_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录通过后驳回 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]))) # 合同撤销,回款审批通过(P4-2) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.cancel_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同撤销,回款审批否决(P4-3) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.cancel_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 合同撤销,回款待审批(P4-4) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.cancel_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 合同撤销,回款通过后驳回(P4-5) # 添加一个待审批的合同 contract_return_id = _AddContract.add_contracts( DepartmentId=DepartmentId, approve_status='applying') _ContractsApproval.cancel_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录通过后驳回 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])))
def case_1(self): self.current_case = 'case 1' _login = login.Login() a = 0 # # 超管登录 关闭合同回款审批,新增回款=================================== # _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) #关闭合同审批和回款审批 _ContractsApproval.close_contract_approval() _ReceivedPaymentApproval.close_received_payment_approval() for userinfo in self.userinfo_list: _login.login(userinfo['username'], userinfo['password'], userinfo['role']) self.cookie = _login.cookie self.csrf = _login.csrf _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _AddReceivedPayments = AddReceivedPayments.AddReceivedPayment( self.cookie, self.csrf) _AddContract = AddContract.AddContract(self.cookie, self.csrf) a = a + 1 # 添加一个合同 if userinfo['username'] == '13799999999': # 新增合同后返回的合同id和客户id:contract_return_id[0]为合同id contract_return_id[1]为客户id # 用户6--合同所属部门:设计部 contract_return_id = _AddContract.add_contracts(DepartmentId=1) for i in range(6): _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) #用户6--合同所属部门:产品部 contract_return_id = _AddContract.add_contracts(DepartmentId=0) for i in range(6): _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) else: # 新增合同后返回的合同id和客户id:contract_return_id[0]为合同id contract_return_id[1]为客户id contract_return_id = _AddContract.add_contracts( DepartmentId=0) # id[0]为合同id id[1]为客户id for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 超管登录 关闭合同审批,开启回款审批,========================= _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval.open_received_payment_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 _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _AddReceivedPayments = AddReceivedPayments.AddReceivedPayment( self.cookie, self.csrf) _AddContract = AddContract.AddContract(self.cookie, self.csrf) a = a + 1 if userinfo['username'] == '13799999999': # 新增合同后返回的合同id和客户id:contract_return_id[0]为合同id contract_return_id[1]为客户id contract_return_id = _AddContract.add_contracts(DepartmentId=1) for i in range(6): # 新增审批通过后的回款 _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) contract_return_id = _AddContract.add_contracts(DepartmentId=0) for i in range(6): _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # 新增合同后返回的合同id和客户id:contract_return_id[0]为合同id contract_return_id[1]为客户id contract_return_id = _AddContract.add_contracts(DepartmentId=1) for i in range(6): # 新增待审批的回款 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) contract_return_id = _AddContract.add_contracts(DepartmentId=0) for i in range(6): # 新增待审批的回款 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 新增合同后返回的合同id和客户id:contract_return_id[0]为合同id contract_return_id[1]为客户id contract_return_id = _AddContract.add_contracts(DepartmentId=1) for i in range(6): # 新增审批否决后的回款 _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) contract_return_id = _AddContract.add_contracts(DepartmentId=0) for i in range(6): _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) contract_return_id = _AddContract.add_contracts(DepartmentId=1) for i in range(6): # 新增审批通过后驳回的回款 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]))) contract_return_id = _AddContract.add_contracts(DepartmentId=0) for i in range(6): # 新增审批通过后驳回的回款 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]))) else: # 添加一个合同 contract_return_id = _AddContract.add_contracts() for i in range(6): # 新增审批通过后的回款 _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) contract_return_id = _AddContract.add_contracts() for i in range(6): # 新增待审批的回款 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # # 添加一个合同 contract_return_id = _AddContract.add_contracts() for i in range(6): # 新增审批否决后的回款 _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1])) _ReceivedPaymentApproval.received_payments_deny( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])) # #添加一个合同 contract_return_id = _AddContract.add_contracts() for i in range(6): # 新增审批通过后驳回的回款 _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]))) _ReceivedPaymentApproval.received_payments_deny( _ReceivedPaymentApproval.received_payments_verify( _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1])))
def case_2(self): _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 _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) # 开启合同审批和 关闭回款审批 _ContractsApproval.open_contract_approval() _ReceivedPaymentApproval.close_received_payment_approval() 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 _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _AddReceivedPayments = AddReceivedPayments.AddReceivedPayment( self.cookie, self.csrf) _AddContract = AddContract.AddContract(self.cookie, self.csrf) a = a + 1 if userinfo['username'] == '13799999999': for b in range(2): # 添加一个待审批的合同(p1-1);新增合同后返回的合同id和客户id:contract_return_id[0]为合同id contract_return_id[1]为客户id contract_return_id = _AddContract.add_contracts( DepartmentId=b, approve_status='applying') _ContractsApproval.verify_contracts(contract_return_id[0]) # print (contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) print(u'合同审批通过,回款关闭,数据完成================================') # 添加一个待审批的合同(p2-1) contract_return_id = _AddContract.add_contracts( DepartmentId=b, approve_status='applying') for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) print(u'合同待审批,回款关闭,数据完成================================') # 添加一个待审批的合同 合同驳回(P3-1) contract_return_id = _AddContract.add_contracts( DepartmentId=b, approve_status='applying') # id[0]为合同id id[1]为客户id # print(contract_return_id) # 审批通过 _ContractsApproval.verify_contracts(contract_return_id[0]) _ContractsApproval.deny_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 添加一个撤销的合同(p4-1) contract_return_id = _AddContract.add_contracts( DepartmentId=b, approve_status='applying') for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) _ContractsApproval.cancel_contracts(contract_return_id[0]) print(u'合同待撤销,回款关闭,数据完成================================') else: # 添加一个待审批的合同(p1-1) contract_return_id = _AddContract.add_contracts( DepartmentId=0, approve_status='applying') # 审批通过 _ContractsApproval.verify_contracts(contract_return_id[0]) print(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) print(u'合同审批通过,回款关闭,数据完成================================') # 添加一个待审批的合同(p2-1) contract_return_id = _AddContract.add_contracts( DepartmentId=0, approve_status='applying') for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) print(u'合同待审批,回款关闭,数据完成================================') # 添加一个待审批的合同 合同通过后驳回(P3-1) contract_return_id = _AddContract.add_contracts( DepartmentId=0, approve_status='applying') # 审批通过 _ContractsApproval.verify_contracts(contract_return_id[0]) _ContractsApproval.deny_contracts(contract_return_id[0]) for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) # 添加一个撤销的合同(p4-1) contract_return_id = _AddContract.add_contracts( DepartmentId=0, approve_status='applying') for i in range(6): # 添加新增回款记录 _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][0] * (i + 1), customer_id=contract_return_id[1]) _AddReceivedPayments.add_received_payments( contract_id=contract_return_id[0], receive_date=self.sign_date_list[i], amount=self.total_amount_list[a - 1][1] * (i + 1), customer_id=contract_return_id[1]) _ContractsApproval.cancel_contracts(contract_return_id[0]) print(u'合同待撤销,回款关闭,数据完成================================') #超管登录 合同审批开启 回款审批开启,新增回款=================================== _login.login(self.userinfo_super['username'], self.userinfo_super['password'], self.userinfo_super['role']) self.cookie = _login.cookie self.csrf = _login.csrf _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval.open_received_payment_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 _ContractsApproval = ContractsApproval.Approvals( self.cookie, self.csrf) _ReceivedPaymentApproval = ReceivedPaymentApproval.Approvals( self.cookie, self.csrf) _AddReceivedPayments = AddReceivedPayments.AddReceivedPayment( self.cookie, self.csrf) _AddContract = AddContract.AddContract(self.cookie, self.csrf) a = a + 1 if userinfo['username'] == '13799999999': self.add_data(a, DepartmentId=0) self.add_data(a, DepartmentId=1) else: self.add_data(a, DepartmentId=0)