工单状态优化

This commit is contained in:
yuxianghui
2024-09-18 11:53:46 +08:00
parent 5d870d53f6
commit ef453dbc1e

View File

@@ -1025,20 +1025,20 @@ class ResMrpWorkOrder(models.Model):
# 查询工序最小的非完工、非返工的装夹预调工单 # 查询工序最小的非完工、非返工的装夹预调工单
work_id = self.search( work_id = self.search(
[('production_id', '=', workorder.production_id.id), [('production_id', '=', workorder.production_id.id),
('routing_type', '=', '装夹预调'),
('state', 'not in', ['rework', 'done', 'cancel'])], ('state', 'not in', ['rework', 'done', 'cancel'])],
limit=1, limit=1,
order="sequence") order="sequence")
if workorder == work_id: if work_id.routing_type == '装夹预调':
if workorder.production_id.reservation_state == 'assigned': if workorder == work_id:
workorder.state = 'ready' if workorder.production_id.reservation_state == 'assigned':
elif workorder.production_id.reservation_state != 'assigned': workorder.state = 'ready'
workorder.state = 'waiting' elif workorder.production_id.reservation_state != 'assigned':
continue workorder.state = 'waiting'
elif (workorder.name == '装夹预调' and continue
workorder.state not in ['rework', 'done', 'cancel']): elif (workorder.name == '装夹预调' and
if workorder.state != 'pending': workorder.state not in ['rework', 'done', 'cancel']):
workorder.state = 'pending' if workorder.state != 'pending':
workorder.state = 'pending'
if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready': if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready':
workorder.state = 'waiting' workorder.state = 'waiting'
continue continue