diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 376101c9..23be7d38 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -620,12 +620,12 @@ class Manufacturing_Connect(http.Controller): # if is_free is True: # delivery_workpiece._delivery_avg() # logging.info('agv下发下产线任务下发完成') - # if ret['IsComplete'] is True: - # # 向AGV任务调度下发下产线任务 - # workorders = request.env['mrp.workorder'].browse(workorder_ids) - # request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders) - # else: - # res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} + if ret['IsComplete'] is True: + # 向AGV任务调度下发下产线任务 + workorders = request.env['mrp.workorder'].browse(workorder_ids) + request.env['sf.agv.scheduling'].add_scheduling(ret['DeviceId'], '下产线', workorders) + else: + res = {'Succeed': False, 'ErrorCode': 203, 'Error': '未传IsComplete字段'} except RepeatTaskException as e: logging.info('AGVToProduct error:%s' % e) except Exception as e: diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 0f26a6d7..1d011dd7 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -142,13 +142,13 @@ class MrpProduction(models.Model): def action_view_remanufacture_productions(self): self.ensure_one() - mrp_production_ids = self.env['mrp.production'].search( + mrp_production = self.env['mrp.production'].search( [('id', '=', self.remanufacture_production_id.id)]) action = { 'res_model': 'mrp.production', 'type': 'ir.actions.act_window', 'view_mode': 'form', - 'res_id': mrp_production_ids[0], + 'res_id': mrp_production.id, } return action diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 095c1ab1..1b315e46 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1154,8 +1154,8 @@ class ResMrpWorkOrder(models.Model): def button_finish(self): for record in self: if record.routing_type == '装夹预调': - if not record.material_center_point or record.X_deviation_angle <= 0: - raise UserError("请对前置三元检测定位参数进行计算定位") + # if not record.material_center_point or record.X_deviation_angle <= 0: + # raise UserError("请对前置三元检测定位参数进行计算定位") if not record.rfid_code and record.is_rework is False: raise UserError("请扫RFID码进行绑定") record.process_state = '待加工' diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 37fa02bd..071f1167 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError from odoo.modules import get_resource_path -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index a0da7ba3..27ce925a 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -151,8 +151,6 @@ class StockRule(models.Model): list2.append(item) for procurement, rule in list2: - logging.info(rule) - logging.info(rule.procure_method) procure_method = rule.procure_method if rule.procure_method == 'mts_else_mto': qty_needed = procurement.product_uom._compute_quantity(procurement.product_qty, @@ -178,10 +176,8 @@ class StockRule(models.Model): for company_id, moves_values in moves_values_by_company.items(): # create the move as SUPERUSER because the current user may not have the rights to do it (mto product # launched by a sale for example) - logging.info(moves_values) moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create( moves_values) - logging.info(moves) # Since action_confirm launch following procurement_group we should activate it. moves._action_confirm() return True diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 8213f483..6fa14a6f 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -127,7 +127,7 @@ confirm="是否确认更新程序" attrs="{'invisible': ['|',('state', '!=', 'rework'),('programming_state', '!=', '已编程未下发')]}"/> +