From 9d9b454ba5013f25903fd2b2841465f5f76b50db Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Sun, 28 Apr 2024 17:20:11 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=88=80=E6=9F=84=E3=80=81=E5=A4=B9=E5=85=B7=E7=89=A9=E6=96=99?= =?UTF-8?q?=E6=89=98=E7=9B=98=E6=90=9C=E7=B4=A2=E6=A8=A1=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8F=B7=E5=AF=B9=E8=B1=A1=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=9A=84list=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0Rfid=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=9B2=E3=80=81=E5=88=B6=E9=80=A0=E5=8D=95?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=9C=8B=E6=9D=BF=E6=B7=BB=E5=8A=A0=E8=AE=B0?= =?UTF-8?q?=E6=95=B0=E5=8A=9F=E8=83=BD=EF=BC=9B3=E3=80=81=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E5=B2=97=E6=B7=BB=E5=8A=A0=E8=B4=A7?= =?UTF-8?q?=E4=BD=8D=E7=9A=84=E8=AF=BB=E5=86=99=E6=9D=83=E9=99=90=EF=BC=9B?= =?UTF-8?q?4=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E7=BB=84?= =?UTF-8?q?=E8=A3=85=E5=8D=95=E5=BC=B9=E7=AA=97=E6=B7=BB=E5=8A=A0=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E8=BE=93=E5=85=A5=E4=BA=94=E7=A7=8D=E7=89=A9=E6=96=99?= =?UTF-8?q?=E7=9A=84=E8=B4=A7=E4=BD=8D=E7=BC=96=E7=A0=81=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E8=AF=A5=E8=B4=A7=E4=BD=8D=E8=BF=9B=E8=A1=8C=E5=A4=9A?= =?UTF-8?q?=E9=A1=B9=E6=A0=A1=E9=AA=8C=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odoo.conf | 2 +- .../views/mrp_production_addional_change.xml | 2 +- sf_tool_management/models/base.py | 4 +- .../views/fixture_material_search_views.xml | 1 + sf_tool_management/views/tool_base_views.xml | 2 - .../views/tool_material_search.xml | 1 + sf_tool_management/wizard/wizard.py | 76 ++++++++++++++++--- sf_warehouse/security/ir.model.access.csv | 1 + 8 files changed, 73 insertions(+), 16 deletions(-) diff --git a/odoo.conf b/odoo.conf index 48ce1738..8db2413f 100644 --- a/odoo.conf +++ b/odoo.conf @@ -4,7 +4,7 @@ csv_internal_sep = , data_dir = /var/lib/odoo db_host = 172.17.0.2 db_maxconn = 64 -db_name = sf_t2cs_003 +db_name = sf_t_0430 db_password = sf db_port = 5432 db_sslmode = prefer diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 0e1695ef..7054f73d 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -380,7 +380,7 @@ diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index ed1cf129..8673d370 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -345,7 +345,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model): # 创建装刀请求 knife_plan.apply_for_tooling() else: - logging.info('功能刀具【%s】满足CNC用刀需求!!!') + logging.info('功能刀具【%s】满足CNC用刀需求!!!' % cnc_processing.cutting_tool_name) class FunctionalToolAssembly(models.Model): @@ -811,6 +811,8 @@ class FunctionalToolDismantle(models.Model): location_dest_scrap = self.env['stock.location'].search([('name', '=', 'Scrap')]) if self.handle_rfid: lot = self.env['stock.lot'].sudo().search([('rfid', '=', self.handle_rfid)]) + if not lot: + raise ValidationError('Rfid为【%s】的功能刀具序列号不存在!' % self.handle_rfid) functional_tool_assembly = self.functional_tool_id.functional_tool_name_id if self.scrap_boolean: # 刀柄报废 入库到Scrap diff --git a/sf_tool_management/views/fixture_material_search_views.xml b/sf_tool_management/views/fixture_material_search_views.xml index c8f6592f..546d968e 100644 --- a/sf_tool_management/views/fixture_material_search_views.xml +++ b/sf_tool_management/views/fixture_material_search_views.xml @@ -61,6 +61,7 @@ + diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index 274d3bcc..e907144d 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -944,7 +944,5 @@ {'search_default_no_dismantle_state':1} - - diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index d4772244..eb7a2418 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -61,6 +61,7 @@ + diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index 7a4f1553..a77c9010 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -246,9 +246,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel): if self.integral_freight_barcode: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.integral_freight_barcode)]) if location: - self.integral_product_id = location.product_id.id + if not location.product_id: + raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode) + else: + material_name_id = location.product_id.cutting_tool_material_id + if material_name_id and material_name_id.name == '整体式刀具': + if location.product_num == 0: + raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode) + self.integral_product_id = location.product_id.id + else: + raise ValidationError( + '编码为【%s】的货位存放的产品为【%s】,不是整体式刀具,请重新选择!' % ( + location.barcode, location.product_id.name)) else: - self.integral_product_id = False + raise ValidationError('编码为【%s】的货位不存在!' % self.integral_freight_barcode) # ===============刀片型号==================== blade_freight_barcode = fields.Char('刀片货位') @@ -265,9 +276,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel): if self.blade_freight_barcode: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.blade_freight_barcode)]) if location: - self.blade_product_id = location.product_id.id + if not location.product_id: + raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode) + else: + material_name_id = location.product_id.cutting_tool_material_id + if material_name_id and material_name_id.name == '刀片': + if location.product_num == 0: + raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode) + self.blade_product_id = location.product_id.id + else: + raise ValidationError( + '编码为【%s】的货位存放的产品为【%s】,不是刀片,请重新选择!' % ( + location.barcode, location.product_id.name)) else: - self.blade_product_id = False + raise ValidationError('编码为【%s】的货位不存在!' % self.blade_freight_barcode) # ====================刀杆型号================== bar_freight_barcode = fields.Char('刀杆货位') @@ -284,9 +306,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel): if self.bar_freight_barcode: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.bar_freight_barcode)]) if location: - self.bar_product_id = location.product_id.id + if not location.product_id: + raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode) + else: + material_name_id = location.product_id.cutting_tool_material_id + if material_name_id and material_name_id.name == '刀杆': + if location.product_num == 0: + raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode) + self.bar_product_id = location.product_id.id + else: + raise ValidationError( + '编码为【%s】的货位存放的产品为【%s】,不是刀杆,请重新选择!' % ( + location.barcode, location.product_id.name)) else: - self.bar_product_id = False + raise ValidationError('编码为【%s】的货位不存在!' % self.bar_freight_barcode) # ===============刀盘型号=================== pad_freight_barcode = fields.Char('刀盘货位') @@ -303,9 +336,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel): if self.pad_freight_barcode: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.pad_freight_barcode)]) if location: - self.pad_product_id = location.product_id.id + if not location.product_id: + raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode) + else: + material_name_id = location.product_id.cutting_tool_material_id + if material_name_id and material_name_id.name == '刀盘': + if location.product_num == 0: + raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode) + self.pad_product_id = location.product_id.id + else: + raise ValidationError( + '编码为【%s】的货位存放的产品为【%s】,不是刀盘,请重新选择!' % ( + location.barcode, location.product_id.name)) else: - self.pad_product_id = False + raise ValidationError('编码为【%s】的货位不存在!' % self.pad_freight_barcode) # ================刀柄型号=============== handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_rfid') @@ -342,12 +386,22 @@ class FunctionalToolAssemblyOrder(models.TransientModel): if self.chuck_freight_barcode: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.chuck_freight_barcode)]) if location: - self.chuck_product_id = location.product_id.id + if not location.product_id: + raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode) + else: + material_name_id = location.product_id.cutting_tool_material_id + if material_name_id and material_name_id.name == '夹头': + if location.product_num == 0: + raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode) + self.chuck_product_id = location.product_id.id + else: + raise ValidationError( + '编码为【%s】的货位存放的产品为【%s】,不是夹头,请重新选择!' % ( + location.barcode, location.product_id.name)) else: - self.chuck_product_id = False + raise ValidationError('编码为【%s】的货位不存在!' % self.chuck_freight_barcode) # ======================================== - def on_barcode_scanned(self, barcode): """ 智能工厂组装单处扫码绑定刀具物料 diff --git a/sf_warehouse/security/ir.model.access.csv b/sf_warehouse/security/ir.model.access.csv index a5b3b2fa..3d7d9a98 100644 --- a/sf_warehouse/security/ir.model.access.csv +++ b/sf_warehouse/security/ir.model.access.csv @@ -136,6 +136,7 @@ access_sf_shelf_location_wizard_group_plan_dispatch,sf_shelf_location_wizard_gro access_sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_user,1,0,0,0 access_sf_shelf_location_wizard_group_sf_stock_manager,sf_shelf_location_wizard_group_sf_stock_manager,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_manager,1,1,1,0 +access_sf_shelf_location_group_sf_tool_user,sf.shelf.location.group_sf_tool_user,model_sf_shelf_location,sf_base.group_sf_tool_user,1,1,0,0