1、修改所以夹具物料信息转接板夹具为转接板(锁板)夹具;2、优化功能刀具安全库存触发生成功能刀具组装单时重复触发的问题;3、设置功能刀具安全库存模型相关字段只有在创建的时候可以修改,其他时候是只读;4、优化功能刀具组装单组装完成后功能刀具入库位置不是刀具房的问题;
This commit is contained in:
@@ -59,7 +59,7 @@ class BasicParametersFixture(models.Model):
|
||||
magnetic_field_height = fields.Float('磁场高度(mm)', digits=(16, 2))
|
||||
magnetic_pole_plate_grinding_allowance = fields.Float('磁极板磨削余量(mm)', digits=(16, 2))
|
||||
|
||||
# '转接板夹具' 字段
|
||||
# '转接板(锁板)夹具' 字段
|
||||
screw_size = fields.Float('螺牙大小(mm)', digits=(16, 2))
|
||||
via_hole_diameter = fields.Float('过孔直径(mm)', digits=(16, 2))
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class FixtureModel(models.Model):
|
||||
magnet_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='磁吸夹具基本参数')
|
||||
adapter_board_fixture_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='转接板夹具基本参数')
|
||||
string='转接板(锁板)夹具基本参数')
|
||||
scroll_chuck_ids = fields.One2many('sf.fixture.materials.basic.parameters', 'fixture_model_id',
|
||||
string='三爪卡盘基本参数')
|
||||
|
||||
@@ -67,7 +67,7 @@ class FixtureModel(models.Model):
|
||||
if fixture_material_id:
|
||||
if self.fixture_material_id.name == "气动夹具":
|
||||
code = self._get_code("JKM-C-JJWL-QDJJ-")
|
||||
elif self.fixture_material_id.name == "转接板夹具":
|
||||
elif self.fixture_material_id.name == "转接板(锁板)夹具":
|
||||
code = self._get_code("JKM-C-JJWL-ZJJJ-")
|
||||
elif self.fixture_material_id.name == "磁吸夹具":
|
||||
code = self._get_code("JKM-C-JJWL-CXJJ-")
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
<field name="adapter_board_fixture_ids"
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '转接板夹具')]}">
|
||||
attrs="{'invisible': [('fixture_material_type', '!=', '转接板(锁板)夹具')]}">
|
||||
<tree editable="bottom" class="center" delete="0">
|
||||
<field name="name"/>
|
||||
<field name="length"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
from datetime import timedelta
|
||||
|
||||
from odoo import fields, models, api
|
||||
from odoo import SUPERUSER_ID
|
||||
from odoo.exceptions import ValidationError
|
||||
@@ -234,6 +234,7 @@ class FunctionalToolWarning(models.Model):
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
_description = '功能刀具出入库记录'
|
||||
_order = 'install_tool_time desc'
|
||||
|
||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
||||
@@ -253,11 +254,11 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
_name = 'sf.real.time.distribution.of.functional.tools'
|
||||
_description = '功能刀具安全库存'
|
||||
|
||||
name = fields.Char('功能刀具名称')
|
||||
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
|
||||
name = fields.Char('功能刀具名称', readonly=False)
|
||||
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
|
||||
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
|
||||
diameter = fields.Integer(string='刀具直径(mm)')
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
|
||||
tool_stock_num = fields.Integer(string='刀具房数量')
|
||||
side_shelf_num = fields.Integer(string='线边刀库数量')
|
||||
on_tool_stock_num = fields.Integer(string='机内刀库数量')
|
||||
@@ -266,10 +267,10 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
max_stock_num = fields.Integer('最高库存量')
|
||||
batch_replenishment_num = fields.Integer('批次补货量', readonly=True, compute='_compute_batch_replenishment_num')
|
||||
unit = fields.Char('单位')
|
||||
image = fields.Binary('图片')
|
||||
image = fields.Binary('图片', readonly=False)
|
||||
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精')
|
||||
whether_standard_knife = fields.Boolean(string='是否标准刀', default=True)
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=False)
|
||||
whether_standard_knife = fields.Boolean(string='是否标准刀', default=True, readonly=False)
|
||||
# 能力特征信息
|
||||
suitable_machining_method_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_machining_product_template_distribution', '适合加工方式',
|
||||
@@ -299,7 +300,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
@api.constrains('min_stock_num', 'max_stock_num')
|
||||
def _check_stock_num(self):
|
||||
for obj in self:
|
||||
if obj.min_stock_num > obj.min_stock_num:
|
||||
if obj.min_stock_num > obj.max_stock_num:
|
||||
raise ValidationError('【最低安全库存】不能高于【最高安全库存】!!!')
|
||||
|
||||
@api.model
|
||||
@@ -326,31 +327,31 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
if tool.tool_stock_total < tool.min_stock_num:
|
||||
tool.batch_replenishment_num = tool.max_stock_num - tool.tool_stock_total
|
||||
# 根据判断创建功能刀具组装单
|
||||
if not tool.sf_functional_tool_assembly_ids:
|
||||
if not tool.sf_functional_tool_assembly_ids and re.match(r'^\d+$', str(tool.id)):
|
||||
for i in range(tool.batch_replenishment_num):
|
||||
tool.create_functional_tool_assembly()
|
||||
tool.create_functional_tool_assembly(tool)
|
||||
print(i, ": ", tool.sf_functional_tool_assembly_ids)
|
||||
else:
|
||||
tool.batch_replenishment_num = 0
|
||||
|
||||
def create_functional_tool_assembly(self):
|
||||
def create_functional_tool_assembly(self, tool):
|
||||
"""
|
||||
创建功能刀具组装单
|
||||
"""
|
||||
functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().create({
|
||||
'functional_tool_name': self.name,
|
||||
'functional_tool_type_id': self.sf_cutting_tool_type_id.id,
|
||||
'functional_tool_diameter': self.diameter,
|
||||
'knife_tip_r_angle': self.knife_tip_r_angle,
|
||||
'coarse_middle_thin': self.coarse_middle_thin,
|
||||
functional_tool_assembly = tool.env['sf.functional.tool.assembly'].sudo().create({
|
||||
'functional_tool_name': tool.name,
|
||||
'functional_tool_type_id': tool.sf_cutting_tool_type_id.id,
|
||||
'functional_tool_diameter': tool.diameter,
|
||||
'knife_tip_r_angle': tool.knife_tip_r_angle,
|
||||
'coarse_middle_thin': tool.coarse_middle_thin,
|
||||
'loading_task_source': '2',
|
||||
'use_tool_time': fields.Datetime.now() + timedelta(hours=4),
|
||||
'applicant': '系统自动',
|
||||
'apply_time': fields.Datetime.now(),
|
||||
'whether_standard_knife': self.whether_standard_knife,
|
||||
'whether_standard_knife': tool.whether_standard_knife,
|
||||
'reason_for_applying': '安全库存',
|
||||
})
|
||||
self.sf_functional_tool_assembly_ids = [(4, functional_tool_assembly.id)]
|
||||
tool.sf_functional_tool_assembly_ids = [(4, functional_tool_assembly.id)]
|
||||
|
||||
def estimate_functional_tool_assembly_ids(self, tool):
|
||||
"""
|
||||
@@ -394,6 +395,15 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
|
||||
vals['sf_functional_cutting_tool_entity_ids'] = sf_functional_cutting_tool_entity_ids.ids
|
||||
self.env['sf.real.time.distribution.of.functional.tools'].create(vals)
|
||||
|
||||
status_create = fields.Boolean('是否是新增状态', default=True)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
vals['status_create'] = False
|
||||
records = super(RealTimeDistributionOfFunctionalTools, self).create(vals_list)
|
||||
return records
|
||||
|
||||
|
||||
class MachineTableToolChangingApply(models.Model):
|
||||
_name = 'sf.machine.table.tool.changing.apply'
|
||||
|
||||
@@ -310,22 +310,29 @@
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name"/>
|
||||
<field name="name" attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
</h1>
|
||||
</div>
|
||||
<field name="status_create" invisible="1"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="sf_cutting_tool_type_id" readonly="1"/>
|
||||
<field name="diameter" readonly="1"/>
|
||||
<field name="knife_tip_r_angle" readonly="1"/>
|
||||
<field name="coarse_middle_thin" readonly="1"/>
|
||||
<field name="whether_standard_knife" readonly="1"/>
|
||||
<field name="sf_cutting_tool_type_id"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="diameter"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="knife_tip_r_angle"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="coarse_middle_thin"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="whether_standard_knife"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="min_stock_num"/>
|
||||
<field name="max_stock_num"/>
|
||||
<field name="batch_replenishment_num"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="image" widget='image' readonly="1"/>
|
||||
<field name="image" widget='image'
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="1">
|
||||
@@ -366,7 +373,7 @@
|
||||
<field name="barcode_id"/>
|
||||
<field name="functional_tool_name_id"/>
|
||||
<field name="new_former"/>
|
||||
<field name="tool_loading_length" string="总长度"/>
|
||||
<field name="tool_loading_length" string="总长度(mm)"/>
|
||||
<field name="functional_tool_length"/>
|
||||
<field name="effective_length"/>
|
||||
<field name="max_lifetime_value"/>
|
||||
|
||||
@@ -537,6 +537,8 @@ class StockPicking(models.Model):
|
||||
self.env['stock.move.line'].create({
|
||||
'picking_id': picking_id.id,
|
||||
'product_id': stock_lot.product_id.id,
|
||||
'location_id': picking_id.location_id.id,
|
||||
'location_dest_id': picking_id.location_dest_id.id,
|
||||
'lot_id': stock_lot.id,
|
||||
'qty_done': 1,
|
||||
'functional_tool_name_id': functional_tool_assembly.id
|
||||
|
||||
Reference in New Issue
Block a user