Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
b60633a535
|
@ -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']
|
||||||
|
|
|
@ -411,7 +411,7 @@ class ResourceViewSet(GenericViewSet):
|
||||||
del(half_list[0])
|
del(half_list[0])
|
||||||
return Response(res)
|
return Response(res)
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal_equip'}, serializer_class=ResourceCalListSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal'}, serializer_class=ResourceCalListSerializer)
|
||||||
def cal_equip(self, request, pk=None):
|
def cal_equip(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
设备状态查看
|
设备状态查看
|
||||||
|
|
|
@ -63,7 +63,7 @@ class OrderViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
return OrderCreateUpdateSerializer
|
return OrderCreateUpdateSerializer
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, perms_map={'get':'order_toplan'})
|
@action(methods=['get'], detail=False, perms_map={'get':'*'})
|
||||||
def toplan(self, request, pk=None):
|
def toplan(self, request, pk=None):
|
||||||
queryset = Order.objects.filter(count__gt=F('planed_count')).order_by('-id')
|
queryset = Order.objects.filter(count__gt=F('planed_count')).order_by('-id')
|
||||||
page = self.paginate_queryset(queryset)
|
page = self.paginate_queryset(queryset)
|
||||||
|
|
|
@ -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']
|
||||||
|
|
|
@ -54,6 +54,10 @@ class WpmService(object):
|
||||||
if wproduct.act_state == WProduct.WPR_ACT_STATE_TORETEST: # 复检
|
if wproduct.act_state == WProduct.WPR_ACT_STATE_TORETEST: # 复检
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||||
|
|
||||||
|
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and \
|
||||||
|
wproduct.subproduction_plan.subproduction.need_combtest : # 配置中需要质检
|
||||||
|
wproduct.act_state = WProduct.WPR_ACT_STATE_TOCOMBTEST
|
||||||
|
|
||||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and \
|
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and \
|
||||||
test.is_midtesting is True:
|
test.is_midtesting is True:
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||||
|
@ -62,9 +66,7 @@ class WpmService(object):
|
||||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and wproduct.material.type == Material.MA_TYPE_GOOD: # 成品检验
|
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and wproduct.material.type == Material.MA_TYPE_GOOD: # 成品检验
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_TOFINALTEST
|
wproduct.act_state = WProduct.WPR_ACT_STATE_TOFINALTEST
|
||||||
|
|
||||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and \
|
|
||||||
wproduct.subproduction_plan.subproduction.need_combtest : # 配置中需要质检
|
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_TOCOMBTEST
|
|
||||||
else:
|
else:
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_OK
|
wproduct.act_state = WProduct.WPR_ACT_STATE_OK
|
||||||
if wproduct.number is None: # 产生半成品编号
|
if wproduct.number is None: # 产生半成品编号
|
||||||
|
|
|
@ -141,7 +141,7 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
||||||
ordering_fields = ['material__number']
|
ordering_fields = ['material__number']
|
||||||
ordering = ['material__number']
|
ordering = ['material__number']
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': 'pick'}, serializer_class=PickSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': 'wmaterial_pick'}, serializer_class=PickSerializer)
|
||||||
def pick(self, request, pk=None):
|
def pick(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
领料
|
领料
|
||||||
|
@ -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))
|
||||||
|
@ -815,6 +817,7 @@ class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMix
|
||||||
raise exceptions.APIException('该操作已提交')
|
raise exceptions.APIException('该操作已提交')
|
||||||
instance.delete()
|
instance.delete()
|
||||||
wp = instance.wproduct
|
wp = instance.wproduct
|
||||||
|
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||||
wp.operation = None
|
wp.operation = None
|
||||||
wp.save()
|
wp.save()
|
||||||
return Response()
|
return Response()
|
||||||
|
|
Loading…
Reference in New Issue