|
|
|
@ -29,7 +29,7 @@ class PointService:
|
|
|
|
qs.update(**{'postamat_id': postamat_id})
|
|
|
|
qs.update(**{'postamat_id': postamat_id})
|
|
|
|
|
|
|
|
|
|
|
|
def start_mathing(self, obj_id: int, task_name=STATUS_TASK_NAME_IMPORT):
|
|
|
|
def start_mathing(self, obj_id: int, task_name=STATUS_TASK_NAME_IMPORT):
|
|
|
|
change_status('Шаг 1. Начинается мэтчинг точек', task_name)
|
|
|
|
change_status('Шаг 1 из 3 (Мэтчинг точек).', task_name)
|
|
|
|
file = models.TempFiles.objects.get(id=obj_id)
|
|
|
|
file = models.TempFiles.objects.get(id=obj_id)
|
|
|
|
excel_file = base64.b64decode(file.data)
|
|
|
|
excel_file = base64.b64decode(file.data)
|
|
|
|
df = pd.read_excel(excel_file)
|
|
|
|
df = pd.read_excel(excel_file)
|
|
|
|
@ -130,7 +130,7 @@ class PointService:
|
|
|
|
matching_status=MatchingStatus.New.name,
|
|
|
|
matching_status=MatchingStatus.New.name,
|
|
|
|
status=PointStatus.Pending.name, area=rayon,
|
|
|
|
status=PointStatus.Pending.name, area=rayon,
|
|
|
|
district=rayon.AO)
|
|
|
|
district=rayon.AO)
|
|
|
|
change_status(f'Шаг 1. Обработано {matched + problem} из {total}', task_name)
|
|
|
|
change_status(f'Шаг 1 из 3 (Мэчинг точек). Обработано {matched + problem} из {total}', task_name)
|
|
|
|
|
|
|
|
|
|
|
|
ts = models.TaskStatus.objects.get(task_name=task_name)
|
|
|
|
ts = models.TaskStatus.objects.get(task_name=task_name)
|
|
|
|
ts.data = {'total': total, 'matched': matched, 'error': problem, 'unmatched': total - matched - problem}
|
|
|
|
ts.data = {'total': total, 'matched': matched, 'error': problem, 'unmatched': total - matched - problem}
|
|
|
|
@ -138,7 +138,7 @@ class PointService:
|
|
|
|
# return total, matched, problem
|
|
|
|
# return total, matched, problem
|
|
|
|
|
|
|
|
|
|
|
|
def make_enrichment(self, task_name=STATUS_TASK_NAME_IMPORT):
|
|
|
|
def make_enrichment(self, task_name=STATUS_TASK_NAME_IMPORT):
|
|
|
|
change_status('Шаг 2. Начинается обогащение точек', task_name)
|
|
|
|
change_status('Шаг 2 из 3 (Обогащение точек).', task_name)
|
|
|
|
points = models.PrePlacementPoint.objects.filter(matching_status=MatchingStatus.New.name).all()
|
|
|
|
points = models.PrePlacementPoint.objects.filter(matching_status=MatchingStatus.New.name).all()
|
|
|
|
groups = models.Post_and_pvzGroup.objects.all()
|
|
|
|
groups = models.Post_and_pvzGroup.objects.all()
|
|
|
|
|
|
|
|
|
|
|
|
@ -251,7 +251,7 @@ class PointService:
|
|
|
|
for group in groups:
|
|
|
|
for group in groups:
|
|
|
|
self.calculate_dist_for_group(point, group, instance_type=models.PrePlacementPointPVZDistance)
|
|
|
|
self.calculate_dist_for_group(point, group, instance_type=models.PrePlacementPointPVZDistance)
|
|
|
|
change_status(
|
|
|
|
change_status(
|
|
|
|
f'Шаг 2. Обогащено {points.filter(matching_status=MatchingStatus.Matched.name).count()} из {points.count()}',
|
|
|
|
f'Шаг 2 из 3 (Обогащение точек). Обработано {points.filter(matching_status=MatchingStatus.Matched.name).count()} из {points.count()}',
|
|
|
|
task_name)
|
|
|
|
task_name)
|
|
|
|
|
|
|
|
|
|
|
|
run_psql_command()
|
|
|
|
run_psql_command()
|
|
|
|
|