fix: work_start_time 可不填
This commit is contained in:
parent
8eee09678a
commit
f5f6c136d9
|
@ -636,18 +636,15 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
mgroup:Mgroup = attrs['mgroup']
|
mgroup:Mgroup = attrs['mgroup']
|
||||||
work_start_time:datetime = attrs.get('work_start_time', None)
|
work_start_time:datetime = attrs.get('work_start_time', None)
|
||||||
if work_start_time:
|
if work_start_time:
|
||||||
handle_date, attrs["shift"] = mgroup.get_shift(work_start_time)
|
attrs['handle_date'], attrs["shift"] = mgroup.get_shift(work_start_time)
|
||||||
else:
|
else:
|
||||||
if "handle_date" in attrs and attrs["handle_date"]:
|
if "handle_date" in attrs and attrs["handle_date"]:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise ParseError('缺少生产日期')
|
raise ParseError('缺少生产日期')
|
||||||
if mtask and mtask.start_date == mtask.end_date:
|
if mtask and mtask.start_date == mtask.end_date:
|
||||||
attrs['handle_date'] = mtask.end_date
|
if attrs['handle_date'] != mtask.end_date:
|
||||||
if attrs['handle_date'] != handle_date:
|
|
||||||
raise ParseError('任务日期与生产日期不一致')
|
raise ParseError('任务日期与生产日期不一致')
|
||||||
elif work_start_time:
|
|
||||||
attrs['handle_date'] = handle_date
|
|
||||||
|
|
||||||
handle_user = attrs.get('handle_user', None)
|
handle_user = attrs.get('handle_user', None)
|
||||||
if handle_user is None and hasattr(self, "request"):
|
if handle_user is None and hasattr(self, "request"):
|
||||||
|
|
Loading…
Reference in New Issue