增加坯料冗余量

This commit is contained in:
胡尧
2024-11-19 08:59:52 +08:00
parent 21f961d893
commit d53f3837c3
10 changed files with 60 additions and 20 deletions

View File

@@ -6,7 +6,7 @@ class ModelType(models.Model):
_description = '模型类型'
name = fields.Char('名称')
embryo_tolerance = fields.Integer('坯料容余')
embryo_tolerance = fields.Many2one('sf.embryo.redundancy', string='坯料容余', required=True)
product_routing_tmpl_ids = fields.One2many('sf.product.model.type.routing.sort', 'product_model_type_id',
'成品工序模板(自动化产线加工')
embryo_routing_tmpl_ids = fields.One2many('sf.embryo.model.type.routing.sort', 'embryo_model_type_id',

View File

@@ -852,7 +852,7 @@ class ResProductMo(models.Model):
attachment = self.attachment_create(item['model_name'], item['model_data'])
# 获取坯料冗余配置
if not item.get('embryo_redundancy'):
embryo_redundancy_id = self.env['sf.embryo.redundancy'].search([('name', '=', '粗坯料')], limit=1)
embryo_redundancy_id = model_type.embryo_tolerance
else:
embryo_redundancy_id = item.get('embryo_redundancy')
vals = {
@@ -938,11 +938,6 @@ class ResProductMo(models.Model):
# surface_technology = self.env['stock.route'].sudo().search([('name', '=', '表面工艺外协')])
# if surface_technology:
# no_bom_copy_product_id.route_ids |= surface_technology
# 获取坯料冗余配置
if not item.get('embryo_redundancy_id'):
embryo_redundancy_id = self.env['sf.embryo.redundancy'].search([('name', '=', '粗坯料')], limit=1)
else:
embryo_redundancy_id = item.get('embryo_redundancy_id')
no_bom_copy_product_id.product_tmpl_id.active = True
logging.info('no_bom_copy_product_id[is_manual_processing]:%s' % no_bom_copy_product_id.is_manual_processing)
materials_id = self.env['sf.production.materials'].search(
@@ -951,6 +946,11 @@ class ResProductMo(models.Model):
[('materials_no', '=', item['texture_type_code'])])
model_type = self.env['sf.model.type'].search([], limit=1)
supplier = self.env['mrp.bom'].get_supplier(materials_type_id)
# 获取坯料冗余配置
if not item.get('embryo_redundancy_id'):
embryo_redundancy_id = model_type.embryo_tolerance
else:
embryo_redundancy_id = item.get('embryo_redundancy_id')
logging.info('no_bom_copy_product_supplier-vals:%s' % supplier)
vals = {
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',

View File

@@ -314,13 +314,15 @@ class StockRule(models.Model):
i = 0
for k in (production_item.product_id.model_processing_panel.split(',')):
if production_item.production_type == '自动化产线加工':
model = 'sf.product.model.type.routing.sort'
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
[('product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
order='sequence asc'
)
else:
model = 'sf.manual.product.model.type.routing.sort'
product_routing_workcenter = self.env[model].search(
[('product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
order='sequence asc'
)
product_routing_workcenter = self.env['sf.manual.product.model.type.routing.sort'].search(
[('manual_product_model_type_id', '=', production_item.product_id.product_model_type_id.id)],
order='sequence asc'
)
for route in product_routing_workcenter:
i += 1
technology_design_values.append(