From 6f2043e7e72a88253a5355a1cba2709664f2fff5 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Wed, 24 Apr 2024 18:33:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E5=B7=A5=E5=8D=95tree=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E3=80=81from=E8=A7=86=E5=9B=BE=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E7=BC=96=E7=A8=8B=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E5=8F=8A=E4=BA=BA=E5=B7=A5=E7=BC=96=E7=A8=8B=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E9=A1=B9=EF=BC=9B2=E3=80=81=E5=BA=8F=E5=88=97=E5=8F=B7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=B7=BB=E5=8A=A0=E6=A0=B9=E6=8D=AERfid?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=9A=84=E9=80=89=E9=A1=B9=EF=BC=9B3?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E9=9B=B6=E4=BB=B6=E7=89=B9=E9=87=87?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BC=98=E5=8C=96MES=E8=A3=85?= =?UTF-8?q?=E5=88=80=E7=94=B3=E8=AF=B7=E6=8E=A5=E5=8F=A3=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=9C=BA=E5=BA=8A=E5=88=80=E5=BA=93=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/WorkCenterBarcodes.xml | 7 +++++- .../views/mrp_production_addional_change.xml | 1 + sf_manufacturing/views/mrp_workorder_view.xml | 5 +++++ sf_manufacturing/views/stock_lot_views.xml | 22 +++++++++++++++++++ sf_quality/models/quality.py | 3 +++ .../models/maintenance_equipment.py | 5 +++-- sf_tool_management/models/mrp_workorder.py | 5 +++-- 7 files changed, 43 insertions(+), 5 deletions(-) diff --git a/sf_machine_connect/views/WorkCenterBarcodes.xml b/sf_machine_connect/views/WorkCenterBarcodes.xml index 0a0cccd6..d44c8a82 100644 --- a/sf_machine_connect/views/WorkCenterBarcodes.xml +++ b/sf_machine_connect/views/WorkCenterBarcodes.xml @@ -10,6 +10,7 @@ + @@ -19,7 +20,11 @@ - + + + + + \ No newline at end of file diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 6ba78573..3cc85e64 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -66,6 +66,7 @@ + diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 0cc541e7..37174039 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -23,6 +23,9 @@ + + + @@ -173,6 +176,8 @@ attrs="{'invisible': [('production_state','=', 'draft')], 'readonly': [('is_user_working', '=', True)]}" sum="real duration"/> + + + + stock.production.lot.view + stock.lot + + + + + + + + + + stock.production.lot.tree.inherit.product.expiry + stock.lot + + + + + + + \ No newline at end of file diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index 92914344..c738d4e1 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -20,6 +20,9 @@ class QualityCheck(models.Model): production_id = self.env['mrp.production'].sudo().search([('name', '=', origin)]) rfid = '' if not production_id.workorder_ids else production_id.workorder_ids[-1].rfid_code or '' val = [rfid] + # todo 需修改 + val = ['0037818516'] + logging.info('获取到的工单信息%s' % val) r = requests.post(crea_url, json=val, headers=headers) ret = r.json() logging.info('_register_quality_check:%s' % ret) diff --git a/sf_tool_management/models/maintenance_equipment.py b/sf_tool_management/models/maintenance_equipment.py index fef6c67c..135bf200 100644 --- a/sf_tool_management/models/maintenance_equipment.py +++ b/sf_tool_management/models/maintenance_equipment.py @@ -63,10 +63,11 @@ class SfMaintenanceEquipment(models.Model): for data in datas: maintenance_equipment_id = self.search([('name', '=', data['DeviceId'])]) if maintenance_equipment_id: + tool_id = '%s%s' % (data['ToolId'][0:1], data['ToolId'][1:].zfill(2)) equipment_tool_id = self.env['maintenance.equipment.tool'].sudo().search( - [('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', data['ToolId'])]) + [('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', tool_id)]) functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search( - [('rfid', '=', data['RfidCode'])]) + [('rfid', '=', str(int(data['RfidCode'])))]) time = None if data['AddDatetime']: datatime = str(data['AddDatetime']) diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index 45ddb317..b4f420f5 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -16,10 +16,11 @@ class CNCprocessing(models.Model): # token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A] headers = {'Authorization': config['center_control_Authorization']} crea_url = config['center_control_url'] + "/AutoDeviceApi/ToolLoadInstruct" + # todo val = { 'DeviceId': knife_plan.machine_table_name, - 'RfidCode': knife_plan.sf_functional_tool_assembly_id.rfid, - 'ToolId': int(knife_plan.cutter_spacing_code_id.code[1:]) + 'RfidCode': knife_plan.sf_functional_tool_assembly_id.rfid.zfill(10), + 'ToolId': int(knife_plan.cam_cutter_spacing_code[1:]) } r = requests.post(crea_url, json=val, headers=headers) ret = r.json() From 9d96e0681c6976817e436782d23bc1d8d9ef1f78 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 25 Apr 2024 14:02:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1=E3=80=81=E6=B3=A8=E9=87=8AMES=E8=A3=85?= =?UTF-8?q?=E5=88=80=E6=8C=87=E4=BB=A4=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=89=80=E4=BB=A5=E8=AF=A5=E6=8E=A5=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E7=94=A8=EF=BC=9B=E6=B3=A8=E9=87=8A=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=A4=B1=E8=B4=A5=E6=97=B6=E5=AF=B9=E9=9B=B6?= =?UTF-8?q?=E4=BB=B6=E7=89=B9=E9=87=87=E6=8E=A5=E5=8F=A3=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E7=94=A8=EF=BC=9B2=E3=80=81=E5=BA=8F=E5=88=97=E5=8F=B7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8Bfrom=E7=95=8C=E9=9D=A2=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=92=AE=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=B7=A5=E5=8E=82=E5=BD=95=E5=85=A5=E7=9A=84=E6=9C=89=E4=BA=9B?= =?UTF-8?q?=E5=88=80=E6=9F=84=E5=BA=8F=E5=88=97=E5=8F=B7=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E4=BD=8D=E6=95=B0=E5=B0=91=E4=BA=8E10=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=88=E9=80=9A=E8=BF=87SQL=E5=9C=A8=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E8=A1=A5=E9=9B=B6=EF=BC=89=EF=BC=88=E5=B7=B2=E9=9A=90?= =?UTF-8?q?=E8=97=8F=EF=BC=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 7 ++++ sf_manufacturing/views/stock_lot_views.xml | 3 ++ sf_quality/models/quality.py | 14 ++++---- sf_tool_management/models/base.py | 4 --- sf_tool_management/models/mrp_workorder.py | 35 ++++++++++---------- sf_tool_management/views/tool_base_views.xml | 2 -- sf_tool_management/wizard/wizard.py | 1 - 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 94a9d646..df9ed02e 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -269,6 +269,13 @@ class ProductionLot(models.Model): rfid = fields.Char('Rfid', readonly=True) product_specification = fields.Char('规格', compute='_compute_product_specification', store=True) + def search_lot_put_rfid(self): + # 使用SQL将所有刀柄Rfid不满十位的值在前方补零 + self.env.cr.execute( + '''UPDATE stock_lot SET rfid = LPAD(rfid, 10, '0') WHERE rfid IS NOT NULL AND LENGTH(rfid) < 10''' + ) + self.env.cr.commit() + @api.depends('product_id') def _compute_product_specification(self): for stock in self: diff --git a/sf_manufacturing/views/stock_lot_views.xml b/sf_manufacturing/views/stock_lot_views.xml index 87b81802..2aed0d2c 100644 --- a/sf_manufacturing/views/stock_lot_views.xml +++ b/sf_manufacturing/views/stock_lot_views.xml @@ -19,6 +19,9 @@ + +