From 830f3bb35e43af3a957b099b2feec98200a4ae4a Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 21 Nov 2022 20:04:56 +0800 Subject: [PATCH] 212 --- .../inspectionProfiles/profiles_settings.xml | 6 - .idea/jikimo-sf.iml | 8 - .idea/modules.xml | 8 - sf_base/__init__.py | 1 + sf_base/__manifest__.py | 12 +- sf_base/commons/__init__.py | 2 +- sf_base/data/process_data.xml | 52 -- sf_base/models/__init__.py | 9 +- sf_base/models/{sf_base.py => base.py} | 66 +-- sf_base/models/{sf_common.py => common.py} | 47 +- sf_base/security/ir.model.access.csv | 31 +- .../{mrs_base_view.xml => base_view.xml} | 191 +++----- .../{mrs_common_view.xml => common_view.xml} | 86 ++-- sf_base/views/menu_view.xml | 81 ++-- sf_base/views/product_template_view.xml | 50 -- sf_bf_connect/__init__.py | 3 + sf_bf_connect/__manifest__.py | 10 +- sf_bf_connect/controllers/__init__.py | 1 + sf_bf_connect/controllers/controllers.py | 41 +- sf_bf_connect/models/__init__.py | 4 +- {sf_bpm_api => sf_bf_connect}/models/http.py | 0 .../models/models.py | 0 sf_bf_connect/models/sf_process_order.py | 34 -- .../views/sale_process_order_view.xml | 18 - sf_bpm_api/__init__.py | 3 - sf_bpm_api/controllers/__init__.py | 1 - sf_bpm_api/controllers/controllers.py | 41 -- sf_bpm_api/data/product_data.xml | 16 - sf_bpm_api/security/group_security.xml | 5 - sf_bpm_api/security/ir.model.access.csv | 5 - {sf_mrs_sync => sf_dlm}/__init__.py | 1 - {sf_bpm_api => sf_dlm}/__manifest__.py | 13 +- {sf_base => sf_dlm}/data/product_data.xml | 4 +- sf_dlm/models/__init__.py | 3 + .../models/product_template.py | 96 ++-- sf_dlm/views/product_template_view.xml | 101 ++++ sf_manufacturing_orders/__manifest__.py | 16 +- sf_manufacturing_orders/models/__init__.py | 11 +- sf_manufacturing_orders/models/model_type.py | 33 ++ .../models/mrp_maintenance.py | 66 +++ .../models/mrp_production.py | 219 +++++++++ .../models/mrp_routing_workcenter.py | 9 - .../models/mrp_workcenter.py | 60 +++ .../models/mrp_workorder.py | 297 +++++++++++- .../models/{sf_production.py => stock.py} | 94 +--- sf_manufacturing_orders/models/tray.py | 59 +++ .../report/tray_report.xml | 20 +- .../security/group_security.xml | 27 ++ .../security/ir.model.access.csv | 9 + .../views/model_type_view.xml | 73 +++ .../views/mrp_maintenance_views.xml | 58 ++- .../views/mrp_routing_workcenter_view.xml | 59 --- .../views/mrp_workcenter_views.xml | 16 +- .../views/mrp_workorder_view.xml | 258 ++++++++++ .../views/sf_production.xml | 39 -- .../views/tray_view.xml | 0 sf_mrp_workorder_sequence/README.rst | 89 ---- sf_mrp_workorder_sequence/__init__.py | 3 - sf_mrp_workorder_sequence/models/__init__.py | 2 - .../models/mrp_production.py | 18 - .../models/mrp_workorder.py | 9 - .../static/description/icon.png | Bin 9455 -> 0 bytes .../static/description/index.html | 429 ----------------- .../views/mrp_workorder_view.xml | 16 - sf_mrs_connect/__init__.py | 1 + sf_mrs_connect/__manifest__.py | 3 +- .../data/ir_cron_data.xml | 47 +- sf_mrs_connect/models/__init__.py | 5 +- sf_mrs_connect/models/models.py | 0 .../models/res_config_setting.py | 40 +- .../models/sync_common.py | 320 ++++++------- .../views/res_config_settings_views.xml | 10 +- sf_mrs_sync/__manifest__.py | 27 -- sf_mrs_sync/connect/__init__.py | 1 - sf_mrs_sync/models/__init__.py | 3 - sf_route_workcenter/__init__.py | 3 - sf_route_workcenter/__manifest__.py | 29 -- sf_route_workcenter/models/__init__.py | 3 - sf_route_workcenter/models/mrp_maintenance.py | 186 -------- sf_route_workcenter/models/workcenter.py | 449 ------------------ .../views/mrp_workcenter_views.xml | 37 -- sf_route_workcenter/views/sf_workorder.xml | 273 ----------- {sf_bpm_api/models => sf_sale}/__init__.py | 3 - .../__manifest__.py | 16 +- sf_sale/models/__init__.py | 1 + {sf_base => sf_sale}/models/sale_order.py | 0 .../views/sale_order_view.xml | 0 87 files changed, 1785 insertions(+), 2711 deletions(-) delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/jikimo-sf.iml delete mode 100644 .idea/modules.xml delete mode 100644 sf_base/data/process_data.xml rename sf_base/models/{sf_base.py => base.py} (78%) rename sf_base/models/{sf_common.py => common.py} (71%) rename sf_base/views/{mrs_base_view.xml => base_view.xml} (75%) rename sf_base/views/{mrs_common_view.xml => common_view.xml} (80%) delete mode 100644 sf_base/views/product_template_view.xml rename {sf_bpm_api => sf_bf_connect}/models/http.py (100%) rename {sf_bpm_api => sf_bf_connect}/models/models.py (100%) delete mode 100644 sf_bf_connect/models/sf_process_order.py delete mode 100644 sf_bf_connect/views/sale_process_order_view.xml delete mode 100644 sf_bpm_api/__init__.py delete mode 100644 sf_bpm_api/controllers/__init__.py delete mode 100644 sf_bpm_api/controllers/controllers.py delete mode 100644 sf_bpm_api/data/product_data.xml delete mode 100644 sf_bpm_api/security/group_security.xml delete mode 100644 sf_bpm_api/security/ir.model.access.csv rename {sf_mrs_sync => sf_dlm}/__init__.py (50%) rename {sf_bpm_api => sf_dlm}/__manifest__.py (52%) rename {sf_base => sf_dlm}/data/product_data.xml (87%) create mode 100644 sf_dlm/models/__init__.py rename {sf_base => sf_dlm}/models/product_template.py (56%) create mode 100644 sf_dlm/views/product_template_view.xml create mode 100644 sf_manufacturing_orders/models/model_type.py create mode 100644 sf_manufacturing_orders/models/mrp_maintenance.py create mode 100644 sf_manufacturing_orders/models/mrp_production.py rename sf_base/models/process.py => sf_manufacturing_orders/models/mrp_routing_workcenter.py (90%) create mode 100644 sf_manufacturing_orders/models/mrp_workcenter.py rename sf_manufacturing_orders/models/{sf_production.py => stock.py} (71%) create mode 100644 sf_manufacturing_orders/models/tray.py rename sf_route_workcenter/report/sf_tray_report.xml => sf_manufacturing_orders/report/tray_report.xml (85%) create mode 100644 sf_manufacturing_orders/security/group_security.xml create mode 100644 sf_manufacturing_orders/security/ir.model.access.csv create mode 100644 sf_manufacturing_orders/views/model_type_view.xml rename sf_route_workcenter/views/maintenance_views.xml => sf_manufacturing_orders/views/mrp_maintenance_views.xml (67%) rename sf_route_workcenter/views/mrp_views.xml => sf_manufacturing_orders/views/mrp_workcenter_views.xml (79%) create mode 100644 sf_manufacturing_orders/views/mrp_workorder_view.xml delete mode 100644 sf_manufacturing_orders/views/sf_production.xml rename sf_route_workcenter/views/sf_tray_view.xml => sf_manufacturing_orders/views/tray_view.xml (100%) delete mode 100644 sf_mrp_workorder_sequence/README.rst delete mode 100644 sf_mrp_workorder_sequence/__init__.py delete mode 100644 sf_mrp_workorder_sequence/models/__init__.py delete mode 100644 sf_mrp_workorder_sequence/models/mrp_production.py delete mode 100644 sf_mrp_workorder_sequence/models/mrp_workorder.py delete mode 100644 sf_mrp_workorder_sequence/static/description/icon.png delete mode 100644 sf_mrp_workorder_sequence/static/description/index.html delete mode 100644 sf_mrp_workorder_sequence/views/mrp_workorder_view.xml rename sf_mrs_sync/data/sf_cron.xml => sf_mrs_connect/data/ir_cron_data.xml (77%) delete mode 100644 sf_mrs_connect/models/models.py rename {sf_mrs_sync => sf_mrs_connect}/models/res_config_setting.py (52%) rename sf_mrs_sync/models/sf_sync_common.py => sf_mrs_connect/models/sync_common.py (75%) rename sf_mrs_sync/views/sf_sync_config_settings_views.xml => sf_mrs_connect/views/res_config_settings_views.xml (87%) delete mode 100644 sf_mrs_sync/__manifest__.py delete mode 100644 sf_mrs_sync/connect/__init__.py delete mode 100644 sf_mrs_sync/models/__init__.py delete mode 100644 sf_route_workcenter/__init__.py delete mode 100644 sf_route_workcenter/__manifest__.py delete mode 100644 sf_route_workcenter/models/__init__.py delete mode 100644 sf_route_workcenter/models/mrp_maintenance.py delete mode 100644 sf_route_workcenter/models/workcenter.py delete mode 100644 sf_route_workcenter/views/mrp_workcenter_views.xml delete mode 100644 sf_route_workcenter/views/sf_workorder.xml rename {sf_bpm_api/models => sf_sale}/__init__.py (50%) rename {sf_mrp_workorder_sequence => sf_sale}/__manifest__.py (59%) create mode 100644 sf_sale/models/__init__.py rename {sf_base => sf_sale}/models/sale_order.py (100%) rename {sf_base => sf_sale}/views/sale_order_view.xml (100%) diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da..00000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jikimo-sf.iml b/.idea/jikimo-sf.iml deleted file mode 100644 index d0876a78..00000000 --- a/.idea/jikimo-sf.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 534b713b..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/sf_base/__init__.py b/sf_base/__init__.py index 0650744f..60182bcc 100644 --- a/sf_base/__init__.py +++ b/sf_base/__init__.py @@ -1 +1,2 @@ from . import models +from . import commons diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index aae20018..494cfe9b 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { - 'name': '机企猫藏智能工厂 基础模块', + 'name': '机企猫智能工厂 基础模块', 'version': '1.0', 'summary': '智能工厂基础模块', 'sequence': 1, @@ -10,15 +10,13 @@ """, 'category': 'YZ', 'website': 'https://www.sf.jikimo.com', - 'depends': ['account', 'base', 'mrp', 'sale'], + 'depends': ['account', 'base', 'mrp'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', - 'views/mrs_base_view.xml', - 'views/mrs_common_view.xml', - "views/menu_view.xml", - 'views/sale_order_view.xml', - 'views/product_template_view.xml', + 'views/base_view.xml', + 'views/common_view.xml', + "views/menu_view.xml" ], 'demo': [ diff --git a/sf_base/commons/__init__.py b/sf_base/commons/__init__.py index 3e880316..d89945c1 100644 --- a/sf_base/commons/__init__.py +++ b/sf_base/commons/__init__.py @@ -1 +1 @@ -from. import common \ No newline at end of file +from. import common diff --git a/sf_base/data/process_data.xml b/sf_base/data/process_data.xml deleted file mode 100644 index 066f4e45..00000000 --- a/sf_base/data/process_data.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index 1314cbdf..4714c995 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -1,5 +1,4 @@ -from. import sf_base -from. import sf_common -from. import process -from. import product_template -from. import sale_order +from . import base +from . import common + + diff --git a/sf_base/models/sf_base.py b/sf_base/models/base.py similarity index 78% rename from sf_base/models/sf_base.py rename to sf_base/models/base.py index d098127b..a5dec8e4 100644 --- a/sf_base/models/sf_base.py +++ b/sf_base/models/base.py @@ -13,29 +13,29 @@ _logger = logging.getLogger(__name__) class MachineBrandTags(models.Model): - _name = 'mrs.machine.brand.tags' + _name = 'sf.machine.brand.tags' _description = '标签' name = fields.Char('名称', size=50) color = fields.Integer('颜色', default=0) class MachineControlSystem(models.Model): - _name = 'mrs.machine.control_system' + _name = 'sf.machine.control_system' _description = '控制系统' code = fields.Char('编码', size=10) name = fields.Char('名称', size=10) - brand_id = fields.Many2one('mrs.machine.brand', '品牌') + brand_id = fields.Many2one('sf.machine.brand', '品牌') active = fields.Boolean('有效', default=True) # 品牌标签 class MachineBrand(models.Model): - _name = 'mrs.machine.brand' + _name = 'sf.machine.brand' _description = '品牌' name = fields.Char('名称') - tag_ids = fields.Many2many('mrs.machine.brand.tags', 'rel_machine_brand_tags', string='类别') + tag_ids = fields.Many2many('sf.machine.brand.tags', 'rel_machine_brand_tags', string='类别') image_brand = fields.Image("品牌图片") active = fields.Boolean('有效', default=True) code = fields.Char('编码') @@ -43,7 +43,7 @@ class MachineBrand(models.Model): # 机床 class MachineTool(models.Model): - _name = 'mrs.machine_tool' + _name = 'sf.machine_tool' _description = '机床' MTcode = fields.Char("编码") code = fields.Char('行业编码') @@ -64,11 +64,11 @@ class MachineTool(models.Model): c_axis = fields.Integer('C轴') remark = fields.Text('备注') precision = fields.Float('加工精度') - control_system_id = fields.Many2one('mrs.machine.control_system', + control_system_id = fields.Many2one('sf.machine.control_system', string="控制系统") # 多个机床型号对应一个机床 - type_id = fields.Many2one('mrs.machine_tool.type', '型号') - brand_id = fields.Many2one('mrs.machine.brand', string='品牌') + type_id = fields.Many2one('sf.machine_tool.type', '型号') + brand_id = fields.Many2one('sf.machine.brand', string='品牌') state = fields.Selection( [("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")], default='正常', string="状态") @@ -145,10 +145,10 @@ class MachineTool(models.Model): def enroll_machine_tool(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) - strurl = sf_sync_config['mrs_url'] + self.crea_url - objs_all = request.env['mrs.machine_tool'].sudo().search([]) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + strurl = sf_sync_config['sf_url'] + self.crea_url + objs_all = request.env['sf.machine_tool'].sudo().search([]) machine_tool_list = [] if objs_all: for item in objs_all: @@ -162,10 +162,10 @@ class MachineTool(models.Model): 'number_of_knife_library': item.number_of_knife_library, 'rotate_speed': item.rotate_speed, 'number_of_axles': item.number_of_axles, - 'control_system_id': self.env['mrs.machine.control_system'].search( + 'control_system_id': self.env['sf.machine.control_system'].search( [('id', '=', item.control_system_id.id)]).code, - 'type_id': self.env['mrs.machine_tool.type'].search([('id', '=', item.type_id.id)]).code, - 'brand_id': self.env['mrs.machine.brand'].search([('id', '=', item.brand_id.id)]).code, + 'type_id': self.env['sf.machine_tool.type'].search([('id', '=', item.type_id.id)]).code, + 'brand_id': self.env['sf.machine.brand'].search([('id', '=', item.brand_id.id)]).code, 'supplier_id': item.supplier_id.id, 'x_axis': item.x_axis, 'y_axis': item.y_axis, @@ -188,19 +188,19 @@ class MachineTool(models.Model): class MachineToolType(models.Model): - _name = 'mrs.machine_tool.type' + _name = 'sf.machine_tool.type' _description = '机床型号' # _order = 'priority desc, code, name, id' name = fields.Char('名称') - brand_id = fields.Many2one('mrs.machine.brand', string='品牌') + brand_id = fields.Many2one('sf.machine.brand', string='品牌') knife_type = fields.Selection( [("BT40", "BT40"), ("BT30", "BT30")], default="", string="刀把类型") number_of_knife_library = fields.Integer('刀库数量') rotate_speed = fields.Integer('转速') # 多个型号对应一个机床 - machine_tool_id = fields.Many2one('mrs.machine_tool', '机床') + machine_tool_id = fields.Many2one('sf.machine_tool', '机床') number_of_axles = fields.Selection( [("三轴", "三轴"), ("四轴", "四轴"), ("五轴", "五轴")], default="", string="轴数") @@ -212,7 +212,7 @@ class MachineToolType(models.Model): c_axis = fields.Integer('C轴') remark = fields.Text('备注') precision = fields.Float('加工精度') - control_system_id = fields.Many2one('mrs.machine.control_system', + control_system_id = fields.Many2one('sf.machine.control_system', string="控制系统") active = fields.Boolean('有效', default=True) code = fields.Char('编码') @@ -220,7 +220,7 @@ class MachineToolType(models.Model): # 刀具 class CuttingTool(models.Model): - _name = 'mrs.cutting_tool.category' + _name = 'sf.cutting_tool.category' _description = '刀具类别' code = fields.Char('编码') @@ -231,7 +231,7 @@ class CuttingTool(models.Model): class CuttingToolType(models.Model): - _name = 'mrs.cutting_tool.type' + _name = 'sf.cutting_tool.type' _description = '刀具型号' code = fields.Char('编码') @@ -243,26 +243,8 @@ class CuttingToolType(models.Model): taper_shank_length = fields.Integer('锥柄长') tool_length = fields.Integer('刀具总长') blade_number = fields.Integer('刃数') - category_id = fields.Many2one('mrs.cutting_tool.category', string='刀具类别') - brand_id = fields.Many2one('mrs.machine.brand', string='品牌') + category_id = fields.Many2one('sf.cutting_tool.category', string='刀具类别') + brand_id = fields.Many2one('sf.machine.brand', string='品牌') remark = fields.Text('备注') active = fields.Boolean('有效', default=True) - -class CNCprocessing(models.Model): - _name = 'cnc.processing' - _description = "CNC加工" - - cnc_id = fields.Many2one('ir.attachment') - FNo = fields.Char(string="序号") - FPGName = fields.Char(string="程序名") - FKnifeName = fields.Char(string="刀具名称") - FDNo = fields.Char(string="刀号") - FWorkType = fields.Char(string="加工类型") - FXY = fields.Char(string="余量_X/Y") - FZ = fields.Char(string="余量_Z") - FJGSD = fields.Char(string="加工深度(Z)") - FSCCD = fields.Char(string="刀具伸出长度") - FDJSpec = fields.Char(string="刀柄型号") - FJGDate = fields.Datetime(string="预计加工时间") - FComment = fields.Char(string="备注") diff --git a/sf_base/models/sf_common.py b/sf_base/models/common.py similarity index 71% rename from sf_base/models/sf_common.py rename to sf_base/models/common.py index b1abf43b..01465284 100644 --- a/sf_base/models/sf_common.py +++ b/sf_base/models/common.py @@ -7,64 +7,65 @@ _logger = logging.getLogger(__name__) # 材料 class MrsProductionMaterials(models.Model): - _name = 'mrs.production.materials' + _name = 'sf.production.materials' _description = '材料' - remark = fields.Text("备注") + + materials_no = fields.Char("编码") name = fields.Char('名称') partner_ids = fields.Many2many('res.partner', 'materials_ids', '加工工厂') - materials_model_ids = fields.One2many('mrs.materials.model', 'materials_id', '材料型号') - materials_no = fields.Char("编码") + materials_model_ids = fields.One2many('sf.materials.model', 'materials_id', '材料型号') + remark = fields.Text("备注") active = fields.Boolean('有效', default=True) # 材料型号 class MrsMaterialModel(models.Model): - _name = 'mrs.materials.model' + _name = 'sf.materials.model' _description = '材料型号' - remark = fields.Text("备注") + + materials_no = fields.Char("编码") + materials_num = fields.Char("编码号") name = fields.Char('型号名') need_h = fields.Boolean("热处理", default="false") mf_materia_post = fields.Char("热处理后密度") density = fields.Float("密度(kg/m³)") - materials_id = fields.Many2one('mrs.production.materials', "材料名") - materials_num = fields.Char("编码号") - materials_no = fields.Char("编码") + materials_id = fields.Many2one('sf.production.materials', "材料名") + remark = fields.Text("备注") active = fields.Boolean('有效', default=True) # 工艺 编码,名称,备注 class MrsProductionProcess(models.Model): - _name = 'mrs.production.process' + _name = 'sf.production.process' _description = '表面工艺' - name = fields.Char('表面工艺') - remark = fields.Text("备注") - processing_order_ids = fields.One2many('mrs.processing.order', 'production_process_id', string='工序') - partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂') + process_encode = fields.Char("编码") + name = fields.Char('名称') + remark = fields.Text("备注") + 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) class MrsProcessingTechnology(models.Model): - _name = 'mrs.processing.technology' + _name = 'sf.processing.technology' _description = '加工工艺' - remark = fields.Text("备注") - name = fields.Char('加工工艺', index=True) + + name = fields.Char('名称', index=True) remark = fields.Text('备注', index=True) process_encode = fields.Char("编码") - processing_order_ids = fields.Many2many('mrs.processing.order', 'mrs_associated_processes', + processing_order_ids = fields.Many2many('sf.processing.order', 'sf_associated_processes', index=True, string='工序') active = fields.Boolean('有效', default=True) class MrsProcessingOrder(models.Model): - _name = 'mrs.processing.order' + _name = 'sf.processing.order' _description = '工序' sequence = fields.Integer('Sequence') - processing_technology_ids = fields.Many2many('mrs.processing.technology', 'mrs_associated_processes', - + processing_technology_ids = fields.Many2many('sf.processing.technology', 'sf_associated_processes', index=True, string='加工工艺') - production_process_id = fields.Many2one('mrs.production.process', string="表面工艺") @@ -72,7 +73,7 @@ class Tray(models.Model): _name = 'sf.tray' _description = '托盘' - code = fields.Char('编码',copy=False) + code = fields.Char('编码', copy=False) name = fields.Char('名称') state = fields.Selection( [("空闲", "空闲"), ("占用", "占用"), ("报损", "报损")], diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 2422ae03..a548d41c 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -1,21 +1,20 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_mrs_machine_tool,mrs_machine_tool,model_mrs_machine_tool,base.group_user,1,1,1,1 -access_mrs_cutting_tool_category,mrs_cutting_tool_category,model_mrs_cutting_tool_category,base.group_user,1,1,1,1 -access_mrs_machine_tool_type,mrs_machine_tool_type,model_mrs_machine_tool_type,base.group_user,1,1,1,1 -access_mrs_cutting_tool_type,mrs_cutting_tool_type,model_mrs_cutting_tool_type,base.group_user,1,1,1,1 -access_mrs_machine_brand,mrs_machine_brand,model_mrs_machine_brand,base.group_user,1,1,1,1 -access_mrs_machine_brand_tags,mrs_machine_brand_tags,model_mrs_machine_brand_tags,base.group_user,1,1,1,1 -access_mrs_machine_control_system,mrs_machine_control_system,model_mrs_machine_control_system,base.group_user,1,1,1,1 - -access_mrs_processing_order,mrs_processing_order,model_mrs_processing_order,base.group_user,1,1,1,1 -access_mrs_production_process,mrs_production_process,model_mrs_production_process,base.group_user,1,1,1,1 -access_mrs_production_materials,mrs_production_materials,model_mrs_production_materials,base.group_user,1,1,1,1 -access_mrs_materials_model,mrs_materials_model,model_mrs_materials_model,base.group_user,1,1,1,1 -access_mrs_processing_technology,mrs_processing_technology,model_mrs_processing_technology,base.group_user,1,1,1,1 +access_sf_machine_tool,sf_machine_tool,model_sf_machine_tool,base.group_user,1,1,1,1 +access_sf_cutting_tool_category,sf_cutting_tool_category,model_sf_cutting_tool_category,base.group_user,1,1,1,1 +access_sf_machine_tool_type,sf_machine_tool_type,model_sf_machine_tool_type,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_machine_brand,sf_machine_brand,model_sf_machine_brand,base.group_user,1,1,1,1 +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,base.group_user,1,1,1,1 +access_sf_processing_order,sf_processing_order,model_sf_processing_order,base.group_user,1,1,1,1 +access_sf_production_process,sf_production_process,model_sf_production_process,base.group_user,1,1,1,1 +access_sf_production_materials,sf_production_materials,model_sf_production_materials,base.group_user,1,1,1,1 +access_sf_materials_model,sf_materials_model,model_sf_materials_model,base.group_user,1,1,1,1 +access_sf_processing_technology,sf_processing_technology,model_sf_processing_technology,base.group_user,1,1,1,1 access_sf_tray,sf_tray,model_sf_tray,base.group_user,1,1,1,1 -access_cnc_processing,cnc_processing,model_cnc_processing,base.group_user,1,1,1,1 -access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1 -access_sf_model_type_routing_sort,sf_model_type_routing_sort,model_sf_model_type_routing_sort,base.group_user,1,1,1,1 + + + diff --git a/sf_base/views/mrs_base_view.xml b/sf_base/views/base_view.xml similarity index 75% rename from sf_base/views/mrs_base_view.xml rename to sf_base/views/base_view.xml index 927cc8dc..ff85bfda 100644 --- a/sf_base/views/mrs_base_view.xml +++ b/sf_base/views/base_view.xml @@ -1,9 +1,9 @@ #------------------品牌------------------ - - search.mrs.machine.brand - mrs.machine.brand + + search.sf.machine.brand + sf.machine.brand @@ -17,9 +17,9 @@ - - tree.mrs.machine.brand - mrs.machine.brand + + tree.sf.machine.brand + sf.machine.brand @@ -29,9 +29,9 @@ - - form.mrs.machine.brand - mrs.machine.brand + + form.sf.machine.brand + sf.machine.brand
@@ -55,10 +55,10 @@ - + 品牌 ir.actions.act_window - mrs.machine.brand + sf.machine.brand tree,form

@@ -71,9 +71,9 @@ #------------------机床型号------------------ - - search.mrs.machine_tool.type - mrs.machine_tool.type + + search.sf.machine_tool.type + sf.machine_tool.type - - tree.mrs.machine_tool.type - mrs.machine_tool.type + + tree.sf.machine_tool.type + sf.machine_tool.type @@ -95,9 +95,9 @@ - - form.mrs.machine_tool.type - mrs.machine_tool.type + + form.sf.machine_tool.type + sf.machine_tool.type @@ -155,10 +155,10 @@ - + 机床型号 ir.actions.act_window - mrs.machine_tool.type + sf.machine_tool.type tree,form

@@ -171,9 +171,9 @@ #------------------刀具型号------------------ - - search.mrs.cutting_tool.type - mrs.cutting_tool.type + + search.sf.cutting_tool.type + sf.cutting_tool.type - tree.mrs.cutting_tool.type - mrs.cutting_tool.type + tree.sf.cutting_tool.type + sf.cutting_tool.type @@ -194,9 +194,9 @@ - - form.mrs.cutting_tool.type - mrs.cutting_tool.type + + form.sf.cutting_tool.type + sf.cutting_tool.type @@ -230,10 +230,10 @@ - + 刀具型号 ir.actions.act_window - mrs.cutting_tool.type + sf.cutting_tool.type tree,form

@@ -246,9 +246,9 @@ #------------------刀具类别------------------ - - search.mrs.cutting_tool.category - mrs.cutting_tool.category + + search.sf.cutting_tool.category + sf.cutting_tool.category - - tree.mrs.cutting_tool.category - mrs.cutting_tool.category + + tree.sf.cutting_tool.category + sf.cutting_tool.category @@ -268,9 +268,9 @@ - - form.mrs.cutting_tool.category - mrs.cutting_tool.category + + form.sf.cutting_tool.category + sf.cutting_tool.category @@ -306,10 +306,10 @@ - + 刀具类别 ir.actions.act_window - mrs.cutting_tool.category + sf.cutting_tool.category tree,form

@@ -322,9 +322,9 @@ #------------------机床注册------------------ - - search.mrs.machine_tool - mrs.machine_tool + + search.sf.machine_tool + sf.machine_tool @@ -338,9 +338,9 @@ - - tree.mrs.machine_tool - mrs.machine_tool + + tree.sf.machine_tool + sf.machine_tool @@ -353,9 +353,9 @@ - - form.mrs.machine_tool - mrs.machine_tool + + form.sf.machine_tool + sf.machine_tool

@@ -427,10 +427,10 @@ - + 机床 ir.actions.act_window - mrs.machine_tool + sf.machine_tool tree,form @@ -444,9 +444,9 @@ #------------------控制系统------------------ - - search.mrs.machine.control_system - mrs.machine.control_system + + search.sf.machine.control_system + sf.machine.control_system - - tree.mrs.machine.control_system - mrs.machine.control_system + + tree.sf.machine.control_system + sf.machine.control_system @@ -467,9 +467,9 @@ - - form.mrs.machine.control_system - mrs.machine.control_system + + form.sf.machine.control_system + sf.machine.control_system @@ -487,10 +487,10 @@ - + 控制系统 ir.actions.act_window - mrs.machine.control_system + sf.machine.control_system tree,form

@@ -500,65 +500,4 @@

- - #------------------模型类型------------------ - - - search.sf.model.type - sf.model.type - - - - - - - - - tree.sf.model.type - sf.model.type - - - - - - - - - form.sf.model.type - sf.model.type - - - - - - - - - - - - - - - - - - - - - - - 模型类型 - ir.actions.act_window - sf.model.type - tree,form - -

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

-

-

-
-
\ No newline at end of file diff --git a/sf_base/views/mrs_common_view.xml b/sf_base/views/common_view.xml similarity index 80% rename from sf_base/views/mrs_common_view.xml rename to sf_base/views/common_view.xml index fa9cfba1..b0e2a7bc 100644 --- a/sf_base/views/mrs_common_view.xml +++ b/sf_base/views/common_view.xml @@ -1,10 +1,9 @@ - - - mrs.processing.technology + + sf.processing.technology
@@ -27,8 +26,8 @@
- - mrs.processing.technology + + sf.processing.technology @@ -38,9 +37,9 @@ - - search.mrs.processing.technology.type - mrs.processing.technology + + search.sf.processing.technology.type + sf.processing.technology @@ -49,8 +48,8 @@ - - mrs.production.process + + sf.production.process @@ -60,8 +59,8 @@ - - mrs.production.process + + sf.production.process
@@ -92,9 +91,9 @@
- - search.mrs.production.process.type - mrs.production.process + + search.sf.production.process.type + sf.production.process @@ -103,8 +102,8 @@ - - mrs.materials.model + + sf.materials.model
@@ -132,8 +131,8 @@
- - mrs.materials.model + + sf.materials.model @@ -144,9 +143,9 @@ - - search.mrs.materials.model.type - mrs.materials.model + + search.sf.materials.model.type + sf.materials.model @@ -159,8 +158,8 @@ - - mrs.production.materials + + sf.production.materials
@@ -189,8 +188,8 @@
- - mrs.production.materials + + sf.production.materials @@ -199,9 +198,9 @@ - - search.mrs.production.materials.type - mrs.production.materials + + search.sf.production.materials.type + sf.production.materials @@ -210,8 +209,8 @@ - - + + @@ -230,10 +229,10 @@ - + 材料 ir.actions.act_window - mrs.production.materials + sf.production.materials tree,form

@@ -241,10 +240,10 @@

- + 表面工艺 ir.actions.act_window - mrs.production.process + sf.production.process tree,form

@@ -252,10 +251,10 @@

- + 材料型号 ir.actions.act_window - mrs.materials.model + sf.materials.model tree,form

@@ -263,10 +262,10 @@

- + 加工工艺 ir.actions.act_window - mrs.processing.technology + sf.processing.technology tree,form @@ -320,10 +319,10 @@ sf.tray.form sf.tray -
- -
+
+ +
@@ -335,8 +334,5 @@
- - -
\ No newline at end of file diff --git a/sf_base/views/menu_view.xml b/sf_base/views/menu_view.xml index 4babedb1..3b329ccb 100644 --- a/sf_base/views/menu_view.xml +++ b/sf_base/views/menu_view.xml @@ -16,11 +16,11 @@ action="action_mrp_configuration" groups="base.group_system"/>--> + action="sf_processing_technology"/> - + + action="action_sf_machine_brand"/> + action="action_sf_machine_tool_type"/> + action="action_sf_cutting_tool_category"/> + action="action_sf_cutting_tool_type"/> - - - - - + action="action_sf_machine_control_system"/> \ No newline at end of file diff --git a/sf_base/views/product_template_view.xml b/sf_base/views/product_template_view.xml deleted file mode 100644 index 2086fba6..00000000 --- a/sf_base/views/product_template_view.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - product.template.form.inherit.sf - product.template - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - product.category.form.inherit.sf - product.category - - - - - - - - - \ No newline at end of file diff --git a/sf_bf_connect/__init__.py b/sf_bf_connect/__init__.py index 50ed18aa..de1d4d01 100644 --- a/sf_bf_connect/__init__.py +++ b/sf_bf_connect/__init__.py @@ -1 +1,4 @@ # -*-coding:utf-8-*- +from . import controllers +from . import models + diff --git a/sf_bf_connect/__manifest__.py b/sf_bf_connect/__manifest__.py index 77d97796..1004a3c5 100644 --- a/sf_bf_connect/__manifest__.py +++ b/sf_bf_connect/__manifest__.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { - 'name': '机企猫智能工厂 同步模块', + 'name': '机企猫智能工厂 连接业务平台模块', 'version': '1.0', - 'summary': '智能工厂同步模块', + 'summary': '连接业务平台模块', 'sequence': 1, 'description': """ -在本模块,同步资源库 +在本模块,接收业务平台的模块 """, 'category': 'YZ', 'website': 'https://www.sf.cs.jikimo.com', - 'depends': ['account', 'sf_base', 'base', 'sale'], + 'depends': ['sf_base'], 'data': [ - # 'views/sale_process_order_view.xml' + ], 'demo': [ ], diff --git a/sf_bf_connect/controllers/__init__.py b/sf_bf_connect/controllers/__init__.py index 4644261c..6d07f482 100644 --- a/sf_bf_connect/controllers/__init__.py +++ b/sf_bf_connect/controllers/__init__.py @@ -1 +1,2 @@ from .import controllers + diff --git a/sf_bf_connect/controllers/controllers.py b/sf_bf_connect/controllers/controllers.py index 91304469..aeec79b6 100644 --- a/sf_bf_connect/controllers/controllers.py +++ b/sf_bf_connect/controllers/controllers.py @@ -4,29 +4,38 @@ import logging from datetime import date, timedelta from odoo import http from odoo.http import request -from odoo.addons.mrs_gateway_api.models.common import Common -from odoo.addons.mrs_gateway_api.models.basicdata_str import BasicDataStr class Sf_Bf_Connect(http.Controller): - @http.route('/api/bfm_process_order/list', type='json', auth='none', methods=['GET', 'POST'], csrf=False, + @http.route('/api/bfm_process_order/list', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False, cors="*") def get_bfm_process_order_list(self, **kw): """ - 获取业务平台传送来的业务平台订单 + 获取业务平台传送来的订单 :param kw: :return: """ - result = json.loads('bfm_process_order_list') - for item in result: - self.env['mrs.production.process'].create({ - "id": item['id'], - "model_file": item['model_file'], - "model_name": item['model_name'], - "type": item['type'], - "surface_technics": item['surface_technics'], - "unit_price": item['unit_price'], - "amount": item['amount'], - "money": item['money'] - }) + res = {'status': 1, 'factory_order_no': ''} + logging.info('get_bfm_process_order_list:%s' % kw) + try: + datas = request.httprequest.data + ret = json.loads(datas) + ret = json.loads(ret['result']) + product_id = request.env.ref('sf_bpm_api.product_template_sf').sudo() + company_id = request.env.ref('base.main_company').sudo() + order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(ret['delivery_end_date'], company_id) + i = 1 + for item in ret['bfm_process_order_list']: + product = request.env['product.template'].sudo().product_create(product_id, item, order_id, + ret['order_number'], i) + order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) + bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(product) + bom.with_user(request.env.ref("base.user_admin")).bom_create_Line(product) + i += 1 + res['factory_order_no'] = order_id.name + return json.JSONEncoder().encode(res) + except Exception as e: + logging.info('get_bfm_process_order_list error:%s' % e) + res['status'] = -1 + return json.JSONEncoder().encode(res) diff --git a/sf_bf_connect/models/__init__.py b/sf_bf_connect/models/__init__.py index b6c1e8a8..1b8cfb6d 100644 --- a/sf_bf_connect/models/__init__.py +++ b/sf_bf_connect/models/__init__.py @@ -1,2 +1,4 @@ -from . import sf_process_order +from . import http +from . import models + diff --git a/sf_bpm_api/models/http.py b/sf_bf_connect/models/http.py similarity index 100% rename from sf_bpm_api/models/http.py rename to sf_bf_connect/models/http.py diff --git a/sf_bpm_api/models/models.py b/sf_bf_connect/models/models.py similarity index 100% rename from sf_bpm_api/models/models.py rename to sf_bf_connect/models/models.py diff --git a/sf_bf_connect/models/sf_process_order.py b/sf_bf_connect/models/sf_process_order.py deleted file mode 100644 index e3947692..00000000 --- a/sf_bf_connect/models/sf_process_order.py +++ /dev/null @@ -1,34 +0,0 @@ -from odoo import models,fields -from odoo.exceptions import ValidationError - - -class bfmOrderLine(models.Model): - _name = 'sf.bfm.order.line' - _description = '业务平台订单' - - model_file = fields.Binary('模型文件', attachment=False) - model_name = fields.char('模型名称') - type = fields.Many2one('mrs.materials.model', '型号') - surface_technics = fields.Many2one('mrs.production.process', string='表面工艺') - # technological_parameter = fields.Many2one('',string='工艺参数') - unit_price = fields.Float('单价') - amount = fields.Integer('数量') - money = fields.Float('金额') - - -class sale(models.Model): - _inherit = 'sale.order' - - bfm_process_order_ids = fields.Many2one('sf.bfm.order.line', string='业务平台订单') - - - - - - - - - - - - diff --git a/sf_bf_connect/views/sale_process_order_view.xml b/sf_bf_connect/views/sale_process_order_view.xml deleted file mode 100644 index 183f793e..00000000 --- a/sf_bf_connect/views/sale_process_order_view.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sf_bpm_api/__init__.py b/sf_bpm_api/__init__.py deleted file mode 100644 index 3834eca4..00000000 --- a/sf_bpm_api/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*-coding:utf-8-*- -from . import controllers -from . import models diff --git a/sf_bpm_api/controllers/__init__.py b/sf_bpm_api/controllers/__init__.py deleted file mode 100644 index 4644261c..00000000 --- a/sf_bpm_api/controllers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .import controllers diff --git a/sf_bpm_api/controllers/controllers.py b/sf_bpm_api/controllers/controllers.py deleted file mode 100644 index aeec79b6..00000000 --- a/sf_bpm_api/controllers/controllers.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -import json -import logging -from datetime import date, timedelta -from odoo import http -from odoo.http import request - - -class Sf_Bf_Connect(http.Controller): - - @http.route('/api/bfm_process_order/list', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False, - cors="*") - def get_bfm_process_order_list(self, **kw): - """ - 获取业务平台传送来的订单 - :param kw: - :return: - """ - res = {'status': 1, 'factory_order_no': ''} - logging.info('get_bfm_process_order_list:%s' % kw) - try: - datas = request.httprequest.data - ret = json.loads(datas) - ret = json.loads(ret['result']) - product_id = request.env.ref('sf_bpm_api.product_template_sf').sudo() - company_id = request.env.ref('base.main_company').sudo() - order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(ret['delivery_end_date'], company_id) - i = 1 - for item in ret['bfm_process_order_list']: - product = request.env['product.template'].sudo().product_create(product_id, item, order_id, - ret['order_number'], i) - order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) - bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(product) - bom.with_user(request.env.ref("base.user_admin")).bom_create_Line(product) - i += 1 - res['factory_order_no'] = order_id.name - return json.JSONEncoder().encode(res) - except Exception as e: - logging.info('get_bfm_process_order_list error:%s' % e) - res['status'] = -1 - return json.JSONEncoder().encode(res) diff --git a/sf_bpm_api/data/product_data.xml b/sf_bpm_api/data/product_data.xml deleted file mode 100644 index 53fb6216..00000000 --- a/sf_bpm_api/data/product_data.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - CNC加工产品模板 - - delivery - product - false - - - - false - - - \ No newline at end of file diff --git a/sf_bpm_api/security/group_security.xml b/sf_bpm_api/security/group_security.xml deleted file mode 100644 index fdbc3ae5..00000000 --- a/sf_bpm_api/security/group_security.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/sf_bpm_api/security/ir.model.access.csv b/sf_bpm_api/security/ir.model.access.csv deleted file mode 100644 index 963679d4..00000000 --- a/sf_bpm_api/security/ir.model.access.csv +++ /dev/null @@ -1,5 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink - - - - diff --git a/sf_mrs_sync/__init__.py b/sf_dlm/__init__.py similarity index 50% rename from sf_mrs_sync/__init__.py rename to sf_dlm/__init__.py index c081ee06..0650744f 100644 --- a/sf_mrs_sync/__init__.py +++ b/sf_dlm/__init__.py @@ -1,2 +1 @@ -# -*-coding:utf-8-*- from . import models diff --git a/sf_bpm_api/__manifest__.py b/sf_dlm/__manifest__.py similarity index 52% rename from sf_bpm_api/__manifest__.py rename to sf_dlm/__manifest__.py index daea8057..aabf049d 100644 --- a/sf_bpm_api/__manifest__.py +++ b/sf_dlm/__manifest__.py @@ -1,18 +1,19 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { - 'name': '机企猫智能工厂 API模块', + 'name': '机企猫智能工厂 产品模块', 'version': '1.0', - 'summary': '智能工厂API模块', + 'summary': '智能工厂产品模块', 'sequence': 1, 'description': """ - 在本模块,接收业务平台订单 +在本模块,为业务平台传过来的订单信息 """, 'category': 'sf', - 'website': 'https://www.sf.cs.jikimo.com', - 'depends': ['sale', 'sf_base'], + 'website': 'https://www.sf.jikimo.com', + 'depends': ['product', 'base'], 'data': [ - + 'data/product_data.xml', + 'views/product_template_view.xml' ], 'demo': [ ], diff --git a/sf_base/data/product_data.xml b/sf_dlm/data/product_data.xml similarity index 87% rename from sf_base/data/product_data.xml rename to sf_dlm/data/product_data.xml index 53fb6216..03a8588f 100644 --- a/sf_base/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -1,7 +1,7 @@ - - + + CNC加工产品模板 delivery diff --git a/sf_dlm/models/__init__.py b/sf_dlm/models/__init__.py new file mode 100644 index 00000000..86d505b8 --- /dev/null +++ b/sf_dlm/models/__init__.py @@ -0,0 +1,3 @@ +from. import product_template + + diff --git a/sf_base/models/product_template.py b/sf_dlm/models/product_template.py similarity index 56% rename from sf_base/models/product_template.py rename to sf_dlm/models/product_template.py index 02bc0bad..077af0bc 100644 --- a/sf_base/models/product_template.py +++ b/sf_dlm/models/product_template.py @@ -9,43 +9,27 @@ class ResProductTemplate(models.Model): model_long = fields.Float('模型长[mm]', digits=(16, 3)) model_width = fields.Float('模型宽[mm]', digits=(16, 3)) model_height = fields.Float('模型高[mm]', digits=(16, 3)) - model_volume = fields.Float('模型体积[mm³]', digits=(16, 3), compute='_compute_model_volume', store=True) + model_volume = fields.Float('模型体积[mm³]', digits=(16, 3)) model_precision = fields.Float('精度要求', digits=(16, 3)) - model_materials_id = fields.Many2one('mrs.production.materials', string='模型材料') - model_materials_type_id = fields.Many2one('mrs.materials.model', string='模型材料型号') model_type_id = fields.Many2one('sf.model.type', string='模型类型') model_processing_panel = fields.Char('模型加工面板') - model_surface_process_id = fields.Many2one('mrs.production.process', string='表面工艺') - model_process_parameters_id = fields.Many2one('mrs.processing.technology', string='工艺参数') - # price = fields.Float('单价', digits=(16, 3)) - # number = fields.Integer('数量', default=1) - # total_amount = fields.Float('金额', digits=(16, 3), compute='_compute_total_amount') - # model_number = - - - # 胚料的长,宽,高 - embryo_long = fields.Float('胚料长[mm]', digits=(16, 3), onchange='count_embryo_size') - embryo_width = fields.Float('胚料宽[mm]', digits=(16, 3), onchange='count_embryo_size') - embryo_height = fields.Float('胚料高[mm]', digits=(16, 3), onchange='count_embryo_size') - embryo_materials_id = fields.Many2one('mrs.production.materials', string='胚料材料') - embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='胚料材料型号') - + model_surface_process_id = fields.Many2one('sf.production.process', string='表面工艺') + model_process_parameters_id = fields.Many2one('sf.processing.technology', string='工艺参数') + model_price = fields.Float('模型单价', digits=(16, 3)) + model_total_amount = fields.Float('模型金额', digits=(16, 3)) + model_number = fields.Integer('模型数量', default=1) + model_remark = fields.Char('模型备注说明') long = fields.Float('长[mm]', digits=(16, 3), onchange='add_product_size') width = fields.Float('宽[mm]', digits=(16, 3), onchange='add_product_size') height = fields.Float('高[mm]', digits=(16, 3), onchange='add_product_size') - materials_id = fields.Many2one('mrs.production.materials', string='材料') - materials_type_id = fields.Many2one('mrs.materials.model', string='材料型号') - - + materials_id = fields.Many2one('sf.production.materials', string='材料') + materials_type_id = fields.Many2one('sf.materials.model', string='材料型号') volume = fields.Float(compute='_compute_volume', store=True) + single_manufacturing = fields.Boolean(string="单个制造") - @api.depends('embryo_long', 'embryo_width', 'embryo_height') + @api.depends('long', 'width', 'height') def _compute_volume(self): - self.volume = self.embryo_long * self.embryo_width * self.embryo_height - - @api.depends('model_long', 'model_width', 'model_height') - def _compute_model_volume(self): - self.model_volume = self.model_long * self.model_width * self.model_height + self.volume = self.long * self.width * self.height # 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品 def product_create(self, product_id, item, order_id, order_number, i): @@ -57,16 +41,19 @@ class ResProductTemplate(models.Model): 'model_width': item['model_width'], 'model_height': item['model_height'], 'model_volume': item['model_volume'], + 'model_price': item['price'], + 'model_total_amount': item['total_amount'], + 'model_number': item['number'], 'list_price': item['price'], - 'model_materials_id': self.env['mrs.production.materials'].search( + 'materials_id': self.env['sf.production.materials'].search( [('materials_no', '=', item['texture_code'])]).id, - 'model_materials_type_id': self.env['mrs.materials.model'].search( + 'materials_type_id': self.env['sf.materials.model'].search( [('materials_no', '=', item['texture_type_code'])]).id, - 'model_surface_process_id': self.env['mrs.production.process'].search( - [('process_encode', '=', item['surface_process_code'])]).id, - 'model_process_parameters_id': self.env['mrs.processing.technology'].search( - [('process_encode', '=', item['process_parameters_code'])]).id, - '' + # 'model_surface_process_id': self.env['mrs.production.process'].search( + # [('process_encode', '=', item['surface_process_code'])]).id, + # 'model_process_parameters_id': self.env['mrs.processing.technology'].search( + # [('process_encode', '=', item['process_parameters_code'])]).id, + 'model_remark': item['remark'], 'default_code': '%s-%s' % (order_number, i), 'barcode': item['barcode'], 'active': True @@ -74,26 +61,6 @@ class ResProductTemplate(models.Model): copy_product_id.sudo().write(vals) return copy_product_id - - # 在产品上增加模型类型和加工的面(例如:A、B) , - # 并根据模型类型计算出产品的胚料尺寸; - @api.onchange('model_type_id') - def count_embryo_size(self): - if not self.model_type_id: - return - bom = self.env['product.product'].search( - [('categ_id.is_embryo', '=', True), ('product_tmpl_id', '=', self.id)], - limit=1, - order='volume desc' - ) - for item in self: - item.embryo_long = bom.embryo_long + 1 - item.embryo_width = bom.embryo_width + 1 - item.embryo_height = bom.embryo_height + 1 - - - - # 根据模型类型默认给模型的长高宽加配置的长度; @api.onchange('model_type_id') def add_product_size(self): @@ -113,13 +80,6 @@ class ResProductTemplate(models.Model): item.model_height = item.model_width + model_type.embryo_tolerance - -class ResProductCategory(models.Model): - _inherit = "product.category" - - is_embryo = fields.Boolean('胚料') - - class ResMrpBom(models.Model): _inherit = 'mrp.bom' @@ -140,9 +100,9 @@ class ResMrpBom(models.Model): # 四、如果匹配成功多个胚料,则选取体积最小的胚料; def bom_create_Line(self, product): embryo = self.env['product.product'].search( - [('categ_id.is_embryo', '=', True), ('embryo_materials_type_id', '=', product.model_materials_type_id.id), - ('embryo_long', '>', product.model_long), ('embryo_width', '>', product.model_width), - ('embryo_height', '>', product.model_height) + [('categ_id.is_embryo', '=', True), ('materials_type_id', '=', product.materials_type_id.id), + ('long', '>', product.long), ('width', '>', product.width), + ('height', '>', product.height) ], limit=1, order='volume desc' @@ -155,3 +115,9 @@ class ResMrpBom(models.Model): 'product_uom_id': 1 } return self.env['mrp.bom.line'].create(vals) + + +class ResProductCategory(models.Model): + _inherit = "product.category" + + is_embryo = fields.Boolean('胚料') diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml new file mode 100644 index 00000000..83d70cfa --- /dev/null +++ b/sf_dlm/views/product_template_view.xml @@ -0,0 +1,101 @@ + + + + + product.template.form.inherit.sf + product.template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + product.category.form.inherit.sf + product.category + + + + + + + + + + product.template.stock.property.form.inherit + product.template + + + + + + + + + + + + + + + + + + + + + + + + + stock.group_stock_user,product.group_stock_packaging + + + + + \ No newline at end of file diff --git a/sf_manufacturing_orders/__manifest__.py b/sf_manufacturing_orders/__manifest__.py index b409bc12..13d242d3 100644 --- a/sf_manufacturing_orders/__manifest__.py +++ b/sf_manufacturing_orders/__manifest__.py @@ -10,13 +10,17 @@ """, 'category': '', 'website': 'https://www.sf.jikimo.com', - 'depends': ['mrp', 'sf_base', 'sf_route_workcenter'], + 'depends': ['mrp', 'sf_base', 'maintenance'], 'data': [ - 'views/sf_production.xml', - 'views/mrp_routing_workcenter_view.xml' - - - + 'security/group_security.xml', + 'security/ir.model.access.csv', + 'views/mrp_maintenance_views.xml', + 'views/mrp_routing_workcenter_view.xml', + 'views/mrp_workcenter_views.xml', + 'views/mrp_workorder_view.xml', + 'views/tray_view.xml', + 'views/model_type_view.xml', + 'report/tray_report.xml' ], 'demo': [ ], diff --git a/sf_manufacturing_orders/models/__init__.py b/sf_manufacturing_orders/models/__init__.py index 38af3ba7..8f632de7 100644 --- a/sf_manufacturing_orders/models/__init__.py +++ b/sf_manufacturing_orders/models/__init__.py @@ -1,4 +1,13 @@ -from . import sf_production +from . import tray +from . import mrp_production +from . import mrp_workcenter +from . import mrp_maintenance +from . import mrp_routing_workcenter from . import mrp_workorder +from . import model_type +from . import stock + + + diff --git a/sf_manufacturing_orders/models/model_type.py b/sf_manufacturing_orders/models/model_type.py new file mode 100644 index 00000000..ecc4b7af --- /dev/null +++ b/sf_manufacturing_orders/models/model_type.py @@ -0,0 +1,33 @@ +from odoo import api, fields, models + + +class ModelType(models.Model): + _name = 'sf.model.type' + _description = '模型类型' + + name = fields.Char('名称') + embryo_tolerance = fields.Integer('胚料的容余量') + routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板') + + +class ModelTypeRoutingSort(models.Model): + _name = 'sf.model.type.routing.sort' + _description = '工序排序' + + sequence = fields.Integer('Sequence') + route_workcenter_id = fields.Many2one('mrp.routing.workcenter') + is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat') + routing_type = fields.Selection([ + ('获取CNC加工程序', '获取CNC加工程序'), + ('装夹', '装夹'), + ('前置三元定位检测', '前置三元定位检测'), + ('CNC加工', 'CNC加工'), + ('后置三元质量检测', '后置三元质量检测'), + ('解除装夹', '解除装夹'), + ], string="工序类型", related='route_workcenter_id.routing_type') + workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids') + model_type_id = fields.Many2one('sf.model.type') + + _sql_constraints = [ + ('route_model_type_uniq', 'unique (route_workcenter_id,model_type_id)', '工序不能重复!') + ] diff --git a/sf_manufacturing_orders/models/mrp_maintenance.py b/sf_manufacturing_orders/models/mrp_maintenance.py new file mode 100644 index 00000000..afca09a2 --- /dev/null +++ b/sf_manufacturing_orders/models/mrp_maintenance.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from odoo import api, fields, models, _ +from dateutil.relativedelta import relativedelta + + +class MaintenanceEquipment(models.Model): + _inherit = "maintenance.equipment" + _check_company_auto = True + + expected_mtbf = fields.Integer(string='Expected MTBF', help='Expected Mean Time Between Failure') + mtbf = fields.Integer(compute='_compute_maintenance_request', string='MTBF', + help='Mean Time Between Failure, computed based on done corrective maintenances.') + mttr = fields.Integer(compute='_compute_maintenance_request', string='MTTR', help='Mean Time To Repair') + estimated_next_failure = fields.Date(compute='_compute_maintenance_request', + string='Estimated time before next failure (in days)', + help='Computed as Latest Failure Date + MTBF') + latest_failure_date = fields.Date(compute='_compute_maintenance_request', string='Latest Failure Date') + workcenter_id = fields.Many2one( + 'mrp.workcenter', string='Work Center', check_company=True) + + @api.depends('effective_date', 'maintenance_ids.stage_id', 'maintenance_ids.close_date', + 'maintenance_ids.request_date') + def _compute_maintenance_request(self): + for equipment in self: + maintenance_requests = equipment.maintenance_ids.filtered( + lambda x: x.maintenance_type == 'corrective' and x.stage_id.done) + mttr_days = 0 + for maintenance in maintenance_requests: + if maintenance.stage_id.done and maintenance.close_date: + mttr_days += (maintenance.close_date - maintenance.request_date).days + equipment.mttr = len(maintenance_requests) and (mttr_days / len(maintenance_requests)) or 0 + maintenance = maintenance_requests.sorted(lambda x: x.request_date) + if len(maintenance) >= 1: + equipment.mtbf = (maintenance[-1].request_date - equipment.effective_date).days / len(maintenance) + equipment.latest_failure_date = maintenance and maintenance[-1].request_date or False + if equipment.mtbf: + equipment.estimated_next_failure = equipment.latest_failure_date + relativedelta(days=equipment.mtbf) + else: + equipment.estimated_next_failure = False + + def button_mrp_workcenter(self): + self.ensure_one() + return { + 'name': _('work centers'), + 'view_mode': 'form', + 'res_model': 'mrp.workcenter', + 'view_id': self.env.ref('mrp.mrp_workcenter_view').id, + 'type': 'ir.actions.act_window', + 'res_id': self.workcenter_id.id, + 'context': { + 'default_company_id': self.company_id.id + } + } + + +class MaintenanceRequest(models.Model): + _inherit = "maintenance.request" + _check_company_auto = True + + production_id = fields.Many2one( + 'mrp.production', string='Manufacturing Order', check_company=True) + workorder_id = fields.Many2one( + 'mrp.workorder', string='Work Order', check_company=True) + production_company_id = fields.Many2one(string='Production Company', related='production_id.company_id') + company_id = fields.Many2one(domain="[('id', '=?', production_company_id)]") diff --git a/sf_manufacturing_orders/models/mrp_production.py b/sf_manufacturing_orders/models/mrp_production.py new file mode 100644 index 00000000..9b5ea04e --- /dev/null +++ b/sf_manufacturing_orders/models/mrp_production.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models + + +class MrpProduction(models.Model): + _inherit = 'mrp.production' + _description = "制造订单" + + tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘") + maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests") + request_ids = fields.One2many('maintenance.request', 'production_id') + + @api.depends('request_ids') + def _compute_maintenance_count(self): + for production in self: + production.maintenance_count = len(production.request_ids) + + def button_maintenance_req(self): + self.ensure_one() + return { + 'name': _('New Maintenance Request'), + 'view_mode': 'form', + 'res_model': 'maintenance.request', + 'type': 'ir.actions.act_window', + 'context': { + 'default_company_id': self.company_id.id, + 'default_production_id': self.id, + }, + 'domain': [('production_id', '=', self.id)], + } + + def open_maintenance_request_mo(self): + self.ensure_one() + action = { + 'name': _('Maintenance Requests'), + 'view_mode': 'kanban,tree,form,pivot,graph,calendar', + 'res_model': 'maintenance.request', + 'type': 'ir.actions.act_window', + 'context': { + 'default_company_id': self.company_id.id, + 'default_production_id': self.id, + }, + 'domain': [('production_id', '=', self.id)], + } + if self.maintenance_count == 1: + production = self.env['maintenance.request'].search([('production_id', '=', self.id)]) + action['view_mode'] = 'form' + action['res_id'] = production.id + return action + + def action_generate_serial(self): + self.ensure_one() + self.lot_producing_id = self.env['stock.production.lot'].create({ + 'product_id': self.product_id.id, + 'company_id': self.company_id.id, + 'name': self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id) or self.env[ + 'ir.sequence'].next_by_code('stock.lot.serial'), + }) + if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids: + self.move_finished_ids.filtered( + lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id + if self.product_id.tracking == 'serial': + self._set_qty_producing() + + # 重载根据工序生成工单的程序:如果产品BOM中没有工序时, + # 根据产品对应的模板类型中工序,去生成工单; + # CNC加工工序的选取规则: + # 如果自动报价有带过来预分配的机床, + # 则根据设备找到工作中心;否则采用前面描述的工作中心分配机制; + # 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心; + + def _create_workorder(self): + for production in self: + if not production.bom_id or not production.product_id: + continue + workorders_values = [] + + product_qty = production.product_uom_id._compute_quantity(production.product_qty, + production.bom_id.product_uom_id) + exploded_boms, dummy = production.bom_id.explode(production.product_id, + product_qty / production.bom_id.product_qty, + picking_type=production.bom_id.picking_type_id) + + for bom, bom_data in exploded_boms: + # If the operations of the parent BoM and phantom BoM are the same, don't recreate work orders. + if not (bom.operation_ids and (not bom_data['parent_line'] or bom_data[ + 'parent_line'].bom_id.operation_ids != bom.operation_ids)): + continue + for operation in bom.operation_ids: + if operation._skip_operation_line(bom_data['product']): + continue + workorders_values += [{ + 'name': operation.name, + 'production_id': production.id, + 'workcenter_id': operation.workcenter_id.id, + 'product_uom_id': production.product_uom_id.id, + 'operation_id': operation.id, + 'state': 'pending', + }] + # 根据加工面板的面数及对应的工序模板生成工单 + i = 0 + processing_panel_len = len(production.product_id.model_processing_panel.split(',')) + for k in (production.product_id.model_processing_panel.split(',')): + routingworkcenter = self.env['sf.model.type.routing.sort'].search( + [('model_type_id', '=', production.product_id.model_type_id.id)], + order='sequence asc' + ) + i += 1 + for route in routingworkcenter: + if i == 1 and route.routing_type == '获取CNC加工程序': + workorders_values.append( + self.env['mrp.workorder'].json_workorder_str('', production, route)) + if route.is_repeat == True: + workorders_values.append( + self.env['mrp.workorder'].json_workorder_str(k, production, route)) + if i == processing_panel_len and route.routing_type == '解除装夹': + workorders_values.append( + self.env['mrp.workorder'].json_workorder_str(k, production, route)) + production.workorder_ids = workorders_values + for workorder in production.workorder_ids: + workorder.duration_expected = workorder._get_duration_expected() + + def create_production1_values(self, production): + production_values_str = {'origin': production.origin, + 'product_id': production.product_id.id, + 'product_description_variants': production.product_description_variants, + 'product_qty': production.product_qty, + 'product_uom_id': production.product_uom_id.id, + 'location_src_id': production.location_src_id.id, + 'location_dest_id': production.location_dest_id.id, + 'bom_id': production.bom_id.id, + 'date_deadline': production.date_deadline, + 'date_planned_start': production.date_planned_start, + 'date_planned_finished': production.date_planned_finished, + 'procurement_group_id': False, + 'propagate_cancel': production.propagate_cancel, + 'orderpoint_id': production.orderpoint_id.id, + 'picking_type_id': production.picking_type_id.id, + 'company_id': production.company_id.id, + 'move_dest_ids': production.move_dest_ids.ids, + 'user_id': production.user_id.id} + return production_values_str + + def _reset_work_order_sequence1(self, k): + for rec in self: + current_sequence = 1 + for work in rec.workorder_ids: + work.sequence = current_sequence + current_sequence += 1 + + def _create_workorder1(self, k): + for production in self: + if not production.bom_id or not production.product_id: + continue + workorders_values = [] + + product_qty = production.product_uom_id._compute_quantity(production.product_qty, + production.bom_id.product_uom_id) + exploded_boms, dummy = production.bom_id.explode(production.product_id, + product_qty / production.bom_id.product_qty, + picking_type=production.bom_id.picking_type_id) + + for bom, bom_data in exploded_boms: + # If the operations of the parent BoM and phantom BoM are the same, don't recreate work orders. + if not (bom.operation_ids and (not bom_data['parent_line'] or bom_data[ + 'parent_line'].bom_id.operation_ids != bom.operation_ids)): + continue + for operation in bom.operation_ids: + if operation._skip_operation_line(bom_data['product']): + continue + workorders_values += [{ + 'name': operation.name, + 'production_id': production.id, + 'workcenter_id': operation.workcenter_id.id, + 'product_uom_id': production.product_uom_id.id, + 'operation_id': operation.id, + 'state': 'pending', + }] + # 根据加工面板的面数及对应的工序模板生成工单 + i = 0 + production.product_id.model_processing_panel = k + processing_panel_len = len(k) + for k in (production.product_id.model_processing_panel.split(',')): + routingworkcenter = self.env['sf.model.type.routing.sort'].search( + [('model_type_id', '=', production.product_id.model_type_id.id)], + + order='sequence asc' + ) + i += 1 + for route in routingworkcenter: + + if route.routing_type == '后置三元质量检测': + workorders_values.append( + self.env['mrp.workorder'].json_workorder_str1(k, production, route) + ) + if route.routing_type == 'CNC加工': + workorders_values.append( + self.env['mrp.workorder'].json_workorder_str1(k, production, route)) + + production.workorder_ids = workorders_values + for workorder in production.workorder_ids: + workorder.duration_expected = workorder._get_duration_expected() + + def _create_workorder2(self, k): + res = self._create_workorder1(k) + self._reset_work_order_sequence1(k) + return res + + def _reset_work_order_sequence(self): + for rec in self: + current_sequence = 1 + for work in rec.workorder_ids: + work.sequence = current_sequence + current_sequence += 1 + + def _create_workorder(self): + res = super()._create_workorder() + self._reset_work_order_sequence() + return res diff --git a/sf_base/models/process.py b/sf_manufacturing_orders/models/mrp_routing_workcenter.py similarity index 90% rename from sf_base/models/process.py rename to sf_manufacturing_orders/models/mrp_routing_workcenter.py index ec793560..8f533a68 100644 --- a/sf_base/models/process.py +++ b/sf_manufacturing_orders/models/mrp_routing_workcenter.py @@ -1,15 +1,6 @@ from odoo import fields, models, api -class ModelType(models.Model): - _name = 'sf.model.type' - _description = '模型类型' - - name = fields.Char('名称') - embryo_tolerance = fields.Integer('胚料的容余量') - routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板') - - class ResMrpRoutingWorkcenter(models.Model): _inherit = 'mrp.routing.workcenter' diff --git a/sf_manufacturing_orders/models/mrp_workcenter.py b/sf_manufacturing_orders/models/mrp_workcenter.py new file mode 100644 index 00000000..8e446f7c --- /dev/null +++ b/sf_manufacturing_orders/models/mrp_workcenter.py @@ -0,0 +1,60 @@ +from odoo import api, fields, models, _ +from collections import defaultdict +from odoo.addons.resource.models.resource import Intervals + + +class ResWorkcenter(models.Model): + _inherit = "mrp.workcenter" + machine_tool_id = fields.Many2one('mrs.machine_tool', '机床') + + equipment_ids = fields.One2many( + 'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment", + check_company=True) + + def action_work_order(self): + if not self.env.context.get('desktop_list_view', False): + action = self.env["ir.actions.actions"]._for_xml_id("sf_route_workcenter.mrp_workorder_action_tablet") + return action + else: + return super(MrpWorkcenter, self).action_work_order() + + def _get_unavailability_intervals(self, start_datetime, end_datetime): + res = super(MrpWorkcenter, self)._get_unavailability_intervals(start_datetime, end_datetime) + if not self: + return res + sql = """ + SELECT workcenter_id, ARRAY_AGG((schedule_date || '|' || schedule_date + INTERVAL '1h' * duration)) as date_intervals + FROM maintenance_request + LEFT JOIN maintenance_equipment + ON maintenance_request.equipment_id = maintenance_equipment.id + WHERE + schedule_date IS NOT NULL + AND duration IS NOT NULL + AND equipment_id IS NOT NULL + AND maintenance_equipment.workcenter_id IS NOT NULL + AND maintenance_equipment.workcenter_id IN %s + AND (schedule_date, schedule_date + INTERVAL '1h' * duration) OVERLAPS (%s, %s) + GROUP BY maintenance_equipment.workcenter_id; + """ + self.env.cr.execute(sql, [tuple(self.ids), fields.Datetime.to_string(start_datetime.astimezone()), + fields.Datetime.to_string(end_datetime.astimezone())]) + res_maintenance = defaultdict(list) + for wc_row in self.env.cr.dictfetchall(): + res_maintenance[wc_row.get('workcenter_id')] = [ + [fields.Datetime.to_datetime(i) for i in intervals.split('|')] + for intervals in wc_row.get('date_intervals') + ] + + for wc_id in self.ids: + intervals_previous_list = [(s.timestamp(), e.timestamp(), self.env['maintenance.request']) for s, e in + res[wc_id]] + intervals_maintenances_list = [(m[0].timestamp(), m[1].timestamp(), self.env['maintenance.request']) for m + in res_maintenance[wc_id]] + final_intervals_wc = Intervals(intervals_previous_list + intervals_maintenances_list) + res[wc_id] = [(datetime.fromtimestamp(s), datetime.fromtimestamp(e)) for s, e, _ in final_intervals_wc] + return res + + +class ResWorkcenterProductivity(models.Model): + _inherit = 'mrp.workcenter.productivity' + workcenter_id = fields.Many2one('mrp.workcenter', required=False) diff --git a/sf_manufacturing_orders/models/mrp_workorder.py b/sf_manufacturing_orders/models/mrp_workorder.py index c93f50d0..28fe31db 100644 --- a/sf_manufacturing_orders/models/mrp_workorder.py +++ b/sf_manufacturing_orders/models/mrp_workorder.py @@ -1,17 +1,13 @@ from odoo import api, fields, models, SUPERUSER_ID, _ -class ResWorkcenterProductivity(models.Model): - _inherit = 'mrp.workcenter.productivity' - workcenter_id = fields.Many2one('mrp.workcenter', required=False) - - class ResMrpWorkOrder(models.Model): _inherit = 'mrp.workorder' - + _order = 'sequence' workcenter_id = fields.Many2one('mrp.workcenter', required=False) processing_panel = fields.Char('加工面') + sequence = fields.Integer(string='工序') routing_type = fields.Selection([ ('获取CNC加工程序', '获取CNC加工程序'), ('装夹', '装夹'), @@ -20,6 +16,78 @@ class ResMrpWorkOrder(models.Model): ('后置三元质量检测', '后置三元质量检测'), ('解除装夹', '解除装夹'), ], string="工序类型") + material_center_point = fields.Char(string='配料中心点') + X1_axis = fields.Float(string='Lx1', default=0) + Y1_axis = fields.Float(string='Ly1', default=0) + Z1_axis = fields.Float(string='Lz1', default=0) + X2_axis = fields.Float(string='Lx2', default=0) + Y2_axis = fields.Float(string='Ly2', default=0) + Z2_axis = fields.Float(string='Lz2', default=0) + X3_axis = fields.Float(string='Fx3', default=0) + Y3_axis = fields.Float(string='Fy3', default=0) + Z3_axis = fields.Float(string='Fz3', default=0) + X4_axis = fields.Float(string='Fx4', default=0) + Y4_axis = fields.Float(string='Fy4', default=0) + Z4_axis = fields.Float(string='Fz4', default=0) + X5_axis = fields.Float(string='Rx5', default=0) + Y5_axis = fields.Float(string='Ry5', default=0) + Z5_axis = fields.Float(string='Rz5', default=0) + X6_axis = fields.Float(string='Rx6', default=0) + Y6_axis = fields.Float(string='Ry6', default=0) + Z6_axis = fields.Float(string='Rz6', default=0) + X7_axis = fields.Float(string='Bx7', default=0) + Y7_axis = fields.Float(string='By7', default=0) + Z7_axis = fields.Float(string='Bz7', default=0) + X8_axis = fields.Float(string='Bx8', default=0) + Y8_axis = fields.Float(string='By8', default=0) + Z8_axis = fields.Float(string='Bz8', default=0) + X9_axis = fields.Float(string='Uz9', default=0) + Y9_axis = fields.Float(string='Uz9', default=0) + Z9_axis = fields.Float(string='Uz9', default=0) + X10_axis = fields.Float(string='Uz10', default=0) + Y10_axis = fields.Float(string='Uz10', default=0) + Z10_axis = fields.Float(string='Uz10', default=0) + X_deviation_angle = fields.Integer(string="X轴偏差度", default=0) + test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果") + cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工") + tray_code = fields.Char(string="托盘") + + # 计算配料中心点和与x轴倾斜度方法 + def getcenter(self): + x1 = self.X1_axis + x2 = self.X2_axis + x3 = self.X3_axis + x4 = self.X4_axis + x5 = self.X5_axis + x6 = self.X6_axis + x7 = self.X7_axis + x8 = self.X8_axis + y1 = self.Y1_axis + y2 = self.Y2_axis + y3 = self.Y3_axis + y4 = self.Y4_axis + y5 = self.Y5_axis + y6 = self.Y6_axis + y7 = self.Y7_axis + y8 = self.Y8_axis + z1 = self.Z9_axis + x0 = ((x3 - x4) * (x2 * y1 - x1 * y2) - (x1 - x2) * (x4 * y3 - x3 * y4)) / ( + (x3 - x4) * (y1 - y2) - (x1 - x2) * (y3 - y4)) + y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / ( + (y3 - y4) * (x1 - x2) - (y1 - y2) * (x3 - x4)) + x1 = ((x7 - x8) * (x6 * y5 - x5 * y6) - (x5 - x6) * (x8 * y7 - x7 * y8)) / ( + (x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8)); + y1 = ((y7 - y8) * (y6 * x5 - y5 * x6) - (y5 - y6) * (y8 * x7 - y7 * x8)) / ( + (y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8)) + x = (x0 + x1) / 2 + y = (y0 + y1) / 2 + z = z1 / 2 + + jd = math.atan2((x5 - x6), (y5 - y6)) + jdz = jd * 180 / math.pi + print("(%.2f,%.2f)" % (x, y)) + self.material_center_point = ("(%.2f,%.2f,%.2f)" % (x, y, z)) + self.X_deviation_angle = jdz def json_workorder_str(self, k, production, route): workorders_values_str = [0, '', { @@ -37,4 +105,221 @@ class ResMrpWorkOrder(models.Model): }] return workorders_values_str + # 工作中心看板按钮 + def button_maintenance_req(self): + self.ensure_one() + return { + 'name': _('New Maintenance Request'), + 'view_mode': 'form', + 'views': [(self.env.ref('mrp_maintenance.maintenance_request_view_form_inherit_mrp').id, 'form')], + 'res_model': 'maintenance.request', + 'type': 'ir.actions.act_window', + 'context': { + 'default_company_id': self.company_id.id, + 'default_workorder_id': self.id, + 'default_production_id': self.production_id.id, + 'discard_on_footer_button': True, + }, + 'target': 'new', + 'domain': [('workorder_id', '=', self.id)] + } + # 扫码绑定托盘方法 + def gettray(self): + if self.tray_code != False: + values = self.env['sf.tray'].search([("code", "=", self.tray_code)]) + if values: + if values.state == "占用": + raise ValidationError('该托盘已占用') + if values.state == "报损": + raise ValidationError('该托盘已损坏') + else: + values.update({ + 'workorder_id': self, + 'production_id': self.production_id, + 'state': '占用', + }) + else: + raise ValidationError('该托盘编码已失效') + else: + return "" + + # 解除托盘绑定 + def unbindtray(self): + tray = self.env['sf.tray'].search([("production_id", "=", self.production_id.id)]) + if tray: + tray.unclamp() + + return "" + + def recreateManufacturingOrWorkerOrder(self): + """ + 重新生成制造订单或者重新生成工单 + """ + if self.test_results == '报废': + values = self.env['mrp.production'].create_production1_values(self.production_id) + productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company( + self.production_id.company_id).create( + values) + self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) + self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) + productions._create_workorder() + productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \ + ( + p.move_dest_ids.procure_method != 'make_to_order' and not p.move_raw_ids and not p.workorder_ids)).action_confirm() + + for production in productions: + origin_production = production.move_dest_ids and production.move_dest_ids[ + 0].raw_material_production_id or False + orderpoint = production.orderpoint_id + if orderpoint and orderpoint.create_uid.id == SUPERUSER_ID and orderpoint.trigger == 'manual': + production.message_post( + body=_('This production order has been created from Replenishment Report.'), + message_type='comment', + subtype_xmlid='mail.mt_note') + elif orderpoint: + production.message_post_with_view( + 'mail.message_origin_link', + values={'self': production, 'origin': orderpoint}, + subtype_id=self.env.ref('mail.mt_note').id) + elif origin_production: + production.message_post_with_view( + 'mail.message_origin_link', + values={'self': production, 'origin': origin_production}, + subtype_id=self.env.ref('mail.mt_note').id) + if self.test_results == '返工': + productions = self.production_id + self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) + self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) + productions._create_workorder2(self.processing_panel) + else: + return True + + # cnc程序获取 + def fetchCNC(self): + res = [{'model_code': self.product_id.barcode, 'production_no': self.production_id.name, + 'machine_tool_code': self.workcenter_id.machine_tool_id.code, + 'material_code': self.env['mrs.production.materials'].search( + [('id', '=', self.product_id.materials_id.id)]).materials_no, + 'material_type_code': self.env['mrs.materials.model'].search( + [('id', '=', self.product_id.materials_type_id.id)]).materials_no, + 'embryo_long': self.product_id.bom_ids.bom_line_ids.product_id.long, + 'embryo_height': self.product_id.bom_ids.bom_line_ids.product_id.height, + 'embryo_width': self.product_id.bom_ids.bom_line_ids.product_id.width + # 'factory_code': self.env.user.company_id.partner_id. + }] + configsettings = self.env['res.config.settings'].get_values() + config_header = Common.get_headers(self, configsettings['token'], configsettings['mrs_secret_key']) + url = '/api/intelligent_programming/create' + config_url = configsettings['mrs_url'] + url + res_str = json.dumps(res) + ret = requests.post(config_url, json={"result": res_str}, data=None, headers=config_header) + ret = ret.json() + result = json.loads(ret['result']) + if result['status'] == 1: + return self.write({'state': 'progress'}) + + def json_workorder_str1(self, k, production, route): + workorders_values_str = [0, '', { + 'product_uom_id': production.product_uom_id.id, + 'qty_producing': 0, + 'operation_id': False, + 'name': route.route_workcenter_id.name, + 'processing_panel': k, + 'routing_type': route.routing_type, + 'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids), + 'date_planned_start': False, + 'date_planned_finished': False, + 'duration_expected': 60, + 'duration': 0 + }] + return workorders_values_str + + # 重写工单开始按钮方法 + def button_start(self): + if self.state == 'waiting': + self.ensure_one() + if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)): + return True + # As button_start is automatically called in the new view + if self.state in ('done', 'cancel'): + return True + + if self.product_tracking == 'serial': + self.qty_producing = 1.0 + else: + self.qty_producing = self.qty_remaining + + self.env['mrp.workcenter.productivity'].create( + self._prepare_timeline_vals(self.duration, datetime.now()) + ) + if self.production_id.state != 'progress': + self.production_id.write({ + 'date_start': datetime.now(), + }) + if self.state == 'progress': + return True + start_date = datetime.now() + vals = { + 'state': 'progress', + 'date_start': start_date, + } + if not self.leave_id: + leave = self.env['resource.calendar.leaves'].create({ + 'name': self.display_name, + 'calendar_id': self.workcenter_id.resource_calendar_id.id, + 'date_from': start_date, + 'date_to': start_date + relativedelta(minutes=self.duration_expected), + 'resource_id': self.workcenter_id.resource_id.id, + 'time_type': 'other' + }) + vals['leave_id'] = leave.id + return self.write(vals) + else: + if self.date_planned_start > start_date: + vals['date_planned_start'] = start_date + if self.date_planned_finished and self.date_planned_finished < start_date: + vals['date_planned_finished'] = start_date + return self.write(vals) + else: + raise ValidationError(_('请先完成上一步工单')) + + +class CNCprocessing(models.Model): + _name = 'sf.cnc.processing' + _description = "CNC加工" + + cnc_id = fields.Many2one('ir.attachment') + FNo = fields.Char(string="序号") + FPGName = fields.Char(string="程序名") + FKnifeName = fields.Char(string="刀具名称") + FDNo = fields.Char(string="刀号") + FWorkType = fields.Char(string="加工类型") + FXY = fields.Char(string="余量_X/Y") + FZ = fields.Char(string="余量_Z") + FJGSD = fields.Char(string="加工深度(Z)") + FSCCD = fields.Char(string="刀具伸出长度") + FDJSpec = fields.Char(string="刀柄型号") + FJGDate = fields.Datetime(string="预计加工时间") + FComment = fields.Char(string="备注") + workorder_id = fields.Many2one('mrp.workorder', string="工单") + + # mrs下发编程单创建CNC加工 + def CNCprocessing_create(self, obj): + workorder = self.env['mrp.workorder'].search([('production_id', '=', obj['manufacturing_order_no']), + ('processing_panel', '=', obj['processing_panel']), + ('routing_type', '=', 'CNC加工')]) + self.env['sf.cnc.processing'].create({ + 'workorder_id': workorder.id, + 'FNo': obj['sequence_number'], + 'FPGName': obj['program_name'], + 'FKnifeName': obj['cutting_tool_name'], + 'FDNo': obj['cutting_tool_no'], + 'FWorkType': obj['processing_type'], + 'FXY': obj['margin_x_y'], + 'FZ': obj['margin_z'], + 'FJGSD': obj['depth_of_processing_z'], + 'FSCCD': obj['cutting_tool_extension_length'], + 'FDJSpec': obj['cutting_tool_handle_type'], + # 'FJGDate': obj[''] + }) diff --git a/sf_manufacturing_orders/models/sf_production.py b/sf_manufacturing_orders/models/stock.py similarity index 71% rename from sf_manufacturing_orders/models/sf_production.py rename to sf_manufacturing_orders/models/stock.py index ae2db189..c31b3e61 100644 --- a/sf_manufacturing_orders/models/sf_production.py +++ b/sf_manufacturing_orders/models/stock.py @@ -7,96 +7,6 @@ from re import split as regex_split from odoo import SUPERUSER_ID, _, api, fields, models, registry from odoo.tools import float_compare, float_is_zero, html_escape -_logger = logging.getLogger(__name__) - - -class ProductTemplate(models.Model): - _inherit = 'product.template' - _description = '产品模板' - - single_manufacturing = fields.Boolean(string="单个制造") - - -class ProcurementGroup(models.Model): - _inherit = 'procurement.group' - - -class MrpProduction(models.Model): - _inherit = 'mrp.production' - _description = "制造订单" - - def action_generate_serial(self): - self.ensure_one() - self.lot_producing_id = self.env['stock.production.lot'].create({ - 'product_id': self.product_id.id, - 'company_id': self.company_id.id, - 'name': self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id) or self.env[ - 'ir.sequence'].next_by_code('stock.lot.serial'), - }) - if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids: - self.move_finished_ids.filtered( - lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id - if self.product_id.tracking == 'serial': - self._set_qty_producing() - - # 重载根据工序生成工单的程序:如果产品BOM中没有工序时, - # 根据产品对应的模板类型中工序,去生成工单; - # CNC加工工序的选取规则: - # 如果自动报价有带过来预分配的机床, - # 则根据设备找到工作中心;否则采用前面描述的工作中心分配机制; - # 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心; - - def _create_workorder(self): - for production in self: - if not production.bom_id or not production.product_id: - continue - workorders_values = [] - - product_qty = production.product_uom_id._compute_quantity(production.product_qty, - production.bom_id.product_uom_id) - exploded_boms, dummy = production.bom_id.explode(production.product_id, - product_qty / production.bom_id.product_qty, - picking_type=production.bom_id.picking_type_id) - - for bom, bom_data in exploded_boms: - # If the operations of the parent BoM and phantom BoM are the same, don't recreate work orders. - if not (bom.operation_ids and (not bom_data['parent_line'] or bom_data[ - 'parent_line'].bom_id.operation_ids != bom.operation_ids)): - continue - for operation in bom.operation_ids: - if operation._skip_operation_line(bom_data['product']): - continue - workorders_values += [{ - 'name': operation.name, - 'production_id': production.id, - 'workcenter_id': operation.workcenter_id.id, - 'product_uom_id': production.product_uom_id.id, - 'operation_id': operation.id, - 'state': 'pending', - }] - # 根据加工面板的面数及对应的工序模板生成工单 - i = 0 - processing_panel_len = len(production.product_id.model_processing_panel.split(',')) - for k in (production.product_id.model_processing_panel.split(',')): - routingworkcenter = self.env['sf.model.type.routing.sort'].search( - [('model_type_id', '=', production.product_id.model_type_id.id)], - order='sequence asc' - ) - i += 1 - for route in routingworkcenter: - if i == 1 and route.routing_type == '获取CNC加工程序': - workorders_values.append( - self.env['mrp.workorder'].json_workorder_str('', production, route)) - if route.is_repeat == True: - workorders_values.append( - self.env['mrp.workorder'].json_workorder_str(k, production, route)) - if i == processing_panel_len and route.routing_type == '解除装夹': - workorders_values.append( - self.env['mrp.workorder'].json_workorder_str(k, production, route)) - production.workorder_ids = workorders_values - for workorder in production.workorder_ids: - workorder.duration_expected = workorder._get_duration_expected() - class StockRule(models.Model): _inherit = 'stock.rule' @@ -277,7 +187,7 @@ class ProductionLot(models.Model): def generate_lot_names1(self, display_name, first_lot, count): """Generate `lot_names` from a string.""" if first_lot.__contains__(display_name): - first_lot = first_lot[(len(display_name)+1):] + first_lot = first_lot[(len(display_name) + 1):] # We look if the first lot contains at least one digit. caught_initial_number = regex_findall(r"\d+", first_lot) @@ -313,4 +223,4 @@ class ProductionLot(models.Model): if last_serial: return self.env['stock.production.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[ 1] - return "%s-%03d" %(product.display_name,1) + return "%s-%03d" % (product.display_name, 1) diff --git a/sf_manufacturing_orders/models/tray.py b/sf_manufacturing_orders/models/tray.py new file mode 100644 index 00000000..08906217 --- /dev/null +++ b/sf_manufacturing_orders/models/tray.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Part of SmartGo. See LICENSE file for full copyright and licensing details. +import base64 +from io import BytesIO +from odoo import api, fields, models, SUPERUSER_ID, _ +from pystrich.code128 import Code128Encoder + + +class Tray(models.Model): + _inherit = 'sf.tray' + _description = '托盘' + qr_image = fields.Binary(string="托盘二维码", compute='compute_qr_image') + production_id = fields.Many2one('mrp.production', string='制造订单', + related='workorder_id.production_id' + ) + workorder_id = fields.Many2one('mrp.workorder', string="工单" + ) + + @api.onchange('production_id') + def updateTrayState(self): + + if self.workorder_id != False: + self.state = '占用' + else: + self.state = '空闲' + + def unclamp(self): + self.workorder_id = False + self.production_id = False + self.state = '空闲' + + @api.depends('code') + def compute_qr_image(self): + for item in self: + if not item.code: + item.qr_image = False + continue + # 根据code动态生成二维码图片 + # qr = qrcode.QRCode( + # version=1, + # error_correction=qrcode.constants.ERROR_CORRECT_L, + # box_size=10, + # border=4, + # ) + # qr.add_data(item.code) + # qr.make(fit=True) + # img = qr.make_image() + # 生成条形码文件 + # bar = barcode.get("ean13", "123456789102", writer=ImageWriter()) + # a = bar.get_fullcode() + # b = bar.save('occ') + # 生成条形码图片 + partner_encoder = Code128Encoder(item.code) + # 转换bytes流 + temp = BytesIO() + partner_encoder.save(temp) + # img.save(temp, format='PNG') + qr_image = base64.b64encode(temp.getvalue()) + item.qr_image = qr_image diff --git a/sf_route_workcenter/report/sf_tray_report.xml b/sf_manufacturing_orders/report/tray_report.xml similarity index 85% rename from sf_route_workcenter/report/sf_tray_report.xml rename to sf_manufacturing_orders/report/tray_report.xml index 0df4a183..184127ba 100644 --- a/sf_route_workcenter/report/sf_tray_report.xml +++ b/sf_manufacturing_orders/report/tray_report.xml @@ -21,11 +21,11 @@ 打印条形码 sf.tray qweb-pdf - sf_route_workcenter.sf_tray_template - sf_route_workcenter.sf_tray_template + sf_manufacturing_orders.sf_tray_template + sf_manufacturing_orders.sf_tray_template report - + @@ -39,7 +39,6 @@ t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:350px;height:60px'}"/>
- @@ -51,12 +50,11 @@ 打印产品信息 mrp.workorder qweb-pdf - sf_route_workcenter.sf_tray_template1 - sf_route_workcenter.sf_tray_template1 + sf_manufacturing_orders.sf_tray_template1 + sf_manufacturing_orders.sf_tray_template1 report - - +
@@ -68,16 +66,10 @@
- -
- - - - diff --git a/sf_manufacturing_orders/security/group_security.xml b/sf_manufacturing_orders/security/group_security.xml new file mode 100644 index 00000000..c32538c7 --- /dev/null +++ b/sf_manufacturing_orders/security/group_security.xml @@ -0,0 +1,27 @@ + + + + 员工 + 1 + + + + 管理 + 2 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sf_manufacturing_orders/security/ir.model.access.csv b/sf_manufacturing_orders/security/ir.model.access.csv new file mode 100644 index 00000000..f2527022 --- /dev/null +++ b/sf_manufacturing_orders/security/ir.model.access.csv @@ -0,0 +1,9 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_sf_cnc_processing,sf_cnc_processing,model_sf_cnc_processing,base.group_user,1,1,1,1 +access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1 +access_sf_model_type_routing_sort,sf_model_type_routing_sort,model_sf_model_type_routing_sort,base.group_user,1,1,1,1 + + + + + diff --git a/sf_manufacturing_orders/views/model_type_view.xml b/sf_manufacturing_orders/views/model_type_view.xml new file mode 100644 index 00000000..58fd70be --- /dev/null +++ b/sf_manufacturing_orders/views/model_type_view.xml @@ -0,0 +1,73 @@ + + + + #------------------模型类型------------------ + + + search.sf.model.type + sf.model.type + + + + + + + + + tree.sf.model.type + sf.model.type + + + + + + + + + form.sf.model.type + sf.model.type + +
+ + + + + + + + + + + + + + + +
+
+
+ + + 模型类型 + ir.actions.act_window + sf.model.type + tree,form + +

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

+

+

+
+
+ + +
+
\ No newline at end of file diff --git a/sf_route_workcenter/views/maintenance_views.xml b/sf_manufacturing_orders/views/mrp_maintenance_views.xml similarity index 67% rename from sf_route_workcenter/views/maintenance_views.xml rename to sf_manufacturing_orders/views/mrp_maintenance_views.xml index 28eb251b..3912ae5e 100644 --- a/sf_route_workcenter/views/maintenance_views.xml +++ b/sf_manufacturing_orders/views/mrp_maintenance_views.xml @@ -7,30 +7,35 @@ - + @@ -46,7 +51,9 @@ - + @@ -58,7 +65,9 @@
- ['|', (not workorder_id and 1 or 0, '=', 1), '|', ('workcenter_id', '=', False), ('workcenter_id.order_ids', 'in', workorder_id)] + ['|', (not workorder_id and 1 or 0, '=', 1), '|', ('workcenter_id', '=', + False), ('workcenter_id.order_ids', 'in', workorder_id)] +
@@ -69,27 +78,28 @@ - +
+ id="maintenance.menu_equipment_form" + name="Equipments" + parent="maintenance.menu_maintenance_title" + groups="maintenance.group_equipment_manager,base.group_user" + sequence="2"/> + action="mrp.mrp_workcenter_action" + groups="mrp.group_mrp_routings" + parent="maintenance.menu_equipment_form" + sequence="1"/> + id="menu_equipment_dashboard" + name="Machines & Tools" + parent="maintenance.menu_equipment_form" + action="maintenance.hr_equipment_action" + sequence="2"/> diff --git a/sf_manufacturing_orders/views/mrp_routing_workcenter_view.xml b/sf_manufacturing_orders/views/mrp_routing_workcenter_view.xml index 65fecf10..b854160a 100644 --- a/sf_manufacturing_orders/views/mrp_routing_workcenter_view.xml +++ b/sf_manufacturing_orders/views/mrp_routing_workcenter_view.xml @@ -1,7 +1,6 @@ - #-----------------作业------------------- mrp.routing.workcenter.form.inherit.sf mrp.routing.workcenter @@ -16,63 +15,5 @@ - - #-----------------工单------------------- - - mrp.production.workorder.form.inherit.sf - mrp.workorder - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #-----------------制造订单里的工单------------------- - - mrp.production.workorder.tree.editable.inherit.sf - mrp.workorder - - - - - - - - - #-----------------工作中心------------------- - - mrp.workcenter.form.inherit.sf - mrp.workcenter - - - - - - - \ No newline at end of file diff --git a/sf_route_workcenter/views/mrp_views.xml b/sf_manufacturing_orders/views/mrp_workcenter_views.xml similarity index 79% rename from sf_route_workcenter/views/mrp_views.xml rename to sf_manufacturing_orders/views/mrp_workcenter_views.xml index 6e3f70c6..af177443 100644 --- a/sf_route_workcenter/views/mrp_views.xml +++ b/sf_manufacturing_orders/views/mrp_workcenter_views.xml @@ -1,8 +1,8 @@ - - mrp.workcenter.form.inherit.maintenance + + mrp.workcenter.form.inherit.sf mrp.workcenter @@ -20,6 +20,10 @@ + + + + @@ -46,9 +50,13 @@
- diff --git a/sf_manufacturing_orders/views/mrp_workorder_view.xml b/sf_manufacturing_orders/views/mrp_workorder_view.xml new file mode 100644 index 00000000..e82f71b7 --- /dev/null +++ b/sf_manufacturing_orders/views/mrp_workorder_view.xml @@ -0,0 +1,258 @@ + + + + mrp.production.workorder.tree.editable.inherit.sf + mrp.workorder + + + + + + + + + + + + + Work Orders + ir.actions.act_window + mrp.workorder + kanban,tree,form + + fullscreen + [('state', 'not in', ['done', 'cancel'])] + {'search_default_workcenter_id': active_id} + +

+ No work orders to do! +

+

+ Work orders are operations to do as part of a manufacturing order. + Operations are defined in the bill of materials or added in the manufacturing order directly. +

+

+ Use the table work center control panel to register operations in the shop floor directly. + The tablet provides worksheets for your workers and allow them to scrap products, track time, + launch a maintenance request, perform quality tests, etc. +

+
+
+ + + mrp.production.workorder.form.inherit.sf + mrp.workorder + + + + + + + + + + mrp.production.workorder.tray.form.inherit.sf + mrp.workorder + + + + +
+
+
+ +
+ + + + + + +
+
+
+
+ +
+ + + + + + + + +
左面:
+
+
+
+
+
+
前面:
+
+
+
+
+
+
右面:
+
+
+
+
+
+
后面:
+
+
+
+
+
+
上面:
+
+
+
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + +
+
+
+ + +
+
+
+
+
+
+
diff --git a/sf_manufacturing_orders/views/sf_production.xml b/sf_manufacturing_orders/views/sf_production.xml deleted file mode 100644 index 5968bfb6..00000000 --- a/sf_manufacturing_orders/views/sf_production.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - product.template.stock.property.form.inherit - product.template - - - - - - - - - - - - - - - - - - - - - - - - - - - - stock.group_stock_user,product.group_stock_packaging - - - - - \ No newline at end of file diff --git a/sf_route_workcenter/views/sf_tray_view.xml b/sf_manufacturing_orders/views/tray_view.xml similarity index 100% rename from sf_route_workcenter/views/sf_tray_view.xml rename to sf_manufacturing_orders/views/tray_view.xml diff --git a/sf_mrp_workorder_sequence/README.rst b/sf_mrp_workorder_sequence/README.rst deleted file mode 100644 index a37bd35d..00000000 --- a/sf_mrp_workorder_sequence/README.rst +++ /dev/null @@ -1,89 +0,0 @@ -======================= -MRP Work Order Sequence -======================= - -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github - :target: https://github.com/OCA/manufacture/tree/15.0/mrp_workorder_sequence - :alt: OCA/manufacture -.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_workorder_sequence - :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/129/15.0 - :alt: Try me on Runbot - -|badge1| |badge2| |badge3| |badge4| |badge5| - -Provide a new field sequence on production orders's work orders, that provides -clear information on the process order of those. - -**Table of contents** - -.. contents:: - :local: - -Usage -===== - -Go to any production order with a routing set and check its work orders. - -Bug Tracker -=========== - -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. - -Do not contact contributors directly about support or help with technical issues. - -Credits -======= - -Authors -~~~~~~~ - -* ForgeFlow - -Contributors -~~~~~~~~~~~~ - -* Lois Rilo -* Pimolnat Suntian -* Christopher Ormaza - -Maintainers -~~~~~~~~~~~ - -This module is maintained by the OCA. - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use. - -.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px - :target: https://github.com/LoisRForgeFlow - :alt: LoisRForgeFlow - -Current `maintainer `__: - -|maintainer-LoisRForgeFlow| - -This module is part of the `OCA/manufacture `_ project on GitHub. - -You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sf_mrp_workorder_sequence/__init__.py b/sf_mrp_workorder_sequence/__init__.py deleted file mode 100644 index 44f9fd7c..00000000 --- a/sf_mrp_workorder_sequence/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). - -from . import models diff --git a/sf_mrp_workorder_sequence/models/__init__.py b/sf_mrp_workorder_sequence/models/__init__.py deleted file mode 100644 index 5a0ba17a..00000000 --- a/sf_mrp_workorder_sequence/models/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import mrp_production -from . import mrp_workorder diff --git a/sf_mrp_workorder_sequence/models/mrp_production.py b/sf_mrp_workorder_sequence/models/mrp_production.py deleted file mode 100644 index 431038bf..00000000 --- a/sf_mrp_workorder_sequence/models/mrp_production.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from odoo import models - - -class MrpProduction(models.Model): - _inherit = "mrp.production" - - def _reset_work_order_sequence(self): - for rec in self: - current_sequence = 1 - for work in rec.workorder_ids: - work.sequence = current_sequence - current_sequence += 1 - - def _create_workorder(self): - res = super()._create_workorder() - self._reset_work_order_sequence() - return res diff --git a/sf_mrp_workorder_sequence/models/mrp_workorder.py b/sf_mrp_workorder_sequence/models/mrp_workorder.py deleted file mode 100644 index 25bb4292..00000000 --- a/sf_mrp_workorder_sequence/models/mrp_workorder.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -from odoo import fields, models - - -class MrpWorkOrder(models.Model): - _inherit = "mrp.workorder" - _order = 'sequence' - - sequence = fields.Integer(string='工序') diff --git a/sf_mrp_workorder_sequence/static/description/icon.png b/sf_mrp_workorder_sequence/static/description/icon.png deleted file mode 100644 index 3a0328b516c4980e8e44cdb63fd945757ddd132d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9455 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 z 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 Xviia!U7SGha1wx#SCgwmn*{w2TRX*I diff --git a/sf_mrp_workorder_sequence/static/description/index.html b/sf_mrp_workorder_sequence/static/description/index.html deleted file mode 100644 index 56d2186b..00000000 --- a/sf_mrp_workorder_sequence/static/description/index.html +++ /dev/null @@ -1,429 +0,0 @@ - - - - - - -MRP Work Order Sequence - - - -
-

MRP Work Order Sequence

- - -

Beta License: LGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

-

Provide a new field sequence on production orders’s work orders, that provides -clear information on the process order of those.

-

Table of contents

- -
-

Usage

-

Go to any production order with a routing set and check its work orders.

-
-
-

Bug Tracker

-

Bugs are tracked on GitHub Issues. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

-

Do not contact contributors directly about support or help with technical issues.

-
-
-

Credits

-
-

Authors

-
    -
  • ForgeFlow
  • -
-
-
-

Contributors

- -
-
-

Maintainers

-

This module is maintained by the OCA.

-Odoo Community Association -

OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use.

-

Current maintainer:

-

LoisRForgeFlow

-

This module is part of the OCA/manufacture project on GitHub.

-

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-
-
-
- - diff --git a/sf_mrp_workorder_sequence/views/mrp_workorder_view.xml b/sf_mrp_workorder_sequence/views/mrp_workorder_view.xml deleted file mode 100644 index 2514a749..00000000 --- a/sf_mrp_workorder_sequence/views/mrp_workorder_view.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - mrp.workorder.tree - mrp.workorder - - - - - - - - diff --git a/sf_mrs_connect/__init__.py b/sf_mrs_connect/__init__.py index 91c5580f..10245345 100644 --- a/sf_mrs_connect/__init__.py +++ b/sf_mrs_connect/__init__.py @@ -1,2 +1,3 @@ from . import controllers from . import models + diff --git a/sf_mrs_connect/__manifest__.py b/sf_mrs_connect/__manifest__.py index 5003bd36..eb7b3533 100644 --- a/sf_mrs_connect/__manifest__.py +++ b/sf_mrs_connect/__manifest__.py @@ -12,7 +12,8 @@ 'website': 'https://www.sf.cs.jikimo.com', 'depends': ['sf_base'], 'data': [ - # 'views/sale_process_order_view.xml' + # 'data/ir_cron_data.xml', + 'views/res_config_settings_views.xml' ], 'demo': [ ], diff --git a/sf_mrs_sync/data/sf_cron.xml b/sf_mrs_connect/data/ir_cron_data.xml similarity index 77% rename from sf_mrs_sync/data/sf_cron.xml rename to sf_mrs_connect/data/ir_cron_data.xml index 1d41776b..94109b13 100644 --- a/sf_mrs_sync/data/sf_cron.xml +++ b/sf_mrs_connect/data/ir_cron_data.xml @@ -2,7 +2,7 @@ 同步资源库材料 - + code model.sync_production_materials() 1 @@ -11,10 +11,9 @@ - 同步资源库材料型号 - + code model.sync_materials_model() 1 @@ -23,10 +22,9 @@ - 同步资源库表面工艺 - + code model.sync_production_process() 1 @@ -37,7 +35,7 @@ 同步资源库加工工艺 - + code model.sync_processing_technology() 1 @@ -48,7 +46,7 @@ 同步资源库标签 - + code model.sync_machine_brand_tags() 1 @@ -57,10 +55,9 @@ - 同步资源库控制系统 - + code model.sync_machine_tool_type_control_system() 1 @@ -71,7 +68,7 @@ 同步资源库品牌 - + code model.sync_machine_brand() 1 @@ -80,20 +77,20 @@ - - - - - - - - - - + + + + + + + + + + 同步资源库机床型号 - + code model.sync_machine_tool_type() 1 @@ -104,7 +101,7 @@ 同步资源库刀具类别 - + code model.sync_cutting_tool_category() 1 @@ -115,7 +112,7 @@ 同步资源库刀具型号 - + code model.sync_cutting_tool_type() 1 @@ -124,9 +121,9 @@ - + 同步资源库工序 - + code model.sync_processing_order() 1 diff --git a/sf_mrs_connect/models/__init__.py b/sf_mrs_connect/models/__init__.py index 0650744f..57e1fb8a 100644 --- a/sf_mrs_connect/models/__init__.py +++ b/sf_mrs_connect/models/__init__.py @@ -1 +1,4 @@ -from . import models +from . import res_config_setting +from . import sync_common + + diff --git a/sf_mrs_connect/models/models.py b/sf_mrs_connect/models/models.py deleted file mode 100644 index e69de29b..00000000 diff --git a/sf_mrs_sync/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py similarity index 52% rename from sf_mrs_sync/models/res_config_setting.py rename to sf_mrs_connect/models/res_config_setting.py index 20a98d11..55b3e66c 100644 --- a/sf_mrs_sync/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -12,32 +12,32 @@ class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' token = fields.Char(string='TOKEN', default='b811ac06-3f00-11ed-9aed-0242ac110003') - mrs_secret_key = fields.Char(string='密钥', default= 'wBmxej38OkErKhD6') - mrs_url = fields.Char(string='访问地址', default= 'https://mrs.cs.jikimo.com') + sf_secret_key = fields.Char(string='密钥', default= 'wBmxej38OkErKhD6') + sf_url = fields.Char(string='访问地址', default= 'https://sf.cs.jikimo.com') def sf_all_sync(self): - self.env['mrs.production.materials'].sync_all_production_materials() + self.env['sf.production.materials'].sync_all_production_materials() _logger.info("同步资源库材料") - self.env['mrs.materials.model'].sync_all_materials_model() + self.env['sf.materials.model'].sync_all_materials_model() _logger.info("同步资源库材料型号") - self.env['mrs.production.process'].sync_all_production_process() + self.env['sf.production.process'].sync_all_production_process() _logger.info("同步资源库表面工艺") - self.env['mrs.processing.technology'].sync_all_processing_technology() + self.env['sf.processing.technology'].sync_all_processing_technology() _logger.info("同步资源库加工工艺") - self.env['mrs.machine.brand.tags'].sync_all_machine_brand_tags() + self.env['sf.machine.brand.tags'].sync_all_machine_brand_tags() _logger.info("同步资源库品牌类别") - self.env['mrs.machine.brand'].sync_all_machine_brand() + self.env['sf.machine.brand'].sync_all_machine_brand() _logger.info("同步资源库品牌") - self.env['mrs.machine.control_system'].sync_all_machine_tool_type_control_system() + self.env['sf.machine.control_system'].sync_all_machine_tool_type_control_system() _logger.info("同步资源库控制系统") - # self.env['mrs.machine_tool'].sync_all_machine_tool() - self.env['mrs.machine_tool.type'].sync_all_machine_tool_type() + # self.env['sf.machine_tool'].sync_all_machine_tool() + self.env['sf.machine_tool.type'].sync_all_machine_tool_type() _logger.info("同步资源库机床型号") - self.env['mrs.cutting_tool.category'].sync_all_cutting_tool_category() + self.env['sf.cutting_tool.category'].sync_all_cutting_tool_category() _logger.info("同步资源库刀具类别") - self.env['mrs.cutting_tool.type'].sync_all_cutting_tool_type() + self.env['sf.cutting_tool.type'].sync_all_cutting_tool_type() _logger.info("同步资源库刀具") - # self.env['mrs.processing.order'].sync_all_processing_order() + # self.env['sf.processing.order'].sync_all_processing_order() @@ -50,13 +50,13 @@ class ResConfigSettings(models.TransientModel): values = super(ResConfigSettings, self).get_values() config = self.env['ir.config_parameter'].sudo() token = config.get_param('token', default='') - mrs_secret_key = config.get_param('mrs_secret_key', default='') - mrs_url = config.get_param('mrs_url', default='') + sf_secret_key = config.get_param('sf_secret_key', default='') + sf_url = config.get_param('sf_url', default='') values.update( token=token, - mrs_secret_key=mrs_secret_key, - mrs_url=mrs_url, + sf_secret_key=sf_secret_key, + sf_url=sf_url, ) return values @@ -64,6 +64,6 @@ class ResConfigSettings(models.TransientModel): super(ResConfigSettings, self).set_values() ir_config = self.env['ir.config_parameter'].sudo() ir_config.set_param("token", self.token or "") - ir_config.set_param("mrs_secret_key", self.mrs_secret_key or "") - ir_config.set_param("mrs_url", self.mrs_url or "") + ir_config.set_param("sf_secret_key", self.sf_secret_key or "") + ir_config.set_param("sf_url", self.sf_url or "") diff --git a/sf_mrs_sync/models/sf_sync_common.py b/sf_mrs_connect/models/sync_common.py similarity index 75% rename from sf_mrs_sync/models/sf_sync_common.py rename to sf_mrs_connect/models/sync_common.py index 2520f6fa..7e2f6224 100644 --- a/sf_mrs_sync/models/sf_sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -12,8 +12,8 @@ from .res_config_setting import ResConfigSettings _logger = logging.getLogger(__name__) -class MrsProductionMaterials(models.Model): - _inherit = "mrs.production.materials" +class sfProductionMaterials(models.Model): + _inherit = "sf.production.materials" _description = "材料" url = '/api/production_materials/list' @@ -23,10 +23,10 @@ class MrsProductionMaterials(models.Model): # 配置中获取token sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_config['sf_url'] + self.url r = requests.post(strUrl, json={}, data=None, headers=headers) r = r.json() @@ -34,7 +34,7 @@ class MrsProductionMaterials(models.Model): if result['status'] == 1: for item in result['production_materials_yesterday_list']: if item: - brand = self.env['mrs.production.materials'].search( + brand = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_no'])]) if brand: brand.id = item['id'], @@ -42,7 +42,7 @@ class MrsProductionMaterials(models.Model): brand.remark = item['remark'], brand.active = item['active'] else: - self.env['mrs.production.materials'].create({ + self.env['sf.production.materials'].create({ "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], @@ -57,10 +57,10 @@ class MrsProductionMaterials(models.Model): _logger = '正在同步所有材料' sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_config['sf_url'] + self.url r = requests.post(strUrl, json={}, data=None, headers=headers) r = r.json() result = json.loads(r['result']) @@ -68,10 +68,10 @@ class MrsProductionMaterials(models.Model): for item in result['production_materials_all_list']: if item: - brand = self.env['mrs.production.materials'].search( + brand = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_no'])]) if not brand: - self.env['mrs.production.materials'].create({ + self.env['sf.production.materials'].create({ "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], @@ -82,8 +82,8 @@ class MrsProductionMaterials(models.Model): raise ValidationError("认证未通过") -class MrsMaterialModel(models.Model): - _inherit = 'mrs.materials.model' +class sfMaterialModel(models.Model): + _inherit = 'sf.materials.model' _description = '材料型号' url = '/api/materials_model/list' @@ -91,17 +91,17 @@ class MrsMaterialModel(models.Model): def sync_materials_model(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['materials_model_yesterday_list']: if item: - brand = self.env['mrs.materials.model'].search( + brand = self.env['sf.materials.model'].search( [("materials_no", '=', item['materials_no'])]) if brand: brand.id = item['id'], @@ -110,18 +110,18 @@ class MrsMaterialModel(models.Model): brand.remark = item['remark'], brand.active = item['active'], brand.mf_materia_post = item['mf_materia_post'], - brand.materials_id = self.env['mrs.production.materials'].search( + brand.materials_id = self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]).id, brand.need_h = item['need_h'], brand.density = item['density'] else: - self.env['mrs.materials.model'].create({ + self.env['sf.materials.model'].create({ "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], "active": item['active'], - "materials_id": self.env['mrs.production.materials'].search( + "materials_id": self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]).id, "need_h": item['need_h'], "mf_materia_post": item['mf_materia_post'], @@ -136,24 +136,24 @@ class MrsMaterialModel(models.Model): def sync_all_materials_model(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + strUrl = sf_sync_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['materials_model_all_list']: if item: - brand = self.env['mrs.materials.model'].search( + brand = self.env['sf.materials.model'].search( [("materials_no", '=', item['materials_no'])]) if not brand: - self.env['mrs.materials.model'].create({ + self.env['sf.materials.model'].create({ "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], "active": item['active'], - "materials_id": self.env['mrs.production.materials'].search( + "materials_id": self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]).id, "need_h": item['need_h'], "mf_materia_post": item['mf_materia_post'], @@ -165,8 +165,8 @@ class MrsMaterialModel(models.Model): raise ValidationError("认证未通过") -class MrsProductionProcess(models.Model): - _inherit = 'mrs.production.process' +class sfProductionProcess(models.Model): + _inherit = 'sf.production.process' _description = '表面工艺' url = '/api/production_process/list' @@ -174,17 +174,17 @@ class MrsProductionProcess(models.Model): def sync_production_process(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['production_process_yesterday_list']: if item: - brand = self.env['mrs.production.process'].search( + brand = self.env['sf.production.process'].search( [("process_encode", '=', item['process_encode'])]) if brand: brand.id = item['id'], @@ -194,7 +194,7 @@ class MrsProductionProcess(models.Model): brand.active = item['active'], brand.remark = item['remark'] else: - self.env['mrs.production.process'].create({ + self.env['sf.production.process'].create({ "id": item['id'], "name": item['name'], "process_encode": item['process_encode'], @@ -210,20 +210,20 @@ class MrsProductionProcess(models.Model): def sync_all_production_process(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['production_process_all_list']: if item: - brand = self.env['mrs.production.process'].search( + brand = self.env['sf.production.process'].search( [("process_encode", '=', item['process_encode'])]) if not brand: - self.env['mrs.production.process'].create({ + self.env['sf.production.process'].create({ "id": item['id'], "name": item['name'], "process_encode": item['process_encode'], @@ -236,8 +236,8 @@ class MrsProductionProcess(models.Model): raise ValidationError("认证未通过") -class MrsProcessingTechnology(models.Model): - _inherit = 'mrs.processing.technology' +class sfProcessingTechnology(models.Model): + _inherit = 'sf.processing.technology' _description = '加工工艺' url = '/api/processing_technology/list' @@ -245,17 +245,17 @@ class MrsProcessingTechnology(models.Model): def sync_processing_technology(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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: - brand = self.env['mrs.processing.technology'].search( + brand = self.env['sf.processing.technology'].search( [("process_encode", '=', item['process_encode'])]) if brand: brand.id = item['id'], @@ -264,7 +264,7 @@ class MrsProcessingTechnology(models.Model): brand.remark = item['remark'], brand.active = item['active'] else: - self.env['mrs.processing.technology'].create({ + self.env['sf.processing.technology'].create({ "id": item['id'], "name": item['name'], "process_encode": item['process_encode'], @@ -280,20 +280,20 @@ class MrsProcessingTechnology(models.Model): def sync_all_processing_technology(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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: - brand = self.env['mrs.processing.technology'].search( + brand = self.env['sf.processing.technology'].search( [("process_encode", '=', item['process_encode'])]) if not brand: - self.env['mrs.processing.technology'].create({ + self.env['sf.processing.technology'].create({ "id": item['id'], "name": item['name'], "process_encode": item['process_encode'], @@ -307,7 +307,7 @@ class MrsProcessingTechnology(models.Model): class MachineBrandTags(models.Model): - _inherit = 'mrs.machine.brand.tags' + _inherit = 'sf.machine.brand.tags' _description = '品牌类别' url = '/api/machine_brand_tags/list' @@ -315,23 +315,23 @@ class MachineBrandTags(models.Model): def sync_machine_brand_tags(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_brand_tags_yesterday_list']: - brand = self.env['mrs.machine.brand.tags'].search( + brand = self.env['sf.machine.brand.tags'].search( [("id", '=', item['id'])]) if brand: brand.id = item['id'], brand.name = item['name'], brand.color = item['color'] else: - self.env['mrs.machine.brand.tags'].create({ + self.env['sf.machine.brand.tags'].create({ "id": item['id'], "name": item['name'], "color": item['color'], @@ -344,19 +344,19 @@ class MachineBrandTags(models.Model): def sync_all_machine_brand_tags(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_brand_tags_all_list']: - brand = self.env['mrs.machine.brand.tags'].search( + brand = self.env['sf.machine.brand.tags'].search( [("name", '=', item['name'])]) if not brand: - self.env['mrs.machine.brand.tags'].create({ + self.env['sf.machine.brand.tags'].create({ "id": item['id'], "name": item['name'], "color": item['color'], @@ -368,7 +368,7 @@ class MachineBrandTags(models.Model): class MachineControlSystem(models.Model): - _inherit = 'mrs.machine.control_system' + _inherit = 'sf.machine.control_system' _description = '控制系统' url = '/api/machine_control_system/list' @@ -376,31 +376,31 @@ class MachineControlSystem(models.Model): def sync_machine_tool_type_control_system(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_control_system_yesterday_list']: if item: - brand = self.env['mrs.machine.control_system'].search( + brand = self.env['sf.machine.control_system'].search( [("code", '=', item['code'])]) if brand: brand.id = item['id'], brand.name = item['name'], brand.code = item['code'], - brand.brand_id=self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, + brand.brand_id=self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, brand.active = item['active'] else: - self.env['mrs.machine.control_system'].create({ + self.env['sf.machine.control_system'].create({ "id": item['id'], "name": item['name'], "code": item['code'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, "active": item['active'], # "tag_ids": item['tag_ids'] @@ -412,10 +412,10 @@ class MachineControlSystem(models.Model): def sync_all_machine_tool_type_control_system(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_config['sf_url'] + self.url r = requests.post(strUrl, json={}, data=None, headers=headers) r = r.json() @@ -423,14 +423,14 @@ class MachineControlSystem(models.Model): if result['status'] == 1: for item in result['machine_control_system_all_list']: if item: - brand = self.env['mrs.machine.control_system'].search( + brand = self.env['sf.machine.control_system'].search( [("code", '=', item['code'])]) if not brand: - self.env['mrs.machine.control_system'].create({ + self.env['sf.machine.control_system'].create({ "id": item['id'], "name": item['name'], "code": item['code'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, "active": item['active'], # "tag_ids": item['tag_ids'] @@ -441,7 +441,7 @@ class MachineControlSystem(models.Model): class MachineBrand(models.Model): - _inherit = 'mrs.machine.brand' + _inherit = 'sf.machine.brand' _description = '品牌' url = '/api/machine_brand/list' @@ -449,17 +449,17 @@ class MachineBrand(models.Model): def sync_machine_brand(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_brand_yesterday_list']: - brand = self.env['mrs.machine.brand'].search( + brand = self.env['sf.machine.brand'].search( [("code", '=', item['code'])]) if brand: brand.id = item['id'], @@ -467,7 +467,7 @@ class MachineBrand(models.Model): brand.code = item['code'], brand.active = item['active'] else: - self.env['mrs.machine.brand'].create({ + self.env['sf.machine.brand'].create({ "id": item['id'], "name": item['name'], "code": item['code'], @@ -483,26 +483,26 @@ class MachineBrand(models.Model): def sync_all_machine_brand(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_brand_all_list']: - brand = self.env['mrs.machine.brand'].search( + brand = self.env['sf.machine.brand'].search( [("code", '=', item['code'])]) if not brand: - self.env['mrs.machine.brand'].create({ + self.env['sf.machine.brand'].create({ "id": item['id'], "name": item['name'], "code": item['code'], # "image_brand": item['image_brand'], "active": item['active'], - "tag_ids": self.env['mrs.machine.brand.tags'].search( + "tag_ids": self.env['sf.machine.brand.tags'].search( [("name", 'in', item['tag_ids'])]).ids @@ -512,7 +512,7 @@ class MachineBrand(models.Model): class MachineTool(models.Model): - _inherit = 'mrs.machine_tool' + _inherit = 'sf.machine_tool' _description = '机床' url = '/api/machine_tool/list' crea_url = '/api/machine_tool/create' @@ -523,16 +523,16 @@ class MachineTool(models.Model): def sync_machine_tool(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_tool_all_yesterday_list']: - brand = self.env['mrs.machine_tool'].search( + brand = self.env['sf.machine_tool'].search( [("code", '=', item['code'])]) if brand: brand.id = item['id'], @@ -557,7 +557,7 @@ class MachineTool(models.Model): brand.active = item['active'] else: - self.env['mrs.machine_tool'].create({ + self.env['sf.machine_tool'].create({ "id": item['id'], "name": item['name'], "precision": item['precision'], @@ -588,19 +588,19 @@ class MachineTool(models.Model): def sync_all_machine_tool(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_tool_all_list']: - brand = self.env['mrs.machine_tool'].search( + brand = self.env['sf.machine_tool'].search( [("code", '=', item['code'])]) if not brand: - self.env['mrs.machine_tool'].create({ + self.env['sf.machine_tool'].create({ "id": item['id'], "name": item['name'], @@ -614,7 +614,7 @@ class MachineTool(models.Model): "number_of_axles": item['number_of_axles'], # "control_system_id": item['control_system_id'], "type_id": item['type_id'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, "x_axis": item['x_axis'], "y_axis": item['y_axis'], "z_axis": item['z_axis'], @@ -630,7 +630,7 @@ class MachineTool(models.Model): class MachineToolType(models.Model): - _inherit = 'mrs.machine_tool.type' + _inherit = 'sf.machine_tool.type' _description = '机床型号' url = '/api/machine_tool_type/list' @@ -638,16 +638,16 @@ class MachineToolType(models.Model): def sync_machine_tool_type(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_tool_type_yesterday_list']: - brand = self.env['mrs.machine_tool.type'].search( + brand = self.env['sf.machine_tool.type'].search( [("code", '=', item['code'])]) if brand: brand.id = item['id'], @@ -657,7 +657,7 @@ class MachineToolType(models.Model): brand.number_of_knife_library = item['number_of_knife_library'], brand.rotate_speed = item['rotate_speed'], brand.number_of_axles = item['number_of_axles'], - brand.control_system_id = self.env['mrs.machine.control_system'].search([('code', '=', item['control_system_id'])]).id, + brand.control_system_id = self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]).id, brand.x_axis = item['x_axis'], brand.y_axis = item['y_axis'], @@ -666,18 +666,18 @@ class MachineToolType(models.Model): brand.c_axis = item['c_axis'], brand.active = item['active'], brand.remark = item['remark'], - brand.brand_id=self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, - brand.machine_tool_id = self.env['mrs.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id + brand.brand_id=self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, + brand.machine_tool_id = self.env['sf.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id else: - self.env['mrs.machine_tool.type'].create({ + self.env['sf.machine_tool.type'].create({ "id": item['id'], "name": item['name'], "code": item['code'], "number_of_knife_library": item['number_of_knife_library'], "rotate_speed": item['rotate_speed'], - 'machine_tool_id' : self.env['mrs.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id, + 'machine_tool_id' : self.env['sf.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id, "number_of_axles": item['number_of_axles'], "x_axis": item['x_axis'], "y_axis": item['y_axis'], @@ -686,9 +686,9 @@ class MachineToolType(models.Model): "c_axis": item['c_axis'], "remark": item['remark'], "precision": item['precision'], - 'control_system_id' : self.env['mrs.machine.control_system'].search([('code', '=', item['control_system_id'])]).id, + 'control_system_id' : self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]).id, "active": item['active'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, }) else: @@ -698,25 +698,25 @@ class MachineToolType(models.Model): def sync_all_machine_tool_type(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['machine_tool_type_all_list']: - brand = self.env['mrs.machine_tool.type'].search( + brand = self.env['sf.machine_tool.type'].search( [("code", '=', item['code'])]) if not brand: - self.env['mrs.machine_tool.type'].create({ + self.env['sf.machine_tool.type'].create({ "id": item['id'], "name": item['name'], "code": item['code'], "number_of_knife_library": item['number_of_knife_library'], "rotate_speed": item['rotate_speed'], - 'machine_tool_id' : self.env['mrs.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id, + 'machine_tool_id' : self.env['sf.machine_tool'].search([('code', '=', item['machine_tool_id'])]).id, "number_of_axles": item['number_of_axles'], "x_axis": item['x_axis'], "y_axis": item['y_axis'], @@ -725,9 +725,9 @@ class MachineToolType(models.Model): "c_axis": item['c_axis'], "remark": item['remark'], "precision": item['precision'], - 'control_system_id' : self.env['mrs.machine.control_system'].search([('code', '=', item['control_system_id'])]).id, + 'control_system_id' : self.env['sf.machine.control_system'].search([('code', '=', item['control_system_id'])]).id, "active": item['active'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, }) else: @@ -735,7 +735,7 @@ class MachineToolType(models.Model): class CuttingTool(models.Model): - _inherit = 'mrs.cutting_tool.category' + _inherit = 'sf.cutting_tool.category' _description = '刀具类别' url = '/api/cutting_tool_category/list' @@ -743,16 +743,16 @@ class CuttingTool(models.Model): def sync_cutting_tool_category(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['cutting_tool_category_yesterday_list']: - brand = self.env['mrs.cutting_tool.category'].search( + brand = self.env['sf.cutting_tool.category'].search( [("code", '=', item['code'])]) if brand: brand.id = item['id'], @@ -761,7 +761,7 @@ class CuttingTool(models.Model): brand.active = item['active'], brand.remark = item['remark'] else: - self.env['mrs.cutting_tool.category'].create({ + self.env['sf.cutting_tool.category'].create({ "id": item['id'], "name": item['name'], "code": item['code'], @@ -777,19 +777,19 @@ class CuttingTool(models.Model): def sync_all_cutting_tool_category(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['cutting_tool_category_all_list']: - brand = self.env['mrs.cutting_tool.category'].search( + brand = self.env['sf.cutting_tool.category'].search( [("code", '=', item['code'])]) if not brand: - self.env['mrs.cutting_tool.category'].create({ + self.env['sf.cutting_tool.category'].create({ "id": item['id'], "name": item['name'], "code": item['code'], @@ -803,7 +803,7 @@ class CuttingTool(models.Model): class CuttingToolType(models.Model): - _inherit = 'mrs.cutting_tool.type' + _inherit = 'sf.cutting_tool.type' _description = '刀具型号' url = '/api/cutting_tool_type/list' @@ -811,16 +811,16 @@ class CuttingToolType(models.Model): def sync_cutting_tool_type(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['cutting_tool_type_yesterday_list']: - brand = self.env['mrs.cutting_tool.type'].search( + brand = self.env['sf.cutting_tool.type'].search( [("code", '=', item['code'])]) if brand: brand.id = item['id'], @@ -835,10 +835,10 @@ class CuttingToolType(models.Model): brand.taper_shank_length = item['taper_shank_length'], brand.tool_length = item['tool_length'], brand.blade_number = item['blade_number'] - brand.brand_id = self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, - brand.category_id = self.env['mrs.cutting_tool.category'].search([('code', '=', item['category_id'])]).id + brand.brand_id = self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, + brand.category_id = self.env['sf.cutting_tool.category'].search([('code', '=', item['category_id'])]).id else: - self.env['mrs.cutting_tool.type'].create({ + self.env['sf.cutting_tool.type'].create({ "id": item['id'], "name": item['name'], "remark": item['remark'], @@ -851,8 +851,8 @@ class CuttingToolType(models.Model): "taper_shank_length": item['taper_shank_length'], "tool_length": item['tool_length'], "blade_number": item['blade_number'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, - "category_id": self.env['mrs.cutting_tool.category'].search([('code', '=', item['category_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, + "category_id": self.env['sf.cutting_tool.category'].search([('code', '=', item['category_id'])]).id, }) else: raise ValidationError("认证未通过") @@ -861,19 +861,19 @@ class CuttingToolType(models.Model): def sync_all_cutting_tool_type(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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['cutting_tool_type_all_list']: - brand = self.env['mrs.cutting_tool.type'].search( + brand = self.env['sf.cutting_tool.type'].search( [("code", '=', item['code'])]) if not brand: - self.env['mrs.cutting_tool.type'].create({ + self.env['sf.cutting_tool.type'].create({ "id": item['id'], "name": item['name'], "remark": item['remark'], @@ -886,16 +886,16 @@ class CuttingToolType(models.Model): "taper_shank_length": item['taper_shank_length'], "tool_length": item['tool_length'], "blade_number": item['blade_number'], - 'brand_id': self.env['mrs.machine.brand'].search([('code', '=', item['brand_id'])]).id, - "category_id": self.env['mrs.cutting_tool.category'].search([('code', '=', item['category_id'])]).id, + 'brand_id': self.env['sf.machine.brand'].search([('code', '=', item['brand_id'])]).id, + "category_id": self.env['sf.cutting_tool.category'].search([('code', '=', item['category_id'])]).id, }) else: raise ValidationError("认证未通过") -class MrsProcessingOrder(models.Model): - _inherit = 'mrs.processing.order' +class sfProcessingOrder(models.Model): + _inherit = 'sf.processing.order' _description = '工序' url = '/api/processing_order/list' @@ -903,22 +903,22 @@ class MrsProcessingOrder(models.Model): def sync_processing_order(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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']: - brand = self.env['mrs.processing.order'].search( + brand = self.env['sf.processing.order'].search( [("id", '=', item['id'])]) if brand: brand.id = item['id'] brand.sequence = item['sequence'] else: - self.env['mrs.processing.order'].create({ + self.env['sf.processing.order'].create({ "id": item['id'], "sequence": item['sequence'], @@ -930,19 +930,19 @@ class MrsProcessingOrder(models.Model): def sync_all_processing_order(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token'] - mrs_secret_key = sf_sync_config['mrs_secret_key'] - headers = Common.get_headers(self, token, mrs_secret_key) + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) - strUrl = sf_sync_config['mrs_url'] + self.url + strUrl = sf_sync_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']: - brand = self.env['mrs.processing.order'].search( + brand = self.env['sf.processing.order'].search( [("id", '=', item['id'])]) if not brand: - self.env['mrs.processing.order'].create({ + self.env['sf.processing.order'].create({ "id": item['id'], "sequence": item['sequence'], }) diff --git a/sf_mrs_sync/views/sf_sync_config_settings_views.xml b/sf_mrs_connect/views/res_config_settings_views.xml similarity index 87% rename from sf_mrs_sync/views/sf_sync_config_settings_views.xml rename to sf_mrs_connect/views/res_config_settings_views.xml index 4f488a33..d650d0f3 100644 --- a/sf_mrs_sync/views/sf_sync_config_settings_views.xml +++ b/sf_mrs_connect/views/res_config_settings_views.xml @@ -18,12 +18,12 @@
-
-
@@ -31,8 +31,6 @@