Merge branch 'master' of http://gitea.xxhhcty.xyz:8080/zcdsj/factory
This commit is contained in:
commit
5711791a1f
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue