1、优化刀具物料接口、优化功能刀具安全库存接口、优化功能刀具预警接口;2、优化功能刀具组装流程;3、优化刀具物料序列号同步步骤;
This commit is contained in:
@@ -6,6 +6,30 @@ from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
def get_suitable_machining_method_names(item):
|
||||
suitable_machining_method_names = []
|
||||
for suitable_machining_method_id in item.suitable_machining_method_ids:
|
||||
if suitable_machining_method_id:
|
||||
suitable_machining_method_names.append(suitable_machining_method_id.name)
|
||||
return suitable_machining_method_names
|
||||
|
||||
|
||||
def get_cutting_direction_names(item):
|
||||
cutting_direction_names = []
|
||||
for cutting_direction_id in item.cutting_direction_ids:
|
||||
if cutting_direction_id:
|
||||
cutting_direction_names.append(cutting_direction_id.name)
|
||||
return cutting_direction_names
|
||||
|
||||
|
||||
def get_suitable_coolant_names(item):
|
||||
suitable_coolant_names = []
|
||||
for suitable_coolant_id in item.suitable_coolant_ids:
|
||||
if suitable_coolant_id:
|
||||
suitable_coolant_names.append(suitable_coolant_id.name)
|
||||
return suitable_coolant_names
|
||||
|
||||
|
||||
class StockLot(models.Model):
|
||||
_inherit = 'stock.lot'
|
||||
_description = '刀具物料序列号注册'
|
||||
@@ -116,18 +140,6 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
functional_tool_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
suitable_machining_method_names = []
|
||||
cutting_direction_names = []
|
||||
suitable_coolant_names = []
|
||||
for suitable_machining_method_id in item.suitable_machining_method_ids:
|
||||
if suitable_machining_method_id:
|
||||
suitable_machining_method_names.append(suitable_machining_method_id.name)
|
||||
for cutting_direction_id in item.cutting_direction_ids:
|
||||
if cutting_direction_id:
|
||||
cutting_direction_names.append(cutting_direction_id.name)
|
||||
for suitable_coolant_id in item.suitable_coolant_ids:
|
||||
if suitable_coolant_id:
|
||||
suitable_coolant_names.append(suitable_coolant_id.name)
|
||||
val = {
|
||||
'id': item.id,
|
||||
'code': item.code,
|
||||
@@ -143,9 +155,6 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
'tool_loading_length': item.tool_loading_length,
|
||||
'functional_tool_length': item.functional_tool_length,
|
||||
'effective_length': item.effective_length,
|
||||
'tool_room_num': item.tool_room_num,
|
||||
'line_edge_knife_library_num': item.line_edge_knife_library_num,
|
||||
'machine_knife_library_num': item.machine_knife_library_num,
|
||||
'max_lifetime_value': item.max_lifetime_value,
|
||||
'alarm_value': item.alarm_value,
|
||||
'used_value': item.used_value,
|
||||
@@ -164,11 +173,11 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
'cutting_tool_cutterpad_model_id': item.cutting_tool_cutterpad_model_id.tool_material_id,
|
||||
'cutting_tool_cutterhandle_model_id': item.cutting_tool_cutterhandle_model_id.tool_material_id,
|
||||
'cutting_tool_cutterhead_model_id': item.cutting_tool_cutterhead_model_id.tool_material_id,
|
||||
'suitable_machining_method_names': suitable_machining_method_names,
|
||||
'suitable_machining_method_names': get_suitable_machining_method_names(item),
|
||||
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
|
||||
'handle_type_name': item.handle_type_id.name,
|
||||
'cutting_direction_names': cutting_direction_names,
|
||||
'suitable_coolant_names': suitable_coolant_names,
|
||||
'cutting_direction_names': get_cutting_direction_names(item),
|
||||
'suitable_coolant_names': get_suitable_coolant_names(item),
|
||||
'active': item.active,
|
||||
}
|
||||
functional_tool_list.append(val)
|
||||
@@ -215,7 +224,6 @@ class FunctionalToolWarning(models.Model):
|
||||
'production_line': item.production_line_id.name,
|
||||
'machine_tool_id': item.maintenance_equipment_id.code,
|
||||
'machine_tool_code': item.machine_tool_code,
|
||||
'machine_table_type_code': item.machine_table_type_id.code,
|
||||
'cutter_spacing_code': item.cutter_spacing_code_id.code,
|
||||
'functional_tool_name': item.name,
|
||||
'barcode': item.barcode_id.name,
|
||||
@@ -228,9 +236,9 @@ class FunctionalToolWarning(models.Model):
|
||||
'alarm_value': item.alarm_value,
|
||||
'used_value': item.used_value,
|
||||
'functional_tool_status': item.functional_tool_status,
|
||||
'alarm_time': item.alarm_time,
|
||||
'alarm_time': item.alarm_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'dispose_user': item.dispose_user,
|
||||
'dispose_time': item.dispose_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'dispose_time': item.dispose_time,
|
||||
'dispose_func': item.dispose_func,
|
||||
}
|
||||
tool_warning_list.append(val)
|
||||
@@ -270,7 +278,7 @@ class StockMoveLine(models.Model):
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'id': item.id,
|
||||
'name': item.functional_tool_name_id.name,
|
||||
'name': item.functional_tool_name,
|
||||
'code': item.code,
|
||||
'rfid': item.rfid,
|
||||
'tool_groups_name': item.tool_groups_id.name,
|
||||
@@ -326,7 +334,6 @@ class RealTimeDistributionFunctionalTools(models.Model):
|
||||
val = {
|
||||
'id': item.id,
|
||||
'name': item.name,
|
||||
'rfid': item.rfid,
|
||||
'tool_groups_name': item.tool_groups_id.name,
|
||||
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
||||
'diameter': item.diameter,
|
||||
@@ -341,8 +348,13 @@ class RealTimeDistributionFunctionalTools(models.Model):
|
||||
'unit': item.unit,
|
||||
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
||||
'functional_tool_codes': str(functional_tool_codes),
|
||||
'whether_standard_knife': item.whether_standard_knife,
|
||||
'coarse_middle_thin': item.coarse_middle_thin,
|
||||
'whether_standard_knife': item.whether_standard_knife,
|
||||
'suitable_machining_method_names': get_suitable_machining_method_names(item),
|
||||
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
|
||||
'handle_type_name': item.handle_type_id.name,
|
||||
'cutting_direction_names': get_cutting_direction_names(item),
|
||||
'suitable_coolant_names': get_suitable_coolant_names(item),
|
||||
'active': item.active
|
||||
}
|
||||
tool_distribution_list.append(val)
|
||||
@@ -358,6 +370,6 @@ class RealTimeDistributionFunctionalTools(models.Model):
|
||||
def create(self, vals_list):
|
||||
records = super(RealTimeDistributionFunctionalTools, self).create(vals_list)
|
||||
for record in records:
|
||||
if record.functional_tool_name_id:
|
||||
if record:
|
||||
record.enroll_functional_tool_real_time_distribution()
|
||||
return records
|
||||
|
||||
Reference in New Issue
Block a user