feat: 改版交接必须为合批操作

This commit is contained in:
caoqianming 2025-11-11 09:35:43 +08:00
parent e001de9bb6
commit acf09d0056
2 changed files with 3 additions and 4 deletions

View File

@ -1189,14 +1189,15 @@ class HandoverSerializer(CustomModelSerializer):
def validate(self, attrs):
if "mtype" not in attrs:
attrs['mtype'] = Handover.H_NORMAL
mtype = attrs["mtype"]
if 'type' not in attrs:
attrs['type'] = Handover.H_NORMAL
if attrs["type"] == Handover.H_CHANGE:
attrs["mtype"] = Handover.H_MERGE
if "material_changed" not in attrs:
raise ParseError("必须指定改版后的物料")
if mtype == Handover.H_MERGE:
if attrs["mtype"] == Handover.H_MERGE:
new_state = None
new_wm:WMaterial = attrs.get("new_wm", None)
if new_wm:

View File

@ -720,8 +720,6 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
recive_mgroup = handover.recive_mgroup
recive_dept = handover.recive_dept
if handover.type == Handover.H_CHANGE:
handover.mtype = Handover.H_MERGE
new_batch = handover.new_batch
if new_batch and mtype != Handover.H_MERGE:
raise ParseError("只有合并时才能提供新批次号")