diff --git a/hb_server/apps/wpm/models.py b/hb_server/apps/wpm/models.py index 55491ca..52f6f32 100644 --- a/hb_server/apps/wpm/models.py +++ b/hb_server/apps/wpm/models.py @@ -118,7 +118,7 @@ class WprouctTicket(CommonAModel): number = models.CharField('物品编号', null=True, blank=True, max_length=50) wproduct = models.ForeignKey(WProduct, verbose_name='关联产品', on_delete=models.CASCADE) material = models.ForeignKey(Material, verbose_name='所在物料状态', on_delete=models.CASCADE) - step = models.ForeignKey(Step, verbose_name='所在步骤', on_delete=models.CASCADE) + 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') diff --git a/hb_server/apps/wpm/services.py b/hb_server/apps/wpm/services.py index 04b8e87..b40104d 100644 --- a/hb_server/apps/wpm/services.py +++ b/hb_server/apps/wpm/services.py @@ -5,7 +5,7 @@ from apps.pm.models import SubProductionPlan, SubProductionProgress from apps.mtm.models import Material, Step, SubprodctionMaterial from apps.qm.models import TestRecord from apps.system.models import User -from apps.wpm.models import WProduct +from apps.wpm.models import WProduct, WprouctTicket from utils.tools import ranstr class WpmServies(object): @@ -48,7 +48,7 @@ class WpmServies(object): if is_testok: if wproduct.act_state == WProduct.WPR_ACT_STATE_TORETEST: # 复检 wproduct.act_state = WProduct.WPR_ACT_STATE_DOWAIT - wproduct.ng_sign = None # 把不合格标记去除 + elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and wproduct.material.type == Material.MA_TYPE_GOOD: # 成品检验 wproduct.act_state = WProduct.WPR_ACT_STATE_TOFINALTEST else: @@ -56,6 +56,11 @@ class WpmServies(object): if wproduct.number is None: # 产生半成品编号 wproduct.number = 'WP'+ranstr(7) + # 去除ng_sign + if wproduct.ng_sign: + wt = WprouctTicket.objects.order_by('id').last() #取最后的工单 + if wt.step.process == test.step.process: + wproduct.ng_sign = None # 更新子计划合格进度 ins = SubProductionProgress.objects.get(subproduction_plan=wproduct.subproduction_plan, is_main=True, type=SubprodctionMaterial.SUB_MA_TYPE_OUT) @@ -67,3 +72,11 @@ class WpmServies(object): wproduct.update_by = user wproduct.test = None wproduct.save() + +@classmethod +def update_subproduction_progress_main(cls, sp:SubProductionPlan, is_workdone:bool=False, is_testok:bool=False): + """ + 更新生产进度 + """ + if is_workdone: + ins = \ No newline at end of file diff --git a/hb_server/apps/wpm/signals.py b/hb_server/apps/wpm/signals.py index 6c61165..273d494 100644 --- a/hb_server/apps/wpm/signals.py +++ b/hb_server/apps/wpm/signals.py @@ -45,7 +45,7 @@ def handleTicket(sender, instance, created, **kwargs): 执行操作决定 """ ticket_data = instance.ticket_data - wt = instance.wt_ticket + wt = WprouctTicket.objects.get(ticket=instance) wp = wt.wproduct decision = WProduct.NG_BACK_WORK