diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index a1cc56d2..d60a2497 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -388,9 +388,12 @@ class MrpProduction(models.Model): def technology_confirm(self): process_parameters = [] account_moves = [] + parameters_not = [] special_design = self.technology_design_ids.filtered( lambda a: a.routing_tag == 'special' and a.is_auto is False) for special in special_design: + if special.route_id.routing_type == '表面工艺' and not special.process_parameters_id: + parameters_not.append(special.route_id.name) if special.process_parameters_id: product_production_process = self.env['product.template'].search( [('server_product_process_parameters_id', '=', special.process_parameters_id.id)]) @@ -404,6 +407,8 @@ class MrpProduction(models.Model): account_moves.append(purchase.name) if account_moves: raise UserError(_("请联系工厂生产经理对采购订单为%s生成的账单进行取消", ", ".join(account_moves))) + if parameters_not: + raise UserError(_("【工艺设计】-【工序】为%s未选择参数,请选择", ", ".join(parameters_not))) if process_parameters: raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters))) # 判断同一个加工面的标准工序的顺序是否依次排序 diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 63afbb18..ccb7ed5c 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -281,7 +281,7 @@ class ResMrpWorkOrder(models.Model): # if technology_design.is_auto is False: # domain = [('origin', '=', order.production_id.name)] # else: - domain = [('purchase_type', '=', 'consignment'),('origin', '=', ','.join(production_list))] + domain = [('purchase_type', '=', 'consignment'), ('origin', '=', ','.join(production_list))] purchase = self.env['purchase.order'].search(domain) if not purchase: order.surface_technics_purchase_count = 0 @@ -1075,6 +1075,13 @@ class ResMrpWorkOrder(models.Model): if workorder.state != 'pending': workorder.state = 'pending' continue + # ================= 如果制造订单制造类型为【人工线下加工】========================== + if (workorder.production_id.production_type == '人工线下加工' + and workorder.production_id.schedule_state == '已排' + and len(workorder.production_id.picking_ids.filtered( + lambda w: w.state not in ['done', 'cancel'])) == 0): + workorder.state = 'ready' + continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' or workorder.production_id.schedule_state != '已排' @@ -1195,11 +1202,12 @@ class ResMrpWorkOrder(models.Model): raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name) self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name # cnc校验 - cnc_workorder = self.search( - [('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')], - limit=1, order='id asc') - if not cnc_workorder.cnc_ids: - raise UserError(_('该制造订单还未下发CNC程序,请稍后再试')) + if self.production_id.production_type == '自动化产线加工': + cnc_workorder = self.search( + [('production_id', '=', self.production_id.id), ('routing_type', '=', 'CNC加工')], + limit=1, order='id asc') + if not cnc_workorder.cnc_ids: + raise UserError(_('该制造订单还未下发CNC程序,请稍后再试')) else: if self.production_id.tool_state in ['1', '2']: if self.production_id.tool_state == '1': diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index ae38b9c1..c9c97ec7 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -332,8 +332,8 @@ class StockRule(models.Model): product_routing_workcenter = self.env[model].search(domain, order='sequence asc') if production_item.production_type == '自动化产线加工': for k in (production_item.product_id.model_processing_panel.split(',')): - i += 1 for route in product_routing_workcenter: + i += 1 technology_design_values.append( self.env['sf.technology.design'].json_technology_design_str(k, route, i, False)) else: diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 725f5eb8..783f39dd 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -120,7 +120,8 @@ - + @@ -365,7 +366,8 @@ - - + True - + True - + 子MO