Skip to content

Commit

Permalink
[#17] 采购模块 (#266)
Browse files Browse the repository at this point in the history
* 增加了材料执行中的物料字段
为状态回溯写了对应的标单查询
增加了几行代码注释

* 状态修改(创建状态转移表)时修改对应标单状态
用filters去筛选标单状态列表

* [#17] 采购物料
[#17] 采购物料
为材料代用和材料执行添加了字段查询功能
  • Loading branch information
eyeeco authored and Time1ess committed Jan 11, 2018
1 parent 3cfd47f commit 15f4cd9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Procurement/api/material_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from Core.utils.pagination import SmallResultsSetPagination
from Procurement.models import MaterialExecution, MaterialExecutionDetail
from Procurement import serializers
from Procurement import filters


# 材料执行表
class MaterialExecutionViewSet(viewsets.ModelViewSet):
pagination_class = SmallResultsSetPagination
queryset = MaterialExecution.objects.all().order_by('-pk')
filter_class = filters.MaterialExcutionFilter

def get_serializer_class(self):
if self.action == 'create':
Expand Down
2 changes: 2 additions & 0 deletions Procurement/api/materialsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
from Procurement.models import MaterialSubApply, MaterialSubApplyItems
from Procurement.models import SubApplyComment
from Procurement import serializers
from Procurement import filters


# 材料代用申请单
class MaterialSubApplyViewSet(viewsets.ModelViewSet):
pagination_class = SmallResultsSetPagination
queryset = MaterialSubApply.objects.all().order_by('-pk')
filter_class = filters.MaterialSubApplyFilter

def get_serializer_class(self):
if self.action == 'list':
Expand Down
7 changes: 6 additions & 1 deletion Procurement/filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

from .status_change import (StatusChangeFilter, )

from .materialsub import (MaterialSubApplyFilter, )

from .material_excution import (MaterialExcutionFilter, )

__all__ = ['PurchaseOrderFilter', 'BiddingSheetFilter',
'BiddingApplicationFilter', 'SupplyRelationshipFilter',
'StatusChangeFilter', 'ProcurementMaterialFilter']
'StatusChangeFilter', 'ProcurementMaterialFilter',
'MaterialSubApplyFilter', 'MaterialExcutionFilter']
11 changes: 11 additions & 0 deletions Procurement/filters/material_excution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django_filters import rest_framework as filters
from Procurement import models


# 根据代用单编号模糊查询
class MaterialExcutionFilter(filters.FilterSet):
uid = filters.CharFilter(name='uid', lookup_expr='icontains')

class Meta:
model = models.MaterialExecution
fields = ('uid',)
11 changes: 11 additions & 0 deletions Procurement/filters/materialsub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django_filters import rest_framework as filters
from Procurement import models


# 根据代用单编号模糊查询
class MaterialSubApplyFilter(filters.FilterSet):
uid = filters.CharFilter(name='uid', lookup_expr='icontains')

class Meta:
model = models.MaterialSubApply
fields = ('uid',)

0 comments on commit 15f4cd9

Please sign in to comment.