Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/订单计划
# Conflicts: # sf_maintenance/__manifest__.py # sf_manufacturing/views/mrp_workcenter_views.xml
This commit is contained in:
@@ -8,6 +8,7 @@ from . import mrp_maintenance
|
||||
from . import mrp_routing_workcenter
|
||||
from . import stock
|
||||
from . import res_user
|
||||
from . import production_line_base
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,14 @@ from odoo import api, fields, models, _
|
||||
class MrpProduction(models.Model):
|
||||
_inherit = 'mrp.production'
|
||||
_description = "制造订单"
|
||||
_order = 'create_date desc'
|
||||
|
||||
tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘")
|
||||
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")
|
||||
request_ids = fields.One2many('maintenance.request', 'production_id')
|
||||
model_file = fields.Binary('模型文件', related='product_id.model_file')
|
||||
schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排')],
|
||||
string='排程状态', default='未排')
|
||||
|
||||
@api.depends('request_ids')
|
||||
def _compute_maintenance_count(self):
|
||||
@@ -336,7 +339,7 @@ class MrpProduction(models.Model):
|
||||
current_sequence += 1
|
||||
if work.name == '获取CNC加工程序':
|
||||
work.button_start()
|
||||
work.fetchCNC()
|
||||
#work.fetchCNC()
|
||||
|
||||
# 创建工单并进行排序
|
||||
def _create_workorder(self):
|
||||
|
||||
@@ -6,7 +6,9 @@ from odoo.addons.resource.models.resource import Intervals
|
||||
|
||||
class ResWorkcenter(models.Model):
|
||||
_inherit = "mrp.workcenter"
|
||||
machine_tool_id = fields.Many2one('sf.machine_tool', '机床')
|
||||
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
|
||||
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||
is_process_outsourcing = fields.Boolean('工艺外协')
|
||||
users_ids = fields.Many2many("res.users", 'users_workcenter')
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
|
||||
|
||||
class ResMrpWorkOrder(models.Model):
|
||||
_inherit = 'mrp.workorder'
|
||||
_order = 'sequence'
|
||||
_order = 'sequence asc,create_date desc'
|
||||
|
||||
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True,
|
||||
check_company=True, string="坯料长度(mm)")
|
||||
@@ -28,7 +28,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
store=True, check_company=True, string="材料")
|
||||
product_tmpl_id_materials_type_id = fields.Many2one(related='production_id.product_tmpl_id.materials_type_id',
|
||||
readonly=True, store=True, check_company=True, string="型号")
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', string='工作中心', required=False)
|
||||
users_ids = fields.Many2many("res.users", 'users_workorder', related="workcenter_id.users_ids")
|
||||
processing_panel = fields.Char('加工面')
|
||||
sequence = fields.Integer(string='工序')
|
||||
@@ -106,6 +106,35 @@ class ResMrpWorkOrder(models.Model):
|
||||
picking_in_id = fields.Many2one('stock.picking', string='外协入库单')
|
||||
picking_out_id = fields.Many2one('stock.picking', string='外协出库单')
|
||||
supplier_id = fields.Many2one('res.partner', string='外协供应商')
|
||||
equipment_id = fields.Many2one('maintenance.equipment', string='加工设备')
|
||||
schedule_state = fields.Selection(related='production_id.schedule_state', store=True)
|
||||
# 工件装夹信息
|
||||
functional_fixture_code = fields.Char(string="功能夹具编码", readonly=True)
|
||||
functional_fixture_serial_number = fields.Char(string="功能夹具序列号", readonly=True)
|
||||
functional_fixture_id = fields.Many2one('sf.functional.fixture', string="功能夹具")
|
||||
functional_fixture_type_id = fields.Many2one('sf.functional.fixture.type', string="功能夹具类型", readonly=True)
|
||||
chuck_serial_number = fields.Char(string="卡盘序列号")
|
||||
chuck_name = fields.Char(string="卡盘名称")
|
||||
chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌")
|
||||
chuck_type_id = fields.Char(string="卡盘类型")
|
||||
chuck_model_id = fields.Char(string="卡盘型号")
|
||||
tray_serial_number = fields.Char(string="卡盘序列号")
|
||||
tray_name = fields.Char(string="托盘名称")
|
||||
tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌")
|
||||
tray_type_id = fields.Char(string="托盘类型")
|
||||
tray_model_id = fields.Char(string="托盘型号")
|
||||
total_wight = fields.Float(string="总重量")
|
||||
maximum_carrying_weight = fields.Char(string="最大承载重量[kg]")
|
||||
maximum_clamping_force = fields.Char(string="最大夹持力[n]")
|
||||
production_line = fields.Char(string="生产线")
|
||||
preset_program_information = fields.Char(string="预调程序信息")
|
||||
|
||||
@api.onchange('functional_fixture_id')
|
||||
def _onchange_functional_fixture_id(self):
|
||||
if self.functional_fixture_id:
|
||||
self.functional_fixture_code = self.functional_fixture_id.code
|
||||
self.functional_fixture_type_id = self.functional_fixture_id.type_id.id
|
||||
|
||||
|
||||
def get_no_data(self, production_id):
|
||||
process_parameter_workorder = self.search(
|
||||
@@ -165,7 +194,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'operation_id': False,
|
||||
'name': route.route_workcenter_id.name,
|
||||
'processing_panel': k,
|
||||
'quality_point_ids':route.route_workcenter_id.quality_point_ids,
|
||||
'quality_point_ids': route.route_workcenter_id.quality_point_ids,
|
||||
'routing_type': route.routing_type,
|
||||
'work_state': '' if not route.routing_type == '获取CNC加工程序' else '待发起',
|
||||
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids,
|
||||
|
||||
30
sf_manufacturing/models/production_line_base.py
Normal file
30
sf_manufacturing/models/production_line_base.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from odoo import models,fields
|
||||
|
||||
|
||||
class ProductionLine(models.Model):
|
||||
_name = 'sf.production.line'
|
||||
_description = '生产线'
|
||||
|
||||
def _get_code(self):
|
||||
"""
|
||||
自动生成编码
|
||||
:return:
|
||||
"""
|
||||
fixture_material = self.env['sf.production.line'].sudo().search(
|
||||
[('code', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not fixture_material:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(fixture_material.code) + 1
|
||||
num = "%03d" % m
|
||||
return num
|
||||
|
||||
name = fields.Char('生产线')
|
||||
code = fields.Char('编码', default=_get_code, readonly=True)
|
||||
remark = fields.Char('备注')
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -231,18 +231,8 @@ class ProductionLot(models.Model):
|
||||
1]
|
||||
now = datetime.now().strftime("%Y-%m-%d")
|
||||
# formatted_date = now.strftime("%Y-%m-%d")
|
||||
if product.integral_cutting_tool_type_id:
|
||||
return "%s-%s-%03d" % (product.integral_cutting_tool_type_id.code, now, 1)
|
||||
if product.blade_type_id:
|
||||
return "%s-%s-%03d" % (product.blade_type_id.code, now, 1)
|
||||
if product.cutter_bar_type_id:
|
||||
return "%s-%s-%03d" % (product.cutter_bar_type_id.code, now, 1)
|
||||
if product.cutter_pad_type_id:
|
||||
return "%s-%s-%03d" % (product.cutter_pad_type_id.code, now, 1)
|
||||
if product.handle_type_id:
|
||||
return "%s-%s-%03d" % (product.handle_type_id.code, now, 1)
|
||||
if product.chuck_type_id:
|
||||
return "%s-%s-%03d" % (product.chuck_type_id.code, now, 1)
|
||||
if product.cutting_tool_model_id:
|
||||
return "%s-%s-%03d" % (product.cutting_tool_model_id.code, now, 1)
|
||||
return "%s-%03d" % (product.name, 1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user