Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
4cbc4e8d90
|
@ -149,9 +149,9 @@ class FIFOViewSet(ListModelMixin, GenericViewSet):
|
||||||
审核通过
|
审核通过
|
||||||
"""
|
"""
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
for i in FIFOItem.objects.filter(fifo=obj):
|
# for i in FIFOItem.objects.filter(fifo=obj):
|
||||||
if not i.is_testok:
|
# if not i.is_testok:
|
||||||
raise APIException('未检验通过, 不可审核')
|
# raise APIException('未检验通过, 不可审核')
|
||||||
if obj.is_audited:
|
if obj.is_audited:
|
||||||
raise APIException('该入库记录已审核通过')
|
raise APIException('该入库记录已审核通过')
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
|
|
@ -13,6 +13,7 @@ def update_subplan_main(sender, instance, created, **kwargs):
|
||||||
subplan.main_product = instance.material
|
subplan.main_product = instance.material
|
||||||
subplan.main_count = instance.count
|
subplan.main_count = instance.count
|
||||||
subplan.main_count_real = instance.count_real
|
subplan.main_count_real = instance.count_real
|
||||||
|
subplan.main_count_ok = instance.count_ok
|
||||||
if instance.count_ok >= instance.count and instance.count_ok > 0:
|
if instance.count_ok >= instance.count and instance.count_ok > 0:
|
||||||
subplan.state = SubProductionPlan.SUBPLAN_STATE_DONE
|
subplan.state = SubProductionPlan.SUBPLAN_STATE_DONE
|
||||||
elif instance.count_ok < instance.count and instance.count_ok > 0:
|
elif instance.count_ok < instance.count and instance.count_ok > 0:
|
||||||
|
|
|
@ -92,8 +92,8 @@ class PickSerializer(serializers.Serializer):
|
||||||
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']
|
||||||
spp.save()
|
spp.save()
|
||||||
if spp.count_pick > spp.count:
|
# if spp.count_pick > spp.count:
|
||||||
raise exceptions.APIException('超过计划需求数')
|
# raise exceptions.APIException('超过计划需求数')
|
||||||
if isLowLevel:
|
if isLowLevel:
|
||||||
# 更新半成品表
|
# 更新半成品表
|
||||||
wids = IProduct.objects.filter(pk__in=[x.id for x in iproducts]).values_list('wproduct', flat=True)
|
wids = IProduct.objects.filter(pk__in=[x.id for x in iproducts]).values_list('wproduct', flat=True)
|
||||||
|
|
|
@ -38,7 +38,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
||||||
serializer_class = SubProductionPlanListSerializer
|
serializer_class = SubProductionPlanListSerializer
|
||||||
filterset_fields = ['production_plan', 'process', 'state', 'main_product', 'workshop']
|
filterset_fields = ['production_plan', 'process', 'state', 'main_product', 'workshop']
|
||||||
ordering_fields = []
|
ordering_fields = []
|
||||||
ordering = ['-id']
|
ordering = ['-update_time']
|
||||||
|
|
||||||
@action(methods=['post', 'get'], detail=True, perms_map={'post':'*', 'get':'*'}, serializer_class=PickHalfSerializer)
|
@action(methods=['post', 'get'], detail=True, perms_map={'post':'*', 'get':'*'}, serializer_class=PickHalfSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
@ -418,8 +418,6 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
for x in range(i.count):
|
for x in range(i.count):
|
||||||
WProduct.objects.create(**wpr)
|
WProduct.objects.create(**wpr)
|
||||||
elif step.type == Step.STEP_TYPE_COMB:
|
elif step.type == Step.STEP_TYPE_COMB:
|
||||||
# 隐藏原半成品
|
|
||||||
ows = OperationWproduct.objects.filter(operation=op)
|
|
||||||
if i.subproduction_progress.is_main:
|
if i.subproduction_progress.is_main:
|
||||||
newstep, hasNext = WpmServies.get_next_step(i.subproduction_plan, step)
|
newstep, hasNext = WpmServies.get_next_step(i.subproduction_plan, step)
|
||||||
wproduct = WProduct()
|
wproduct = WProduct()
|
||||||
|
@ -438,7 +436,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
instance.count_real = instance.count_real + 1 # 这个地方可能会有问题,不够严谨
|
instance.count_real = instance.count_real + 1 # 这个地方可能会有问题,不够严谨
|
||||||
instance.save()
|
instance.save()
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
ows.update(is_hidden=True, child=wproduct)
|
# 隐藏原半成品
|
||||||
|
wps = WProduct.objects.filter(ow_wproduct__operation = op)
|
||||||
|
wps.update(is_hidden=True, child=wproduct)
|
||||||
op.is_submited = True
|
op.is_submited = True
|
||||||
op.save()
|
op.save()
|
||||||
return Response()
|
return Response()
|
||||||
|
|
Loading…
Reference in New Issue