from odoo import models, fields

'''============================定位元件型号====================================='''


class FixtureSettingElement(models.Model):
    _name = 'sf.fixture.setting.element'
    _description = "定位元件型号"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="型号名称", readonly=True)
    setting_ele_type_id = fields.Many2one('sf.setting.element.type', string="定位元件类型", readonly=True)
    brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True)

    length = fields.Char(string='长度(mm)', readonly=True)
    width = fields.Char(string='宽度(mm)', readonly=True)
    height = fields.Char(string='高度(mm)', readonly=True)
    diameter = fields.Char(string='直径(mm)', readonly=True)

    material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True)
    hardness = fields.Char(string='硬度(°)', readonly=True)
    chucking_power = fields.Char(string='夹持力', readonly=True)
    surface_treatment = fields.Char(string='表面处理', readonly=True)
    accuracy_grade = fields.Char(string='精度等级', readonly=True)

    picture = fields.Binary(string="图片", readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''=============================定位原件类型============================================='''


class SettingElementType(models.Model):
    _name = 'sf.setting.element.type'
    _description = "定位原件类型"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string='定位原件类型', readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''==============================夹紧元件型号=============================================='''


class FixtureClampingElement(models.Model):
    _name = 'sf.fixture.clamping.element'
    _description = "夹紧元件型号"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="型号名称", readonly=True)
    clamping_ele_type_id = fields.Many2one('sf.clamping.element.type', string="夹紧元件类型", readonly=True)
    brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True)

    length = fields.Char(string='长度(mm)', readonly=True)
    width = fields.Char(string='宽度(mm)', readonly=True)
    height = fields.Char(string='高度(mm)', readonly=True)
    diameter = fields.Char(string='直径(mm)', readonly=True)

    material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True)
    hardness = fields.Char(string='硬度(°)', readonly=True)
    chucking_power = fields.Char(string='夹持力', readonly=True)
    surface_treatment = fields.Char(string='夹持方式', readonly=True)
    accuracy_grade = fields.Char(string='精度等级', readonly=True)

    picture = fields.Binary(string="图片", readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''============================夹紧元件类型======================================='''


# 夹紧元件类型
class ClampingElementType(models.Model):
    _name = "sf.clamping.element.type"
    _description = "夹紧元件类型"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(name='夹紧元件类型', readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''=========================对刀夹具型号====================================='''


class FixtureToolSetting(models.Model):
    _name = 'sf.fixture.tool.setting'
    _description = "对刀夹具型号"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="型号名称", readonly=True)
    tool_setting_type_id = fields.Many2one('sf.tool.setting.type', string="对刀夹具类型", readonly=True)
    brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True)

    length = fields.Char(string='长度(mm)', readonly=True)
    width = fields.Char(string='宽度(mm)', readonly=True)
    height = fields.Char(string='高度(mm)', readonly=True)
    diameter = fields.Char(string='直径(mm)', readonly=True)

    material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True)
    hardness = fields.Char(string='硬度(°)', readonly=True)
    chucking_power = fields.Char(string='夹持力', readonly=True)
    clamp_mode = fields.Char(string='夹持方式', readonly=True)
    accuracy_grade = fields.Char(string='精度等级', readonly=True)
    max_clamp_diameter = fields.Char('最大夹持直接(mm)', readonly=True)

    picture = fields.Binary(string="图片", readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''===========================对刀夹具类型=========================================='''


class ToolSettingType(models.Model):
    _name = 'sf.tool.setting.type'
    _description = "对刀夹具类型"

    code = fields.Char('编码', readonly=True)
    name = fields.Char(string='对刀夹具类型', readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''==========================定位装置型号======================================='''


class FixtureLocatingDevice(models.Model):
    _name = 'sf.fixture.locating.device'
    _description = "定位装置型号"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="型号名称", readonly=True)
    locating_device_type_id = fields.Many2one('sf.locating.device.type', string="定位装置类型", readonly=True)
    brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True)

    length = fields.Char(string='长度(mm)', readonly=True)
    width = fields.Char(string='宽度(mm)', readonly=True)
    height = fields.Char(string='高度(mm)', readonly=True)
    diameter = fields.Char(string='直径(mm)', readonly=True)

    material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True)
    weight = fields.Char(string='重量(kg)', readonly=True)
    accuracy_grade = fields.Char(string='精度等级', readonly=True)
    locate_mode_ids = fields.Many2many('sf.locating.device.locate.mode', string='定位装置定位方式', readonly=True)
    max_bearing_capacity = fields.Char(string='最大承载力', readonly=True)

    picture = fields.Binary(string="图片", readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''==============================定位装置类型================================'''


# 定位装置型号
class LocatingDeviceType(models.Model):
    _name = 'sf.locating.device.type'
    _description = "定位装置类型"

    code = fields.Char('编码', readonly=True)
    name = fields.Char(string='定位装置类型', readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''============================定位装置定位方式========================================'''


# 定位装置定位方式
class LocatingDeviceLocateMode(models.Model):
    _name = 'sf.locating.device.locate.mode'
    _description = "定位装置定位方式"

    code = fields.Char('编码', readonly=True)
    name = fields.Char('定位方式', readonly=True)
    name_id = fields.Many2many('sf.fixture.locating.device', string='定位装置', readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''===========================导向元件型号===================================='''


class FixtureGuideElement(models.Model):
    _name = 'sf.fixture.guide.element'
    _description = "导向元件型号"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="型号名称", readonly=True)
    guide_ele_type_id = fields.Many2one('sf.guide.element.type', string="导向元件类型", readonly=True)
    brand_id = fields.Many2one('sf.machine.brand', string="品牌", readonly=True)

    length = fields.Char(string='长度(mm)', readonly=True)
    width = fields.Char(string='宽度(mm)', readonly=True)
    height = fields.Char(string='高度(mm)', readonly=True)
    diameter = fields.Char(string='直径(mm)', readonly=True)

    material_type_id = fields.Many2one('sf.materials.model', string='材料型号', readonly=True)
    weight = fields.Char(string='重量', readonly=True)
    accuracy_grade = fields.Char(string='精度等级', readonly=True)
    guide_ele_guide_mode_id = fields.Many2many('sf.guide.element.guide.mode', string='导向元件导向方式', readonly=True)
    scope_of_application = fields.Char(string='适用范围', readonly=True)
    guide_ele_way_to_install_id = fields.Many2many('sf.guide.element.way.to.install', string='导向元件安装方式',
                                                   readonly=True)

    picture = fields.Binary(string="图片", readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''=============================导向元件类型============================================'''


class GuideElementType(models.Model):
    _name = 'sf.guide.element.type'
    _description = "导向元件类型"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="导向元件类型", readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''================================导向元件导向方式=========================================='''


class GuideElementGuideMode(models.Model):
    _name = 'sf.guide.element.guide.mode'
    _description = "导向元件导向方式"

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="导向元件导向方式", readonly=True)
    name_id = fields.Many2many('sf.fixture.guide.element', string='导向元件', readonly=True)
    comment = fields.Text(string='备注', readonly=True)


'''=============================导向元件安装方式==========================================='''


class GuideElementWayToInstall(models.Model):
    _name = 'sf.guide.element.way.to.install'
    _description = '导向元件安装方式'

    code = fields.Char(string='编码', readonly=True)
    name = fields.Char(string="导向元件安装方式", readonly=True)
    name_id = fields.Many2many('sf.fixture.guide.element', string='导向元件', readonly=True)
    comment = fields.Text(string='备注', readonly=True)
