暂时去掉根据CNC工单是否有编程单来控制装夹预调工单状态的功能,待重议此需求逻辑
This commit is contained in:
@@ -667,36 +667,36 @@ class ResMrpWorkOrder(models.Model):
|
||||
# 'domain': [('production_id', '=', self.id)],
|
||||
# 'target':'new'
|
||||
# }
|
||||
@api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state')
|
||||
def _compute_state(self):
|
||||
for workorder in self:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
cnc_workorder = self.search(
|
||||
[('production_id', '=', workorder.production_id.id), ('routing_type', '=', 'CNC加工')],
|
||||
limit=1, order='id asc')
|
||||
if not cnc_workorder:
|
||||
workorder.state = 'waiting'
|
||||
else:
|
||||
for item in cnc_workorder.cnc_ids:
|
||||
functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||
[('tool_name_id.name', '=', item.cutting_tool_name)])
|
||||
if not functional_cutting_tool:
|
||||
workorder.state = 'waiting'
|
||||
if workorder.state == 'pending':
|
||||
if all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||
workorder.state = 'ready' if workorder.production_id.reservation_state == 'assigned' else 'waiting'
|
||||
continue
|
||||
if workorder.state not in ('waiting', 'ready'):
|
||||
continue
|
||||
if not all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||
workorder.state = 'pending'
|
||||
continue
|
||||
if workorder.production_id.reservation_state not in ('waiting', 'confirmed', 'assigned'):
|
||||
continue
|
||||
if workorder.production_id.reservation_state == 'assigned' and workorder.state == 'waiting':
|
||||
workorder.state = 'ready'
|
||||
elif workorder.production_id.reservation_state != 'assigned' and workorder.state == 'ready':
|
||||
workorder.state = 'waiting'
|
||||
# @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state')
|
||||
# def _compute_state(self):
|
||||
# for workorder in self:
|
||||
# if workorder.routing_type == '装夹预调':
|
||||
# cnc_workorder = self.search(
|
||||
# [('production_id', '=', workorder.production_id.id), ('routing_type', '=', 'CNC加工')],
|
||||
# limit=1, order='id asc')
|
||||
# if not cnc_workorder:
|
||||
# workorder.state = 'waiting'
|
||||
# else:
|
||||
# for item in cnc_workorder.cnc_ids:
|
||||
# functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||
# [('tool_name_id.name', '=', item.cutting_tool_name)])
|
||||
# if not functional_cutting_tool:
|
||||
# workorder.state = 'waiting'
|
||||
# if workorder.state == 'pending':
|
||||
# if all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||
# workorder.state = 'ready' if workorder.production_id.reservation_state == 'assigned' else 'waiting'
|
||||
# continue
|
||||
# if workorder.state not in ('waiting', 'ready'):
|
||||
# continue
|
||||
# if not all([wo.state in ('done', 'cancel') for wo in workorder.blocked_by_workorder_ids]):
|
||||
# workorder.state = 'pending'
|
||||
# continue
|
||||
# if workorder.production_id.reservation_state not in ('waiting', 'confirmed', 'assigned'):
|
||||
# continue
|
||||
# if workorder.production_id.reservation_state == 'assigned' and workorder.state == 'waiting':
|
||||
# workorder.state = 'ready'
|
||||
# elif workorder.production_id.reservation_state != 'assigned' and workorder.state == 'ready':
|
||||
# workorder.state = 'waiting'
|
||||
|
||||
def recreateManufacturingOrWorkerOrder(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user