自建模块日志警告信息处理
This commit is contained in:
@@ -118,7 +118,7 @@ class MachineTool(models.Model):
|
|||||||
supplier_id = fields.Many2one('res.partner', string='制造商',
|
supplier_id = fields.Many2one('res.partner', string='制造商',
|
||||||
domain="[('is_vendor', '=', True)]")
|
domain="[('is_vendor', '=', True)]")
|
||||||
registration_date = fields.Date('注册日期')
|
registration_date = fields.Date('注册日期')
|
||||||
state_zc = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册', tracking=True)
|
state_zc = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册')
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
|
|
||||||
@api.constrains('rotate_speed')
|
@api.constrains('rotate_speed')
|
||||||
@@ -279,7 +279,7 @@ class MachineToolType(models.Model):
|
|||||||
feed_speed = fields.Char('进给速度(mm/min)')
|
feed_speed = fields.Char('进给速度(mm/min)')
|
||||||
tool_speed = fields.Char('刀具速度(m/min)')
|
tool_speed = fields.Char('刀具速度(m/min)')
|
||||||
distance_min = fields.Char('主轴端面至工作台面距离MIN(mm)')
|
distance_min = fields.Char('主轴端面至工作台面距离MIN(mm)')
|
||||||
distance_max = fields.Char('主轴端面至工作台面距离MIN(mm)')
|
distance_max = fields.Char('主轴端面至工作台面距离MAX(mm)')
|
||||||
taper = fields.Char('主轴锥度(°)')
|
taper = fields.Char('主轴锥度(°)')
|
||||||
torque = fields.Char('主轴电机扭矩(n/m)')
|
torque = fields.Char('主轴电机扭矩(n/m)')
|
||||||
motor_power = fields.Char('主轴电机功率(kw)')
|
motor_power = fields.Char('主轴电机功率(kw)')
|
||||||
|
|||||||
@@ -34,22 +34,22 @@ class FixtureModel(models.Model):
|
|||||||
clamping_way = fields.Char(string="装夹方式")
|
clamping_way = fields.Char(string="装夹方式")
|
||||||
port_type = fields.Char(string="接口类型")
|
port_type = fields.Char(string="接口类型")
|
||||||
model_file = fields.Binary(string="3D模型图")
|
model_file = fields.Binary(string="3D模型图")
|
||||||
length = fields.Char(string="长度[mm]", size=6)
|
length = fields.Char(string="长度[mm]")
|
||||||
width = fields.Char(string="宽度[mm]", size=6)
|
width = fields.Char(string="宽度[mm]")
|
||||||
height = fields.Char(string="高度[mm]", size=6)
|
height = fields.Char(string="高度[mm]")
|
||||||
weight = fields.Char(string="重量[kg]", size=4)
|
weight = fields.Char(string="重量[kg]")
|
||||||
clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX[mm]", size=6)
|
clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX[mm]")
|
||||||
clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX[mm]", size=6)
|
clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX[mm]")
|
||||||
clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX[mm]", size=6)
|
clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX[mm]")
|
||||||
clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX[mm]", size=6)
|
clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX[mm]")
|
||||||
maximum_carrying_weight = fields.Float(string="最大承载重量[kg]", size=4)
|
maximum_carrying_weight = fields.Float(string="最大承载重量[kg]")
|
||||||
maximum_clamping_force = fields.Integer(string="最大夹持力[n]", size=8)
|
maximum_clamping_force = fields.Integer(string="最大夹持力[n]")
|
||||||
materials_model_id = fields.Many2one('sf.materials.model', string="材料型号")
|
materials_model_id = fields.Many2one('sf.materials.model', string="材料型号")
|
||||||
driving_way = fields.Selection([('气动', '气动'), ('液压', '液压'), ('机械', '机械')], string="驱动方式")
|
driving_way = fields.Selection([('气动', '气动'), ('液压', '液压'), ('机械', '机械')], string="驱动方式")
|
||||||
apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_fixture_model_machine_tool_type',
|
apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_fixture_model_machine_tool_type',
|
||||||
string="适用机床型号")
|
string="适用机床型号")
|
||||||
through_hole_size = fields.Integer(string="过孔大小[mm]", size=6)
|
through_hole_size = fields.Integer(string="过孔大小[mm]")
|
||||||
screw_size = fields.Integer(string="螺牙大小[mm]", size=6)
|
screw_size = fields.Integer(string="螺牙大小[mm]")
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
|
|
||||||
def _get_code(self, fixture_model_type_code):
|
def _get_code(self, fixture_model_type_code):
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class FunctionalFixture(models.Model):
|
|||||||
domain=[('fixture_material_type', '=', '磁吸托盘')])
|
domain=[('fixture_material_type', '=', '磁吸托盘')])
|
||||||
vice_tray_model_ids = fields.Many2many('sf.fixture.model', 'rel_fixture_model_vice_tray', string="虎钳托盘型号",
|
vice_tray_model_ids = fields.Many2many('sf.fixture.model', 'rel_fixture_model_vice_tray', string="虎钳托盘型号",
|
||||||
domain=[('fixture_material_type', '=', '虎钳托盘')])
|
domain=[('fixture_material_type', '=', '虎钳托盘')])
|
||||||
registration_status = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册', tracking=True)
|
registration_status = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册')
|
||||||
active = fields.Boolean('有效', default=True)
|
active = fields.Boolean('有效', default=True)
|
||||||
|
|
||||||
@api.onchange('type_id')
|
@api.onchange('type_id')
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ class CuttingToolModel(models.Model):
|
|||||||
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='刀具类型',
|
cutting_tool_type_id = fields.Many2one('sf.cutting.tool.type', string='刀具类型',
|
||||||
)
|
)
|
||||||
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||||
tool_length = fields.Integer('长度(mm)', size=6)
|
tool_length = fields.Integer('长度(mm)')
|
||||||
tool_width = fields.Integer('宽度(mm)', size=6)
|
tool_width = fields.Integer('宽度(mm)')
|
||||||
tool_height = fields.Integer('高度(mm)', size=6)
|
tool_height = fields.Integer('高度(mm)')
|
||||||
tool_thickness = fields.Integer('厚度(mm)', size=6)
|
tool_thickness = fields.Integer('厚度(mm)')
|
||||||
tool_weight = fields.Float('重量(kg)', size=4)
|
tool_weight = fields.Float('重量(kg)')
|
||||||
coating_material = fields.Char('涂层材质')
|
coating_material = fields.Char('涂层材质')
|
||||||
# 整体式刀具参数
|
# 整体式刀具参数
|
||||||
total_length = fields.Float('总长度(mm)')
|
total_length = fields.Float('总长度(mm)')
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ access_sf_multi_mounting_type,sf_multi_mounting_type,model_sf_multi_mounting_typ
|
|||||||
access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user,1,1,1,1
|
access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user,1,1,1,1
|
||||||
access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,base.group_user,1,1,1,1
|
access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,base.group_user,1,1,1,1
|
||||||
access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,base.group_user,1,1,1,1
|
access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,base.group_user,1,1,1,1
|
||||||
|
access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -63,6 +63,7 @@ class SfSaintenanceStandards(models.Model):
|
|||||||
|
|
||||||
class MaintenanceStandardImage(models.Model):
|
class MaintenanceStandardImage(models.Model):
|
||||||
_name = 'maintenance.standard.image'
|
_name = 'maintenance.standard.image'
|
||||||
|
_description = 'maintenance.standard.image'
|
||||||
|
|
||||||
image = fields.Binary(string='维保图片')
|
image = fields.Binary(string='维保图片')
|
||||||
standard_id = fields.Many2one('maintenance.standards', string='Standard')
|
standard_id = fields.Many2one('maintenance.standards', string='Standard')
|
||||||
|
|||||||
@@ -66,7 +66,14 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
|
|
||||||
MTcode = fields.Char("编码", default=get_no)
|
MTcode = fields.Char("编码", default=get_no)
|
||||||
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||||
equipment_type = fields.Selection([('机床', '机床')], related='category_id.equipment_type')
|
equipment_type = fields.Selection([('机床', '机床')], compute='_compute_category_id')
|
||||||
|
|
||||||
|
@api.depends('category_id')
|
||||||
|
def _compute_category_id(self):
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
record.equipment_type = record.category_id.equipment_type
|
||||||
|
|
||||||
code = fields.Char('机台号')
|
code = fields.Char('机台号')
|
||||||
name = fields.Char('名称')
|
name = fields.Char('名称')
|
||||||
knife_type = fields.Selection(
|
knife_type = fields.Selection(
|
||||||
@@ -114,7 +121,7 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
feed_speed = fields.Char('进给速度(mm/min)')
|
feed_speed = fields.Char('进给速度(mm/min)')
|
||||||
tool_speed = fields.Char('刀具速度(m/min)')
|
tool_speed = fields.Char('刀具速度(m/min)')
|
||||||
distance_min = fields.Char('主轴端面至工作台面距离MIN(mm)')
|
distance_min = fields.Char('主轴端面至工作台面距离MIN(mm)')
|
||||||
distance_max = fields.Char('主轴端面至工作台面距离MIN(mm)')
|
distance_max = fields.Char('主轴端面至工作台面距离MAX(mm)')
|
||||||
taper = fields.Char('主轴锥度(°)')
|
taper = fields.Char('主轴锥度(°)')
|
||||||
torque = fields.Char('主轴电机扭矩(n/m)')
|
torque = fields.Char('主轴电机扭矩(n/m)')
|
||||||
motor_power = fields.Char('主轴电机功率(kw)')
|
motor_power = fields.Char('主轴电机功率(kw)')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class SfMaintenanceLogs(models.Model):
|
|||||||
code = fields.Char(string='编码')
|
code = fields.Char(string='编码')
|
||||||
name = fields.Char(string='名称')
|
name = fields.Char(string='名称')
|
||||||
type = fields.Selection([('type1', '类型1'), ('type2', '类型2')], string='类型')
|
type = fields.Selection([('type1', '类型1'), ('type2', '类型2')], string='类型')
|
||||||
brand = fields.Many2one('sf.machine.brand', relared='model.brand_id', string='品牌')
|
brand = fields.Many2one('sf.machine.brand', related='maintenance_equipment_id.brand_id', string='品牌')
|
||||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
||||||
code_location = fields.Char(string='编码位置')
|
code_location = fields.Char(string='编码位置')
|
||||||
fault_type = fields.Selection([('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型')
|
fault_type = fields.Selection([('电气类', '电气类'), ('机械类', '机械类'), ('程序类', '程序类'), ('系统类', '系统类')], string='故障类型')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from odoo import fields, models
|
from odoo import fields, models,api
|
||||||
|
|
||||||
|
|
||||||
class ResProductCategory(models.Model):
|
class ResProductCategory(models.Model):
|
||||||
@@ -39,7 +39,15 @@ class ProductModelTypeRoutingSort(models.Model):
|
|||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
|
('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
|
||||||
], string="工序类型", related='route_workcenter_id.routing_type')
|
], string="工序类型", compute='_compute_route_workcenter_id')
|
||||||
|
|
||||||
|
@api.depends('route_workcenter_id')
|
||||||
|
def _compute_route_workcenter_id(self):
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
record.routing_type = record.route_workcenter_id.routing_type
|
||||||
|
|
||||||
|
|
||||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||||
product_model_type_id = fields.Many2one('sf.model.type')
|
product_model_type_id = fields.Many2one('sf.model.type')
|
||||||
|
|
||||||
@@ -62,7 +70,14 @@ class EmbryoModelTypeRoutingSort(models.Model):
|
|||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
|
('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
|
||||||
], string="工序类型", related='route_workcenter_id.routing_type')
|
], string="工序类型", compute='_compute_route_workcenter_id')
|
||||||
|
|
||||||
|
@api.depends('route_workcenter_id')
|
||||||
|
def _compute_route_workcenter_id(self):
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
record.routing_type = record.route_workcenter_id.routing_type
|
||||||
|
|
||||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||||
embryo_model_type_id = fields.Many2one('sf.model.type')
|
embryo_model_type_id = fields.Many2one('sf.model.type')
|
||||||
|
|
||||||
@@ -85,7 +100,14 @@ class SurfaceTechnicsModelTypeRoutingSort(models.Model):
|
|||||||
('CNC加工', 'CNC加工'),
|
('CNC加工', 'CNC加工'),
|
||||||
('后置三元质量检测', '后置三元质量检测'),
|
('后置三元质量检测', '后置三元质量检测'),
|
||||||
('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
|
('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
|
||||||
], string="工序类型", related='route_workcenter_id.routing_type')
|
], string="工序类型", compute='_compute_route_workcenter_id')
|
||||||
|
|
||||||
|
@api.depends('route_workcenter_id')
|
||||||
|
def _compute_route_workcenter_id(self):
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
record.routing_type = record.route_workcenter_id.routing_type
|
||||||
|
|
||||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||||
surface_technics_model_type_id = fields.Many2one('sf.model.type')
|
surface_technics_model_type_id = fields.Many2one('sf.model.type')
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class ResWorkcenter(models.Model):
|
|||||||
_inherit = "mrp.workcenter"
|
_inherit = "mrp.workcenter"
|
||||||
|
|
||||||
# 生产线显示
|
# 生产线显示
|
||||||
production_line_show = fields.Char(string='生产线')
|
production_line_show = fields.Char(string='生产线名称')
|
||||||
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||||
is_process_outsourcing = fields.Boolean('工艺外协')
|
is_process_outsourcing = fields.Boolean('工艺外协')
|
||||||
@@ -20,7 +20,13 @@ class ResWorkcenter(models.Model):
|
|||||||
|
|
||||||
equipment_status = fields.Selection(
|
equipment_status = fields.Selection(
|
||||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||||
string="设备状态", related='equipment_id.state')
|
string="设备状态", compute='_compute_equipment_id')
|
||||||
|
|
||||||
|
@api.depends('equipment_id')
|
||||||
|
def _compute_equipment_id(self):
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
record.equipment_status = record.equipment_id.state
|
||||||
|
|
||||||
equipment_image = fields.Binary('设备图片', related='equipment_id.machine_tool_picture')
|
equipment_image = fields.Binary('设备图片', related='equipment_id.machine_tool_picture')
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
_order = 'sequence asc,create_date desc'
|
_order = 'sequence asc,create_date desc'
|
||||||
|
|
||||||
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True,
|
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True,
|
||||||
check_company=True, string="坯料长度(mm)")
|
string="坯料长度(mm)")
|
||||||
product_tmpl_id_width = fields.Float(related='production_id.product_tmpl_id.width', readonly=True, store=True,
|
product_tmpl_id_width = fields.Float(related='production_id.product_tmpl_id.width', readonly=True, store=True,
|
||||||
check_company=True, string="坯料宽度(mm)")
|
string="坯料宽度(mm)")
|
||||||
product_tmpl_id_height = fields.Float(related='production_id.product_tmpl_id.height', readonly=True, store=True,
|
product_tmpl_id_height = fields.Float(related='production_id.product_tmpl_id.height', readonly=True, store=True,
|
||||||
check_company=True, string="坯料高度(mm)")
|
string="坯料高度(mm)")
|
||||||
product_tmpl_id_materials_id = fields.Many2one(related='production_id.product_tmpl_id.materials_id', readonly=True,
|
product_tmpl_id_materials_id = fields.Many2one(related='production_id.product_tmpl_id.materials_id', readonly=True,
|
||||||
store=True, check_company=True, string="材料")
|
store=True, check_company=True, string="材料")
|
||||||
product_tmpl_id_materials_type_id = fields.Many2one(related='production_id.product_tmpl_id.materials_type_id',
|
product_tmpl_id_materials_type_id = fields.Many2one(related='production_id.product_tmpl_id.materials_type_id',
|
||||||
@@ -41,7 +41,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
('解除装夹', '解除装夹'),
|
('解除装夹', '解除装夹'),
|
||||||
('切割', '切割'), ('表面工艺', '表面工艺')
|
('切割', '切割'), ('表面工艺', '表面工艺')
|
||||||
], string="工序类型")
|
], string="工序类型")
|
||||||
results = fields.Char('检测结果')
|
results = fields.Char('结果')
|
||||||
|
|
||||||
@api.onchange('users_ids')
|
@api.onchange('users_ids')
|
||||||
def get_user_permissions(self):
|
def get_user_permissions(self):
|
||||||
@@ -118,7 +118,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌")
|
chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌")
|
||||||
chuck_type_id = fields.Char(string="卡盘类型")
|
chuck_type_id = fields.Char(string="卡盘类型")
|
||||||
chuck_model_id = fields.Char(string="卡盘型号")
|
chuck_model_id = fields.Char(string="卡盘型号")
|
||||||
tray_serial_number = fields.Char(string="卡盘序列号")
|
tray_serial_number = fields.Char(string="托盘序列号")
|
||||||
tray_name = fields.Char(string="托盘名称")
|
tray_name = fields.Char(string="托盘名称")
|
||||||
tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌")
|
tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌")
|
||||||
tray_type_id = fields.Char(string="托盘类型")
|
tray_type_id = fields.Char(string="托盘类型")
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
@@ -15,8 +15,15 @@ class ResProductMo(models.Model):
|
|||||||
categ_type = fields.Selection(
|
categ_type = fields.Selection(
|
||||||
[("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"),
|
[("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"),
|
||||||
("夹具", "夹具")],
|
("夹具", "夹具")],
|
||||||
string='产品的类别', related='categ_id.type',
|
string='产品的类别', compute='_compute_categ_id',
|
||||||
store=True)
|
store=True)
|
||||||
|
|
||||||
|
@api.depends('categ_id')
|
||||||
|
def _compute_categ_id(self):
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
record.categ_type = record.categ_id.type
|
||||||
|
|
||||||
model_name = fields.Char('模型名称')
|
model_name = fields.Char('模型名称')
|
||||||
model_long = fields.Float('模型长(mm)', digits=(16, 3))
|
model_long = fields.Float('模型长(mm)', digits=(16, 3))
|
||||||
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
||||||
@@ -56,11 +63,11 @@ class ResProductMo(models.Model):
|
|||||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||||
|
|
||||||
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||||
tool_length = fields.Integer('长度(mm)', size=6)
|
tool_length = fields.Integer('长度(mm)')
|
||||||
tool_width = fields.Integer('宽度(mm)', size=6)
|
tool_width = fields.Integer('宽度(mm)')
|
||||||
tool_height = fields.Integer('高度(mm)', size=6)
|
tool_height = fields.Integer('高度(mm)')
|
||||||
tool_thickness = fields.Integer('厚度(mm)', size=6)
|
tool_thickness = fields.Integer('厚度(mm)')
|
||||||
tool_weight = fields.Float('重量(kg)', size=4)
|
tool_weight = fields.Float('重量(kg)', digits=(16, 3))
|
||||||
coating_material = fields.Char('涂层材质')
|
coating_material = fields.Char('涂层材质')
|
||||||
# 整体式刀具参数
|
# 整体式刀具参数
|
||||||
cutting_tool_total_length = fields.Float('总长度(mm)')
|
cutting_tool_total_length = fields.Float('总长度(mm)')
|
||||||
@@ -138,22 +145,73 @@ class ResProductMo(models.Model):
|
|||||||
fixture_clamping_way = fields.Char(string="装夹方式")
|
fixture_clamping_way = fields.Char(string="装夹方式")
|
||||||
fixture_port_type = fields.Char(string="接口类型")
|
fixture_port_type = fields.Char(string="接口类型")
|
||||||
fixture_model_file = fields.Binary(string="3D模型图")
|
fixture_model_file = fields.Binary(string="3D模型图")
|
||||||
fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX(mm)", size=6)
|
fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度MAX(mm)")
|
||||||
fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX(mm)", size=6)
|
fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度MAX(mm)")
|
||||||
fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX(mm)", size=6)
|
fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度MAX(mm)")
|
||||||
fixture_clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX(mm)", digits=(16, 6))
|
fixture_clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径MAX(mm)", digits=(16, 6))
|
||||||
fixture_maximum_carrying_weight = fields.Float(string="最大承载重量(kg)", digits=(16, 4))
|
fixture_maximum_carrying_weight = fields.Float(string="最大承载重量(kg)", digits=(16, 4))
|
||||||
fixture_maximum_clamping_force = fields.Integer(string="最大夹持力(n)", size=8)
|
fixture_maximum_clamping_force = fields.Integer(string="最大夹持力(n)")
|
||||||
fixture_driving_way = fields.Char(string="驱动方式")
|
fixture_driving_way = fields.Char(string="驱动方式")
|
||||||
fixture_apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_product_machine_tool_type',
|
fixture_apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_product_machine_tool_type',
|
||||||
string="适用机床型号")
|
string="适用机床型号")
|
||||||
fixture_through_hole_size = fields.Integer(string="过孔大小(mm)", size=6)
|
fixture_through_hole_size = fields.Integer(string="过孔大小(mm)")
|
||||||
fixture_screw_size = fields.Integer(string="螺牙大小(mm)", size=6)
|
fixture_screw_size = fields.Integer(string="螺牙大小(mm)")
|
||||||
|
|
||||||
# 注册状态
|
# 注册状态
|
||||||
register_state = fields.Selection([('未注册', '未注册'), ('已注册', '已注册'), ('注册失败', '注册失败')],
|
register_state = fields.Selection([('未注册', '未注册'), ('已注册', '已注册'), ('注册失败', '注册失败')],
|
||||||
string='注册状态', default='未注册')
|
string='注册状态', default='未注册')
|
||||||
industry_code = fields.Char('行业编码', readonly=True)
|
industry_code = fields.Char('行业编码', readonly=True)
|
||||||
|
|
||||||
|
@api.constrains('tool_length')
|
||||||
|
def _check_tool_length_size(self):
|
||||||
|
if self.tool_length > 1000000:
|
||||||
|
raise ValidationError("长度不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('tool_width')
|
||||||
|
def _check_tool_width_size(self):
|
||||||
|
if self.tool_width > 1000000:
|
||||||
|
raise ValidationError("宽度不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('tool_height')
|
||||||
|
def _check_tool_height_size(self):
|
||||||
|
if self.tool_height > 1000000:
|
||||||
|
raise ValidationError("高度不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('tool_thickness')
|
||||||
|
def _check_tool_thickness_size(self):
|
||||||
|
if self.tool_thickness > 1000000:
|
||||||
|
raise ValidationError("厚度不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('fixture_clamp_workpiece_length_max')
|
||||||
|
def _check_fixture_clamp_workpiece_length_max_size(self):
|
||||||
|
if self.fixture_clamp_workpiece_length_max > 1000000:
|
||||||
|
raise ValidationError("夹持工件长度MAX不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('fixture_clamp_workpiece_width_max')
|
||||||
|
def _check_fixture_clamp_workpiece_width_max_size(self):
|
||||||
|
if self.fixture_clamp_workpiece_width_max > 1000000:
|
||||||
|
raise ValidationError("夹持工件宽度MAX不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('fixture_clamp_workpiece_height_max')
|
||||||
|
def _check_fixture_clamp_workpiece_height_max_size(self):
|
||||||
|
if self.fixture_clamp_workpiece_height_max > 1000000:
|
||||||
|
raise ValidationError("夹持工件高度MAX不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('fixture_maximum_clamping_force')
|
||||||
|
def _check_fixture_maximum_clamping_force_size(self):
|
||||||
|
if self.fixture_maximum_clamping_force > 100000000:
|
||||||
|
raise ValidationError("最大夹持力不能超过100000000")
|
||||||
|
|
||||||
|
@api.constrains('fixture_through_hole_size')
|
||||||
|
def _check_fixture_through_hole_size_size(self):
|
||||||
|
if self.fixture_through_hole_size > 1000000:
|
||||||
|
raise ValidationError("过孔大小不能超过1000000")
|
||||||
|
|
||||||
|
@api.constrains('fixture_screw_size')
|
||||||
|
def _check_fixture_through_hole_size_size(self):
|
||||||
|
if self.fixture_screw_size > 1000000:
|
||||||
|
raise ValidationError("螺牙大小不能超过1000000")
|
||||||
|
|
||||||
def _json_apply_machine_tool_type_item_code(self, item):
|
def _json_apply_machine_tool_type_item_code(self, item):
|
||||||
code_arr = []
|
code_arr = []
|
||||||
for i in item.product_id.fixture_apply_machine_tool_type_ids:
|
for i in item.product_id.fixture_apply_machine_tool_type_ids:
|
||||||
@@ -500,20 +558,20 @@ class ResProductMo(models.Model):
|
|||||||
item.model_file = self.transition_glb_file(report_path, model_code)
|
item.model_file = self.transition_glb_file(report_path, model_code)
|
||||||
|
|
||||||
# 将attach的datas内容转为glb文件
|
# 将attach的datas内容转为glb文件
|
||||||
def transition_glb_file(self, report_path, code):
|
# def transition_glb_file(self, report_path, code):
|
||||||
shapes = read_step_file(report_path)
|
# shapes = read_step_file(report_path)
|
||||||
output_file = os.path.join('/tmp', str(code) + '.stl')
|
# output_file = os.path.join('/tmp', str(code) + '.stl')
|
||||||
write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
# write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||||
# 转化为glb
|
# # 转化为glb
|
||||||
output_glb_file = os.path.join('/tmp', str(code) + '.glb')
|
# output_glb_file = os.path.join('/tmp', str(code) + '.glb')
|
||||||
util_path = get_resource_path('sf_dlm', 'static/util')
|
# util_path = get_resource_path('sf_dlm', 'static/util')
|
||||||
cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
|
# cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
|
||||||
os.system(cmd)
|
# os.system(cmd)
|
||||||
# 转base64
|
# # 转base64
|
||||||
with open(output_glb_file, 'rb') as fileObj:
|
# with open(output_glb_file, 'rb') as fileObj:
|
||||||
image_data = fileObj.read()
|
# image_data = fileObj.read()
|
||||||
base64_data = base64.b64encode(image_data)
|
# base64_data = base64.b64encode(image_data)
|
||||||
return base64_data
|
# return base64_data
|
||||||
|
|
||||||
|
|
||||||
class ResMrpBomMo(models.Model):
|
class ResMrpBomMo(models.Model):
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class WorkLogSetting(models.Model):
|
|||||||
return num
|
return num
|
||||||
|
|
||||||
code = fields.Char(string='序号', default=_get_code)
|
code = fields.Char(string='序号', default=_get_code)
|
||||||
name = fields.Char(string='工作日历名称', required=True, size=15, length=30)
|
name = fields.Char(string='工作日历名称', required=True, size=15)
|
||||||
|
|
||||||
working_shift_ids = fields.Many2many('sf.working.shift', string='班次', required=True)
|
working_shift_ids = fields.Many2many('sf.working.shift', string='班次', required=True)
|
||||||
start_time = fields.Datetime(string='日开始时间', readonly=True, compute='_compute_working_shift_ids')
|
start_time = fields.Datetime(string='日开始时间', readonly=True, compute='_compute_working_shift_ids')
|
||||||
@@ -107,11 +107,11 @@ class WorkLogSetting(models.Model):
|
|||||||
# 'date_time': target_date})
|
# 'date_time': target_date})
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals_list):
|
||||||
"""
|
"""
|
||||||
创建记录时,生成工作日历
|
创建记录时,生成工作日历
|
||||||
"""
|
"""
|
||||||
record = super(WorkLogSetting, self).create(vals)
|
record = super(WorkLogSetting, self).create(vals_list)
|
||||||
record.generate_work_calendar()
|
record.generate_work_calendar()
|
||||||
return record
|
return record
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@@ -80,22 +80,22 @@ class QuickEasyOrder(models.Model):
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
# 将attach的datas内容转为glb文件
|
# 将attach的datas内容转为glb文件
|
||||||
def transition_glb_file(self, report_path, model_code):
|
# def transition_glb_file(self, report_path, model_code):
|
||||||
shapes = read_step_file(report_path)
|
# shapes = read_step_file(report_path)
|
||||||
#output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
|
# #output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
|
||||||
output_file = os.path.join('/tmp', str(model_code) + '.stl')
|
# output_file = os.path.join('/tmp', str(model_code) + '.stl')
|
||||||
write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
# write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||||
# 转化为glb
|
# # 转化为glb
|
||||||
#output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
|
# #output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
|
||||||
output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
|
# output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
|
||||||
util_path = get_resource_path('sf_dlm', 'static/util')
|
# util_path = get_resource_path('sf_dlm', 'static/util')
|
||||||
cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
|
# cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
|
||||||
os.system(cmd)
|
# os.system(cmd)
|
||||||
# 转base64
|
# # 转base64
|
||||||
with open(output_glb_file, 'rb') as fileObj:
|
# with open(output_glb_file, 'rb') as fileObj:
|
||||||
image_data = fileObj.read()
|
# image_data = fileObj.read()
|
||||||
base64_data = base64.b64encode(image_data)
|
# base64_data = base64.b64encode(image_data)
|
||||||
return base64_data
|
# return base64_data
|
||||||
# return False
|
# return False
|
||||||
|
|
||||||
@api.onchange('upload_model_file')
|
@api.onchange('upload_model_file')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
code = fields.Char('编码')
|
code = fields.Char('编码')
|
||||||
name = fields.Char('名称')
|
name = fields.Char('名称')
|
||||||
mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', string='刀具型号')
|
mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', string='刀具型号')
|
||||||
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', tracking=True,
|
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
||||||
group_expand='_read_group_mrs_cutting_tool_type_ids')
|
group_expand='_read_group_mrs_cutting_tool_type_ids')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -218,11 +218,11 @@ class FunctionalToolWarning(models.Model):
|
|||||||
|
|
||||||
diameter = fields.Float('直径(mm)', readonly=True, related='functional_cutting_tool_id.diameter')
|
diameter = fields.Float('直径(mm)', readonly=True, related='functional_cutting_tool_id.diameter')
|
||||||
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
||||||
string='刀具等级', readonly=True, related='functional_cutting_tool_id.tool_grade')
|
string='刀具等级', readonly=True, compute='_compute_functional_cutting_tool_id')
|
||||||
machining_accuracy = fields.Float('加工精度(mm)', readonly=True,
|
machining_accuracy = fields.Float('加工精度(mm)', readonly=True,
|
||||||
related='functional_cutting_tool_id.machining_accuracy')
|
related='functional_cutting_tool_id.machining_accuracy')
|
||||||
|
|
||||||
tool_length = fields.Float('装刀长', readonly=True, related='functional_cutting_tool_id.tool_length')
|
# tool_length = fields.Float('装刀长', readonly=True, related='functional_cutting_tool_id.tool_length')
|
||||||
|
|
||||||
tool_length = fields.Float('装刀长(mm)', readonly=True, related='functional_cutting_tool_id.tool_length')
|
tool_length = fields.Float('装刀长(mm)', readonly=True, related='functional_cutting_tool_id.tool_length')
|
||||||
blade_number = fields.Integer('刃数', readonly=True, related='functional_cutting_tool_id.blade_number')
|
blade_number = fields.Integer('刃数', readonly=True, related='functional_cutting_tool_id.blade_number')
|
||||||
@@ -231,16 +231,24 @@ class FunctionalToolWarning(models.Model):
|
|||||||
effective_blade_length = fields.Float('有效刃长(mm)', readonly=True,
|
effective_blade_length = fields.Float('有效刃长(mm)', readonly=True,
|
||||||
related='functional_cutting_tool_id.effective_blade_length')
|
related='functional_cutting_tool_id.effective_blade_length')
|
||||||
max_life = fields.Float('最大寿命值', readonly=True, related='functional_cutting_tool_id.max_life')
|
max_life = fields.Float('最大寿命值', readonly=True, related='functional_cutting_tool_id.max_life')
|
||||||
is_standard = fields.Selection([('1', '是'), ('0', '否')],'是否标准刀', readonly=True, related='functional_cutting_tool_id.is_standard')
|
is_standard = fields.Selection([('1', '是'), ('0', '否')],'是否标准刀', readonly=True,
|
||||||
|
compute='_compute_functional_cutting_tool_id')
|
||||||
applicable_range = fields.Char('适用范围', readonly=True, related='functional_cutting_tool_id.applicable_range')
|
applicable_range = fields.Char('适用范围', readonly=True, related='functional_cutting_tool_id.applicable_range')
|
||||||
image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image')
|
|
||||||
|
|
||||||
# 功能刀具预警 特有字段
|
image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image')
|
||||||
install_tool_time = fields.Datetime("装刀时间", readonly=True,
|
install_tool_time = fields.Datetime("装刀时间", readonly=True,
|
||||||
related='functional_tool_assembly_id.tool_loading_time')
|
related='functional_tool_assembly_id.tool_loading_time')
|
||||||
|
|
||||||
|
@api.depends('functional_cutting_tool_id')
|
||||||
|
def _compute_functional_cutting_tool_id(self):
|
||||||
|
if self.functional_cutting_tool_id:
|
||||||
|
self.tool_grade = self.functional_cutting_tool_id.tool_grade
|
||||||
|
self.is_standard = self.functional_cutting_tool_id.is_standard
|
||||||
|
|
||||||
|
# 功能刀具预警 特有字段
|
||||||
outbound_time = fields.Datetime('出库时间', readonly=True, related='functional_tool_assembly_id.receive_time')
|
outbound_time = fields.Datetime('出库时间', readonly=True, related='functional_tool_assembly_id.receive_time')
|
||||||
on_board_time = fields.Datetime('上机时间', readonly=False)
|
on_board_time = fields.Datetime('上机时间', readonly=False)
|
||||||
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=True, tracking=True,
|
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=True,
|
||||||
group_expand='_read_group_machine_table_name_ids')
|
group_expand='_read_group_machine_table_name_ids')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -250,7 +258,7 @@ class FunctionalToolWarning(models.Model):
|
|||||||
|
|
||||||
machine_tool_code = fields.Char('机台号', readonly=True, related='functional_tool_assembly_id.machine_tool_code')
|
machine_tool_code = fields.Char('机台号', readonly=True, related='functional_tool_assembly_id.machine_tool_code')
|
||||||
cutting_tool_code = fields.Char('刀位号', readonly=True, related='functional_tool_assembly_id.cutter_spacing_code')
|
cutting_tool_code = fields.Char('刀位号', readonly=True, related='functional_tool_assembly_id.cutter_spacing_code')
|
||||||
idle_time = fields.Char('闲置时长', readonly=False)
|
# idle_time = fields.Char('闲置时长', readonly=False)
|
||||||
idle_time = fields.Char('闲置时长(h)', readonly=False)
|
idle_time = fields.Char('闲置时长(h)', readonly=False)
|
||||||
alarm_value = fields.Char('报警值', readonly=False)
|
alarm_value = fields.Char('报警值', readonly=False)
|
||||||
used_value = fields.Char('已使用值', readonly=False)
|
used_value = fields.Char('已使用值', readonly=False)
|
||||||
@@ -272,7 +280,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
|
|
||||||
functional_cutting_tool_id = fields.Many2one('sf.functional.cutting.tool.entity', '功能刀具', readonly=True)
|
functional_cutting_tool_id = fields.Many2one('sf.functional.cutting.tool.entity', '功能刀具', readonly=True)
|
||||||
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||||
tracking=True, group_expand='_read_mrs_cutting_tool_type_ids',
|
group_expand='_read_mrs_cutting_tool_type_ids',
|
||||||
store=True,
|
store=True,
|
||||||
compute='_compute_functional_cutting_tool_id')
|
compute='_compute_functional_cutting_tool_id')
|
||||||
|
|
||||||
@@ -344,7 +352,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
|
|
||||||
diameter = fields.Float('直径(mm)', readonly=True, related='functional_cutting_tool_id.diameter')
|
diameter = fields.Float('直径(mm)', readonly=True, related='functional_cutting_tool_id.diameter')
|
||||||
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
||||||
string='刀具等级', readonly=True, related='functional_cutting_tool_id.tool_grade')
|
string='刀具等级', readonly=True, compute='_compute_functional_cutting_tool_id')
|
||||||
machining_accuracy = fields.Float('加工精度(mm)', readonly=True,
|
machining_accuracy = fields.Float('加工精度(mm)', readonly=True,
|
||||||
related='functional_cutting_tool_id.machining_accuracy')
|
related='functional_cutting_tool_id.machining_accuracy')
|
||||||
tool_length = fields.Float('装刀长(mm)', readonly=True, related='functional_cutting_tool_id.tool_length')
|
tool_length = fields.Float('装刀长(mm)', readonly=True, related='functional_cutting_tool_id.tool_length')
|
||||||
@@ -354,10 +362,17 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
|||||||
effective_blade_length = fields.Float('有效刃长(mm)', readonly=True,
|
effective_blade_length = fields.Float('有效刃长(mm)', readonly=True,
|
||||||
related='functional_cutting_tool_id.effective_blade_length')
|
related='functional_cutting_tool_id.effective_blade_length')
|
||||||
max_life = fields.Float('最大寿命值', readonly=True, related='functional_cutting_tool_id.max_life')
|
max_life = fields.Float('最大寿命值', readonly=True, related='functional_cutting_tool_id.max_life')
|
||||||
is_standard = fields.Selection([('1', '是'), ('0', '否')],'是否标准刀', readonly=True, related='functional_cutting_tool_id.is_standard')
|
is_standard = fields.Selection([('1', '是'), ('0', '否')],'是否标准刀', readonly=True,
|
||||||
|
compute='_compute_functional_cutting_tool_id')
|
||||||
applicable_range = fields.Char('适用范围', readonly=True, related='functional_cutting_tool_id.applicable_range')
|
applicable_range = fields.Char('适用范围', readonly=True, related='functional_cutting_tool_id.applicable_range')
|
||||||
image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image')
|
image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image')
|
||||||
|
|
||||||
|
@api.depends('functional_cutting_tool_id')
|
||||||
|
def _compute_functional_cutting_tool_id(self):
|
||||||
|
if self.functional_cutting_tool_id:
|
||||||
|
self.tool_grade = self.functional_cutting_tool_id.tool_grade
|
||||||
|
self.is_standard = self.functional_cutting_tool_id.is_standard
|
||||||
|
|
||||||
# 功能刀具实时分布
|
# 功能刀具实时分布
|
||||||
tool_stock_num = fields.Integer(string='刀具房库存数量', readonly=False)
|
tool_stock_num = fields.Integer(string='刀具房库存数量', readonly=False)
|
||||||
side_shelf_num = fields.Integer(string='线边货架货架数量', readonly=False)
|
side_shelf_num = fields.Integer(string='线边货架货架数量', readonly=False)
|
||||||
@@ -395,7 +410,7 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model):
|
|||||||
|
|
||||||
functional_cutting_tool_id = fields.Many2one('sf.functional.cutting.tool.entity', '功能刀具', readonly=True)
|
functional_cutting_tool_id = fields.Many2one('sf.functional.cutting.tool.entity', '功能刀具', readonly=True)
|
||||||
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||||
tracking=True, group_expand='_read_mrs_cutting_tool_type_ids',
|
group_expand='_read_mrs_cutting_tool_type_ids',
|
||||||
store=True,
|
store=True,
|
||||||
compute='_compute_functional_cutting_tool_id')
|
compute='_compute_functional_cutting_tool_id')
|
||||||
|
|
||||||
@@ -465,7 +480,7 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model):
|
|||||||
|
|
||||||
diameter = fields.Float('直径(mm)', readonly=True, related='functional_cutting_tool_id.diameter')
|
diameter = fields.Float('直径(mm)', readonly=True, related='functional_cutting_tool_id.diameter')
|
||||||
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
||||||
string='刀具等级', readonly=True, related='functional_cutting_tool_id.tool_grade')
|
string='刀具等级', readonly=True, compute='_compute_functional_cutting_tool_id')
|
||||||
machining_accuracy = fields.Float('加工精度(mm)', readonly=True,
|
machining_accuracy = fields.Float('加工精度(mm)', readonly=True,
|
||||||
related='functional_cutting_tool_id.machining_accuracy')
|
related='functional_cutting_tool_id.machining_accuracy')
|
||||||
tool_length = fields.Float('装刀长(mm)', readonly=True, related='functional_cutting_tool_id.tool_length')
|
tool_length = fields.Float('装刀长(mm)', readonly=True, related='functional_cutting_tool_id.tool_length')
|
||||||
@@ -475,10 +490,17 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model):
|
|||||||
effective_blade_length = fields.Float('有效刃长(mm)', readonly=True,
|
effective_blade_length = fields.Float('有效刃长(mm)', readonly=True,
|
||||||
related='functional_cutting_tool_id.effective_blade_length')
|
related='functional_cutting_tool_id.effective_blade_length')
|
||||||
max_life = fields.Float('最大寿命值', readonly=True, related='functional_cutting_tool_id.max_life')
|
max_life = fields.Float('最大寿命值', readonly=True, related='functional_cutting_tool_id.max_life')
|
||||||
is_standard = fields.Selection([('1', '是'), ('0', '否')],'是否标准刀', readonly=True, related='functional_cutting_tool_id.is_standard')
|
is_standard = fields.Selection([('1', '是'), ('0', '否')],'是否标准刀', readonly=True,
|
||||||
|
compute='_compute_functional_cutting_tool_id')
|
||||||
applicable_range = fields.Char('适用范围', readonly=True, related='functional_cutting_tool_id.applicable_range')
|
applicable_range = fields.Char('适用范围', readonly=True, related='functional_cutting_tool_id.applicable_range')
|
||||||
image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image')
|
image = fields.Binary('图片', readonly=True, related='functional_cutting_tool_id.image')
|
||||||
|
|
||||||
|
@api.depends('functional_cutting_tool_id')
|
||||||
|
def _compute_functional_cutting_tool_id(self):
|
||||||
|
if self.functional_cutting_tool_id:
|
||||||
|
self.tool_grade = self.functional_cutting_tool_id.tool_grade
|
||||||
|
self.is_standard = self.functional_cutting_tool_id.is_standard
|
||||||
|
|
||||||
# 功能刀具出入库记录 特有字段
|
# 功能刀具出入库记录 特有字段
|
||||||
current_state = fields.Char(string='当前状态', readonly=False)
|
current_state = fields.Char(string='当前状态', readonly=False)
|
||||||
current_store_area = fields.Char(string='当前库区', readonly=False)
|
current_store_area = fields.Char(string='当前库区', readonly=False)
|
||||||
@@ -486,7 +508,7 @@ class InboundAndOutboundRecordsOfFunctionalTools(models.Model):
|
|||||||
tool_install_staff = fields.Char(string='装刀人', readonly=False)
|
tool_install_staff = fields.Char(string='装刀人', readonly=False)
|
||||||
tool_install_time = fields.Datetime(string='装刀时间', readonly=False)
|
tool_install_time = fields.Datetime(string='装刀时间', readonly=False)
|
||||||
thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False)
|
thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False)
|
||||||
max_life_span = fields.Char(string='最大寿命值', readonly=False)
|
# max_life_span = fields.Char(string='最大寿命值', readonly=False)
|
||||||
alarm_value = fields.Char(string='报警值', readonly=False)
|
alarm_value = fields.Char(string='报警值', readonly=False)
|
||||||
used_value = fields.Char(string='已使用值', readonly=False)
|
used_value = fields.Char(string='已使用值', readonly=False)
|
||||||
reason_application = fields.Char(string='申请原因', readonly=False)
|
reason_application = fields.Char(string='申请原因', readonly=False)
|
||||||
@@ -528,12 +550,11 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
# string='换刀需求信息',
|
# string='换刀需求信息',
|
||||||
# attrs="{'invisible': 1}")
|
# attrs="{'invisible': 1}")
|
||||||
|
|
||||||
|
name = fields.Many2one('maintenance.equipment', string='CNC机床',required=True, readonly=False,
|
||||||
name = fields.Many2one('maintenance.equipment', string='CNC机床',required=True, readonly=False, tracking=True,
|
|
||||||
group_expand='_read_group_names')
|
group_expand='_read_group_names')
|
||||||
machine_table_type_id = fields.Many2one('sf.machine_tool.category', string='机床类型', readonly=True,
|
machine_table_type_id = fields.Many2one('sf.machine_tool.category', string='机床类型', readonly=True,
|
||||||
compute='_compute_name')
|
compute='_compute_name')
|
||||||
machine_tool_code = fields.Char(string='机台号', attrs="{'invisible': 1}", readonly=True, compute='_compute_name')
|
machine_tool_code = fields.Char(string='机台号', invisible=True, readonly=True, compute='_compute_name')
|
||||||
cutter_spacing_code = fields.Char(string='刀位号', readonly=False)
|
cutter_spacing_code = fields.Char(string='刀位号', readonly=False)
|
||||||
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True, compute='_compute_functional_tool_name_id')
|
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True, compute='_compute_functional_tool_name_id')
|
||||||
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False)
|
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False)
|
||||||
@@ -555,7 +576,7 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型',
|
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型',
|
||||||
readonly=True)
|
readonly=True)
|
||||||
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
|
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
|
||||||
string='粗/中/精', readonly=True)
|
string='粗/中/精(待换)', readonly=True)
|
||||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||||
applicant = fields.Char(string='申请人', readonly=True)
|
applicant = fields.Char(string='申请人', readonly=True)
|
||||||
used_tool_time = fields.Datetime(string='用刀时间', readonly=True)
|
used_tool_time = fields.Datetime(string='用刀时间', readonly=True)
|
||||||
@@ -692,7 +713,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
|||||||
functional_tool_code = fields.Char(string='功能刀具编码', readonly=False)
|
functional_tool_code = fields.Char(string='功能刀具编码', readonly=False)
|
||||||
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False)
|
functional_tool_name_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=False)
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
|
||||||
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=False, tracking=True,
|
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称', readonly=False,
|
||||||
group_expand='_read_group_machine_table_name_ids')
|
group_expand='_read_group_machine_table_name_ids')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -786,7 +807,7 @@ class FunctionalToolAssembly(models.Model):
|
|||||||
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True)
|
functional_tool_code = fields.Char(string='功能刀具编码', readonly=True)
|
||||||
name = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=True)
|
name = fields.Many2one('sf.functional.cutting.tool', string='功能刀具名称', readonly=True)
|
||||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||||
tracking=True, group_expand='_read_group_functional_tool_type_ids')
|
group_expand='_read_group_functional_tool_type_ids')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _read_group_functional_tool_type_ids(self, categories, domain, order):
|
def _read_group_functional_tool_type_ids(self, categories, domain, order):
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ class SfToolMaterialSearch(models.Model):
|
|||||||
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')
|
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')
|
||||||
|
|
||||||
# 关联刀具物料模型
|
# 关联刀具物料模型
|
||||||
mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',tracking=True,
|
mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
|
||||||
group_expand='_read_group_mrs_cutting_tool_material_ids')
|
group_expand='_read_group_mrs_cutting_tool_material_ids')
|
||||||
cutting_tool_material_name = fields.Char(string='物料名称',invisible=True)
|
cutting_tool_material_name = fields.Char(string='物料名称', invisible=True)
|
||||||
|
|
||||||
@api.onchange('mrs_cutting_tool_material_id')
|
@api.onchange('mrs_cutting_tool_material_id')
|
||||||
def _onchange_mrs_cutting_tool_material_id(self):
|
def _onchange_mrs_cutting_tool_material_id(self):
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"description": "3D模型展示模块(限odoo16)",
|
"description": "3D模型展示模块(限odoo16)",
|
||||||
"author": "Van",
|
"author": "Van",
|
||||||
"website": "https://jikimo.com",
|
"website": "https://jikimo.com",
|
||||||
|
"license": "LGPL-3",
|
||||||
"category": "Tutorials",
|
"category": "Tutorials",
|
||||||
"version": "16.0.0.1",
|
"version": "16.0.0.1",
|
||||||
"depends": ['web'],
|
"depends": ['web'],
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
'jikimo_sfs/zpl_print/static/src/scss/changes.scss'
|
'jikimo_sfs/zpl_print/static/src/scss/changes.scss'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
'license': 'LGPL-3',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'application': False,
|
'application': False,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
|
|||||||
Reference in New Issue
Block a user