diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index 2c05e1a2..65b76795 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -30,7 +30,7 @@ 'web.assets_qweb': [ ], 'web.assets_backend': [ - 'sf_base/static/src/scss/format_img.scss', + 'sf_base/static/src/scss/*.scss', ], }, diff --git a/sf_base/models/base.py b/sf_base/models/base.py index aeb0c0ac..57453d56 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -85,7 +85,7 @@ class MachineTool(models.Model): [("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")], default='正常', string="机床状态") #0606新增字段 - machine_tool_picture = fields.Binary('机床图片') + machine_tool_picture = fields.Binary('图片') heightened_way = fields.Selection([ ('sifudianji', '伺服电机驱动'), ('youyagang', '油压缸驱动'), @@ -260,7 +260,7 @@ class MachineToolType(models.Model): rotate_speed = fields.Integer('转速') #0606新增字段 created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user) - machine_tool_picture = fields.Binary('机床图片') + machine_tool_picture = fields.Binary('图片') heightened_way = fields.Selection([ ('sifudianji', '伺服电机驱动'), ('youyagang', '油压缸驱动'), diff --git a/sf_base/static/src/scss/test.scss b/sf_base/static/src/scss/test.scss new file mode 100644 index 00000000..32aba96d --- /dev/null +++ b/sf_base/static/src/scss/test.scss @@ -0,0 +1,7 @@ +.test_model { + display: flex !important; +} +.test_model>.o_form_label { + margin-left: 20px; + margin-right: 0px !important; +} \ No newline at end of file diff --git a/sf_base/views/base_view.xml b/sf_base/views/base_view.xml index 75d481c8..1b51900c 100644 --- a/sf_base/views/base_view.xml +++ b/sf_base/views/base_view.xml @@ -96,23 +96,25 @@ - + form.sf.machine_tool.type sf.machine_tool.type
- + - - - + + + + + @@ -177,6 +179,7 @@ + 机床型号 ir.actions.act_window @@ -249,7 +252,7 @@ tree,form

- [机床型号] 还没有哦!点左上角的[创建]按钮,沙发归你了! + [机床类型] 还没有哦!点左上角的[创建]按钮,沙发归你了!

diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 5653ac7b..d15741e9 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 @@ -468,20 +468,20 @@ class ResProductTemplate(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 @api.onchange('integral_cutting_tool_type_id') def _get_integral_cutting_tool_type_info(self): diff --git a/sf_tool_management/__init__.py b/sf_tool_management/__init__.py index 041ffad6..c081ee06 100644 --- a/sf_tool_management/__init__.py +++ b/sf_tool_management/__init__.py @@ -1,2 +1,2 @@ # -*-coding:utf-8-*- -from . import models \ No newline at end of file +from . import models diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py index da1ea72c..8368f528 100644 --- a/sf_tool_management/__manifest__.py +++ b/sf_tool_management/__manifest__.py @@ -16,6 +16,7 @@ 'security/ir.model.access.csv', 'views/tool_base_views.xml', 'views/menu_view.xml', + ], 'demo': [ ], diff --git a/sf_tool_management/models/__init__.py b/sf_tool_management/models/__init__.py index 61a05d94..c1c7e803 100644 --- a/sf_tool_management/models/__init__.py +++ b/sf_tool_management/models/__init__.py @@ -1,4 +1,2 @@ from . import base - - diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index e83e9277..ae13cb56 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -1,12 +1,15 @@ # -*- coding: utf-8 -*- from odoo import fields, models, api -# 功能刀具预警 + class FunctionalCuttingToolEntity(models.Model): _name = 'sf.functional.cutting.tool.entity' _inherit = 'sf.functional.cutting.tool' - _description = '功能刀具预警' + _description = '功能刀具管理' + order = fields.Char(string='序') + functional_cutting_tool_id = fields.Many2one('sf.functional.cutting.tool', string='功能刀具', invisible=True) + # 功能刀具预警 特有字段 install_tool_time = fields.Char("装刀时间") outbound_time = fields.Char('出库时间') on_board_time = fields.Char('上机时间') @@ -20,5 +23,77 @@ class FunctionalCuttingToolEntity(models.Model): dispose_user = fields.Char('处理人') dispose_time = fields.Char('处理时间') dispose_func = fields.Char('处理方法/措施') - remake = fields.Char('备注') + remark = fields.Char('备注') + # 功能刀具出入库记录 特有字段 + thickness = fields.Selection([('1', '粗'), ('2', '中'), ('3', '细')], string='粗/中/细') + max_life_span = fields.Char(string='最大寿命值') + # alarm_value = fields.Char(string='报警值') + # used_value = fields.Char(string='已使用值') + current_state = fields.Char(string='当前状态') + current_store_area = fields.Char(string='当前库区') + current_store_place = fields.Char(string='当前库位') + number = fields.Integer(string='数量') + reason_application = fields.Char(string='申请原因') + applicant = fields.Char(string='申请人') + return_staff = fields.Char(string='归还人') + return_time = fields.Date(string='归还入库时间') + tool_state = fields.Char(string="刀具状态") + tool_install_staff = fields.Char(string='装刀人') + tool_install_time = fields.Datetime(string='装刀时间') + receive_equipment = fields.Char(string='领用机台') + receive_staff = fields.Char(string='领用人') + receive_time = fields.Char(string='领用出库时间') + # remark = fields.Text(string='备注/说明') + + # 功能刀具实时分布 + tool_stock_num = fields.Text(string='刀具房库存数量') + side_shelf_num = fields.Text(string='线边货架货架数量') + on_tool_stock_num = fields.Text(string='机内刀库库存数量') + tool_stock_total = fields.Text(string='合计') + return_reuse_num_re = fields.Text(string='归还再用数量(精)') + return_reuse_num_co = fields.Text(string='归还再用数量(粗)') + return_processing_num = fields.Text(string='归还需磨削数量') + return_total = fields.Text(string='合计') + total = fields.Text(string='总计') + # remark = fields.Text(string='备注/说明') + + # @api.onchange('functional_cutting_tool_id') + # def get_functional_cutting_tool_info(self): + # for item in self: + # item.code = item.functional_cutting_tool_id.code, + # item.name = item.functional_cutting_tool_id.name, + # item.functional_model_number = item.functional_cutting_tool_id.functional_model_number, + # item.integral_model_number = item.functional_cutting_tool_id.integral_model_number, + # item.blade_model_number = item.functional_cutting_tool_id.blade_model_number, + # item.cutterbar_model_number = item.functional_cutting_tool_id.cutterbar_model_number, + # item.cutterpad_model_number = item.functional_cutting_tool_id.cutterpad_model_number, + # item.handle_model_number = item.functional_cutting_tool_id.handle_model_number, + # item.chuck_model_number = item.functional_cutting_tool_id.chuck_model_number, + # item.diameter = item.functional_cutting_tool_id.diameter, + # item.tool_grade = item.functional_cutting_tool_id.tool_grade, + # item.machining_accuracy = item.functional_cutting_tool_id.machining_accuracy, + # item.ctool_lengthode = item.functional_cutting_tool_id.tool_length, + # item.blade_number = item.functional_cutting_tool_id.blade_number, + # item.integral_blade_length = item.functional_cutting_tool_id.integral_blade_length, + # item.effective_blade_length = item.functional_cutting_tool_id.effective_blade_length, + # item.max_life = item.functional_cutting_tool_id.max_life, + # item.is_standard = item.functional_cutting_tool_id.is_standard, + # item.applicable_range = item.functional_cutting_tool_id.applicable_range, + + @api.model + def create(self, vals): + + if not vals.get('order'): + vals['order'] = self._generate_code() + return super(FunctionalCuttingToolEntity, self).create(vals) + + @api.model + def _generate_code(self): + last_tool = self.search([], order='id desc', limit=1) + if last_tool: + last_code = int(last_tool.code.split('-')[-1]) + new_code = '{:03d}'.format(last_code + 1) + else: + new_code = '001' + return new_code diff --git a/sf_tool_management/security/ir.model.access.csv b/sf_tool_management/security/ir.model.access.csv index d1ff33f5..3156f716 100644 --- a/sf_tool_management/security/ir.model.access.csv +++ b/sf_tool_management/security/ir.model.access.csv @@ -1,5 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_sf_functional_cutting_tool_warning,sf.functional.cutting.tool.warning,model_sf_functional_cutting_tool_warning,base.group_user,1,1,1,1 +access_sf_functional_cutting_tool_entity,sf.functional.cutting.tool.entity,model_sf_functional_cutting_tool_entity,base.group_user,1,1,1,1 diff --git a/sf_tool_management/views/menu_view.xml b/sf_tool_management/views/menu_view.xml index 67ccc2aa..5791bf90 100644 --- a/sf_tool_management/views/menu_view.xml +++ b/sf_tool_management/views/menu_view.xml @@ -6,10 +6,11 @@ 功能刀具预警 ir.actions.act_window sf.functional.cutting.tool.entity - tree,form + tree
+ @@ -28,8 +29,25 @@ id="menu_sf_functional_cutting_tool_warning" parent="menu_sf_tool_manage" name="功能刀具预警" - sequence="3" - action="action_sf_functional_cutting_tool_warning" + sequence="4" + action="sf_function_tool_entry_warning_view_act" /> + + + + + \ No newline at end of file diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index f473dcc5..8e44b693 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -1,6 +1,45 @@ + + + sf.functional.cutting.tool.entity.list.tree + sf.functional.cutting.tool.entity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具列表 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + + sf.functional.cutting.tool.entity.tree @@ -30,79 +69,125 @@ - + - - - sf.functional.cutting.tool.entity.form + + + 功能刀具预警 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + + + + + 功能刀具出入库记录 sf.functional.cutting.tool.entity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具出入库记录 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + + + + 功能刀具实时分布 + sf.functional.cutting.tool.entity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 功能刀具实时分布 + ir.actions.act_window + sf.functional.cutting.tool.entity + tree + + +