From d9543d42fd32a11b84c79fdaedc1bdbd1f33f548 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 10 May 2024 16:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=B7=A5=E5=8D=95=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=A4=84=E6=8E=A7=E5=88=B6=E7=8A=B6=E6=80=81=EF=BC=8C=E6=9D=A5?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=9D=9E=E6=AD=A3=E5=B8=B8=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 4 ++-- sf_manufacturing/models/mrp_production.py | 2 +- sf_manufacturing/models/mrp_workorder.py | 13 +++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 80ae21e7..e42bb1c7 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -214,8 +214,8 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'} return json.JSONEncoder().encode(res) workorder.button_finish() - workorder.process_state = '待解除装夹' - workorder.sudo().production_id.process_state = '待解除装夹' + # workorder.process_state = '待解除装夹' + # workorder.sudo().production_id.process_state = '待解除装夹' # 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态 if workorder.date_finished: diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index e2d6616a..a96f3383 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -67,7 +67,7 @@ class MrpProduction(models.Model): ('待加工', '待加工'), ('待解除装夹', '待解除装夹'), ('已完工', '已完工'), - ], string='工序状态', related='workorder_ids.process_state', store=True) + ], string='工序状态') # 零件图号 part_number = fields.Char('零件图号') diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 5c8ecdd6..704b0ec5 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -412,8 +412,8 @@ class ResMrpWorkOrder(models.Model): work = workorder.production_id.workorder_ids work.compensation_value_x = eval(self.material_center_point)[0] work.compensation_value_y = eval(self.material_center_point)[1] - work.process_state = '待加工' - self.sudo().production_id.state = 'pending_processing' + # work.process_state = '待加工' + # self.sudo().production_id.process_state = '待加工' self.date_finished = datetime.now() workorder.button_finish() @@ -828,6 +828,14 @@ class ResMrpWorkOrder(models.Model): if not record.rfid_code: raise UserError("请扫RFID码进行绑定") record.workpiece_delivery_ids[0].write({'status': '待下发'}) + record.process_state = '待加工' + # record.write({'process_state': '待加工'}) + record.production_id.process_state = '待加工' + + if record.routing_type == 'CNC加工': + record.process_state = '待解除装夹' + # record.write({'process_state': '待加工'}) + record.production_id.process_state = '待解除装夹' if record.routing_type == '解除装夹': ''' @@ -869,6 +877,7 @@ class ResMrpWorkOrder(models.Model): for move_raw_id in record.production_id.move_raw_ids: move_raw_id.quantity_done = move_raw_id.product_uom_qty record.process_state = '已完工' + record.production_id.process_state = '已完工' record.production_id.button_mark_done1() # self.production_id.state = 'done'