1.优化根据同一个产品,生成的制造订单绑定同一个编程单需求
This commit is contained in:
@@ -56,8 +56,9 @@ class MrpProduction(models.Model):
|
|||||||
glb_file = fields.Binary("glb模型文件")
|
glb_file = fields.Binary("glb模型文件")
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||||
production_line_state = fields.Selection([('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
|
production_line_state = fields.Selection(
|
||||||
string='上/下产线', default='待上产线')
|
[('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
|
||||||
|
string='上/下产线', default='待上产线')
|
||||||
# 工序状态
|
# 工序状态
|
||||||
# Todo 研究下用法
|
# Todo 研究下用法
|
||||||
process_state = fields.Selection([
|
process_state = fields.Selection([
|
||||||
@@ -114,7 +115,7 @@ class MrpProduction(models.Model):
|
|||||||
# production.state = 'pending_processing'
|
# production.state = 'pending_processing'
|
||||||
production.state = 'pending_cam'
|
production.state = 'pending_cam'
|
||||||
if production.state == 'progress' and production.schedule_state == '已排' and production.process_state == '待加工':
|
if production.state == 'progress' and production.schedule_state == '已排' and production.process_state == '待加工':
|
||||||
# if production.state == 'pending_cam' and production.process_state == '待加工':
|
# if production.state == 'pending_cam' and production.process_state == '待加工':
|
||||||
production.state = 'pending_processing'
|
production.state = 'pending_processing'
|
||||||
elif production.state == 'progress' and production.process_state == '待解除装夹':
|
elif production.state == 'progress' and production.process_state == '待解除装夹':
|
||||||
production.state = 'pending_era_cam'
|
production.state = 'pending_era_cam'
|
||||||
@@ -262,10 +263,14 @@ class MrpProduction(models.Model):
|
|||||||
# 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心;
|
# 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心;
|
||||||
|
|
||||||
def _create_workorder3(self):
|
def _create_workorder3(self):
|
||||||
|
programming_no = None
|
||||||
|
product_id_new = None
|
||||||
for production in self:
|
for production in self:
|
||||||
if not production.bom_id or not production.product_id:
|
if not production.bom_id or not production.product_id:
|
||||||
continue
|
continue
|
||||||
workorders_values = []
|
workorders_values = []
|
||||||
|
if product_id_new is None:
|
||||||
|
product_id_new = production.product_id
|
||||||
|
|
||||||
product_qty = production.product_uom_id._compute_quantity(production.product_qty,
|
product_qty = production.product_uom_id._compute_quantity(production.product_qty,
|
||||||
production.bom_id.product_uom_id)
|
production.bom_id.product_uom_id)
|
||||||
@@ -290,7 +295,14 @@ class MrpProduction(models.Model):
|
|||||||
'state': 'pending',
|
'state': 'pending',
|
||||||
}]
|
}]
|
||||||
if production.product_id.categ_id.type == '成品':
|
if production.product_id.categ_id.type == '成品':
|
||||||
production.fetchCNC()
|
if programming_no is None:
|
||||||
|
production.fetchCNC()
|
||||||
|
programming_no = production.programming_no
|
||||||
|
else:
|
||||||
|
if production.product_id == product_id_new:
|
||||||
|
if not production.programming_no:
|
||||||
|
production.write({'programming_no': programming_no, 'programming_state': '编程中'})
|
||||||
|
|
||||||
# 根据加工面板的面数及对应的工序模板生成工单
|
# 根据加工面板的面数及对应的工序模板生成工单
|
||||||
i = 0
|
i = 0
|
||||||
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
||||||
@@ -524,8 +536,8 @@ class MrpProduction(models.Model):
|
|||||||
# work.button_finish()
|
# work.button_finish()
|
||||||
|
|
||||||
# 创建工单并进行排序
|
# 创建工单并进行排序
|
||||||
def _create_workorder(self):
|
def _create_workorder(self, programming_no_new):
|
||||||
self._create_workorder3()
|
self._create_workorder3(programming_no_new)
|
||||||
self._reset_work_order_sequence()
|
self._reset_work_order_sequence()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -1143,6 +1143,7 @@ class WorkPieceDelivery(models.Model):
|
|||||||
name = fields.Char('单据编号')
|
name = fields.Char('单据编号')
|
||||||
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
|
workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True)
|
||||||
workorder_state = fields.Selection(related='workorder_id.state', string='工单状态')
|
workorder_state = fields.Selection(related='workorder_id.state', string='工单状态')
|
||||||
|
rfid_code = fields.Char(related='workorder_id.rfid_code', string='rfid码', store=True)
|
||||||
production_id = fields.Many2one('mrp.production', string='制造订单号', readonly=True)
|
production_id = fields.Many2one('mrp.production', string='制造订单号', readonly=True)
|
||||||
production_line_id = fields.Many2one('sf.production.line', string='目的生产线')
|
production_line_id = fields.Many2one('sf.production.line', string='目的生产线')
|
||||||
plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True)
|
plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True)
|
||||||
@@ -1158,7 +1159,6 @@ class WorkPieceDelivery(models.Model):
|
|||||||
status = fields.Selection(
|
status = fields.Selection(
|
||||||
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发')
|
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态', default='待下发')
|
||||||
is_cnc_program_down = fields.Boolean('程序是否下发', default=False)
|
is_cnc_program_down = fields.Boolean('程序是否下发', default=False)
|
||||||
rfid_code = fields.Char('rfid码')
|
|
||||||
active = fields.Boolean(string="有效", default=True)
|
active = fields.Boolean(string="有效", default=True)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
@@ -612,6 +612,7 @@
|
|||||||
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
||||||
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
||||||
<field name="is_cnc_program_down" readonly="1"/>
|
<field name="is_cnc_program_down" readonly="1"/>
|
||||||
|
<!-- <field name="rfid_code"/>-->
|
||||||
<field name="task_delivery_time" readonly="1"/>
|
<field name="task_delivery_time" readonly="1"/>
|
||||||
<field name="task_completion_time" readonly="1"/>
|
<field name="task_completion_time" readonly="1"/>
|
||||||
<field name="delivery_duration" widget="float_time"/>
|
<field name="delivery_duration" widget="float_time"/>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user