Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造代码优化

# Conflicts:
#	zpl_print/models/common.py
This commit is contained in:
mgw
2024-03-14 14:24:26 +08:00
38 changed files with 1334 additions and 496 deletions

View File

@@ -451,8 +451,8 @@ div:has(.o_required_modifier) > label::before {
}
}
// 设置列表底部按钮、设置列表header按钮
.o_list_renderer .o_field_x2many_list_row_add a,.treeHeaderBtn{
// 更改表格底部按钮样式
.o_list_renderer .o_field_x2many_list_row_add a,.treeHeaderBtn,.o_x2m_control_panel .o_cp_buttons .btn{
display: inline-block;
margin: 5px 0;
font-size: 14px;
@@ -463,7 +463,7 @@ div:has(.o_required_modifier) > label::before {
border-radius: 0.25rem;
transition: all .3s;
}
.o_list_renderer .o_field_x2many_list_row_add a:hover,.treeHeaderBtn:hover{
.o_list_renderer .o_field_x2many_list_row_add a:hover,.treeHeaderBtn:hover,.o_x2m_control_panel .o_cp_buttons .btn:hover{
background: #71639e;
color: #fff
}

View File

@@ -106,6 +106,7 @@ class MachineTool(models.Model):
lead_screw = fields.Char('丝杆')
workbench_L = fields.Char('工作台长度(mm)')
workbench_W = fields.Char('工作台宽度(mm)')
workbench_H = fields.Char('工作台高度(mm)')
guide_rail = fields.Char('导轨')
machine_tool_L = fields.Char('机床长度(mm)')
machine_tool_W = fields.Char('机床宽度(mm)')
@@ -193,6 +194,7 @@ class MachineTool(models.Model):
item.lead_screw = item.type_id.lead_screw
item.workbench_L = item.type_id.workbench_L
item.workbench_W = item.type_id.workbench_W
item.workbench_H = item.type_id.workbench_H
item.guide_rail = item.type_id.guide_rail
item.machine_tool_L = item.type_id.machine_tool_L
item.machine_tool_W = item.type_id.machine_tool_W
@@ -280,6 +282,7 @@ class MachineToolType(models.Model):
workpiece_load = fields.Char('工件最大负载(kg)')
workbench_L = fields.Char('工作台长度(mm)')
workbench_W = fields.Char('工作台宽度(mm)')
workbench_H = fields.Char('工作台高度(mm)')
machine_tool_L = fields.Char('机床长度(mm)')
machine_tool_W = fields.Char('机床宽度(mm)')
machine_tool_H = fields.Char('机床高度(mm)')
@@ -295,8 +298,9 @@ class MachineToolType(models.Model):
x_axis = fields.Integer('X轴')
y_axis = fields.Integer('Y轴')
z_axis = fields.Integer('Z轴')
b_axis = fields.Integer('B')
c_axis = fields.Integer('C')
a_axis = fields.Char('a')
b_axis = fields.Char('B')
c_axis = fields.Char('C轴')
remark = fields.Char('备注')
control_system_id = fields.Many2one('sf.machine.control_system',
string="控制系统")
@@ -309,7 +313,7 @@ class MachineToolType(models.Model):
default="", string="轴数")
# 1212新增字段
a_axis = fields.Integer('a轴')
function_type = fields.Selection(
[("ZXJGZX", "钻铣加工中心"), ("CXJGZX", "车削加工中心"), ("FHJGZX", "复合加工中心")],
default="", string="功能类型")
@@ -335,23 +339,23 @@ class MachineToolType(models.Model):
straight_cutting_feed_rate = fields.Char('直线切削进给速度(mm/min)')
rotary_cutting_feed_rate = fields.Char('回转切削进给速度(mm/min)')
X_precision = fields.Float('X轴定位精度(mm)', digits=(12, 3))
X_precision_repeat = fields.Float('X轴重复定位精度(mm)', digits=(12, 3))
Y_precision = fields.Float('Y轴定位精度(mm)', digits=(12, 3))
Y_precision_repeat = fields.Float('Y轴重复定位精度(mm)', digits=(12, 3))
Z_precision = fields.Float('Z轴定位精度(mm)', digits=(12, 3))
Z_precision_repeat = fields.Float('Z轴重复定位精度(mm)', digits=(12, 3))
a_precision = fields.Float('a轴定位精度(mm)', digits=(12, 3))
a_precision_repeat = fields.Float('a轴重复定位精度(mm)', digits=(12, 3))
b_precision = fields.Float('b轴定位精度(mm)', digits=(12, 3))
b_precision_repeat = fields.Float('b轴重复定位精度(mm)', digits=(12, 3))
c_precision = fields.Float('c轴定位精度(mm)', digits=(12, 3))
c_precision_repeat = fields.Float('c轴重复定位精度(mm)', digits=(12, 3))
X_precision = fields.Char('X轴定位精度(mm)')
X_precision_repeat = fields.Char('X轴重复定位精度(mm)')
Y_precision = fields.Char('Y轴定位精度(mm)')
Y_precision_repeat = fields.Char('Y轴重复定位精度(mm)')
Z_precision = fields.Char('Z轴定位精度(mm)')
Z_precision_repeat = fields.Char('Z轴重复定位精度(mm)')
a_precision = fields.Char('a轴定位精度(mm)')
a_precision_repeat = fields.Char('a轴重复定位精度(mm)')
b_precision = fields.Char('b轴定位精度(mm)')
b_precision_repeat = fields.Char('b轴重复定位精度(mm)')
c_precision = fields.Char('c轴定位精度(mm)')
c_precision_repeat = fields.Char('c轴重复定位精度(mm)')
tool_full_diameter_max = fields.Float('刀具满刀最大直径(mm)')
tool_perimeter_diameter_max = fields.Float('刀具邻空刀最大直径(mm)')
T_tool_time = fields.Integer('T-T换刀时间(s)')
C_tool_time = fields.Integer('C-C换刀时间(s)')
T_tool_time = fields.Float('T-T换刀时间(s)', digits=(12, 1))
C_tool_time = fields.Float('C-C换刀时间(s)', digits=(12, 1))
jg_image_id = fields.Many2many('maintenance.equipment.image', 'jg_equipment_id', string='加工能力',
domain="[('type', '=', '加工能力')]")

View File

@@ -90,7 +90,7 @@ class MrsProductionProcess(models.Model):
code = fields.Char("编码")
name = fields.Char('名称')
remark = fields.Text("备注")
processing_order_ids = fields.One2many('sf.processing.order', 'production_process_id', string='工序')
# processing_order_ids = fields.One2many('sf.processing.order', 'production_process_id', string='工序')
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
active = fields.Boolean('有效', default=True)
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
@@ -98,25 +98,25 @@ class MrsProductionProcess(models.Model):
# workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_process', required=True)
class MrsProcessingTechnology(models.Model):
_name = 'sf.processing.technology'
_description = '加工工艺'
name = fields.Char('名称', index=True)
remark = fields.Text('备注', index=True)
code = fields.Char("编码")
processing_order_ids = fields.Many2many('sf.processing.order', 'sf_associated_processes',
index=True, string='工序')
active = fields.Boolean('有效', default=True)
# class MrsProcessingTechnology(models.Model):
# _name = 'sf.processing.technology'
# _description = '加工工艺'
#
# name = fields.Char('名称', index=True)
# remark = fields.Text('备注', index=True)
# code = fields.Char("编码")
# processing_order_ids = fields.Many2many('sf.processing.order', 'sf_associated_processes',
# index=True, string='工序')
# active = fields.Boolean('有效', default=True)
class MrsProcessingOrder(models.Model):
_name = 'sf.processing.order'
_description = '工序'
sequence = fields.Integer('Sequence')
processing_technology_ids = fields.Many2many('sf.processing.technology', 'sf_associated_processes',
index=True, string='加工工艺')
production_process_id = fields.Many2one('sf.production.process', string="表面工艺")
# class MrsProcessingOrder(models.Model):
# _name = 'sf.processing.order'
# _description = '工序'
# sequence = fields.Integer('Sequence')
# processing_technology_ids = fields.Many2many('sf.processing.technology', 'sf_associated_processes',
# index=True, string='加工工艺')
# production_process_id = fields.Many2one('sf.production.process', string="表面工艺")
class SupplierSort(models.Model):

View File

@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
import json
import requests
from datetime import date
from odoo import fields, models, api
from odoo.exceptions import ValidationError
from odoo.addons.sf_base.commons.common import Common
class CuttingToolMaterial(models.Model):
@@ -113,6 +110,24 @@ class CuttingToolModel(models.Model):
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz(整体式刀具)')
feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz(刀片)')
material_model_id = fields.Many2one('sf.materials.model', '材料型号')
@api.onchange('cutting_tool_material_id')
def _get_code(self):
if self.is_cloud is False:
today = date.today().strftime("%Y%m%d")
today_code = 'T-DJWL-%s-%s' % (self.cutting_tool_material_id.code, today)
cutting_tool_model = self.search(
[('code', 'ilike', today_code), ('is_cloud', '=', False),
('active', 'in', [True, False])],
limit=1,
order="id desc")
if not cutting_tool_model:
num = "%03d" % 1
else:
m = int(today_code[-3:]) + 1
num = "%03d" % m
self.code = "%s%s" % (today_code, num)
# 适用夹头型号可以多选
# chuck_ids = fields.Many2many(
# 'sf.cutting_tool.standard.library',

View File

@@ -10,6 +10,7 @@ class ToolMaterialsBasicParameters(models.Model):
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库')
cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型',
store=True)
is_cloud = fields.Boolean(related='standard_library_id.is_cloud', string='云端数据')
# 整体式刀具参数
total_length = fields.Float('总长度(mm)')
@@ -21,7 +22,7 @@ class ToolMaterialsBasicParameters(models.Model):
handle_diameter = fields.Float('柄部直径(mm)')
handle_length = fields.Float('柄部长度(mm)')
blade_tip_diameter = fields.Integer('刀尖直径(mm)')
blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20)
blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20)
blade_tip_taper = fields.Integer('刀尖锥度(°)')
blade_diameter = fields.Float('刃部直径(mm)')
blade_length = fields.Float('刃部长度(mm)')
@@ -37,7 +38,7 @@ class ToolMaterialsBasicParameters(models.Model):
cutting_blade_length = fields.Float('切削刃长(mm)')
relief_angle = fields.Integer('后角(°)')
blade_tip_circular_arc_radius = fields.Char('刀尖圆弧半径(mm)', size=20)
inscribed_circle_diameter = fields.Float('内接圆直径(mm)')
inscribed_circle_diameter = fields.Float('内接圆直径IC/D(mm)')
install_aperture_diameter = fields.Float('安装孔直径(mm)')
chip_breaker_groove = fields.Selection([('', ''), ('单面', '单面'), ('双面', '双面')],
string='有无断屑槽')
@@ -170,8 +171,6 @@ class FeedPerTooth(models.Model):
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)', size=20)
active = fields.Boolean(string='有效', default=True)
# @api.depends('product_template_id')
# def _compute_product_template_id(self):
# if self.product_template_id is not None:

View File

@@ -9,16 +9,13 @@ access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,b
access_sf_machine_brand_tags_admin,sf_machine_brand_tags_admin,model_sf_machine_brand_tags,base.group_system,1,1,1,0
access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,base.group_user,1,1,1,0
access_sf_machine_control_system_admin,sf_machine_control_system_admin,model_sf_machine_control_system,base.group_system,1,1,1,0
access_sf_processing_order,sf_processing_order,model_sf_processing_order,base.group_user,1,1,1,0
access_sf_processing_order_admin,sf_processing_order_admin,model_sf_processing_order,base.group_system,1,1,1,0
access_sf_production_process,sf_production_process,model_sf_production_process,base.group_user,1,1,1,0
access_sf_production_process_admin,sf_production_process_admin,model_sf_production_process,base.group_system,1,1,1,0
access_sf_production_materials,sf_production_materials,model_sf_production_materials,base.group_user,1,1,1,0
access_sf_production_materials_admin,sf_production_materials_admin,model_sf_production_materials,base.group_system,1,1,1,0
access_sf_materials_model,sf_materials_model,model_sf_materials_model,base.group_user,1,1,1,0
access_sf_materials_model_admin,sf_materials_model_admin,model_sf_materials_model,base.group_system,1,1,1,0
access_sf_processing_technology,sf_processing_technology,model_sf_processing_technology,base.group_user,1,1,1,0
access_sf_processing_technology_admin,sf_processing_technology_admin,model_sf_processing_technology,base.group_system,1,1,1,0
access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user,1,1,1,0
access_sf_supplier_sort_admin,sf_supplier_sort_admin,model_sf_supplier_sort,base.group_system,1,1,1,0
access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,0
@@ -75,11 +72,15 @@ access_sf_cutting_speed_group_purchase_director,sf_cutting_speed_group_purchase_
access_sf_cutting_speed_group_sale_director,sf_cutting_speed_group_sale_director,model_sf_cutting_speed,sf_base.group_sale_director,1,1,1,0
access_sf_cutting_speed_group_plan_dispatch,sf_cutting_speed_group_plan_dispatch,model_sf_cutting_speed,sf_base.group_plan_dispatch,1,0,0,0
access_sf_cutting_speed_group_plan_director,sf_cutting_speed_group_plan_director,model_sf_cutting_speed,sf_base.group_plan_director,1,1,1,0
access_sf_cutting_speed_group_quality_director,sf_cutting_speed_group_quality_director,model_sf_cutting_speed,sf_base.group_quality_director,1,1,1,0
access_sf_cutting_speed_group_quality,sf_cutting_speed_group_quality,model_sf_cutting_speed,sf_base.group_quality,1,1,1,0
access_sf_feed_per_tooth_group_purchase_director,sf_feed_per_tooth_group_purchase_director,model_sf_feed_per_tooth,sf_base.group_purchase_director,1,1,0,0
access_sf_feed_per_tooth_group_sale_director,sf_feed_per_tooth_group_sale_director,model_sf_feed_per_tooth,sf_base.group_sale_director,1,1,0,0
access_sf_feed_per_tooth_group_plan_dispatch,sf_feed_per_tooth_group_plan_dispatch,model_sf_feed_per_tooth,sf_base.group_plan_dispatch,1,0,0,0
access_sf_feed_per_tooth_group_plan_director,sf_feed_per_tooth_group_plan_director,model_sf_feed_per_tooth,sf_base.group_plan_director,1,1,0,0
access_sf_feed_per_tooth_group_sale_salemanager,sf_feed_per_tooth_group_sale_salemanager,model_sf_feed_per_tooth,sf_base.group_sale_salemanager,1,0,0,0
access_sf_feed_per_tooth_group_quality,sf_feed_per_tooth_group_quality,model_sf_feed_per_tooth,sf_base.group_quality,1,1,1,0
access_sf_feed_per_tooth_group_quality_director,sf_feed_per_tooth_group_quality_director,model_sf_feed_per_tooth,sf_base.group_quality_director,1,1,1,0
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,0
access_sf_feed_per_tooth_admin,sf_feed_per_tooth_admin,model_sf_feed_per_tooth,base.group_system,1,1,1,0
access_sf_ramping_angle,sf_ramping_angle,model_sf_ramping_angle,base.group_user,1,1,1,1
@@ -94,7 +95,6 @@ access_sf_machine_brand_group_purchase_director,sf_machine_brand_group_purchase_
access_sf_machine_brand_group_sale_director,sf_machine_brand_group_sale_director,model_sf_machine_brand,sf_base.group_sale_director,1,0,0,0
access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,base.group_user,1,1,1,1
access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_processing_order,sf_processing_order,model_sf_processing_order,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_production_process,sf_production_process,model_sf_production_process,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_production_materials,sf_production_materials,model_sf_production_materials,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_production_materials_group_plan_director,sf_production_materials_group_plan_director,model_sf_production_materials,sf_base.group_plan_director,1,1,0,0
@@ -104,7 +104,6 @@ access_sf_materials_model,sf_materials_model,model_sf_materials_model,sf_base.gr
access_sf_materials_model_group_plan_director,sf_materials_model_group_plan_director,model_sf_materials_model,sf_base.group_plan_director,1,0,0,0
access_sf_materials_model_group_purchase_director,sf_materials_model_group_purchase_director,model_sf_materials_model,sf_base.group_purchase_director,1,0,0,0
access_sf_materials_model_group_sale_director,sf_materials_model_group_sale_director,model_sf_materials_model,sf_base.group_sale_director,1,0,0,0
access_sf_processing_technology,sf_processing_technology,model_sf_processing_technology,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,sf_base.group_sf_mrp_user,1,0,0,0
access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,sf_base.group_sf_mrp_user,1,0,0,0
@@ -143,9 +142,7 @@ access_sf_cutting_width_depth,sf_cutting_width_depth,model_sf_cutting_width_dept
access_sf_cutting_width_depth_group_purchase,sf_cutting_width_depth_group_purchase,model_sf_cutting_width_depth,sf_base.group_purchase,1,0,0,0
access_maintenance_equipment_image,maintenance_equipment_image,model_maintenance_equipment_image,base.group_user,1,1,1,1
access_purchase_order_group_purchase,access_purchase_order_group_purchase,purchase.model_purchase_order,sf_base.group_purchase,1,1,1,0
access_purchase_order_group_purchase_director,access_purchase_order_group_purchase_director,purchase.model_purchase_order,sf_base.group_purchase_director,1,1,1,0
access_purchase_order_line_group_purchase,access_purchase_order_line_group_purchase,purchase.model_purchase_order_line,sf_base.group_purchase,1,1,1,0
access_purchase_order_line_group_purchase_director,access_purchase_order_line_group_purchase_director,purchase.model_purchase_order_line,sf_base.group_purchase_director,1,1,1,0
access_spindle_taper_type,spindle_taper_type,model_spindle_taper_type,base.group_user,1,1,1,1
access_sf_tool_groups_group_plan_dispatch,sf_tool_groups,model_sf_tool_groups,sf_base.group_plan_dispatch,1,0,0,0
access_sf_tool_groups_group_sf_tool_user,sf_tool_groups,model_sf_tool_groups,sf_base.group_sf_tool_user,1,1,1,1
@@ -161,11 +158,9 @@ access_sf_machine_tool_type,sf_machine_tool_type,model_sf_machine_tool_type,sf_b
access_sf_machine_brand,sf_machine_brand,model_sf_machine_brand,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_processing_order,sf_processing_order,model_sf_processing_order,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_production_process,sf_production_process,model_sf_production_process,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_production_materials,sf_production_materials,model_sf_production_materials,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_materials_model,sf_materials_model,model_sf_materials_model,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_processing_technology,sf_processing_technology,model_sf_processing_technology,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,sf_base.group_sf_mrp_user,1,1,0,0
access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,sf_base.group_sf_mrp_user,1,1,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
9 access_sf_machine_brand_tags_admin sf_machine_brand_tags_admin model_sf_machine_brand_tags base.group_system 1 1 1 0
10 access_sf_machine_control_system sf_machine_control_system model_sf_machine_control_system base.group_user 1 1 1 0
11 access_sf_machine_control_system_admin sf_machine_control_system_admin model_sf_machine_control_system base.group_system 1 1 1 0
12 access_sf_processing_order access_sf_production_process sf_processing_order sf_production_process model_sf_processing_order model_sf_production_process base.group_user 1 1 1 0
access_sf_processing_order_admin sf_processing_order_admin model_sf_processing_order base.group_system 1 1 1 0
13 access_sf_production_process access_sf_production_process_admin sf_production_process sf_production_process_admin model_sf_production_process base.group_user base.group_system 1 1 1 0
14 access_sf_production_process_admin access_sf_production_materials sf_production_process_admin sf_production_materials model_sf_production_process model_sf_production_materials base.group_system base.group_user 1 1 1 0
15 access_sf_production_materials access_sf_production_materials_admin sf_production_materials sf_production_materials_admin model_sf_production_materials base.group_user base.group_system 1 1 1 0
16 access_sf_production_materials_admin access_sf_materials_model sf_production_materials_admin sf_materials_model model_sf_production_materials model_sf_materials_model base.group_system base.group_user 1 1 1 0
17 access_sf_materials_model access_sf_materials_model_admin sf_materials_model sf_materials_model_admin model_sf_materials_model base.group_user base.group_system 1 1 1 0
18 access_sf_materials_model_admin access_sf_supplier_sort sf_materials_model_admin sf_supplier_sort model_sf_materials_model model_sf_supplier_sort base.group_system base.group_user 1 1 1 0
access_sf_processing_technology sf_processing_technology model_sf_processing_technology base.group_user 1 1 1 0
access_sf_processing_technology_admin sf_processing_technology_admin model_sf_processing_technology base.group_system 1 1 1 0
19 access_sf_supplier_sort access_sf_supplier_sort_admin sf_supplier_sort sf_supplier_sort_admin model_sf_supplier_sort base.group_user base.group_system 1 1 1 0
20 access_sf_supplier_sort_admin access_sf_production_process_parameter sf_supplier_sort_admin sf_production_process_parameter model_sf_supplier_sort model_sf_production_process_parameter base.group_system base.group_user 1 1 1 0
21 access_sf_production_process_parameter access_sf_production_process_parameter_group_plan_director sf_production_process_parameter sf_production_process_parameter_group_plan_director model_sf_production_process_parameter base.group_user sf_base.group_plan_director 1 1 0 1 0 0
72 access_sf_cutting_speed_group_plan_dispatch access_sf_cutting_speed_group_plan_director sf_cutting_speed_group_plan_dispatch sf_cutting_speed_group_plan_director model_sf_cutting_speed sf_base.group_plan_dispatch sf_base.group_plan_director 1 0 1 0 1 0
73 access_sf_cutting_speed_group_plan_director access_sf_cutting_speed_group_quality_director sf_cutting_speed_group_plan_director sf_cutting_speed_group_quality_director model_sf_cutting_speed sf_base.group_plan_director sf_base.group_quality_director 1 1 1 0
74 access_sf_feed_per_tooth_group_purchase_director access_sf_cutting_speed_group_quality sf_feed_per_tooth_group_purchase_director sf_cutting_speed_group_quality model_sf_feed_per_tooth model_sf_cutting_speed sf_base.group_purchase_director sf_base.group_quality 1 1 0 1 0
75 access_sf_feed_per_tooth_group_purchase_director sf_feed_per_tooth_group_purchase_director model_sf_feed_per_tooth sf_base.group_purchase_director 1 1 0 0
76 access_sf_feed_per_tooth_group_sale_director sf_feed_per_tooth_group_sale_director model_sf_feed_per_tooth sf_base.group_sale_director 1 1 0 0
77 access_sf_feed_per_tooth_group_sale_director access_sf_feed_per_tooth_group_plan_dispatch sf_feed_per_tooth_group_sale_director sf_feed_per_tooth_group_plan_dispatch model_sf_feed_per_tooth sf_base.group_sale_director sf_base.group_plan_dispatch 1 1 0 0 0
78 access_sf_feed_per_tooth_group_plan_dispatch access_sf_feed_per_tooth_group_plan_director sf_feed_per_tooth_group_plan_dispatch sf_feed_per_tooth_group_plan_director model_sf_feed_per_tooth sf_base.group_plan_dispatch sf_base.group_plan_director 1 0 1 0 0
79 access_sf_feed_per_tooth_group_plan_director access_sf_feed_per_tooth_group_sale_salemanager sf_feed_per_tooth_group_plan_director sf_feed_per_tooth_group_sale_salemanager model_sf_feed_per_tooth sf_base.group_plan_director sf_base.group_sale_salemanager 1 1 0 0 0
80 access_sf_feed_per_tooth_group_sale_salemanager access_sf_feed_per_tooth_group_quality sf_feed_per_tooth_group_sale_salemanager sf_feed_per_tooth_group_quality model_sf_feed_per_tooth sf_base.group_sale_salemanager sf_base.group_quality 1 0 1 0 1 0
81 access_sf_feed_per_tooth access_sf_feed_per_tooth_group_quality_director sf_feed_per_tooth sf_feed_per_tooth_group_quality_director model_sf_feed_per_tooth base.group_user sf_base.group_quality_director 1 1 1 0
82 access_sf_feed_per_tooth sf_feed_per_tooth model_sf_feed_per_tooth base.group_user 1 1 1 0
83 access_sf_feed_per_tooth_admin sf_feed_per_tooth_admin model_sf_feed_per_tooth base.group_system 1 1 1 0
84 access_sf_feed_per_tooth_admin access_sf_ramping_angle sf_feed_per_tooth_admin sf_ramping_angle model_sf_feed_per_tooth model_sf_ramping_angle base.group_system base.group_user 1 1 1 0 1
85 access_sf_ramping_angle access_sf_ramping_angle_admin sf_ramping_angle sf_ramping_angle_admin model_sf_ramping_angle base.group_user base.group_system 1 1 1 1
86 access_sf_ramping_angle_admin access_sf_cutting_width_depth sf_ramping_angle_admin sf_cutting_width_depth model_sf_ramping_angle model_sf_cutting_width_depth base.group_system base.group_user 1 1 1 1
95 access_sf_machine_brand_tags access_sf_machine_control_system sf_machine_brand_tags sf_machine_control_system model_sf_machine_brand_tags model_sf_machine_control_system base.group_user sf_base.group_sf_mrp_user 1 1 0 1 0 1 0
96 access_sf_machine_control_system access_sf_production_process sf_machine_control_system sf_production_process model_sf_machine_control_system model_sf_production_process sf_base.group_sf_mrp_user 1 0 0 0
97 access_sf_processing_order access_sf_production_materials sf_processing_order sf_production_materials model_sf_processing_order model_sf_production_materials sf_base.group_sf_mrp_user 1 0 0 0
access_sf_production_process sf_production_process model_sf_production_process sf_base.group_sf_mrp_user 1 0 0 0
98 access_sf_production_materials access_sf_production_materials_group_plan_director sf_production_materials sf_production_materials_group_plan_director model_sf_production_materials sf_base.group_sf_mrp_user sf_base.group_plan_director 1 0 1 0 0
99 access_sf_production_materials_group_plan_director access_sf_production_materials_group_purchase_director sf_production_materials_group_plan_director sf_production_materials_group_purchase_director model_sf_production_materials sf_base.group_plan_director sf_base.group_purchase_director 1 1 0 0
100 access_sf_production_materials_group_purchase_director access_sf_production_materials_group_sale_director sf_production_materials_group_purchase_director sf_production_materials_group_sale_director model_sf_production_materials sf_base.group_purchase_director sf_base.group_sale_director 1 1 0 0
104 access_sf_materials_model_group_purchase_director access_sf_materials_model_group_sale_director sf_materials_model_group_purchase_director sf_materials_model_group_sale_director model_sf_materials_model sf_base.group_purchase_director sf_base.group_sale_director 1 0 0 0
105 access_sf_materials_model_group_sale_director access_sf_supplier_sort sf_materials_model_group_sale_director sf_supplier_sort model_sf_materials_model model_sf_supplier_sort sf_base.group_sale_director sf_base.group_sf_mrp_user 1 0 0 0
106 access_sf_processing_technology access_sf_production_process_parameter sf_processing_technology sf_production_process_parameter model_sf_processing_technology model_sf_production_process_parameter sf_base.group_sf_mrp_user 1 0 0 0
access_sf_supplier_sort sf_supplier_sort model_sf_supplier_sort sf_base.group_sf_mrp_user 1 0 0 0
107 access_sf_production_process_parameter access_sf_production_process_category sf_production_process_parameter sf_production_process_category model_sf_production_process_parameter model_sf_production_process_category sf_base.group_sf_mrp_user 1 0 0 0
108 access_sf_production_process_category access_sf_machine_tool_category sf_production_process_category sf_machine_tool_category model_sf_production_process_category model_sf_machine_tool_category sf_base.group_sf_mrp_user 1 0 0 0
109 access_sf_machine_tool_category access_sf_cutting_tool_material_group_purchase_director sf_machine_tool_category sf_cutting_tool_material_group_purchase_director model_sf_machine_tool_category model_sf_cutting_tool_material sf_base.group_sf_mrp_user sf_base.group_purchase_director 1 0 0 1 0
142 access_maintenance_equipment_image access_purchase_order_group_purchase maintenance_equipment_image access_purchase_order_group_purchase model_maintenance_equipment_image purchase.model_purchase_order base.group_user sf_base.group_purchase 1 1 1 1 0
143 access_purchase_order_group_purchase access_purchase_order_line_group_purchase access_purchase_order_group_purchase access_purchase_order_line_group_purchase purchase.model_purchase_order purchase.model_purchase_order_line sf_base.group_purchase 1 1 1 0
144 access_purchase_order_group_purchase_director access_spindle_taper_type access_purchase_order_group_purchase_director spindle_taper_type purchase.model_purchase_order model_spindle_taper_type sf_base.group_purchase_director base.group_user 1 1 1 0 1
access_purchase_order_line_group_purchase access_purchase_order_line_group_purchase purchase.model_purchase_order_line sf_base.group_purchase 1 1 1 0
145 access_purchase_order_line_group_purchase_director access_sf_tool_groups_group_plan_dispatch access_purchase_order_line_group_purchase_director sf_tool_groups purchase.model_purchase_order_line model_sf_tool_groups sf_base.group_purchase_director sf_base.group_plan_dispatch 1 1 0 1 0 0
access_spindle_taper_type spindle_taper_type model_spindle_taper_type base.group_user 1 1 1 1
146 access_sf_tool_groups_group_plan_dispatch access_sf_tool_groups_group_sf_tool_user sf_tool_groups model_sf_tool_groups sf_base.group_plan_dispatch sf_base.group_sf_tool_user 1 0 1 0 1 0 1
147 access_sf_tool_groups_group_sf_tool_user access_purchase_order sf_tool_groups purchase.order model_sf_tool_groups purchase.model_purchase_order sf_base.group_sf_tool_user sf_base.group_plan_dispatch 1 1 0 1 0 1 0
148 access_purchase_order access_res_partner purchase.order res.partner purchase.model_purchase_order base.model_res_partner sf_base.group_plan_dispatch 1 0 0 0
158 access_sf_processing_order access_sf_production_materials sf_processing_order sf_production_materials model_sf_processing_order model_sf_production_materials sf_base.group_sf_mrp_user 1 1 0 0
159 access_sf_production_process access_sf_materials_model sf_production_process sf_materials_model model_sf_production_process model_sf_materials_model sf_base.group_sf_mrp_user 1 1 0 0
160 access_sf_production_materials access_sf_supplier_sort sf_production_materials sf_supplier_sort model_sf_production_materials model_sf_supplier_sort sf_base.group_sf_mrp_user 1 1 0 0
access_sf_materials_model sf_materials_model model_sf_materials_model sf_base.group_sf_mrp_user 1 1 0 0
161 access_sf_processing_technology access_sf_production_process_parameter sf_processing_technology sf_production_process_parameter model_sf_processing_technology model_sf_production_process_parameter sf_base.group_sf_mrp_user 1 1 0 0
162 access_sf_supplier_sort access_sf_production_process_category sf_supplier_sort sf_production_process_category model_sf_supplier_sort model_sf_production_process_category sf_base.group_sf_mrp_user 1 1 0 0
163 access_sf_production_process_parameter access_sf_machine_tool_category sf_production_process_parameter sf_machine_tool_category model_sf_production_process_parameter model_sf_machine_tool_category sf_base.group_sf_mrp_user 1 1 0 0
access_sf_production_process_category sf_production_process_category model_sf_production_process_category sf_base.group_sf_mrp_user 1 1 0 0
164 access_sf_machine_tool_category access_sf_cutting_tool_material sf_machine_tool_category sf_cutting_tool_material model_sf_machine_tool_category model_sf_cutting_tool_material sf_base.group_sf_mrp_user 1 1 0 0
165 access_sf_cutting_tool_material access_sf_cutting_tool_type sf_cutting_tool_material sf_cutting_tool_type model_sf_cutting_tool_material model_sf_cutting_tool_type sf_base.group_sf_mrp_user 1 1 0 0
166 access_sf_cutting_tool_type access_sf_functional_cutting_tool sf_cutting_tool_type sf_functional_cutting_tool model_sf_cutting_tool_type model_sf_functional_cutting_tool sf_base.group_sf_mrp_user 1 1 0 0

View File

@@ -173,6 +173,10 @@
<label for="workbench_W" string="宽"/>
<field name="workbench_W" class="o_address_zip" required="1"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="workbench_H" string="高"/>
<field name="workbench_H" class="o_address_zip" required="1"
options="{'format': false}"/>
</div>
<field name="workpiece_load"/>
<label for="machine_tool_L" string="机床尺寸(mm)"/>
@@ -239,15 +243,15 @@
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="b_axis" string="b"
<label for="c_axis" string="c"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
<field name="b_axis" class="o_address_zip"
<field name="c_axis" class="o_address_zip"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="c_axis" string="c"
<label for="b_axis" string="b"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"/>
<field name="c_axis" class="o_address_zip"
<field name="b_axis" class="o_address_zip"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"
options="{'format': false}"/>
</div>

View File

@@ -1,6 +1,60 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<!--表面工艺可选参数-->
<record model="ir.ui.view" id="mrs_production_process_parameter_tree">
<field name="model">sf.production.process.parameter</field>
<field name="arch" type="xml">
<tree string="表面工艺可选参数" delete="0">
<field name="code"/>
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="mrs_production_process_parameter_form">
<field name="model">sf.production.process.parameter</field>
<field name="arch" type="xml">
<form string="表面工艺可选参数" edit="0" delete="0">
<sheet>
<div class="oe_title">
<h1>
<field name="name" required="1" placeholder="名称" />
</h1>
</div>
<group>
<group>
<field name="code" readonly="1"/>
</group>
<group>
<field name="process_id" required="1"/>
</group>
</group>
<notebook>
<page string="适用材料">
<field name="materials_model_ids"></field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="search_mrs_production_process_parameter_view">
<field name="name">search.mrs.production.process.parameter</field>
<field name="model">sf.production.process.parameter</field>
<field name="arch" type="xml">
<search>
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
<field name="name" string="名称" filter_domain="[('name','ilike',self)]"/>
<field name="code" string="编码" filter_domain="[('codeNum','ilike',self)]"/>
<searchpanel class="account_root">
<field name="process_id" icon="fa-filter"/>
</searchpanel>
</search>
</field>
</record>
<!--加工工艺-->
<!-- <record model="ir.ui.view" id="sf_processing_technology_form">-->
<!-- <field name="model">sf.processing.technology</field>-->
@@ -20,26 +74,26 @@
<!-- </form>-->
<!-- </field>-->
<!-- </record>-->
<record model="ir.ui.view" id="sf_processing_technology_tree">
<field name="model">sf.processing.technology</field>
<field name="arch" type="xml">
<tree string="加工工艺" create="0" edit="0" delete="1">
<field name="code"/>
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="search_sf_processing_technology_view">
<field name="name">search.sf.processing.technology.type</field>
<field name="model">sf.processing.technology</field>
<field name="arch" type="xml">
<search>
<field name="name" string="名称搜索" filter_domain="[('name','ilike',self)]"/>
<field name="code" string="编码搜索" filter_domain="[('code','ilike',self)]"/>
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
</search>
</field>
</record>
<!-- <record model="ir.ui.view" id="sf_processing_technology_tree">-->
<!-- <field name="model">sf.processing.technology</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="加工工艺" create="0" edit="0" delete="1">-->
<!-- <field name="code"/>-->
<!-- <field name="name"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<!-- <record model="ir.ui.view" id="search_sf_processing_technology_view">-->
<!-- <field name="name">search.sf.processing.technology.type</field>-->
<!-- <field name="model">sf.processing.technology</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <search>-->
<!-- <field name="name" string="名称搜索" filter_domain="[('name','ilike',self)]"/>-->
<!-- <field name="code" string="编码搜索" filter_domain="[('code','ilike',self)]"/>-->
<!-- <filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>-->
<!-- </search>-->
<!-- </field>-->
<!-- </record>-->
<!--表面工艺类别-->
<record model="ir.ui.view" id="sf_production_process_category_form">
@@ -156,19 +210,7 @@
</form>
</field>
</page>
<page string="工序">
<field name='processing_order_ids' options="{'no_create':True}" widget="one2many">
<tree editable='bottom'>
<field name="sequence" widget="handle"/>
<field name="processing_technology_ids" widget="many2many_tags">
</field>
</tree>
<form>
<field name="processing_technology_ids" widget="many2many">
</field>
</form>
</field>
</page>
</notebook>
</group>
<group>
@@ -350,12 +392,12 @@
<field name="res_model">sf.materials.model</field>
<field name="view_mode">tree,form</field>
</record>
<record id="sf_processing_technology" model="ir.actions.act_window">
<field name="name">加工工艺</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.processing.technology</field>
<field name="view_mode">tree</field>
</record>
<!-- <record id="sf_processing_technology" model="ir.actions.act_window">-->
<!-- <field name="name">加工工艺</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">sf.processing.technology</field>-->
<!-- <field name="view_mode">tree</field>-->
<!-- </record>-->
<record id="sf_production_process_category" model="ir.actions.act_window">
<field name="name">表面工艺类别</field>
@@ -363,6 +405,12 @@
<field name="res_model">sf.production.process.category</field>
<field name="view_mode">tree,form</field>
</record>
<record id="mrs_production_process_parameter_action" model="ir.actions.act_window">
<field name="name">表面工艺可选参数</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.production.process.parameter</field>
<field name="view_mode">tree,form</field>
</record>
</data>

View File

@@ -111,13 +111,19 @@
/>
<menuitem
id="menu_sf_processing_technology"
name="加工工艺"
<menuitem
id="mrs_production_process_parameter_view"
name="表面工艺可选参数"
parent="menu_sf_production_process_1"
sequence="3"
action="sf_processing_technology"/>
sequence="2"
action="mrs_production_process_parameter_action"
/>
<!-- <menuitem-->
<!-- id="menu_sf_processing_technology"-->
<!-- name="加工工艺"-->
<!-- parent="menu_sf_production_process_1"-->
<!-- sequence="3"-->
<!-- action="sf_processing_technology"/>-->
<!-- <menuitem-->
<!-- id="menu_sf_partner_views"-->
@@ -143,5 +149,6 @@
sequence="1"
action="action_sf_machine_control_system"/>
</data>
</odoo>

View File

@@ -1,132 +1,302 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- ================================================刀具基础参数================================================ -->
<record id="view_sf_tool_materials_basic_parameters_integral_tree" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" delete="0" create="0" edit="0" sample="1">
<field name="total_length" />
<field name="blade_number" />
<field name="neck_diameter"/>
<field name="neck_length"/>
<field name="handle_diameter" />
<field name="handle_length" />
<field name="blade_tip_diameter"/>
<field name="blade_tip_working_size"/>
<field name="blade_tip_taper" />
<field name="blade_diameter" />
<field name="blade_length"/>
<field name="blade_helix_angle"/>
<field name="blade_width" />
<field name="blade_width" />
<field name="pitch"/>
<field name="cutting_depth"/>
</tree>
</field>
</record>
<!-- ================================================刀具基础参数================================================ -->
<record id="view_sf_tool_materials_basic_parameters_integral_tree" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" delete="0" create="0" edit="0" sample="1">
<field name="total_length"/>
<field name="blade_number"/>
<field name="neck_diameter"/>
<field name="neck_length"/>
<field name="handle_diameter"/>
<field name="handle_length"/>
<field name="blade_tip_diameter"/>
<field name="blade_tip_working_size"/>
<field name="blade_tip_taper"/>
<field name="blade_diameter"/>
<field name="blade_length"/>
<field name="blade_helix_angle"/>
<field name="blade_width"/>
<field name="blade_width"/>
<field name="pitch"/>
<field name="cutting_depth"/>
</tree>
</field>
</record>
<record id="view_sf_tool_materials_basic_parameters_blade_tree" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" delete="0" create="0">
<field name="total_length" />
<field name="length" />
<field name="thickness"/>
<field name="width"/>
<field name="cutting_blade_length" />
<field name="relief_angle" />
<field name="blade_tip_circular_arc_radius"/>
<field name="inscribed_circle_diameter"/>
<field name="install_aperture_diameter" />
<field name="chip_breaker_groove" />
<field name="blade_teeth_model"/>
<field name="blade_blade_number"/>
<field name="main_included_angle" />
<field name="top_angle" />
<field name="thread_model"/>
<field name="thread_num" />
<field name="blade_tip_height_tolerance" />
<field name="inscribed_circle_tolerance"/>
<field name="thickness_tolerance"/>
</tree>
</field>
</record>
<record id="view_sf_tool_materials_basic_parameters_blade_tree" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" delete="0" create="0">
<field name="total_length"/>
<field name="length"/>
<field name="thickness"/>
<field name="width"/>
<field name="cutting_blade_length"/>
<field name="relief_angle"/>
<field name="blade_tip_circular_arc_radius"/>
<field name="inscribed_circle_diameter"/>
<field name="install_aperture_diameter"/>
<field name="chip_breaker_groove"/>
<field name="blade_teeth_model"/>
<field name="blade_blade_number"/>
<field name="main_included_angle"/>
<field name="top_angle"/>
<field name="thread_model"/>
<field name="thread_num"/>
<field name="blade_tip_height_tolerance"/>
<field name="inscribed_circle_tolerance"/>
<field name="thickness_tolerance"/>
</tree>
</field>
</record>
<record id="view_sf_tool_materials_basic_parameters_cutter_bar_tree" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" delete="0" create="0">
<field name="total_length" />
<field name="height" />
<field name="blade_height"/>
<field name="cut_depth_max"/>
<field name="cutter_arbor_diameter" />
<field name="min_machining_aperture" />
<field name="install_blade_tip_num"/>
<field name="cutting_blade_model"/>
<field name="is_cooling_hole" />
<field name="locating_slot_code" />
<field name="installing_structure"/>
<field name="blade_id"/>
<field name="tool_shim" />
<field name="cotter_pin" />
<field name="pressing_plate"/>
<field name="screw"/>
<field name="spanner" />
</tree>
</field>
</record>
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" delete="0" create="0">
<field name="total_length"/>
<field name="height"/>
<field name="blade_height"/>
<field name="cut_depth_max"/>
<field name="cutter_arbor_diameter"/>
<field name="min_machining_aperture"/>
<field name="install_blade_tip_num"/>
<field name="cutting_blade_model"/>
<field name="is_cooling_hole"/>
<field name="locating_slot_code"/>
<field name="installing_structure"/>
<field name="blade_id"/>
<field name="tool_shim"/>
<field name="cotter_pin"/>
<field name="pressing_plate"/>
<field name="screw"/>
<field name="spanner"/>
</tree>
</field>
</record>
<record id="view_sf_tool_materials_basic_parameters_tree" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数" >
<field name="total_length" />
<field name="blade_number" />
<field name="neck_diameter"/>
<field name="neck_length"/>
<field name="handle_diameter" />
<field name="handle_length" />
<field name="blade_tip_diameter"/>
<field name="blade_tip_working_size"/>
<field name="blade_tip_taper" />
<field name="blade_diameter" />
<field name="blade_length"/>
<field name="blade_helix_angle"/>
<field name="blade_width" />
<field name="blade_width" />
<field name="pitch"/>
<field name="cutting_depth"/>
</tree>
</field>
</record>
<field name="name">sf.tool.materials.basic.parameters.tree</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<tree string="基础参数">
<field name="total_length"/>
<field name="blade_number"/>
<field name="neck_diameter"/>
<field name="neck_length"/>
<field name="handle_diameter"/>
<field name="handle_length"/>
<field name="blade_tip_diameter"/>
<field name="blade_tip_working_size"/>
<field name="blade_tip_taper"/>
<field name="blade_diameter"/>
<field name="blade_length"/>
<field name="blade_helix_angle"/>
<field name="blade_width"/>
<field name="blade_width"/>
<field name="pitch"/>
<field name="cutting_depth"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_sf_tool_materials_basic_parameters_search">
<field name="name">sf.tool.materials.basic.parameters.search</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_sf_tool_materials_basic_parameters_search">
<field name="name">sf.tool.materials.basic.parameters.search</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
</search>
</field>
</record>
<record id="action_sf_tool_materials_basic_parameters" model="ir.actions.act_window">
<field name="name">基础参数</field>
<field name="res_model">sf.tool.materials.basic.parameters</field>
<field name="view_mode">tree</field>
<record id="view_sf_tool_materials_basic_parameters_form" model="ir.ui.view">
<field name="name">sf.tool.materials.basic.parameters.form</field>
<field name="model">sf.tool.materials.basic.parameters</field>
<field name="arch" type="xml">
<form string="规则">
<sheet>
<field name="cutting_tool_type" invisible="0"/>
<field name="standard_library_id" invisible="1"/>
<group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}">
<field name="total_length"/>
<field name="blade_diameter" class="diameter"/>
<field name="blade_length"/>
<field name="blade_number"/>
<field name="neck_length"/>
<field name="neck_diameter" class="diameter"/>
<field name="handle_diameter" class="diameter"/>
<field name="handle_length"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}">
<field name="blade_tip_working_size"/>
<field name="blade_tip_diameter" class="diameter"/>
<field name="blade_tip_taper"/>
<field name="blade_helix_angle"/>
<field name="pitch"/>
<field name="blade_width"/>
<field name="blade_depth"/>
<field name="cut_depth_max"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')]}">
<field name="length"/>
<field name="thickness"/>
<field name="inscribed_circle_diameter" class="diameter"/>
<field name="install_aperture_diameter" class="diameter" string="安装孔直径D1(mm)"/>
<field name="blade_tip_circular_arc_radius" string="刀尖圆弧半径RE(mm)"/>
<field name="cutting_blade_length"/>
<field name="relief_angle"/>
<field name="chip_breaker_groove"/>
<field name="chip_breaker_type_code"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀片')]}">
<field name="blade_teeth_model"/>
<field name="thread_model"/>
<field name="pitch"/>
<field name="thread_num"/>
<field name="cut_depth_max"/>
<field name="blade_blade_number" string="刃数"/>
<field name="blade_width" string="刃宽"/>
<field name="main_included_angle"/>
<field name="top_angle"/>
<field name="blade_tip_height_tolerance"/>
<field name="inscribed_circle_tolerance"/>
<field name="thickness_tolerance"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')]}">
<field name="total_length"/>
<field name="width"/>
<field name="height"/>
<label for="knife_head_length" string="刀头尺寸"/>
<div class="test_model">
<label for="knife_head_length" string="长"/>
<field name="knife_head_length" class="o_address_zip"
options="{'format': false}"/>
<label for="knife_head_width" string="宽"/>
<field name="knife_head_width" class="o_address_zip"
options="{'format': false}"/>
<label for="knife_head_height" string="高"/>
<field name="knife_head_height" class="o_address_zip"
options="{'format': false}"/>
</div>
<field name="blade_diameter" class="diameter"/>
<field name="cutter_arbor_diameter" class="diameter"/>
<field name="is_cooling_hole"/>
<field name="locating_slot_code"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')]}">
<field name="main_included_angle"/>
<field name="relief_angle"/>
<field name="cutting_blade_length"/>
<field name="cut_depth_max"/>
<field name="min_machining_aperture"/>
<field name="install_blade_tip_num"/>
<field name="installing_structure"/>
<field name="blade_id" options="{'no_create': True}"/>
<field name="tool_shim"/>
<field name="cotter_pin"/>
<field name="pressing_plate"/>
<field name="screw"/>
<field name="spanner"/>
</group>
<!-- <field name="context">{'selection_mode': 'single'}</field>-->
<field name="domain">[]</field>
<!-- <field name="multi">false</field>-->
</record>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀盘')]}">
<field name="install_blade_tip_num"/>
<field name="blade_diameter" class="diameter"/>
<field name="cutter_head_diameter" class="diameter"/>
<field name="interface_diameter" class="diameter"/>
<field name="total_length"/>
<field name="blade_length"/>
<field name="cutting_blade_length"/>
<field name="cut_depth_max"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀盘')]}">
<field name="main_included_angle"/>
<field name="installing_structure"/>
<field name="blade_id" options="{'no_create': True}"/>
<field name="screw"/>
<field name="spanner"/>
<field name="is_cooling_hole"/>
<field name="locating_slot_code"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}">
<field name="er_size_model" string="尺寸型号"/>
<label for="min_clamping_diameter" string="夹持直径"/>
<div class="test_model">
<label for="min_clamping_diameter" string="最小"/>
<field name="min_clamping_diameter" class="o_address_zip diameter"
options="{'format': false}"/>
<label for="max_clamping_diameter" string="最大"/>
<field name="max_clamping_diameter" class="o_address_zip diameter"
options="{'format': false}"/>
</div>
<field name="total_length"/>
<field name="outer_diameter" class="diameter"/>
<field name="inner_diameter" class="diameter"/>
<field name="taper"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')]}">
<field name="run_out_accuracy"/>
<field name="top_diameter" class="diameter"/>
<field name="weight"/>
<field name="max_load_capacity"/>
<field name="cooling_jacket"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}">
<field name="taper_shank_model"/>
<field name="total_length"/>
<field name="shank_length"/>
<field name="shank_diameter" class="diameter"/>
<field name="flange_shank_length"/>
<field name="flange_diameter" class="diameter"/>
<field name="diameter_slip_accuracy"/>
<field name="dynamic_balance_class"/>
</group>
<group attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}">
<label for="min_clamping_diameter" string="夹持直径"/>
<div class="test_model">
<label for="min_clamping_diameter" string="最小"/>
<field name="min_clamping_diameter" class="o_address_zip diameter"
options="{'format': false}"/>
<label for="max_clamping_diameter" string="最大"/>
<field name="max_clamping_diameter" class="o_address_zip diameter"
options="{'format': false}"/>
</div>
<field name="max_rotate_speed"/>
<field name="fit_chuck_size"/>
<field name="nut"/>
<field name="spanner"/>
<field name="clamping_mode"/>
<field name="tool_changing_time"/>
<field name="cooling_model"/>
<field name="is_quick_cutting"/>
<field name="is_safe_lock"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_sf_tool_materials_basic_parameters" model="ir.actions.act_window">
<field name="name">基础参数</field>
<field name="res_model">sf.tool.materials.basic.parameters</field>
<field name="view_mode">form</field>
<field name="context">{'default_cutting_tool_type': cutting_tool_type}</field>
<field name="domain">[]</field>
<!-- <field name="multi">false</field>-->
</record>
</data>
</odoo>

View File

@@ -21,6 +21,7 @@
<field name="name">刀具标准库</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.cutting_tool.standard.library</field>
<!-- <field name="context">{'default_cutting_tool_material_id': cutting_tool_material_id}</field>-->
<field name="view_mode">tree,form</field>
</record>
<!-- 功能刀具action -->

View File

@@ -123,19 +123,19 @@
<form string="刀具标准库" delete="0" create="0" edit="0">
<sheet>
<field name="image" widget='image' class="oe_avatar"
options="{'zoom': true, 'preview_image':'image_128'}"/>
options="{'zoom': true, 'preview_image':'image_128'}" required="1"/>
<div class="oe_title">
<h1>
<field name="code"/>
<field name="code" readonly="1"/>
</h1>
</div>
<group>
<group>
<field name="name"/>
<field name="cutting_tool_material_id"/>
<field name="cutting_tool_type"/>
<field name="cutting_tool_type_id"/>
<field name="brand_id"/>
<field name="cutting_tool_material_id" readonly="1"/>
<field name="cutting_tool_type" invisible="1"/>
<field name="cutting_tool_type_id" required="1"/>
<field name="brand_id" required="1"/>
<label for="integral_run_out_accuracy_min" string="端跳精度"
attrs="{'invisible': [('cutting_tool_type', '!=', '整体式刀具')]}"/>
<div class="o_address_format"
@@ -165,8 +165,7 @@
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')]}"/>
</group>
<group>
<field name="material_model_id" placeholder="请选择" string="材质"
attrs="{'required': [('cutting_tool_type', 'not in', ['刀柄', '夹头'])]}"/>
<field name="material_model_id" placeholder="请选择" string="材质"/>
<field name="tool_hardness" string="硬度(hrc)" options="{'format': false}"
widget="integer"/>
<field name="coating_material"/>

View File

@@ -7,7 +7,7 @@
<field name="inherit_id" ref="sf_sale.view_product_template_form_inherit_sf"/>
<field name="arch" type="xml">
<field name="invoice_policy" position="after">
<field name='categ_id' attrs="{'readonly': [('id', '!=', False)]}"/>
<field name='categ_id' class="custom_required" attrs="{'readonly': [('id', '!=', False)]}"/>
<field name='is_bfm' invisible="1"/>
<field name='categ_type' invisible="1"/>
<field name="upload_model_file"
@@ -32,9 +32,14 @@
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
placeholder="请选择"/>
<field name="cutting_tool_model_id" placeholder="请选择" class="custom_required"
options="{'no_create': True}"
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"/>
domain="[('cutting_tool_material_id','=',cutting_tool_material_id)]"
context="{'default_cutting_tool_material_id': cutting_tool_material_id}"
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}">
</field>
<!-- <button name="%(sf_base.action_sf_cutting_tool_standard_library)d" string="新建" type="action"-->
<!-- context="{'default_cutting_tool_material_id': cutting_tool_material_id}"/>-->
<field name="specification_id" placeholder="请选择" class="custom_required"
context="{'default_cutting_tool_type': cutting_tool_type,'default_standard_library_id':cutting_tool_model_id}"
attrs="{'invisible': [('categ_type', '!=', '刀具')],'required': [('categ_type', '=', '刀具')],'readonly': [('id', '!=', False)]}"
domain="[('standard_library_id','=',cutting_tool_model_id)]"/>
<field name="fixture_material_id" attrs="{'invisible': [('categ_type', '!=', '夹具')]}"
@@ -90,7 +95,7 @@
</field>
</record>
<record model="ir.ui.view" id="view_product_template_form_inherit_sf">
<record model="ir.ui.view" id="view_product_template_only_form_inherit_sf">
<field name="name">product.template.only.form.inherit.sf</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
@@ -104,7 +109,7 @@
</field>
</record>
<record model="ir.ui.view" id="view_product_template_only_form_inherit_sf">
<record model="ir.ui.view" id="view_product_template_only_dlm_form_inherit_sf">
<field name="name">product.template.only.form.inherit.sf</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sf_dlm_management.view_sale_product_template_form_inherit_sf"/>
@@ -142,6 +147,10 @@
attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')],'readonly': [('id', '!=', False)]}"/>
<field name="tool_height"
attrs="{'invisible': [('cutting_tool_type', '!=', '刀杆')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_shank_length" string="刀柄长度(mm)"
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_shank_diameter" string="刀柄直径(mm)" class="diameter"
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_flange_diameter"
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_flange_length"
@@ -258,7 +267,7 @@
<span>(mm)&amp;nbsp;</span>
</div>
<field name="cutting_tool_clamping_way"
attrs="{'invisible': [('cutting_tool_type','not in',('刀柄','夹头'))],'readonly': [('id', '!=', False)]}"/>
attrs="{'invisible': [('cutting_tool_type','not in',('刀柄'))],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_top_diameter" class="diameter"
attrs="{'invisible': [('cutting_tool_type','not in',('夹头'))],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_outer_diameter" class="diameter"
@@ -297,7 +306,7 @@
<field name="tool_weight"
attrs='{"invisible": [("cutting_tool_type","not in",("夹头","刀柄"))],"readonly": [("id", "!=", False)]}'/>
<field name="cutting_tool_taper"
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头','刀柄'))],'readonly': [('id', '!=', False)]}"/>
attrs="{'invisible': [('cutting_tool_type', 'not in', ('夹头'))],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_taper_shank_model"
attrs="{'invisible': [('cutting_tool_type', '!=', '刀柄')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_dynamic_balance_class"
@@ -340,9 +349,9 @@
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_er_size_model"
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/>
<field name="cutting_tool_handle_id"
options="{'no_create': True}"
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/>
<!-- <field name="cutting_tool_handle_id"-->
<!-- options="{'no_create': True}"-->
<!-- attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/>-->
<field name="cooling_suit_type_ids"
attrs="{'invisible': [('cutting_tool_type', '!=', '夹头')],'readonly': [('id', '!=', False)]}"/>
<!-- 刀杆 -->

View File

@@ -47,7 +47,7 @@ class SfMaintenanceEquipment(models.Model):
default="", string="轴数")
# 1212新增字段
a_axis = fields.Integer('a轴')
function_type = fields.Selection(
[("ZXJGZX", "钻铣加工中心"), ("CXJGZX", "车削加工中心"), ("FHJGZX", "复合加工中心")],
default="", string="功能类型")
@@ -73,23 +73,23 @@ class SfMaintenanceEquipment(models.Model):
straight_cutting_feed_rate = fields.Char('直线切削进给速度(mm/min)')
rotary_cutting_feed_rate = fields.Char('回转切削进给速度(mm/min)')
X_precision = fields.Float('X轴定位精度(mm)', digits=(12, 3))
X_precision_repeat = fields.Float('X轴重复定位精度(mm)', digits=(12, 3))
Y_precision = fields.Float('Y轴定位精度(mm)', digits=(12, 3))
Y_precision_repeat = fields.Float('Y轴重复定位精度(mm)', digits=(12, 3))
Z_precision = fields.Float('Z轴定位精度(mm)', digits=(12, 3))
Z_precision_repeat = fields.Float('Z轴重复定位精度(mm)', digits=(12, 3))
a_precision = fields.Float('a轴定位精度(mm)', digits=(12, 3))
a_precision_repeat = fields.Float('a轴重复定位精度(mm)', digits=(12, 3))
b_precision = fields.Float('b轴定位精度(mm)', digits=(12, 3))
b_precision_repeat = fields.Float('b轴重复定位精度(mm)', digits=(12, 3))
c_precision = fields.Float('c轴定位精度(mm)', digits=(12, 3))
c_precision_repeat = fields.Float('c轴重复定位精度(mm)', digits=(12, 3))
X_precision = fields.Char('X轴定位精度(mm)')
X_precision_repeat = fields.Char('X轴重复定位精度(mm)')
Y_precision = fields.Char('Y轴定位精度(mm)')
Y_precision_repeat = fields.Char('Y轴重复定位精度(mm)')
Z_precision = fields.Char('Z轴定位精度(mm)')
Z_precision_repeat = fields.Char('Z轴重复定位精度(mm)')
a_precision = fields.Char('a轴定位精度(mm)')
a_precision_repeat = fields.Char('a轴重复定位精度(mm)')
b_precision = fields.Char('b轴定位精度(mm)')
b_precision_repeat = fields.Char('b轴重复定位精度(mm)')
c_precision = fields.Char('c轴定位精度(mm)')
c_precision_repeat = fields.Char('c轴重复定位精度(mm)')
tool_full_diameter_max = fields.Float('刀具满刀最大直径(mm)')
tool_perimeter_diameter_max = fields.Float('刀具邻空刀最大直径(mm)')
T_tool_time = fields.Integer('T-T换刀时间(s)')
C_tool_time = fields.Integer('C-C换刀时间(s)')
T_tool_time = fields.Float('T-T换刀时间(s)', digits=(12, 1))
C_tool_time = fields.Float('C-C换刀时间(s)', digits=(12, 1))
# 待删除字段
precision_min = fields.Float('X轴定位精度min(mm)', digits=(12, 3))
@@ -164,11 +164,12 @@ class SfMaintenanceEquipment(models.Model):
number_of_knife_library = fields.Integer('刀库数量(把)')
rotate_speed = fields.Integer('转速')
# 加工进程
a_axis = fields.Char('a轴')
x_axis = fields.Integer('X轴')
y_axis = fields.Integer('Y轴')
z_axis = fields.Integer('Z轴')
b_axis = fields.Integer('B轴')
c_axis = fields.Integer('C轴')
b_axis = fields.Char('B轴')
c_axis = fields.Char('C轴')
remark = fields.Char('备注')
is_binding = fields.Boolean('是否绑定机床', default=False)
control_system_id = fields.Many2one('sf.machine.control_system',
@@ -191,6 +192,7 @@ class SfMaintenanceEquipment(models.Model):
workpiece_load = fields.Char('工件最大负载(kg)')
workbench_L = fields.Char('工作台长度(mm)')
workbench_W = fields.Char('工作台宽度(mm)')
workbench_H = fields.Char('工作台高度(mm)')
machine_tool_L = fields.Char('机床长度(mm)')
machine_tool_W = fields.Char('机床宽度(mm)')
machine_tool_H = fields.Char('机床高度(mm)')
@@ -518,6 +520,7 @@ class SfMaintenanceEquipment(models.Model):
'lead_screw': item.lead_screw,
'workbench_L': item.workbench_L,
'workbench_W': item.workbench_W,
'workbench_H': item.workbench_H,
'guide_rail': item.guide_rail,
'machine_tool_L': item.machine_tool_L,
'machine_tool_W': item.machine_tool_W,

View File

@@ -1,5 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_equipment_maintenance_standards,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_maintenance.sf_group_equipment_user,1,1,1,0
access_equipment_maintenance_standards_manager,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_maintenance.sf_group_equipment_manager,1,1,1,1
access_equipment_maintenance_standards,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_maintenance_logs_sf_group_equipment_user,sf_maintenance_logs,model_sf_maintenance_logs,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_maintenance_logs_sf_group_equipment_manager,sf_maintenance_logs,model_sf_maintenance_logs,sf_maintenance.sf_group_equipment_manager,1,1,1,0
access_maintenance_equipment_sf_group_equipment_user,maintenance_equipment,model_maintenance_equipment,sf_maintenance.sf_group_equipment_user,1,0,0,0
@@ -9,7 +10,7 @@ access_maintenance_equipment_oee,maintenance_equipment_oee,model_maintenance_equ
access_maintenance_equipment_oee_logs_sf_group_equipment_user,maintenance_equipment_oee_logs,model_maintenance_equipment_oee_logs,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_maintenance_equipment_oee_logs,maintenance_equipment_oee_logs,model_maintenance_equipment_oee_logs,sf_maintenance.sf_group_equipment_manager,1,1,1,0
access_maintenance_standards_sf_group_equipment_user,maintenance_standards,model_maintenance_standards,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_maintenance.sf_group_equipment_manager,1,1,1,0
access_maintenance_standards,maintenance_standards,model_maintenance_standards,sf_maintenance.sf_group_equipment_manager,1,1,1,1
access_maintenance_standard_image_sf_group_equipment_user,maintenance_standard_image,model_maintenance_standard_image,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_maintenance_standard_image,maintenance_standard_image,model_maintenance_standard_image,sf_maintenance.sf_group_equipment_manager,1,1,1,0
access_sf_robot_axis_num_sf_group_equipment_user,sf_robot_axis_num,model_sf_robot_axis_num,sf_maintenance.sf_group_equipment_user,1,0,0,0
@@ -41,16 +42,13 @@ access_sf_machine_brand_tags_sf_group_equipment_user,sf_machine_brand_tags,sf_ba
access_sf_machine_brand_tags_admin_sf_group_equipment_user,sf_machine_brand_tags_admin,sf_base.model_sf_machine_brand_tags,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_machine_control_system_sf_group_equipment_user,sf_machine_control_system,sf_base.model_sf_machine_control_system,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_machine_control_system_admin_sf_group_equipment_user,sf_machine_control_system_admin,sf_base.model_sf_machine_control_system,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_processing_order_sf_group_equipment_user,sf_processing_order,sf_base.model_sf_processing_order,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_processing_order_admin_sf_group_equipment_user,sf_processing_order_admin,sf_base.model_sf_processing_order,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_production_process_sf_group_equipment_user,sf_production_process,sf_base.model_sf_production_process,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_production_process_admin_sf_group_equipment_user,sf_production_process_admin,sf_base.model_sf_production_process,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_production_materials_sf_group_equipment_user,sf_production_materials,sf_base.model_sf_production_materials,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_production_materials_admin_sf_group_equipment_user,sf_production_materials_admin,sf_base.model_sf_production_materials,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_materials_model_sf_group_equipment_user,sf_materials_model,sf_base.model_sf_materials_model,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_materials_model_admin_sf_group_equipment_user,sf_materials_model_admin,sf_base.model_sf_materials_model,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_processing_technology_sf_group_equipment_user,sf_processing_technology,sf_base.model_sf_processing_technology,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_processing_technology_admin_sf_group_equipment_user,sf_processing_technology_admin,sf_base.model_sf_processing_technology,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_supplier_sort_sf_group_equipment_user,sf_supplier_sort,sf_base.model_sf_supplier_sort,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_supplier_sort_admin_sf_group_equipment_user,sf_supplier_sort_admin,sf_base.model_sf_supplier_sort,sf_maintenance.sf_group_equipment_user,1,0,0,0
access_sf_production_process_parameter_sf_group_equipment_user,sf_production_process_parameter,sf_base.model_sf_production_process_parameter,sf_maintenance.sf_group_equipment_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_equipment_maintenance_standards access_equipment_maintenance_standards_manager equipment_maintenance_standards model_equipment_maintenance_standards sf_maintenance.sf_group_equipment_user sf_maintenance.sf_group_equipment_manager 1 1 1 0 1
3 access_equipment_maintenance_standards equipment_maintenance_standards model_equipment_maintenance_standards sf_maintenance.sf_group_equipment_user 1 0 0 0
4 access_sf_maintenance_logs_sf_group_equipment_user sf_maintenance_logs model_sf_maintenance_logs sf_maintenance.sf_group_equipment_user 1 0 0 0
5 access_sf_maintenance_logs_sf_group_equipment_manager sf_maintenance_logs model_sf_maintenance_logs sf_maintenance.sf_group_equipment_manager 1 1 1 0
6 access_maintenance_equipment_sf_group_equipment_user maintenance_equipment model_maintenance_equipment sf_maintenance.sf_group_equipment_user 1 0 0 0
10 access_maintenance_equipment_oee_logs_sf_group_equipment_user maintenance_equipment_oee_logs model_maintenance_equipment_oee_logs sf_maintenance.sf_group_equipment_user 1 0 0 0
11 access_maintenance_equipment_oee_logs maintenance_equipment_oee_logs model_maintenance_equipment_oee_logs sf_maintenance.sf_group_equipment_manager 1 1 1 0
12 access_maintenance_standards_sf_group_equipment_user maintenance_standards model_maintenance_standards sf_maintenance.sf_group_equipment_user 1 0 0 0
13 access_maintenance_standards maintenance_standards model_maintenance_standards sf_maintenance.sf_group_equipment_manager 1 1 1 0 1
14 access_maintenance_standard_image_sf_group_equipment_user maintenance_standard_image model_maintenance_standard_image sf_maintenance.sf_group_equipment_user 1 0 0 0
15 access_maintenance_standard_image maintenance_standard_image model_maintenance_standard_image sf_maintenance.sf_group_equipment_manager 1 1 1 0
16 access_sf_robot_axis_num_sf_group_equipment_user sf_robot_axis_num model_sf_robot_axis_num sf_maintenance.sf_group_equipment_user 1 0 0 0
42 access_sf_production_process_admin_sf_group_equipment_user access_sf_production_materials_admin_sf_group_equipment_user sf_production_process_admin sf_production_materials_admin sf_base.model_sf_production_process sf_base.model_sf_production_materials sf_maintenance.sf_group_equipment_user 1 0 0 0
43 access_sf_production_materials_sf_group_equipment_user access_sf_materials_model_sf_group_equipment_user sf_production_materials sf_materials_model sf_base.model_sf_production_materials sf_base.model_sf_materials_model sf_maintenance.sf_group_equipment_user 1 0 0 0
44 access_sf_production_materials_admin_sf_group_equipment_user access_sf_materials_model_admin_sf_group_equipment_user sf_production_materials_admin sf_materials_model_admin sf_base.model_sf_production_materials sf_base.model_sf_materials_model sf_maintenance.sf_group_equipment_user 1 0 0 0
access_sf_materials_model_sf_group_equipment_user sf_materials_model sf_base.model_sf_materials_model sf_maintenance.sf_group_equipment_user 1 0 0 0
access_sf_materials_model_admin_sf_group_equipment_user sf_materials_model_admin sf_base.model_sf_materials_model sf_maintenance.sf_group_equipment_user 1 0 0 0
45 access_sf_processing_technology_sf_group_equipment_user access_sf_supplier_sort_sf_group_equipment_user sf_processing_technology sf_supplier_sort sf_base.model_sf_processing_technology sf_base.model_sf_supplier_sort sf_maintenance.sf_group_equipment_user 1 0 0 0
46 access_sf_processing_technology_admin_sf_group_equipment_user access_sf_supplier_sort_admin_sf_group_equipment_user sf_processing_technology_admin sf_supplier_sort_admin sf_base.model_sf_processing_technology sf_base.model_sf_supplier_sort sf_maintenance.sf_group_equipment_user 1 0 0 0
47 access_sf_supplier_sort_sf_group_equipment_user access_sf_production_process_parameter_sf_group_equipment_user sf_supplier_sort sf_production_process_parameter sf_base.model_sf_supplier_sort sf_base.model_sf_production_process_parameter sf_maintenance.sf_group_equipment_user 1 0 0 0
48 access_sf_supplier_sort_admin_sf_group_equipment_user access_sf_production_process_parameter_group_plan_director_sf_group_equipment_user sf_supplier_sort_admin sf_production_process_parameter_group_plan_director sf_base.model_sf_supplier_sort sf_base.model_sf_production_process_parameter sf_maintenance.sf_group_equipment_user 1 0 0 0
49 access_sf_production_process_parameter_sf_group_equipment_user access_sf_production_process_parameter_group_purchase_director_sf_group_equipment_user sf_production_process_parameter sf_production_process_parameter_group_purchase_director sf_base.model_sf_production_process_parameter sf_maintenance.sf_group_equipment_user 1 0 0 0
50 access_sf_production_process_parameter_group_plan_director_sf_group_equipment_user access_sf_production_process_parameter_group_sale_director_sf_group_equipment_user sf_production_process_parameter_group_plan_director sf_production_process_parameter_group_sale_director sf_base.model_sf_production_process_parameter sf_maintenance.sf_group_equipment_user 1 0 0 0
51 access_sf_production_process_parameter_group_purchase_director_sf_group_equipment_user access_sf_production_process_parameter_admin_sf_group_equipment_user sf_production_process_parameter_group_purchase_director sf_production_process_parameter_admin sf_base.model_sf_production_process_parameter sf_maintenance.sf_group_equipment_user 1 0 0 0
access_sf_production_process_parameter_group_sale_director_sf_group_equipment_user sf_production_process_parameter_group_sale_director sf_base.model_sf_production_process_parameter sf_maintenance.sf_group_equipment_user 1 0 0 0
52 access_sf_production_process_parameter_admin_sf_group_equipment_user access_sf_production_process_category_sf_group_equipment_user sf_production_process_parameter_admin sf_production_process_category sf_base.model_sf_production_process_parameter sf_base.model_sf_production_process_category sf_maintenance.sf_group_equipment_user 1 0 0 0
53 access_sf_production_process_category_sf_group_equipment_user access_sf_production_process_category_admin_sf_group_equipment_user sf_production_process_category sf_production_process_category_admin sf_base.model_sf_production_process_category sf_maintenance.sf_group_equipment_user 1 0 0 0
54 access_sf_production_process_category_admin_sf_group_equipment_user access_sf_machine_tool_category_sf_group_equipment_user sf_production_process_category_admin sf_machine_tool_category sf_base.model_sf_production_process_category sf_base.model_sf_machine_tool_category sf_maintenance.sf_group_equipment_user 1 0 0 0

View File

@@ -31,7 +31,7 @@
<notebook>
<page string="维保项目">
<field name="maintenance_standards_ids">
<field name="maintenance_standards_ids" delete="1">
<tree editable="bottom">
<field name="name" class="table_custom_required"/>
<field name="fault_type" class="table_custom_required"/>

View File

@@ -85,6 +85,11 @@
<field name="workbench_W" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="workbench_H" string="高"/>
<field name="workbench_H" class="o_address_zip"
attrs="{'required': [('equipment_type', '=', '机床')]}"
options="{'format': false}"/>
</div>
<field name="workpiece_load"/>
<label for="machine_tool_L" string="机床尺寸(mm)"/>
@@ -155,15 +160,15 @@
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="b_axis" string="b"
<label for="c_axis" string="c"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
<field name="b_axis" class="o_address_zip"
<field name="c_axis" class="o_address_zip"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="c_axis" string="c"
<label for="b_axis" string="b"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"/>
<field name="c_axis" class="o_address_zip"
<field name="b_axis" class="o_address_zip"
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"
options="{'format': false}"/>
</div>

View File

@@ -1 +1,2 @@
from . import controllers
from . import workpiece

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
import logging
import json
from odoo import http
from odoo.http import request
class Workpiece(http.Controller):
@http.route('/agvApi/backfeed', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
cors="*")
def backfeed(self, **kw):
"""
agv小车反馈工单(工件)结果
:param kw:
:return:
"""
logging.info('backfeed:%s' % kw)
try:
res = {'Succeed': True}
datas = request.httprequest.data
ret = json.loads(datas)
logging.info('backfeed-ret:%s' % ret)
if 'reqCode' in ret:
if 'method' in ret:
if ret['method'] == 'end':
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
[('production_id.name', '=', ret['reqCode'])])
if workpiece_delivery:
workpiece_delivery.write({'status': '已配送', 'task_completion_time': ret['reqTime']})
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该reqCode暂未查到对应的工件配送记录'}
else:
res = {'Succeed': False, 'ErrorCode': 204, 'Error': '未传method字段'}
else:
res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传reqCode字段'}
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
logging.info('backfeed error:%s' % e)
return json.JSONEncoder().encode(res)

View File

@@ -134,6 +134,7 @@ class ResMrpWorkOrder(models.Model):
workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送')
is_delivery = fields.Boolean('是否配送完成', default=False)
rfid_code = fields.Char('RFID码')
rfid_code_old = fields.Char('RFID码(已解除)')
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
string='生产线', store=True)
production_line_state = fields.Selection(related='production_id.production_line_state',
@@ -235,7 +236,16 @@ class ResMrpWorkOrder(models.Model):
# if not item.workpiece_code:
# raise UserError('请对【同运工件】进行扫描')
else:
item.write({'task_delivery_time': fields.Datetime.now(), 'status': '配送'})
if item.status == '下发':
return {
'name': _('确认'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'sf.workpiece.delivery.wizard',
'target': 'new',
'context': {
'default_workorder_id': self.id,
}}
# 拼接工单对象属性值
def json_workorder_str(self, k, production, route):
@@ -624,6 +634,7 @@ class ResMrpWorkOrder(models.Model):
is_production_id = False
if is_production_id == True and self.name == '解除装夹':
for workorder in self.production_id.workorder_ids:
workorder.rfid_code_old = workorder.rfid_code
workorder.rfid_code = None
for move_raw_id in self.production_id.move_raw_ids:
move_raw_id.quantity_done = move_raw_id.product_uom_qty
@@ -897,7 +908,25 @@ class WorkPieceDelivery(models.Model):
# 配送至avg小车
def _delivery_avg(self):
self.write({'task_delivery_time': fields.Datetime.now(), 'status': '待配送'})
res = {'reqCode': self.production_id.name, 'reqTime': '', 'clientCode': '', 'tokenCode': '',
'taskTyp': 'F01', 'ctnrTyp': '', 'ctnrCode': '', 'wbCode': '', 'positionCodePath': [], 'podCode': '',
'podDir': '', 'materialLot': '', 'priority': '', 'taskCode': '', 'agvCode': '', 'materialLot': '',
'data': ''}
config = self.env['res.config.settings'].get_values()
try:
logging.info('config-AGV请求路径:%s' % config['agv_rcms_url'])
logging.info('config-json:%s' % res)
ret = requests.post((config['agv_rcms_url']), json=res)
ret = ret.json()
logging.info('config-ret:%s' % ret)
if ret['code'] == 0:
if self.production_id.name == ret['reqCode']:
self.write({'task_delivery_time': fields.Datetime.now(), 'status': '待配送'})
else:
raise UserError(ret['message'])
except Exception as e:
logging.info('config-e:%s' % e)
raise UserError("工件配送请求agv失败")
@api.depends('production_id.production_line_id')
def _compute_production_line_id(self):

View File

@@ -6,6 +6,8 @@ import os
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
@@ -68,7 +70,8 @@ class ResProductMo(models.Model):
cutting_tool_shank_length = fields.Float('柄部长度(mm)', digits=(6, 1))
cutting_tool_blade_length = fields.Float('刃部长度(mm)')
cutting_tool_blade_number = fields.Selection(
[('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')], '刃数(个)')
[('0', '0'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')],
string='刃数(个)', default='0')
# 整体式刀具新增字段
cutting_tool_neck_length = fields.Float('颈部长度(mm)', digits=(6, 1))
cutting_tool_neck_diameter = fields.Float('颈部直径(mm)', digits=(6, 1))
@@ -101,6 +104,10 @@ class ResProductMo(models.Model):
compaction_way_id = fields.Many2one('maintenance.equipment.image',
'压紧方式', domain=[('type', '=', '压紧方式')])
@api.onchange('cutting_tool_model_id')
def _onchange_cutting_tool_model_id(self):
self.specification_id = False
@api.onchange('cutting_tool_material_id')
def _onchange_cutting_tool_material_id(self):
for item in self:
@@ -190,20 +197,24 @@ class ResProductMo(models.Model):
self.cutting_tool_blade_number = self.specification_id.blade_number
self.cutting_tool_blade_type = self.cutting_tool_model_id.blade_type
self.cutting_tool_shank_diameter = self.specification_id.handle_diameter
self.cutting_tool_shank_length = self.specification_id.handle_length
self.cutting_tool_neck_length = self.specification_id.neck_length
self.cutting_tool_neck_diameter = self.specification_id.neck_diameter
self.cutting_tool_blade_tip_diameter = self.specification_id.blade_tip_diameter
self.cutting_tool_blade_tip_taper = self.specification_id.blade_tip_taper
self.cutting_tool_blade_helix_angle = self.specification_id.blade_helix_angle
self.cutting_tool_blade_tip_working_size = self.specification_id.blade_tip_working_size
self.cutting_tool_pitch = self.specification_id.pitch
self.cutting_tool_blade_width = self.specification_id.blade_width
self.cutting_tool_blade_depth = self.specification_id.blade_depth
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
self.cutting_tool_cut_depth_max = self.specification_id.cut_depth_max
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
elif self.cutting_tool_type == '夹头':
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
self.cutting_tool_clamping_diameter_min = self.specification_id.max_clamping_diameter
self.cutting_tool_clamping_way = self.specification_id.clamping_mode
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
self.cutting_tool_taper = self.specification_id.taper
self.cutting_tool_top_diameter = self.specification_id.top_diameter
self.cutting_tool_outer_diameter = self.specification_id.outer_diameter
self.cutting_tool_inner_diameter = self.specification_id.inner_diameter
@@ -241,6 +252,7 @@ class ResProductMo(models.Model):
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids
elif self.cutting_tool_type in ('刀盘', '刀杆'):
self.cutting_tool_blade_diameter = self.specification_id.blade_diameter
self.cutting_tool_total_length = self.specification_id.total_length
self.tool_length = self.specification_id.length
self.tool_thickness = self.specification_id.thickness
@@ -271,14 +283,19 @@ class ResProductMo(models.Model):
self.cutting_tool_cutter_head_diameter = self.specification_id.cutter_head_diameter
self.cutting_tool_interface_diameter = self.specification_id.interface_diameter
else:
self.cutting_tool_cutter_arbor_diameter = self.specification_id.cutter_arbor_diameter
self.cutting_tool_knife_head_height = self.specification_id.knife_head_height
self.cutting_tool_knife_head_width = self.specification_id.knife_head_width
self.cutting_tool_knife_head_length = self.specification_id.knife_head_length
self.cutting_tool_tool_shim = self.specification_id.tool_shim
self.cutting_tool_cotter_pin = self.specification_id.cotter_pin
self.cutting_tool_pressing_plate = self.specification_id.pressing_plate
self.cutting_tool_min_machining_aperture = self.specification_id.min_machining_aperture
self.cutting_tool_rear_angle = self.specification_id.relief_angle
elif self.cutting_tool_type == '刀柄':
self.cutting_tool_total_length = self.specification_id.total_length
self.cutting_tool_shank_diameter = self.specification_id.shank_diameter
self.cutting_tool_shank_length = self.specification_id.shank_length
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
self.cutting_tool_change_time = self.specification_id.tool_changing_time
self.cutting_tool_total_length = self.specification_id.total_length
@@ -295,6 +312,8 @@ class ResProductMo(models.Model):
self.cutting_tool_chuck_id = self.specification_id.chuck_id.id
self.cutting_tool_jump_accuracy = self.specification_id.diameter_slip_accuracy
self.cutting_tool_taper_shank_model = self.specification_id.taper_shank_model
self.cutting_tool_cooling_type = self.specification_id.cooling_model
self.cutting_tool_clamping_way = self.specification_id.clamping_mode
self.suitable_machining_method_ids = [(6, 0, [])] if not \
self.cutting_tool_model_id.suitable_machining_method_ids \
else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]
@@ -350,30 +369,30 @@ class ResProductMo(models.Model):
self.cutting_speed_ids = False
self.feed_per_tooth_ids = False
@api.constrains('fit_blade_shape_id', 'suitable_machining_method_ids', 'blade_tip_characteristics_id',
'handle_type_id', 'cutting_direction_ids', 'suitable_coolant_ids', 'compaction_way_id')
def _check_cutting_tool_ability(self):
if self.cutting_tool_type in ['整体式刀具', '刀片', '刀杆', '刀盘']:
if self.cutting_tool_type in ['刀片', '刀杆', '刀盘']:
if not self.fit_blade_shape_id:
raise ValidationError("请选择适配刀片形状")
if self.cutting_tool_type in ['刀杆', '刀盘']:
if not self.compaction_way_id:
raise ValidationError("请选择压紧方式")
if self.cutting_tool_type == '刀片':
if not self.suitable_coolant_ids:
raise ValidationError("请选择适合冷却方式")
elif self.cutting_tool_type == '整体式刀具':
if not self.handle_type_id:
raise ValidationError("请选择柄部类型")
if not self.suitable_coolant_ids:
raise ValidationError("请选择适合冷却方式")
if not self.suitable_machining_method_ids:
raise ValidationError("请选择适合加工方式")
if not self.blade_tip_characteristics_id:
raise ValidationError("请选择刀尖特征")
if not self.cutting_direction_ids:
raise ValidationError("请选择走刀方向")
# @api.constrains('fit_blade_shape_id', 'suitable_machining_method_ids', 'blade_tip_characteristics_id',
# 'handle_type_id', 'cutting_direction_ids', 'suitable_coolant_ids', 'compaction_way_id')
# def _check_cutting_tool_ability(self):
# if self.cutting_tool_type in ['整体式刀具', '刀片', '刀杆', '刀盘']:
# if self.cutting_tool_type in ['刀片', '刀杆', '刀盘']:
# if not self.fit_blade_shape_id:
# raise ValidationError("请选择适配刀片形状")
# if self.cutting_tool_type in ['刀杆', '刀盘']:
# if not self.compaction_way_id:
# raise ValidationError("请选择压紧方式")
# if self.cutting_tool_type == '刀片':
# if not self.suitable_coolant_ids:
# raise ValidationError("请选择适合冷却方式")
# elif self.cutting_tool_type == '整体式刀具':
# if not self.handle_type_id:
# raise ValidationError("请选择柄部类型")
# if not self.suitable_coolant_ids:
# raise ValidationError("请选择适合冷却方式")
# if not self.suitable_machining_method_ids:
# raise ValidationError("请选择适合加工方式")
# if not self.blade_tip_characteristics_id:
# raise ValidationError("请选择刀尖特征")
# if not self.cutting_direction_ids:
# raise ValidationError("请选择走刀方向")
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')

View File

@@ -184,7 +184,9 @@
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
<field name="functional_fixture_type_id"
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
<field name="rfid_code" force_save="1" readonly="1" class="customRFID"/>
<field name="rfid_code" force_save="1" readonly="1" class="customRFID"
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
<script src="/sf_manufacturing/static/src/js/customRFID.js"></script>
</group>
<!-- <group>-->
@@ -540,7 +542,7 @@
<field name="arch" type="xml">
<tree string="工件配送">
<header>
<button name="button_delivery" type="object" string="配送"/>
<button name="button_delivery" type="object" string="配送" class="oe_highlight"/>
</header>
<field name="status" widget="badge"
decoration-success="status == '已配送'"

View File

@@ -6,6 +6,8 @@
<field name="arch" type="xml">
<form>
<field name="delivery_id" invisible="True"/>
<field name="workorder_id" invisible="True"/>
<div>
是否确定配送?
</div>

View File

@@ -10,7 +10,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
_description = '工件配送'
delivery_id = fields.Many2one('sf.workpiece.delivery', string='配送')
workorder_id = fields.Many2one('mrp.workorder', string='工单')
def confirm(self):
self.delivery_id._delivery_avg()
if self.workorder_id:
self.workorder_id.workpiece_delivery_ids._delivery_avg()
else:
self.delivery_id._delivery_avg()

View File

@@ -13,7 +13,9 @@ class ResConfigSettings(models.TransientModel):
token = fields.Char(string='TOKEN', default='b811ac06-3f00-11ed-9aed-0242ac110003')
sf_secret_key = fields.Char(string='密钥', default='wBmxej38OkErKhD6')
sf_url = fields.Char(string='访问地址', default='https://sf.cs.jikimo.com')
agv_url = fields.Char(string='avg访问地址', default='http://IP:PORT/rcms/services/rest')
agv_rcms_url = fields.Char(string='avg_rcms访问地址',
default='http://IP:PORT/rcms/services/rest/hikRpcService/genAgvSchedulingTask')
agv_rcs_url = fields.Char(string='avg_rcs访问地址', default='http://IP:PORT/xxx/agv/agvCallbackService/agvCallback')
model_parser_url = fields.Char('特征识别路径')
ftp_host = fields.Char(string='FTP的ip')
ftp_port = fields.Char(string='FTP端口')
@@ -34,8 +36,8 @@ class ResConfigSettings(models.TransientModel):
_logger.info("同步资源库表面工艺类别完成")
self.env['sf.production.process'].sync_all_production_process()
_logger.info("同步资源库表面工艺完成")
self.env['sf.processing.technology'].sync_all_processing_technology()
_logger.info("同步资源库加工工艺")
# self.env['sf.processing.technology'].sync_all_processing_technology()
# _logger.info("同步资源库加工工艺")
self.env['sf.machine.brand.tags'].sync_all_machine_brand_tags()
_logger.info("同步资源库品牌类别完成")
self.env['sf.machine.brand'].sync_all_machine_brand()
@@ -90,6 +92,8 @@ class ResConfigSettings(models.TransientModel):
token = config.get_param('token', default='')
sf_secret_key = config.get_param('sf_secret_key', default='')
sf_url = config.get_param('sf_url', default='')
agv_rcms_url = config.get_param('agv_rcms_url', default='')
agv_rcs_url = config.get_param('agv_rcs_url', default='')
ftp_host = config.get_param('ftp_host', default='')
ftp_port = config.get_param('ftp_port', default='')
ftp_user = config.get_param('ftp_user', default='')
@@ -99,6 +103,8 @@ class ResConfigSettings(models.TransientModel):
token=token,
sf_secret_key=sf_secret_key,
sf_url=sf_url,
agv_rcms_url=agv_rcms_url,
agv_rcs_url=agv_rcs_url,
ftp_host=ftp_host,
ftp_port=ftp_port,
ftp_user=ftp_user,
@@ -112,6 +118,8 @@ class ResConfigSettings(models.TransientModel):
ir_config.set_param("token", self.token or "")
ir_config.set_param("sf_secret_key", self.sf_secret_key or "")
ir_config.set_param("sf_url", self.sf_url or "")
ir_config.set_param("agv_rcms_url", self.agv_rcms_url or "")
ir_config.set_param("agv_rcs_url", self.agv_rcs_url or "")
ir_config.set_param("ftp_host", self.ftp_host or "")
ir_config.set_param("ftp_port", self.ftp_port or "")
ir_config.set_param("ftp_user", self.ftp_user or "")

View File

@@ -40,10 +40,10 @@ class MrStaticResourceDataSync(models.Model):
logging.info("表面工艺已每日同步成功")
self.env['sf.production.process.parameter'].sync_production_process_parameter_yesterday()
logging.info("表面工艺可选参数已每日同步成功")
self.env['sf.processing.technology'].sync_processing_technology_yesterday()
logging.info("加工工艺已每日同步成功")
self.env['sf.processing.order'].sync_processing_order_yesterday()
logging.info("工序已同步已每日同步成功")
# self.env['sf.processing.technology'].sync_processing_technology_yesterday()
# logging.info("加工工艺已每日同步成功")
# self.env['sf.processing.order'].sync_processing_order_yesterday()
# logging.info("工序已同步已每日同步成功")
self.env['sf.fixture.material'].sync_fixture_material_yesterday()
logging.info("夹具物料已每日同步成功")
self.env['sf.multi_mounting.type'].sync_multi_mounting_type_yesterday()
@@ -367,64 +367,64 @@ class sfProductionProcess(models.Model):
raise ValidationError("表面工艺认证未通过")
class sfProcessingTechnology(models.Model):
_inherit = 'sf.processing.technology'
_description = '加工工艺'
url = '/api/processing_technology/list'
# 定时同步加工工艺
def sync_processing_technology_yesterday(self):
config = self.env['res.config.settings'].get_values()
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
strUrl = config['sf_url'] + self.url
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['processing_technology_yesterday_list']:
if item:
processing_technology = self.search(
[("code", '=', item['process_encode']), ('active', 'in', [True, False])])
if processing_technology:
processing_technology.name = item['name']
processing_technology.remark = item['remark']
processing_technology.active = item['active']
else:
self.create({
"name": item['name'],
"code": item['process_encode'],
"remark": item['remark'],
"active": item['active'],
})
else:
raise ValidationError("加工工艺认证未通过")
# 同步所有加工工艺
def sync_all_processing_technology(self):
config = self.env['res.config.settings'].get_values()
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
strUrl = config['sf_url'] + self.url
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['processing_technology_all_list']:
if item:
processing_technology = self.search(
[("code", '=', item['process_encode']), ('active', 'in', [True, False])])
if not processing_technology:
self.create({
"name": item['name'],
"code": item['process_encode'],
"remark": item['remark'],
"active": item['active'],
})
else:
processing_technology.name = item['name']
processing_technology.remark = item['remark']
processing_technology.active = item['active']
else:
raise ValidationError("加工工艺认证未通过")
# class sfProcessingTechnology(models.Model):
# _inherit = 'sf.processing.technology'
# _description = '加工工艺'
# url = '/api/processing_technology/list'
#
# # 定时同步加工工艺
# def sync_processing_technology_yesterday(self):
# config = self.env['res.config.settings'].get_values()
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
# strUrl = config['sf_url'] + self.url
# r = requests.post(strUrl, json={}, data=None, headers=headers)
# r = r.json()
# result = json.loads(r['result'])
# if result['status'] == 1:
# for item in result['processing_technology_yesterday_list']:
# if item:
# processing_technology = self.search(
# [("code", '=', item['process_encode']), ('active', 'in', [True, False])])
# if processing_technology:
# processing_technology.name = item['name']
# processing_technology.remark = item['remark']
# processing_technology.active = item['active']
# else:
# self.create({
# "name": item['name'],
# "code": item['process_encode'],
# "remark": item['remark'],
# "active": item['active'],
# })
# else:
# raise ValidationError("加工工艺认证未通过")
#
# # 同步所有加工工艺
# def sync_all_processing_technology(self):
# config = self.env['res.config.settings'].get_values()
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
# strUrl = config['sf_url'] + self.url
# r = requests.post(strUrl, json={}, data=None, headers=headers)
# r = r.json()
# result = json.loads(r['result'])
# if result['status'] == 1:
# for item in result['processing_technology_all_list']:
# if item:
# processing_technology = self.search(
# [("code", '=', item['process_encode']), ('active', 'in', [True, False])])
# if not processing_technology:
# self.create({
# "name": item['name'],
# "code": item['process_encode'],
# "remark": item['remark'],
# "active": item['active'],
# })
# else:
# processing_technology.name = item['name']
# processing_technology.remark = item['remark']
# processing_technology.active = item['active']
# else:
# raise ValidationError("加工工艺认证未通过")
class MachineBrandTags(models.Model):
@@ -657,6 +657,7 @@ class MachineToolType(models.Model):
# "lead_screw": item['lead_screw'],
"workbench_L": item['workbench_L'],
"workbench_W": item['workbench_W'],
"workbench_H": item['workbench_H'],
# "guide_rail": item['guide_rail'],
"machine_tool_L": item['machine_tool_L'],
"machine_tool_W": item['machine_tool_W'],
@@ -739,6 +740,7 @@ class MachineToolType(models.Model):
# "lead_screw": item['lead_screw'],
"workbench_L": item['workbench_L'],
"workbench_W": item['workbench_W'],
"workbench_H": item['workbench_H'],
# "guide_rail": item['guide_rail'],
"machine_tool_L": item['machine_tool_L'],
"machine_tool_W": item['machine_tool_W'],
@@ -852,6 +854,7 @@ class MachineToolType(models.Model):
# "lead_screw": item['lead_screw'],
"workbench_L": item['workbench_L'],
"workbench_W": item['workbench_W'],
"workbench_H": item['workbench_H'],
# "guide_rail": item['guide_rail'],
"machine_tool_L": item['machine_tool_L'],
"machine_tool_W": item['machine_tool_W'],
@@ -934,6 +937,7 @@ class MachineToolType(models.Model):
# "lead_screw": item['lead_screw'],
"workbench_L": item['workbench_L'],
"workbench_W": item['workbench_W'],
"workbench_H": item['workbench_H'],
# "guide_rail": item['guide_rail'],
"machine_tool_L": item['machine_tool_L'],
"machine_tool_W": item['machine_tool_W'],
@@ -996,50 +1000,50 @@ class MachineToolType(models.Model):
raise ValidationError("机床型号认证未通过")
class sfProcessingOrder(models.Model):
_inherit = 'sf.processing.order'
_description = '工序'
url = '/api/processing_order/list'
# 定时同步工序
def sync_processing_order_yesterday(self):
config = self.env['res.config.settings'].get_values()
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
strUrl = config['sf_url'] + self.url
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['processing_order_yesterday_list']:
processing_order = self.search([("id", '=', item['id']), ('active', 'in', [True, False])])
if processing_order:
processing_order.sequence = item['sequence']
else:
self.create({
"sequence": item['sequence'],
})
else:
raise ValidationError("工序认证未通过")
# 同步所有工序
def sync_all_processing_order(self):
config = self.env['res.config.settings'].get_values()
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
strUrl = config['sf_url'] + self.url
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['processing_order_all_list']:
processing_order = self.search([("id", '=', item['id']), ('active', 'in', [True, False])])
if not processing_order:
self.create({
"sequence": item['sequence'],
})
else:
processing_order.sequence = item['sequence']
else:
raise ValidationError("工序认证未通过")
# class sfProcessingOrder(models.Model):
# _inherit = 'sf.processing.order'
# _description = '工序'
# url = '/api/processing_order/list'
#
# # 定时同步工序
# def sync_processing_order_yesterday(self):
# config = self.env['res.config.settings'].get_values()
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
# strUrl = config['sf_url'] + self.url
# r = requests.post(strUrl, json={}, data=None, headers=headers)
# r = r.json()
# result = json.loads(r['result'])
# if result['status'] == 1:
# for item in result['processing_order_yesterday_list']:
# processing_order = self.search([("id", '=', item['id']), ('active', 'in', [True, False])])
# if processing_order:
# processing_order.sequence = item['sequence']
# else:
# self.create({
# "sequence": item['sequence'],
# })
# else:
# raise ValidationError("工序认证未通过")
#
# # 同步所有工序
# def sync_all_processing_order(self):
# config = self.env['res.config.settings'].get_values()
# headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
# strUrl = config['sf_url'] + self.url
# r = requests.post(strUrl, json={}, data=None, headers=headers)
# r = r.json()
# result = json.loads(r['result'])
# if result['status'] == 1:
# for item in result['processing_order_all_list']:
# processing_order = self.search([("id", '=', item['id']), ('active', 'in', [True, False])])
# if not processing_order:
# self.create({
# "sequence": item['sequence'],
# })
# else:
# processing_order.sequence = item['sequence']
# else:
# raise ValidationError("工序认证未通过")
class sfProductionProcessParameter(models.Model):

View File

@@ -74,9 +74,26 @@
</div>
</div>
</div>
<div>
<h2>AGV参数配置</h2>
<div class="row mt16 o_settings_container">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<div class="text-muted">
<label for="agv_rcms_url" string="调度系统(cms)访问地址"/>
<field name="agv_rcms_url"/>
</div>
<div class="text-muted">
<label for="agv_rcs_url" string="RCS-2000系统访问地址"/>
<field name="agv_rcs_url"/>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -1,7 +1,7 @@
import datetime
import base64
from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.exceptions import UserError, ValidationError
class ReSaleOrder(models.Model):
@@ -99,7 +99,7 @@ class ReSaleOrder(models.Model):
def check_order_line(self):
for item in self:
if not item.order_line:
raise UserError('请选择【订单行】中的【产品】')
raise ValidationError('请选择【订单行】中的【产品】')
for line in item.order_line:
if not line.product_template_id:
raise UserError('请对【订单行】中的【产品】进行选择')

View File

@@ -243,6 +243,10 @@
<form position="attributes">
<attribute name="delete">False</attribute>
</form>
<field name="name" position="replace">
<field name='name' placeholder="例如:奶酪汉堡" attrs="{'readonly': [('id', '!=', False)]}"/>
</field>
<field name="categ_id" position="replace">
<field name='categ_id' invisible="1"/>
</field>

View File

@@ -2,4 +2,5 @@ from . import base
from . import tool_material_search
from . import maintenance_equipment
from . import mrp_workorder
from . import functional_tool_enroll

View File

@@ -16,7 +16,7 @@ class FunctionalCuttingToolEntity(models.Model):
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
code = fields.Char('编码', related='functional_tool_name_id.code')
rfid = fields.Char('rfid', readonly=True)
name = fields.Char(related='functional_tool_name_id.name')
name = fields.Char('名称')
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True)
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
sf_cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具型号')
@@ -39,24 +39,29 @@ class FunctionalCuttingToolEntity(models.Model):
functional_tool_status = fields.Selection([('正常', '正常'), ('报警', '报警'), ('已拆除', '已拆除')],
string='状态', store=True, default='正常')
current_location_id = fields.Many2one('stock.location', string='当前位置', readonly=True)
current_location = fields.Char('位置', compute='_compute_current_location_id')
current_location = fields.Selection(
[('组装后', '组装后'), ('刀具房', '刀具房'), ('线边刀库', '线边刀库'), ('机内刀库', '机内刀库')],
string='位置', compute='_compute_current_location_id', store=True)
image = fields.Binary('图片', readonly=True)
active = fields.Boolean(string='已归档', default=True)
@api.depends('barcode_id')
@api.depends('barcode_id.quant_ids')
def _compute_current_location_id(self):
for record in self:
if record.barcode_id.quant_ids:
for quant_id in record.barcode_id.quant_ids:
if quant_id.inventory_quantity_auto_apply > 0:
record.sudo().current_location_id = quant_id.location_id
record.sudo().current_location = quant_id.location_id.name
record.current_location_id = quant_id.location_id
if quant_id.location_id.name == '制造前':
record.current_location = '机内刀库'
else:
record.current_location = quant_id.location_id.name
if record.current_location_id:
record.sudo().get_location_num()
else:
record.sudo().current_location_id = False
record.sudo().current_location = False
record.current_location_id = False
record.current_location = False
def get_location_num(self):
"""
@@ -64,22 +69,15 @@ class FunctionalCuttingToolEntity(models.Model):
"""
for obj in self:
if obj.current_location_id:
if obj.current_location_id.name in ['刀具房']:
obj.tool_room_num = 0
obj.line_edge_knife_library_num = 0
obj.machine_knife_library_num = 0
if obj.current_location in ['刀具房']:
obj.tool_room_num = 1
obj.line_edge_knife_library_num = 0
obj.machine_knife_library_num = 0
elif "线边刀库" in obj.current_location_id.name:
obj.tool_room_num = 0
elif "线边刀库" in obj.current_location:
obj.line_edge_knife_library_num = 1
obj.machine_knife_library_num = 0
elif "机内刀库" in obj.current_location_id.name:
obj.tool_room_num = 0
obj.line_edge_knife_library_num = 0
elif "机内刀库" in obj.current_location:
obj.machine_knife_library_num = 1
else:
obj.tool_room_num = 0
obj.line_edge_knife_library_num = 0
obj.machine_knife_library_num = 0
@api.model
def _read_group_mrs_cutting_tool_type_id(self, categories, domain, order):
@@ -131,7 +129,6 @@ class FunctionalCuttingToolEntity(models.Model):
@api.depends('cutting_tool_integral_model_id', 'cutting_tool_blade_model_id')
def _compute_maintenance_equipment_image(self):
for record in self:
print('111')
if record.cutting_tool_integral_model_id:
print(record.cutting_tool_integral_model_id)
record.sudo().suitable_machining_method_ids = record.cutting_tool_integral_model_id.suitable_machining_method_ids.ids
@@ -180,6 +177,17 @@ class FunctionalCuttingToolEntity(models.Model):
('coarse_middle_thin', '=', self.coarse_middle_thin)]
return result
def tool_inventory_displacement_out(self):
"""
机床当前刀库实时信息接口,功能刀具出库
"""
# 获取位置对象
location_inventory_id = self.current_location_id
stock_location_id = self.env['stock.location'].search([('name', '=', '制造前')])
# 创建功能刀具该批次/序列号 库存移动和移动历史
self.barcode_id.create_stock_quant(location_inventory_id, stock_location_id,
self.functional_tool_name_id.id, '机床装刀', self.functional_tool_name_id)
# ==========刀具组接口==========
# def _register_functional_tool_groups(self, obj):
# create_url = '/AutoDeviceApi/ToolGroup'
@@ -222,7 +230,8 @@ class FunctionalToolWarning(models.Model):
group_expand='_read_group_machine_table_name_ids')
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床')
machine_tool_code = fields.Char(string='机台号', related='maintenance_equipment_id.name')
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型')
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型',
related='maintenance_equipment_id.category_id')
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号',
domain="[('equipment_id', '=', maintenance_equipment_id)]")
# 功能刀具信息
@@ -281,14 +290,14 @@ class StockMoveLine(models.Model):
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
group_expand='_read_group_functional_tool_type_id',
related='functional_tool_name_id.functional_tool_type_id')
diameter = fields.Integer(string='刀具直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
code = fields.Char('编码', related='functional_tool_name_id.code')
rfid = fields.Char('rfid', related='functional_tool_name_id.rfid')
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
group_expand='_read_group_functional_tool_type_id')
functional_tool_name = fields.Char('刀具名称')
diameter = fields.Integer(string='刀具直径(mm)')
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
install_tool_time = fields.Datetime("刀具组装时间", default=fields.Datetime.now())
code = fields.Char('编码')
rfid = fields.Char('rfid')
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组')
@api.model
def _read_group_functional_tool_type_id(self, categories, domain, order):
@@ -425,17 +434,17 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
计算刀具房数量、线边刀库数量、机内刀库数量
"""
if tool:
tool.sudo().tool_stock_num = 0
tool.sudo().side_shelf_num = 0
tool.sudo().on_tool_stock_num = 0
tool.tool_stock_num = 0
tool.side_shelf_num = 0
tool.on_tool_stock_num = 0
if tool.sf_functional_cutting_tool_entity_ids:
for cutting_tool in tool.sf_functional_cutting_tool_entity_ids:
if cutting_tool.tool_room_num > 0:
tool.sudo().tool_stock_num += 1
tool.tool_stock_num += 1
elif cutting_tool.line_edge_knife_library_num > 0:
tool.sudo().side_shelf_num += 1
tool.side_shelf_num += 1
elif cutting_tool.machine_knife_library_num > 0:
tool.sudo().on_tool_stock_num += 1
tool.on_tool_stock_num += 1
def create_or_edit_safety_stock(self, vals, sf_functional_cutting_tool_entity_ids):
"""
@@ -462,6 +471,14 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
records = super(RealTimeDistributionOfFunctionalTools, self).create(vals_list)
return records
def write(self, vals):
res = super().write(vals)
for item in self:
if item:
if vals.get('min_stock_num') or vals.get('max_stock_num'):
item.enroll_functional_tool_real_time_distribution()
return res
class MachineTableToolChangingApply(models.Model):
_name = 'sf.machine.table.tool.changing.apply'

View File

@@ -0,0 +1,375 @@
import json
import base64
import requests
from odoo import models, api
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 = '刀具物料序列号注册'
crea_url = "/api/tool_material_stock/create"
def enroll_tool_material_stock(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + self.crea_url
objs_all = self.env['stock.lot'].search([('id', '=', self.id)])
tool_material_stock_list = []
if objs_all:
for item in objs_all:
val = {
'name': item.name,
'tool_material_status': item.tool_material_status,
'location': [] if not item.quant_ids else item.quant_ids[-1].location_id.name,
'tool_material_search_id': item.tool_material_search_id.id,
}
tool_material_stock_list.append(val)
kw = json.dumps(tool_material_stock_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if ret.get('code') == 200:
return '刀具物料序列号注册成功'
else:
raise UserError("没有注册刀具物料序列号信息")
@api.model_create_multi
def create(self, vals_list):
records = super(StockLot, self).create(vals_list)
for record in records:
if record.product_id.categ_id.name == '刀具':
record.tool_material_status = '可用'
record.enroll_tool_material_stock()
return records
class ToolMaterial(models.Model):
_inherit = 'sf.tool.material.search'
_description = '刀具物料注册'
crea_url = '/api/tool_material/create'
def enroll_tool_material(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + self.crea_url
objs_all = self.search([('id', '=', self.id)])
tool_material_list = []
if objs_all:
for item in objs_all:
barcode_names = []
for barcode_id in item.barcode_ids:
if barcode_id.name:
barcode_names.append(barcode_id.name)
val = {
'name': item.name,
'id': item.id,
'cutting_tool_material_code': item.cutting_tool_material_id.code,
'cutting_tool_standard_library_code': item.cutting_tool_standard_library_id.code,
'specification_name': item.specification_id.name,
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
'number': item.number,
'usable_num': item.usable_num,
'have_been_used_num': item.have_been_used_num,
'scrap_num': item.scrap_num,
'barcode_names': str(barcode_names),
'active': item.active
}
tool_material_list.append(val)
kw = json.dumps(tool_material_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if ret.get('code') == 200:
return '刀具物料注册成功'
else:
raise UserError("没有注册刀具物料信息")
@api.model_create_multi
def create(self, vals_list):
records = super(ToolMaterial, self).create(vals_list)
for record in records:
if record:
record.enroll_tool_material()
return records
class FunctionalCuttingToolEntity(models.Model):
_inherit = 'sf.functional.cutting.tool.entity'
_description = '功能刀具列表注册'
crea_url = "/api/functional_tool_entity/create"
# 注册同步功能刀具列表
def enroll_functional_tool_entity(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + self.crea_url
objs_all = self.env['sf.functional.cutting.tool.entity'].search([('id', '=', self.id)])
functional_tool_list = []
if objs_all:
for item in objs_all:
val = {
'id': item.id,
'code': item.code,
'name': item.name,
'rfid': item.rfid,
'tool_groups_name': item.tool_groups_id.name,
'barcode': item.barcode_id.name,
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
'functional_tool_diameter': item.functional_tool_diameter,
'knife_tip_r_angle': item.knife_tip_r_angle,
'coarse_middle_thin': item.coarse_middle_thin,
'new_former': item.new_former,
'tool_loading_length': item.tool_loading_length,
'functional_tool_length': item.functional_tool_length,
'effective_length': item.effective_length,
'max_lifetime_value': item.max_lifetime_value,
'alarm_value': item.alarm_value,
'used_value': item.used_value,
'functional_tool_status': item.functional_tool_status,
'current_location': item.current_location,
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
'whether_standard_knife': item.whether_standard_knife,
'L_D_number': item.L_D_number,
'hiding_length': item.hiding_length,
'cut_time': item.cut_time,
'cut_length': item.cut_length,
'cut_number': item.cut_number,
'cutting_tool_integral_model_id': item.cutting_tool_integral_model_id.tool_material_id,
'cutting_tool_blade_model_id': item.cutting_tool_blade_model_id.tool_material_id,
'cutting_tool_cutterbar_model_id': item.cutting_tool_cutterbar_model_id.tool_material_id,
'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': 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,
}
functional_tool_list.append(val)
kw = json.dumps(functional_tool_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if ret.get('code') == 200:
return "功能刀具注册成功"
else:
raise UserError("没有注册功能刀具信息")
@api.model_create_multi
def create(self, vals_list):
records = super(FunctionalCuttingToolEntity, self).create(vals_list)
for record in records:
if record:
record.enroll_functional_tool_entity()
return records
class FunctionalToolWarning(models.Model):
_inherit = 'sf.functional.tool.warning'
_description = '功能刀具预警注册'
crea_url = "/api/functional_tool_warning/create"
# 注册同步功能刀具预警
def enroll_functional_tool_warning(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + self.crea_url
objs_all = self.env['sf.functional.tool.warning'].search([('id', '=', self.id)])
tool_warning_list = []
if objs_all:
for item in objs_all:
val = {
'id': item.id,
'name': item.name,
'code': item.code,
'rfid': item.rfid,
'tool_groups_name': item.tool_groups_id.name,
'production_line': item.production_line_id.name,
'machine_tool_id': item.maintenance_equipment_id.code,
'machine_tool_code': item.machine_tool_code,
'cutter_spacing_code': item.cutter_spacing_code_id.code,
'functional_tool_name': item.name,
'barcode': item.barcode_id.name,
'mrs_cutting_tool_type_code': item.mrs_cutting_tool_type_id.code,
'diameter': item.diameter,
'knife_tip_r_angle': item.knife_tip_r_angle,
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
'on_board_time': item.on_board_time.strftime('%Y-%m-%d %H:%M:%S'),
'max_lifetime_value': item.max_lifetime_value,
'alarm_value': item.alarm_value,
'used_value': item.used_value,
'functional_tool_status': item.functional_tool_status,
'alarm_time': item.alarm_time.strftime('%Y-%m-%d %H:%M:%S'),
'dispose_user': item.dispose_user,
'dispose_time': item.dispose_time,
'dispose_func': item.dispose_func,
}
tool_warning_list.append(val)
kw = json.dumps(tool_warning_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if ret.get('code') == 200:
return "功能刀具预警注册成功"
else:
raise UserError("没有注册功能刀具预警信息")
@api.model_create_multi
def create(self, vals_list):
records = super(FunctionalToolWarning, self).create(vals_list)
for record in records:
if record:
record.enroll_functional_tool_warning()
return records
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
_description = '功能刀具出入库记录注册'
crea_url = "/api/functional_tool_move/create"
# 注册同步功能刀具出入库记录
def enroll_functional_tool_move(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + self.crea_url
objs_all = self.env['stock.move.line'].search([('id', '=', self.id), ('functional_tool_name_id', '!=', False)])
tool_stock_list = []
if objs_all:
for item in objs_all:
val = {
'id': item.id,
'name': item.functional_tool_name,
'code': item.code,
'rfid': item.rfid,
'tool_groups_name': item.tool_groups_id.name,
'reference': item.reference,
'barcode': item.lot_id.name,
'functional_tool_type_code': item.functional_tool_type_id.code,
'diameter': item.diameter,
'knife_tip_r_angle': item.knife_tip_r_angle,
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
'location_id': item.location_id.name,
'location_dest_name': item.location_dest_id.name,
'date': item.date.strftime('%Y-%m-%d %H:%M:%S'),
'qty_done': item.qty_done,
}
tool_stock_list.append(val)
kw = json.dumps(tool_stock_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if ret.get('code') == 200:
return "功能刀具出入库记录注册成功"
else:
raise UserError("没有注册功能刀具出入库记录信息")
@api.model_create_multi
def create(self, vals_list):
records = super(StockMoveLine, self).create(vals_list)
for record in records:
if record.functional_tool_name_id:
record.enroll_functional_tool_move()
return records
class RealTimeDistributionFunctionalTools(models.Model):
_inherit = 'sf.real.time.distribution.of.functional.tools'
_description = '功能刀具安全库存注册'
crea_url = "/api/functional_tool_distribution/create"
# 注册同步功能刀具预警
def enroll_functional_tool_real_time_distribution(self):
sf_sync_config = self.env['res.config.settings'].get_values()
token = sf_sync_config['token']
sf_secret_key = sf_sync_config['sf_secret_key']
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + self.crea_url
objs_all = self.env['sf.real.time.distribution.of.functional.tools'].search([('id', '=', self.id)])
tool_distribution_list = []
if objs_all:
for item in objs_all:
functional_tool_codes = []
for obj in item.sf_functional_cutting_tool_entity_ids:
functional_tool_codes.append(obj.code)
val = {
'id': item.id,
'name': item.name,
'tool_groups_name': item.tool_groups_id.name,
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
'diameter': item.diameter,
'knife_tip_r_angle': item.knife_tip_r_angle,
'tool_stock_num': item.tool_stock_num,
'side_shelf_num': item.side_shelf_num,
'on_tool_stock_num': item.on_tool_stock_num,
'tool_stock_total': item.tool_stock_total,
'min_stock_num': item.min_stock_num,
'max_stock_num': item.max_stock_num,
'batch_replenishment_num': item.batch_replenishment_num,
'unit': item.unit,
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
'functional_tool_codes': str(functional_tool_codes),
'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)
kw = json.dumps(tool_distribution_list, ensure_ascii=False)
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
ret = r.json()
if ret.get('code') == 200:
return "功能刀具出入库记录注册成功"
else:
raise UserError("没有注册功能刀具出入库记录信息")
@api.model_create_multi
def create(self, vals_list):
records = super(RealTimeDistributionFunctionalTools, self).create(vals_list)
for record in records:
if record:
record.enroll_functional_tool_real_time_distribution()
return records

View File

@@ -79,6 +79,9 @@ class SfMaintenanceEquipment(models.Model):
'functional_tool_name_id': functional_tool_id.id,
'tool_install_time': time
})
if functional_tool_id.current_location_id.name != '制造前':
# 对功能刀具进行出库到生产线
functional_tool_id.tool_inventory_displacement_out()
functional_tool_id.write({
'max_lifetime_value': data['MaxLife'],
'used_value': data['UseLife'],
@@ -95,16 +98,24 @@ class StockLot(models.Model):
tool_material_search_id = fields.Many2one('sf.tool.material.search', string='刀具物料搜索')
tool_material_status = fields.Selection([('可用', '可用'), ('在用', '在用'), ('报废', '报废')], string='状态',
compute='_compute_tool_material_status')
compute='_compute_tool_material_status', store=True)
@api.depends('quant_ids')
def _compute_tool_material_status(self):
for record in self:
if record:
if record.quant_ids[-1].location_id.name == '刀具组装位置':
record.tool_material_status = '在用'
else:
record.tool_material_status = '可用'
if record.quant_ids:
if record.quant_ids[-1].location_id.name == '刀具组装位置':
record.tool_material_status = '在用'
else:
record.tool_material_status = '可用'
@api.onchange('tool_material_status')
def _onchange_tool_material_status(self):
for obj in self:
if obj:
# 注册刀具物料状态到cloud平台
obj.enroll_tool_material_stock()
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
@@ -133,9 +144,7 @@ class StockLot(models.Model):
for record in records:
if record.product_id.categ_id.name == '刀具':
tool_material_search = self.env['sf.tool.material.search'].sudo().search(
[('cutting_tool_material_id', '=', record.product_id.cutting_tool_material_id.id),
('cutting_tool_standard_library_id', '=', record.product_id.cutting_tool_model_id.id),
('specification_id', '=', record.product_id.specification_id.id)])
[('id', '=', record.product_id.tool_material_id)])
if tool_material_search:
record.tool_material_search_id = tool_material_search
return records
@@ -144,12 +153,15 @@ class StockLot(models.Model):
class ProductProduct(models.Model):
_inherit = 'product.product'
tool_material_id = fields.Char('刀具物料搜索模型ID')
@api.model_create_multi
def create(self, vals_list):
records = super(ProductProduct, self).create(vals_list)
for record in records:
if record.categ_id.name == '刀具':
self.env['sf.tool.material.search'].sudo().create({
tool_material = self.env['sf.tool.material.search'].sudo().create({
'product_id': record.id
})
record.tool_material_id = tool_material.id
return records

View File

@@ -311,6 +311,7 @@ class ToolMaterial(models.Model):
product_id = fields.Many2one('product.product', string='刀具物料产品')
name = fields.Char('名称', related='product_id.name')
code = fields.Char('编码')
cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
related='product_id.cutting_tool_material_id',
store=True,

View File

@@ -40,6 +40,8 @@
<field name="arch" type="xml">
<form create="0" edit="0" delete="0">
<header>
<!-- <button name="enroll_functional_tool_entity" string="功能刀具注册" type="object"-->
<!-- class="btn-primary"/>-->
<field name="functional_tool_status" widget="statusbar" statusbar_visible="正常,报警,已拆除"/>
</header>
<sheet>
@@ -152,8 +154,8 @@
<field name="max_lifetime_value"/>
<field name="alarm_value"/>
<field name="used_value"/>
<field name="current_location_id"/>
<field name="current_location" invisible="1"/>
<field name="current_location_id" invisible="1"/>
<field name="current_location"/>
</group>
<group>
<field name="tool_loading_length"/>
@@ -203,7 +205,7 @@
<filter string="已归档" name="inactive" domain="[('active', '=', False)]"/>
<searchpanel>
<field name="sf_cutting_tool_type_id" icon="fa-building" enable_counters="1"/>
<field name="current_location_id" icon="fa-building" enable_counters="1"/>
<field name="current_location" icon="fa-building" enable_counters="1"/>
<field name="functional_tool_status" icon="fa-building" enable_counters="1"/>
</searchpanel>
</search>
@@ -243,6 +245,8 @@
<field name="dispose_user"/>
<field name="dispose_time"/>
<field name="dispose_func"/>
<!-- <button name="enroll_functional_tool_warning" string="刀具预警注册" type="object"-->
<!-- class="btn-primary"/>-->
</tree>
</field>
</record>
@@ -318,6 +322,10 @@
<field name="model">sf.real.time.distribution.of.functional.tools</field>
<field name="arch" type="xml">
<form>
<!-- <header>-->
<!-- <button name="enroll_functional_tool_real_time_distribution" string="安全库存注册" type="object"-->
<!-- class="btn-primary"/>-->
<!-- </header>-->
<sheet>
<div class="oe_title">
<h1>
@@ -454,6 +462,7 @@
<field name="date"/>
<field name="qty_done" string="数量"/>
<field name="functional_tool_type_id" invisible="True"/>
<!-- <button name="enroll_functional_tool_move" string="安全库存注册" type="object" class="btn-primary"/>-->
</tree>
</field>
</record>

View File

@@ -22,6 +22,9 @@
<field name="model">sf.tool.material.search</field>
<field name="arch" type="xml">
<form string="刀具物料查询" create="0">
<header>
<button string="刀具物料注册" name="enroll_tool_material" type="object" class="btn-primary"/>
</header>
<sheet>
<div class="oe_title">
<h1>
@@ -59,6 +62,7 @@
<tree>
<field name="name"/>
<field name="tool_material_status"/>
<button name="enroll_tool_material_stock" string="序列号注册" type="object" class="btn-primary"/>
</tree>
</field>
</page>

View File

@@ -300,29 +300,32 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
智能工厂组装单处扫码绑定刀具物料')
"""
for record in self:
records = record.env['stock.lot'].search([('name', '=', barcode)])
if not records:
raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
for record_stock_lot in records:
if record_stock_lot.quant_ids[-1].location_id.name == '刀具组装位置':
raise ValidationError('刀具物料已使用,请重新选择!!!')
elif record_stock_lot.quant_ids[-1].location_id.name not in '刀具':
raise ValidationError('刀具物料未入库,请重新选择!!!')
tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
if tool_material_name == '整体式刀具':
record.integral_code_id = record_stock_lot.id
elif tool_material_name == '刀片':
record.blade_code_id = record_stock_lot.id
elif tool_material_name == '刀杆':
record.bar_code_id = record_stock_lot.id
elif tool_material_name == '刀盘':
record.pad_code_id = record_stock_lot.id
elif tool_material_name == '刀柄':
record.handle_code_id = record_stock_lot.id
elif tool_material_name == '夹头':
record.chuck_code_id = record_stock_lot.id
else:
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
if 'DJWL' in barcode:
records = record.env['stock.lot'].search([('name', '=', barcode)])
if not records:
raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
for record_stock_lot in records:
if record_stock_lot.quant_ids[-1].location_id.name == '刀具组装位置':
raise ValidationError('刀具物料已使用,请重新选择!!!')
elif record_stock_lot.quant_ids[-1].location_id.name not in '刀具':
raise ValidationError('该刀具物料未入库,请重新选择!!!')
tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
if tool_material_name == '整体式刀具':
record.integral_code_id = record_stock_lot.id
elif tool_material_name == '刀片':
record.blade_code_id = record_stock_lot.id
elif tool_material_name == '刀杆':
record.bar_code_id = record_stock_lot.id
elif tool_material_name == '刀盘':
record.pad_code_id = record_stock_lot.id
elif tool_material_name == '刀柄':
record.handle_code_id = record_stock_lot.id
elif tool_material_name == '夹头':
record.chuck_code_id = record_stock_lot.id
else:
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
else:
record.rfid = barcode
# 组装功能刀具参数信息
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
@@ -478,9 +481,9 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
# 创建组装入库单
# 创建功能刀具批次/序列号记录
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly)
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly, self)
# 创建刀具组装入库单
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly)
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly, self)
# 刀具物料出库
if self.integral_code_id:
product_id.tool_material_stock_moves(self.integral_code_id)
@@ -580,6 +583,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
return {
'barcode_id': stock_lot.id,
'code': self.tool_code,
'name': self.after_assembly_functional_tool_name,
'rfid': self.rfid,
'tool_groups_id': self.tool_groups_id.id,
'functional_tool_name_id': functional_tool_assembly_id.id,
@@ -615,7 +619,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
class StockPicking(models.Model):
_inherit = 'stock.picking'
def create_stocking_picking(self, stock_lot, functional_tool_assembly):
def create_stocking_picking(self, stock_lot, functional_tool_assembly, obj):
"""
创建刀具组装入库单
"""
@@ -636,7 +640,14 @@ class StockPicking(models.Model):
'location_dest_id': picking_id.location_dest_id.id,
'lot_id': stock_lot.id,
'qty_done': 1,
'functional_tool_name_id': functional_tool_assembly.id
'functional_tool_name_id': functional_tool_assembly.id,
'functional_tool_type_id': obj.functional_tool_type_id.id,
'diameter': obj.after_assembly_functional_tool_diameter,
'knife_tip_r_angle': obj.after_assembly_knife_tip_r_angle,
'code': obj.tool_code,
'rfid': obj.rfid,
'functional_tool_name': obj.after_assembly_functional_tool_name,
'tool_groups_id': obj.tool_groups_id.id
})
# 将刀具组装入库单的状态更改为就绪
picking_id.action_confirm()
@@ -661,7 +672,7 @@ class StockPicking(models.Model):
class ProductProduct(models.Model):
_inherit = 'product.product'
def create_assemble_warehouse_receipt(self, tool_assembly_order_id, functional_tool_assembly):
def create_assemble_warehouse_receipt(self, tool_assembly_order_id, functional_tool_assembly, obj):
"""
创建功能刀具批次/序列号记录
"""
@@ -676,7 +687,8 @@ class ProductProduct(models.Model):
location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
# 创建功能刀具该批次/序列号 库存移动和移动历史
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id)
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
'功能刀具组装', obj)
return stock_lot
@@ -710,20 +722,20 @@ class ProductProduct(models.Model):
location_inventory_id = tool_material.quant_ids.location_id[-1]
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
# 创建功能刀具该批次/序列号 库存移动和移动历史
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None)
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装', False)
class StockLot(models.Model):
_inherit = 'stock.lot'
def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id):
def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id, name, obj):
"""
对功能刀具组装过程的功能刀具和刀具物料进行库存移动,以及创建移动历史
"""
# 创建库存移动记录
stock_move_id = self.env['stock.move'].create({
'name': '功能刀具组装',
stock_move_id = self.env['stock.move'].sudo().create({
'name': name,
'product_id': self.product_id.id,
'location_id': location_inventory_id.id,
'location_dest_id': stock_location_id.id,
@@ -732,13 +744,32 @@ class StockLot(models.Model):
})
# 创建移动历史记录
stock_move_line_id = self.env['stock.move.line'].create({
stock_move_line_id = self.env['stock.move.line'].sudo().create({
'product_id': self.product_id.id,
'functional_tool_name_id': functional_tool_assembly_id,
'lot_id': self.id,
'move_id': stock_move_id.id,
'install_tool_time': fields.Datetime.now(),
'qty_done': 1.0,
'state': 'done'
'state': 'done',
'functional_tool_type_id': False if not obj else obj.functional_tool_type_id.id,
'diameter': None if not obj else obj.after_assembly_functional_tool_diameter,
'knife_tip_r_angle': None if not obj else obj.after_assembly_knife_tip_r_angle,
'code': '' if not obj else obj.tool_code,
'rfid': '' if not obj else obj.rfid,
'functional_tool_name': '' if not obj else obj.after_assembly_functional_tool_name,
'tool_groups_id': False if not obj else obj.tool_groups_id.id
})
return stock_move_id, stock_move_line_id
class StockQuant(models.Model):
_inherit = 'stock.quant'
@api.model_create_multi
def create(self, vals_list):
records = super(StockQuant, self).create(vals_list)
for record in records:
if record.lot_id.product_id.categ_id.name == '刀具':
record.lot_id.enroll_tool_material_stock()
return records

View File

@@ -10,6 +10,7 @@ class Common(models.Model):
def print_zpl(self, zpl_str):
# WinDll_path = "D://桌面//pythonZPL//tsc_python_sdk_example//TSC_Python_SDK_Example//tsc_sample//libs//TSCLIB.dll"
WinDll_path = "D://jikimo-dev//jikimo//SF//zpl_print//libs//TSCLIB.dll"
# WinDll_path = "D://桌面//pythonZPL//zebra_zpl//libs//TSCLIB.dll"
try:
tsclibrary = ctypes.WinDLL(WinDll_path)
tsclibrary.openportW("USB")