添加工艺退回调整

This commit is contained in:
jinling.yang
2024-11-11 17:55:05 +08:00
parent e8858559f6
commit 359fd40ed3
7 changed files with 38 additions and 11 deletions

View File

@@ -257,6 +257,33 @@ class MrpProduction(models.Model):
if production.tool_state == '2':
production.state = 'rework'
def technology_back_adjust(self):
special_design = self.technology_design_ids.filtered(
lambda a: a.routing_tag == 'special' and a.is_auto is False and a.active in [True,False])
workorders_values = []
for item in special_design:
if item.active is False:
domain = [('production_id','=',self.id)]
if item.surface_technics_parameters_id:
domain += [('surface_technics_parameters_id', '=', item.process_parameters_id)]
else:
domain += [('name', '=', item.route_id.name)]
workorder = self.env['mrp.workorder'].search(domain)
if workorder:
workorder.write({'state': 'cancel'})
else:
workorder = self.env['mrp.workorder'].search([('name', '=', item.route_id.name)])
if not workorder:
workorders_values.append(
self.env[
'mrp.workorder']._json_workorder_surface_process_str(
production, route, product_production_process.seller_ids[0].partner_id.id))
if workorders_values:
self.workorders.write({})
# 工艺确认
def technology_confirm(self):
process_parameters = []

View File

@@ -38,13 +38,10 @@ class ResMrpWorkOrder(models.Model):
processing_panel = fields.Char('加工面')
sequence = fields.Integer(string='工序')
routing_type = fields.Selection([
# ('获取CNC加工程序', '获取CNC加工程序'),
('装夹预调', '装夹预调'),
# ('前置三元定位检测', '前置三元定位检测'),
('CNC加工', 'CNC加工'),
# ('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'),
('切割', '切割'), ('表面工艺', '表面工艺')
('切割', '切割'), ('表面工艺', '表面工艺'), ('线切割', '线切割')
], string="工序类型")
results = fields.Char('结果')
state = fields.Selection([

View File

@@ -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):

View File

@@ -20,7 +20,7 @@ class sf_technology_design(models.Model):
workorders_values_str = [0, '', {
'route_id': route.id,
'panel': k,
'process_parameters_id': False if route.routing_type.id != '表面工艺' else self.env[
'process_parameters_id': False if route.routing_type != '表面工艺' else self.env[
'sf.production.process.parameter'].search(
[('process_id', '=', route.surface_technics_id.id)]).id,
'sequence': i,

View File

@@ -129,6 +129,9 @@
></button>
</xpath>
<xpath expr="(//header//button[@name='button_scrap'])" position="replace">
<button name="technology_confirm" string="工艺确认" type="object" class="oe_highlight"
attrs="{'invisible': [('workorder_ids', '!=', [])]}"></button>
<button name="technology_back_adjust" string="退回调整" type="object" class="oe_highlight"></button>
<button name="button_scrap" invisible="1"/>
<button name="do_update_program" string="更新程序" type="object" groups="sf_base.group_sf_mrp_user"
confirm="是否确认更新程序"

View File

@@ -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

View File

@@ -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