diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index 59ffdd58..e199a938 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -515,4 +515,10 @@ div:has(.o_required_modifier) > label::before { input { border-bottom: 1px solid; } +} + +// 设置表格横向滚动 +.o_list_renderer.o_renderer { + max-width: 100%; + overflow-x: auto; } \ No newline at end of file diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 4ed3368f..a4db152e 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -5,7 +5,7 @@ import re import requests from itertools import groupby from odoo import api, fields, models, _ -from odoo.exceptions import UserError +from odoo.exceptions import UserError, ValidationError from odoo.addons.sf_base.commons.common import Common from odoo.tools import float_compare, float_round, float_is_zero, format_datetime @@ -507,10 +507,58 @@ class MrpProduction(models.Model): def _reset_work_order_sequence(self): for rec in self: - current_sequence = 1 - for work in rec.workorder_ids: - work.sequence = current_sequence - current_sequence += 1 + product_routing_sequence_list = {} # 成品 + embryo_routing_sequence_list = {} # 坯料 + model_type_id = rec.product_id.product_model_type_id + if model_type_id: + tmpl_num = 1 + # 成品工序 + product_routing_tmpl_ids = model_type_id.product_routing_tmpl_ids + if product_routing_tmpl_ids: + for tmpl_id in product_routing_tmpl_ids: + product_routing_sequence_list.update({tmpl_id.route_workcenter_id.name: tmpl_num}) + tmpl_num += 1 + # 表面工艺工序 + # 模型类型的表面工艺工序模版 + surface_tmpl_ids = model_type_id.surface_technics_routing_tmpl_ids + # 产品选择的表面工艺 + model_process_parameters_ids = rec.product_id.model_process_parameters_ids + process_dict = {} + if model_process_parameters_ids: + for process_parameters_id in model_process_parameters_ids: + process_id = process_parameters_id.process_id + surface_tmpl_name = '' + for surface_tmpl_id in surface_tmpl_ids: + if process_id == surface_tmpl_id.route_workcenter_id.surface_technics_id: + surface_tmpl_name = surface_tmpl_id.route_workcenter_id.name + process_dict.update({int(process_id.category_id.code): '%s-%s' % ( + surface_tmpl_name, process_parameters_id.name)}) + process_list = sorted(process_dict.keys()) + for process_num in process_list: + product_routing_sequence_list.update({process_dict.get(process_num): tmpl_num}) + tmpl_num += 1 + # 坯料工序 + tmpl_num = 1 + embryo_routing_tmpl_ids = model_type_id.embryo_routing_tmpl_ids + if embryo_routing_tmpl_ids: + for tmpl_id in embryo_routing_tmpl_ids: + embryo_routing_sequence_list.update({tmpl_id.route_workcenter_id.name: tmpl_num}) + tmpl_num += 1 + else: + raise ValidationError('该产品没有选择【模版类型】!') + + if rec.product_id.categ_id.name == '成品': + for work in rec.workorder_ids: + if product_routing_sequence_list.get(work.name): + work.sequence = product_routing_sequence_list[work.name] + else: + raise ValidationError('工序【%s】在产品选择的模版类型中不存在!' % work.name) + elif rec.product_id.categ_id.name == '坯料': + for work in rec.workorder_ids: + if embryo_routing_sequence_list.get(work.name): + work.sequence = embryo_routing_sequence_list[work.name] + else: + raise ValidationError('工序【%s】在产品选择的模版类型中不存在!' % work.name) # if work.name == '获取CNC加工程序': # work.button_start() # #work.fetchCNC() diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 5291d4d7..e840224f 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -578,7 +578,12 @@ class FunctionalToolAssembly(models.Model): def put_start_preset(self): self.search([('start_preset_bool', '=', True)]).write({'start_preset_bool': False}) - self.write({'start_preset_bool': True}) + self.write({ + 'after_assembly_tool_loading_length': 0, + 'after_assembly_functional_tool_diameter': 0, + 'after_assembly_knife_tip_r_angle': 0, + 'start_preset_bool': True + }) return { 'type': 'ir.actions.act_window', 'res_model': 'sf.functional.tool.assembly.order', diff --git a/sf_tool_management/models/functional_tool_enroll.py b/sf_tool_management/models/functional_tool_enroll.py index e69ebdd8..8891b287 100644 --- a/sf_tool_management/models/functional_tool_enroll.py +++ b/sf_tool_management/models/functional_tool_enroll.py @@ -216,6 +216,7 @@ class FunctionalCuttingToolEntity(models.Model): 'coarse_middle_thin': item.coarse_middle_thin, 'new_former': item.new_former, 'tool_loading_length': item.tool_loading_length, + 'handle_length': item.handle_length, 'functional_tool_length': item.functional_tool_length, 'effective_length': item.effective_length, 'max_lifetime_value': item.max_lifetime_value, diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 0b00be26..b3e93238 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -464,8 +464,8 @@
-