领料更新车间物料时只处理物料

This commit is contained in:
caoqianming 2022-03-01 13:21:01 +08:00
parent 20c70b3d11
commit 6f6707c024
3 changed files with 14 additions and 11 deletions

View File

@ -77,8 +77,8 @@ class StepViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet):
""" """
子工序-增删改查 子工序-增删改查
""" """
perms_map = {'get':'*', 'post':'step_create', perms_map = {'get':'*', 'post':'process_update',
'put':'step_update', 'delete':'step_delete'} 'put':'process_update', 'delete':'process_update'}
queryset = Step.objects.all() queryset = Step.objects.all()
serializer_class = StepSerializer serializer_class = StepSerializer
search_fields = ['name', 'number'] search_fields = ['name', 'number']

View File

@ -93,15 +93,16 @@ class PickSerializer(serializers.Serializer):
FIFOItemProduct.objects.bulk_create(mls) FIFOItemProduct.objects.bulk_create(mls)
# 更新车间物料 # 更新车间物料
wm, _ = WMaterial.objects.get_or_create(material=i['material'], batch=i['batch'], \ if i['material'].type != Material.MA_TYPE_HALFGOOD:
subproduction_plan=sp,defaults={ wm, _ = WMaterial.objects.get_or_create(material=i['material'], batch=i['batch'], \
'material':i['material'], subproduction_plan=sp,defaults={
'batch':i['batch'], 'material':i['material'],
'subproduction_plan':sp, 'batch':i['batch'],
'count':0 'subproduction_plan':sp,
}) 'count':0
wm.count = wm.count + i['count'] })
wm.save() 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 = SubProductionProgress.objects.get(material=i['material'], subproduction_plan=sp, type=SubprodctionMaterial.SUB_MA_TYPE_IN)
spp.count_pick = spp.count_pick + i['count'] spp.count_pick = spp.count_pick + i['count']

View File

@ -281,6 +281,8 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
ip = {} ip = {}
ip['fifoitem'] = fifoitem ip['fifoitem'] = fifoitem
ip['wproduct'] = i ip['wproduct'] = i
if i.number is None:
raise exceptions.APIException('缺少编号')
ip['number'] = i.number ip['number'] = i.number
ip['material'] = i.material ip['material'] = i.material
ips.append(FIFOItemProduct(**ip)) ips.append(FIFOItemProduct(**ip))