From 902dc5bd966e067cdb9b189ac88bf1155b0056c0 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 11 Jan 2022 16:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=8D=A12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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):