待检测半成品
This commit is contained in:
parent
5379b84438
commit
25211e9e5a
|
@ -1,7 +1,7 @@
|
|||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
|
||||
from apps.inm.models import Inventory, MaterialBatch, FIFO, FIFOItem
|
||||
from apps.inm.models import FIFOItemProduct, Inventory, MaterialBatch, FIFO, FIFOItem
|
||||
|
||||
|
||||
def update_inm(instance:FIFO, type:int=1):
|
||||
|
@ -23,6 +23,8 @@ def update_inm(instance:FIFO, type:int=1):
|
|||
o2.save()
|
||||
material.count = material.count + i.count
|
||||
material.save()
|
||||
# 如果有详细半成品
|
||||
pass
|
||||
elif instance.type in [FIFO.FIFO_TYPE_DO_OUT]: # 生产领料
|
||||
# 更新相关表
|
||||
for i in FIFOItem.objects.filter(fifo=instance):
|
||||
|
|
|
@ -53,8 +53,9 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
|||
act_state=WProduct.WPR_ACT_STATE_OK, m_state=material, is_deleted=False)
|
||||
if wproducts.exists():
|
||||
# 创建入库记录
|
||||
remark = vdata.get('remark', '')
|
||||
fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_IN,
|
||||
is_audited=True, auditor=request.user, inout_date=timezone.now(), create_by=request.user)
|
||||
is_audited=True, auditor=request.user, inout_date=timezone.now(), create_by=request.user, remark=remark)
|
||||
# 创建入库明细
|
||||
fifoitem = FIFOItem()
|
||||
fifoitem.is_tested = True
|
||||
|
@ -111,7 +112,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
|||
perms_map={'*':'*'}
|
||||
queryset = WProduct.objects.select_related('p_state', 'm_state').filter(is_hidden=False)
|
||||
serializer_class = WProductListSerializer
|
||||
filterset_fields = ['p_state', 'subproduction_plan', 'm_state', 'production_plan', 'p_state__process']
|
||||
filterset_fields = ['p_state', 'subproduction_plan', 'm_state', 'production_plan', 'p_state__process', 'act_state']
|
||||
search_fields = ['number']
|
||||
ordering_fields = ['id']
|
||||
ordering = ['id']
|
||||
|
|
Loading…
Reference in New Issue