From c35041f72bb571165c85e50f177c43514be056e1 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 16 Dec 2025 16:33:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20routepack=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=B6=E5=81=9A=E4=B8=80=E4=B8=8B=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mtm/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/mtm/views.py b/apps/mtm/views.py index fd3484f6..4f6b41cc 100644 --- a/apps/mtm/views.py +++ b/apps/mtm/views.py @@ -249,9 +249,12 @@ class RoutePackViewSet(CustomModelViewSet): @transaction.atomic def destroy(self, request, *args, **kwargs): + from apps.wpm.models import Mlog obj: RoutePack = self.get_object() if obj.state != RoutePack.RP_S_CREATE: raise ParseError('该状态下不可删除') + if Mlog.objects.filter(route__routepack=obj).exists(): + raise ParseError('该工艺路线包有生产记录,不可删除') obj.delete() Ticket.objects.filter(ticket_data__t_id=obj.id, ticket_data__t_model='routepack').delete() return Response(status=204) From 0c5034683cc9c0ff802481d2db52444be71e3cb3 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 17 Dec 2025 09:25:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20update=5Fmb=5Fitem=E6=97=B6=E8=80=83?= =?UTF-8?q?=E8=99=91=E6=A3=80=E9=AA=8C=E7=9A=84=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/inm/services.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/inm/services.py b/apps/inm/services.py index dba22bff..c0046a9a 100644 --- a/apps/inm/services.py +++ b/apps/inm/services.py @@ -373,7 +373,10 @@ class InmService: ddict["material_ofrom"] = i.material if field == "count": - count_change = i.count - i.count_notok + if i.test_date is not None: + count_change = i.count - i.count_notok + else: + count_change = i.count elif field == "count_notok": count_change = getattr(i, field) else: