From decfd2740125cc787f58f62157ca61e426087119 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 29 May 2024 12:41:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8Dcnc=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=A8=8B=E5=BA=8F=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=202.=E4=BF=AE=E5=A4=8D=E7=BC=96=E7=A8=8B=E5=8D=95?= =?UTF-8?q?=E5=B7=B2=E4=B8=8B=E5=8F=91=EF=BC=8C=E5=9C=A8=E5=B7=A5=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E9=80=81=E6=97=B6=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=9C=AA?= =?UTF-8?q?=E4=B8=8B=E5=8F=91nc=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 6 ++++-- sf_mrs_connect/controllers/controllers.py | 14 +++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 522c8c02..0f37c8f0 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -964,7 +964,7 @@ class CNCprocessing(models.Model): _order = 'sequence_number,id' cnc_id = fields.Many2one('ir.attachment') - sequence_number = fields.Char('序号') + sequence_number = fields.Integer('序号') program_name = fields.Char('程序名') functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型') cutting_tool_name = fields.Char('刀具名称') @@ -1026,6 +1026,8 @@ class CNCprocessing(models.Model): 'cutting_tool_extension_length': obj['cutting_tool_extension_length'], 'cutting_tool_handle_type': obj['cutting_tool_handle_type'], 'estimated_processing_time': obj['estimated_processing_time'], + 'program_path': obj['program_path'], + 'cnc_id': obj['cnc_id'].id, 'remark': obj['remark'] }) return cnc_processing_str @@ -1416,7 +1418,7 @@ class WorkPieceDelivery(models.Model): 'task_delivery_time': fields.Datetime.now(), 'status': '待配送' }) - if delivery_item == "上产线": + if delivery_item.type == "上产线": delivery_item.workorder_id.write({'is_delivery': True}) else: raise UserError(ret['message']) diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 98c2d59e..08d6d9b4 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -63,12 +63,16 @@ class Sf_Mrs_Connect(http.Controller): logging.info('cnc_processing111:%s' % cnc_processing) if cnc_processing: cnc_processing_arr.append(cnc_processing._json_cnc_processing(cnc_processing)) - if cnc_program and cnc_processing_arr: + if (cnc_program and cnc_processing_arr) or (not cnc_program and cnc_processing_arr): logging.info('cnc_processing_arr:%s' % cnc_processing_arr) - cnc_program.write({'programming_state': '已编程', 'work_state': '已编程'}) - cnc_program.workorder_ids.filtered(lambda b: b.routing_type == 'CNC加工').write( - {'cnc_ids': cnc_processing_arr, 'cnc_worksheet': cnc_production.workorder_ids.filtered( - lambda b: b.routing_type == 'CNC加工').cnc_worksheet}) + if cnc_program and cnc_processing_arr: + cnc_program.write({'programming_state': '已编程', 'work_state': '已编程'}) + cnc_program.workorder_ids.filtered(lambda b: b.routing_type == 'CNC加工').write( + {'cnc_ids': cnc_processing_arr, 'cnc_worksheet': cnc_production.workorder_ids.filtered( + lambda b: b.routing_type == 'CNC加工').cnc_worksheet}) + cnc_program |= cnc_production + if not cnc_program and cnc_processing_arr: + cnc_program = cnc_production cnc_program_ids = [item.id for item in cnc_program] workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [('production_id', 'in', cnc_program_ids)])