1.修复工件配送向导制造订单号能显示5个
2工件配送向导页面优化 3.生成制造订单同时工件配送默认路线
This commit is contained in:
@@ -493,9 +493,15 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
return workorders_values_str
|
return workorders_values_str
|
||||||
|
|
||||||
def _json_workpiece_delivery_list(self, production):
|
def _json_workpiece_delivery_list(self, production):
|
||||||
|
up_route = self.env['sf.agv.task.route'].search([('route_type', '=', '上产线')], limit=1, order='id asc')
|
||||||
|
down_route = self.env['sf.agv.task.route'].search([('route_type', '=', '下产线')], limit=1, order='id asc')
|
||||||
return [
|
return [
|
||||||
[0, '', {'production_id': production.id, 'type': '上产线'}],
|
[0, '', {'production_id': production.id, 'type': '上产线', 'route_id': up_route.id,
|
||||||
[0, '', {'production_id': production.id, 'type': '下产线'}]]
|
'feeder_station_start_id': up_route.start_site_id.id,
|
||||||
|
'feeder_station_destination_id': up_route.end_site_id.id}],
|
||||||
|
[0, '', {'production_id': production.id, 'type': '下产线', 'route_id': down_route.id,
|
||||||
|
'feeder_station_start_id': down_route.start_site_id.id,
|
||||||
|
'feeder_station_destination_id': down_route.end_site_id.id}]]
|
||||||
|
|
||||||
# 拼接工单对象属性值(表面工艺)
|
# 拼接工单对象属性值(表面工艺)
|
||||||
def _json_workorder_surface_process_str(self, production, route, process_parameter, supplier_id):
|
def _json_workorder_surface_process_str(self, production, route, process_parameter, supplier_id):
|
||||||
@@ -745,12 +751,12 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
limit=1, order='id asc')
|
limit=1, order='id asc')
|
||||||
if not cnc_workorder:
|
if not cnc_workorder:
|
||||||
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
||||||
# else:
|
else:
|
||||||
# for item in cnc_workorder.cnc_ids:
|
for item in cnc_workorder.cnc_ids:
|
||||||
# functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||||
# [('tool_name_id.name', '=', item.cutting_tool_name)])
|
[('tool_name_id.name', '=', item.cutting_tool_name)])
|
||||||
# if not functional_cutting_tool:
|
if not functional_cutting_tool:
|
||||||
# raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
|
raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
|
||||||
if self.routing_type == '解除装夹':
|
if self.routing_type == '解除装夹':
|
||||||
'''
|
'''
|
||||||
记录开始时间
|
记录开始时间
|
||||||
@@ -827,6 +833,13 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||||
if not record.rfid_code:
|
if not record.rfid_code:
|
||||||
raise UserError("请扫RFID码进行绑定")
|
raise UserError("请扫RFID码进行绑定")
|
||||||
|
record.process_state = '待加工'
|
||||||
|
# record.write({'process_state': '待加工'})
|
||||||
|
record.production_id.process_state = '待加工'
|
||||||
|
if record.routing_type == 'CNC加工':
|
||||||
|
record.process_state = '待解除装夹'
|
||||||
|
# record.write({'process_state': '待加工'})
|
||||||
|
record.production_id.process_state = '待解除装夹'
|
||||||
if record.routing_type == '解除装夹':
|
if record.routing_type == '解除装夹':
|
||||||
'''
|
'''
|
||||||
记录结束时间
|
记录结束时间
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import os
|
|||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import ValidationError
|
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 write_stl_file
|
|
||||||
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
@@ -179,6 +181,12 @@ class ResProductMo(models.Model):
|
|||||||
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
# def name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||||
|
# # if self._context.get('is_sale_order_line'):
|
||||||
|
# # domain = [('sale_ok', '=', True), ('categ_type', '=', '成品')]
|
||||||
|
# # return self._search(expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid)
|
||||||
|
# return super(product.template, self)._name_search(name, args, operator, limit, name_get_uid)
|
||||||
|
|
||||||
@api.onchange('specification_id')
|
@api.onchange('specification_id')
|
||||||
def _onchange_specification(self):
|
def _onchange_specification(self):
|
||||||
if self.specification_id:
|
if self.specification_id:
|
||||||
|
|||||||
@@ -607,12 +607,14 @@
|
|||||||
decoration-danger="status == '待配送'"/>
|
decoration-danger="status == '待配送'"/>
|
||||||
<field name="production_id"/>
|
<field name="production_id"/>
|
||||||
<field name="type" readonly="1"/>
|
<field name="type" readonly="1"/>
|
||||||
<field name="production_line_id" options="{'no_create': True}"/>
|
<field name="production_line_id" options="{'no_create': True}" readonly="1"/>
|
||||||
<field name="route_id" options="{'no_create': True}" domain="[('type','in',['上产线','下产线'])]"/>
|
<field name="route_id" options="{'no_create': True}"
|
||||||
|
domain="[('route_type','in',['上产线','下产线'])]"/>
|
||||||
|
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
||||||
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_start_id" readonly="1" force_save="1"/>
|
||||||
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
<field name="feeder_station_destination_id" readonly="1" force_save="1"/>
|
||||||
<field name="is_cnc_program_down" readonly="1"/>
|
<field name="is_cnc_program_down" readonly="1"/>
|
||||||
<!-- <field name="rfid_code"/>-->
|
<!-- <field name="rfid_code"/>-->
|
||||||
<field name="task_delivery_time" readonly="1"/>
|
<field name="task_delivery_time" readonly="1"/>
|
||||||
<field name="task_completion_time" readonly="1"/>
|
<field name="task_completion_time" readonly="1"/>
|
||||||
<field name="delivery_duration" widget="float_time"/>
|
<field name="delivery_duration" widget="float_time"/>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Part of YiZuo. See LICENSE file for full copyright and licensing details.
|
# Part of YiZuo. See LICENSE file for full copyright and licensing details.
|
||||||
|
import logging
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from odoo import models, api, fields, _
|
from odoo import models, api, fields, _
|
||||||
@@ -44,7 +45,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
|
|||||||
def recognize_production(self):
|
def recognize_production(self):
|
||||||
# production_ids = []
|
# production_ids = []
|
||||||
# delivery_ids = []
|
# delivery_ids = []
|
||||||
if len(self.production_ids) > 4:
|
# aa = self.production_ids.workorder_ids.filtered(
|
||||||
|
# lambda b: b.routing_type == "装夹预调").workpiece_delivery_ids.filtered(
|
||||||
|
# lambda c: c.rfid_code == self.rfid_code)
|
||||||
|
# logging.info('aa:%s' % aa)
|
||||||
|
if len(self.production_ids) == 4:
|
||||||
raise UserError('只能配送四个制造订单')
|
raise UserError('只能配送四个制造订单')
|
||||||
else:
|
else:
|
||||||
if self.rfid_code:
|
if self.rfid_code:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from odoo.http import request
|
|||||||
|
|
||||||
class Sf_Mrs_Connect(http.Controller):
|
class Sf_Mrs_Connect(http.Controller):
|
||||||
|
|
||||||
@http.route('/api/cnc_processing/create', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
@http.route('/api/cnc_processing/create', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||||
cors="*")
|
cors="*")
|
||||||
def get_cnc_processing_create(self, **kw):
|
def get_cnc_processing_create(self, **kw):
|
||||||
"""
|
"""
|
||||||
@@ -27,28 +27,25 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
# 查询状态为进行中且类型为获取CNC加工程序的工单
|
# 查询状态为进行中且类型为获取CNC加工程序的工单
|
||||||
cnc_production = request.env['mrp.production'].with_user(
|
cnc_production = request.env['mrp.production'].with_user(
|
||||||
request.env.ref("base.user_admin")).search([('name', '=', ret['production_order_no'])])
|
request.env.ref("base.user_admin")).search([('name', '=', ret['production_order_no'])])
|
||||||
cnc_program = request.env['mrp.production'].with_user(
|
|
||||||
request.env.ref("base.user_admin")).search([('programming_no', '=', cnc_production.programming_no)])
|
|
||||||
logging.info('制造订单号:%s' % cnc_production.name)
|
logging.info('制造订单号:%s' % cnc_production.name)
|
||||||
if cnc_production:
|
if cnc_production:
|
||||||
# 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'])
|
||||||
# 拉取所有加工面的程序文件
|
# 拉取所有加工面的程序文件
|
||||||
i = 1
|
# i = 1
|
||||||
#
|
|
||||||
# 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"
|
||||||
files = os.listdir(program_path_tmp)
|
files = os.listdir(program_path_tmp)
|
||||||
cnc_processing_arr = []
|
|
||||||
for f in files:
|
for f in files:
|
||||||
program_path = os.path.join(program_path_tmp, f)
|
program_path = os.path.join(program_path_tmp, f)
|
||||||
logging.info('cnc程序路径 :%s' % program_path)
|
logging.info('cnc程序路径 :%s' % program_path)
|
||||||
@@ -56,15 +53,9 @@ class Sf_Mrs_Connect(http.Controller):
|
|||||||
# 插入cmm程序数据
|
# 插入cmm程序数据
|
||||||
request.env['sf.cmm.program'].with_user(
|
request.env['sf.cmm.program'].with_user(
|
||||||
request.env.ref("base.user_admin")).cmm_program_create(ret, program_path, program_path_tmp)
|
request.env.ref("base.user_admin")).cmm_program_create(ret, program_path, program_path_tmp)
|
||||||
cnc_processing = request.env['sf.cnc.processing'].with_user(
|
request.env['sf.cnc.processing'].with_user(
|
||||||
request.env.ref("base.user_admin")).cnc_processing_create(cnc_production, ret, program_path,
|
request.env.ref("base.user_admin")).cnc_processing_create(cnc_production, ret, program_path,
|
||||||
program_path_tmp)
|
program_path_tmp)
|
||||||
if cnc_processing:
|
|
||||||
cnc_processing_arr.append(cnc_processing._json_cnc_processing(cnc_processing))
|
|
||||||
if cnc_program and cnc_processing_arr:
|
|
||||||
cnc_program.write({'programming_state': '已编程', 'work_state': '已编程'})
|
|
||||||
cnc_program.workorder_ids.filtered(lambda b: b.routing_type == 'CNC加工').write(
|
|
||||||
{'cnc_ids': cnc_processing_arr})
|
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
else:
|
else:
|
||||||
res = {'status': 0, 'message': '该制造订单暂未开始'}
|
res = {'status': 0, 'message': '该制造订单暂未开始'}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ class ReSaleOrder(models.Model):
|
|||||||
self.check_status = 'pending'
|
self.check_status = 'pending'
|
||||||
|
|
||||||
def get_customer(self):
|
def get_customer(self):
|
||||||
partner_tag = self.env['res.partner.category'].sudo().search([('name', '=', '业务平台')], limit=1, order='id asc')
|
partner_tag = self.env['res.partner.category'].sudo().search([('name', '=', '业务平台')], limit=1,
|
||||||
|
order='id asc')
|
||||||
if not partner_tag:
|
if not partner_tag:
|
||||||
partner_tag = self.env['res.partner.category'].sudo().create({'name': '平台客户'})
|
partner_tag = self.env['res.partner.category'].sudo().create({'name': '平台客户'})
|
||||||
customer = self.env['res.partner'].search([('name', '=', '业务平台')], limit=1, order='id asc')
|
customer = self.env['res.partner'].search([('name', '=', '业务平台')], limit=1, order='id asc')
|
||||||
@@ -139,9 +140,19 @@ class ResaleOrderLine(models.Model):
|
|||||||
_inherit = 'sale.order.line'
|
_inherit = 'sale.order.line'
|
||||||
|
|
||||||
model_glb_file = fields.Binary('模型的glb文件')
|
model_glb_file = fields.Binary('模型的glb文件')
|
||||||
|
# product_template_id = fields.Many2one(
|
||||||
|
# string="产品",
|
||||||
|
# comodel_name='product.template',
|
||||||
|
# compute='_compute_product_template_id',
|
||||||
|
# readonly=False,
|
||||||
|
# search='_search_product_template_id',
|
||||||
|
# # previously related='product_id.product_tmpl_id'
|
||||||
|
# # not anymore since the field must be considered editable for product configurator logic
|
||||||
|
# # without modifying the related product_id when updated.
|
||||||
|
# domain=[('sale_ok', '=', True), ('categ_type', '=', '成品')])
|
||||||
check_status = fields.Selection(related='order_id.check_status')
|
check_status = fields.Selection(related='order_id.check_status')
|
||||||
|
|
||||||
@api.onchange('product_id')
|
@api.onchange('product_template_id')
|
||||||
def _compute_model_glb_file(self):
|
def _compute_model_glb_file(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
if line.product_template_id:
|
if line.product_template_id:
|
||||||
|
|||||||
@@ -117,6 +117,10 @@
|
|||||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
|
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
|
||||||
<field name="model_glb_file" widget="Viewer3D" optional="show"
|
<field name="model_glb_file" widget="Viewer3D" optional="show"
|
||||||
string="模型文件" attrs="{'readonly': [('state', 'in', ['draft'])]}"/>
|
string="模型文件" attrs="{'readonly': [('state', 'in', ['draft'])]}"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="attributes">
|
||||||
|
<attribute name="options">{'no_create': True}</attribute>
|
||||||
|
<attribute name="context">{'is_sale_order_line': True }</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='order_line']" position="attributes">
|
<xpath expr="//field[@name='order_line']" position="attributes">
|
||||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||||
|
|||||||
Reference in New Issue
Block a user