def stop_roboy(isa_job_no, user_name): isa_job_status = '' try: update_sql(user_name) rpa_rest(host='http://rpa.chinaive.com', rest_type='stop-job', data_json={"job_no": isa_job_no}, add_pr='/rapi/rcall.action?', token='a56d8e1e413c43baa989c5feeb2d5fdb') isa_job_status = 'OK' except: isa_job_status = 'Faile' print('此任务已经执行完毕') update_sql(user_name) return isa_job_status
def start_robot(jobs, rpa_client_id, job_no): print('开始下发机器人执行') jobs = 'NewProject1' isa_no = rpa_rest(host='http://rpa.chinaive.com', rest_type='start-job', data_json={ "proc_code": jobs, "robot_no": rpa_client_id }, add_pr='/rapi/rcall.action?', token='59e078f284f440f49e36076eb07efbc3') print('isa_no =====================', isa_no['result']['job_no']) # TODO 获取此机器人在 服务器的任务编号写入数据库 # rpa_rest(host='http://rpa.chinaive.com', rest_type='get-jobs', data_json={"proc_code": jobs}, # add_pr='/rapi/rcall.action?', token='59e078f284f440f49e36076eb07efbc3') try: time.sleep(0.5) Job_list_summary.objects.filter(job_no=job_no).update( isa_job_no=isa_no['result']['job_no']) # Job_list_summary.objects.filter(job_no = job_no).update(isa_job_no=isa_no['result']['START_TIME']) # Job_list_summary.isa_job_no = isa_no['result']['job_no'] # Job_list_summary.save() except: print('艺赛琪编号写入失败')
def set_email(request): flowCode = {1: 'GeShui', 2: 'NewProject1', 3: 'InvoiceCheck0705'} if request.method == "GET": Agent.append(request.GET.get('name')) print('获取到去创建任务页面的上一个也买你的值:', request.GET.get('name')) return render(request, 'email.html', locals()) elif request.method == 'POST': # print('POST:', request.POST.get('chose_rpa')) print('Agent:', Agent) print('Agent:', MachineInfo[-1]) rpa_rest(host='http://192.168.1.151', rest_type='start-job', data_json={ "proc_code": flowCode[Agent[-1]], "robot_no": MachineInfo[-1] }, add_pr='/rapi/rcall.action?', token='a56d8e1e413c43baa989c5feeb2d5fdb') return render(request, 'email.html', locals())