还原代码
This commit is contained in:
@@ -257,10 +257,22 @@ class MrpProduction(models.Model):
|
||||
|
||||
# 工艺确认
|
||||
def technology_confirm(self):
|
||||
process_parameters = []
|
||||
special_design = self.technology_design_ids.filtered(
|
||||
lambda a: a.routing_tag == 'special' and a.process_parameters_id is not False)
|
||||
for special in special_design:
|
||||
if special.process_parameters_id:
|
||||
product_production_process = self.env['product.template'].search(
|
||||
[('server_product_process_parameters_id', '=', special.process_parameters_id.id)])
|
||||
if not product_production_process:
|
||||
if special.process_parameters_id not in process_parameters:
|
||||
process_parameters.append(special.process_parameters_id.display_name)
|
||||
if process_parameters:
|
||||
raise UserError(_("【工艺设计】-【参数】为%s的在【产品】中不存在,请先创建", ", ".join(process_parameters)))
|
||||
# 判断同一个加工面的标准工序的顺序是否依次排序
|
||||
error_panel = []
|
||||
technology_design = self.technology_design_ids.filtered(lambda a: a.routing_tag == 'standard').sorted(
|
||||
key=lambda m: m.sequence)
|
||||
error_panel = []
|
||||
for index, design in enumerate(technology_design):
|
||||
routing_type = design.route_id.routing_type
|
||||
if index < len(technology_design) - 1:
|
||||
@@ -269,18 +281,19 @@ class MrpProduction(models.Model):
|
||||
next_design_routing_type = next_design.route_id.routing_type
|
||||
logging.info('当前工序和加工面: %s-%s' % (design.route_id.name, design.panel))
|
||||
logging.info('下一个工序和加工面: %s-%s' % (next_design.route_id.name, next_design.panel))
|
||||
if design.panel != next_design.panel:
|
||||
if index == 0:
|
||||
raise UserError('【加工面】为%s的标准工序里含有其他加工面的工序,请调整后重试' % design.panel)
|
||||
if routing_type not in ['解除装夹']:
|
||||
raise UserError('【加工面】为%s的标准工序顺序有误,请调整后重试' % design.panel)
|
||||
if design.panel == next_design.panel:
|
||||
if (routing_type == '装夹预调' and next_design_routing_type == '解除装夹') or (
|
||||
routing_type == 'CNC加工' and next_design_routing_type == '装夹预调'):
|
||||
if design.panel not in error_panel:
|
||||
error_panel.append(design.panel)
|
||||
if design.panel is not False:
|
||||
if design.panel != next_design.panel:
|
||||
if index == 0:
|
||||
raise UserError('【加工面】为%s的标准工序里含有其他加工面的工序,请调整后重试' % design.panel)
|
||||
if routing_type not in ['解除装夹']:
|
||||
raise UserError('【加工面】为%s的标准工序顺序有误,请调整后重试' % design.panel)
|
||||
if design.panel == next_design.panel:
|
||||
if (routing_type == '装夹预调' and next_design_routing_type == '解除装夹') or (
|
||||
routing_type == 'CNC加工' and next_design_routing_type == '装夹预调'):
|
||||
if design.panel not in error_panel:
|
||||
error_panel.append(design.panel)
|
||||
else:
|
||||
if not error_panel:
|
||||
if not error_panel and not process_parameters:
|
||||
return {
|
||||
'name': _('工艺确认'),
|
||||
'type': 'ir.actions.act_window',
|
||||
@@ -293,7 +306,6 @@ class MrpProduction(models.Model):
|
||||
}}
|
||||
if error_panel:
|
||||
raise UserError(_("【加工面】为%s的标准工序顺序有误,请调整后重试", ", ".join(error_panel)))
|
||||
|
||||
return True
|
||||
|
||||
def action_check(self):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -14,3 +14,4 @@ class SfProductionProcessParameter(models.Model):
|
||||
domain = [('process_id', '=', routing.surface_technics_id.id)]
|
||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||
return super()._name_search(name, args, operator, limit, name_get_uid)
|
||||
|
||||
|
||||
@@ -392,6 +392,9 @@ class StockRule(models.Model):
|
||||
logging.info('production_process:%s' % p.name)
|
||||
process_parameter = production.product_id.model_process_parameters_ids.filtered(
|
||||
lambda pm: pm.process_id.id == p.id)
|
||||
product_production_process = self.env['product.template'].search(
|
||||
[('server_product_process_parameters_id', '=',
|
||||
process_parameter.id)])
|
||||
if process_parameter:
|
||||
i += 1
|
||||
route_production_process = self.env[
|
||||
@@ -401,6 +404,7 @@ class StockRule(models.Model):
|
||||
technology_design_values.append(
|
||||
self.env['sf.technology.design'].json_technology_design_str(k,
|
||||
route_production_process,
|
||||
product_production_process,
|
||||
i))
|
||||
productions.technology_design_ids = technology_design_values
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@
|
||||
<page string="工艺设计">
|
||||
<field name="technology_design_ids" widget="one2many">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="sequence" widget="handle" />
|
||||
<field name="route_id" context="{'production_id': production_id}"
|
||||
attrs="{'readonly': [('is_auto', '=', True)]}" options="{'no_create': True}"/>
|
||||
<field name="process_parameters_id" attrs="{'readonly': [('is_auto', '=', True)]}"
|
||||
|
||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
||||
import requests
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
# 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
|
||||
from odoo import models, fields, api
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
@@ -6,8 +6,8 @@ import os
|
||||
from datetime import datetime
|
||||
from stl import mesh
|
||||
# from OCC.Core.GProp import GProp_GProps
|
||||
# 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
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo import models, fields, api
|
||||
from odoo.modules import get_resource_path
|
||||
|
||||
Reference in New Issue
Block a user