Merge branch 'feature/优化工单_4' into feature/优化工单_5
This commit is contained in:
@@ -907,18 +907,40 @@ class ResMrpWorkOrder(models.Model):
|
||||
# else:
|
||||
# if workorder.state not in ['cancel', 'rework']:
|
||||
# workorder.state = 'rework'
|
||||
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
|
||||
if workorder.production_id.tool_state in ['1', '2']:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']:
|
||||
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
|
||||
if workorder.production_id.tool_state in ['1', '2']:
|
||||
if workorder.state in ['ready']:
|
||||
workorder.state = 'waiting'
|
||||
continue
|
||||
elif workorder.state == 'pending' and self.search(
|
||||
elif workorder.state in ['waiting']:
|
||||
continue
|
||||
elif workorder.state == 'pending' and workorder == self.search(
|
||||
[('production_id', '=', workorder.production_id.id),
|
||||
('sequence', '=', workorder.sequence - 1),
|
||||
('state', 'in', ['done', 'rework'])]):
|
||||
('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),
|
||||
('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.state)
|
||||
|
||||
@@ -53,7 +53,8 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
|
||||
string='功能刀具安全库存', readonly=True)
|
||||
|
||||
@api.depends('barcode_id.quant_ids', 'functional_tool_status', 'current_shelf_location_id')
|
||||
@api.depends('barcode_id.quant_ids', 'barcode_id.quant_ids.location_id', 'functional_tool_status',
|
||||
'current_shelf_location_id')
|
||||
def _compute_current_location_id(self):
|
||||
for record in self:
|
||||
if record.functional_tool_status == '已拆除':
|
||||
|
||||
@@ -106,9 +106,9 @@ class CNCprocessing(models.Model):
|
||||
'handle_result': '待处理'
|
||||
})
|
||||
# 修改当前面装夹预调工单的 is_rework 为 True
|
||||
work_ids = production_id.workorder_ids.filtered(
|
||||
lambda a: a.routing_type == '装夹预调' and a.processing_panel == key and not a.is_rework)
|
||||
work_ids.write({'is_rework': True})
|
||||
# work_ids = production_id.workorder_ids.filtered(
|
||||
# lambda a: a.routing_type == '装夹预调' and a.processing_panel == key and not a.is_rework)
|
||||
# work_ids.write({'is_rework': True})
|
||||
# 对缺刀信息进行处理
|
||||
for key in data2:
|
||||
if data2.get(key):
|
||||
|
||||
Reference in New Issue
Block a user