1、计划管理-产线设备资源设置模块优化,工作日历设置模块优化,添加选择提示;2、刀具管理-功能刀具组装、列表、预警、实时分布、出入库记录和组装界面的刀具物料字段绑定对象更改为库存下的刀具物料;3、功能刀具组装-组装界面添加选择提示,4、功能刀具列表下的能力参数对没有选择的图片不展示
This commit is contained in:
@@ -8,48 +8,42 @@ class ProcedureEquipmentResourceSetting(models.Model):
|
||||
|
||||
name = fields.Many2one('sf.production.line', string='生产线', required=True)
|
||||
work_center_name_id = fields.Many2one('mrp.workcenter', string='工作中心名称')
|
||||
equipment_code = fields.Char(string='机台号', readonly=True, compute='_onchange_equipment_name_id')
|
||||
equipment_name_id = fields.Many2one('maintenance.equipment',
|
||||
string='设备名称',
|
||||
readonly=True,
|
||||
compute='_onchange_work_center_name_id')
|
||||
brand = fields.Char(string='品牌', readonly=True, compute='_onchange_equipment_name_id')
|
||||
model = fields.Char(string='型号', readonly=True, compute='_onchange_equipment_name_id')
|
||||
equipment_name_id = fields.Many2one('maintenance.equipment', string='设备名称', readonly=True, search=True,
|
||||
compute='_compute_equipment_name_id')
|
||||
equipment_code = fields.Char(string='机台号', readonly=True, related='equipment_name_id.code')
|
||||
brand_id = fields.Many2one('sf.machine.brand', string='品牌', readonly=True, related='equipment_name_id.brand_id')
|
||||
type_id = fields.Many2one('sf.machine_tool.type', string='型号', readonly=True, related='equipment_name_id.type_id')
|
||||
status = fields.Selection(string='设备状态', readonly=True, related='equipment_name_id.state')
|
||||
# todo 传入工序数据
|
||||
working_procedure = fields.Char(string='工序', readonly=True)
|
||||
production_capacity = fields.Float(string='产能', required=True, digits=(4, 1))
|
||||
working_calendar_id = fields.Many2one('sf.work.log.setting', string='工作日历')
|
||||
working_shift_id = fields.Many2many('sf.working.shift', string='班次', readonly=True, compute='_onchange_working_calendar_id')
|
||||
working_shift_id = fields.Many2many('sf.working.shift', string='班次', readonly=True,
|
||||
compute='_compute_working_shift_id')
|
||||
create_time = fields.Datetime(string='新增时间', default=lambda self: fields.Datetime.now(), readonly=True)
|
||||
status = fields.Selection([('正常', '正常'), ('1', '故障停机'), ('2', '计划停机')],
|
||||
string='设备状态',
|
||||
readonly=True,
|
||||
compute='_onchange_equipment_name_id')
|
||||
participate_in_scheduling = fields.Boolean(string='参与排程', default=True)
|
||||
|
||||
@api.onchange('production_capacity')
|
||||
def _onchange_production_capacity(self):
|
||||
@api.depends('work_center_name_id')
|
||||
def _compute_equipment_name_id(self):
|
||||
for record in self:
|
||||
if record.work_center_name_id:
|
||||
record.equipment_name_id = record.work_center_name_id.equipment_id
|
||||
else:
|
||||
record.equipment_name_id = None
|
||||
|
||||
@api.constrains('production_capacity')
|
||||
def _check_production_capacity(self):
|
||||
for record in self:
|
||||
if record.production_capacity < 0:
|
||||
raise UserError("输入的产能值不正确,请重新输入!")
|
||||
|
||||
@api.depends('work_center_name_id')
|
||||
def _onchange_work_center_name_id(self):
|
||||
for record in self:
|
||||
record.equipment_name_id = record.work_center_name_id.equipment_id
|
||||
|
||||
@api.onchange('equipment_name_id')
|
||||
def _onchange_equipment_name_id(self):
|
||||
for record in self:
|
||||
record.equipment_code = record.equipment_name_id.code
|
||||
record.brand = record.equipment_name_id.brand_id.name
|
||||
record.model = record.equipment_name_id.type_id.name
|
||||
record.status = record.equipment_name_id.state
|
||||
raise UserError("产能不能为负!")
|
||||
|
||||
@api.depends('working_calendar_id')
|
||||
def _onchange_working_calendar_id(self):
|
||||
def _compute_working_shift_id(self):
|
||||
for record in self:
|
||||
record.working_shift_id = record.working_calendar_id.working_shift_ids
|
||||
if record.working_calendar_id:
|
||||
record.working_shift_id = record.working_calendar_id.working_shift_ids
|
||||
else:
|
||||
record.working_shift_id = None
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user