From 9ec37f5d5b359538eaa8dfc73d3e709af96576f7 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 3 Jul 2024 09:45:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E9=9D=A2?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=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 | 24 +++++++++---------- sf_manufacturing/models/mrp_workorder.py | 5 ++-- .../views/mrp_production_addional_change.xml | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index dd97531f..fde6814b 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -229,12 +229,12 @@ class Manufacturing_Connect(http.Controller): # request.env['sf.production.plan'].sudo().search([('production_id', '=', production_id)]).write( # {'actual_end_time': workorder.date_finished, # 'state': 'finished'}) - # production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)]) - # if production_obj: - # production_obj.sudo().work_order_state = '已完成' - # production_obj.write({'state': 'done'}) - # request.env['sale.order'].sudo().search( - # [('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'}) + # production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)]) + # if production_obj: + # production_obj.sudo().work_order_state = '已完成' + # production_obj.write({'state': 'done'}) + # request.env['sale.order'].sudo().search( + # [('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'}) except Exception as e: res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} @@ -471,10 +471,10 @@ class Manufacturing_Connect(http.Controller): workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') if workorder: for order in workorder: - if order.production_id.production_line_state == '待上产线': + if order.production_line_state == '待上产线': logging.info( - '制造订单产线状态:%s' % order.production_id.production_line_state) - order.production_id.write({'production_line_state': '已上产线'}) + '制造订单产线状态:%s' % order.production_line_state) + order.write({'production_line_state': '已上产线'}) workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [ ('rfid_code', '=', rfid_code), ('type', '=', '上产线'), @@ -528,10 +528,10 @@ class Manufacturing_Connect(http.Controller): workorder = request.env['mrp.workorder'].sudo().search(domain, order='id asc') if workorder: for order in workorder: - if order.production_id.production_line_state == '已上产线': + if order.production_line_state == '已上产线': logging.info( - '制造订单产线状态:%s' % order.production_id.production_line_state) - order.production_id.write({'production_line_state': '已下产线'}) + '制造订单产线状态:%s' % order.production_line_state) + order.write({'production_line_state': '已下产线'}) workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [ ('rfid_code', '=', rfid_code), ('type', '=', '下产线'), diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 09bde519..46bcde47 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -193,8 +193,9 @@ class ResMrpWorkOrder(models.Model): production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id', string='生产线', store=True, tracking=True) - production_line_state = fields.Selection(related='production_id.production_line_state', - string='上/下产线', store=True, tracking=True) + production_line_state = fields.Selection( + [('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')], + string='上/下产线', default='待上产线', tracking=True) detection_report = fields.Binary('检测报告', readonly=True) is_remanufacture = fields.Boolean(string='重新生成制造订单', default=False) is_fetchcnc = fields.Boolean(string='重新获取NC程序', default=False) diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index b65dfb2f..b5e348b9 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -87,7 +87,7 @@ - + From bb33a1d0937e7c706360c3995613665ae3c40f0a Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 3 Jul 2024 10:37:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E9=9D=A2?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=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 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index fde6814b..9f76f065 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -473,8 +473,12 @@ class Manufacturing_Connect(http.Controller): for order in workorder: if order.production_line_state == '待上产线': logging.info( - '制造订单产线状态:%s' % order.production_line_state) - order.write({'production_line_state': '已上产线'}) + '工单产线状态:%s' % order.production_line_state) + panel_workorder = request.env['mrp.workorder'].sudo().search( + [('rfid_code', '=', rfid_code), + ('processing_panel', '=', order.processing_panel)]) + if panel_workorder: + panel_workorder.write({'production_line_state': '已上产线'}) workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [ ('rfid_code', '=', rfid_code), ('type', '=', '上产线'), @@ -530,8 +534,12 @@ class Manufacturing_Connect(http.Controller): for order in workorder: if order.production_line_state == '已上产线': logging.info( - '制造订单产线状态:%s' % order.production_line_state) - order.write({'production_line_state': '已下产线'}) + '工单产线状态:%s' % order.production_line_state) + panel_workorder = request.env['mrp.workorder'].sudo().search( + [('rfid_code', '=', rfid_code), + ('processing_panel', '=', order.processing_panel)]) + if panel_workorder: + panel_workorder.write({'production_line_state': '已下产线'}) workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search( [ ('rfid_code', '=', rfid_code), ('type', '=', '下产线'), From 6c6fe44d45371a52e7751abe5cef5ad50980da1f Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 3 Jul 2024 10:53:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=B8=8A/=E4=B8=8B=E4=BA=A7=E7=BA=BF?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 95242b54..73782a9c 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -55,9 +55,9 @@ class MrpProduction(models.Model): glb_file = fields.Binary("glb模型文件") production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True) plan_start_processing_time = fields.Datetime('计划开始加工时间') - production_line_state = fields.Selection( - [('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')], - string='上/下产线', default='待上产线', tracking=True) + # production_line_state = fields.Selection( + # [('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')], + # string='上/下产线', default='待上产线', tracking=True) # 工序状态 # Todo 研究下用法 process_state = fields.Selection([