坯料新增路线
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_id,
|
||||
item,
|
||||
order_id, 'self_machining', i)
|
||||
order_id, 'self_machining', i, product)
|
||||
# 创建坯料的bom
|
||||
self_machining_bom = request.env['mrp.bom'].with_user(
|
||||
request.env.ref("base.user_admin")).bom_create(
|
||||
@@ -78,7 +78,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
item,
|
||||
order_id,
|
||||
'subcontract',
|
||||
i)
|
||||
i, product)
|
||||
if outsource_embryo == -3:
|
||||
res['status'] = -3
|
||||
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,
|
||||
item,
|
||||
order_id,
|
||||
'purchase', i)
|
||||
'purchase', i,
|
||||
product)
|
||||
if purchase_embryo == -3:
|
||||
res['status'] = -3
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未设置获取方式和供应商,请先配置再进行分配'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<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="code">mrp.routing.workcenter</field>
|
||||
<field name="padding">4</field>
|
||||
@@ -74,12 +74,23 @@
|
||||
<field name="active">True</field>
|
||||
<field name="sequence">11</field>
|
||||
</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="action">push</field>-->
|
||||
<!-- <field name="pick_type_id" ref="outcontract_picking_out"></field>-->
|
||||
<!-- <field name="location_src_id" ref=""/>-->
|
||||
<!-- <field name="location_dest_id" ref="stock_location_locations_virtual_outcontract"/>-->
|
||||
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
|
||||
<!--<!– <field name="action">push</field>–>-->
|
||||
<!-- <field name="pick_type_id" ref="outcontract_picking_in"/>-->
|
||||
<!-- <!– <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="sequence">11</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
@@ -304,21 +304,21 @@ class MrpProduction(models.Model):
|
||||
'state': 'pending',
|
||||
}]
|
||||
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,并将所有生产订单的名称作为字符串传递
|
||||
if not production.programming_no:
|
||||
production_programming = self.search(
|
||||
[('product_id.id', '=', production.product_id.id), ('origin', '=', production.origin)],
|
||||
limit=1, order='id asc')
|
||||
logging.info('production_programming1:%s' % production_programming.programming_no)
|
||||
if not production_programming.programming_no:
|
||||
production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]))
|
||||
else:
|
||||
logging.info('production_programming2:%s' % production_programming.programming_no)
|
||||
production.write({'programming_no': production_programming.programming_no,
|
||||
'programming_state': '编程中'})
|
||||
# 根据加工面板的面数及对应的工序模板生成工单
|
||||
# if not production.programming_no:
|
||||
# production_programming = self.search(
|
||||
# [('product_id.id', '=', production.product_id.id), ('origin', '=', production.origin)],
|
||||
# limit=1, order='id asc')
|
||||
# logging.info('production_programming1:%s' % production_programming.programming_no)
|
||||
# if not production_programming.programming_no:
|
||||
# production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]))
|
||||
# else:
|
||||
# logging.info('production_programming2:%s' % production_programming.programming_no)
|
||||
# production.write({'programming_no': production_programming.programming_no,
|
||||
# 'programming_state': '编程中'})
|
||||
# # 根据加工面板的面数及对应的工序模板生成工单
|
||||
i = 0
|
||||
processing_panel_len = len(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文件下载到临时目录
|
||||
def download_file_tmp(self, production_no, 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 = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
||||
ftp_resconfig['ftp_password'])
|
||||
|
||||
@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
|
||||
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
@@ -660,8 +660,12 @@ class ResProductMo(models.Model):
|
||||
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()
|
||||
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
|
||||
materials_id = self.env['sf.production.materials'].search(
|
||||
[('materials_no', '=', item['texture_code'])])
|
||||
|
||||
@@ -37,14 +37,14 @@ class Sf_Mrs_Connect(http.Controller):
|
||||
# if ret['glb_file']:
|
||||
# cnc_production.glb_file = base64.b64encode(ret['glb_file'])
|
||||
# 拉取所有加工面的程序文件
|
||||
for r in ret['processing_panel']:
|
||||
download_state = request.env['sf.cnc.processing'].with_user(
|
||||
request.env.ref("base.user_admin")).download_file_tmp(
|
||||
ret['folder_name'], r)
|
||||
if download_state == 0:
|
||||
res['status'] = -2
|
||||
res['message'] = '制造订单号为%s的CNC程序文件从FTP拉取失败' % (cnc_production.name)
|
||||
return json.JSONEncoder().encode(res)
|
||||
# for r in ret['processing_panel']:
|
||||
# download_state = request.env['sf.cnc.processing'].with_user(
|
||||
# request.env.ref("base.user_admin")).download_file_tmp(
|
||||
# ret['folder_name'], r)
|
||||
# if download_state == 0:
|
||||
# res['status'] = -2
|
||||
# res['message'] = '制造订单号为%s的CNC程序文件从FTP拉取失败' % (cnc_production.name)
|
||||
# return json.JSONEncoder().encode(res)
|
||||
logging.info('创建cnc工单')
|
||||
program_path_tmp = os.path.join('/tmp', ret['folder_name'], 'return', r)
|
||||
# program_path_tmp = "C://Users//43484//Desktop//机企猫工作文档//其他//model_analysis"
|
||||
|
||||
@@ -8,8 +8,8 @@ from datetime import datetime
|
||||
import requests
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from odoo import models, fields, api
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
@@ -6,8 +6,8 @@ import os
|
||||
from datetime import datetime
|
||||
from stl import mesh
|
||||
# from OCC.Core.GProp import GProp_GProps
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo import models, fields, api
|
||||
from odoo.modules import get_resource_path
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<field name="inherit_id" ref="sale.view_quotation_tree_with_onboarding"/>
|
||||
<field name="arch" type="xml">
|
||||
<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>
|
||||
</tree>
|
||||
<field name="name" position="attributes">
|
||||
@@ -223,7 +223,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree position="attributes">
|
||||
<!-- <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>
|
||||
</tree>
|
||||
<field name="name" position="attributes">
|
||||
|
||||
Reference in New Issue
Block a user