1.修复工件配送向导制造订单号能显示5个

2工件配送向导页面优化
3.生成制造订单同时工件配送默认路线
This commit is contained in:
jinling.yang
2024-05-11 13:38:57 +08:00
parent ec01b89242
commit 999959b6a1
9 changed files with 77 additions and 43 deletions

View File

@@ -493,9 +493,15 @@ class ResMrpWorkOrder(models.Model):
return workorders_values_str
def _json_workpiece_delivery_list(self, production):
up_route = self.env['sf.agv.task.route'].search([('route_type', '=', '上产线')], limit=1, order='id asc')
down_route = self.env['sf.agv.task.route'].search([('route_type', '=', '下产线')], limit=1, order='id asc')
return [
[0, '', {'production_id': production.id, 'type': '上产线'}],
[0, '', {'production_id': production.id, 'type': '下产线'}]]
[0, '', {'production_id': production.id, 'type': '上产线', 'route_id': up_route.id,
'feeder_station_start_id': up_route.start_site_id.id,
'feeder_station_destination_id': up_route.end_site_id.id}],
[0, '', {'production_id': production.id, 'type': '下产线', 'route_id': down_route.id,
'feeder_station_start_id': down_route.start_site_id.id,
'feeder_station_destination_id': down_route.end_site_id.id}]]
# 拼接工单对象属性值(表面工艺)
def _json_workorder_surface_process_str(self, production, route, process_parameter, supplier_id):
@@ -745,12 +751,12 @@ class ResMrpWorkOrder(models.Model):
limit=1, order='id asc')
if not cnc_workorder:
raise UserError(_('该制造订单还未下发CNC程序请稍后再试'))
# else:
# for item in cnc_workorder.cnc_ids:
# functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
# [('tool_name_id.name', '=', item.cutting_tool_name)])
# if not functional_cutting_tool:
# raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
else:
for item in cnc_workorder.cnc_ids:
functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
[('tool_name_id.name', '=', item.cutting_tool_name)])
if not functional_cutting_tool:
raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
if self.routing_type == '解除装夹':
'''
记录开始时间
@@ -827,6 +833,13 @@ class ResMrpWorkOrder(models.Model):
raise UserError("请对前置三元检测定位参数进行计算定位")
if not record.rfid_code:
raise UserError("请扫RFID码进行绑定")
record.process_state = '待加工'
# record.write({'process_state': '待加工'})
record.production_id.process_state = '待加工'
if record.routing_type == 'CNC加工':
record.process_state = '待解除装夹'
# record.write({'process_state': '待加工'})
record.production_id.process_state = '待解除装夹'
if record.routing_type == '解除装夹':
'''
记录结束时间

View File

@@ -7,8 +7,10 @@ import os
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
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):
@@ -179,6 +181,12 @@ class ResProductMo(models.Model):
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
# }
# def name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
# # if self._context.get('is_sale_order_line'):
# # domain = [('sale_ok', '=', True), ('categ_type', '=', '成品')]
# # return self._search(expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid)
# return super(product.template, self)._name_search(name, args, operator, limit, name_get_uid)
@api.onchange('specification_id')
def _onchange_specification(self):
if self.specification_id: