处理机床能力数据
This commit is contained in:
@@ -19,6 +19,7 @@ class SfEquipmentSaintenanceStandards(models.Model):
|
||||
num = "%04d" % m
|
||||
return num
|
||||
code = fields.Char(string='编码', default=get_no)
|
||||
remark = fields.Char('备注')
|
||||
maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养')
|
||||
name = fields.Char(string='名称')
|
||||
created_user_id = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||
@@ -26,7 +27,7 @@ class SfEquipmentSaintenanceStandards(models.Model):
|
||||
maintenance_equipment_ids = fields.Many2many(
|
||||
'maintenance.equipment',
|
||||
'sf_maintenance_equipment_ids',
|
||||
string='设备',
|
||||
string='适用设备',
|
||||
domain="[('category_id', '=', maintenance_equipment_category_id)]"
|
||||
)
|
||||
|
||||
@@ -42,23 +43,29 @@ class SfEquipmentSaintenanceStandards(models.Model):
|
||||
if record.maintenance_type == '检修':
|
||||
record.write({'overhaul_ids': [(6, 0, record.maintenance_equipment_ids.ids)]})
|
||||
|
||||
@api.onchange("maintenance_standards_ids")
|
||||
def _reset_work_order_sequence(self):
|
||||
for rec in self:
|
||||
current_sequence = 1
|
||||
for work in rec.maintenance_standards_ids:
|
||||
work.sequence = current_sequence
|
||||
current_sequence += 1
|
||||
# @api.onchange("maintenance_standards_ids")
|
||||
# def _reset_work_order_sequence(self):
|
||||
# for rec in self:
|
||||
# current_sequence = 1
|
||||
# for work in rec.maintenance_standards_ids:
|
||||
# work.sequence = current_sequence
|
||||
# current_sequence += 1
|
||||
|
||||
class SfSaintenanceStandards(models.Model):
|
||||
_name = 'maintenance.standards'
|
||||
_description = '维保项目'
|
||||
_order = 'sequence'
|
||||
|
||||
sequence = fields.Integer('序号')
|
||||
name = fields.Char('维保项目')
|
||||
maintenance_standards = fields.Char('维保标准')
|
||||
fault_type = fields.Selection(
|
||||
[('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='类别')
|
||||
equipment_maintenance_standards_id = fields.Many2one('equipment.maintenance.standards', string='设备维保标准')
|
||||
maintenance_request_id = fields.Many2one('maintenance.request', string='设备维保计划')
|
||||
images = fields.One2many('maintenance.standard.image', 'standard_id', string='反馈图片')
|
||||
Period = fields.Integer('周期/频次(天)')
|
||||
remark = fields.Char('备注说明')
|
||||
|
||||
|
||||
class MaintenanceStandardImage(models.Model):
|
||||
|
||||
@@ -44,6 +44,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
overhaul_period = fields.Integer(string='预防检修频次')
|
||||
overhaul_duration = fields.Float(string='检修时长')
|
||||
|
||||
|
||||
overhaul_id = fields.Many2one('equipment.maintenance.standards', string='设备检修标准',
|
||||
domain="[('maintenance_type','=','检修')]")
|
||||
|
||||
@@ -142,7 +143,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
active = fields.Boolean('有效', default=True)
|
||||
# 多个型号对应一个机床
|
||||
machine_tool_id = fields.Many2one('sf.machine_tool', '机床')
|
||||
sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs','maintenance_equipment_id', '设备故障日志')
|
||||
sf_maintenance_logs_ids = fields.One2many('sf.maintenance.logs', 'maintenance_equipment_id', '设备故障日志')
|
||||
|
||||
|
||||
def name_get(self):
|
||||
@@ -481,5 +482,8 @@ class MaintenanceStandardImage(models.Model):
|
||||
_name = 'maintenance.equipment.image'
|
||||
_description = '设备图文展示'
|
||||
|
||||
|
||||
active = fields.Boolean('有效', default=True)
|
||||
name = fields.Char('加工能力')
|
||||
image = fields.Binary(string='设备图文')
|
||||
equipment_id = fields.Many2many('maintenance.equipment', 'image_id', string='设备')
|
||||
@@ -22,3 +22,5 @@ class SfMaintenanceLogs(models.Model):
|
||||
recovery_time = fields.Datetime(string='复原时间')
|
||||
fault_duration = fields.Float(string='故障时长')
|
||||
note = fields.Text(string='备注')
|
||||
|
||||
|
||||
|
||||
@@ -21,14 +21,26 @@
|
||||
<group>
|
||||
<field name="maintenance_type" required="1"/>
|
||||
<field name="created_user_id"/>
|
||||
|
||||
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
<field name="maintenance_equipment_ids" widget="many2many_tags" attrs="{'invisible': [('maintenance_equipment_category_id', '=', False)]}"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="维保项目">
|
||||
|
||||
<field name="maintenance_standards_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="fault_type"/>
|
||||
<field name="maintenance_standards"/>
|
||||
<field name="Period"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
@@ -46,6 +58,7 @@
|
||||
<field name="maintenance_equipment_ids"/>
|
||||
<field name="created_user_id"/>
|
||||
<field name="create_date" string="创建时间"/>
|
||||
<field name="remark"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -24,9 +24,11 @@
|
||||
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}">
|
||||
<field name="maintenance_standards" widget="ony2many">
|
||||
<tree>
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="maintenance_standards"/>
|
||||
<field name="images"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -78,8 +80,16 @@
|
||||
<form string="设备维保项目">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="maintenance_standards"/>
|
||||
<group>
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="maintenance_standards"/>
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
|
||||
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="上传图片">
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
<!-- <field string="Maintenance" name="maintenance_count" widget="statinfo"/>-->
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
|
||||
|
||||
<button name="%(action_maintenance_logs)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
@@ -46,6 +47,10 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='maintenance_team_id']" position="before">
|
||||
<field name="machine_tool_picture" widget="image"/>
|
||||
<label for="enroll_machine_tool"/>
|
||||
<div class="col-12 col-lg-6 o_setting_box" style="white-space: nowrap">
|
||||
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='category_id']" position="after">
|
||||
<field name="state_zc" readonly="1"/>
|
||||
@@ -173,10 +178,12 @@
|
||||
</page>
|
||||
|
||||
<page string="图文展示">
|
||||
<field name='image_id' widget="one2many">
|
||||
<field name='image_id' widget="many2many_checkboxes" options="{'no_create': True}" style="white-space: nowrap;">
|
||||
<tree editable="bottom">
|
||||
<field name="name" />
|
||||
<field name="image" widget="image"
|
||||
options="{'size': [100, 100], 'click enlarge': True}"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -222,7 +229,7 @@
|
||||
<group string="其他">
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>
|
||||
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
|
||||
@@ -11,13 +11,18 @@ class ResWorkcenter(models.Model):
|
||||
production_line_show = fields.Char(string='生产线名称')
|
||||
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||
is_process_outsourcing = fields.Boolean('工艺外协')
|
||||
users_ids = fields.Many2many("res.users", 'users_workcenter')
|
||||
|
||||
equipment_id = fields.Many2one(
|
||||
'maintenance.equipment', string="设备",
|
||||
check_company=True)
|
||||
|
||||
|
||||
|
||||
is_process_outsourcing = fields.Boolean('工艺外协')
|
||||
users_ids = fields.Many2many("res.users", 'users_workcenter')
|
||||
|
||||
|
||||
|
||||
|
||||
equipment_status = fields.Selection(
|
||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||
string="设备状态", compute='_compute_equipment_id')
|
||||
|
||||
Reference in New Issue
Block a user