diff --git a/hb_server/apps/inm/views.py b/hb_server/apps/inm/views.py index 055b3a8..ce7a72d 100644 --- a/hb_server/apps/inm/views.py +++ b/hb_server/apps/inm/views.py @@ -190,15 +190,16 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet): 审核通过 """ obj = self.get_object() - if obj.type == FIFO.FIFO_TYPE_SALE_OUT: # 如果是销售提货,需额外处理 - pass - if not FIFOItem.objects.filter(fifo=obj).exists(): - raise ValidationError('出入库条目为空') - for i in FIFOItem.objects.filter(fifo=obj, need_test=True): - if not i.is_testok: - raise APIException('未检验通过, 不可审核') if obj.is_audited: - raise APIException('该入库记录已审核通过') + raise APIException('该入库记录已审核通过') + if obj.type == FIFO.FIFO_TYPE_SALE_OUT: # 如果是销售提货,需额外处理 + InmService.sale_out_audit(obj) + else: + if not FIFOItem.objects.filter(fifo=obj).exists(): + raise ValidationError('出入库条目为空') + for i in FIFOItem.objects.filter(fifo=obj, need_test=True): + if not i.is_testok: + raise APIException('未检验通过, 不可审核') obj.is_audited = True obj.auditor = request.user obj.inout_date = timezone.now() # 也是审核日期