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