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

This commit is contained in:
shilixia 2021-11-16 14:21:27 +08:00
commit e68f7fdb15
2 changed files with 6 additions and 4 deletions

View File

@ -171,7 +171,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
materials = [] materials = []
for i in need: for i in need:
materials.append(i['material']) materials.append(i['material'])
objs = MaterialBatch.objects.filter(material__id__in=materials) objs = MaterialBatch.objects.filter(material__id__in=materials).order_by('material__number')
have = MaterialBatchSerializer(instance=objs, many=True).data have = MaterialBatchSerializer(instance=objs, many=True).data
return Response({'need':need, 'have':have}) return Response({'need':need, 'have':have})

View File

@ -201,7 +201,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
if 'is_testok' not in vdata: if 'is_testok' not in vdata:
raise exceptions.APIException('未填写检测结论') raise exceptions.APIException('未填写检测结论')
obj = serializer.save(create_by = self.request.user, m_state=vdata['wproduct'].m_state) obj = serializer.save(create_by = self.request.user, m_state=wproduct.m_state)
tris = [] tris = []
for m in record_data: # 保存记录详情 for m in record_data: # 保存记录详情
form_field = m['form_field'] form_field = m['form_field']
@ -219,8 +219,10 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
# 如果检测合格, 变更动态产品进行状态 # 如果检测合格, 变更动态产品进行状态
if obj.is_testok: if obj.is_testok:
vdata['wproduct'].act_state = WProduct.WPR_ACT_STATE_OK wproduct.act_state = WProduct.WPR_ACT_STATE_OK
vdata['wproduct'].save() if wproduct.number is None: # 产生半成品编号
wproduct.number = 'BCP' + str(timezone.now())
wproduct.save()
# 更新子计划状态 # 更新子计划状态
# 获取该子计划主产品数, 更新进度 # 获取该子计划主产品数, 更新进度
main_count = WProduct.objects.filter(subproduction_plan=wproduct.subproduction_plan, act_stae=WProduct.WPR_ACT_STATE_OK).count() main_count = WProduct.objects.filter(subproduction_plan=wproduct.subproduction_plan, act_stae=WProduct.WPR_ACT_STATE_OK).count()