758 lines
31 KiB
Python
758 lines
31 KiB
Python
# -*- coding: utf-8 -*-
|
||
import math
|
||
import traceback
|
||
from datetime import datetime, timedelta
|
||
|
||
import requests
|
||
from django.conf import settings
|
||
from django.contrib.auth.decorators import login_required
|
||
from django.db.models import Avg, Max, Min, Q
|
||
from django.db.models.functions import (Greatest, TruncDate, TruncDay,
|
||
TruncHour, TruncMinute, TruncSecond)
|
||
from django.http import HttpResponse
|
||
from django.shortcuts import get_object_or_404, redirect, render
|
||
from django.views.decorators.cache import never_cache
|
||
from requests.auth import HTTPBasicAuth
|
||
|
||
from apps.geoproc.models.model_indicators import PointIndicators
|
||
from apps.geoproc.models.model_journalobs_table import JournalObsTable
|
||
from apps.geoproc.models.model_journalvisual_table import JournalVizualTable
|
||
from apps.geoproc.models.model_journalvisual_table_m import JournalVizualTableM
|
||
from apps.geoproc.models.model_point import Point
|
||
from apps.geoproc.models.model_sector import Sector
|
||
from apps.util import generalmodule
|
||
from sabron.util import logging
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_show(request, sector):
|
||
try:
|
||
if request.method == "POST":
|
||
dict_param = request.POST.dict()
|
||
by_all_sectors = True if dict_param["AllSectors"] == "true" else False
|
||
data_start = datetime.strptime(
|
||
dict_param["DataStart"] + " 00:00:00", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
data_stop = datetime.strptime(
|
||
dict_param["DataStop"] + " 23:59:59", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
delta = data_stop - data_start
|
||
html = (
|
||
"""
|
||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||
<thead>
|
||
<tr align="center">
|
||
<th style='width: 15px' rowspan="3" align="center"> Репер </th>
|
||
<th colspan="3" align="center">Дата наблюдения</th>
|
||
<th colspan="3" align="center">Дата наблюдения</th>
|
||
<th colspan="11" align="center">между """
|
||
+ dict_param["DataStart"]
|
||
+ """ и """
|
||
+ dict_param["DataStop"]
|
||
+ """</th>
|
||
</tr>
|
||
<tr align="center">
|
||
<th colspan="3" align="center">"""
|
||
+ dict_param["DataStart"]
|
||
+ """</th>
|
||
<th colspan="3" align="center">"""
|
||
+ dict_param["DataStop"]
|
||
+ """</th>
|
||
<th colspan="5" align="center" >Смещения, м</th>
|
||
<th colspan="1" align="center" >Период, сут</th>
|
||
<th colspan="5" align="center" >Скорость смещения, мм/сут</th>
|
||
</tr>
|
||
<tr align="center">
|
||
<th align="center">X</th>
|
||
<th align="center">Y</th>
|
||
<th align="center">Z</th>
|
||
<th align="center">X</th>
|
||
<th align="center">Y</th>
|
||
<th align="center">Z</th>
|
||
<th align="center">∆X</th>
|
||
<th align="center">∆Y</th>
|
||
<th align="center">∆Z</th>
|
||
<th align="center">∆P</th>
|
||
<th align="center">∆V</th>
|
||
<th align="center"></th>
|
||
<th align="center">∆X</th>
|
||
<th align="center">∆Y</th>
|
||
<th align="center">∆Z</th>
|
||
<th align="center">∆P</th>
|
||
<th align="center">∆V</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
"""
|
||
)
|
||
if by_all_sectors:
|
||
point_indicators_start = PointIndicators.objects.filter(
|
||
date_time=data_start
|
||
).all()
|
||
point_indicators_stop = PointIndicators.objects.filter(
|
||
date_time=data_stop
|
||
).all()
|
||
else:
|
||
point_indicators_start = PointIndicators.objects.filter(
|
||
date_time=data_start, point__sector=sector
|
||
).all()
|
||
point_indicators_stop = PointIndicators.objects.filter(
|
||
date_time=data_stop, point__sector=sector
|
||
).all()
|
||
|
||
count_day = delta.days + 1
|
||
for point_indicators_s in point_indicators_start:
|
||
|
||
point_indicators_e = point_indicators_stop.filter(
|
||
point=point_indicators_s.point
|
||
).first()
|
||
deltaX = round(point_indicators_e.x - point_indicators_s.x, 3)
|
||
deltaY = round(point_indicators_e.y - point_indicators_s.y, 3)
|
||
deltaZ = round(point_indicators_e.z - point_indicators_s.z, 3)
|
||
deltaP = round(math.sqrt(deltaX**2 + deltaY**2), 3)
|
||
deltaV = round(math.sqrt(deltaY**2 + deltaZ**2 + deltaX**2), 3)
|
||
s_deltaX = round(deltaX * 1000 / count_day, 3)
|
||
s_deltaY = round(deltaY * 1000 / count_day, 3)
|
||
s_deltaZ = round(deltaZ * 1000 / count_day, 3)
|
||
s_deltaP = round(deltaP * 1000 / count_day, 3)
|
||
s_deltaV = round(deltaV * 1000 / count_day, 3)
|
||
html = html + """"<tr align="center">"""
|
||
html = (
|
||
html
|
||
+ """"
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.point)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.x)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.y)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.z)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_e.x)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_e.y)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_e.z)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaX)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaY)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaZ)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaP)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaV)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(count_day)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaX)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaY)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaZ)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaP)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaV)
|
||
+ """</th>
|
||
"""
|
||
)
|
||
|
||
html = html + """</tr>"""
|
||
html = (
|
||
html
|
||
+ """
|
||
|
||
</tbody>
|
||
</table>
|
||
"""
|
||
)
|
||
return HttpResponse(html, content_type="application/text")
|
||
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_jc_show_0(request, sector):
|
||
try:
|
||
if request.method == "POST":
|
||
dict_param = request.POST.dict()
|
||
data_start = datetime.strptime(
|
||
dict_param["DataStart"] + " 00:00:00", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
data_stop = datetime.strptime(
|
||
dict_param["DataStop"] + " 23:59:59", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
by_all_sectors = True if dict_param["AllSectors"] == "true" else False
|
||
delta = data_stop - data_start
|
||
html = """
|
||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||
<thead>
|
||
<tr>
|
||
<th style="text-align: center;vertical-align: middle;">Дата</th>
|
||
<th style="text-align: center;vertical-align: middle;">Наименование</th>
|
||
<th style="text-align: center;vertical-align: middle;">Дата отметки (Начальник участка)</th>
|
||
<th style="text-align: center;vertical-align: middle;">Дата отметки (Главный инженер)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
"""
|
||
myquery = Q()
|
||
if by_all_sectors:
|
||
myquery = Q(journal_vizual__date_time__range=[data_start, data_stop])
|
||
else:
|
||
myquery &= Q(
|
||
journal_vizual__date_time__range=[data_start, data_stop]
|
||
) & Q(journal_vizual__sector=sector)
|
||
journal_list = (
|
||
JournalVizualTable.objects.filter(myquery)
|
||
.prefetch_related("journal_vizual")
|
||
.all()
|
||
)
|
||
for journal in journal_list:
|
||
html = html + """<tr align="center">"""
|
||
html = (
|
||
html
|
||
+ """
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.journal_vizual.date_time.strftime("%d.%m.%Y"))
|
||
+ """</td>
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.name)
|
||
+ """</td>
|
||
"""
|
||
)
|
||
if journal.sign1:
|
||
html = (
|
||
html
|
||
+ """<td align="center">"""
|
||
+ str(journal.sign1_date.strftime("%d.%m.%Y"))
|
||
+ """</td>"""
|
||
)
|
||
else:
|
||
html = html + """<td align="center">Не проверено</td>"""
|
||
if journal.sign2:
|
||
html = (
|
||
html
|
||
+ """<td align="center">"""
|
||
+ str(journal.sign2_date.strftime("%d.%m.%Y"))
|
||
+ """</td>"""
|
||
)
|
||
else:
|
||
html = html + """<td align="center">Не проверено</td>"""
|
||
|
||
html = html + """</tr>"""
|
||
html = (
|
||
html
|
||
+ """
|
||
|
||
</tbody>
|
||
</table>
|
||
"""
|
||
)
|
||
return HttpResponse(html, content_type="application/text")
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_jc_show_1(request, sector):
|
||
try:
|
||
if request.method == "POST":
|
||
dict_param = request.POST.dict()
|
||
data_start = datetime.strptime(
|
||
dict_param["DataStart"] + " 00:00:00", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
data_stop = datetime.strptime(
|
||
dict_param["DataStop"] + " 23:59:59", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
by_all_sectors = True if dict_param["AllSectors"] == "true" else False
|
||
delta = data_stop - data_start
|
||
html = """
|
||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||
<thead>
|
||
<tr>
|
||
<th style="text-align: center;vertical-align: middle;">Дата</th>
|
||
<th style="text-align: center;vertical-align: middle;">Наименование</th>
|
||
<th style="text-align: center;vertical-align: middle;">Дата отметки (Начальник участка)</th>
|
||
<th style="text-align: center;vertical-align: middle;">Дата отметки (Главный инженер)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
"""
|
||
myquery = Q()
|
||
if by_all_sectors:
|
||
myquery &= Q(journal_vizual__date_time__range=[data_start, data_stop])
|
||
else:
|
||
myquery &= Q(
|
||
journal_vizual__date_time__range=[data_start, data_stop]
|
||
) & Q(journal_vizual__sector=sector)
|
||
journal_list = (
|
||
JournalVizualTableM.objects.filter(myquery)
|
||
.prefetch_related("journal_vizual")
|
||
.all()
|
||
)
|
||
for journal in journal_list:
|
||
html = html + """<tr align="center">"""
|
||
html = (
|
||
html
|
||
+ """
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.journal_vizual.date_time.strftime("%d.%m.%Y"))
|
||
+ """</td>
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.name)
|
||
+ """</td>
|
||
"""
|
||
)
|
||
if journal.sign1:
|
||
html = (
|
||
html
|
||
+ """<td align="center">"""
|
||
+ str(journal.sign1_date.strftime("%d.%m.%Y"))
|
||
+ """</td>"""
|
||
)
|
||
else:
|
||
html = html + """<td align="center">Не проверено</td>"""
|
||
if journal.sign2:
|
||
html = (
|
||
html
|
||
+ """<td align="center">"""
|
||
+ str(journal.sign2_date.strftime("%d.%m.%Y"))
|
||
+ """</td>"""
|
||
)
|
||
else:
|
||
html = html + """<td align="center">Не проверено</td>"""
|
||
|
||
html = html + """</tr>"""
|
||
html = (
|
||
html
|
||
+ """
|
||
|
||
</tbody>
|
||
</table>
|
||
"""
|
||
)
|
||
return HttpResponse(html, content_type="application/text")
|
||
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_jc_show_2(request, sector):
|
||
try:
|
||
if request.method == "POST":
|
||
dict_param = request.POST.dict()
|
||
data_start = datetime.strptime(
|
||
dict_param["DataStart"] + " 00:00:00", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
data_stop = datetime.strptime(
|
||
dict_param["DataStop"] + " 23:59:59", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
by_all_sectors = True if dict_param["AllSectors"] == "true" else False
|
||
delta = data_stop - data_start
|
||
html = """
|
||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||
<thead>
|
||
<tr>
|
||
<th style="text-align: center;vertical-align: middle;">Дата</th>
|
||
<th style="text-align: center;vertical-align: middle;">Наименование</th>
|
||
<th style="text-align: center;vertical-align: middle;">Дата отметки (Главного геолога)</th>
|
||
<th style="text-align: center;vertical-align: middle;">Дата отметки (Главного технолога)</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
"""
|
||
myquery = Q()
|
||
|
||
if by_all_sectors:
|
||
myquery &= Q(journal_vizual__date_time__range=[data_start, data_stop])
|
||
else:
|
||
myquery &= Q(
|
||
journal_vizual__date_time__range=[data_start, data_stop]
|
||
) & Q(journal_vizual__sector=sector)
|
||
journal_list = (
|
||
JournalObsTable.objects.filter(myquery)
|
||
.prefetch_related("journal_vizual")
|
||
.all()
|
||
)
|
||
for journal in journal_list:
|
||
html = html + """<tr align="center">"""
|
||
html = (
|
||
html
|
||
+ """
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.journal_vizual.date_time.strftime("%d.%m.%Y"))
|
||
+ """</td>
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.name)
|
||
+ """</td>
|
||
"""
|
||
)
|
||
if journal.sign1:
|
||
html = (
|
||
html
|
||
+ """<td align="center">"""
|
||
+ str(journal.sign1_date.strftime("%d.%m.%Y"))
|
||
+ """</td>"""
|
||
)
|
||
else:
|
||
html = html + """<td align="center">Не проверено</td>"""
|
||
if journal.sign2:
|
||
html = (
|
||
html
|
||
+ """<td align="center">"""
|
||
+ str(journal.sign2_date.strftime("%d.%m.%Y"))
|
||
+ """</td>"""
|
||
)
|
||
else:
|
||
html = html + """<td align="center">Не проверено</td>"""
|
||
|
||
html = html + """</tr>"""
|
||
html = (
|
||
html
|
||
+ """
|
||
|
||
</tbody>
|
||
</table>
|
||
"""
|
||
)
|
||
return HttpResponse(html, content_type="application/text")
|
||
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_jc_show_3(request, sector):
|
||
try:
|
||
if request.method == "POST":
|
||
dict_param = request.POST.dict()
|
||
data_start = datetime.strptime(
|
||
dict_param["DataStart"] + " 00:00:00", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
data_stop = datetime.strptime(
|
||
dict_param["DataStop"] + " 23:59:59", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
by_all_sectors = True if dict_param["AllSectors"] == "true" else False
|
||
delta = data_stop - data_start
|
||
html = """
|
||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||
<thead>
|
||
<tr>
|
||
<th style="text-align: center;vertical-align: middle;">Дата</th>
|
||
<th style="text-align: center;vertical-align: middle;">Журнал</th>
|
||
<th style="text-align: center;vertical-align: middle;">Наименование</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
"""
|
||
if by_all_sectors:
|
||
myquery = Q(sign1=False) | Q(sign2=False)
|
||
else:
|
||
myquery = (Q(sign1=False) | Q(sign2=False)) & Q(
|
||
journal_vizual__sector=sector
|
||
)
|
||
journal_list = (
|
||
JournalVizualTable.objects.filter(myquery)
|
||
.prefetch_related("journal_vizual")
|
||
.all()
|
||
)
|
||
for journal in journal_list:
|
||
html = (
|
||
html
|
||
+ """
|
||
<tr align="center">
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.journal_vizual.date_time.strftime("%d.%m.%Y"))
|
||
+ """</td>
|
||
<td style="text-align: center;vertical-align: middle;">Журнал визуальных наблюдений</td>
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.name)
|
||
+ """</td>
|
||
</tr>
|
||
"""
|
||
)
|
||
|
||
journal_list = (
|
||
JournalVizualTableM.objects.filter(myquery)
|
||
.prefetch_related("journal_vizual")
|
||
.all()
|
||
)
|
||
for journal in journal_list:
|
||
html = (
|
||
html
|
||
+ """
|
||
<tr align="center">
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.journal_vizual.date_time.strftime("%d.%m.%Y"))
|
||
+ """</td>
|
||
<td style="text-align: center;vertical-align: middle;">Журнал указаний и уведомлений</td>
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.name)
|
||
+ """</td>
|
||
</tr>
|
||
"""
|
||
)
|
||
journal_list = (
|
||
JournalObsTable.objects.filter(myquery)
|
||
.prefetch_related("journal_vizual")
|
||
.all()
|
||
)
|
||
for journal in journal_list:
|
||
html = (
|
||
html
|
||
+ """
|
||
<tr align="center">
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.journal_vizual.date_time.strftime("%d.%m.%Y"))
|
||
+ """</td>
|
||
<td style="text-align: center;vertical-align: middle;">Журнал наблюдений за состоянием бортов,траншей,уступов,откосов и отвалов</td>
|
||
<td style="text-align: center;vertical-align: middle;">"""
|
||
+ str(journal.name)
|
||
+ """</td>
|
||
</tr>
|
||
"""
|
||
)
|
||
html = (
|
||
html
|
||
+ """
|
||
|
||
</tbody>
|
||
</table>
|
||
"""
|
||
)
|
||
return HttpResponse(html, content_type="application/text")
|
||
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_jc_show_4(request):
|
||
try:
|
||
if request.method == "POST":
|
||
dict_param = request.POST.dict()
|
||
data_start = datetime.strptime(
|
||
dict_param["DataStart"] + " 00:00:00", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
data_stop = datetime.strptime(
|
||
dict_param["DataStop"] + " 23:59:59", "%d.%m.%Y %H:%M:%S"
|
||
)
|
||
delta = data_stop - data_start
|
||
html = (
|
||
"""
|
||
<table align="center" id = 'id_table' class='table table-bordered table-striped'>
|
||
<thead>
|
||
<tr align="center">
|
||
<th style='width: 15px' rowspan="3" align="center"> Репер </th>
|
||
<th colspan="3" align="center">Дата наблюдения</th>
|
||
<th colspan="3" align="center">Дата наблюдения</th>
|
||
<th colspan="11" align="center">между """
|
||
+ dict_param["DataStart"]
|
||
+ """ и """
|
||
+ dict_param["DataStop"]
|
||
+ """</th>
|
||
</tr>
|
||
<tr align="center">
|
||
<th colspan="3" align="center">"""
|
||
+ dict_param["DataStart"]
|
||
+ """</th>
|
||
<th colspan="3" align="center">"""
|
||
+ dict_param["DataStop"]
|
||
+ """</th>
|
||
<th colspan="5" align="center" >Смещения, м</th>
|
||
<th colspan="1" align="center" >Период, сут</th>
|
||
<th colspan="5" align="center" >Скорость смещения, мм/сут</th>
|
||
</tr>
|
||
<tr align="center">
|
||
<th align="center">X</th>
|
||
<th align="center">Y</th>
|
||
<th align="center">Z</th>
|
||
<th align="center">X</th>
|
||
<th align="center">Y</th>
|
||
<th align="center">Z</th>
|
||
<th align="center">∆X</th>
|
||
<th align="center">∆Y</th>
|
||
<th align="center">∆Z</th>
|
||
<th align="center">∆P</th>
|
||
<th align="center">∆V</th>
|
||
<th align="center"></th>
|
||
<th align="center">∆X</th>
|
||
<th align="center">∆Y</th>
|
||
<th align="center">∆Z</th>
|
||
<th align="center">∆P</th>
|
||
<th align="center">∆V</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
"""
|
||
)
|
||
point_indicators_start = PointIndicators.objects.filter(
|
||
date_time=data_start
|
||
).all()
|
||
point_indicators_stop = PointIndicators.objects.filter(
|
||
date_time=data_stop
|
||
).all()
|
||
context = {
|
||
"point_indicators_start": point_indicators_start,
|
||
"point_indicators_stop": point_indicators_stop,
|
||
}
|
||
count_day = delta.days + 1
|
||
for point_indicators_s in point_indicators_start:
|
||
|
||
point_indicators_e = point_indicators_stop.filter(
|
||
point=point_indicators_s.point
|
||
).first()
|
||
deltaX = round(point_indicators_e.x - point_indicators_s.x, 3)
|
||
deltaY = round(point_indicators_e.y - point_indicators_s.y, 3)
|
||
deltaZ = round(point_indicators_e.z - point_indicators_s.z, 3)
|
||
deltaP = round(math.sqrt(deltaX**2 + deltaY**2), 3)
|
||
deltaV = round(math.sqrt(deltaY**2 + deltaZ**2 + deltaX**2), 3)
|
||
s_deltaX = round(deltaX * 1000 / count_day, 3)
|
||
s_deltaY = round(deltaY * 1000 / count_day, 3)
|
||
s_deltaZ = round(deltaZ * 1000 / count_day, 3)
|
||
s_deltaP = round(deltaP * 1000 / count_day, 3)
|
||
s_deltaV = round(deltaV * 1000 / count_day, 3)
|
||
html = html + """"<tr align="center">"""
|
||
html = (
|
||
html
|
||
+ """"
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.point)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.x)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.y)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_s.z)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_e.x)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_e.y)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(point_indicators_e.z)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaX)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaY)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaZ)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaP)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(deltaV)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(count_day)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaX)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaY)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaZ)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaP)
|
||
+ """</th>
|
||
<th align="center">"""
|
||
+ str(s_deltaV)
|
||
+ """</th>
|
||
"""
|
||
)
|
||
|
||
html = html + """</tr>"""
|
||
html = (
|
||
html
|
||
+ """
|
||
|
||
</tbody>
|
||
</table>
|
||
"""
|
||
)
|
||
return HttpResponse(html, content_type="application/text")
|
||
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_j(request, pk):
|
||
try:
|
||
sector = get_object_or_404(Sector, id=pk)
|
||
if request.method == "GET":
|
||
context = generalmodule.get_context_template()
|
||
context["sector"] = sector
|
||
return render(request, "report/report_j.html", context)
|
||
else:
|
||
return report_show(request, sector=sector)
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|
||
|
||
|
||
@login_required(login_url="/accounts/login/?next=")
|
||
@never_cache
|
||
def report_jc(request, pk):
|
||
try:
|
||
sector = get_object_or_404(Sector, id=pk)
|
||
if request.method == "GET":
|
||
context = generalmodule.get_context_template()
|
||
context["sector"] = sector
|
||
return render(request, "report/report_jc.html", context)
|
||
else:
|
||
param = request.POST.dict()
|
||
if param["variant"] == "0":
|
||
return report_jc_show_0(request, sector)
|
||
elif param["variant"] == "1":
|
||
return report_jc_show_1(request, sector)
|
||
elif param["variant"] == "2":
|
||
return report_jc_show_2(request, sector)
|
||
elif param["variant"] == "3":
|
||
return report_jc_show_3(request, sector)
|
||
|
||
return report_show(request)
|
||
except Exception as err:
|
||
logging.error(traceback.format_exc())
|