From d52f5fa8419e77b81cd619ff6108670a9cc64d25 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Wed, 11 Jun 2025 11:15:03 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=97=B6=E6=8A=A5=E9=94=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_message/models/sf_message_quality_check.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sf_message/models/sf_message_quality_check.py b/sf_message/models/sf_message_quality_check.py index 31e92370..1f0950ad 100644 --- a/sf_message/models/sf_message_quality_check.py +++ b/sf_message/models/sf_message_quality_check.py @@ -43,14 +43,17 @@ class SFMessageQualityCheck(models.Model): # ('message_template_id', '=', message_template.id)]) # return jikimo_message_queue def write(self, vals): - original_state = self.quality_state + original_state = {} + for item in self: + original_state.update({f'{item.id}': item.quality_state}) res = super(SFMessageQualityCheck, self).write(vals) - if res and vals.get('quality_state') == 'none' and original_state != 'none': - message_template_id = self.env['jikimo.message.template'].sudo().search([('name', '=', '待质检提醒')]) - queue_id = self.env['jikimo.message.queue'].sudo().search( - [('message_template_id', '=', message_template_id[-1].id), ('res_id', '=', self.id)]) - if not queue_id and '制造' not in [pt.name for pt in self.point_id.picking_type_ids]: - self.add_queue('待质检') + for item in self: + if vals.get('quality_state') == 'none' and original_state.get(f'{item.id}') != 'none': + message_template_id = self.env['jikimo.message.template'].sudo().search([('name', '=', '待质检提醒')]) + queue_id = self.env['jikimo.message.queue'].sudo().search( + [('message_template_id', '=', message_template_id[-1].id), ('res_id', '=', item.id)]) + if not queue_id and '制造' not in [pt.name for pt in item.point_id.picking_type_ids]: + item.add_queue('待质检') return res def _get_message(self, message_queue_ids): From 62ead52f0078cd07434bc2bb4d02ebf6eab50d4d Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Wed, 11 Jun 2025 17:18:59 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E9=A2=84=E8=AD=A6=E6=97=B6=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E8=AE=B0=E5=BD=95=E5=92=8C=E5=8A=9F=E8=83=BD=E5=88=80?= =?UTF-8?q?=E5=85=B7=E6=8B=86=E8=A7=A3=E5=8D=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 27 +------ sf_tool_management/models/functional_tool.py | 14 ---- .../views/functional_tool_views.xml | 1 - sf_warehouse/models/sync_common.py | 71 +++++++++++-------- 4 files changed, 41 insertions(+), 72 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 70b0b87b..7203f19c 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -445,32 +445,7 @@ class Manufacturing_Connect(http.Controller): shelfinfo = list(filter(lambda x: x.get('DeviceId') == DeciveId, request.env['sf.shelf.location'].sudo().get_sf_shelf_location_info( DeciveId))) - total_data = request.env['sf.shelf.location.datasync'].sudo().get_total_data() - for item in shelfinfo: - logging.info('货架已获取信息:%s' % item) - shelf_barcode = request.env['sf.shelf.location.datasync'].sudo().find_our_code( - total_data, item['Postion']) - location_id = request.env['sf.shelf.location'].sudo().search( - [('barcode', '=', shelf_barcode)], - limit=1) - if location_id: - # 如果是线边刀库信息,则对功能刀具移动生成记录 - if 'Tool' in item['Postion']: - tool = request.env['sf.functional.cutting.tool.entity'].sudo().search( - [('rfid', '=', item['RfidCode']), ('functional_tool_status', '!=', '已拆除')]) - tool.sudo().tool_in_out_stock_location(location_id) - if tool: - location_id.product_sn_id = tool.barcode_id.id - # 修改功能刀具状态 - if item.get('State') == '报警': - if tool.functional_tool_status != item.get('State'): - tool.write({ - 'functional_tool_status': item['State'] - }) - else: - location_id.product_sn_id = False - if item['RfidCode']: - logging.info('Rfid为【%s】的功能刀具在系统中不存在!' % item['RfidCode']) + request.env['sf.shelf.location.datasync'].sudo().set_shelf_location(shelfinfo) else: equipment_id = request.env['maintenance.equipment'].sudo().search([('name', '=', DeciveId)]) if equipment_id: diff --git a/sf_tool_management/models/functional_tool.py b/sf_tool_management/models/functional_tool.py index dcbca0e7..2568dc89 100644 --- a/sf_tool_management/models/functional_tool.py +++ b/sf_tool_management/models/functional_tool.py @@ -58,20 +58,6 @@ class FunctionalCuttingToolEntity(models.Model): safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools', string='功能刀具安全库存', readonly=True) - @api.onchange('functional_tool_status') - def _onchange_functional_tool_status(self): - for item in self: - if item: - if item.functional_tool_status == '报警': - self.create_tool_dismantle() - - def set_functional_tool_status(self): - # self.write({ - # 'functional_tool_status': '报警' - # }) - self.functional_tool_status = '报警' - self.create_tool_dismantle() - def create_tool_dismantle(self): for item in self: # 创建报警刀具拆解单 diff --git a/sf_tool_management/views/functional_tool_views.xml b/sf_tool_management/views/functional_tool_views.xml index 25b9346a..a306d6dd 100644 --- a/sf_tool_management/views/functional_tool_views.xml +++ b/sf_tool_management/views/functional_tool_views.xml @@ -42,7 +42,6 @@
-