报废操作bug
This commit is contained in:
parent
71e00d8455
commit
b104a93828
|
@ -339,6 +339,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
serializer = ScrapSerializer(data=request.data)
|
serializer = ScrapSerializer(data=request.data)
|
||||||
|
serializer.is_valid(raise_exception=True)
|
||||||
vdata = serializer.validated_data
|
vdata = serializer.validated_data
|
||||||
if obj.act_state == WProduct.WPR_ACT_STATE_NOTOK:
|
if obj.act_state == WProduct.WPR_ACT_STATE_NOTOK:
|
||||||
pass
|
pass
|
||||||
|
@ -363,21 +364,29 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
||||||
# return WorkflowSimpleSerializer(instance=wfs, many=True).data
|
# return WorkflowSimpleSerializer(instance=wfs, many=True).data
|
||||||
|
|
||||||
@action(methods=['get'], detail=True, perms_map={'get':'*'})
|
@action(methods=['get'], detail=True, perms_map={'get':'*'})
|
||||||
def bhg_wf(self, request, pk=None):
|
def wf_bhg(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
发起不合格审理单
|
发起不合格审理单
|
||||||
"""
|
"""
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
if obj.act_state != WProduct.WPR_ACT_STATE_NOTOK:
|
if obj.act_state != WProduct.WPR_ACT_STATE_NOTOK:
|
||||||
raise exceptions.APIException('非检验不合格产品不可发起不合格审理')
|
raise exceptions.APIException('非检验不合格产品不可发起不合格审理')
|
||||||
ret = {
|
workflow = Workflow.objects.filter(name='不合格品审理单', is_deletd=False).first()
|
||||||
|
if workflow:
|
||||||
|
exist_data = {
|
||||||
'sys_wproduct':obj.id,
|
'sys_wproduct':obj.id,
|
||||||
'sys_name':obj.material.name,
|
'sys_name':obj.material.name,
|
||||||
'sys_specification':obj.material.specification,
|
'sys_specification':obj.material.specification,
|
||||||
'sys_finder':request.user.id,
|
'sys_finder':request.user.id,
|
||||||
'sys_process':obj.step.process.id,
|
'sys_process':obj.step.process.id,
|
||||||
}
|
}
|
||||||
return Response(ret)
|
ret = {'workflow':workflow.id}
|
||||||
|
ret['exist_data'] = exist_data
|
||||||
|
return Response(ret)
|
||||||
|
else:
|
||||||
|
raise exceptions.APIException('未找到对应工作流程')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue