优化odoo16工单视图展示问题
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 基础模块',
|
||||
'name': '机企猫智能工厂 基础配置',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂基础模块',
|
||||
'sequence': 1,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 连接业务平台模块',
|
||||
'name': '机企猫智能工厂 对接业务平台',
|
||||
'version': '1.0',
|
||||
'summary': '连接业务平台模块',
|
||||
'sequence': 1,
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.cs.jikimo.com',
|
||||
'depends': ['sf_base'],
|
||||
'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
|
||||
'data': [
|
||||
|
||||
],
|
||||
|
||||
@@ -8,7 +8,7 @@ from odoo.http import request
|
||||
|
||||
class Sf_Bf_Connect(http.Controller):
|
||||
|
||||
@http.route('/api/bfm_process_order/list', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||
@http.route('/api/bfm_process_order/list', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_bfm_process_order_list(self, **kw):
|
||||
"""
|
||||
@@ -24,7 +24,9 @@ class Sf_Bf_Connect(http.Controller):
|
||||
ret = json.loads(ret['result'])
|
||||
product_id = request.env.ref('sf_dlm.product_template_sf').sudo()
|
||||
company_id = request.env.ref('base.main_company').sudo()
|
||||
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(ret['delivery_end_date'], company_id)
|
||||
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
|
||||
company_id, ret['delivery_name'], ret['delivery_telephone'], ret['delivery_address'],
|
||||
ret['delivery_end_date'])
|
||||
i = 1
|
||||
for item in ret['bfm_process_order_list']:
|
||||
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
|
||||
|
||||
@@ -4,12 +4,14 @@ import datetime
|
||||
import time
|
||||
import hashlib
|
||||
from odoo import fields, models, api
|
||||
from odoo.http import request, AuthenticationError
|
||||
from odoo.http import request
|
||||
|
||||
__author__ = 'jinling.yang'
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class AuthenticationError(Exception):
|
||||
pass
|
||||
|
||||
class Http(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
@@ -23,6 +25,7 @@ class Http(models.AbstractModel):
|
||||
# 查询密钥
|
||||
factory_secret = request.env['res.partner'].sudo().search(
|
||||
[('sf_token', '=', datas['HTTP_TOKEN'])], limit=1)
|
||||
logging.info('factory_secret:%s' % factory_secret)
|
||||
if not factory_secret:
|
||||
raise AuthenticationError('无效的token')
|
||||
timestamp_str = int(time.time())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 产品模块',
|
||||
'name': '机企猫智能工厂 产品管理',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂产品模块',
|
||||
'sequence': 1,
|
||||
@@ -12,7 +12,7 @@
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['mrp', 'base', 'sf_manufacturing'],
|
||||
'data': [
|
||||
# 'data/product_data.xml',
|
||||
'data/product_data.xml',
|
||||
'views/product_template_view.xml'
|
||||
],
|
||||
'demo': [
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<data noupdate="1">
|
||||
<record id="product_template_sf" model="product.product">
|
||||
<field name="name">CNC加工产品模板</field>
|
||||
<field name="categ_id" ref="product.product_category_5"/>
|
||||
<!-- <field name="categ_id" ref="product.product_category_5"/>-->
|
||||
<field name="invoice_policy">delivery</field>
|
||||
<field name="detailed_type">product</field>
|
||||
<field name="purchase_ok">false</field>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
import logging
|
||||
|
||||
|
||||
class ResProductTemplate(models.Model):
|
||||
@@ -9,7 +10,7 @@ class ResProductTemplate(models.Model):
|
||||
model_long = fields.Float('模型长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('模型宽[mm]', digits=(16, 3))
|
||||
model_height = fields.Float('模型高[mm]', digits=(16, 3))
|
||||
model_volume = fields.Float('模型体积[mm]', compute='_compute_model_volume', store=True)
|
||||
model_volume = fields.Float('模型体积[m³]')
|
||||
model_machining_precision = fields.Selection([
|
||||
('±0.10mm', '±0.10mm'),
|
||||
('±0.05mm', '±0.05mm'),
|
||||
@@ -22,35 +23,38 @@ class ResProductTemplate(models.Model):
|
||||
model_process_parameters_id = fields.Many2one('sf.processing.technology', string='工艺参数')
|
||||
model_price = fields.Float('模型单价', digits=(16, 3))
|
||||
model_remark = fields.Char('模型备注说明')
|
||||
long = fields.Float('长[mm]', digits=(16, 3))
|
||||
length = fields.Float('长[mm]', digits=(16, 3))
|
||||
width = fields.Float('宽[mm]', digits=(16, 3))
|
||||
height = fields.Float('高[mm]', digits=(16, 3))
|
||||
materials_id = fields.Many2one('sf.production.materials', string='材料')
|
||||
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
|
||||
volume = fields.Float(compute='_compute_volume', store=True)
|
||||
# volume = fields.Float(compute='_compute_volume', store=True)
|
||||
single_manufacturing = fields.Boolean(string="单个制造")
|
||||
|
||||
@api.depends('long', 'width', 'height')
|
||||
def _compute_volume(self):
|
||||
self.volume = self.long * self.width * self.height
|
||||
# @api.depends('long', 'width', 'height')
|
||||
# def _compute_volume(self):
|
||||
# self.volume = self.long * self.width * self.height
|
||||
|
||||
@api.depends('model_long', 'model_width', 'model_height')
|
||||
def _compute_model_volume(self):
|
||||
self.model_volume = self.model_long * self.model_width * self.model_height
|
||||
# @api.depends('model_long', 'model_width', 'model_height')
|
||||
# def _compute_model_volume(self):
|
||||
# self.model_volume = self.model_long * self.model_width * self.model_height
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
|
||||
def product_create(self, product_id, item, order_id, order_number, i):
|
||||
copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
|
||||
copy_product_id.product_tmpl_id.active = True
|
||||
logging.info('product_create:%s' % item)
|
||||
vals = {
|
||||
'name': '%s-%s' % (order_id.name, i),
|
||||
'model_long': item['model_long'],
|
||||
'model_width': item['model_width'],
|
||||
'model_height': item['model_height'],
|
||||
'model_volume': item['model_volume'],
|
||||
'length': item['long'],
|
||||
'width': item['width'],
|
||||
'height': item['height'],
|
||||
'volume': item['long'] * item['width'] * item['height'],
|
||||
'model_price': item['price'],
|
||||
'model_total_amount': item['total_amount'],
|
||||
'model_number': item['number'],
|
||||
'single_manufacturing': True,
|
||||
'list_price': item['price'],
|
||||
'materials_id': self.env['sf.production.materials'].search(
|
||||
[('materials_no', '=', item['texture_code'])]).id,
|
||||
@@ -65,6 +69,7 @@ class ResProductTemplate(models.Model):
|
||||
'barcode': item['barcode'],
|
||||
'active': True
|
||||
}
|
||||
logging.info('product_create1:%s' % item)
|
||||
copy_product_id.sudo().write(vals)
|
||||
return copy_product_id
|
||||
|
||||
@@ -109,21 +114,16 @@ class ResMrpBom(models.Model):
|
||||
# 三、胚料的长宽高均要大于模型的长宽高;
|
||||
# 四、如果匹配成功多个胚料,则选取体积最小的胚料;
|
||||
def bom_create_Line(self, product):
|
||||
logging.info('bom_create_Line:%s' % product)
|
||||
embryo = self.env['product.product'].search(
|
||||
[('categ_id.is_embryo', '=', True), ('materials_type_id', '=', product.materials_type_id.id),
|
||||
('long', '>', product.long), ('width', '>', product.width),
|
||||
('length', '>', product.length), ('width', '>', product.width),
|
||||
('height', '>', product.height)
|
||||
],
|
||||
limit=1,
|
||||
order='volume desc'
|
||||
)
|
||||
vals = {
|
||||
'bom_id': self.id,
|
||||
'product_id': embryo.id,
|
||||
'product_tmpl_id': embryo.product_tmpl_id.id,
|
||||
'product_qty': 1,
|
||||
'product_uom_id': 1
|
||||
}
|
||||
logging.info('bom_create_Line1:%s' % product)
|
||||
return self.env['mrp.bom.line'].create(vals)
|
||||
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
</field>
|
||||
|
||||
<xpath expr="//label[@for='volume']" position="before">
|
||||
<label for="long" string="尺寸"
|
||||
<label for="length" string="尺寸"
|
||||
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">
|
||||
<label for="long" string="长"/>
|
||||
<field name="long" class="o_address_zip"/>
|
||||
<label for="length" string="长"/>
|
||||
<field name="length" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="width" string="宽"/>
|
||||
<field name="width" class="o_address_zip"/>
|
||||
@@ -34,7 +34,7 @@
|
||||
<field name="model_long" string="长[mm]"/>
|
||||
<field name="model_width" string="宽[mm]"/>
|
||||
<field name="model_height" string="高[mm]"/>
|
||||
<field name="model_volume" string="体积[mm]"/>
|
||||
<field name="model_volume" string="体积[m³]"/>
|
||||
<field name="model_type_id" string="模型类型"/>
|
||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"/>
|
||||
<field name="model_machining_precision" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 制造模块',
|
||||
'name': '机企猫智能工厂 制造管理',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂制造模块',
|
||||
'sequence': 1,
|
||||
|
||||
@@ -51,10 +51,10 @@ class MrpProduction(models.Model):
|
||||
|
||||
def action_generate_serial(self):
|
||||
self.ensure_one()
|
||||
self.lot_producing_id = self.env['stock.production.lot'].create({
|
||||
self.lot_producing_id = self.env['stock.lot'].create({
|
||||
'product_id': self.product_id.id,
|
||||
'company_id': self.company_id.id,
|
||||
'name': self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
|
||||
'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
|
||||
'ir.sequence'].next_by_code('stock.lot.serial'),
|
||||
})
|
||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||
|
||||
@@ -4,6 +4,7 @@ import math
|
||||
import requests
|
||||
import logging
|
||||
import base64
|
||||
# import subprocess
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
@@ -13,7 +14,6 @@ from odoo.exceptions import UserError
|
||||
from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
|
||||
|
||||
|
||||
|
||||
class ResMrpWorkOrder(models.Model):
|
||||
_inherit = 'mrp.workorder'
|
||||
_order = 'sequence'
|
||||
@@ -29,6 +29,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
('后置三元质量检测', '后置三元质量检测'),
|
||||
('解除装夹', '解除装夹'),
|
||||
], string="工序类型")
|
||||
cnc_worksheet = fields.Binary(
|
||||
'工作指令', readonly=True)
|
||||
material_center_point = fields.Char(string='配料中心点')
|
||||
X1_axis = fields.Float(default=0)
|
||||
Y1_axis = fields.Float(default=0)
|
||||
@@ -61,7 +63,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
Y10_axis = fields.Float(default=0)
|
||||
Z10_axis = fields.Float(default=0)
|
||||
X_deviation_angle = fields.Integer(string="X轴偏差度", default=0)
|
||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果")
|
||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
|
||||
string="检测结果")
|
||||
cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工")
|
||||
tray_code = fields.Char(string="托盘")
|
||||
|
||||
@@ -337,12 +340,12 @@ class CNCprocessing(models.Model):
|
||||
depth_of_processing_z = fields.Char('加工深度(Z)')
|
||||
cutting_tool_extension_length = fields.Char('刀具伸出长度')
|
||||
cutting_tool_handle_type = fields.Char('刀柄型号')
|
||||
estimated_processing_time = fields.Char('预计加工时间')
|
||||
estimated_processing_time = fields.Datetime('预计加工时间')
|
||||
remark = fields.Text('备注')
|
||||
workorder_id = fields.Many2one('mrp.workorder', string="工单")
|
||||
|
||||
# mrs下发编程单创建CNC加工
|
||||
def CNCprocessing_create(self, obj):
|
||||
def cnc_processing_create(self, obj):
|
||||
workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['manufacturing_order_no']),
|
||||
('processing_panel', '=', obj['processing_panel']),
|
||||
('routing_type', '=', 'CNC加工')])
|
||||
@@ -363,6 +366,7 @@ class CNCprocessing(models.Model):
|
||||
}
|
||||
return self.env['sf.cnc.processing'].create(vals)
|
||||
|
||||
# 创建附件(nc文件)
|
||||
def attachment_create(self, name, data):
|
||||
attachment = self.env['ir.attachment'].create({
|
||||
'datas': base64.b64encode(data),
|
||||
@@ -372,6 +376,7 @@ class CNCprocessing(models.Model):
|
||||
})
|
||||
return attachment
|
||||
|
||||
# 将FTP的nc文件下载到临时目录
|
||||
def download_file_tmp(self, model_code, processing_panel):
|
||||
remotepath = os.path.join('/', model_code, 'return', processing_panel)
|
||||
serverdir = os.path.join('/tmp', model_code, 'return', processing_panel)
|
||||
@@ -379,6 +384,7 @@ class CNCprocessing(models.Model):
|
||||
ftp.download_file_tree(remotepath, serverdir)
|
||||
return serverdir
|
||||
|
||||
# 将nc文件存到attach的datas里
|
||||
def write_file(self, nc_file_path, cnc):
|
||||
if os.path.exists(nc_file_path):
|
||||
with open(nc_file_path, 'rb') as file:
|
||||
@@ -389,6 +395,20 @@ class CNCprocessing(models.Model):
|
||||
else:
|
||||
return False
|
||||
|
||||
# 将nc文件对应的excel清单转为pdf
|
||||
# def to_pdf(self, excel_path, pdf_path):
|
||||
# """
|
||||
# 需要在linux中下载好libreoffice
|
||||
# """
|
||||
# logging.info('pdf_path:%s' % pdf_path)
|
||||
# logging.info('pdf_path:%s' % excel_path)
|
||||
# # 注意cmd中的libreoffice要和linux中安装的一致
|
||||
# cmd = 'soffice --headless --convert-to pdf'.split() + [excel_path] + ['--outdir'] + [pdf_path]
|
||||
# p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1)
|
||||
# # p.wait(timeout=30) # 停顿30秒等待转化
|
||||
# # stdout, stderr = p.communicate()
|
||||
# p.communicate()
|
||||
|
||||
|
||||
class SfWorkOrderBarcodes(models.Model):
|
||||
"""
|
||||
@@ -402,4 +422,3 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
self.tray_code = tray_code.code
|
||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
workorder.gettray_auto(barcode)
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class StockRule(models.Model):
|
||||
|
||||
|
||||
class ProductionLot(models.Model):
|
||||
_inherit = 'stock.production.lot'
|
||||
_inherit = 'stock.lot'
|
||||
|
||||
@api.model
|
||||
def generate_lot_names1(self, display_name, first_lot, count):
|
||||
@@ -217,10 +217,10 @@ class ProductionLot(models.Model):
|
||||
def _get_next_serial(self, company, product):
|
||||
"""Return the next serial number to be attributed to the product."""
|
||||
if product.tracking == "serial":
|
||||
last_serial = self.env['stock.production.lot'].search(
|
||||
last_serial = self.env['stock.lot'].search(
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id)],
|
||||
limit=1, order='id DESC')
|
||||
if last_serial:
|
||||
return self.env['stock.production.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[
|
||||
return self.env['stock.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[
|
||||
1]
|
||||
return "%s-%03d" % (product.display_name, 1)
|
||||
|
||||
@@ -41,16 +41,16 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_workorder_form_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.workorder.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <field name="production_id" position="after">-->
|
||||
<!-- <field name="processing_panel" readonly="1"/>-->
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_workorder_form_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.workorder.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <field name="production_id" position="after">-->
|
||||
<!-- <field name="processing_panel" readonly="1"/>-->
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="view_mrp_production_workorder_tray_form_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">mrp.production.workorder.tray.form.inherit.sf</field>
|
||||
@@ -71,11 +71,12 @@
|
||||
<field name="routing_type" invisible="1"/>
|
||||
<field name="processing_panel" readonly="1"/>
|
||||
<field name="tray_code"/>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
|
||||
</group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="gettray" string="绑定托盘"
|
||||
attrs='{"invisible": [("production_id","=",False)]}'/>
|
||||
</div>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
</xpath>
|
||||
@@ -86,121 +87,107 @@
|
||||
<field name="processing_panel" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<div>左面:</div>
|
||||
<div>左面:</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X1_axis" string="x"/>
|
||||
<field name="X1_axis" class="o_form_label"/>
|
||||
<label for="Y1_axis" string="y"/>
|
||||
<field name="Y1_axis" class="o_form_label"/>
|
||||
<label for="Z1_axis" string="z"/>
|
||||
<field name="Z1_axis" class="o_form_label"/>
|
||||
<div></div>
|
||||
<div class="o_address_format">
|
||||
<label for="X1_axis" string="x1"/>
|
||||
<field name="X1_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y1_axis" string="y1"/>
|
||||
<field name="Y1_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z1_axis" string="z1"/>
|
||||
<field name="Z1_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X2_axis" string="x2"/>
|
||||
<field name="X2_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y2_axis" string="y2"/>
|
||||
<field name="Y2_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z2_axis" string="z2"/>
|
||||
<field name="Z2_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div>前面:</div>
|
||||
<label for="X2_axis" string="x"/>
|
||||
<field name="X2_axis" class="o_form_label"/>
|
||||
<label for="Y2_axis" string="y"/>
|
||||
<field name="Y2_axis" class="o_form_label"/>
|
||||
<label for="Z2_axis" string="z"/>
|
||||
<field name="Z2_axis" class="o_form_label"/>
|
||||
</div>
|
||||
<div>前面:</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X3_axis" string="x"/>
|
||||
<field name="X3_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y3_axis" string="y"/>
|
||||
<field name="Y3_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z3_axis" string="z"/>
|
||||
<field name="Z3_axis" class="o_form_label"/>
|
||||
<div></div>
|
||||
<div class="o_address_format">
|
||||
<label for="X3_axis" string="x1"/>
|
||||
<field name="X3_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y3_axis" string="y1"/>
|
||||
<field name="Y3_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z3_axis" string="z1"/>
|
||||
<field name="Z3_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X4_axis" string="x2"/>
|
||||
<field name="X4_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y4_axis" string="y2"/>
|
||||
<field name="Y4_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z4_axis" string="z2"/>
|
||||
<field name="Z4_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div>右面:</div>
|
||||
<label for="X4_axis" string="x"/>
|
||||
<field name="X4_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y4_axis" string="y"/>
|
||||
<field name="Y4_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z4_axis" string="z"/>
|
||||
<field name="Z4_axis" class="o_form_label"/>
|
||||
</div>
|
||||
<div>右面:</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X5_axis" string="x"/>
|
||||
<field name="X5_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y5_axis" string="y"/>
|
||||
<field name="Y5_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z5_axis" string="z"/>
|
||||
<field name="Z5_axis" class="o_form_label"/>
|
||||
<div></div>
|
||||
<div class="o_address_format">
|
||||
<label for="X5_axis" string="x1"/>
|
||||
<field name="X5_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y5_axis" string="y1"/>
|
||||
<field name="Y5_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z5_axis" string="z1"/>
|
||||
<field name="Z5_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X6_axis" string="x2"/>
|
||||
<field name="X6_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y6_axis" string="y2"/>
|
||||
<field name="Y6_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z6_axis" string="z2"/>
|
||||
<field name="Z6_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div>后面:</div>
|
||||
<label for="X6_axis" string="x"/>
|
||||
<field name="X6_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y6_axis" string="y"/>
|
||||
<field name="Y6_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z6_axis" string="z"/>
|
||||
<field name="Z6_axis" class="o_form_label"/>
|
||||
</div>
|
||||
<div>后面:</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X7_axis" string="x"/>
|
||||
<field name="X7_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y7_axis" string="y"/>
|
||||
<field name="Y7_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z7_axis" string="z"/>
|
||||
<field name="Z7_axis" class="o_form_label"/>
|
||||
<div></div>
|
||||
<div class="o_address_format">
|
||||
<label for="X7_axis" string="x1"/>
|
||||
<field name="X7_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y7_axis" string="y1"/>
|
||||
<field name="Y7_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z7_axis" string="z1"/>
|
||||
<field name="Z7_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X8_axis" string="x2"/>
|
||||
<field name="X8_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y8_axis" string="y2"/>
|
||||
<field name="Y8_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z8_axis" string="z2"/>
|
||||
<field name="Z8_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div>上面:</div>
|
||||
<label for="X8_axis" string="x"/>
|
||||
<field name="X8_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y8_axis" string="y"/>
|
||||
<field name="Y8_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z8_axis" string="z"/>
|
||||
<field name="Z8_axis" class="o_form_label"/>
|
||||
</div>
|
||||
<div>上面:</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X9_axis" string="x"/>
|
||||
<field name="X9_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y9_axis" string="y"/>
|
||||
<field name="Y9_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z9_axis" string="z"/>
|
||||
<field name="Z9_axis" class="o_form_label"/>
|
||||
<div></div>
|
||||
<div class="o_address_format">
|
||||
<label for="X9_axis" string="x1"/>
|
||||
<field name="X9_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y9_axis" string="y1"/>
|
||||
<field name="Y9_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z9_axis" string="z1"/>
|
||||
<field name="Z9_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div class="o_address_format">
|
||||
<label for="X10_axis" string="x2"/>
|
||||
<field name="X10_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y10_axis" string="y2"/>
|
||||
<field name="Y10_axis" class="o_address_zip"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z10_axis" string="z2"/>
|
||||
<field name="Z10_axis" class="o_address_zip"/>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="getcenter" string="计算定位"/>
|
||||
</div>
|
||||
</group>
|
||||
<label for="X10_axis" string="x"/>
|
||||
<field name="X10_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Y10_axis" string="y"/>
|
||||
<field name="Y10_axis" class="o_form_label"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="Z10_axis" string="z"/>
|
||||
<field name="Z10_axis" class="o_form_label"/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="getcenter" string="计算定位"/>
|
||||
</div>
|
||||
|
||||
<group>
|
||||
<field name="material_center_point"/>
|
||||
<field name='X_deviation_angle'/>
|
||||
@@ -210,39 +197,43 @@
|
||||
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<field name="cnc_ids" widget="one2many">
|
||||
<tree>
|
||||
<field name="cnc_id"/>
|
||||
<field name="sequence_number"/>
|
||||
<field name="program_name"/>
|
||||
<field name="cutting_tool_name"/>
|
||||
<field name="cutting_tool_no"/>
|
||||
<field name="processing_type"/>
|
||||
<field name="margin_x_y"/>
|
||||
<field name="margin_z"/>
|
||||
<field name="depth_of_processing_z"/>
|
||||
<field name="cutting_tool_extension_length"/>
|
||||
<field name="cutting_tool_handle_type"/>
|
||||
<field name="estimated_processing_time"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group>
|
||||
<field name="cnc_ids" widget="one2many" string="工作程序">
|
||||
<tree>
|
||||
<field name="sequence_number"/>
|
||||
<field name="program_name"/>
|
||||
<field name="cnc_id" string="文件"/>
|
||||
<field name="cutting_tool_name"/>
|
||||
<field name="cutting_tool_no"/>
|
||||
<field name="processing_type"/>
|
||||
<field name="margin_x_y"/>
|
||||
<field name="margin_z"/>
|
||||
<field name="depth_of_processing_z"/>
|
||||
<field name="cutting_tool_extension_length"/>
|
||||
<field name="cutting_tool_handle_type"/>
|
||||
<field name="estimated_processing_time"/>
|
||||
<field name="remark"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="cnc_worksheet" string="工作指令" widget="pdf_viewer"/>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
|
||||
<group>
|
||||
<field name="test_results" widget="selection"/>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<field name="test_results" widget="selection" />
|
||||
|
||||
</group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"
|
||||
string="检测确认"/>
|
||||
</div>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
||||
<group>
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="unbindtray" string="解除装夹"/>
|
||||
</div>
|
||||
@@ -250,7 +241,7 @@
|
||||
<button type="action" class="oe_highlight" name="sf_manufacturing.label_sf_tray_code1"
|
||||
string="打印标签"/>
|
||||
</div>
|
||||
</group>
|
||||
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 连接制造资源库模块 ',
|
||||
'name': '机企猫智能工厂 对接制造资源库 ',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂连接制造资源库模块',
|
||||
'sequence': 1,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import base64
|
||||
import logging
|
||||
import os
|
||||
from datetime import date, timedelta
|
||||
@@ -23,12 +24,27 @@ class Sf_Mrs_Connect(http.Controller):
|
||||
ret = json.loads(datas)
|
||||
ret = json.loads(ret['result'])
|
||||
for obj in ret:
|
||||
cnc = request.env['sf.cnc.processing'].with_user(request.env.ref("base.user_admin")).CNCprocessing_create(obj)
|
||||
# 从ftp拉取对应的文件
|
||||
cnc = request.env['sf.cnc.processing'].with_user(
|
||||
request.env.ref("base.user_admin")).cnc_processing_create(obj)
|
||||
# # 从ftp拉取对应的文件
|
||||
model_code = cnc.workorder_id.product_id.barcode
|
||||
processing_panel = cnc.workorder_id.processing_panel
|
||||
server_dir = cnc.with_user(request.env.ref("base.user_admin")).download_file_tmp(model_code, processing_panel)
|
||||
server_dir = cnc.with_user(request.env.ref("base.user_admin")).download_file_tmp(model_code,
|
||||
processing_panel)
|
||||
cnc_file_path = os.path.join(server_dir, cnc.program_name + '.NC')
|
||||
cnc.with_user(request.env.ref("base.user_admin")).write_file(cnc_file_path, cnc)
|
||||
# logging.info('get_cnc_processing_create:%s' % '111111111111111')
|
||||
# for root, dirs, files in os.walk(server_dir):
|
||||
# for file in files:
|
||||
# if os.path.splitext(file)[1] == '.xlsx' or os.path.splitext(file)[1] == ".xls":
|
||||
# pdf_path = os.path.splitext(file)[1] + '.PDF'
|
||||
# cnc_pdf_path = request.env['sf.cnc.processing'].with_user(
|
||||
# request.env.ref("base.user_admin")).to_pdf(os.path.join(root, file), pdf_path)
|
||||
# if pdf_path != False:
|
||||
# if not cnc.workorder_id.cnc_worksheet:
|
||||
# cnc.workorder_id.cnc_worksheet = base64.b64encode(open(cnc_pdf_path, 'rb').read())
|
||||
# else:
|
||||
# logging.info('break:%s' % 'break')
|
||||
# break
|
||||
except Exception as e:
|
||||
logging.info('get_cnc_processing_create error:%s' % e)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
{
|
||||
'name': '机企猫智能工厂 销售模块',
|
||||
'name': '机企猫智能工厂 销售管理',
|
||||
'version': '1.0',
|
||||
'summary': '智能工厂销售模块',
|
||||
'sequence': 1,
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sale', 'sale_management', 'sf_bf_connect', 'sf_dlm'],
|
||||
'depends': ['sale', 'sale_management'],
|
||||
'data': [
|
||||
'views/sale_order_view.xml'
|
||||
],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from odoo import models, fields
|
||||
from odoo.exceptions import ValidationError
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
|
||||
class ReSaleOrder(models.Model):
|
||||
@@ -20,9 +21,9 @@ class ReSaleOrder(models.Model):
|
||||
'company_id': company_id.id,
|
||||
'date_order': now_time,
|
||||
'name': self.env['ir.sequence'].next_by_code('sale.order', sequence_date=now_time),
|
||||
'partner_id': 8,
|
||||
'partner_id': 1,
|
||||
'state': 'sale',
|
||||
'user_id': 6,
|
||||
'user_id': 1,
|
||||
'person_of_delivery': delivery_name,
|
||||
'telephone_of_delivery': delivery_telephone,
|
||||
'address_of_delivery': delivery_address,
|
||||
|
||||
Reference in New Issue
Block a user