feat: handover count可不填写
This commit is contained in:
parent
e2f4cd1612
commit
0baec25a8b
|
|
@ -593,14 +593,17 @@ class HandoverSerializer(CustomModelSerializer):
|
|||
raise ValidationError('收料车间和收料工段必须有一个')
|
||||
if 'send_dept' not in attrs and 'send_mgroup' not in attrs:
|
||||
raise ValidationError('送料车间和送料工段必须有一个')
|
||||
t_count = 0
|
||||
for ind, item in enumerate(handoverb):
|
||||
wm = item["wm"]
|
||||
t_count += item["count"]
|
||||
if attrs["material"] != wm.material:
|
||||
raise ParseError(f'第{ind+1}物料与交接物料不一致')
|
||||
if wm.notok_sign is not None and attrs['type'] in [Handover.H_NORMAL, Handover.H_TEST]:
|
||||
raise ParseError(f'第{ind+1}物料不合格,不能进行正常/检验交接')
|
||||
if wm.count_xtest is not None:
|
||||
raise ParseError(f'第{ind+1}物料检验中,不能进行交接')
|
||||
attrs["count"] = t_count
|
||||
if attrs['type'] == Handover.H_SCRAP:
|
||||
attrs['recive_mgroup'] = attrs['send_mgroup']
|
||||
attrs['recive_dept'] = attrs['send_dept']
|
||||
|
|
@ -619,6 +622,8 @@ class HandoverSerializer(CustomModelSerializer):
|
|||
"recive_dept": {"required": False},
|
||||
"material": {"required": False},
|
||||
"batch": {"required": False},
|
||||
"count": {"required": False},
|
||||
"count_eweight": {"required": False}
|
||||
}
|
||||
|
||||
def create(self, validated_data):
|
||||
|
|
|
|||
Loading…
Reference in New Issue