1、重构工单cnc编程用刀校验方法;制造订单、工单、cnc编程单添加刀具状态字段,并且根据cnc编程单刀具状态自动计算制造订单、工单刀具状态字段的值;制造订单form页新增展示功能刀具状态字段;2、功能刀具拆解单刀具物料选择目标货位添加过滤添加为只选择所属货区是刀具房的货位;

This commit is contained in:
yuxianghui
2024-07-10 16:23:24 +08:00
parent 27eb959a2a
commit 129f8a4d7d
6 changed files with 120 additions and 44 deletions

View File

@@ -24,6 +24,21 @@ class MrpProduction(models.Model):
work_order_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
string='工单状态', default='未排')
tool_state = fields.Selection([('0', '正常'), ('1', '缺刀'), ('2', '无效刀')], string='功能刀具状态', default='0',
store=True, compute='_compute_tool_state')
tool_state_remark = fields.Text(string='功能刀具状态备注', readonly=True)
@api.depends('workorder_ids.tool_state')
def _compute_tool_state(self):
for item in self:
if item:
if item.workorder_ids.filtered(lambda a: a.tool_state == '2'):
item.tool_state = '2'
elif item.workorder_ids.filtered(lambda a: a.tool_state == '1'):
item.tool_state = '1'
else:
item.tool_state = '0'
# state = fields.Selection(selection_add=[
# ('pending_scheduling', '待排程'),
# ('pending_processing', '待加工'),

View File

@@ -158,6 +158,21 @@ class ResMrpWorkOrder(models.Model):
# 加工图纸
processing_drawing = fields.Binary(string='加工图纸')
# 功能刀具状态
tool_state = fields.Selection([('0', '正常'), ('1', '缺刀'), ('2', '无效刀')], string='功能刀具状态', default='0',
store=True, compute='_compute_tool_state')
@api.depends('cnc_ids.tool_state')
def _compute_tool_state(self):
for item in self:
if item:
if item.cnc_ids.filtered(lambda a: a.tool_state == '2'):
item.tool_state = '2'
elif item.cnc_ids.filtered(lambda a: a.tool_state == '1'):
item.tool_state = '1'
else:
item.tool_state = '0'
@api.depends('production_id')
def _compute_save_name(self):
"""