修改工单重复,业务平台分配工厂自动生成产品部分新增字段
This commit is contained in:
@@ -14,7 +14,14 @@ class ResProductTemplate(models.Model):
|
||||
model_materials_id = fields.Many2one('mrs.production.materials', string='模型材料')
|
||||
model_materials_type_id = fields.Many2one('mrs.materials.model', string='模型材料型号')
|
||||
model_type_id = fields.Many2one('sf.model.type', string='模型类型')
|
||||
processing_panel = fields.Char('模型加工面板')
|
||||
model_processing_panel = fields.Char('模型加工面板')
|
||||
model_surface_process_id = fields.Many2one('mrs.production.process', string='表面工艺')
|
||||
model_process_parameters_id = fields.Many2one('mrs.processing.technology', string='工艺参数')
|
||||
# price = fields.Float('单价', digits=(16, 3))
|
||||
# number = fields.Integer('数量', default=1)
|
||||
# total_amount = fields.Float('金额', digits=(16, 3), compute='_compute_total_amount')
|
||||
# model_number =
|
||||
|
||||
# 胚料的长,宽,高
|
||||
embryo_long = fields.Float('胚料长[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
embryo_width = fields.Float('胚料宽[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
@@ -22,6 +29,7 @@ class ResProductTemplate(models.Model):
|
||||
embryo_materials_id = fields.Many2one('mrs.production.materials', string='胚料材料')
|
||||
embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='胚料材料型号')
|
||||
|
||||
|
||||
volume = fields.Float(compute='_compute_volume', store=True)
|
||||
|
||||
@api.depends('embryo_long', 'embryo_width', 'embryo_height')
|
||||
@@ -43,6 +51,11 @@ class ResProductTemplate(models.Model):
|
||||
[('materials_no', '=', item['texture_code'])]).id,
|
||||
'model_materials_type_id': self.env['mrs.materials.model'].search(
|
||||
[('materials_no', '=', item['texture_type_code'])]).id,
|
||||
'model_surface_process_id': self.env['mrs.production.process'].search(
|
||||
[('process_encode', '=', item['surface_process_code'])]).id,
|
||||
'model_process_parameters_id': self.env['mrs.processing.technology'].search(
|
||||
[('process_encode', '=', item['process_parameters_code'])]).id,
|
||||
''
|
||||
'default_code': '%s-%s' % (order_number, i),
|
||||
'barcode': item['barcode'],
|
||||
'active': True
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<field name="model_height" string="高[mm]"/>
|
||||
<field name="model_volume" string="体积[mm]"/>
|
||||
<field name="model_type_id" string="模板类型"/>
|
||||
<field name="processing_panel" placeholder="例如A,B" string="加工面板"/>
|
||||
<field name="model_processing_panel" placeholder="例如A,B" string="加工面板"/>
|
||||
<field name="model_precision" string="精度要求"/>
|
||||
<field name="model_materials_id" string="材料"/>
|
||||
<field name="model_materials_type_id" string="型号"
|
||||
|
||||
@@ -20,4 +20,20 @@ class ResMrpWorkOrder(models.Model):
|
||||
('解除装夹', '解除装夹'),
|
||||
], string="工序类型")
|
||||
|
||||
def json_workorder_str(self, k, production, route):
|
||||
workorders_values_str = [0, '', {
|
||||
'product_uom_id': production.product_uom_id.id,
|
||||
'qty_producing': 0,
|
||||
'operation_id': False,
|
||||
'name': route.route_workcenter_id.name,
|
||||
'processing_panel': k,
|
||||
'routing_type': route.routing_type,
|
||||
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids),
|
||||
'date_planned_start': False,
|
||||
'date_planned_finished': False,
|
||||
'duration_expected': 60,
|
||||
'duration': 0
|
||||
}]
|
||||
return workorders_values_str
|
||||
|
||||
|
||||
|
||||
@@ -65,23 +65,24 @@ class MrpProduction(models.Model):
|
||||
'state': 'pending',
|
||||
}]
|
||||
# 根据加工面板的面数及对应的工序模板生成工单
|
||||
for k in (production.product_id.processing_panel.split(',')):
|
||||
for route in production.product_id.model_type_id.routing_tmpl_ids:
|
||||
if route:
|
||||
workorders_values_str = [0, '', {
|
||||
'product_uom_id': production.product_uom_id.id,
|
||||
'qty_producing': 0,
|
||||
'operation_id': False,
|
||||
'name': route.route_workcenter_id.name,
|
||||
'processing_panel': k,
|
||||
'routing_type': route.routing_type,
|
||||
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids),
|
||||
'date_planned_start': False,
|
||||
'date_planned_finished': False,
|
||||
'duration_expected': 60,
|
||||
'duration': 0
|
||||
}]
|
||||
workorders_values.append(workorders_values_str)
|
||||
i = 0
|
||||
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
||||
for k in (production.product_id.model_processing_panel.split(',')):
|
||||
routingworkcenter = self.env['sf.model.type.routing.sort'].search(
|
||||
[('model_type_id', '=', production.product_id.model_type_id.id)],
|
||||
order='sequence asc'
|
||||
)
|
||||
i += 1
|
||||
for route in routingworkcenter:
|
||||
if i == 1 and route.routing_type == '获取CNC加工程序':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str('', production, route))
|
||||
if route.is_repeat == True:
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||
if i == processing_panel_len and route.routing_type == '解除装夹':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||
production.workorder_ids = workorders_values
|
||||
for workorder in production.workorder_ids:
|
||||
workorder.duration_expected = workorder._get_duration_expected()
|
||||
|
||||
2
sf_mrs_connect/__init__.py
Normal file
2
sf_mrs_connect/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import controllers
|
||||
from . import models
|
||||
24
sf_mrs_connect/__manifest__.py
Normal file
24
sf_mrs_connect/__manifest__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂连接制造资源库 ',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂连接制造资源库模块',
|
||||
'sequence': 1,
|
||||
'description': """
|
||||
在本模块,智能工厂连接制造资源库
|
||||
""",
|
||||
'category': 'YZ',
|
||||
'website': 'https://www.sf.cs.jikimo.com',
|
||||
'depends': [],
|
||||
'data': [
|
||||
# 'views/sale_process_order_view.xml'
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
'qweb': [
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
0
sf_mrs_connect/controllers/__init__.py
Normal file
0
sf_mrs_connect/controllers/__init__.py
Normal file
1
sf_mrs_connect/controllers/controllers.py
Normal file
1
sf_mrs_connect/controllers/controllers.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import controllers
|
||||
1
sf_mrs_connect/models/__init__.py
Normal file
1
sf_mrs_connect/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
0
sf_mrs_connect/models/models.py
Normal file
0
sf_mrs_connect/models/models.py
Normal file
Reference in New Issue
Block a user