diff --git a/sf_base/models/common.py b/sf_base/models/common.py index d163a024..2e2cccf6 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -67,6 +67,10 @@ class MrsMaterialModel(models.Model): mf_materia_post = fields.Char("热处理后密度") density = fields.Float("密度(kg/m³)") materials_id = fields.Many2one('sf.production.materials', "材料名") + tensile_strength = fields.Float("拉伸强度(n/mm²)") + hardness = fields.Float("硬度(hrc)") + rough_machining = fields.Float("粗加工Vc(m/min)") + finish_machining = fields.Float("精加工Vc(m/min)") remark = fields.Text("备注") gain_way = fields.Selection( [("自加工", "自加工"), ("外协", "外协"), ("采购", "采购")], diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index 492a3b4e..afa7d88b 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -82,7 +82,7 @@ - + @@ -105,8 +105,8 @@ sf.production.process - - + + @@ -204,12 +204,15 @@ - + + + - + + @@ -242,8 +245,13 @@ - - + + + + + + + @@ -353,26 +361,26 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 25f6974a..6c2003ff 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -99,25 +99,33 @@ class sfMaterialModel(models.Model): if result['status'] == 1: for item in result['materials_model_yesterday_list']: if item: - brand = self.env['sf.materials.model'].search( + materials_model = self.env['sf.materials.model'].search( [("materials_no", '=', item['materials_no'])]) - if brand: - brand.id = item['id'], - brand.name = item['name'], - brand.materials_no = item['materials_no'], - brand.remark = item['remark'], - brand.active = item['active'], - brand.mf_materia_post = item['mf_materia_post'], - brand.materials_id = self.env['sf.production.materials'].search( + if materials_model: + materials_model.id = item['id'], + materials_model.name = item['name'], + materials_model.materials_no = item['materials_no'], + materials_model.remark = item['remark'], + materials_model.tensile_strength = item['tensile_strength'], + materials_model.hardness = item['hardness'], + materials_model.materials_no = item['materials_no'], + materials_model.rough_machining = item['rough_machining'], + materials_model.finish_machining = item['finish_machining'], + materials_model.mf_materia_post = item['mf_materia_post'], + materials_model.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'] + materials_model.need_h = item['need_h'], + materials_model.density = item['density'] else: self.env['sf.materials.model'].create({ "id": item['id'], "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], + "tensile_strength": item['tensile_strength'], + "hardness": item['hardness'], + "rough_machining": item['rough_machining'], + "finish_machining": item['finish_machining'], "active": item['active'], "materials_id": self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]).id, @@ -143,14 +151,18 @@ class sfMaterialModel(models.Model): if result['status'] == 1: for item in result['materials_model_all_list']: if item: - brand = self.env['sf.materials.model'].search( + materials_model = self.env['sf.materials.model'].search( [("materials_no", '=', item['materials_no'])]) - if not brand: + if not materials_model: self.env['sf.materials.model'].create({ "name": item['name'], "materials_no": item['materials_no'], "remark": item['remark'], "active": item['active'], + "tensile_strength": item['tensile_strength'], + "hardness": item['hardness'], + "rough_machining": item['rough_machining'], + "finish_machining": item['finish_machining'], "materials_id": self.env['sf.production.materials'].search( [("materials_no", '=', item['materials_id.materials_no'])]).id, "need_h": item['need_h'], @@ -573,7 +585,6 @@ class MachineBrand(models.Model): raise ValidationError("认证未通过") - class MachineToolType(models.Model): _inherit = 'sf.machine_tool.type' _description = '机床型号' @@ -1492,7 +1503,6 @@ class SyncFixtureModel(models.Model): "multi_mounting_type_id": self.env['sf.multi_mounting.type'].search( [('code', '=', item['multi_mounting_type_code'])]).id, "brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id, - "manufacturer_model_number": item['manufacturer_model_number'], "clamping_way": item['clamping_way'], "port_type": item['port_type'], "model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']), @@ -1522,7 +1532,6 @@ class SyncFixtureModel(models.Model): "multi_mounting_type_id": self.env['sf.multi_mounting.type'].search( [('code', '=', item['multi_mounting_type_code'])]).id, "brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id, - "manufacturer_model_number": item['manufacturer_model_number'], "clamping_way": item['clamping_way'], "port_type": item['port_type'], "model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']), @@ -1574,7 +1583,6 @@ class SyncFixtureModel(models.Model): "multi_mounting_type_id": self.env['sf.multi_mounting.type'].search( [('code', '=', item['multi_mounting_type_code'])]).id, "brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id, - "manufacturer_model_number": item['manufacturer_model_number'], "clamping_way": item['clamping_way'], "port_type": item['port_type'], "model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']), @@ -1604,7 +1612,6 @@ class SyncFixtureModel(models.Model): "multi_mounting_type_id": self.env['sf.multi_mounting.type'].search( [('code', '=', item['multi_mounting_type_code'])]).id, "brand_id": self.env['sf.machine.brand'].search([('code', '=', item['brand_code'])]).id, - "manufacturer_model_number": item['manufacturer_model_number'], "clamping_way": item['clamping_way'], "port_type": item['port_type'], "model_file": '' if not item['model_file'] else base64.b64decode(item['model_file']), @@ -2031,8 +2038,7 @@ class SfToolModel(models.Model): else: raise ValidationError("认证未通过") - - # 同步所有刀具型号列表 + # 同步所有刀具型号列表 def sync_all_tool_model(self): sf_sync_config = self.env['res.config.settings'].get_values() token = sf_sync_config['token']