From ec42e70118d8d94b87120b0615b416318ff19459 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 30 May 2025 11:11:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20gen=5Fnumber=5Fwith?= =?UTF-8?q?=5Frule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/wpm/views.py b/apps/wpm/views.py index d54afa1b..eaececeb 100644 --- a/apps/wpm/views.py +++ b/apps/wpm/views.py @@ -695,9 +695,12 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust c_month = now.month m_model = material_out.model wpr = Wpr.objects.filter(material_start=material_out, create_time__year=c_year, create_time__month=c_month).order_by("number").last() + cq_w = 4 + if '02d' in rule: + cq_w = 2 if wpr: try: - n_count = int(wpr.number.split("-")[-1].lstrip('0')) + n_count = int(wpr.number[-cq_w:].lstrip('0')) except Exception as e: raise ParseError(f"获取该类产品最后编号错误: {str(e)}") try: