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 a954a37..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 obj.ow_wproduct.ow_operation.count() >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 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')