Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shilixia 2021-11-24 14:11:54 +08:00
commit 4cbc4e8d90
4 changed files with 10 additions and 9 deletions

View File

@ -149,9 +149,9 @@ class FIFOViewSet(ListModelMixin, GenericViewSet):
审核通过
"""
obj = self.get_object()
for i in FIFOItem.objects.filter(fifo=obj):
if not i.is_testok:
raise APIException('未检验通过, 不可审核')
# for i in FIFOItem.objects.filter(fifo=obj):
# if not i.is_testok:
# raise APIException('未检验通过, 不可审核')
if obj.is_audited:
raise APIException('该入库记录已审核通过')
with transaction.atomic():

View File

@ -13,6 +13,7 @@ def update_subplan_main(sender, instance, created, **kwargs):
subplan.main_product = instance.material
subplan.main_count = instance.count
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:
subplan.state = SubProductionPlan.SUBPLAN_STATE_DONE
elif instance.count_ok < instance.count and instance.count_ok > 0:

View File

@ -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.count_pick = spp.count_pick + i['count']
spp.save()
if spp.count_pick > spp.count:
raise exceptions.APIException('超过计划需求数')
# if spp.count_pick > spp.count:
# raise exceptions.APIException('超过计划需求数')
if isLowLevel:
# 更新半成品表
wids = IProduct.objects.filter(pk__in=[x.id for x in iproducts]).values_list('wproduct', flat=True)

View File

@ -38,7 +38,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
serializer_class = SubProductionPlanListSerializer
filterset_fields = ['production_plan', 'process', 'state', 'main_product', 'workshop']
ordering_fields = []
ordering = ['-id']
ordering = ['-update_time']
@action(methods=['post', 'get'], detail=True, perms_map={'post':'*', 'get':'*'}, serializer_class=PickHalfSerializer)
@transaction.atomic
@ -418,8 +418,6 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
for x in range(i.count):
WProduct.objects.create(**wpr)
elif step.type == Step.STEP_TYPE_COMB:
# 隐藏原半成品
ows = OperationWproduct.objects.filter(operation=op)
if i.subproduction_progress.is_main:
newstep, hasNext = WpmServies.get_next_step(i.subproduction_plan, step)
wproduct = WProduct()
@ -438,7 +436,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
instance.count_real = instance.count_real + 1 # 这个地方可能会有问题,不够严谨
instance.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.save()
return Response()