diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 59ce68ab..da54f77b 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -296,8 +296,13 @@ class MrpProduction(models.Model): # 编程单更新 def update_programming_state(self): try: + manufacturing_type = 'rework' + if self.is_scrap: + manufacturing_type = 'scrap' + elif self.tool_state == '2': + manufacturing_type = 'invalid_tool_rework' res = {'programming_no': self.programming_no, - 'manufacturing_type': 'rework' if self.is_scrap is False else 'scrap'} + 'manufacturing_type': manufacturing_type} logging.info('res=%s:' % res) configsettings = self.env['res.config.settings'].get_values() config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key']) diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 7f3c3d83..cb56287a 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -25,7 +25,7 @@ class Sf_Mrs_Connect(http.Controller): ret = json.loads(ret['result']) logging.info('下发编程单:%s' % ret) domain = [('programming_no', '=', ret['programming_no'])] - if ret['manufacturing_type'] == 'scrap': + if ret['manufacturing_type'] in ('scrap', 'invalid_tool_rework'): domain += [('state', 'not in', ['done', 'scrap', 'cancel'])] productions = request.env['mrp.production'].with_user( request.env.ref("base.user_admin")).search(domain) @@ -96,6 +96,14 @@ class Sf_Mrs_Connect(http.Controller): res.update({ 'production_ids': productions.ids }) + + # 对制造订单所以面的cnc工单的程序用刀进行校验 + try: + productions.production_cnc_tool_checkout() + except Exception as e: + logging.info(f'对cnc工单的程序用刀进行校验报错:{e}') + return json.JSONEncoder().encode(res) + return json.JSONEncoder().encode(res) else: res = {'status': 0, 'message': '该制造订单暂未开始'} diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index 506f5b8d..a5c7a6fa 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -17,11 +17,6 @@ - -