From e693bd97f37a410cfc7ef10f630c6f262a69c210 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 4 Jul 2023 17:32:14 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BB=B6?= =?UTF-8?q?=E7=BB=84=E8=A3=85=EF=BC=8C=E5=B7=A5=E4=BB=B6=E5=87=BA=E5=BA=93?= =?UTF-8?q?=EF=BC=8C=E7=BB=84=E8=A3=85=E5=B7=A5=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/models/__init__.py | 1 + sf_base/models/workpiece_clamping.py | 110 ++++++++++++++++++++++ sf_base/views/menu_fixture_view.xml | 7 ++ sf_base/views/workpiece_clamping_view.xml | 71 ++++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 sf_base/models/workpiece_clamping.py create mode 100644 sf_base/views/workpiece_clamping_view.xml diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index cc906ab8..6811dd70 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -3,6 +3,7 @@ from . import common from . import tool_base_new from . import fixture from . import functional_fixture +from . import workpiece_clamping diff --git a/sf_base/models/workpiece_clamping.py b/sf_base/models/workpiece_clamping.py new file mode 100644 index 00000000..2f90da48 --- /dev/null +++ b/sf_base/models/workpiece_clamping.py @@ -0,0 +1,110 @@ +from odoo import models, fields, api + + +class WorkpieceClamping(models.Model): + _name = 'sf.workpiece.clamping' + _description = "工件装夹" + # 以下为坯料(工件)申请信息 + apply_code = fields.Char(string="申请坯料编码", size=25, required=True) + apply_name = fields.Char(string="申请坯料名称", size=25, required=True) + material_id = fields.Many2one('sf.production.materials', string="坯料材料", required=True) + apply_width = fields.Float(string="申请宽度", required=True) + apply_length = fields.Float(string="申请长度", required=True) + apply_height = fields.Float(string="申请高度", required=True) + apply_weight = fields.Float(string="申请重量", required=True) + apply_diameter = fields.Float(string="申请直径", required=True) + surface_accuracy = fields.Char(string="表面精度", required=True) + # 以下为坯料(工件)装夹信息 + chuck_name = fields.Char(string="卡盘名称", required=True) + chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌", required=True) + chuck_type_id = fields.Char(string="卡盘类型", required=True) + chuck_model_id = fields.Char(string="卡盘型号", required=True) + tray_name = fields.Char(string="托盘名称", required=True) + tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌", required=True) + tray_type_id = fields.Char(string="托盘类型", required=True) + tray_model_id = fields.Char(string="托盘型号", required=True) + real_code = fields.Char(string="真实坯料编码", size=25, required=True) + real_name = fields.Char(string="真实坯料名称", size=25, required=True) + real_width = fields.Float(string="真实宽度", required=True) + real_length = fields.Float(string="真实长度", required=True) + real_height = fields.Float(string="真实高度", required=True) + real_diameter = fields.Float(string="真实直径", required=True) + # 以下为坯料(工件)预调信息 + # hole_site = fields.Char(string="孔位", required=True) + # curve = fields.Char(string="曲线", required=True) + # straight_line = fields.Char(string="直线", required=True) + # x_axis = fields.Float(string="X轴", required=True) + # y_axis = fields.Float(string="Y轴", required=True) + # z_axis = fields.Float(string="Z轴", required=True) + # tool_radius = fields.Float(string="刀具半径", required=True) + # tool_length = fields.Float(string="刀具长度", required=True) + # tool_offset_point = fields.Float(string="刀具偏移点", required=True) + # tool_compensation_value = fields.Float(string="刀具补偿值", required=True) + # cutting_spindle_speed = fields.Float(string="切削主轴转速", required=True) + # cutting_feed_rate = fields.Float(string="切削进给速度", required=True) + # depth_of_cutting = fields.Float(string="切削深度", required=True) + # cutting_direction = fields.Char(string="切削方向", required=True) + # cnc_program_information = fields.Char(string="CNC程序信息", required=True) + + +class StockRemoval(models.Model): + _name = 'sf.stock.removal' + _description = "出库" + + code = fields.Char(string="功能夹具编码", size=25, required=True) + name = fields.Char(string="功能夹具名称", size=25, required=True) + type = fields.Char(string="功能夹具类型", required=True) + production_line = fields.Char(string="生产线", required=True) + machine_tool = fields.Many2one('sf.machine_tool', string="机床", required=True) + + +class Assemble(models.Model): + _name = 'sf.assemble' + _description = "组合装夹" + + functional_fixture_code = fields.Char(string="功能夹具编码", size=25, required=True) + functional_fixture_name = fields.Char(string="功能夹具名称", size=25, required=True) + functional_fixture_type = fields.Char(string="功能夹具类型", required=True) + chuck_name = fields.Char(string="卡盘名称", required=True) + chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌", required=True) + chuck_type_id = fields.Char(string="卡盘类型", required=True) + chuck_model_id = fields.Char(string="卡盘型号", required=True) + tray_name = fields.Char(string="托盘名称", required=True) + tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌", required=True) + tray_type_id = fields.Char(string="托盘类型", required=True) + tray_model_id = fields.Char(string="托盘型号", required=True) + real_code = fields.Char(string="真实坯料编码", size=25, required=True) + real_name = fields.Char(string="真实坯料名称", size=25, required=True) + total_wight = fields.Float(string="总重量", required=True) + maximum_carrying_weight = fields.Char(string="最大承载重量[kg]") + maximum_clamping_force = fields.Char(string="最大夹持力[n]") + production_line = fields.Char(string="生产线", required=True) + # 以下为智能工厂工单带过来的机床信息 + machine_tool = fields.Many2one('sf.machine_tool', string="机床名称", required=True) + machine_tool_code = fields.Char(string="机床编码", required=True) + machine_tool_startime = fields.Date(string="机床开始加工时间", required=True) + # 以下为智能工厂工单带过来的信息 + apply_staff = fields.Char(string="申请人", required=True) + apply_time = fields.Date(string="申请时间", required=True) + apply_reason = fields.Char(string="申请原因", required=True) + # 以下为装夹的信息 + preset_staff = fields.Char(string="预调名称", required=True) + preset_time = fields.Date(string="预调时间", required=True) + material_taker = fields.Char(string="领料人", required=True) + material_removal_time = fields.Date(string="领料出库时间", required=True) + + + + + + + + + + + + + + + + diff --git a/sf_base/views/menu_fixture_view.xml b/sf_base/views/menu_fixture_view.xml index 7186fe35..883b6599 100644 --- a/sf_base/views/menu_fixture_view.xml +++ b/sf_base/views/menu_fixture_view.xml @@ -38,4 +38,11 @@ name="功能夹具" sequence="4" /> + + \ No newline at end of file diff --git a/sf_base/views/workpiece_clamping_view.xml b/sf_base/views/workpiece_clamping_view.xml new file mode 100644 index 00000000..9b67a3a0 --- /dev/null +++ b/sf_base/views/workpiece_clamping_view.xml @@ -0,0 +1,71 @@ + + + + + + + search.sf.workpiece.clamping + sf.workpiece.clamping + + + + + + + + + + + 工件夹具 + sf.workpiece.clamping + + + + + + + + + + + + + + + + + + + + 工件夹具 + sf.workpiece.clamping + +
+ + + + + + + + + + + + + +
+
+
+ + + 工件夹具 + ir.actions.act_window + sf.workpiece.clamping + tree,form + + +
\ No newline at end of file From 66cd682f7d596e3a10b5e965f32732aff35f5294 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 5 Jul 2023 17:34:43 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E4=BB=B6?= =?UTF-8?q?=E8=A3=85=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/__init__.py | 2 + sf_base/__manifest__.py | 3 + sf_base/models/__init__.py | 2 +- sf_base/models/assemble.py | 54 ++++++ sf_base/models/workpiece_clamping.py | 110 ------------ sf_base/security/ir.model.access.csv | 9 +- sf_base/views/assemble_view.xml | 161 ++++++++++++++++++ sf_base/views/menu_fixture_view.xml | 4 +- sf_base/views/workpiece_clamping_view.xml | 71 -------- sf_base/wizard/__init__.py | 4 + sf_base/wizard/stock_removal_wizard.py | 21 +++ sf_base/wizard/stock_removal_wizard_view.xml | 34 ++++ sf_base/wizard/workpiece_clamping_wizard.py | 56 ++++++ .../wizard/workpiece_clamping_wizard_view.xml | 83 +++++++++ 14 files changed, 426 insertions(+), 188 deletions(-) create mode 100644 sf_base/models/assemble.py delete mode 100644 sf_base/models/workpiece_clamping.py create mode 100644 sf_base/views/assemble_view.xml delete mode 100644 sf_base/views/workpiece_clamping_view.xml create mode 100644 sf_base/wizard/__init__.py create mode 100644 sf_base/wizard/stock_removal_wizard.py create mode 100644 sf_base/wizard/stock_removal_wizard_view.xml create mode 100644 sf_base/wizard/workpiece_clamping_wizard.py create mode 100644 sf_base/wizard/workpiece_clamping_wizard_view.xml diff --git a/sf_base/__init__.py b/sf_base/__init__.py index 60182bcc..070e5f4e 100644 --- a/sf_base/__init__.py +++ b/sf_base/__init__.py @@ -1,2 +1,4 @@ from . import models from . import commons +from . import wizard + diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index d6f8a88a..85182220 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -18,6 +18,9 @@ 'views/common_view.xml', 'views/fixture_view.xml', 'views/functional_fixture_view.xml', + 'wizard/workpiece_clamping_wizard_view.xml', + 'wizard/stock_removal_wizard_view.xml', + 'views/assemble_view.xml', 'views/menu_view.xml', "views/tool_views.xml", "views/tool_menu.xml", diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index 6811dd70..f81781ec 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -3,7 +3,7 @@ from . import common from . import tool_base_new from . import fixture from . import functional_fixture -from . import workpiece_clamping +from . import assemble diff --git a/sf_base/models/assemble.py b/sf_base/models/assemble.py new file mode 100644 index 00000000..902bedc6 --- /dev/null +++ b/sf_base/models/assemble.py @@ -0,0 +1,54 @@ +from odoo import models, fields, api + + +class Assemble(models.Model): + _name = 'sf.assemble' + _description = "组合装夹" + + functional_fixture_code = fields.Char(string="功能夹具编码", size=25, required=True) + functional_fixture_name = fields.Char(string="功能夹具名称", size=25, required=True) + functional_fixture_type = fields.Char(string="功能夹具类型", required=True) + chuck_name = fields.Char(string="卡盘名称", required=True) + chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌", required=True) + chuck_type_id = fields.Char(string="卡盘类型", required=True) + chuck_model_id = fields.Char(string="卡盘型号", required=True) + tray_name = fields.Char(string="托盘名称", required=True) + tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌", required=True) + tray_type_id = fields.Char(string="托盘类型", required=True) + tray_model_id = fields.Char(string="托盘型号", required=True) + real_code = fields.Char(string="真实坯料编码", size=25, required=True) + real_name = fields.Char(string="真实坯料名称", size=25, required=True) + total_wight = fields.Float(string="总重量", required=True) + maximum_carrying_weight = fields.Char(string="最大承载重量[kg]") + maximum_clamping_force = fields.Char(string="最大夹持力[n]") + production_line = fields.Char(string="生产线", required=True) + # 以下为智能工厂工单带过来的机床信息 + machine_tool = fields.Many2one('sf.machine_tool', string="机床名称", required=True) + machine_tool_startime = fields.Date(string="机床开始加工时间", required=True) + # 以下为智能工厂工单带过来的信息 + apply_staff = fields.Char(string="申请人", required=True) + machine_tool_code = fields.Char(string="机床编码", required=True) + apply_time = fields.Date(string="申请时间", required=True) + apply_reason = fields.Char(string="申请原因", required=True) + # 以下为装夹的信息 + preset_staff = fields.Char(string="预调名称", required=True) + preset_time = fields.Date(string="预调时间", required=True) + material_taker = fields.Char(string="领料人", required=True) + material_removal_time = fields.Date(string="领料出库时间", required=True) + remark = fields.Char(string="备注", required=True) + + + + + + + + + + + + + + + + diff --git a/sf_base/models/workpiece_clamping.py b/sf_base/models/workpiece_clamping.py deleted file mode 100644 index 2f90da48..00000000 --- a/sf_base/models/workpiece_clamping.py +++ /dev/null @@ -1,110 +0,0 @@ -from odoo import models, fields, api - - -class WorkpieceClamping(models.Model): - _name = 'sf.workpiece.clamping' - _description = "工件装夹" - # 以下为坯料(工件)申请信息 - apply_code = fields.Char(string="申请坯料编码", size=25, required=True) - apply_name = fields.Char(string="申请坯料名称", size=25, required=True) - material_id = fields.Many2one('sf.production.materials', string="坯料材料", required=True) - apply_width = fields.Float(string="申请宽度", required=True) - apply_length = fields.Float(string="申请长度", required=True) - apply_height = fields.Float(string="申请高度", required=True) - apply_weight = fields.Float(string="申请重量", required=True) - apply_diameter = fields.Float(string="申请直径", required=True) - surface_accuracy = fields.Char(string="表面精度", required=True) - # 以下为坯料(工件)装夹信息 - chuck_name = fields.Char(string="卡盘名称", required=True) - chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌", required=True) - chuck_type_id = fields.Char(string="卡盘类型", required=True) - chuck_model_id = fields.Char(string="卡盘型号", required=True) - tray_name = fields.Char(string="托盘名称", required=True) - tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌", required=True) - tray_type_id = fields.Char(string="托盘类型", required=True) - tray_model_id = fields.Char(string="托盘型号", required=True) - real_code = fields.Char(string="真实坯料编码", size=25, required=True) - real_name = fields.Char(string="真实坯料名称", size=25, required=True) - real_width = fields.Float(string="真实宽度", required=True) - real_length = fields.Float(string="真实长度", required=True) - real_height = fields.Float(string="真实高度", required=True) - real_diameter = fields.Float(string="真实直径", required=True) - # 以下为坯料(工件)预调信息 - # hole_site = fields.Char(string="孔位", required=True) - # curve = fields.Char(string="曲线", required=True) - # straight_line = fields.Char(string="直线", required=True) - # x_axis = fields.Float(string="X轴", required=True) - # y_axis = fields.Float(string="Y轴", required=True) - # z_axis = fields.Float(string="Z轴", required=True) - # tool_radius = fields.Float(string="刀具半径", required=True) - # tool_length = fields.Float(string="刀具长度", required=True) - # tool_offset_point = fields.Float(string="刀具偏移点", required=True) - # tool_compensation_value = fields.Float(string="刀具补偿值", required=True) - # cutting_spindle_speed = fields.Float(string="切削主轴转速", required=True) - # cutting_feed_rate = fields.Float(string="切削进给速度", required=True) - # depth_of_cutting = fields.Float(string="切削深度", required=True) - # cutting_direction = fields.Char(string="切削方向", required=True) - # cnc_program_information = fields.Char(string="CNC程序信息", required=True) - - -class StockRemoval(models.Model): - _name = 'sf.stock.removal' - _description = "出库" - - code = fields.Char(string="功能夹具编码", size=25, required=True) - name = fields.Char(string="功能夹具名称", size=25, required=True) - type = fields.Char(string="功能夹具类型", required=True) - production_line = fields.Char(string="生产线", required=True) - machine_tool = fields.Many2one('sf.machine_tool', string="机床", required=True) - - -class Assemble(models.Model): - _name = 'sf.assemble' - _description = "组合装夹" - - functional_fixture_code = fields.Char(string="功能夹具编码", size=25, required=True) - functional_fixture_name = fields.Char(string="功能夹具名称", size=25, required=True) - functional_fixture_type = fields.Char(string="功能夹具类型", required=True) - chuck_name = fields.Char(string="卡盘名称", required=True) - chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌", required=True) - chuck_type_id = fields.Char(string="卡盘类型", required=True) - chuck_model_id = fields.Char(string="卡盘型号", required=True) - tray_name = fields.Char(string="托盘名称", required=True) - tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌", required=True) - tray_type_id = fields.Char(string="托盘类型", required=True) - tray_model_id = fields.Char(string="托盘型号", required=True) - real_code = fields.Char(string="真实坯料编码", size=25, required=True) - real_name = fields.Char(string="真实坯料名称", size=25, required=True) - total_wight = fields.Float(string="总重量", required=True) - maximum_carrying_weight = fields.Char(string="最大承载重量[kg]") - maximum_clamping_force = fields.Char(string="最大夹持力[n]") - production_line = fields.Char(string="生产线", required=True) - # 以下为智能工厂工单带过来的机床信息 - machine_tool = fields.Many2one('sf.machine_tool', string="机床名称", required=True) - machine_tool_code = fields.Char(string="机床编码", required=True) - machine_tool_startime = fields.Date(string="机床开始加工时间", required=True) - # 以下为智能工厂工单带过来的信息 - apply_staff = fields.Char(string="申请人", required=True) - apply_time = fields.Date(string="申请时间", required=True) - apply_reason = fields.Char(string="申请原因", required=True) - # 以下为装夹的信息 - preset_staff = fields.Char(string="预调名称", required=True) - preset_time = fields.Date(string="预调时间", required=True) - material_taker = fields.Char(string="领料人", required=True) - material_removal_time = fields.Date(string="领料出库时间", required=True) - - - - - - - - - - - - - - - - diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 175e4589..4b84fcfe 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -14,20 +14,21 @@ access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user, access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,1 access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,base.group_user,1,1,1,1 access_sf_machine_tool_category,sf_machine_tool_category,model_sf_machine_tool_category,base.group_user,1,1,1,1 - access_sf_cutting_tool_material,sf_cutting_tool_material,model_sf_cutting_tool_material,base.group_user,1,1,1,1 access_sf_cutting_tool_type,sf_cutting_tool_type,model_sf_cutting_tool_type,base.group_user,1,1,1,1 access_sf_cutting_tool_model,sf_cutting_tool_model,model_sf_cutting_tool_model,base.group_user,1,1,1,1 access_sf_functional_cutting_tool,sf_functional_cutting_tool,model_sf_functional_cutting_tool,base.group_user,1,1,1,1 access_sf_functional_cutting_tool_model,sf_functional_cutting_tool_model,model_sf_functional_cutting_tool_model,base.group_user,1,1,1,1 - - - access_sf_fixture_material,sf_fixture_material,model_sf_fixture_material,base.group_user,1,1,1,1 access_sf_multi_mounting_type,sf_multi_mounting_type,model_sf_multi_mounting_type,base.group_user,1,1,1,1 access_sf_fixture_model,sf_fixture_model,model_sf_fixture_model,base.group_user,1,1,1,1 access_sf_functional_fixture_type,sf_functional_fixture_type,model_sf_functional_fixture_type,base.group_user,1,1,1,1 access_sf_functional_fixture,sf_functional_fixture,model_sf_functional_fixture,base.group_user,1,1,1,1 +access_sf_workpiece_clamping_wizard,sf_workpiece_clamping_wizard,model_sf_workpiece_clamping_wizard,base.group_user,1,1,1,1 +access_sf_stock_removal_wizard,sf_stock_removal_wizard,model_sf_stock_removal_wizard,base.group_user,1,1,1,1 +access_sf_assemble,sf_assemble,model_sf_assemble,base.group_user,1,1,1,1 + + diff --git a/sf_base/views/assemble_view.xml b/sf_base/views/assemble_view.xml new file mode 100644 index 00000000..20da39b2 --- /dev/null +++ b/sf_base/views/assemble_view.xml @@ -0,0 +1,161 @@ + + + + + + + search.sf.assemble + sf.assemble + + + + + + + + + + + + 工件夹具 + sf.assemble + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 工件夹具 + sf.assemble + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + 工件夹具 + ir.actions.act_window + sf.assemble + tree,form + + +
\ No newline at end of file diff --git a/sf_base/views/menu_fixture_view.xml b/sf_base/views/menu_fixture_view.xml index 883b6599..64d5873a 100644 --- a/sf_base/views/menu_fixture_view.xml +++ b/sf_base/views/menu_fixture_view.xml @@ -39,9 +39,9 @@ sequence="4" /> - diff --git a/sf_base/views/workpiece_clamping_view.xml b/sf_base/views/workpiece_clamping_view.xml deleted file mode 100644 index 9b67a3a0..00000000 --- a/sf_base/views/workpiece_clamping_view.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - search.sf.workpiece.clamping - sf.workpiece.clamping - - - - - - - - - - - 工件夹具 - sf.workpiece.clamping - - - - - - - - - - - - - - - - - - - - 工件夹具 - sf.workpiece.clamping - -
- - - - - - - - - - - - - -
-
-
- - - 工件夹具 - ir.actions.act_window - sf.workpiece.clamping - tree,form - - -
\ No newline at end of file diff --git a/sf_base/wizard/__init__.py b/sf_base/wizard/__init__.py new file mode 100644 index 00000000..ac69a1da --- /dev/null +++ b/sf_base/wizard/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import workpiece_clamping_wizard +from . import stock_removal_wizard diff --git a/sf_base/wizard/stock_removal_wizard.py b/sf_base/wizard/stock_removal_wizard.py new file mode 100644 index 00000000..58d7abc7 --- /dev/null +++ b/sf_base/wizard/stock_removal_wizard.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError +import logging +_logger = logging.getLogger(__name__) + + +class StockRemovalWizard(models.Model): + _name = 'sf.stock.removal.wizard' + _description = "出库" + + code = fields.Char(string="功能夹具编码", size=25, required=True) + name = fields.Char(string="功能夹具名称", size=25, required=True) + type = fields.Char(string="功能夹具类型", required=True) + production_line = fields.Char(string="生产线", required=True) + machine_tool = fields.Many2one('sf.machine_tool', string="机床", required=True) + + def submit(self): + return 1 + diff --git a/sf_base/wizard/stock_removal_wizard_view.xml b/sf_base/wizard/stock_removal_wizard_view.xml new file mode 100644 index 00000000..d669cdca --- /dev/null +++ b/sf_base/wizard/stock_removal_wizard_view.xml @@ -0,0 +1,34 @@ + + + + sf.stock.removal.wizard.form.view + sf.stock.removal.wizard + +
+ + + + + + + + + + + +
+
+
+
+
+ + + 出库 + sf.stock.removal.wizard + form + new + +
+
\ No newline at end of file diff --git a/sf_base/wizard/workpiece_clamping_wizard.py b/sf_base/wizard/workpiece_clamping_wizard.py new file mode 100644 index 00000000..81489bc8 --- /dev/null +++ b/sf_base/wizard/workpiece_clamping_wizard.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError +import logging + +_logger = logging.getLogger(__name__) + + +class WorkpieceClampingWizard(models.Model): + _name = 'sf.workpiece.clamping.wizard' + _description = "工件装夹" + # 以下为坯料(工件)申请信息 + apply_code = fields.Char(string="申请坯料编码", size=25, required=True) + apply_name = fields.Char(string="申请坯料名称", size=25, required=True) + material_id = fields.Many2one('sf.production.materials', string="坯料材料", required=True) + apply_width = fields.Float(string="申请宽度", required=True) + apply_length = fields.Float(string="申请长度", required=True) + apply_height = fields.Float(string="申请高度", required=True) + apply_weight = fields.Float(string="申请重量", required=True) + apply_diameter = fields.Float(string="申请直径", required=True) + surface_accuracy = fields.Char(string="表面精度", required=True) + # 以下为坯料(工件)装夹信息 + chuck_name = fields.Char(string="卡盘名称", required=True) + chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌", required=True) + chuck_type_id = fields.Char(string="卡盘类型", required=True) + chuck_model_id = fields.Char(string="卡盘型号", required=True) + tray_name = fields.Char(string="托盘名称", required=True) + tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌", required=True) + tray_type_id = fields.Char(string="托盘类型", required=True) + tray_model_id = fields.Char(string="托盘型号", required=True) + real_code = fields.Char(string="真实坯料编码", size=25, required=True) + real_name = fields.Char(string="真实坯料名称", size=25, required=True) + real_width = fields.Float(string="真实宽度", required=True) + real_length = fields.Float(string="真实长度", required=True) + real_height = fields.Float(string="真实高度", required=True) + real_diameter = fields.Float(string="真实直径", required=True) + # 以下为坯料(工件)预调信息 + # hole_site = fields.Char(string="孔位", required=True) + # curve = fields.Char(string="曲线", required=True) + # straight_line = fields.Char(string="直线", required=True) + # x_axis = fields.Float(string="X轴", required=True) + # y_axis = fields.Float(string="Y轴", required=True) + # z_axis = fields.Float(string="Z轴", required=True) + # tool_radius = fields.Float(string="刀具半径", required=True) + # tool_length = fields.Float(string="刀具长度", required=True) + # tool_offset_point = fields.Float(string="刀具偏移点", required=True) + # tool_compensation_value = fields.Float(string="刀具补偿值", required=True) + # cutting_spindle_speed = fields.Float(string="切削主轴转速", required=True) + # cutting_feed_rate = fields.Float(string="切削进给速度", required=True) + # depth_of_cutting = fields.Float(string="切削深度", required=True) + # cutting_direction = fields.Char(string="切削方向", required=True) + preset_program_information = fields.Char(string="预调程序信息", required=True) + + def submit(self): + return 1 diff --git a/sf_base/wizard/workpiece_clamping_wizard_view.xml b/sf_base/wizard/workpiece_clamping_wizard_view.xml new file mode 100644 index 00000000..30cb1591 --- /dev/null +++ b/sf_base/wizard/workpiece_clamping_wizard_view.xml @@ -0,0 +1,83 @@ + + + + sf.workpiece.clamping.wizard.form.view + sf.workpiece.clamping.wizard + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + 装夹 + sf.workpiece.clamping.wizard + form + new + +
+
\ No newline at end of file From 6dfced854166bf181ad3db9f2a8b6cfb4335e2a8 Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Mon, 10 Jul 2023 17:26:43 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8F=AD=E6=AC=A1?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=AF=B9=E8=B1=A1=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=8E=86=E8=AE=BE=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E7=8F=AD=E6=AC=A1=E3=80=81=E5=B7=A5=E4=BD=9C=E6=97=A5=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=B1=BB=E5=9E=8B=EF=BC=9B=E6=96=B0=E5=A2=9E=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=97=A5=E5=8E=86=E8=A1=A8=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/__manifest__.py | 2 +- sf_maintenance/views/production_line_view.xml | 2 +- sf_plan_management/__manifest__.py | 2 +- sf_plan_management/models/base.py | 4 +- sf_plan_management/models/calendar_base.py | 114 ++++++++---- .../security/ir.model.access.csv | 4 + sf_plan_management/views/menu_view.xml | 21 +++ ...{paln_base_view.xml => plan_base_view.xml} | 174 ++++++++++++++---- 8 files changed, 245 insertions(+), 78 deletions(-) rename sf_plan_management/views/{paln_base_view.xml => plan_base_view.xml} (56%) diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index 6e644ebc..17b1e541 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -12,7 +12,7 @@ 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', - 'views/production_line_base.py', + 'views/production_line_view.xml', 'views/maintenance_views.xml', 'views/maintenance_logs_views.xml', 'views/equipment_maintenance_standards_views.xml', diff --git a/sf_maintenance/views/production_line_view.xml b/sf_maintenance/views/production_line_view.xml index 0772d116..b9fd459f 100644 --- a/sf_maintenance/views/production_line_view.xml +++ b/sf_maintenance/views/production_line_view.xml @@ -74,7 +74,7 @@ diff --git a/sf_plan_management/__manifest__.py b/sf_plan_management/__manifest__.py index 44be0987..fa2c7ffb 100644 --- a/sf_plan_management/__manifest__.py +++ b/sf_plan_management/__manifest__.py @@ -14,7 +14,7 @@ 'data': [ 'security/ir.model.access.csv', # 'security/ir.model.access.csv', - 'views/paln_base_view.xml', + 'views/plan_base_view.xml', 'views/menu_view.xml', ], 'demo': [ diff --git a/sf_plan_management/models/base.py b/sf_plan_management/models/base.py index 1a8d1e27..57df9566 100644 --- a/sf_plan_management/models/base.py +++ b/sf_plan_management/models/base.py @@ -19,7 +19,7 @@ class ProcedureEquipmentResourceSetting(models.Model): working_procedure = fields.Char(string='工序', readonly=True) production_capacity = fields.Float(string='产能', required=True, digits=(4, 1)) working_calendar_id = fields.Many2one('sf.work.log.setting', string='工作日历') - working_shift = fields.Char(string='班次', readonly=True, compute='_onchange_working_calendar_id') + working_shift_id = fields.Many2many('sf.working.shift', string='班次', readonly=True, compute='_onchange_working_calendar_id') create_time = fields.Datetime(string='新增时间', default=lambda self: fields.Datetime.now(), readonly=True) status = fields.Selection([('正常', '正常'), ('1', '故障停机'), ('2', '计划停机')], string='设备状态', @@ -49,7 +49,7 @@ class ProcedureEquipmentResourceSetting(models.Model): @api.depends('working_calendar_id') def _onchange_working_calendar_id(self): for record in self: - record.working_shift = record.working_calendar_id.working_shift + record.working_shift_id = record.working_calendar_id.working_shift_id diff --git a/sf_plan_management/models/calendar_base.py b/sf_plan_management/models/calendar_base.py index 0bc1ba56..5d75aea2 100644 --- a/sf_plan_management/models/calendar_base.py +++ b/sf_plan_management/models/calendar_base.py @@ -45,24 +45,9 @@ class WorkLogSetting(models.Model): end_time_M = fields.Selection(time_M_or_S_selection(), '分', required=True) duration = fields.Char(string='时长', readonly=True, compute='_compute_duration') - day_off = fields.Char(string='休息日', required=True) + day_off_id = fields.Many2many('sf.day.off', string='休息日', required=True) - user_defined_working_shift_status = fields.Boolean(string='自定义班次', default=False) - working_shift = fields.Char(string='班次') - working_shift_char = fields.Char(string='班次', readonly=True, compute='_compute_working_shift_time') - working_shift_select = fields.Selection([('早班00:00-08:00', '早班00:00-08:00'), - ('白班08:00-16:00', '白班08:00-16:00'), - ('晚班16:00-24:00', '晚班16:00-24:00'), - ('长白班08:00-20:00', '长白班08:00-20:00'), - ('长晚班20:00-08:00', '长晚班20:00-08:00')], string='班次') - working_shift_start_time_H = fields.Selection(time_H_selection(), '班次开始时间:时', - attr={'required': [('user_defined_working_shift_status', '=', 'True')]}) - working_shift_start_time_M = fields.Selection(time_M_or_S_selection(), '分', - attr={'required': [('user_defined_working_shift_status', '=', 'True')]}) - working_shift_end_time_H = fields.Selection(time_H_selection(), '班次结束时间:时', - attr={'required': [('user_defined_working_shift_status', '=', 'True')]}) - working_shift_end_time_M = fields.Selection(time_M_or_S_selection(), '分', - attr={'required': [('user_defined_working_shift_status', '=', 'True')]}) + working_shift_id = fields.Many2many('sf.working.shift', string='班次') status = fields.Boolean(string='状态', default=True) update_person = fields.Char(string='更新人', default=lambda self: self.env.user.name) @@ -86,27 +71,7 @@ class WorkLogSetting(models.Model): for record in self: record.end_time = f"{record.end_time_H}:{record.end_time_M}:00" - @api.onchange('working_shift_char', 'working_shift_select') - def _onchange_working_shift(self): - """ - 对班次是否手动输入是进行不同的展示 - :return: - """ - for record in self: - if record.working_shift_select: - record.working_shift = record.working_shift_select - else: - record.working_shift = record.working_shift_char - - @api.depends( - 'working_shift_start_time_H', 'working_shift_start_time_M', - 'working_shift_end_time_H', 'working_shift_end_time_M') - def _compute_working_shift_time(self): - start_time = f"{self.working_shift_start_time_H}:{self.working_shift_start_time_M}:00" - end_time = f"{self.working_shift_end_time_H}:{self.working_shift_end_time_M}:00" - self.working_shift_char = f"自定义班次{start_time}-{end_time}" - - @api.depends('start_time_H', 'start_time_M', 'end_time_H', 'end_time_M') + @api.depends('start_time_H', 'start_time_M', 'end_time_H', 'end_time_M') def _compute_duration(self): """ 根据日开始时间和日结束时间计算每日工作时长 @@ -119,6 +84,75 @@ class WorkLogSetting(models.Model): end_m = float(record.end_time_M) # 日开始时间小于日结束时间 if st_h < end_h: - record.duration = str(round(end_h-st_h+(end_m-st_m)/60, 2)) + record.duration = str(round(end_h - st_h + (end_m - st_m) / 60, 2)) else: - record.duration = str(round(end_h-st_h+(end_m-st_m)/60+24, 2)) + record.duration = str(round(end_h - st_h + (end_m - st_m) / 60 + 24, 2)) + + # @api.model + # def create(self, vals_list): + # """ + # 创建新工作日历设置记录时,同时根据所选的休息日新建工作日历的休息日记录 + # :param vals_list: + # :return: + # """ + # + # + # return super(WorkLogSetting, self).create(vals_list) + + +class WorkingShift(models.Model): + _name = 'sf.working.shift' + _description = '班次' + + def _get_code(self): + """ + 自动生成编码 + :return: + """ + fixture_material = self.env['sf.working.shift'].sudo().search( + [('code', '!=', '')], + limit=1, + order="id desc") + if not fixture_material: + num = "%03d" % 1 + else: + m = int(fixture_material.code) + 1 + num = "%03d" % m + return num + + code = fields.Char('编码', default=_get_code, readonly=True) + name = fields.Char('名称', required=True) + start_time = fields.Datetime('班次开始时间') + end_time = fields.Datetime('班次结束时间') + remark = fields.Char('备注') + + +class DayOff(models.Model): + _name = 'sf.day.off' + _description = '休息日' + + name = fields.Selection([ + ('周一', '周一'), + ('周二', '周二'), + ('周三', '周三'), + ('周四', '周四'), + ('周五', '周五'), + ('周六', '周六'), + ('周日', '周日')], '休息日名称') + + +class WorkScheduleCalendar(models.Model): + _name = 'sf.work.schedule.calendar' + _description = '工作安排日历' + + name_id = fields.Many2one('sf.work.log.setting', '工作日历名称') + day_off_id = fields.Many2many('sf.day.off', string='休息日') + scheduled_outage = fields.Char('计划停机') + monthly_rest_days = fields.Char('月休息天数', readonly=True) + annual_rest_days = fields.Char('年休息天数', readonly=True) + monthly_planned_downtime = fields.Char('月计划停机时长', readonly=True) + annual_planned_downtime = fields.Char('年计划停机时长', readonly=True) + + name = fields.Selection([('休息日', '休息日'),('计划停机', '计划停机')], '名称') + date_time = fields.Datetime('休息时间') + diff --git a/sf_plan_management/security/ir.model.access.csv b/sf_plan_management/security/ir.model.access.csv index 98cf2ae7..45b4c99b 100644 --- a/sf_plan_management/security/ir.model.access.csv +++ b/sf_plan_management/security/ir.model.access.csv @@ -2,6 +2,10 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_sf_work_log_setting,sf.work.log.setting,model_sf_work_log_setting,base.group_user,1,1,1,1 access_sf_procedure_equipment_resource_setting,sf.procedure.equipment.resource.setting,model_sf_procedure_equipment_resource_setting,base.group_user,1,1,1,1 +access_sf_day_off,sf.day.off,model_sf_day_off,base.group_user,1,1,1,1 +access_sf_working_shift,sf.working.shift,model_sf_working_shift,base.group_user,1,1,1,1 +access_sf_work_schedule_calendar,sf.work.schedule.calendar,model_sf_work_schedule_calendar,base.group_user,1,1,1,1 + diff --git a/sf_plan_management/views/menu_view.xml b/sf_plan_management/views/menu_view.xml index 2bf4569d..926b7ea7 100644 --- a/sf_plan_management/views/menu_view.xml +++ b/sf_plan_management/views/menu_view.xml @@ -25,4 +25,25 @@ action="sf_procedure_equipment_resource_setting_act" sequence="10" /> + + + + + + \ No newline at end of file diff --git a/sf_plan_management/views/paln_base_view.xml b/sf_plan_management/views/plan_base_view.xml similarity index 56% rename from sf_plan_management/views/paln_base_view.xml rename to sf_plan_management/views/plan_base_view.xml index 645aa45d..bc4cd2a4 100644 --- a/sf_plan_management/views/paln_base_view.xml +++ b/sf_plan_management/views/plan_base_view.xml @@ -1,6 +1,6 @@ - + 工作日历设置 sf.work.log.setting @@ -11,8 +11,8 @@ - - + + @@ -35,29 +35,7 @@ - - - - - - - - - - - - - - - - - - - - - - - + @@ -80,9 +58,9 @@ - - - + @@ -100,7 +78,137 @@ - + + + 休息日 + sf.day.off + + + + + + + + + 休息日 + sf.day.off + tree,form + + + + + + 班次 + sf.working.shift + + + + + + + + + + + + + 班次 + sf.working.shift + +
+ + + + + + + + + + + + + +
+
+
+ + + 班次 + sf.working.shift + tree,form + + + + + + 工作安排日历 + sf.work.schedule.calendar + + + + + + + + + + + 工作安排日历 + sf.work.schedule.calendar + +
+ + + + + + + + + + + + + + + + + +
+
+
+ + + 工作安排日历 + sf.work.schedule.calendar + + + + + + + + + + + 工作安排日历 + sf.work.schedule.calendar + + + + + + + + + 工作安排日历 + sf.work.schedule.calendar + calendar,search,tree,form + + + + 产线设备资源设置 sf.procedure.equipment.resource.setting @@ -114,7 +222,7 @@ - + @@ -161,7 +269,7 @@ - + @@ -182,7 +290,7 @@ - + From 7743c9658cc206d7b29977a12afe3d3f51788d15 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 10 Jul 2023 17:33:17 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mrp_workorder/views/mrp_workorder_views.xml | 5 +- sf_maintenance/__manifest__.py | 3 +- sf_manufacturing/models/mrp_workorder.py | 12 ++++ sf_manufacturing/views/mrp_workorder_view.xml | 69 +++++++++++++------ 4 files changed, 63 insertions(+), 26 deletions(-) diff --git a/mrp_workorder/views/mrp_workorder_views.xml b/mrp_workorder/views/mrp_workorder_views.xml index efabc78b..61491d4c 100644 --- a/mrp_workorder/views/mrp_workorder_views.xml +++ b/mrp_workorder/views/mrp_workorder_views.xml @@ -160,10 +160,7 @@ if env.user.has_group('mrp.group_mrp_workorder_dependencies'): - - - - + diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index cc2a1d46..17b1e541 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -12,12 +12,11 @@ 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', - 'views/production_line_base.py', + 'views/production_line_view.xml', 'views/maintenance_views.xml', 'views/maintenance_logs_views.xml', 'views/equipment_maintenance_standards_views.xml', 'views/maintenance_request_views.xml', - 'views/production_line_view.xml', ], 'installable': True, 'application': False, diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 2c38616e..3b1ecdb1 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -524,6 +524,18 @@ class ResMrpWorkOrder(models.Model): }) super().button_finish() + def action_view_schedule_tree(self): + # 执行打开树视图的操作(已排程的工单) + return { + 'name': 'Schedule Work Order Tree', + 'type': 'ir.actions.act_window', + 'res_model': 'mrp.workorder', + 'target': 'current', + 'view_mode': 'tree', + 'views': [[self.env.ref('mrp.mrp_production_workorder_tree_editable_view').id], 'tree'], + 'domain': [('schedule_state', '=', '已排')], + } + class CNCprocessing(models.Model): _name = 'sf.cnc.processing' diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index e024b46c..db5f2ed4 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -11,7 +11,6 @@ - @@ -96,26 +95,26 @@ - - 工单 - ir.actions.act_window - mrp.workorder - tree,kanban,form - + + + + + + - - - - - - - - -

- 没有已排程的工单! -

-
-
+ + + + + + + + + + + + + @@ -440,5 +439,35 @@ + + + + 工单 + ir.actions.act_window + mrp.workorder + tree,kanban,form + + + [('schedule_state', '=', '已排')] + + + + + + + + + + + + + + + +
From 94ffec20db2aded93ec0f5426822ed17ee71b1cc Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 11 Jul 2023 15:43:03 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0js=5Fclass=E7=B1=BB?= =?UTF-8?q?=E5=AF=B9=E7=9C=8B=E6=9D=BF=E8=A7=86=E5=9B=BE=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/__manifest__.py | 6 +++++- .../static/src/js/custom_kanban_controller.js | 21 +++++++++++++++++++ .../static/src/kanban_color_change.scss | 20 +++++++++++++++--- .../static/xml/custom_kanban_controller.xml | 16 ++++++++++++++ sf_warehouse/views/view.xml | 2 +- 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 sf_warehouse/static/src/js/custom_kanban_controller.js create mode 100644 sf_warehouse/static/xml/custom_kanban_controller.xml diff --git a/sf_warehouse/__manifest__.py b/sf_warehouse/__manifest__.py index fb0a512f..e4019a7c 100644 --- a/sf_warehouse/__manifest__.py +++ b/sf_warehouse/__manifest__.py @@ -23,7 +23,11 @@ 'web.assets_qweb': [ ], 'web.assets_backend':[ - 'sf_warehouse/static/src/kanban_color_change.scss' + # 'sf_warehouse/static/src/js/vanilla-masker.min.js', + 'sf_warehouse/static/src/kanban_color_change.scss', + 'sf_warehouse/static/src/js/custom_kanban_controller.js', + 'sf_warehouse/static/xml/custom_kanban_controller.xml', + ] diff --git a/sf_warehouse/static/src/js/custom_kanban_controller.js b/sf_warehouse/static/src/js/custom_kanban_controller.js new file mode 100644 index 00000000..7b9d01fb --- /dev/null +++ b/sf_warehouse/static/src/js/custom_kanban_controller.js @@ -0,0 +1,21 @@ +/** @odoo-module */ + +import { KanbanController } from "@web/views/kanban/kanban_controller"; +import { kanbanView } from "@web/views/kanban/kanban_view"; +import { registry } from "@web/core/registry"; + +// the controller usually contains the Layout and the renderer. +class CustomKanbanController extends KanbanController { + // Your logic here, override or insert new methods... + // if you override setup(), don't forget to call super.setup() +} + +CustomKanbanController.template = "sf_warehouse.CustomKanbanView"; + +export const customKanbanView = { + ...kanbanView, // contains the default Renderer/Controller/Model + Controller: CustomKanbanController, +}; + +// Register it to the views registry +registry.category("views").add("custom_kanban", customKanbanView); \ No newline at end of file diff --git a/sf_warehouse/static/src/kanban_color_change.scss b/sf_warehouse/static/src/kanban_color_change.scss index eca158e1..ddb39767 100644 --- a/sf_warehouse/static/src/kanban_color_change.scss +++ b/sf_warehouse/static/src/kanban_color_change.scss @@ -1,11 +1,25 @@ .oe_kanban_card.kanban_color_1 { - background-color: red !important; + background-color: #73b9a2 !important; } .oe_kanban_card.kanban_color_2 { - background-color: blue !important; + background-color: #ac6767 !important; } .oe_kanban_card.kanban_color_3 { - background-color: green !important; + background-color: #77787b !important; +} + +.color-guide { + border: 1px solid #ccc; + background-color: #f9f9f9; + padding: 10px; +} + +.color-guide-item { + display: inline-block; + width: 20px; + height: 20px; + margin-right: 10px; + border-radius: 50%; } diff --git a/sf_warehouse/static/xml/custom_kanban_controller.xml b/sf_warehouse/static/xml/custom_kanban_controller.xml new file mode 100644 index 00000000..d5b426b8 --- /dev/null +++ b/sf_warehouse/static/xml/custom_kanban_controller.xml @@ -0,0 +1,16 @@ + + + + + + + + + +
+ Hello world ! +
+
+ +
+
\ No newline at end of file diff --git a/sf_warehouse/views/view.xml b/sf_warehouse/views/view.xml index f5a41d43..ba03d4ad 100644 --- a/sf_warehouse/views/view.xml +++ b/sf_warehouse/views/view.xml @@ -74,7 +74,7 @@ example.kanban stock.location - +
+ @@ -140,9 +141,9 @@ - + - 工作安排日历 + 工作日历 sf.work.schedule.calendar @@ -154,7 +155,7 @@ - 工作安排日历 + 工作日历 sf.work.schedule.calendar
@@ -166,6 +167,7 @@ + From 81842dc5ecb3362b753c5029cc15c7d1d44b5bfb Mon Sep 17 00:00:00 2001 From: yuxianghui <1608204036@qq.com> Date: Thu, 13 Jul 2023 16:05:38 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E5=B0=86=E7=94=9F=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E4=BB=8E=E8=AE=BE=E5=A4=87=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=90=AC=E7=A7=BB=E5=88=B0=E4=BA=86=E5=88=B6=E9=80=A0=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E8=AE=BE=E7=BD=AE=E4=BF=AE=E6=94=B9=E4=BC=91=E6=81=AF?= =?UTF-8?q?=E6=97=A5=E5=AD=97=E6=AE=B5=E5=88=99=E5=B7=A5=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E5=88=9B=E5=BB=BA=E6=96=B0=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/__manifest__.py | 1 - sf_maintenance/models/__init__.py | 1 - sf_maintenance/security/ir.model.access.csv | 2 +- sf_manufacturing/__manifest__.py | 1 + sf_manufacturing/models/__init__.py | 1 + .../models/production_line_base.py | 0 sf_manufacturing/security/ir.model.access.csv | 2 +- .../views/production_line_view.xml | 0 sf_plan_management/__manifest__.py | 2 +- sf_plan_management/models/calendar_base.py | 39 +++++++++++-------- sf_plan_management/views/menu_view.xml | 2 +- sf_plan_management/views/plan_base_view.xml | 7 ++-- 12 files changed, 32 insertions(+), 26 deletions(-) rename {sf_maintenance => sf_manufacturing}/models/production_line_base.py (100%) rename {sf_maintenance => sf_manufacturing}/views/production_line_view.xml (100%) diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index 17b1e541..529c62fc 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -12,7 +12,6 @@ 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', - 'views/production_line_view.xml', 'views/maintenance_views.xml', 'views/maintenance_logs_views.xml', 'views/equipment_maintenance_standards_views.xml', diff --git a/sf_maintenance/models/__init__.py b/sf_maintenance/models/__init__.py index 98f9d12c..0e06b132 100644 --- a/sf_maintenance/models/__init__.py +++ b/sf_maintenance/models/__init__.py @@ -3,4 +3,3 @@ from . import sf_maintenance from . import sf_maintenance_logs from . import sf_equipment_maintenance_standards from . import sf_maintenance_requests -from . import production_line_base diff --git a/sf_maintenance/security/ir.model.access.csv b/sf_maintenance/security/ir.model.access.csv index 809ed5b6..52c0ab72 100644 --- a/sf_maintenance/security/ir.model.access.csv +++ b/sf_maintenance/security/ir.model.access.csv @@ -4,6 +4,6 @@ access_sf_maintenance_logs,sf_maintenance_logs,model_sf_maintenance_logs,base.gr access_maintenance_equipment,maintenance_equipment,model_maintenance_equipment,base.group_user,1,1,1,1 access_maintenance_standards,maintenance_standards,model_maintenance_standards,base.group_user,1,1,1,1 -access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1 + diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index 5e61bb27..adde17a8 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -20,6 +20,7 @@ 'views/mrp_routing_workcenter_view.xml', 'views/mrp_workcenter_views.xml', 'views/mrp_workorder_view.xml', + 'views/production_line_view.xml', 'views/tray_view.xml', 'views/model_type_view.xml', diff --git a/sf_manufacturing/models/__init__.py b/sf_manufacturing/models/__init__.py index 055eece0..2d7d2f1e 100644 --- a/sf_manufacturing/models/__init__.py +++ b/sf_manufacturing/models/__init__.py @@ -8,6 +8,7 @@ from . import mrp_maintenance from . import mrp_routing_workcenter from . import stock from . import res_user +from . import production_line_base diff --git a/sf_maintenance/models/production_line_base.py b/sf_manufacturing/models/production_line_base.py similarity index 100% rename from sf_maintenance/models/production_line_base.py rename to sf_manufacturing/models/production_line_base.py diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv index bc24436c..e0a78bb6 100644 --- a/sf_manufacturing/security/ir.model.access.csv +++ b/sf_manufacturing/security/ir.model.access.csv @@ -5,7 +5,7 @@ access_sf_product_model_type_routing_sort,sf_product_model_type_routing_sort,mod access_sf_embryo_model_type_routing_sort,sf_embryo_model_type_routing_sort,model_sf_embryo_model_type_routing_sort,base.group_user,1,1,1,1 access_sf_surface_technics_model_type_routing_sort,sf_surface_technics_model_type_routing_sort,model_sf_surface_technics_model_type_routing_sort,base.group_user,1,1,1,1 - +access_sf_production_line,sf.production.line,model_sf_production_line,base.group_user,1,1,1,1 diff --git a/sf_maintenance/views/production_line_view.xml b/sf_manufacturing/views/production_line_view.xml similarity index 100% rename from sf_maintenance/views/production_line_view.xml rename to sf_manufacturing/views/production_line_view.xml diff --git a/sf_plan_management/__manifest__.py b/sf_plan_management/__manifest__.py index fa2c7ffb..d4ec406b 100644 --- a/sf_plan_management/__manifest__.py +++ b/sf_plan_management/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sf_maintenance'], + 'depends': ['sf_manufacturing'], 'data': [ 'security/ir.model.access.csv', # 'security/ir.model.access.csv', diff --git a/sf_plan_management/models/calendar_base.py b/sf_plan_management/models/calendar_base.py index 3cd41a1e..6176bde3 100644 --- a/sf_plan_management/models/calendar_base.py +++ b/sf_plan_management/models/calendar_base.py @@ -55,6 +55,13 @@ class WorkLogSetting(models.Model): update_person = fields.Char(string='更新人', default=lambda self: self.env.user.name) update_time = fields.Datetime(string='更新时间', default=lambda self: fields.Datetime.now()) + setting_to_calendar_ids = fields.One2many('sf.work.schedule.calendar', 'name_id', '工作日历') + + # @api.model + # def create(self, vals): + # vals['setting_to_calendar_ids'] = [(4, child.id)] + # return super(WorkLogSetting, self).create(vals) + @api.depends('start_time_H', 'start_time_M') def _compute_start_time(self): """ @@ -93,8 +100,7 @@ class WorkLogSetting(models.Model): @api.onchange('day_off_id') def _onchange_day_off_id(self): # 先删除之前创建的工作日历事件记录 - self.env['sf.work.schedule.calendar'].search([ - ('calendar_code', '=', self.code), ('name_id', '=', self.name)]).unlink() + # self.env['sf.work.schedule.calendar'].search([('calendar_code', '=', self.code)]).unlink() # 获取当年的一月一号的日期 year = fields.Datetime.now().year # 2023 @@ -124,15 +130,19 @@ class WorkLogSetting(models.Model): ints += 1 # 创建工作日历的休息日事件 - # day_off_ids = self.day_off_id.mapped('name') - # for week in day_off_ids: - # num = desc[week] - # while num <= 30: - # target_date = first_day + timedelta(days=num) - # self.env['sf.work.schedule.calendar'].create({'name': '休息日', - # 'name_id': self.name.id, - # 'date_time': target_date}) - # num += 7 + day_off_ids = self.day_off_id.mapped('name') + record = self.env['sf.work.log.setting'].search([('code', '=', self.code)]) + # record.setting_to_calendar_ids.unlink() + # self.env.cr.commit() + for week in day_off_ids: + num = desc[week] + while num <= 30: + target_date = first_day + timedelta(days=num) + num += 7 + self.env['sf.work.schedule.calendar'].create({'name': '休息日', + 'name_id': record.id, + 'calendar_code': self.code, + 'date_time': target_date}) class WorkingShift(models.Model): @@ -182,9 +192,9 @@ class WorkScheduleCalendar(models.Model): name = fields.Selection([('休息日', '休息日'), ('计划停机', '计划停机')], '日历事件名称') date_time = fields.Date('休息时间') - name_id = fields.Many2one('sf.work.log.setting', '工作日历名称') calendar_code = fields.Char('工作日历编码') + day_off_id = fields.Many2many('sf.day.off', string='休息日') scheduled_outage = fields.Char('计划停机') monthly_rest_days = fields.Char('月休息天数', readonly=True) @@ -192,10 +202,5 @@ class WorkScheduleCalendar(models.Model): monthly_planned_downtime = fields.Char('月计划停机时长', readonly=True) annual_planned_downtime = fields.Char('年计划停机时长', readonly=True) - @api.onchange('name_id') - def _onchange_name_id(self): - for record in self: - record.calendar_code = record.name_id.code - diff --git a/sf_plan_management/views/menu_view.xml b/sf_plan_management/views/menu_view.xml index 926b7ea7..793f381d 100644 --- a/sf_plan_management/views/menu_view.xml +++ b/sf_plan_management/views/menu_view.xml @@ -41,7 +41,7 @@ /> + @@ -182,7 +183,7 @@
- 工作安排日历 + 工作日历 sf.work.schedule.calendar @@ -194,7 +195,7 @@ - 工作安排日历 + 工作日历 sf.work.schedule.calendar @@ -204,7 +205,7 @@ - 工作安排日历 + 工作日历 sf.work.schedule.calendar calendar,search,tree,form From f9c63b69a14ac91403736f1b2940de1ea176cd42 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 13 Jul 2023 16:09:28 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=E5=B7=B2=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 52 +++++++++++++++++++++++++++--------- sf_warehouse/views/view.xml | 14 +++++++--- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 4990d233..af4e185a 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -10,22 +10,12 @@ class SfLocation(models.Model): name = fields.Char('Location Name', required=True, size=20) barcode = fields.Char('Barcode', copy=False, required=True, size=15) - # 仓库类别(selection:仓库、库区、库位、货位) + # 仓库类别(selection:库区、库位、货位) location_type = fields.Selection([ - ('仓库', '仓库'), ('库区', '库区'), ('货架', '货架'), ('货位', '货位') ], string='仓库类别') - # 仓库类型(分类:成品库、坯料库、原材料库、刀具库、线边料库、线边刀库) - location_category = fields.Selection([ - ('成品库', '成品库'), - ('坯料库', '坯料库'), - ('原材料库', '原材料库'), - ('刀具库', '刀具库'), - ('线边料库', '线边料库'), - ('线边刀库', '线边刀库') - ], string='仓库类型') # 库区类型(selection:拣货区、存货区、收货区、退货区、次品区) area_type = fields.Selection([ ('拣货区', '拣货区'), @@ -34,6 +24,13 @@ class SfLocation(models.Model): ('退货区', '退货区'), ('次品区', '次品区') ], string='库区类型') + # 存储类型(selection:库区、货架) + storage_type = fields.Selection([ + ('库区', '库区'), + ('货架', '货架') + ], string='存储类型') + # 产品类别 (关联:product.category) + product_type = fields.Many2many('product.category', string='产品类别') # 货架独有字段:通道、方向、货架高度(m)、货架层数、层数容量 channel = fields.Char(string='通道', required=True) direction = fields.Selection([ @@ -64,6 +61,27 @@ class SfLocation(models.Model): hide_shelf = fields.Boolean(compute='_compute_hide_what', string='隐藏货架') hide_location = fields.Boolean(compute='_compute_hide_what', string='隐藏货位') + @api.model + def create(self, vals): + """ + 重写create方法,添加自定义的约束 + """ + print('create', vals) + if vals.get('location_id'): + location = self.env['stock.location'].browse(vals.get('location_id')) + if location.storage_type == '库区': + raise UserError('库区不能作为父级仓库') + return super().create(vals) + + @api.onchange('location_id') + def _onchange_location_id(self): + """ + 重写onchange方法,添加自定义的约束 + """ + if self.location_id: + if self.location_id.storage_type == '库区': + raise UserError('库区不能作为父级仓库') + # @api.constrains('shelf_height') # def _check_shelf_height(self): # for record in self: @@ -84,6 +102,9 @@ class SfLocation(models.Model): @api.depends('product_sn_id') def _compute_product_id(self): + """ + 根据产品序列号,获取产品 + """ for record in self: if record.product_sn_id: record.product_id = record.product_sn_id.product_id @@ -153,6 +174,9 @@ class SfLocation(models.Model): # 生成货位 def create_location(self): + """ + 当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量 + """ if self.location_type == '货架': for i in range(self.shelf_layer): for j in range(self.layer_capacity): @@ -165,8 +189,12 @@ class SfLocation(models.Model): }) def generate_barcode(self, i, j): + """ + 生成货位条码 + """ # 这里是你生成barcode的代码 - area_type_barcode = self.location_id.barcode + # area_type_barcode = self.location_id.barcode + area_type_barcode = self.barcode i_str = str(i + 1).zfill(3) # 确保是两位数,如果不足两位,左侧补0 j_str = str(j + 1).zfill(3) # 确保是两位数,如果不足两位,左侧补0 return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + i_str + '-' + j_str diff --git a/sf_warehouse/views/view.xml b/sf_warehouse/views/view.xml index ba03d4ad..6481fa84 100644 --- a/sf_warehouse/views/view.xml +++ b/sf_warehouse/views/view.xml @@ -30,11 +30,13 @@ + + - - + + @@ -53,7 +55,13 @@
+ + + + + + + + + + + + + + + + + + + + + + @@ -440,34 +434,24 @@
- 工单 ir.actions.act_window mrp.workorder tree,kanban,form - + [('schedule_state', '=', '已排')] - - - - - - - - - - - - + + + diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 4926726e..8e8b7bbb 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -1771,7 +1771,7 @@ class SyncFunctionalFixture(models.Model): self.env['sf.functional.fixture'].create({ "name": item['name'], "code": item['code'], - "functional_fixture_type_id": self.env['sf.functional.fixture.type'].search( + "type_id": self.env['sf.functional.fixture.type'].search( [("code", '=', item['functional_fixture_type_code'])]).id, "zero_chuck_model_ids": self._get_fixture_model_ids(item['zero_chuck_model_codes']), "transfer_tray_model_ids": self._get_fixture_model_ids( @@ -1785,7 +1785,7 @@ class SyncFunctionalFixture(models.Model): else: functional_fixture.write({ "name": item['name'], - "functional_fixture_type_id": self.env['sf.functional.fixture.type'].search( + "type_id": self.env['sf.functional.fixture.type'].search( [("code", '=', item['functional_fixture_type_code'])]).id, "zero_chuck_model_ids": self._get_fixture_model_ids(item['zero_chuck_model_codes']), "transfer_tray_model_ids": self._get_fixture_model_ids( @@ -1820,7 +1820,7 @@ class SyncFunctionalFixture(models.Model): self.env['sf.functional.fixture'].create({ "name": item['name'], "code": item['code'], - "functional_fixture_type_id": self.env['sf.functional.fixture.type'].search( + "type_id": self.env['sf.functional.fixture.type'].search( [("code", '=', item['functional_fixture_type_code'])]).id, "zero_chuck_model_ids": self._get_fixture_model_ids(item['zero_chuck_model_codes']), "transfer_tray_model_ids": self._get_fixture_model_ids( @@ -1834,7 +1834,7 @@ class SyncFunctionalFixture(models.Model): else: functional_fixture.write({ "name": item['name'], - "functional_fixture_type_id": self.env['sf.functional.fixture.type'].search( + "type_id": self.env['sf.functional.fixture.type'].search( [("code", '=', item['functional_fixture_type_code'])]).id, "zero_chuck_model_ids": self._get_fixture_model_ids(item['zero_chuck_model_codes']), "transfer_tray_model_ids": self._get_fixture_model_ids( From 36bb77ccb024e48aaef3a638d0956e7e52ec31fa Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 13 Jul 2023 17:17:48 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E7=9A=84=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E6=8C=89=E9=92=AE=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/__manifest__.py | 1 - sf_manufacturing/views/mrp_workorder_view.xml | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index 17b1e541..529c62fc 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -12,7 +12,6 @@ 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', - 'views/production_line_view.xml', 'views/maintenance_views.xml', 'views/maintenance_logs_views.xml', 'views/equipment_maintenance_standards_views.xml', diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index c4152c3c..0b980564 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -111,7 +111,8 @@ ('is_user_working', '!=', False),('user_permissions','=',False),('name','=','获取CNC加工程序')]}"/>