diff --git a/apps/wpm/views.py b/apps/wpm/views.py index a78f74f2..34aa7ce0 100644 --- a/apps/wpm/views.py +++ b/apps/wpm/views.py @@ -690,15 +690,16 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust from apps.wpmw.models import Wpr now = timezone.now() c_year = now.year + c_year2 = str(c_year)[-2:] c_month = now.month m_model = material_out.model wps_qs = Wpr.objects.filter(material_start=material_out, create_time__year=c_year, create_time__month=c_month).order_by("create_time") n_count = wps_qs.count() + 1 try: if gen_count == 1: - return rule.format(c_year=c_year, c_month=c_month, m_model=m_model, n_count=n_count) + return rule.format(c_year=c_year, c_month=c_month, m_model=m_model, n_count=n_count, c_year2=c_year2) else: - return [rule.format(c_year=c_year, c_month=c_month, m_model=m_model, n_count=n_count+i) for i in range(gen_count)] + return [rule.format(c_year=c_year, c_month=c_month, m_model=m_model, n_count=n_count+i, c_year2=c_year2) for i in range(gen_count)] except (KeyError, ValueError) as e: raise ParseError(f"个号生成错误: {e}")