From 9cfc084c5cd910e8dd75ec4ba1bab8b41371cb5d Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Tue, 23 Apr 2024 10:54:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=B9=E9=A2=84=E8=B0=83=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=EF=BC=8C=E8=A6=81=E5=B8=A6=E5=9B=BE=E7=BA=B8=E5=92=8C?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6=E5=8F=8A=E5=9D=AF=E6=96=99?= =?UTF-8?q?=E9=95=BF=E5=AE=BD=E9=AB=98=E5=8F=82=E6=95=B0=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=9C=80=E6=B1=822=EF=BC=9A=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 2 ++ sf_manufacturing/models/mrp_production.py | 22 ++++++++++++------- sf_manufacturing/models/mrp_workorder.py | 10 ++++++++- .../views/mrp_production_addional_change.xml | 7 ++++-- sf_manufacturing/views/mrp_workorder_view.xml | 4 ++++ 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 63fd4f57..333c57f4 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -202,6 +202,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.work_order_state = 'pending_era_cam' # 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态 if workorder.date_finished: diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index f5863616..3c6cc6da 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -32,7 +32,9 @@ class MrpProduction(models.Model): ('draft', 'Draft'), ('confirmed', 'Confirmed'), ('progress', '待排程'), + ('pending_cam', '待装夹'), ('pending_processing', '待加工'), + ('pending_era_cam', '待解除装夹'), ('completed', '已完工'), ('to_close', 'To Close'), ('done', 'Done'), @@ -56,14 +58,15 @@ class MrpProduction(models.Model): plan_start_processing_time = fields.Datetime('计划开始加工时间') production_line_state = fields.Selection([('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')], string='上/下产线', default='待上产线') - # 加工状态 + # 工序状态 + # Todo 研究下用法 process_state = fields.Selection([ - ('待排程', '待排程'), ('待装夹', '待装夹'), - ('待CNC加工', '待CNC加工'), + ('待检测', '待检测'), + ('待加工', '待加工'), ('待解除装夹', '待解除装夹'), - ('已完成', '已完成') - ], string='加工状态', default='待排程') + ('已完工', '已完工'), + ], string='工序状态', related='workorder_ids.process_state', store=True) # 零件图号 part_number = fields.Char('零件图号') @@ -106,10 +109,13 @@ class MrpProduction(models.Model): # 新添加的状态逻辑 if production.state == 'progress' and production.schedule_state == '已排': + # production.state = 'pending_processing' + production.state = 'pending_cam' + elif production.state == 'pending_cam' and production.process_state == '待加工': production.state = 'pending_processing' - # elif production.state == 'progress' and production.schedule_state == '已完成': - # production.state = 'completed' - elif production.state == 'pending_processing' and production.work_order_state == '已完成': + elif production.state == 'pending_processing' and production.process_state == '待解除装夹': + production.state = 'pending_era_cam' + elif production.state == 'pending_era_cam' and production.process_state == '已完工': production.state = 'completed' elif production.state == 'progress' and production.work_order_state == '已完成': production.state = 'completed' diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index ec4482e0..110de50d 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -131,8 +131,12 @@ class ResMrpWorkOrder(models.Model): process_state = fields.Selection([ ('待装夹', '待装夹'), ('待检测', '待检测'), - ('已完工', '已完工') + ('待加工', '待加工'), + ('待解除装夹', '待解除装夹'), + ('已完工', '已完工'), ], string='工序状态', default='待装夹') + # 加工图纸 + processing_drawing = fields.Binary(string='加工图纸', related='production_id.part_drawing') @api.depends('production_id') def _compute_save_name(self): @@ -401,6 +405,8 @@ class ResMrpWorkOrder(models.Model): work.compensation_value_x = eval(self.material_center_point)[0] work.compensation_value_y = eval(self.material_center_point)[1] workorder.button_finish() + self.process_state = '待加工' + # self.sudo().production_id.state = 'pending_processing' except Exception as e: # 重新抛出捕获到的异常信息 raise UserError(str(e)) @@ -823,6 +829,7 @@ class ResMrpWorkOrder(models.Model): workorder.rfid_code = None for move_raw_id in self.production_id.move_raw_ids: move_raw_id.quantity_done = move_raw_id.product_uom_qty + self.process_state = '已完工' self.production_id.button_mark_done1() # self.production_id.state = 'done' @@ -1032,6 +1039,7 @@ class SfWorkOrderBarcodes(models.Model): for item in workorder_rfid: item.write({'rfid_code': barcode}) logging.info("Rfid绑定成功!!!") + self.process_state = '待检测' else: embryo_stock_lot = self.env['stock.lot'].search([('name', '=', barcode)]) if embryo_stock_lot: diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 26aaa0e2..90cee94b 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -62,11 +62,14 @@ - draft,confirmed,progress,pending_processing,completed,done + + + progress,pending_cam,pending_processing,pending_era_cam,completed,done - + + diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index edc3cb44..78db99af 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -264,6 +264,10 @@ + + + +