领料更新车间物料时只处理物料
This commit is contained in:
parent
20c70b3d11
commit
6f6707c024
|
@ -77,8 +77,8 @@ class StepViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet):
|
|||
"""
|
||||
子工序-增删改查
|
||||
"""
|
||||
perms_map = {'get':'*', 'post':'step_create',
|
||||
'put':'step_update', 'delete':'step_delete'}
|
||||
perms_map = {'get':'*', 'post':'process_update',
|
||||
'put':'process_update', 'delete':'process_update'}
|
||||
queryset = Step.objects.all()
|
||||
serializer_class = StepSerializer
|
||||
search_fields = ['name', 'number']
|
||||
|
|
|
@ -93,15 +93,16 @@ class PickSerializer(serializers.Serializer):
|
|||
FIFOItemProduct.objects.bulk_create(mls)
|
||||
|
||||
# 更新车间物料
|
||||
wm, _ = WMaterial.objects.get_or_create(material=i['material'], batch=i['batch'], \
|
||||
subproduction_plan=sp,defaults={
|
||||
'material':i['material'],
|
||||
'batch':i['batch'],
|
||||
'subproduction_plan':sp,
|
||||
'count':0
|
||||
})
|
||||
wm.count = wm.count + i['count']
|
||||
wm.save()
|
||||
if i['material'].type != Material.MA_TYPE_HALFGOOD:
|
||||
wm, _ = WMaterial.objects.get_or_create(material=i['material'], batch=i['batch'], \
|
||||
subproduction_plan=sp,defaults={
|
||||
'material':i['material'],
|
||||
'batch':i['batch'],
|
||||
'subproduction_plan':sp,
|
||||
'count':0
|
||||
})
|
||||
wm.count = wm.count + i['count']
|
||||
wm.save()
|
||||
# 更新子计划物料情况
|
||||
spp = SubProductionProgress.objects.get(material=i['material'], subproduction_plan=sp, type=SubprodctionMaterial.SUB_MA_TYPE_IN)
|
||||
spp.count_pick = spp.count_pick + i['count']
|
||||
|
|
|
@ -281,6 +281,8 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
ip = {}
|
||||
ip['fifoitem'] = fifoitem
|
||||
ip['wproduct'] = i
|
||||
if i.number is None:
|
||||
raise exceptions.APIException('缺少编号')
|
||||
ip['number'] = i.number
|
||||
ip['material'] = i.material
|
||||
ips.append(FIFOItemProduct(**ip))
|
||||
|
|
Loading…
Reference in New Issue