From de6014d1dda1fdb0ce3e50a00f72d3b4f340ec25 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 21 Jun 2024 17:39:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E4=BA=A7=E7=BA=BF=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E5=BD=93RFID=E4=B8=8D=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E4=BA=A7=E7=BA=BF=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 78 +++++++++++---------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 61bc83ea..75badcc8 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -460,25 +460,27 @@ class Manufacturing_Connect(http.Controller): if f'RfidCode{i}' in ret: rfid_code = ret[f'RfidCode{i}'] logging.info('RfidCode:%s' % rfid_code) - domain = [ - ('rfid_code', '=', rfid_code), - ('routing_type', '=', 'CNC加工') - ] - workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') - if workorder: - for order in workorder: - if order.production_id.production_line_state == '待上产线': - logging.info( - '制造订单产线状态:%s' % order.production_id.production_line_state) - order.production_id.write({'production_line_state': '已上产线'}) - workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search([ - ('rfid_code', '=', rfid_code), ('type', '=', '上产线'), - ('production_id', '=', order.production_id.id)]) - if workpiece_delivery.status == '待下发': - workpiece_delivery.write({'is_manual_work': True}) - else: - res = {'Succeed': False, 'ErrorCode': 204, - 'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']} + if rfid_code is not None: + domain = [ + ('rfid_code', '=', rfid_code), + ('routing_type', '=', 'CNC加工') + ] + workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') + if workorder: + for order in workorder: + if order.production_id.production_line_state == '待上产线': + logging.info( + '制造订单产线状态:%s' % order.production_id.production_line_state) + order.production_id.write({'production_line_state': '已上产线'}) + workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( + [ + ('rfid_code', '=', rfid_code), ('type', '=', '上产线'), + ('production_id', '=', order.production_id.id)]) + if workpiece_delivery.status == '待下发': + workpiece_delivery.write({'is_manual_work': True}) + else: + res = {'Succeed': False, 'ErrorCode': 204, + 'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']} else: res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} else: @@ -515,24 +517,26 @@ class Manufacturing_Connect(http.Controller): if f'RfidCode{i}' in ret: rfid_code = ret[f'RfidCode{i}'] logging.info('RfidCode:%s' % rfid_code) - domain = [ - ('rfid_code', '=', rfid_code), - ('routing_type', '=', 'CNC加工') - ] - workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') - if workorder: - for order in workorder: - if order.production_id.production_line_state == '已上产线': - logging.info( - '制造订单产线状态:%s' % order.production_id.production_line_state) - order.production_id.write({'production_line_state': '已下产线'}) - workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search([ - ('rfid_code', '=', rfid_code), ('type', '=', '下产线'), - ('production_id', '=', order.production_id.id)]) - delivery_Arr.append(workpiece_delivery.id) - else: - res = {'Succeed': False, 'ErrorCode': 204, - 'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']} + if rfid_code is not None: + domain = [ + ('rfid_code', '=', rfid_code), + ('routing_type', '=', 'CNC加工') + ] + workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') + if workorder: + for order in workorder: + if order.production_id.production_line_state == '已上产线': + logging.info( + '制造订单产线状态:%s' % order.production_id.production_line_state) + order.production_id.write({'production_line_state': '已下产线'}) + workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( + [ + ('rfid_code', '=', rfid_code), ('type', '=', '下产线'), + ('production_id', '=', order.production_id.id)]) + delivery_Arr.append(workpiece_delivery.id) + else: + res = {'Succeed': False, 'ErrorCode': 204, + 'Error': 'DeviceId为%s没有对应的已配送工件数据' % ret['DeviceId']} if delivery_Arr: logging.info('delivery_Arr:%s' % delivery_Arr) delivery_workpiece = request.env['sf.workpiece.delivery'].sudo().search( From e453508f17233787215b2aec8ccb117f06e5250c Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 24 Jun 2024 14:18:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E6=B8=85=E5=8D=95=E6=9F=A5=E8=AF=A2=E5=88=97?= =?UTF-8?q?=E8=A1=A8:=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/views/tool_views.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index 1e82b8c2..c3bbb6d1 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -555,9 +555,9 @@ sf.tool.inventory - + - + From ec30a07394b561f93b6df76b96e15054c215031c Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 24 Jun 2024 14:54:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 8daf1488..7eea666b 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -1028,7 +1028,7 @@ class ProductProduct(models.Model): 'product_id': self.id, 'lot_id': lot_id.id, 'move_id': stock_move_id.id, - 'destination_location_id': shelf_location_id.id, + 'destination_location_id': shelf_location_id.id if shelf_location_id else False, 'install_tool_time': fields.Datetime.now(), 'qty_done': 1.0, 'state': 'done', From 828b4b0f6b6b6e5395809c6b21dc5b933f841a5f Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 24 Jun 2024 16:55:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=80=E5=85=B7=E6=B8=85=E5=8D=95=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/views/tool_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml index c3bbb6d1..87dbd94c 100644 --- a/sf_base/views/tool_views.xml +++ b/sf_base/views/tool_views.xml @@ -557,7 +557,7 @@ - +