diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index a8fa14a..96ee033 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -57,7 +57,7 @@ class PickSerializer(serializers.Serializer): i['count'] = len(i['iproducts']) isLowLevel = True if i['count']>0: - if 'iproducts' in i: + if isLowLevel: iproducts = i.pop('iproducts') i['fifo'] = fifo i['is_testok'] = True # 默认检测合格 @@ -91,12 +91,13 @@ class PickSerializer(serializers.Serializer): spp.save() if spp.count_pick > spp.count: raise exceptions.APIException('超过计划需求数') - # 更新半成品表 - wproducts = WProduct.objects.filter(pk__in=[x.wproduct for x in i['iproducts']]) - first_step = Step.objects.get(pk=sp.steps[0].id) - wproducts.update(step=first_step, is_executed=False, - act_state=WProduct.WPR_ACT_STATE_DOING, is_hidden=False, warehouse=None, - subproduction_plan=sp, production_plan=sp.production_plan) + if isLowLevel: + # 更新半成品表 + wproducts = WProduct.objects.filter(pk__in=[x.wproduct for x in i['iproducts']]) + first_step = Step.objects.get(pk=sp.steps[0].id) + wproducts.update(step=first_step, is_executed=False, + act_state=WProduct.WPR_ACT_STATE_DOING, is_hidden=False, warehouse=None, + subproduction_plan=sp, production_plan=sp.production_plan) sp.is_picked=True sp.state = SubProductionPlan.SUBPLAN_STATE_WORKING #生产中 sp.state_date_real = timezone.now() #实际开工日期