优化cnc工单返工:在原有的cnc工单后新增返工标志的cnc工单,且工序累加,状态为就绪,解除装夹工单的状态为等待其他工单

This commit is contained in:
jinling.yang
2024-05-22 17:35:57 +08:00
parent 6d503968a5
commit ff12a86406
7 changed files with 25 additions and 26 deletions

View File

@@ -406,20 +406,20 @@ class MrpProduction(models.Model):
# 工单排序 # 工单排序
def _reset_work_order_sequence1(self, k): def _reset_work_order_sequence1(self, k):
sequen = 0
for rec in self: for rec in self:
current_sequence = 10 cnc_workorder = rec.workorder_ids.filtered(lambda wo: wo.name == "CNC加工")
cnc_back_workorder = rec.workorder_ids.filtered(lambda wo: wo.name == "CNC加工(返工)")
for work in rec.workorder_ids: for work in rec.workorder_ids:
work.sequence = current_sequence if work.name == cnc_workorder.name and work.processing_panel == k:
current_sequence += 10 cnc_back_workorder.write({'sequence': work.sequence + 1, 'state': 'ready', 'cnc_ids': work.cnc_ids,
if work.name == '后置三元质量检测' and work.processing_panel == k: 'cmm_ids': work.cmm_ids})
sequen = work.sequence print(cnc_back_workorder.sequence)
elif work.routing_type not in ['装夹预调'] and work != cnc_back_workorder:
for work in rec.workorder_ids: work.sequence += 1
if work.name == '后置三元质量检测(返工)' and work.processing_panel == k: print(work.sequence)
work.sequence = sequen + 2 if work.routing_type == '解除装夹':
if work.name == 'CNC加工(返工)' and work.processing_panel == k: work.write({'state': 'pending'})
work.sequence = sequen + 1 print(work.state)
# 在制造订单上新增工单 # 在制造订单上新增工单
def _create_workorder1(self, k): def _create_workorder1(self, k):
@@ -459,13 +459,7 @@ class MrpProduction(models.Model):
order='sequence asc' order='sequence asc'
) )
i += 1 i += 1
for route in routingworkcenter: for route in routingworkcenter:
# if route.routing_type == '后置三元质量检测':
# workorders_values.append(
# self.env['mrp.workorder'].json_workorder_str1(k, production, route)
# )
if route.routing_type == 'CNC加工': if route.routing_type == 'CNC加工':
workorders_values.append( workorders_values.append(
self.env['mrp.workorder'].json_workorder_str1(k, production, route)) self.env['mrp.workorder'].json_workorder_str1(k, production, route))

View File

@@ -895,6 +895,8 @@ class ResMrpWorkOrder(models.Model):
record.write({ record.write({
'date_planned_finished': tem_date_planned_finished # 保持原值 'date_planned_finished': tem_date_planned_finished # 保持原值
}) })
if record.routing_type == 'CNC加工' and record.test_results in ['返工', '报废']:
record.recreateManufacturingOrWorkerOrder()
is_production_id = True is_production_id = True
for workorder in record.production_id.workorder_ids: for workorder in record.production_id.workorder_ids:
if workorder.state != 'done': if workorder.state != 'done':

View File

@@ -7,8 +7,8 @@ import os
from odoo import models, fields, api, _ from odoo import models, fields, api, _
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path from odoo.modules import get_resource_path
from OCC.Extend.DataExchange import read_step_file # from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file # from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model): class ResProductMo(models.Model):

View File

@@ -80,7 +80,7 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0), <field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}) ]"/> (0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}) ]"/>
<!-- (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')})--> <!-- (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')})-->
<!-- <field name="target">fullscreen</field>--> <!-- <field name="target">fullscreen</field>-->
<field name="target">current</field> <field name="target">current</field>
<field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field> <field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field>
@@ -477,7 +477,7 @@
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'> <page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
<group> <group>
<field name="test_results" attrs='{"invisible":[("results","!=",False)]}'/> <field name="test_results" attrs='{"invisible":[("results","!=",False)]}'/>
<field name="is_remanufacture" attrs='{"invisible":[("test_results","=","合格")]}'/> <field name="is_remanufacture" attrs='{"invisible":[("test_results","!=","报废")]}'/>
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/> <field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
<field name="detection_report" attrs='{"invisible":[("results","!=",False)]}' <field name="detection_report" attrs='{"invisible":[("results","!=",False)]}'
widget="pdf_viewer"/> widget="pdf_viewer"/>

View File

@@ -32,6 +32,9 @@ class FtpController():
logging.error(f"Error checking file: {e}") logging.error(f"Error checking file: {e}")
return False return False
# # 检测字符串的编码 # # 检测字符串的编码
# def detect_encoding(self, s): # def detect_encoding(self, s):
# result = chardet.detect(s) # result = chardet.detect(s)

View File

@@ -8,8 +8,8 @@ from datetime import datetime
import requests import requests
from odoo import http from odoo import http
from odoo.http import request from odoo.http import request
from OCC.Extend.DataExchange import read_step_file # from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file # from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api from odoo import models, fields, api
from odoo.modules import get_resource_path from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError from odoo.exceptions import ValidationError, UserError

View File

@@ -6,8 +6,8 @@ import os
from datetime import datetime from datetime import datetime
from stl import mesh from stl import mesh
# from OCC.Core.GProp import GProp_GProps # from OCC.Core.GProp import GProp_GProps
from OCC.Extend.DataExchange import read_step_file # from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import write_stl_file # from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api from odoo import models, fields, api
from odoo.modules import get_resource_path from odoo.modules import get_resource_path