diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index e9537d9..ce5eb9c 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -463,12 +463,20 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): card_data = WProductCardSerializer(instance=obj).data ret = [] if card_data['parents']: - pass - else: - ret.append(['序号', '工序', card_data['number']]) - step_list_full = card_data['step_list_full'] - for index, item in enumerate(step_list_full): - ret.append([str(index+1), item['step_name'], item['actions']]) + line1 = ['序号', '工序'] + for i in card_data['parents']: + line1.append(i['number']) + ret.append(line1) + steps_list_full_1 = card_data['parents'][0]['step_list_full'] + for index, item in enumerate(steps_list_full_1): + linex = [str(index+1), item['step_name']] + for i in card_data['parents']: + linex.append(i['step_list_full'][index]['actions']) + ret.append(linex) + ret.append(['序号', '工序', card_data['number']]) + step_list_full = card_data['step_list_full'] + for index, item in enumerate(step_list_full): + ret.append([str(index+1), item['step_name'], item['actions']]) return Response(ret) class WproductTicketViewSet(ListModelMixin, GenericViewSet):