Skip to content

Commit

Permalink
Merge pull request #3548 from mikhailprivalov/fix_auto_load_and_sign
Browse files Browse the repository at this point in the history
process auto_load and sign document
  • Loading branch information
Wellheor1 authored Feb 24, 2024
2 parents b5642b1 + ba01141 commit 05311ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
11 changes: 8 additions & 3 deletions api/directions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3877,6 +3877,12 @@ def eds_documents(request):
if not direction.is_all_confirm():
return status_response(False, 'Направление должно быть подтверждено!')

documents = process_to_sign_direction(direction, pk, request.user, iss_obj)

return JsonResponse({"documents": documents, "edsTitle": direction.get_eds_title(), "executors": direction.get_executors()})


def process_to_sign_direction(direction, pk, user, iss_obj):
required_signatures = direction.required_signatures(need_save=True)

documents = []
Expand Down Expand Up @@ -3926,7 +3932,7 @@ def eds_documents(request):
"inline": '1',
"protocol_plain_text": '1',
},
'user': request.user,
'user': user,
'plain_response': True,
}
filename = f'{pk}-{last_time_confirm}.pdf'
Expand Down Expand Up @@ -3969,8 +3975,7 @@ def eds_documents(request):
}

documents.append(document)

return JsonResponse({"documents": documents, "edsTitle": direction.get_eds_title(), "executors": direction.get_executors()})
return documents


@login_required
Expand Down
17 changes: 6 additions & 11 deletions api/management/commands/auto_load_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
from django.utils import timezone

from utils.nsi_directories import NSI
import simplejson as json
from django.http import HttpRequest
from api.directions.views import eds_documents
from api.directions.views import process_to_sign_direction

logger = logging.getLogger("IF")

Expand Down Expand Up @@ -166,15 +164,12 @@ def handle(self, *args, **kwargs):
continue
directions.ParaclinicResult(issledovaniye=iss, field=f, field_type=f.field_type, value=data_result.get(f.title)).save()
stdout.write(f"Добавлена карта: \n, {direction.pk}, {card}")
eds_documents_data = json.dumps({"pk": direction.pk})
eds_documents_obj = HttpRequest()
eds_documents_obj._body = eds_documents_data
eds_documents_obj.user = doc_profile.user
eds_documents(eds_documents_obj)
result = process_to_sign_direction(direction, direction.pk, doc_profile.user, iss)
stdout.write(f"sign_data: {result}")
except Exception as e:
logger.exception(e)
message = "Серверная ошибка"
return {"ok": False, "message": message}
step += 1
stdout.write(f"{step}")
stdout.write(f"Добавлена карта: \n, {direction.pk}, {card}")
step += 1
stdout.write(f"{step}")
stdout.write(f"Добавлена карта: \n, {direction.pk}, {card}")

0 comments on commit 05311ce

Please sign in to comment.