坯料新增路线
This commit is contained in:
@@ -52,7 +52,7 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
self_machining_embryo = request.env['product.template'].sudo().no_bom_product_create(
|
self_machining_embryo = request.env['product.template'].sudo().no_bom_product_create(
|
||||||
self_machining_id,
|
self_machining_id,
|
||||||
item,
|
item,
|
||||||
order_id, 'self_machining', i)
|
order_id, 'self_machining', i, product)
|
||||||
# 创建坯料的bom
|
# 创建坯料的bom
|
||||||
self_machining_bom = request.env['mrp.bom'].with_user(
|
self_machining_bom = request.env['mrp.bom'].with_user(
|
||||||
request.env.ref("base.user_admin")).bom_create(
|
request.env.ref("base.user_admin")).bom_create(
|
||||||
@@ -78,7 +78,7 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
item,
|
item,
|
||||||
order_id,
|
order_id,
|
||||||
'subcontract',
|
'subcontract',
|
||||||
i)
|
i, product)
|
||||||
if outsource_embryo == -3:
|
if outsource_embryo == -3:
|
||||||
res['status'] = -3
|
res['status'] = -3
|
||||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||||
@@ -105,7 +105,8 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
purchase_embryo = request.env['product.template'].sudo().no_bom_product_create(purchase_id,
|
purchase_embryo = request.env['product.template'].sudo().no_bom_product_create(purchase_id,
|
||||||
item,
|
item,
|
||||||
order_id,
|
order_id,
|
||||||
'purchase', i)
|
'purchase', i,
|
||||||
|
product)
|
||||||
if purchase_embryo == -3:
|
if purchase_embryo == -3:
|
||||||
res['status'] = -3
|
res['status'] = -3
|
||||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<record id="sequence_routing_workcenter" model="ir.sequence">
|
<record id="sequence_routing_workcenter" model="ir.sequence">
|
||||||
<field name="name">工序编码规则</field>
|
<field name="name">工序编码规则</field>
|
||||||
<field name="code">mrp.routing.workcenter</field>
|
<field name="code">mrp.routing.workcenter</field>
|
||||||
<field name="padding">4</field>
|
<field name="padding">4</field>
|
||||||
@@ -74,12 +74,23 @@
|
|||||||
<field name="active">True</field>
|
<field name="active">True</field>
|
||||||
<field name="sequence">11</field>
|
<field name="sequence">11</field>
|
||||||
</record>
|
</record>
|
||||||
<!-- <record id="route_surface_technology_outsourcing" model="stock.rule">-->
|
<!-- <record id="rule_surface_technology_in" model="stock.rule">-->
|
||||||
<!-- <field name="name">外协出库单</field>-->
|
<!-- <field name="name">外协出库单</field>-->
|
||||||
<!-- <field name="action">push</field>-->
|
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
|
||||||
<!-- <field name="pick_type_id" ref="outcontract_picking_out"></field>-->
|
<!--<!– <field name="action">push</field>–>-->
|
||||||
<!-- <field name="location_src_id" ref=""/>-->
|
<!-- <field name="pick_type_id" ref="outcontract_picking_in"/>-->
|
||||||
<!-- <field name="location_dest_id" ref="stock_location_locations_virtual_outcontract"/>-->
|
<!-- <!– <field name="location_src_id" search="[('barcode','=','WH-PREPRODUCTION')]"/>–>-->
|
||||||
|
<!-- <!– <field name="location_dest_id" ref="stock_location_locations_virtual_outcontract"/>–>-->
|
||||||
|
<!-- <!– <field name="active">True</field>–>-->
|
||||||
|
<!-- <!– <field name="sequence">11</field>–>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
<!-- <record id="rule_surface_technology_in" model="stock.rule">-->
|
||||||
|
<!-- <field name="name">外协入库单</field>-->
|
||||||
|
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
|
||||||
|
<!-- <field name="action">pull</field>-->
|
||||||
|
<!-- <field name="pick_type_id" ref="outcontract_picking_out"/>-->
|
||||||
|
<!-- <field name="location_src_id" ref="stock_location_locations_virtual_outcontract"/>-->
|
||||||
|
<!-- <field name="location_dest_id" search="[('barcode','=','WH-PREPRODUCTION')]"/>-->
|
||||||
<!-- <field name="active">True</field>-->
|
<!-- <field name="active">True</field>-->
|
||||||
<!-- <field name="sequence">11</field>-->
|
<!-- <field name="sequence">11</field>-->
|
||||||
<!-- </record>-->
|
<!-- </record>-->
|
||||||
|
|||||||
@@ -304,21 +304,21 @@ class MrpProduction(models.Model):
|
|||||||
'state': 'pending',
|
'state': 'pending',
|
||||||
}]
|
}]
|
||||||
if production.product_id.categ_id.type == '成品':
|
if production.product_id.categ_id.type == '成品':
|
||||||
if production.product_id.id in product_id_to_production_names:
|
# if production.product_id.id in product_id_to_production_names:
|
||||||
# 同一个产品多个制造订单对应一个编程单和模型库
|
# 同一个产品多个制造订单对应一个编程单和模型库
|
||||||
# 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递
|
# 只调用一次fetchCNC,并将所有生产订单的名称作为字符串传递
|
||||||
if not production.programming_no:
|
# if not production.programming_no:
|
||||||
production_programming = self.search(
|
# production_programming = self.search(
|
||||||
[('product_id.id', '=', production.product_id.id), ('origin', '=', production.origin)],
|
# [('product_id.id', '=', production.product_id.id), ('origin', '=', production.origin)],
|
||||||
limit=1, order='id asc')
|
# limit=1, order='id asc')
|
||||||
logging.info('production_programming1:%s' % production_programming.programming_no)
|
# logging.info('production_programming1:%s' % production_programming.programming_no)
|
||||||
if not production_programming.programming_no:
|
# if not production_programming.programming_no:
|
||||||
production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]))
|
# production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]))
|
||||||
else:
|
# else:
|
||||||
logging.info('production_programming2:%s' % production_programming.programming_no)
|
# logging.info('production_programming2:%s' % production_programming.programming_no)
|
||||||
production.write({'programming_no': production_programming.programming_no,
|
# production.write({'programming_no': production_programming.programming_no,
|
||||||
'programming_state': '编程中'})
|
# 'programming_state': '编程中'})
|
||||||
# 根据加工面板的面数及对应的工序模板生成工单
|
# # 根据加工面板的面数及对应的工序模板生成工单
|
||||||
i = 0
|
i = 0
|
||||||
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
processing_panel_len = len(production.product_id.model_processing_panel.split(','))
|
||||||
for k in (production.product_id.model_processing_panel.split(',')):
|
for k in (production.product_id.model_processing_panel.split(',')):
|
||||||
|
|||||||
@@ -1040,6 +1040,7 @@ class CNCprocessing(models.Model):
|
|||||||
# 将FTP的nc文件下载到临时目录
|
# 将FTP的nc文件下载到临时目录
|
||||||
def download_file_tmp(self, production_no, processing_panel):
|
def download_file_tmp(self, production_no, processing_panel):
|
||||||
remotepath = os.path.join('/NC', production_no, 'return', processing_panel)
|
remotepath = os.path.join('/NC', production_no, 'return', processing_panel)
|
||||||
|
serverdir = os.path.join('/tmp', production_no, 'return', processing_panel)
|
||||||
ftp_resconfig = self.env['res.config.settings'].get_values()
|
ftp_resconfig = self.env['res.config.settings'].get_values()
|
||||||
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
||||||
ftp_resconfig['ftp_password'])
|
ftp_resconfig['ftp_password'])
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError
|
|||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|
||||||
|
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
@@ -660,8 +660,12 @@ class ResProductMo(models.Model):
|
|||||||
return attachment
|
return attachment
|
||||||
|
|
||||||
# 创建坯料
|
# 创建坯料
|
||||||
def no_bom_product_create(self, product_id, item, order_id, route_type, i):
|
def no_bom_product_create(self, product_id, item, order_id, route_type, i, finish_product):
|
||||||
no_bom_copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
|
no_bom_copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
|
||||||
|
if finish_product.model_process_parameters_ids:
|
||||||
|
surface_technology = self.env['stock.rule'].sudo().search([('name', '=', '表面工艺外协')])
|
||||||
|
if surface_technology:
|
||||||
|
no_bom_copy_product_id.route_ids |= surface_technology
|
||||||
no_bom_copy_product_id.product_tmpl_id.active = True
|
no_bom_copy_product_id.product_tmpl_id.active = True
|
||||||
materials_id = self.env['sf.production.materials'].search(
|
materials_id = self.env['sf.production.materials'].search(
|
||||||
[('materials_no', '=', item['texture_code'])])
|
[('materials_no', '=', item['texture_code'])])
|
||||||
|
|||||||
@@ -37,14 +37,14 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
# if ret['glb_file']:
|
# if ret['glb_file']:
|
||||||
# cnc_production.glb_file = base64.b64encode(ret['glb_file'])
|
# cnc_production.glb_file = base64.b64encode(ret['glb_file'])
|
||||||
# 拉取所有加工面的程序文件
|
# 拉取所有加工面的程序文件
|
||||||
for r in ret['processing_panel']:
|
# for r in ret['processing_panel']:
|
||||||
download_state = request.env['sf.cnc.processing'].with_user(
|
# download_state = request.env['sf.cnc.processing'].with_user(
|
||||||
request.env.ref("base.user_admin")).download_file_tmp(
|
# request.env.ref("base.user_admin")).download_file_tmp(
|
||||||
ret['folder_name'], r)
|
# ret['folder_name'], r)
|
||||||
if download_state == 0:
|
# if download_state == 0:
|
||||||
res['status'] = -2
|
# res['status'] = -2
|
||||||
res['message'] = '制造订单号为%s的CNC程序文件从FTP拉取失败' % (cnc_production.name)
|
# res['message'] = '制造订单号为%s的CNC程序文件从FTP拉取失败' % (cnc_production.name)
|
||||||
return json.JSONEncoder().encode(res)
|
# return json.JSONEncoder().encode(res)
|
||||||
logging.info('创建cnc工单')
|
logging.info('创建cnc工单')
|
||||||
program_path_tmp = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
program_path_tmp = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
||||||
# program_path_tmp = "C://Users//43484//Desktop//机企猫工作文档//其他//model_analysis"
|
# program_path_tmp = "C://Users//43484//Desktop//机企猫工作文档//其他//model_analysis"
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from stl import mesh
|
from stl import mesh
|
||||||
# from OCC.Core.GProp import GProp_GProps
|
# from OCC.Core.GProp import GProp_GProps
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|||||||
@@ -198,7 +198,7 @@
|
|||||||
<field name="inherit_id" ref="sale.view_quotation_tree_with_onboarding"/>
|
<field name="inherit_id" ref="sale.view_quotation_tree_with_onboarding"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree position="attributes">
|
<tree position="attributes">
|
||||||
<attribute name="default_order">check_status desc,create_date asc</attribute>
|
<attribute name="default_order">create_date desc</attribute>
|
||||||
<attribute name="delete">False</attribute>
|
<attribute name="delete">False</attribute>
|
||||||
</tree>
|
</tree>
|
||||||
<field name="name" position="attributes">
|
<field name="name" position="attributes">
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree position="attributes">
|
<tree position="attributes">
|
||||||
<!-- <attribute name="default_order">schedule_status desc,date_order asc</attribute> -->
|
<!-- <attribute name="default_order">schedule_status desc,date_order asc</attribute> -->
|
||||||
<attribute name="default_order">date_order asc</attribute>
|
<attribute name="default_order">create_date desc</attribute>
|
||||||
<attribute name="create">False</attribute>
|
<attribute name="create">False</attribute>
|
||||||
</tree>
|
</tree>
|
||||||
<field name="name" position="attributes">
|
<field name="name" position="attributes">
|
||||||
|
|||||||
Reference in New Issue
Block a user