From 8e3a31620040d763138f23d9cab66d67cf6518d7 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 24 Jan 2024 17:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=89=93=E5=8D=B0=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8F=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 165 +------ sf_manufacturing/views/stock_picking_view.xml | 11 + sf_warehouse/models/model.py | 3 +- .../views/change_stock_move_views.xml | 39 +- stock_barcode/models/stock_move_line.py | 9 +- stock_barcode/views/stock_move_line_views.xml | 403 ++++++++++-------- stock_barcode/views/stock_picking_views.xml | 327 +++++++------- 7 files changed, 430 insertions(+), 527 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 06269fc5..a39bd0f4 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -359,7 +359,6 @@ class ReStockMove(models.Model): materiel_height = fields.Float(string='物料高度', digits=(16, 4)) def _get_new_picking_values_Res(self, item, sorted_workorders, rescode): - logging.info('new_picking-rescode: %s' % rescode) return { 'name': self.env['stock.picking']._get_name_Res(rescode), 'origin': item.name, @@ -373,165 +372,11 @@ class ReStockMove(models.Model): 'state': 'confirmed', } - # 将采购到的夹具注册到Cloud - def _register_fixture(self): - create_url = '/api/factory_fixture_material/create' - config = self.env['res.config.settings'].get_values() - headers = Common.get_headers(self, config['token'], config['sf_secret_key']) - strurl = config['sf_url'] + create_url - for item in self: - val = { - 'token': config['token'], - 'name': item.product_id.name, - 'brand_code': self.env['sf.machine.brand'].search([('id', '=', item.product_id.brand_id.id)]).code, - 'fixture_material_code': self.env['sf.fixture.material'].search( - [('id', '=', item.product_id.fixture_material_id.id)]).code, - 'fixture_materials_type_code': self.env['sf.materials.model'].search( - [('id', '=', item.product_id.materials_type_id.id)]).materials_no, - 'fixture_clamping_way': item.product_id.fixture_clamping_way, - 'fixture_port_type': item.product_id.fixture_port_type, - 'fixture_length': item.product_id.tool_length, - 'fixture_width': item.product_id.tool_width, - 'fixture_height': item.product_id.tool_height, - 'fixture_weight': item.product_id.tool_weight, - 'fixture_amount': int(item.quantity_done), - 'fixture_model_file': '' if not item.product_id.fixture_model_file else base64.b64encode( - item.product_id.fixture_model_file).decode( - 'utf-8'), - 'fixture_clamp_workpiece_length_max': item.product_id.fixture_clamp_workpiece_length_max, - 'fixture_clamp_workpiece_width_max': item.product_id.fixture_clamp_workpiece_width_max, - 'fixture_clamp_workpiece_height_max': item.product_id.fixture_clamp_workpiece_height_max, - 'fixture_clamp_workpiece_diameter_max': item.product_id.fixture_clamp_workpiece_diameter_max, - 'fixture_maximum_carrying_weight': item.product_id.fixture_maximum_carrying_weight, - 'fixture_maximum_clamping_force': item.product_id.fixture_maximum_clamping_force, - 'fixture_driving_way': '' if not item.product_id.fixture_driving_way - else item.product_id.fixture_driving_way, - 'fixture_apply_machine_tool_type_codes': self.env[ - 'product.template']._json_apply_machine_tool_type_item_code(item), - 'fixture_through_hole_size': item.product_id.fixture_through_hole_size, - 'fixture_screw_size': item.product_id.fixture_screw_size, - } - try: - if item.product_id.industry_code: - val['industry_code'] = item.product_id.industry_code - ret = requests.post(strurl, json={}, data=val, headers=headers) - ret = ret.json() - if ret['status'] == 200: - if not item.product_id.industry_code: - item.product_id.write({'register_state': '已注册', 'industry_code': ret['industry_code']}) - else: - item.product_id.write({'register_state': '已注册'}) - else: - item.product_id.write({'register_state': '注册失败'}) - except Exception as e: - raise UserError("注册夹具到云端失败,请联系管理员!") - - # 将采购到的刀具注册到Cloud - def _register_cutting_tool(self): - create_url = '/api/factory_cutting_tool_material/create' - config = self.env['res.config.settings'].get_values() - headers = Common.get_headers(self, config['token'], config['sf_secret_key']) - strurl = config['sf_url'] + create_url - for item in self: - val = { - 'token': config['token'], - 'name': item.product_id.name, - 'brand_code': self.env['sf.machine.brand'].search([('id', '=', item.product_id.brand_id.id)]).code, - 'cutting_tool_material_code': self.env['sf.cutting.tool.material'].search( - [('id', '=', item.product_id.cutting_tool_material_id.id)]).code, - 'cutting_tool_type_code': self.env['sf.cutting.tool.type'].search( - [('id', '=', item.product_id.cutting_tool_type_id.id)]).code, - 'material_model_code': self.env['sf.materials.model'].search( - [('id', '=', item.product_id.materials_type_id.id)]).materials_no, - 'tool_length': item.product_id.tool_length, - 'tool_width': item.product_id.tool_width, - 'tool_height': item.product_id.tool_height, - 'tool_thickness': item.product_id.tool_thickness, - 'tool_weight': item.product_id.tool_weight, - 'tool_hardness': item.product_id.tool_hardness, - 'coating_material': item.product_id.coating_material, - 'amount': int(item.quantity_done), - # 'model_file': '' if not item.product_id.fixture_model_file else base64.b64encode( - # item.product_id.fixture_model_file).decode( - # 'utf-8'), - 'total_length': item.product_id.cutting_tool_total_length, - 'shank_length': item.product_id.cutting_tool_shank_length, - 'blade_length': item.product_id.cutting_tool_blade_length, - 'neck_length': item.product_id.cutting_tool_neck_length, - 'neck_diameter': item.product_id.cutting_tool_neck_diameter, - 'shank_diameter': item.product_id.cutting_tool_shank_diameter, - 'blade_tip_diameter': item.product_id.cutting_tool_blade_tip_diameter, - 'blade_tip_taper': item.product_id.cutting_tool_blade_tip_taper, - 'blade_helix_angle': item.product_id.cutting_tool_blade_helix_angle, - 'blade_type': item.product_id.cutting_tool_blade_type, - 'coarse_medium_fine': '' if item.product_id.cutting_tool_coarse_medium_fine is False - else item.product_id.cutting_tool_coarse_medium_fine, - 'run_out_accuracy_max': item.product_id.cutting_tool_run_out_accuracy_max, - 'run_out_accuracy_min': item.product_id.cutting_tool_run_out_accuracy_min, - 'head_diameter': item.product_id.cutting_tool_head_diameter, - 'diameter': item.product_id.cutting_tool_diameter, - 'blade_number': '' if item.product_id.cutting_tool_blade_number is False - else item.product_id.cutting_tool_blade_number, - 'front_angle': item.product_id.cutting_tool_front_angle, - 'rear_angle': item.product_id.cutting_tool_rear_angle, - 'main_included_angle': item.product_id.cutting_tool_main_included_angle, - 'chuck_codes': self.env['product.template']._json_chuck_item_code(item), - 'cutter_bar_codes': self.env['product.template']._json_cutter_bar_item_code(item), - 'cutter_pad_codes': self.env['product.template']._json_cutter_pad_item_code(item), - 'blade_codes': self.env['product.template']._json_blade_item_code(item), - 'handle_codes': self.env['product.template']._json_handle_item_code(item), - 'nut': item.product_id.cutting_tool_nut, - 'top_angle': item.product_id.cutting_tool_top_angle, - 'jump_accuracy': item.product_id.cutting_tool_jump_accuracy, - 'working_hardness': item.product_id.cutting_tool_working_hardness, - 'blade_diameter': item.product_id.cutting_tool_blade_diameter, - 'wrench': item.product_id.cutting_tool_wrench, - 'accuracy_level': item.product_id.cutting_tool_accuracy_level, - 'clamping_way': item.product_id.cutting_tool_clamping_way, - 'clamping_length': item.product_id.cutting_tool_clamping_length, - 'clamping_tolerance': item.product_id.cutting_tool_clamping_tolerance, - 'diameter_max': item.product_id.cutting_tool_diameter_max, - 'clamping_diameter_min': item.product_id.cutting_tool_clamping_diameter_min, - 'clamping_diameter_max': item.product_id.cutting_tool_clamping_diameter_max, - 'detection_accuracy_max': item.product_id.cutting_tool_detection_accuracy_max, - 'detection_accuracy_min': item.product_id.cutting_tool_detection_accuracy_min, - 'is_rough_finish': item.product_id.cutting_tool_is_rough_finish, - 'is_finish': item.product_id.cutting_tool_is_finish, - 'is_drill_hole': item.product_id.cutting_tool_is_drill_hole, - 'is_safety_lock': item.product_id.cutting_tool_is_safety_lock, - 'is_high_speed_cutting': item.product_id.cutting_tool_is_high_speed_cutting, - 'dynamic_balance_class': item.product_id.cutting_tool_dynamic_balance_class, - 'change_time': item.product_id.cutting_tool_change_time, - 'standard_speed': item.product_id.cutting_tool_standard_speed, - 'speed_max': item.product_id.cutting_tool_speed_max, - 'cooling_type': item.product_id.cutting_tool_cooling_type, - 'body_accuracy': item.product_id.cutting_tool_body_accuracy, - 'apply_lock_nut_model': item.product_id.apply_lock_nut_model, - 'apply_lock_wrench_model': item.product_id.apply_lock_wrench_model, - 'tool_taper': item.product_id.cutting_tool_taper, - 'flange_length': item.product_id.cutting_tool_flange_length, - 'flange_diameter': item.product_id.cutting_tool_flange_diameter, - 'outer_diameter': item.product_id.cutting_tool_outer_diameter, - 'inner_diameter': item.product_id.cutting_tool_inner_diameter, - 'cooling_suit_type_ids': item.product_id.cooling_suit_type_ids, - 'er_size_model': item.product_id.cutting_tool_er_size_model, - 'image': '' if not item.product_id.image_1920 else - base64.b64encode(item.product_id.image_1920).decode('utf-8'), - } - try: - if item.product_id.industry_code: - val['industry_code'] = item.product_id.industry_code - ret = requests.post(strurl, json={}, data=val, headers=headers) - ret = ret.json() - if ret['status'] == 200: - if not item.product_id.industry_code: - item.product_id.write({'register_state': '已注册', 'industry_code': ret['industry_code']}) - else: - item.product_id.write({'register_state': '已注册'}) - else: - item.product_id.write({'register_state': '注册失败'}) - except Exception as e: - raise UserError("注册刀具到云端失败,请联系管理员!") + def print_serial_numbers(self): + if not self.next_serial: + raise UserError(_("请先分配序列号再进行打印")) + for item in self.move_line_ids: + print(item.lot_name) class ReStockQuant(models.Model): diff --git a/sf_manufacturing/views/stock_picking_view.xml b/sf_manufacturing/views/stock_picking_view.xml index a287fbec..13bb12c2 100644 --- a/sf_manufacturing/views/stock_picking_view.xml +++ b/sf_manufacturing/views/stock_picking_view.xml @@ -1,6 +1,17 @@ + + stock.move.operations.form.inherit.sf + stock.move + + + + + -
- -
- - -
-
+ + + - - stock.barcode.quant.kanban - stock.quant - 1000 - - - - - - -
- -
-
- - - + + stock.barcode.quant.kanban + stock.quant + 1000 + + + + + + +
+ + + +
+
+ + + +
-
- - - - - + + + + + - - stock.quant.kanban.barcode - stock.quant - 1000 - - - - -
-
- + + stock.quant.kanban.barcode + stock.quant + 1000 + + + + +
+
+ + + +
+
+ + + + + +
+
+ + +
+
+ + +
-
- - - - -
-
- -
-
- -
-
- - - - - + + + + + - - stock_barcode.quant.tree.inherit - stock.quant - - primary - - - UoM - show - - - hide - - - hide - - - + + stock_barcode.quant.tree.inherit + stock.quant + + primary + + + UoM + show + + + hide + + + hide + + + diff --git a/stock_barcode/views/stock_picking_views.xml b/stock_barcode/views/stock_picking_views.xml index d61de200..d516844c 100644 --- a/stock_barcode/views/stock_picking_views.xml +++ b/stock_barcode/views/stock_picking_views.xml @@ -1,181 +1,174 @@ - - - stock.move.line.operations.tree.inherit - stock.move.line - - - - - - - - {'barcode_events': True} - field_float_scannable - - - + + + + stock.move.line.kanban.inherited + stock.move.line + + + + + + + + + + - - stock.move.line.kanban.inherited - stock.move.line - - - - - - - - - - - - - stock.picking.form.view.barcode - stock.picking - 1000 - -
- - - -
- -
-
+ + + + + + +
+
+ +
+ - - Open picking form - stock.picking - form - { - 'res_id': active_id, - } - - + + Open picking form + stock.picking + form + { + 'res_id': active_id, + } + + - - stock.picking.view.kanban.barcode - stock.picking - - + + stock.picking.view.kanban.barcode + stock.picking + + - - - - - - + + + + + + - - Operation Types - stock.picking.type - - - - - - - + + Operation Types + stock.picking.type + + + + + + + - - Operation Types - stock.picking.type - - - - - - - - - - - - - - - - - - - - + Operation Types + stock.picking.type + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + +