From bf010e2ccaccd1716bb39feb9cd025be325672d7 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 27 Mar 2023 21:04:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AD=A6=E5=91=8A=E5=8F=8A?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=A1=A8=E9=9D=A2=E5=B7=A5=E8=89=BA=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/__manifest__.py | 1 + sf_base/models/common.py | 2 + sf_base/security/ir.model.access.csv | 1 + sf_base/views/common_view.xml | 86 ++++++++++----------- sf_bf_connect/__manifest__.py | 3 +- sf_bf_connect/controllers/controllers.py | 1 - sf_bf_connect/models/jd_eclp.py | 4 +- sf_dlm/__manifest__.py | 5 +- sf_dlm/data/product_data.xml | 10 ++- sf_dlm/models/product_template.py | 30 +++---- sf_dlm/views/product_template_view.xml | 5 +- sf_machine_connect/__manifest__.py | 2 +- sf_manufacturing/__manifest__.py | 1 + sf_manufacturing/models/mrp_production.py | 2 +- sf_mrs_connect/__manifest__.py | 1 + sf_mrs_connect/models/res_config_setting.py | 4 +- sf_mrs_connect/models/sync_common.py | 2 +- sf_sale/__manifest__.py | 1 + 18 files changed, 89 insertions(+), 72 deletions(-) diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index 11931f4c..2daf3ec0 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -23,6 +23,7 @@ ], 'qweb': [ ], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False, diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 32c4b245..2a4fce98 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -63,6 +63,8 @@ class MrsProductionProcess(models.Model): parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数') gain_way = fields.Selection([("自加工", "自加工"), ("外协", "外协")], default="", string="获取方式") category_id = fields.Many2one('sf.production.process.category') + workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_process', required=True) + class MrsProcessingTechnology(models.Model): diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index c9e93e5b..816341ee 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -15,6 +15,7 @@ access_sf_tray,sf_tray,model_sf_tray,base.group_user,1,1,1,1 access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user,1,1,1,1 access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,1 +access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,base.group_user,1,1,1,1 diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index d89acc71..89d6df00 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -108,55 +108,49 @@ sf.production.process
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - + + + + + + + + + + + + + + + - - - - - - - - -
-
-
- - - - - + + + + + + + + + + + +
+ + +
+
+
+ + + + + + + +
diff --git a/sf_bf_connect/__manifest__.py b/sf_bf_connect/__manifest__.py index bcec62fa..013390f1 100644 --- a/sf_bf_connect/__manifest__.py +++ b/sf_bf_connect/__manifest__.py @@ -13,13 +13,14 @@ 'depends': ['sf_base', 'sf_sale', 'sf_dlm'], 'data': [ 'views/res_partner_view.xml', - 'views/view.xml', + # 'views/view.xml', 'report/bill_report.xml', ], 'demo': [ ], 'qweb': [ ], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False, diff --git a/sf_bf_connect/controllers/controllers.py b/sf_bf_connect/controllers/controllers.py index 12270d8e..471fc152 100644 --- a/sf_bf_connect/controllers/controllers.py +++ b/sf_bf_connect/controllers/controllers.py @@ -111,7 +111,6 @@ class Sf_Bf_Connect(http.Controller): product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has( purchase_embryo) order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item) - order_id.step_file = product.model_file i += 1 res['factory_order_no'] = order_id.name return json.JSONEncoder().encode(res) diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py index 7eb1af20..5a7579af 100644 --- a/sf_bf_connect/models/jd_eclp.py +++ b/sf_bf_connect/models/jd_eclp.py @@ -1,4 +1,4 @@ -import cpca +#import cpca import logging import base64 import requests @@ -37,7 +37,7 @@ class JdEclp(models.Model): deliveryType = fields.Selection([('6', '特快零担'), ('25', '特快重货')], string='运输类型', default='25') # bill = fields.Char(string='物流面单') - bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf') + # bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf') # bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas') bill_show = fields.Binary(string='物流面单展示', readonly=True) diff --git a/sf_dlm/__manifest__.py b/sf_dlm/__manifest__.py index e20486c8..ba5e706b 100644 --- a/sf_dlm/__manifest__.py +++ b/sf_dlm/__manifest__.py @@ -10,9 +10,11 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['mrp', 'base', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting'], + 'depends': ['mrp', 'base', 'sf_manufacturing', 'web_widget_model_viewer', 'mrp_subcontracting', 'purchase_stock', + 'uom'], 'data': [ 'data/product_data.xml', + 'data/uom_data.xml', 'views/product_template_view.xml', 'views/product_workorder.xml' ], @@ -20,6 +22,7 @@ ], 'qweb': [ ], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False, diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml index f4b9b717..8e01b270 100644 --- a/sf_dlm/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -15,6 +15,11 @@ 原材料 + + + + + CNC加工产品模板 @@ -29,7 +34,7 @@ true serial - + false 胚料自加工模板 @@ -45,6 +50,7 @@ true serial + false @@ -60,6 +66,7 @@ serial + false 胚料采购模板 @@ -74,6 +81,7 @@ serial + false \ No newline at end of file diff --git a/sf_dlm/models/product_template.py b/sf_dlm/models/product_template.py index 9dbfed49..1364c76e 100644 --- a/sf_dlm/models/product_template.py +++ b/sf_dlm/models/product_template.py @@ -1,8 +1,8 @@ from odoo import models, fields, api from odoo.exceptions import ValidationError from odoo.modules import get_resource_path -from OCC.Extend.DataExchange import read_step_file -from OCC.Extend.DataExchange import write_stl_file +# from OCC.Extend.DataExchange import read_step_file +# from OCC.Extend.DataExchange import write_stl_file import logging import base64 import hashlib @@ -30,8 +30,9 @@ class ResProductTemplate(models.Model): product_model_type_id = fields.Many2one('sf.model.type', string='产品模型类型') embryo_model_type_id = fields.Many2one('sf.model.type', string='胚料模型类型') model_processing_panel = fields.Char('模型加工面板') - model_surface_process_id = fields.Many2one('sf.production.process', string='表面工艺') - model_process_parameters_id = fields.Many2one('sf.processing.technology', string='工艺参数') + # model_surface_process_category_id = fields.Many2one('sf.production.process.category', string='表面工艺类别') + model_surface_process_id = fields.Many2many('sf.production.process', 'rel_product_process', string='表面工艺') + model_process_parameters_id = fields.Many2many('sf.processing.technology', 'rel_product_technology', string='工艺参数') # model_price = fields.Float('模型单价', digits=(16, 3)) model_remark = fields.Char('模型备注说明') length = fields.Float('长[mm]', digits=(16, 3)) @@ -108,8 +109,8 @@ class ResProductTemplate(models.Model): [('materials_no', '=', item['texture_type_code'])]).id, 'model_surface_process_id': self.env['sf.production.process'].search( [('process_encode', '=', item['surface_process_code'])]).id, - # 'model_process_parameters_id': self.env['sf.processing.technology'].search( - # [('process_encode', '=', item['process_parameters_code'])]).id, + 'model_process_parameters_id': self.env['sf.processing.technology'].search( + [('process_encode', '=', item['process_parameters_code'])]).id, 'model_remark': item['remark'], 'default_code': '%s-%s' % (order_number, i), # 'barcode': item['barcode'], @@ -182,14 +183,15 @@ class ResProductTemplate(models.Model): @api.model_create_multi def create(self, vals_list): for vals in vals_list: - if vals['upload_model_file']: - for item in vals['upload_model_file']: - attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))]) - base64_data = base64.b64encode(attachment.datas) - base64_datas = base64_data.decode('utf-8') - model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() - report_path = attachment._full_path(attachment.store_fname) - vals['model_file'] = self.transition_glb_file(report_path, model_code) + if vals.get('upload_model_file'): + if vals.get('is_bfm') is False and vals.get('categ_type') == '成品': + for item in vals['upload_model_file']: + attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))]) + base64_data = base64.b64encode(attachment.datas) + base64_datas = base64_data.decode('utf-8') + model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest() + report_path = attachment._full_path(attachment.store_fname) + vals['model_file'] = self.transition_glb_file(report_path, model_code) self._sanitize_vals(vals) templates = super(ResProductTemplate, self).create(vals_list) if "create_product_product" not in self._context: diff --git a/sf_dlm/views/product_template_view.xml b/sf_dlm/views/product_template_view.xml index 7eb5f625..176a4669 100644 --- a/sf_dlm/views/product_template_view.xml +++ b/sf_dlm/views/product_template_view.xml @@ -14,7 +14,8 @@ + widget="many2many_binary" + attrs="{'invisible': ['|', ('categ_type', '!=', '成品'),('categ_type', '=', False)]}"/> @@ -24,6 +25,8 @@ + + diff --git a/sf_machine_connect/__manifest__.py b/sf_machine_connect/__manifest__.py index af66a542..26c849d9 100644 --- a/sf_machine_connect/__manifest__.py +++ b/sf_machine_connect/__manifest__.py @@ -34,7 +34,7 @@ 'assets': { }, - + 'license': 'LGPL-3', 'installable': True, 'application': True, # 'auto_install': False, diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py index 70277dca..2db63e1b 100644 --- a/sf_manufacturing/__manifest__.py +++ b/sf_manufacturing/__manifest__.py @@ -27,6 +27,7 @@ ], 'qweb': [ ], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False, diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index ebcee7bf..a8b8b0eb 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -248,7 +248,7 @@ class MrpProduction(models.Model): if work.name == '获取CNC加工程序': work.button_start() #work.button_finish() - work.fetchCNC() + #work.fetchCNC() #创建工单并进行排序 def _create_workorder(self): diff --git a/sf_mrs_connect/__manifest__.py b/sf_mrs_connect/__manifest__.py index 3954aa3f..b1955012 100644 --- a/sf_mrs_connect/__manifest__.py +++ b/sf_mrs_connect/__manifest__.py @@ -19,6 +19,7 @@ ], 'qweb': [ ], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False, diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py index 856b3c83..8aae305a 100644 --- a/sf_mrs_connect/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -24,10 +24,10 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步资源库材料") self.env['sf.materials.model'].sync_all_materials_model() _logger.info("同步资源库材料型号") - self.env['sf.production.process'].sync_all_production_process() - _logger.info("同步资源库表面工艺") self.env['sf.production.process.category'].sync_all_production_process_category() _logger.info("同步资源库表面工艺类别") + self.env['sf.production.process'].sync_all_production_process() + _logger.info("同步资源库表面工艺") self.env['sf.processing.technology'].sync_all_processing_technology() _logger.info("同步资源库加工工艺") self.env['sf.machine.brand.tags'].sync_all_machine_brand_tags() diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index c4da9926..d751a090 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -212,7 +212,7 @@ class sfProductionProcessCategory(models.Model): for item in result['production_process_category_all_list']: if item: category = self.env['sf.production.process.category'].search( - [("process_encode", '=', item['process_encode'])]) + [("code", '=', item['code'])]) if not category: self.env['sf.production.process.category'].create({ "name": item['name'], diff --git a/sf_sale/__manifest__.py b/sf_sale/__manifest__.py index 51769040..1414f297 100644 --- a/sf_sale/__manifest__.py +++ b/sf_sale/__manifest__.py @@ -18,6 +18,7 @@ ], 'qweb': [ ], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False,