增加坯料冗余量,调整坯料客供料的名称

This commit is contained in:
胡尧
2024-11-18 09:44:50 +08:00
parent 9410ca82db
commit bc0b8bdecb
12 changed files with 84 additions and 27 deletions

View File

@@ -10,7 +10,7 @@ def _data_install(cr, registry):
env.ref('jikimo_sale_multiple_supply_methods.product_template_purchase').product_variant_id.write({'active': False, 'is_bfm': True})
env.ref('jikimo_sale_multiple_supply_methods.product_template_manual_processing').product_variant_id.write({'active': False, 'single_manufacturing': True, 'is_bfm': True})
env.ref('jikimo_sale_multiple_supply_methods.product_template_default').product_variant_id.write({'active': False, 'is_bfm': True})
env.ref('jikimo_sale_multiple_supply_methods.product_template_raw_material_customer_provided').product_variant_id.write({'active': False})
env.ref('jikimo_sale_multiple_supply_methods.product_template_embryo_customer_provided').product_variant_id.write({'active': False})
env.ref('jikimo_sale_multiple_supply_methods.product_template_outsourcing').product_variant_id.write({'active': False, 'is_bfm': True})
env.ref('sf_dlm.product_embryo_sf_self_machining').product_tmpl_id.write({'categ_type': '坯料'})
env.ref('sf_dlm.product_template_sf').product_tmpl_id.write({'categ_type': '成品'})

View File

@@ -65,7 +65,7 @@
<field name="partner_id" eval="91"/>
</record>
<record id="product_template_raw_material_customer_provided" model="product.template">
<record id="product_template_embryo_customer_provided" model="product.template">
<field name="name">坯料客供料模板</field>
<field name="active" eval="False"/>
<field name="categ_id" ref="sf_dlm.product_category_embryo_sf"/>

View File

@@ -68,7 +68,7 @@ class SaleOrder(models.Model):
# 当成品上带有客供料选项时,生成坯料时选择“客供料”路线
if line.is_incoming_material:
# 将成品模板的内容复制到成品上
customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_tempalte_raw_material_customer_provided').sudo()
customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_embryo_customer_provided').sudo()
# 创建坯料客供料的批量不需要创建bom
material_customer_provided_embryo = self.env['product.template'].sudo().no_bom_product_create(
customer_provided_embryo.with_context(active_test=False).product_variant_id,

View File

@@ -410,3 +410,13 @@ class ReSaleOrder(models.Model):
person_of_delivery = fields.Char('收货人')
telephone_of_delivery = fields.Char('电话号码')
address_of_delivery = fields.Char('联系地址')
class EmbryoRedundancy(models.Model):
_name = "sf.embryo.redundancy"
name = fields.Char('名称', required=True)
long = fields.Float('长度', required=True)
width = fields.Float('宽度', required=True)
height = fields.Float('高度', required=True)
code = fields.Char('编码', required=True)

View File

@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse','jikimo_attachment_viewer', 'jikimo_sale_multiple_supply_methods'],
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse','jikimo_attachment_viewer'],
'data': [
'data/cron_data.xml',
'data/stock_data.xml',

View File

@@ -1331,17 +1331,17 @@ class MrpProduction(models.Model):
return production_values_str
# 增加制造订单类型
production_type = fields.Selection(
[('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
string='制造类型',
compute='_compute_production_type',
store=True
)
# production_type = fields.Selection(
# [('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
# string='制造类型',
# compute='_compute_production_type',
# store=True
# )
@api.depends('product_id.is_manual_processing')
def _compute_production_type(self):
for production in self:
production.production_type = '自动化产线加工' if not production.product_id.is_manual_processing else '人工线下加工'
# @api.depends('product_id.is_manual_processing')
# def _compute_production_type(self):
# for production in self:
# production.production_type = '自动化产线加工' if not production.product_id.is_manual_processing else '人工线下加工'
class sf_detection_result(models.Model):

View File

@@ -356,14 +356,21 @@ class StockRule(models.Model):
product_id_to_production_names)
if not technology_design_values:
if production.product_id.categ_id.type == '成品':
production.product_id.model_processing_panel = 'ZM,FM'
# production.product_id.model_processing_panel = 'ZM,FM'
# 根据加工面板的面数及成品工序模板生成工序设计
i = 0
for k in (production.product_id.model_processing_panel.split(',')):
# 根据制造类型来选择成品工序模板
# if production.production_type == '自动化产线加工':
product_routing_workcenter = self.env['sf.product.model.type.routing.sort'].search(
[('product_model_type_id', '=', production.product_id.product_model_type_id.id)],
order='sequence asc'
)
# elif production.production_type == '人工线下加工':
# product_routing_workcenter = self.env['sf.manual.product.model.type.routing.sort'].search(
# [('manual_product_model_type_id', '=', production.product_id.product_model_type_id.id)],
# order='sequence asc'
# )
for route in product_routing_workcenter:
i += 1
technology_design_values.append(
@@ -407,7 +414,6 @@ class StockRule(models.Model):
product_production_process,
i))
productions.technology_design_ids = technology_design_values
# # 同一个产品多个制造订单对应一个编程单和模型库
# # 只调用一次fetchCNC并将所有生产订单的名称作为字符串传递
# if not production_item.programming_no:

View File

@@ -35,10 +35,10 @@
<field name="reservation_state" optional="hide" decoration-danger="reservation_state == 'confirmed'"
decoration-success="reservation_state == 'assigned'"/>
</xpath>
<xpath expr="//field[@name='state']" position="before">
<!-- <xpath expr="//field[@name='state']" position="before">
<field name="production_type" widget="badge" decoration-warning="production_type == '人工线下加工'"
decoration-success="production_type == '自动化产线加工'" optional="show"/>
</xpath>
</xpath> -->
<xpath expr="//field[@name='activity_ids']" position="replace">
<field name="activity_ids" string="下一个活动" widget="list_activity" optional="hide"/>
</xpath>
@@ -91,7 +91,7 @@
</xpath>
<xpath expr="//sheet//group//group//div[3]" position="after">
<field name="production_type" readonly="1"/>
<!-- <field name="production_type" readonly="1"/> -->
<field name="manual_quotation" readonly="1"/>
<field name="programming_no" readonly="1"/>
<field name="programming_state" readonly="1"

View File

@@ -86,6 +86,8 @@ class ResConfigSettings(models.TransientModel):
_logger.info("同步刀具物料每齿走刀量完成")
self.env['sf.machining.accuracy'].sync_machining_accuracy_all()
_logger.info("同步加工精度完成")
self.env['sf.embryo.redundancy'].sync_embryo_redundancy_all()
_logger.info("同步坯料冗余完成")
except Exception as e:
_logger.info("sf_all_sync error: %s" % e)

View File

@@ -76,6 +76,8 @@ class MrStaticResourceDataSync(models.Model):
_logger.info("同步刀具物料每齿走刀量完成")
self.env['sf.machining.accuracy'].sync_machining_accuracy_all()
_logger.info("同步加工精度完成")
self.env['sf.embryo.redundancy'].sync_embryo_redundancy_all()
_logger.info("同步坯料冗余完成")
except Exception as e:
traceback_error = traceback.format_exc()
logging.error("同步静态资源库失败:%s" % traceback_error)
@@ -3149,7 +3151,7 @@ class MachiningAccuracySync(models.Model):
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
_logger.info('加工精度:%s' % result)
# _logger.info('加工精度:%s' % result)
if result['status'] == 1:
machining_accuracy_all_list = result['machining_accuracy_all_list']
# 获取同步的id集合
@@ -3168,3 +3170,40 @@ class MachiningAccuracySync(models.Model):
"name": time['name'],
"standard_tolerance": time['standard_tolerance'],
})
class EmbryoRedundancySync(models.Model):
_inherit = 'sf.embryo.redundancy'
_description = '坯料冗余'
url = '/api/embryo_redundancy/list'
def sync_embryo_redundancy_all(self):
config = self.env['res.config.settings'].get_values()
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
strUrl = config['sf_url'] + self.url
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
# _logger.info('加工精度:%s' % result)
if result['status'] == 1:
embryo_redundancy_all_list = result['embryo_redundancy_all_list']
# 获取同步的id集合
codes = [obj['code'] for obj in embryo_redundancy_all_list]
self.env['sf.embryo.redundancy'].sudo().search(
[('code', 'not in', codes)]).unlink()
for item in embryo_redundancy_all_list:
embryo_redundancy = self.env['sf.embryo.redundancy'].sudo().search(
[('code', '=', item['code'])])
if embryo_redundancy:
embryo_redundancy.name = item['name']
embryo_redundancy.code = item['code']
embryo_redundancy.long = item['long']
embryo_redundancy.width = item['width']
embryo_redundancy.height = item['height']
else:
self.env['sf.embryo.redundancy'].sudo().create({
"name": item['name'],
"code": item['code'],
"long": item['long'],
"width": item['width'],
"height": item['height'],
})

View File

@@ -417,12 +417,12 @@ class sf_production_plan(models.Model):
raise UserError(e)
# 增加制造订单类型
production_type = fields.Selection(
[('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
string='制造类型',
related='production_id.production_type',
store=True
)
# production_type = fields.Selection(
# [('自动化产线加工', '自动化产线加工'), ('人工线下加工', '人工线下加工')],
# string='制造类型',
# related='production_id.production_type',
# store=True
# )
# 机台作业计划

View File

@@ -22,7 +22,7 @@
<field name="production_line_id"/>
<field name="date_planned_start"/>
<field name="date_planned_finished"/>
<field name="production_type" widget="badge" decoration-warning="production_type == '人工线下加工'" decoration-success="production_type == '自动化产线加工'"/>
<!-- <field name="production_type" widget="badge" decoration-warning="production_type == '人工线下加工'" decoration-success="production_type == '自动化产线加工'"/> -->
<field name="actual_start_time" optional='hide'/>
<field name="actual_end_time" optional='hide'/>
<field name="actual_process_time" optional='hide'/>