物料批次增加tag expired查询条件
This commit is contained in:
parent
5efd8fe32a
commit
c29eb242ae
|
@ -2,11 +2,18 @@ from django_filters import rest_framework as filters
|
|||
|
||||
from apps.mtm.models import Material
|
||||
from .models import IProduct, MaterialBatch
|
||||
from django.utils import timezone
|
||||
class MbFilterSet(filters.FilterSet):
|
||||
material = filters.ModelMultipleChoiceFilter(field_name="material", queryset=Material.objects.all())
|
||||
tag = filters.CharFilter(method="filter_tag")
|
||||
class Meta:
|
||||
model = MaterialBatch
|
||||
fields = ['material', 'warehouse']
|
||||
|
||||
def filter_tag(self, queryset, name, value):
|
||||
if value == 'expired':
|
||||
queryset = queryset.exclude(expiration_date=None).filter(expiration_date__lte = timezone.now())
|
||||
return queryset
|
||||
|
||||
|
||||
class IProductFilterSet(filters.FilterSet):
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
|
@ -1,7 +0,0 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MnsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'apps.mns'
|
||||
verbose_name = '消息通知系统'
|
|
@ -1,6 +0,0 @@
|
|||
from django.db import models
|
||||
from utils.model import BaseModel
|
||||
# Create your models here.
|
||||
|
||||
class Notify(BaseModel)
|
||||
pass
|
|
@ -1,3 +0,0 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
|
@ -1,3 +0,0 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
|
@ -620,6 +620,8 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
|||
pass
|
||||
else:
|
||||
raise exceptions.APIException('消耗与产出不一致')
|
||||
# 实际消耗物料校验
|
||||
|
||||
# 检查自定义表单填写
|
||||
if OperationRecord.objects.filter(operation=op, is_filled=False).exists():
|
||||
raise exceptions.APIException('存在自定义表单未填写')
|
||||
|
|
Loading…
Reference in New Issue