From da239f0907b7df35113919d383fa46fddea39a23 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 17 Dec 2021 17:12:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/utils/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/utils/view.py b/hb_server/utils/view.py index 83974a5..8c20646 100644 --- a/hb_server/utils/view.py +++ b/hb_server/utils/view.py @@ -65,7 +65,7 @@ class UpdateDevelop(APIView): ret = os.popen('git pull https://caoqianming%40foxmail.com:9093qqww@e.coding.net/ctcdevteam/hberp/hberp.git develop') # 奇怪的处理 os.chdir('/home/hberp/hb_server/vuedist') - os.popen('cp index.html indexbak & rm -rf index.html & rename indexbak index.html') + os.popen('cp index.html indexbak & rm -rf index.html & mv indexbak index.html') # 打包前端 # os.chdir('/home/hberp/hb_client') # os.system('npm run build:prod') From 09de208ca5091854533e9d9142baa9218e1bd8ab Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 20 Dec 2021 09:23:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E6=93=8D=E4=BD=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index a954a37..709b73e 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -338,7 +338,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet): 报废操作 """ obj = self.get_object() - if obj.ow_wproduct.ow_operation.count() >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK: + if Operation.objects.filter(ow_operation__ow_wproduct=obj, is_submited=True) >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK: raise exceptions.APIException('该产品不支持直接报废') obj.act_state = WProduct.WPR_ACT_STATE_SCRAP obj.update_by = request.user From 2f30f51219f23a008c9da284cbf73ca5cc1ecd54 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 20 Dec 2021 09:30:12 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E6=93=8D=E4=BD=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 709b73e..9dd8571 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -338,7 +338,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet): 报废操作 """ obj = self.get_object() - if Operation.objects.filter(ow_operation__ow_wproduct=obj, is_submited=True) >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK: + if Operation.objects.filter(ow_operation__wproduct=obj, is_submited=True) >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK: raise exceptions.APIException('该产品不支持直接报废') obj.act_state = WProduct.WPR_ACT_STATE_SCRAP obj.update_by = request.user From 186fbff1c5ef0876577310d730ca34439227694d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 20 Dec 2021 10:46:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8A=A5=E5=BA=9F=E6=93=8D=E4=BD=9Cbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wf/models.py | 8 ++++++++ hb_server/apps/wf/scripts.py | 16 +++++++++++++++- hb_server/apps/wpm/models.py | 1 + hb_server/apps/wpm/views.py | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/hb_server/apps/wf/models.py b/hb_server/apps/wf/models.py index cdc4780..34eb8ec 100644 --- a/hb_server/apps/wf/models.py +++ b/hb_server/apps/wf/models.py @@ -212,6 +212,14 @@ class Ticket(CommonBModel): act_state = models.IntegerField('进行状态', default=1, help_text='当前工单的进行状态', choices=act_state_choices) multi_all_person = models.JSONField('全部处理的结果', default=dict, blank=True, help_text='需要当前状态处理人全部处理时实际的处理结果,json格式') +# class TicketCustomField(BaseModel): +# """ +# 工单自定义表单数据 +# """ +# form_field = models.ForeignKey(CustomField, verbose_name='关联自定义表单字段', on_delete=models.CASCADE) +# field_value = models.JSONField('录入值', null=True, blank=True) +# field_display_value = models.CharField('展示值', max_length=1000, null=True, blank=True, help_text='可用于只读时展示') +# ticket = models.ForeignKey(Ticket, verbose_name='关联的工单', on_delete=models.CASCADE, related_name='ticket_data') class TicketFlow(BaseModel): """ diff --git a/hb_server/apps/wf/scripts.py b/hb_server/apps/wf/scripts.py index 3bdb206..e96502f 100644 --- a/hb_server/apps/wf/scripts.py +++ b/hb_server/apps/wf/scripts.py @@ -12,4 +12,18 @@ class GetParticipants: def get_create_by(cls, state:dict={}, ticket:dict={}, ticket_data:dict={}, request={}): """工单创建人""" participant = ticket.create_by.id - return participant \ No newline at end of file + return participant + +class HandleScripts: + all_funcs = [ + {'func': 'handle_wproduct', 'name':'处理不合格品'} + ] + @classmethod + def handle_wproduct(cls, ticket:dict={}): + """处理不合格品""" + ticket_data = ticket.ticket_data + wp = ticket.wt_ticket + wp = ticket_data + if 'shenli2' in ticket_data and ticket_data['shenli2']: + if ticket_data['shenli2'] in ['返工', '返修']: + pass \ No newline at end of file diff --git a/hb_server/apps/wpm/models.py b/hb_server/apps/wpm/models.py index 5d82cca..4b10902 100644 --- a/hb_server/apps/wpm/models.py +++ b/hb_server/apps/wpm/models.py @@ -84,6 +84,7 @@ class WprouctTicket(CommonAModel): step = models.ForeignKey(Step, verbose_name='所在步骤', on_delete=models.CASCADE) subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='所在子生产计划', on_delete=models.CASCADE) ticket = models.ForeignKey('wf.ticket', verbose_name='关联工单', on_delete=models.CASCADE, related_name='wt_ticket') + decision = models.CharField('最终决定', null=True, blank=True, max_length=100) class Pick(CommonADModel): """ diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 9dd8571..a9d6482 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -338,7 +338,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet): 报废操作 """ obj = self.get_object() - if Operation.objects.filter(ow_operation__wproduct=obj, is_submited=True) >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK: + if Operation.objects.filter(ow_operation__wproduct=obj, is_submited=True).count() >4 or obj.act_state != WProduct.WPR_ACT_STATE_NOTOK: raise exceptions.APIException('该产品不支持直接报废') obj.act_state = WProduct.WPR_ACT_STATE_SCRAP obj.update_by = request.user