From b07e7707c78664c024728ef8134ab327bd11006d Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 17 Jul 2024 15:30:38 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E8=B0=83=E5=BA=A6=E5=B2=97=EF=BC=8C=E6=9C=BA=E5=BA=8A=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=B2=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/security/ir.model.access.csv | 3 +++ sf_manufacturing/views/mrp_production_addional_change.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv index 5cdb72b7..ec8e2db4 100644 --- a/sf_manufacturing/security/ir.model.access.csv +++ b/sf_manufacturing/security/ir.model.access.csv @@ -142,7 +142,10 @@ access_mrp_bom_byproduct_group_sf_stock_user,mrp_bom_byproduct_group_sf_stock_us access_mrp_bom_byproduct_group_sf_stock_manager,mrp_bom_byproduct_group_sf_mrp_manager,mrp.model_mrp_bom_byproduct,sf_base.group_sf_stock_manager,1,0,0,0 access_sf_rework_wizard_group_sf_order_user,sf_rework_wizard_group_sf_order_user,model_sf_rework_wizard,sf_base.group_sf_order_user,1,1,1,0 +access_sf_rework_wizard_group_plan_dispatch,sf_rework_wizard_group_plan_dispatch,model_sf_rework_wizard,sf_base.group_plan_dispatch,1,1,1,0 access_sf_detection_result_group_sf_order_user,sf_detection_result_group_sf_order_user,model_sf_detection_result,sf_base.group_sf_order_user,1,1,1,0 +access_sf_detection_result_group_plan_dispatch,sf_detection_result_group_plan_dispatch,model_sf_detection_result,sf_base.group_plan_dispatch,1,1,1,0 access_sf_processing_panel_group_sf_order_user,sf_processing_panel_group_sf_order_user,model_sf_processing_panel,sf_base.group_sf_order_user,1,1,1,0 +access_sf_processing_panel_group_plan_dispatch,sf_processing_panel_group_plan_dispatch,model_sf_processing_panel,sf_base.group_plan_dispatch,1,1,1,0 diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 9ee96732..ca4659e5 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -555,7 +555,7 @@
- +
From d8b4797ffe583e3f771f45e5b96791e0523bd531 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 17 Jul 2024 15:31:47 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=BA=E5=BA=8A=E6=93=8D=E4=BD=9C=E5=B2=97?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv index ec8e2db4..358e2879 100644 --- a/sf_manufacturing/security/ir.model.access.csv +++ b/sf_manufacturing/security/ir.model.access.csv @@ -145,6 +145,7 @@ access_sf_rework_wizard_group_sf_order_user,sf_rework_wizard_group_sf_order_user access_sf_rework_wizard_group_plan_dispatch,sf_rework_wizard_group_plan_dispatch,model_sf_rework_wizard,sf_base.group_plan_dispatch,1,1,1,0 access_sf_detection_result_group_sf_order_user,sf_detection_result_group_sf_order_user,model_sf_detection_result,sf_base.group_sf_order_user,1,1,1,0 access_sf_detection_result_group_plan_dispatch,sf_detection_result_group_plan_dispatch,model_sf_detection_result,sf_base.group_plan_dispatch,1,1,1,0 +access_sf_detection_result_group_sf_equipment_user,sf_detection_result_group_sf_equipment_user,model_sf_detection_result,sf_base.group_sf_equipment_user,1,1,1,0 access_sf_processing_panel_group_sf_order_user,sf_processing_panel_group_sf_order_user,model_sf_processing_panel,sf_base.group_sf_order_user,1,1,1,0 access_sf_processing_panel_group_plan_dispatch,sf_processing_panel_group_plan_dispatch,model_sf_processing_panel,sf_base.group_plan_dispatch,1,1,1,0 From 974671ee077cd57e4ba25431e185427749261d44 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 17 Jul 2024 15:33:49 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A7=A3=E9=99=A4?= =?UTF-8?q?=E8=A3=85=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 6da74cbc..b065284b 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1064,14 +1064,16 @@ class ResMrpWorkOrder(models.Model): for workorder in record.production_id.workorder_ids: if workorder.state != 'done': is_production_id = False - if record.routing_type == '解除装夹': + if record.routing_type in ['解除装夹'] or ( + record.is_rework is True and record.routing_type in ['装夹预调']) or ( + record.test_results in ['返工', '报废'] and record.routing_type in ['CNC加工']): for workorder in record.production_id.workorder_ids: if workorder.processing_panel == record.processing_panel: rfid_code = workorder.rfid_code workorder.write({'rfid_code_old': rfid_code, 'rfid_code': False}) - workorder.rfid_code_old = rfid_code - workorder.rfid_code = False + # workorder.rfid_code_old = rfid_code + # workorder.rfid_code = False if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺']: logging.info('product_qty:%s' % record.production_id.product_qty) for move_raw_id in record.production_id.move_raw_ids: From 5e83fb382f2c3196fb7a2810db571eaa66e92418 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 17 Jul 2024 15:37:20 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=BF=98=E5=8E=9Frfid=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/mrp_workorder_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index b12d4fcb..5fa77224 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -185,7 +185,7 @@ - From 77f7602b23460109e9fec8b61a9c9c4c215c1b94 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 17 Jul 2024 19:03:07 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E9=9D=A2?= =?UTF-8?q?=E8=BF=94=E5=B7=A5=E5=B7=A5=E5=8D=95=E7=8A=B6=E6=80=81=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 3 +- sf_manufacturing/models/mrp_workorder.py | 75 +++++++------------ .../views/mrp_production_addional_change.xml | 5 +- sf_manufacturing/wizard/rework_wizard.py | 6 +- 4 files changed, 40 insertions(+), 49 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index b965a63e..39c44e80 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -56,7 +56,8 @@ class MrpProduction(models.Model): reprogramming_num = fields.Integer('重新编程次数', default=0) work_state = fields.Char('业务状态') programming_state = fields.Selection( - [('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发')], string='编程状态', + [('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发'), ('已下发', '已下发')], + string='编程状态', tracking=True) glb_file = fields.Binary("glb模型文件") production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index b065284b..692dde1a 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -827,28 +827,37 @@ class ResMrpWorkOrder(models.Model): re_work = self.env['mrp.workorder'].search([('production_id', '=', workorder.production_id.id), ('processing_panel', '=', workorder.processing_panel), ('is_rework', '=', True), ('state', 'in', ['done', 'rework'])]) - logging.info('re_work:%s' % re_work.state) if workorder.state not in ['cancel', 'progress', 'rework']: - logging.info('工序:%s' % workorder.routing_type) - logging.info('状态:%s' % workorder.state) - logging.info('is_rework:%s' % workorder.is_rework) - logging.info('面:%s' % workorder.processing_panel) - logging.info('编程状态:%s' % workorder.production_id.programming_state) - logging.info('制造状态:%s' % workorder.production_id.state) - # if workorder.state =='done' and workorder.is_rework is True: - # workorder.state = 'rework' - # else: - # if re_work: - # workorder.state = 'rework' if workorder.production_id.state == 'rework': - if (workorder.routing_type == 'CNC加工' and workorder.state == 'done') or ( - workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '编程中' and re_work): - logging.info('面111:%s' % workorder.processing_panel) - workorder.state = 'waiting' + logging.info('len(re_work):%s' % len(re_work)) + logging.info('工序:%s' % workorder.routing_type) + logging.info('状态:%s' % workorder.state) + logging.info('is_rework:%s' % workorder.is_rework) + logging.info('面:%s' % workorder.processing_panel) + logging.info('编程状态:%s' % workorder.production_id.programming_state) + logging.info('制造状态:%s' % workorder.production_id.state) + if re_work: + if workorder.routing_type == '装夹预调' and workorder.state not in ['done', 'rework', + 'cancel'] and workorder.is_rework is False: + workorder.state = 'waiting' + if workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'rework', 'cancel']: + pre_workorder = self.env['mrp.workorder'].search( + [('production_id', '=', workorder.production_id.id), + ('processing_panel', '=', workorder.processing_panel), + ('routing_type', '=', '装夹预调'), ('state', '=', 'done')]) + if pre_workorder: + workorder.state = 'waiting' elif workorder.production_id.state == 'progress': - logging.info('面222:%s' % workorder.processing_panel) - if workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '已下发' and re_work: - workorder.state = 'ready' + logging.info('len(re_work):%s' % len(re_work)) + logging.info('工序:%s' % workorder.routing_type) + logging.info('状态:%s' % workorder.state) + logging.info('is_rework:%s' % workorder.is_rework) + logging.info('面:%s' % workorder.processing_panel) + logging.info('编程状态:%s' % workorder.production_id.programming_state) + logging.info('制造状态:%s' % workorder.production_id.state) + if workorder.routing_type == '装夹预调' and workorder.production_id.programming_state == '已下发': + if re_work: + workorder.state = 'ready' # else: # if workorder.state not in ['cancel', 'rework']: # workorder.state = 'rework' @@ -988,7 +997,7 @@ class ResMrpWorkOrder(models.Model): if record.routing_type == '装夹预调': if not record.material_center_point and record.X_deviation_angle > 0: raise UserError("请对前置三元检测定位参数进行计算定位") - if not record.rfid_code: + if not record.rfid_code and record.is_rework is False: raise UserError("请扫RFID码进行绑定") record.process_state = '待加工' # record.write({'process_state': '待加工'}) @@ -1130,32 +1139,6 @@ class ResMrpWorkOrder(models.Model): workorder.detection_report = base64.b64encode(open(report_file_path, 'rb').read()) return True - # 重新下发nc程序 - # def button_send_program_again(self): - # try: - # res = {'programming_no': self.production_id.programming_no} - # configsettings = self.env['res.config.settings'].get_values() - # config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key']) - # url = '/api/intelligent_programming/reset_state_again' - # config_url = configsettings['sf_url'] + url - # r = requests.post(config_url, json=res, data=None, headers=config_header) - # r = r.json() - # result = json.loads(r['result']) - # if result['status'] == 1: - # productions = self.env['mrp.production'].search( - # [('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')]) - # if productions: - # workorder = productions.workorder_ids.filtered( - # lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel', - # 'progress']) - # if workorder: - # productions.write({'work_state': '编程中', 'programming_state': '编程中'}) - # else: - # raise UserError(result['message']) - # except Exception as e: - # logging.info('button_send_program_again error:%s' % e) - # raise UserError("重新下发nc程序失败,请联系管理员") - def print_method(self): """ 解除装夹处调用关联制造订单的关联序列号的打印方法 diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index ca4659e5..11d746da 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -455,6 +455,9 @@ + +
- +
diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py index 2faf74d0..4ad7c163 100644 --- a/sf_manufacturing/wizard/rework_wizard.py +++ b/sf_manufacturing/wizard/rework_wizard.py @@ -81,10 +81,14 @@ class ReworkWizard(models.TransientModel): if production_id: if self.env.user.has_group('sf_base.group_sf_order_user'): panel_ids = [] + panel_arr = production_id.product_id.model_processing_panel for p in production_id.detection_result_ids.filtered( lambda ap1: ap1.handle_result == '待处理'): + if p.processing_panel not in panel_arr: + panel_arr += ','.join(p.processing_panel) + for item in panel_arr.split(','): panel = self.env['sf.processing.panel'].search( - [('name', 'ilike', p.processing_panel)]) + [('name', 'ilike', item)]) if panel: panel_ids.append(panel.id) domain = {'processing_panel_id': [('id', 'in', panel_ids)]} From 6c2fb043c494aa89c1f23bd5def152e79f9b1efc Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 17 Jul 2024 19:29:21 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=90=8E=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 39c44e80..6386e978 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -128,7 +128,8 @@ class MrpProduction(models.Model): production.state = 'pending_cam' if production.state == 'progress': - if all(wo_state not in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')): + if all(wo_state not in ('progress', 'done', 'rework') for wo_state in + production.workorder_ids.mapped('state')): production.state = 'pending_cam' # if production.state == 'pending_cam': # if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')):