Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化制造功能
This commit is contained in:
@@ -910,39 +910,40 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# if workorder.state not in ['cancel', 'rework']:
|
# if workorder.state not in ['cancel', 'rework']:
|
||||||
# workorder.state = 'rework'
|
# workorder.state = 'rework'
|
||||||
if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']:
|
if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']:
|
||||||
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
|
if workorder.production_id.programming_state == '已编程':
|
||||||
if workorder.production_id.tool_state in ['1', '2']:
|
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
|
||||||
if workorder.state in ['ready']:
|
if workorder.production_id.tool_state in ['1', '2']:
|
||||||
workorder.state = 'waiting'
|
if workorder.state in ['ready']:
|
||||||
continue
|
workorder.state = 'waiting'
|
||||||
elif workorder.state in ['waiting']:
|
continue
|
||||||
continue
|
elif workorder.state in ['waiting']:
|
||||||
elif workorder.state == 'pending' and workorder == self.search(
|
continue
|
||||||
[('production_id', '=', workorder.production_id.id),
|
elif workorder.state == 'pending' and workorder == self.search(
|
||||||
('routing_type', '=', '装夹预调'),
|
|
||||||
('state', 'not in', ['rework', 'done', 'cancel'])],
|
|
||||||
limit=1,
|
|
||||||
order="sequence"):
|
|
||||||
workorder.state = 'waiting'
|
|
||||||
continue
|
|
||||||
elif workorder.production_id.tool_state in ['0']:
|
|
||||||
if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'):
|
|
||||||
if not workorder.production_id.workorder_ids.filtered(
|
|
||||||
lambda a: (a.routing_type not in ['装夹预调'] and
|
|
||||||
a.state not in ['pending', 'done', 'rework', 'cancel'])):
|
|
||||||
# 查询工序最小的非完工、非返工的装夹预调工单
|
|
||||||
work_id = self.search(
|
|
||||||
[('production_id', '=', workorder.production_id.id),
|
[('production_id', '=', workorder.production_id.id),
|
||||||
('routing_type', '=', '装夹预调'),
|
('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:
|
workorder.state = 'waiting'
|
||||||
if workorder.production_id.reservation_state == 'assigned':
|
continue
|
||||||
workorder.state = 'ready'
|
elif workorder.production_id.tool_state in ['0']:
|
||||||
elif workorder.production_id.reservation_state != 'assigned':
|
if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'):
|
||||||
workorder.state = 'waiting'
|
if not workorder.production_id.workorder_ids.filtered(
|
||||||
continue
|
lambda a: (a.routing_type not in ['装夹预调'] and
|
||||||
|
a.state not in ['pending', 'done', 'rework', 'cancel'])):
|
||||||
|
# 查询工序最小的非完工、非返工的装夹预调工单
|
||||||
|
work_id = self.search(
|
||||||
|
[('production_id', '=', workorder.production_id.id),
|
||||||
|
('routing_type', '=', '装夹预调'),
|
||||||
|
('state', 'not in', ['rework', 'done', 'cancel'])],
|
||||||
|
limit=1,
|
||||||
|
order="sequence")
|
||||||
|
if workorder == work_id:
|
||||||
|
if workorder.production_id.reservation_state == 'assigned':
|
||||||
|
workorder.state = 'ready'
|
||||||
|
elif workorder.production_id.reservation_state != 'assigned':
|
||||||
|
workorder.state = 'waiting'
|
||||||
|
continue
|
||||||
|
|
||||||
logging.info('工序:%s' % workorder.sequence)
|
logging.info('工序:%s' % workorder.sequence)
|
||||||
logging.info('工单最终状态:%s' % workorder.state)
|
logging.info('工单最终状态:%s' % workorder.state)
|
||||||
|
|||||||
Reference in New Issue
Block a user