From 35afdd3b2ad0aa76aa09ffa4855a64dfa15ef20f Mon Sep 17 00:00:00 2001
From: yuxianghui <1608204036@qq.com>
Date: Fri, 8 Sep 2023 10:20:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E6=A8=A1=E5=9E=8B=E4=BB=8Esf=5Fbase=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=88=B0sf=5Fmanufacturing=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=EF=BC=9B=E6=96=B0=E5=A2=9E=E6=AF=8F=E9=BD=BF=E8=B5=B0=E5=88=80?=
=?UTF-8?q?=E9=87=8F=E6=A8=A1=E5=9E=8B=EF=BC=9B=E6=95=B4=E4=BD=93=E5=BC=8F?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E6=96=B0=E5=A2=9E=E5=85=B3?=
=?UTF-8?q?=E8=81=94=E6=AF=8F=E9=BD=BF=E8=B5=B0=E5=88=80=E9=87=8F=E5=AF=B9?=
=?UTF-8?q?=E8=B1=A1=E5=AD=97=E6=AE=B5=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_base/__manifest__.py | 1 -
sf_base/models/__init__.py | 1 -
sf_base/security/ir.model.access.csv | 7 +---
sf_dlm/views/product_template_view.xml | 41 ++++++++++++++++---
sf_manufacturing/__manifest__.py | 1 +
sf_manufacturing/models/__init__.py | 1 +
sf_manufacturing/models/product_template.py | 35 ++++++++--------
.../models/tool_other_features.py | 28 +++++++++++--
sf_manufacturing/security/ir.model.access.csv | 8 +++-
.../views/tool_other_features_view.xml | 25 ++++++++++-
sf_sale/models/quick_easy_order.py | 36 ++++++++--------
.../models/tool_material_search.py | 3 ++
.../views/tool_material_search.xml | 6 +++
13 files changed, 138 insertions(+), 55 deletions(-)
rename {sf_base => sf_manufacturing}/models/tool_other_features.py (67%)
rename {sf_base => sf_manufacturing}/views/tool_other_features_view.xml (83%)
diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index 5f4c6906..bcb25c81 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -18,7 +18,6 @@
'views/common_view.xml',
'views/fixture_view.xml',
'views/functional_fixture_view.xml',
- 'views/tool_other_features_view.xml',
'views/menu_view.xml',
"views/tool_views.xml",
"views/tool_menu.xml",
diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py
index 93961162..483787eb 100644
--- a/sf_base/models/__init__.py
+++ b/sf_base/models/__init__.py
@@ -3,7 +3,6 @@ from . import common
from . import tool_base_new
from . import fixture
from . import functional_fixture
-from . import tool_other_features
diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv
index 73661ae8..fefaeb1b 100644
--- a/sf_base/security/ir.model.access.csv
+++ b/sf_base/security/ir.model.access.csv
@@ -24,12 +24,7 @@ access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user,
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_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,1
-access_sf_suitable_machining_method,sf_suitable_machining_method,model_sf_suitable_machining_method,base.group_user,1,1,1,1
-access_sf_blade_tip_characteristics,sf_blade_tip_characteristics,model_sf_blade_tip_characteristics,base.group_user,1,1,1,1
-access_sf_handle_type,sf_handle_type,model_sf_handle_type,base.group_user,1,1,1,1
-access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base.group_user,1,1,1,1
-access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1
-access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
+
diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml
index 9a2f3b4f..73321c0b 100644
--- a/sf_dlm/views/product_template_view.xml
+++ b/sf_dlm/views/product_template_view.xml
@@ -211,22 +211,51 @@
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index be18f685..b7fa686a 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -22,6 +22,7 @@
'views/mrp_workcenter_views.xml',
'views/mrp_workorder_view.xml',
'views/production_line_view.xml',
+ 'views/tool_other_features_view.xml',
# 'views/tray_view.xml',
'views/model_type_view.xml',
# 'views/kanban_change.xml'
diff --git a/sf_manufacturing/models/__init__.py b/sf_manufacturing/models/__init__.py
index 2d7d2f1e..96accf78 100644
--- a/sf_manufacturing/models/__init__.py
+++ b/sf_manufacturing/models/__init__.py
@@ -9,6 +9,7 @@ from . import mrp_routing_workcenter
from . import stock
from . import res_user
from . import production_line_base
+from . import tool_other_features
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 98e4247a..a55ebef8 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -1,8 +1,8 @@
from odoo import models, fields, api
from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path
-from OCC.Extend.DataExchange import read_step_file
-from OCC.Extend.DataExchange import write_stl_file
+# from OCC.Extend.DataExchange import read_step_file
+# from OCC.Extend.DataExchange import write_stl_file
import logging
import base64
import hashlib
@@ -100,7 +100,8 @@ class ResProductMo(models.Model):
cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction_product_template', '走刀方向')
suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant_product_template', '适合冷却液')
- cutting_speed_ids = fields.Many2many('sf.cutting.speed', 'rel_sf_cutting_speed', '切削速度Vc')
+ cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
+ feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
@api.constrains('suitable_machining_method_ids')
def _check_suitable_machining_method_ids(self):
@@ -662,20 +663,20 @@ class ResProductMo(models.Model):
item.model_file = self.transition_glb_file(report_path, model_code)
# 将attach的datas内容转为glb文件
- def transition_glb_file(self, report_path, code):
- shapes = read_step_file(report_path)
- output_file = os.path.join('/tmp', str(code) + '.stl')
- write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
- # 转化为glb
- output_glb_file = os.path.join('/tmp', str(code) + '.glb')
- util_path = get_resource_path('sf_dlm', 'static/util')
- cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
- os.system(cmd)
- # 转base64
- with open(output_glb_file, 'rb') as fileObj:
- image_data = fileObj.read()
- base64_data = base64.b64encode(image_data)
- return base64_data
+ # def transition_glb_file(self, report_path, code):
+ # shapes = read_step_file(report_path)
+ # output_file = os.path.join('/tmp', str(code) + '.stl')
+ # write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
+ # # 转化为glb
+ # output_glb_file = os.path.join('/tmp', str(code) + '.glb')
+ # util_path = get_resource_path('sf_dlm', 'static/util')
+ # cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
+ # os.system(cmd)
+ # # 转base64
+ # with open(output_glb_file, 'rb') as fileObj:
+ # image_data = fileObj.read()
+ # base64_data = base64.b64encode(image_data)
+ # return base64_data
class ResMrpBomMo(models.Model):
diff --git a/sf_base/models/tool_other_features.py b/sf_manufacturing/models/tool_other_features.py
similarity index 67%
rename from sf_base/models/tool_other_features.py
rename to sf_manufacturing/models/tool_other_features.py
index 129b0199..198faa09 100644
--- a/sf_base/models/tool_other_features.py
+++ b/sf_manufacturing/models/tool_other_features.py
@@ -1,4 +1,4 @@
-from odoo import fields, models
+from odoo import fields, models, api
class SuitableMachiningMethod(models.Model):
@@ -56,12 +56,14 @@ class CuttingSpeed(models.Model):
#
# order = fields.Char('序', default=_get_order, readonly=True)
+ product_template_id = fields.Many2one('product.template', string='产品')
+
execution_standard_id = fields.Char('执行标准')
material_code = fields.Char('材料代号')
material_name = fields.Char('材料名称')
material_grade = fields.Char('材料牌号')
- tensile_strength = fields.Char('拉伸强度 (N/mm²)')
- hardness = fields.Char('硬度(HRC)')
+ tensile_strength = fields.Float('拉伸强度 (N/mm²)')
+ hardness = fields.Float('硬度(HRC)')
cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc')
cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc')
@@ -70,4 +72,22 @@ class CuttingSpeed(models.Model):
cutting_speed_n5 = fields.Char('径向切宽 ae=5%D1 ap=L1max 切削速度Vc')
rough_machining = fields.Char('粗加工 Vc(m/min)')
precision_machining = fields.Char('精加工 Vc(m/min)')
- application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
\ No newline at end of file
+ application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
+
+
+class FeedPerTooth(models.Model):
+ _name = 'sf.feed.per.tooth'
+ _description = '每齿走刀量fz'
+
+ product_template_id = fields.Many2one('product.template', string='产品')
+
+ cutting_speed = fields.Char('径向切宽 ae(mm)')
+ materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
+ blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True, compute='_compute_product_template_id')
+ feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
+ unit = fields.Char('单位', default='fz')
+
+ @api.depends('product_template_id')
+ def _compute_product_template_id(self):
+ if self.product_template_id is not None:
+ self.blade_diameter = self.product_template_id.integral_blade_diameter
diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv
index e0a78bb6..76812adb 100644
--- a/sf_manufacturing/security/ir.model.access.csv
+++ b/sf_manufacturing/security/ir.model.access.csv
@@ -7,6 +7,12 @@ access_sf_surface_technics_model_type_routing_sort,sf_surface_technics_model_typ
access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1
-
+access_sf_suitable_machining_method,sf_suitable_machining_method,model_sf_suitable_machining_method,base.group_user,1,1,1,1
+access_sf_blade_tip_characteristics,sf_blade_tip_characteristics,model_sf_blade_tip_characteristics,base.group_user,1,1,1,1
+access_sf_handle_type,sf_handle_type,model_sf_handle_type,base.group_user,1,1,1,1
+access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base.group_user,1,1,1,1
+access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1
+access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
+access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
diff --git a/sf_base/views/tool_other_features_view.xml b/sf_manufacturing/views/tool_other_features_view.xml
similarity index 83%
rename from sf_base/views/tool_other_features_view.xml
rename to sf_manufacturing/views/tool_other_features_view.xml
index df614171..897ff785 100644
--- a/sf_base/views/tool_other_features_view.xml
+++ b/sf_manufacturing/views/tool_other_features_view.xml
@@ -105,7 +105,7 @@
切削速度Vc
sf.cutting.speed
-
+
@@ -131,4 +131,27 @@
sf.cutting.speed
tree
+
+
+
+
+ 每齿走刀量fz
+ sf.feed.per.tooth
+
+
+
+
+
+
+
+
+
+
+
+
+ 每齿走刀量fz
+ ir.actions.act_window
+ sf.feed.per.tooth
+ tree
+
\ No newline at end of file
diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py
index eed2be57..625e21a2 100644
--- a/sf_sale/models/quick_easy_order.py
+++ b/sf_sale/models/quick_easy_order.py
@@ -1,7 +1,7 @@
from odoo import models, fields, api
from odoo.modules import get_resource_path
-from OCC.Extend.DataExchange import read_step_file
-from OCC.Extend.DataExchange import write_stl_file
+# from OCC.Extend.DataExchange import read_step_file
+# from OCC.Extend.DataExchange import write_stl_file
from odoo.exceptions import ValidationError, UserError
from odoo.addons.sf_base.commons.common import Common
from datetime import datetime
@@ -86,22 +86,22 @@ class QuickEasyOrder(models.Model):
return obj
# 将attach的datas内容转为glb文件
- def transition_glb_file(self, report_path, model_code):
- shapes = read_step_file(report_path)
- # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', 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)
- # 转化为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')
- util_path = get_resource_path('sf_dlm', 'static/util')
- cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
- os.system(cmd)
- # 转base64
- with open(output_glb_file, 'rb') as fileObj:
- image_data = fileObj.read()
- base64_data = base64.b64encode(image_data)
- return base64_data
+ # def transition_glb_file(self, report_path, model_code):
+ # shapes = read_step_file(report_path)
+ # # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', 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)
+ # # 转化为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')
+ # util_path = get_resource_path('sf_dlm', 'static/util')
+ # cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
+ # os.system(cmd)
+ # # 转base64
+ # with open(output_glb_file, 'rb') as fileObj:
+ # image_data = fileObj.read()
+ # base64_data = base64.b64encode(image_data)
+ # return base64_data
# return False
diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py
index c58d0e6f..ab9c24f7 100644
--- a/sf_tool_management/models/tool_material_search.py
+++ b/sf_tool_management/models/tool_material_search.py
@@ -102,6 +102,9 @@ class SfToolMaterialSearch(models.Model):
cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction', '走刀方向')
suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant', '适合冷却液')
+ cutting_speed_ids = fields.Many2many('sf.cutting.speed', string='切削速度Vc')
+ feed_per_tooth_ids = fields.Many2many('sf.feed.per.tooth', 'rel_feed_per_tooth_ids', '每齿走刀量fz')
+
@api.constrains('suitable_machining_method_ids')
def _check_suitable_machining_method_ids(self):
for record in self:
diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml
index 7ed97d1d..594073ff 100644
--- a/sf_tool_management/views/tool_material_search.xml
+++ b/sf_tool_management/views/tool_material_search.xml
@@ -240,6 +240,12 @@
+
+
+
+
+
+