From bc2c0f7fb0c4ff18b1a786bce067926513aa1c5d Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sun, 28 Apr 2024 15:17:41 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AB=99=E7=82=B9?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=9C=AA=E5=8F=98=EF=BC=8C=E5=8F=8A=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=AD=9B=E9=80=89=E6=A1=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/agv_setting.py | 2 ++ sf_manufacturing/models/mrp_workorder.py | 12 ++---------- sf_manufacturing/views/mrp_workorder_view.xml | 11 +++++++---- sf_plan/models/custom_plan.py | 3 ++- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/sf_manufacturing/models/agv_setting.py b/sf_manufacturing/models/agv_setting.py index dad6ec4f..164d3175 100644 --- a/sf_manufacturing/models/agv_setting.py +++ b/sf_manufacturing/models/agv_setting.py @@ -32,6 +32,8 @@ class AgvSetting(models.Model): if da['DeviceId'] == item.name: if da['AtHome'] is True: item.state = '占用' + else: + item.state = '空闲' class AgvTaskRoute(models.Model): diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index dd7dbd3c..9d64361e 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1081,9 +1081,7 @@ class WorkPieceDelivery(models.Model): delivery_num = fields.Char('工件配送编码') workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True) production_id = fields.Many2one('mrp.production', string='制造订单号', readonly=True) - production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id', - string='目的生产线', readonly=True, - store=True) + production_line_id = fields.Many2one('sf.production.line', string='目的生产线') plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True) route_id = fields.Many2one('sf.agv.task.route', '任务路线') @@ -1235,13 +1233,7 @@ class WorkPieceDelivery(models.Model): raise UserError(ret['message']) except Exception as e: logging.info('config-e:%s' % e) - raise UserError("工件配送请求agv失败") - - @api.onchange('production_id.production_line_id') - def _compute_production_line_id(self): - if self.production_id.production_line_id: - self.production_line_id = self.production_id.production_line_id.id - self.plan_start_processing_time = self.production_id.plan_start_processing_time + raise UserError("工件配送请求agv失败:%s" % e) @api.depends('task_delivery_time', 'task_completion_time') def _compute_delivery_duration(self): diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 0611e1e3..841b51ed 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -608,9 +608,12 @@ sf.workpiece.delivery - - - + + + + @@ -631,7 +634,7 @@ 工件配送 sf.workpiece.delivery - {'search_default_on_down':1} + {'search_default_on_up':1} tree,search [('type','in',['上产线','下产线'])] diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index fc38bc11..bcb15d69 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -84,7 +84,8 @@ class sf_production_plan(models.Model): item.sudo().production_id.production_line_id = item.production_line_id.id item.sudo().production_id.workorder_ids.filtered( lambda b: b.routing_type == "装夹预调").workpiece_delivery_ids.write( - {'production_line_id': item.production_line_id.id}) + {'production_line_id': item.production_line_id.id, + 'plan_start_processing_time': item.plan_start_processing_time}) # item.sudo().production_id.plan_start_processing_time = item.date_planned_start # @api.onchange('state') 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 02/18] =?UTF-8?q?1=E3=80=81=E5=88=80=E5=85=B7=E7=89=A9?= =?UTF-8?q?=E6=96=99=E5=88=80=E6=9F=84=E3=80=81=E5=A4=B9=E5=85=B7=E7=89=A9?= =?UTF-8?q?=E6=96=99=E6=89=98=E7=9B=98=E6=90=9C=E7=B4=A2=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E5=BA=8F=E5=88=97=E5=8F=B7=E5=AF=B9=E8=B1=A1=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=9A=84list=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0Rfid?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=9B2=E3=80=81=E5=88=B6=E9=80=A0?= =?UTF-8?q?=E5=8D=95=E6=90=9C=E7=B4=A2=E7=9C=8B=E6=9D=BF=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=B0=E6=95=B0=E5=8A=9F=E8=83=BD=EF=BC=9B3=E3=80=81?= =?UTF-8?q?=E5=88=80=E5=85=B7=E7=BB=84=E8=A3=85=E5=B2=97=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E7=9A=84=E8=AF=BB=E5=86=99=E6=9D=83=E9=99=90?= =?UTF-8?q?=EF=BC=9B4=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=BB=84=E8=A3=85=E5=8D=95=E5=BC=B9=E7=AA=97=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E8=BE=93=E5=85=A5=E4=BA=94=E7=A7=8D=E7=89=A9?= =?UTF-8?q?=E6=96=99=E7=9A=84=E8=B4=A7=E4=BD=8D=E7=BC=96=E7=A0=81=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9=E8=AF=A5=E8=B4=A7=E4=BD=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=A4=9A=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 From 45220d75af03ef8fce8f1933f102796a6ffd5bee Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sun, 28 Apr 2024 17:34:41 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=90=E9=80=81?= =?UTF-8?q?=E7=A9=BA=E6=96=99=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 4 +- sf_manufacturing/data/empty_racks_data.xml | 36 +++++++++ sf_manufacturing/models/mrp_workorder.py | 2 + sf_manufacturing/models/product_template.py | 4 +- .../views/mrp_production_addional_change.xml | 2 +- sf_manufacturing/views/mrp_workorder_view.xml | 76 +++++++++++++++++-- sf_plan/views/view.xml | 8 ++ sf_sale/models/quick_easy_order.py | 4 +- sf_sale/models/quick_easy_order_old.py | 4 +- 9 files changed, 125 insertions(+), 15 deletions(-) create mode 100644 sf_manufacturing/data/empty_racks_data.xml diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 1568f7c7..4358b35d 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -430,7 +430,7 @@ class Manufacturing_Connect(http.Controller): if 'DeviceId' in ret: logging.info('DeviceId:%s' % ret['DeviceId']) if 'IsComplete' in ret: - if ret['IsComplete'] is True: + if ret['IsComplete'] is True or ret['IsComplete'] is False: for i in range(1, 5): logging.info('F-RfidCode:%s' % i) if f'RfidCode{i}' in ret: @@ -482,7 +482,7 @@ class Manufacturing_Connect(http.Controller): logging.info('DeviceId:%s' % ret['DeviceId']) delivery_Arr = [] if 'IsComplete' in ret: - if ret['IsComplete'] is True: + if ret['IsComplete'] is True or ret['IsComplete'] is False: for i in range(1, 5): logging.info('F-RfidCode:%s' % i) if f'RfidCode{i}' in ret: diff --git a/sf_manufacturing/data/empty_racks_data.xml b/sf_manufacturing/data/empty_racks_data.xml new file mode 100644 index 00000000..90102ec2 --- /dev/null +++ b/sf_manufacturing/data/empty_racks_data.xml @@ -0,0 +1,36 @@ + + + + + 运送空料架路线:C01-A01 + sf.workpiece.delivery + WCA%(year)s%(month)s%(day)s + 4 + + + + + 运送空料架路线:B01-B02 + sf.workpiece.delivery + WBB%(year)s%(month)s%(day)s + 4 + + + + + 运送空料架路线:B01-A01 + sf.workpiece.delivery + WBA%(year)s%(month)s%(day)s + 4 + + + + + 运送空料架路线:C01-B02 + sf.workpiece.delivery + WCB%(year)s%(month)s%(day)s + 4 + + + + \ No newline at end of file diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 9d64361e..70551c5e 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1078,6 +1078,7 @@ class WorkPieceDelivery(models.Model): _name = "sf.workpiece.delivery" _description = '工件配送' + name = fields.Char('名称') delivery_num = fields.Char('工件配送编码') workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True) production_id = fields.Many2one('mrp.production', string='制造订单号', readonly=True) @@ -1095,6 +1096,7 @@ class WorkPieceDelivery(models.Model): status = fields.Selection( [('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发') is_cnc_program_down = fields.Boolean('程序是否下发', default=False) + active = fields.Boolean(string="有效", default=True) # @api.model # def create(self, vals): diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 16ea429a..d766629c 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -7,8 +7,8 @@ import os 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 class ResProductMo(models.Model): diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 0e1695ef..c90122f7 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -79,12 +79,12 @@ - + diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 841b51ed..28b06aeb 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -183,6 +183,8 @@ attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/> + sf.workpiece.delivery - - + + + + - + @@ -634,9 +636,71 @@ 工件配送 sf.workpiece.delivery - {'search_default_on_up':1} + tree,search [('type','in',['上产线','下产线'])] + + + + + 运送空料架 + sf.workpiece.delivery + + +
+
+ + + +
+
+
+ + + + 运送空料架 + sf.workpiece.delivery + +
+ +
+
+ + + + + + + +
+
+
+
+ + + + 运送空料架 + sf.workpiece.delivery + + + + + + + + + + + + 运送空料架 + sf.workpiece.delivery + + + tree,form + [('type','in',['运送空料架'])] + diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml index 68772142..96e19c8e 100644 --- a/sf_plan/views/view.xml +++ b/sf_plan/views/view.xml @@ -306,6 +306,14 @@ action="sf_manufacturing.sf_workpiece_delivery_act" parent="mrp.menu_mrp_manufacturing" /> + + diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 1ece6b86..ed52d9de 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -8,8 +8,8 @@ from datetime import datetime import requests from odoo import http from odoo.http import request -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 from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py index 724d4369..24bf5738 100644 --- a/sf_sale/models/quick_easy_order_old.py +++ b/sf_sale/models/quick_easy_order_old.py @@ -6,8 +6,8 @@ import os from datetime import datetime from stl import mesh # from OCC.Core.GProp import GProp_GProps -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 from odoo.addons.sf_base.commons.common import Common from odoo import models, fields, api from odoo.modules import get_resource_path From 537e89092609c5305731eb0f6e608f1c28e0ed20 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 29 Apr 2024 14:19:22 +0800 Subject: [PATCH 04/18] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E6=8B=86=E8=A7=A3=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E6=83=85=E5=86=B5=E4=B8=8B=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E7=9A=84=E4=BD=8D?= =?UTF-8?q?=E7=A7=BB=E8=AE=B0=E5=BD=95=EF=BC=9B=E6=B7=BB=E5=8A=A0=E6=8B=86?= =?UTF-8?q?=E8=A7=A3=E6=88=90=E5=8A=9F=E5=90=8E=E6=8B=86=E8=A7=A3=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E7=9A=84=E5=88=80=E5=85=B7=E6=97=A5=E5=BF=97=EF=BC=9B?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BD=93=E6=8B=86=E8=A7=A3=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E6=98=AF=E3=80=90=E6=9B=B4=E6=8D=A2=E4=B8=BA=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=88=80=E5=85=B7=E3=80=91=E6=97=B6=EF=BC=8C=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E5=BF=85=E5=A1=AB=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E8=B4=A7=E4=BD=8D=E7=9C=8B=E6=9D=BF=E6=B7=BB=E5=8A=A0=E6=8C=89?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 43 ++++++++++++-------- sf_tool_management/views/tool_base_views.xml | 18 +++++--- sf_warehouse/views/shelf_location.xml | 1 + 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 8673d370..b00ab209 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -769,6 +769,15 @@ class FunctionalToolDismantle(models.Model): chuck_freight_id = fields.Many2one('sf.shelf.location', '夹头目标货位', domain="[('product_id', 'in', (chuck_product_id, False))]") + @api.onchange('functional_tool_id') + def _onchange_freight(self): + for item in self: + item.integral_freight_id = False + item.blade_freight_id = False + item.bar_freight_id = False + item.pad_freight_id = False + item.chuck_freight_id = False + @api.depends('functional_tool_id') def _compute_functional_tool_num(self): for item in self: @@ -807,7 +816,7 @@ class FunctionalToolDismantle(models.Model): raise ValidationError('Rfid为【%s】的功能刀具已经拆解,请勿重复操作!' % self.functional_tool_id.rfid_dismantle) location = self.env['stock.location'].search([('name', '=', '刀具组装位置')]) location_dest = self.env['stock.location'].search([('name', '=', '刀具房')]) - # =================刀柄是否报废拆解======= + # =================刀柄是否[报废]拆解======= 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)]) @@ -822,34 +831,34 @@ class FunctionalToolDismantle(models.Model): # 刀柄不报废 入库到刀具房 lot.create_stock_quant(location, location_dest, functional_tool_assembly.id, '功能刀具拆解', functional_tool_assembly, functional_tool_assembly.tool_groups_id) - # ==============功能刀具报废拆解================ + # ==============功能刀具[报废]拆解================ if self.dismantle_cause in ['寿命到期报废', '崩刀报废']: # 除刀柄外物料报废 入库到Scrap - if self.integral_freight_id: + if self.integral_product_id: self.integral_product_id.dismantle_stock_moves(False, location, location_dest_scrap) - elif self.blade_freight_id: + elif self.blade_product_id: self.blade_product_id.dismantle_stock_moves(False, location, location_dest_scrap) - if self.bar_freight_id: + if self.bar_product_id: self.bar_product_id.dismantle_stock_moves(False, location, location_dest_scrap) - elif self.pad_freight_id: + elif self.pad_product_id: self.pad_product_id.dismantle_stock_moves(False, location, location_dest_scrap) - if self.chuck_freight_id: + if self.chuck_product_id: self.chuck_product_id.dismantle_stock_moves(False, location, location_dest_scrap) - # ===========功能刀具磨削拆解============== + # ===========功能刀具[磨削]拆解============== elif self.dismantle_cause in ['刀具需磨削']: location_dest = self.env['stock.location'].search([('name', '=', '磨削房')]) # 除刀柄外物料拆解 入库到具体库位 - if self.integral_freight_id: + if self.integral_product_id: self.integral_product_id.dismantle_stock_moves(False, location, location_dest) - elif self.blade_freight_id: + elif self.blade_product_id: self.blade_product_id.dismantle_stock_moves(False, location, location_dest) - if self.bar_freight_id: + if self.bar_product_id: self.bar_product_id.dismantle_stock_moves(False, location, location_dest) - elif self.pad_freight_id: + elif self.pad_product_id: self.pad_product_id.dismantle_stock_moves(False, location, location_dest) - if self.chuck_freight_id: + if self.chuck_product_id: self.chuck_product_id.dismantle_stock_moves(False, location, location_dest) - # ==============功能刀具更换拆解============== + # ==============功能刀具[更换]拆解============== elif self.dismantle_cause in ['更换为其他刀具']: # 除刀柄外物料拆解 入库到具体库位 if self.integral_freight_id: @@ -877,7 +886,7 @@ class FunctionalToolDismantle(models.Model): 'rfid': '', 'state': '已拆解' }) - logging.info('刀具拆解成功!') + logging.info('【%s】刀具拆解成功!' % self.name) class ProductProduct(models.Model): @@ -897,12 +906,12 @@ class ProductProduct(models.Model): location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)]) location.product_num = location.product_num + 1 else: - location = False + location = self.env['sf.shelf.location'] # 创建移动历史记录 stock_move_line_id = self.env['stock.move.line'].sudo().create({ 'product_id': self.id, 'move_id': stock_move_id.id, - 'current_location_id': location.id or False, + 'current_location_id': location.id, 'install_tool_time': fields.Datetime.now(), 'qty_done': 1.0, 'state': 'done', diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml index e907144d..61bbd110 100644 --- a/sf_tool_management/views/tool_base_views.xml +++ b/sf_tool_management/views/tool_base_views.xml @@ -846,7 +846,8 @@ attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/> - + @@ -855,7 +856,8 @@ + attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')], + 'required': [('chuck_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/> @@ -869,7 +871,8 @@ + attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')], + 'required': [('integral_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/> @@ -884,7 +887,8 @@ + attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')], + 'required': [('blade_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/> @@ -896,7 +900,8 @@ + attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')], + 'required': [('bar_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/> @@ -908,7 +913,8 @@ + attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')], + 'required': [('pad_freight_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具'])]}"/> diff --git a/sf_warehouse/views/shelf_location.xml b/sf_warehouse/views/shelf_location.xml index 90783fca..2f6317b9 100644 --- a/sf_warehouse/views/shelf_location.xml +++ b/sf_warehouse/views/shelf_location.xml @@ -246,6 +246,7 @@ +