Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/获取cnc工单Bug修复

This commit is contained in:
jinling.yang
2023-08-29 17:41:23 +08:00
22 changed files with 412 additions and 219 deletions

View File

@@ -1,4 +1,4 @@
from odoo import fields, models
from odoo import fields, models,api
class ResProductCategory(models.Model):
@@ -32,7 +32,26 @@ class ProductModelTypeRoutingSort(models.Model):
sequence = fields.Integer('Sequence')
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
# routing_type = fields.Selection([
# ('获取CNC加工程序', '获取CNC加工程序'),
# ('装夹', '装夹'),
# ('前置三元定位检测', '前置三元定位检测'),
# ('CNC加工', 'CNC加工'),
# ('后置三元质量检测', '后置三元质量检测'),
# ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
# ], 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
routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
product_model_type_id = fields.Many2one('sf.model.type')
@@ -48,7 +67,25 @@ class EmbryoModelTypeRoutingSort(models.Model):
sequence = fields.Integer('Sequence')
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
# routing_type = fields.Selection([
# ('获取CNC加工程序', '获取CNC加工程序'),
# ('装夹', '装夹'),
# ('前置三元定位检测', '前置三元定位检测'),
# ('CNC加工', 'CNC加工'),
# ('后置三元质量检测', '后置三元质量检测'),
# ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
# ], 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
routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
embryo_model_type_id = fields.Many2one('sf.model.type')
@@ -64,7 +101,25 @@ class SurfaceTechnicsModelTypeRoutingSort(models.Model):
sequence = fields.Integer('Sequence')
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
# routing_type = fields.Selection([
# ('获取CNC加工程序', '获取CNC加工程序'),
# ('装夹', '装夹'),
# ('前置三元定位检测', '前置三元定位检测'),
# ('CNC加工', 'CNC加工'),
# ('后置三元质量检测', '后置三元质量检测'),
# ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺')
# ], 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
routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
surface_technics_model_type_id = fields.Many2one('sf.model.type')

View File

@@ -8,7 +8,7 @@ class ResWorkcenter(models.Model):
_inherit = "mrp.workcenter"
# 生产线显示
production_line_show = fields.Char(string='生产线')
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('工艺外协')
@@ -20,7 +20,13 @@ class ResWorkcenter(models.Model):
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')

View File

@@ -19,11 +19,11 @@ class ResMrpWorkOrder(models.Model):
_order = 'sequence asc,create_date desc'
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,
check_company=True, string="坯料宽度(mm)")
string="坯料宽度(mm)")
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,
store=True, check_company=True, string="材料")
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="工序类型")
results = fields.Char('检测结果')
results = fields.Char('结果')
@api.onchange('users_ids')
def get_user_permissions(self):
@@ -118,7 +118,7 @@ class ResMrpWorkOrder(models.Model):
chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌")
chuck_type_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_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌")
tray_type_id = fields.Char(string="托盘类型")

View File

@@ -12,7 +12,22 @@ import os
class ResProductMo(models.Model):
_inherit = 'product.template'
model_file = fields.Binary('模型文件')
# categ_type = fields.Selection(
# [("成品", "成品"), ("坯料", "坯料"), ("原材料", "原材料"), ("表面工艺", "表面工艺"), ("刀具", "刀具"),
# ("夹具", "夹具")],
# string='产品的类别', compute='_compute_categ_id',
# store=True)
#
# @api.depends('categ_id')
# def _compute_categ_id(self):
# for record in self:
# if record:
# record.categ_type = record.categ_id.type
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
model_name = fields.Char('模型名称')
model_long = fields.Float('模型长(mm)', digits=(16, 3))
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
@@ -57,6 +72,7 @@ class ResProductMo(models.Model):
tool_height = fields.Integer('高度(mm)')
tool_thickness = fields.Integer('厚度(mm)')
tool_weight = fields.Float('重量(kg)')
coating_material = fields.Char('涂层材质')
# 整体式刀具参数
cutting_tool_total_length = fields.Float('总长度(mm)')
@@ -134,10 +150,12 @@ class ResProductMo(models.Model):
fixture_clamping_way = fields.Char(string="装夹方式")
fixture_port_type = fields.Char(string="接口类型")
fixture_model_file = fields.Binary(string="3D模型图")
fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度max(mm)")
fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度max(mm)")
fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度max(mm)")
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_clamping_force = fields.Integer(string="最大夹持力(n)")
fixture_driving_way = fields.Char(string="驱动方式")
@@ -145,11 +163,62 @@ class ResProductMo(models.Model):
string="适用机床型号")
fixture_through_hole_size = fields.Integer(string="过孔大小(mm)")
fixture_screw_size = fields.Integer(string="螺牙大小(mm)")
# 注册状态
register_state = fields.Selection([('未注册', '未注册'), ('已注册', '已注册'), ('注册失败', '注册失败')],
string='注册状态', default='未注册')
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):
code_arr = []
for i in item.product_id.fixture_apply_machine_tool_type_ids: