def schedule_detail(request, schedule_id): schedule_id = uncoding(schedule_id) schedule_info = ScheduleInifo.objects.filter(id=int(schedule_id),project_name__project_status='ex',project_name__project_exaudit=True) if schedule_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif not schedule_info: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: user = schedule_info.first() project_id = user.project_name.id audit_company = AuditCompanyInfo.objects.filter(status=True, project_name_id=project_id) sc_file_list = ScheduleFileInifo.objects.filter(status=True, project_name=project_id) member_name_list = AuditMemberInfo.objects.filter(project_name_id=int(project_id)) # member_user = member_name_list.filter(username_id=request.user.id).first() title = PlansInifo.objects.filter(id=int(project_id), status=True).first() switch = 'close' if title.project_status == 'ex' : switch = 'open' project_id=coding(project_id) schedule_id=coding(schedule_id) return render(request, 'exaudit/schedule_detail.html', { 'schedule_id': schedule_id, 'user': user, 'project_id': project_id, 'audit_company': audit_company, 'sc_file_list': sc_file_list, 'member_name':member_name_list, # 'member_user':member_user, 'title':title, 'switch':switch })
def problem_detail(request, problem_id): problem_id=uncoding(problem_id) problem_info = ProblemInfo.objects.filter(status=True, id=int(problem_id)).first() if problem_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif problem_info.project_name.project_status != 'ex' and problem_info.project_name.project_exaudit != True: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: project_id = problem_info.project_name_id # user = AuditMemberInfo.objects.filter(status=True, project_name_id=project_id, username_id=request.user.id).first() switch = 'open' project_is = PlansInifo.objects.filter(status=True, id=int(project_id), project_status='ex').first() audit_company = AuditCompanyInfo.objects.filter(status=True, project_name_id=int(project_id)) problem_file_list = ProblemFileInifo.objects.filter(status=True, problem_id=int(problem_id)) project_id=coding(project_id) return render(request, 'exaudit/problem_detail.html', { 'project_id': project_id, 'problem_info': problem_info, # 'user': user, 'switch': switch, 'audit_company': audit_company, 'problem_file_list': problem_file_list })
def problem_list(request, project_id): project_id = uncoding(project_id) project = PlansInifo.objects.filter(status=True, id=int(project_id), project_exaudit=True,project_status='ex').first() if project_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif not project: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: do_problem_list = ProblemInfo.objects.filter(status=True, project_name_id=int(project_id), problem_status='do',username_id=None).order_by('-add_time') co_sg_problem_list = ProblemInfo.objects.filter(status=True, project_name_id=int(project_id), problem_status='co',username_id=None, problem_type='sg').order_by('-add_time') co_re_problem_list = ProblemInfo.objects.filter(status=True, project_name_id=int(project_id), problem_status='co',username_id=None, problem_type='re').order_by('-add_time') el_problem_list = ProblemInfo.objects.filter(status=True, project_name_id=int(project_id), problem_status='el',username_id=None).order_by('-add_time') problem_file_list = ProblemFileInifo.objects.filter(status=True, project_name_id=int(project_id)) switch = 'open' project_id=coding(project_id) return render(request, 'exaudit/problem_list.html', { 'project_id': project_id, 'do_problem_list': do_problem_list, 'co_sg_problem_list': co_sg_problem_list, 'co_re_problem_list': co_re_problem_list, 'el_problem_list': el_problem_list, 'problem_file_list': problem_file_list, 'switch':switch, 'project':project })
def exaudit_feedback(request): if request.method=='POST': re_problem_id=uncoding(request.POST.get('re_problem_id')) if re_problem_id == '0': return render(request, 'exaudit/exaudit_return.html', { 're_problem_msg':'编码错误' }) else: re_problem = RectificationProblemInfo.objects.filter(status=True, id=int(re_problem_id)).first() re_project = RectificationPrjectInfo.objects.filter(status=True,id=re_problem.re_project_id,re_status='pr').first() if re_project: re_feedback_list = RectificationFeedbackInfo.objects.filter(status=True,re_project_name_id=re_problem_id).order_by('-add_time') re_feedback_nm = list(set(re_feedback.id for re_feedback in re_feedback_list)) today = datetime.datetime.now().today() re_feedback_file_list = RectificationFeedbackFileInfo.objects.filter(status=True, re_feedback_id__in=re_feedback_nm) return render(request,'exaudit/exaudit_feedback.html',{ 're_project':re_project, # 're_project_id':re_project_id, 're_problem':re_problem, 're_feedback_list':re_feedback_list, 'today':today, 're_feedback_file_list':re_feedback_file_list, 're_problem_id':coding(re_problem_id) }) else: return render(request, 'exaudit/exaudit_return.html', { 're_problem_msg':'项目已整改结束' })
def start_detail1(request,project_id): switch = 'open' # switch_stauts = PlansInifo.objects.filter(status=True, id=int(project_id), project_status='cp').first() # if switch_stauts: # switch = 'close' project_id = uncoding(project_id) project = PlansInifo.objects.filter(status=True, id=int(project_id), project_exaudit=True,project_status='ex').first() if project_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif not project: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: notice_info = AllNoticeInfo.objects.filter(status=True, company_id_id=project.company_id_id, project_name_id=int(project_id), notice_type='audit').first() if notice_info: notice_id_1 = notice_info.id notice_file = AllNoticeFileInfo.objects.filter(status=True, notice_name_id=int(notice_id_1)) else: notice_file = '' start_detail = StartInfo.objects.filter(status=True, company_id=project.company_id_id, project_name=int(project_id)).first() start_file = StartFieldInfo.objects.filter(status=True, project_name=int(project_id)) audit_company = AuditCompanyInfo.objects.filter(status=True, project_name_id=int(project_id)) project_member = AuditMemberInfo.objects.filter(status=True, project_name_id=int(project_id)) member_list_id = list(set(member.username.id for member in project_member)) user_list = UserProfile.objects.filter(is_active='1', company_name=project.company_id_id) except_member_list = list(set(member.id for member in user_list)) except_member = user_list.exclude(id__in=member_list_id) # member_list = project_member.filter(username_id=request.user.id) # if member_list: # member = member_list[0] # else: # member = '' project_name = PlansInifo.objects.filter(id=int(project_id), status=True).first() project_id = coding(int(project_id)) return render(request, 'exaudit/start_detail.html', { 'project_id': project_id, 'switch': switch, 'notice_info': notice_info, 'notice_file': notice_file, 'start_detail': start_detail, 'start_file': start_file, 'audit_company': audit_company, 'project_member': project_member, # 'member': member, 'except_members': except_member, 'project_name': project_name, 'project':project })
def problem_add(request, project_id): project_id = uncoding(project_id) project = PlansInifo.objects.filter(status=True, id=int(project_id), project_exaudit=True,project_status='ex').first() if project_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif not project: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: audit_company = AuditCompanyInfo.objects.filter(project_name_id=int(project_id), status=True) project_id=coding(project_id) return render(request, 'exaudit/problem_add.html', { 'project_id': project_id, 'audit_company': audit_company })
def schedule_list(request, project_id): project_id = uncoding(project_id) project = PlansInifo.objects.filter(status=True, id=int(project_id), project_exaudit=True,project_status='ex').first() if project_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif not project: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: keyword = request.GET.get('keyword', '') sc_list = ScheduleInifo.objects.filter(project_name_id=int(project_id), status=True) user_list = sc_list.filter(username_id=None).order_by('-add_time') if keyword: user_list = sc_list.filter(username_id=None).order_by('-add_time').filter( Q(schedule_title__icontains=keyword) | Q(schedule_content__icontains=keyword) | Q( schedule_feedback__icontains=keyword) | Q(audit_company__audit_company__icontains=keyword) | Q( audit_company__audit_person__icontains=keyword)) title = PlansInifo.objects.filter(id=int(project_id), status=True).first() this_date = datetime.date.today() member_name_list = AuditMemberInfo.objects.filter(project_name_id=int(project_id)) # member_user = member_name_list.filter(username_id=request.user.id).first() sc_file_list = ScheduleFileInifo.objects.filter(status=True, project_name_id=int(project_id)) audit_company = AuditCompanyInfo.objects.filter(status=True, project_name_id=int(project_id)) project_id=coding(project_id) return render(request, 'exaudit/schedule_list.html', { 'project_id': project_id, 'sc_list': sc_list, 'user_list': user_list, 'title': title, 'this_date': this_date, 'member_name': member_name_list, 'sc_file_list': sc_file_list, 'audit_company': audit_company, # 'member_user': member_user })
def report_detail(request, project_id): project_id = uncoding(project_id) project = PlansInifo.objects.filter(status=True, id=int(project_id), project_exaudit=True,project_status='ex').first() if project_id == '0': return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '编码错误' }) elif not project: return render(request, 'exaudit/exaudit_return.html', { 'project_msg': '非外审项目' }) else: feedback_file_list = FeedbackFileInifo.objects.filter(status=True, project_name_id=int(project_id)).order_by( 'add_time') switch = 'close' project_info = PlansInifo.objects.filter(status=True, id=int(project_id),project_status='ex').first() if project_info: switch = 'open' # member = AuditMemberInfo.objects.filter(status=True, username_id=request.user.id,project_name_id=int(project_id)).first() notice_info = AllNoticeInfo.objects.filter(status=True, company_id_id=project.company_id_id, project_name_id=int(project_id), notice_type='report').first() report_type1=['fi','fifi'] report_fi_file=ReportFileInifo.objects.filter(status=True,project_name_id=int(project_id),report_type__in=report_type1).order_by('add_time') report_type2=['pr','prfi'] report_pr_file=ReportFileInifo.objects.filter(status=True,project_name_id=int(project_id),report_type__in=report_type2).order_by('add_time') project_id=coding(project_id) return render(request, 'exaudit/report_detail.html', { 'project_id': project_id, 'feedback_file_list': feedback_file_list, 'switch': switch, # 'member': member, 'notice_info': notice_info, 'report_fi_file':report_fi_file, 'report_pr_file':report_pr_file })
def coding(self): from users.tests import coding coding = coding(self.id) return coding
def coding(self): from users.tests import coding key = str(self.id) coding = coding(key) return coding
def re_problem_exportxl(request, re_project_id): # re_project_id=request.GET.get('re_project_id') re_project = RectificationPrjectInfo.objects.filter(status=True, company_id_id=request.user.company_name_id, id=int(re_project_id)).first() re_problem_list = RectificationProblemInfo.objects.filter(status=True, company_id_id=int(request.user.company_name_id), re_project_id=int(re_project_id)) workbook = Workbook() data_re_problem = workbook.create_sheet(u"编码", 0) border = Border(left=Side(style='thick', color=colors.RED), right=Side(style='medium', color=colors.BLACK), top=Side(style='double', color=colors.BLUE), bottom=Side(style='dotted', color=colors.BLACK)) # workbook=workbook.active re_problem_header = ["序号", "问题名称", "整改状态", "问题内容", "被审计公司", "被审计人", "整改问题编码"] data_re_problem.append(re_problem_header) # data_re_problem.cell(row=1,column=1,value="序号") # data_re_problem.cell(row=1, column=2, value="名称") # data_re_problem["{}{}".format(num2column(1), 1)].border = border # data_re_problem["{}{}".format(num2column(2), 1)].border = border # data_re_problem["{}{}".format(num2column(3), 1)].border = border # data_re_problem["{}{}".format(num2column(4), 1)].border = border # data_re_problem["{}{}".format(num2column(5), 1)].border = border # data_re_problem["{}{}".format(num2column(6), 1)].border = border # data_re_problem["{}{}".format(num2column(7), 1)].border = border num = 0 if re_problem_list: for re_problem in re_problem_list: data_re_problem.cell(row=num + 2, column=1).value = num + 1 # data_re_problem["{}{}".format(num2column(1),num+2)].border=border data_re_problem.cell(row=num + 2, column=2).value = re_problem.re_problem.problem_title # data_re_problem["{}{}".format(num2column(2), num + 2)].border = border if re_problem.re_situation == 'pr': data_re_problem.cell(row=num + 2, column=3).value = '整改中' # data_re_problem["{}{}".format(num2column(num + 2), 3)].border = border elif re_problem.re_situation == 'co': data_re_problem.cell(row=num + 2, column=3).value = '整改完成' # data_re_problem["{}{}".format(num2column(num + 2), 3)].border = border else: data_re_problem.cell(row=num + 2, column=3).value = '无法整改' # data_re_problem["{}{}".format(num2column(num + 2), 3)].border = border data_re_problem.cell(row=num + 2, column=4).value = re_problem.re_problem.problem_content # data_re_problem["{}{}".format(num2column(num + 2), 4)].border = border data_re_problem.cell(row=num + 2, column=5).value = re_problem.re_problem.audit_company.audit_company # data_re_problem["{}{}".format(num2column(num + 2), 5)].border = border data_re_problem.cell(row=num + 2, column=6).value = re_problem.re_problem.audit_company.audit_person # data_re_problem["{}{}".format(num2column(num + 2), 6)].border = border data_re_problem.cell(row=num + 2, column=7).value = coding(re_problem.id) # data_re_problem["{}{}".format(num2column(num + 2), 7)].border = border num += 1 # # aa['问题名称']=re_problem.re_problem.problem_title # # aa['整改状态']=re_problem.re_situation # # aa['问题内容']=re_problem.re_problem.problem_content # # aa['被审计公司']=re_problem.re_problem.audit_company.audit_company # # aa['被审计人']=re_problem.re_problem.audit_company.audit_person # # aa['整改问题编码']=re_problem.coding # # re_problem_list2.insert(num,aa) file_name = re_project.project_name.project_name + '--问题编码' + datetime.datetime.today().strftime( '%Y-%m-%d %H:%M:%S') wb = save_virtual_workbook(workbook) # response = StreamingHttpResponse(streaming_content=wb,content_type='application/octet-stream') response = HttpResponse(content=wb, content_type='application/octet-stream') # response["content_type"] = 'application/octet-stream' # response['Content-Type'] = 'application/vnd.ms-excel' # response['Content-Type']= 'application/x-xlsx' # response['Content-Disposition'] = 'attachment; filename=%s.xlsx' % "活动数据" response["Content-Disposition"] = 'attachment; filename={}.xls'.format(file_name.encode().decode('latin-1')) # workbook.close() # response = HttpResponse(save_virtual_workbook(workbook), content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') # response['Content-Disposition'] = 'attachment; filename=%s.xls' % file_name return response