Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀柄和夹头反注册到Cloud生成动态刀具物料
# Conflicts: # sf_manufacturing/models/product_template.py
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['account', 'base', 'mrp_workorder', 'sale'],
|
||||
'depends': [],
|
||||
'data': [
|
||||
|
||||
],
|
||||
@@ -21,6 +21,7 @@
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*',
|
||||
'jikimo_frontend/static/src/scss/test.scss',
|
||||
],
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
.zoomed {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(20);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { Many2ManyCheckboxesField } from "@web/views/fields/many2many_checkboxes/many2many_checkboxes_field";
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
export class MyCustomWidget extends Many2ManyCheckboxesField {
|
||||
// 你可以重写或者添加一些方法和属性
|
||||
// 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量
|
||||
setup() {
|
||||
super.setup(); // 调用父类的setup方法
|
||||
// 你自己的代码
|
||||
}
|
||||
onImageClick(event) {
|
||||
// 放大图片逻辑
|
||||
// 获取图片元素
|
||||
const img = event.target;
|
||||
|
||||
// 实现放大图片逻辑
|
||||
// 比如使用 CSS 放大
|
||||
img.classList.add('zoomed');
|
||||
}
|
||||
}
|
||||
MyCustomWidget.template = "sf_plan.MyCustomWidget"
|
||||
// MyCustomWidget.supportedTypes = ['many2many'];
|
||||
|
||||
registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget);
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="sf_plan.MyCustomWidget" owl="1">
|
||||
<div aria-atomic="true">
|
||||
<t t-foreach="items" t-as="item" t-key="item[0]">
|
||||
<div>
|
||||
<CheckBox
|
||||
value="isSelected(item)"
|
||||
disabled="props.readonly"
|
||||
onChange="(ev) => this.onChange(item[0], ev)"
|
||||
>
|
||||
<t t-esc="item[1]"/>
|
||||
|
||||
</CheckBox>
|
||||
|
||||
</div>
|
||||
<div t-on-click="onImageClick">
|
||||
<t>
|
||||
<img t-att-src="item[2]" width="20" height="20"/>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -38,4 +38,36 @@ class SuitableCoolant(models.Model):
|
||||
_description = '适合冷却液'
|
||||
|
||||
name = fields.Char('名称')
|
||||
image = fields.Image('图片')
|
||||
image = fields.Image('图片')
|
||||
|
||||
|
||||
class CuttingSpeed(models.Model):
|
||||
_name = 'sf.cutting.speed'
|
||||
_description = '切削速度Vc'
|
||||
|
||||
# def _get_order(self):
|
||||
# last_tool = self.search([], order='id desc', limit=1)
|
||||
# if last_tool:
|
||||
# last_order = int(last_tool.order)
|
||||
# new_order = last_order + 1
|
||||
# else:
|
||||
# new_order = '1'
|
||||
# return new_order
|
||||
#
|
||||
# order = fields.Char('序', default=_get_order, readonly=True)
|
||||
|
||||
execution_standard_id = fields.Char('执行标准')
|
||||
material_code = fields.Char('材料代号')
|
||||
material_name = fields.Char('材料名称')
|
||||
material_grade = fields.Char('材料牌号')
|
||||
tensile_strength = fields.Char('拉伸强度 (N/mm²)')
|
||||
hardness = fields.Char('硬度(HRC)')
|
||||
|
||||
cutting_speed_n1 = fields.Char('径向切宽 ae=100%D1 ap=1*D1 切削速度Vc')
|
||||
cutting_speed_n2 = fields.Char('径向切宽 ae=50%D1 ap=1.5*D1 切削速度Vc')
|
||||
cutting_speed_n3 = fields.Char('径向切宽 ae=25%D1 ap=L1max 切削速度Vc')
|
||||
cutting_speed_n4 = fields.Char('径向切宽 ae=15%D1 ap=L1max 切削速度Vc')
|
||||
cutting_speed_n5 = fields.Char('径向切宽 ae=5%D1 ap=L1max 切削速度Vc')
|
||||
rough_machining = fields.Char('粗加工 Vc(m/min)')
|
||||
precision_machining = fields.Char('精加工 Vc(m/min)')
|
||||
application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
|
||||
@@ -29,6 +29,7 @@ access_sf_blade_tip_characteristics,sf_blade_tip_characteristics,model_sf_blade_
|
||||
access_sf_handle_type,sf_handle_type,model_sf_handle_type,base.group_user,1,1,1,1
|
||||
access_sf_cutting_direction,sf_cutting_direction,model_sf_cutting_direction,base.group_user,1,1,1,1
|
||||
access_sf_suitable_coolant,sf_suitable_coolant,model_sf_suitable_coolant,base.group_user,1,1,1,1
|
||||
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -98,4 +98,37 @@
|
||||
<field name="res_model">sf.suitable.coolant</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- ======================================== 切削速度Vc========================================-->
|
||||
<record id="sf_cutting_speed_tree" model="ir.ui.view">
|
||||
<field name="name">切削速度Vc</field>
|
||||
<field name="model">sf.cutting.speed</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="切削速度Vc" editable="bottom">
|
||||
<!-- <field name="order"/>-->
|
||||
<field name="execution_standard_id"/>
|
||||
<field name="material_code"/>
|
||||
<field name="material_name"/>
|
||||
<field name="material_grade"/>
|
||||
<field name="tensile_strength"/>
|
||||
<field name="hardness"/>
|
||||
<field name="cutting_speed_n1"/>
|
||||
<field name="cutting_speed_n2"/>
|
||||
<field name="cutting_speed_n3"/>
|
||||
<field name="cutting_speed_n4"/>
|
||||
<field name="cutting_speed_n5"/>
|
||||
<field name="rough_machining"/>
|
||||
<field name="precision_machining"/>
|
||||
<field name="application"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sf_cutting_speed_act" model="ir.actions.act_window">
|
||||
<field name="name">切削速度Vc</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.cutting.speed</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -359,6 +359,9 @@
|
||||
<field name="suitable_coolant_ids" string=""/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="切削速度Vc">
|
||||
<field name="cutting_speed_ids" string=""/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="夹具物料参数" attrs="{'invisible': [('categ_type', '!=', '夹具')]}">
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
<field name="inherit_id" ref="sf_manufacturing.view_mrp_production_workorder_tray_form_inherit_sf"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//header" position="inside">
|
||||
<button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight"/>
|
||||
<button string="程序下载" name="cnc_file_download" type="object" class="oe_highlight" attrs='{"invisible": ["|",
|
||||
("user_permissions","=",False),("routing_type","!=","CNC加工")]}'/>
|
||||
</xpath>
|
||||
<xpath expr="//page//field[@name='cnc_ids']" position="before">
|
||||
<group>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from odoo import models, fields, api
|
||||
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
|
||||
import logging
|
||||
import base64
|
||||
import hashlib
|
||||
@@ -66,9 +66,9 @@ class ResProductMo(models.Model):
|
||||
domain="[('cutting_tool_material_id.name', '=', cutting_tool_type)]")
|
||||
|
||||
brand_id = fields.Many2one('sf.machine.brand', '品牌')
|
||||
tool_length = fields.Integer('长度(mm)')
|
||||
tool_width = fields.Integer('宽度(mm)')
|
||||
tool_height = fields.Integer('高度(mm)')
|
||||
tool_length = fields.Float('长度(mm)')
|
||||
tool_width = fields.Float('宽度(mm)')
|
||||
tool_height = fields.Float('高度(mm)')
|
||||
tool_thickness = fields.Integer('厚度(mm)')
|
||||
tool_weight = fields.Float('重量(kg)')
|
||||
tool_hardness = fields.Integer('硬度(hrc)')
|
||||
@@ -86,7 +86,7 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_shank_diameter = fields.Float('柄部直径(mm)', digits=(6, 1))
|
||||
cutting_tool_blade_tip_diameter = fields.Float('刀尖直径(mm)', digits=(6, 1))
|
||||
cutting_tool_blade_tip_taper = fields.Float('刀尖锥度(°)', digits=(6, 1))
|
||||
cutting_tool_blade_helix_angle = fields.Char('刃部螺旋角(°)')
|
||||
cutting_tool_blade_helix_angle = fields.Integer('刃部螺旋角(°)')
|
||||
cutting_tool_blade_type = fields.Char('刃部类型')
|
||||
cutting_tool_coarse_medium_fine = fields.Selection([('粗', '粗'), ('中', '中'), ('精', '精')], '粗/中/精')
|
||||
cutting_tool_run_out_accuracy_max = fields.Float('端跳精度max', digits=(6, 1))
|
||||
@@ -170,15 +170,23 @@ class ResProductMo(models.Model):
|
||||
# if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最小(min)不能为0")
|
||||
|
||||
cutting_speed_ids = fields.Many2many('sf.cutting.speed', 'rel_sf_cutting_speed', '切削速度Vc')
|
||||
|
||||
# @api.constrains('suitable_machining_method_ids')
|
||||
# def _check_suitable_machining_method_ids(self):
|
||||
# for record in self:
|
||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("适合加工方式不能为空!")
|
||||
|
||||
# @api.constrains('integral_run_out_accuracy_max')
|
||||
# def _check_integral_run_out_accuracy_max(self):
|
||||
# if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具':
|
||||
# raise ValidationError("端跳精度最大(max)不能为0")
|
||||
|
||||
cutting_tool_diameter = fields.Float('直径(mm)')
|
||||
cutting_tool_front_angle = fields.Float('前角(°)')
|
||||
cutting_tool_rear_angle = fields.Float('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Float('主偏角(°)')
|
||||
cutting_tool_front_angle = fields.Integer('前角(°)')
|
||||
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
||||
# cutting_tool_material_model_id = fields.Many2one('sf.materials.model', '材料型号')
|
||||
cutting_tool_nut = fields.Float('配对螺母(mm)')
|
||||
# 适用夹头型号可以多选
|
||||
@@ -190,7 +198,7 @@ class ResProductMo(models.Model):
|
||||
domain="[('cutting_tool_type', '=', '夹头')]",
|
||||
string='适用夹头型号')
|
||||
# 刀片参数
|
||||
cutting_tool_top_angle = fields.Float('顶角(°)')
|
||||
cutting_tool_top_angle = fields.Integer('顶角(°)')
|
||||
cutting_tool_jump_accuracy = fields.Float('径跳精度(mm)')
|
||||
cutting_tool_working_hardness = fields.Char('加工硬度(hrc)')
|
||||
cutting_tool_cutter_bar_ids = fields.Many2many(
|
||||
@@ -246,8 +254,8 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_body_accuracy = fields.Float('本体精度(mm)')
|
||||
apply_lock_nut_model = fields.Char('适用锁紧螺母型号')
|
||||
apply_lock_wrench_model = fields.Char('适用锁紧扳手型号')
|
||||
cutting_tool_detection_accuracy_max = fields.Char('最大检测精度(mm)')
|
||||
cutting_tool_detection_accuracy_min = fields.Char('最小检测精度(mm)')
|
||||
cutting_tool_detection_accuracy_max = fields.Float('最大检测精度(mm)')
|
||||
cutting_tool_detection_accuracy_min = fields.Float('最小检测精度(mm)')
|
||||
# 夹头参数
|
||||
cutting_tool_taper = fields.Integer('锥度(°)')
|
||||
cutting_tool_outer_diameter = fields.Float('外径(mm)')
|
||||
@@ -776,11 +784,14 @@ class ResMrpBomMo(models.Model):
|
||||
# 选取当前坯料原材料
|
||||
raw_bom_line = self.get_raw_bom(embryo)
|
||||
if raw_bom_line:
|
||||
qty = 1
|
||||
if round(embryo.volume * raw_bom_line.materials_type_id.density / 1000000) > 1:
|
||||
qty = round(embryo.volume * raw_bom_line.materials_type_id.density / 1000000)
|
||||
bom_line = self.env['mrp.bom.line'].create({
|
||||
'bom_id': self.id,
|
||||
'product_id': raw_bom_line.id,
|
||||
'product_tmpl_id': raw_bom_line.product_tmpl_id.id,
|
||||
'product_qty': round(embryo.volume * raw_bom_line.materials_type_id.density / 1000000),
|
||||
'product_qty': qty,
|
||||
'product_uom_id': raw_bom_line.uom_id.id,
|
||||
})
|
||||
return bom_line
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import logging
|
||||
from odoo.modules import get_resource_path
|
||||
from odoo import fields, models, api
|
||||
from quatotion import readSql, feature_recognize, auto_quatotion
|
||||
# from quatotion import readSql, feature_recognize, auto_quatotion
|
||||
|
||||
__author__ = 'jinling.yang'
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -24,14 +24,14 @@ class AutoQuatotion(models.Model):
|
||||
def get_process_time_db_path(self):
|
||||
return get_resource_path('sf_sale', 'models', 'process_time.db')
|
||||
|
||||
def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
|
||||
'''
|
||||
通过打包好的.so库,
|
||||
以调用autoQuatotion库中Quatotion类,
|
||||
初始化后调用类的analyseShape方法对模型文件进行价格预测
|
||||
'''
|
||||
# 初始化自动报价类(输入特征数据库和加工时间数据库)
|
||||
reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
|
||||
# 获取价格、加工时间、尺寸、XYZ、翻面次数
|
||||
feature_info = reader.analyseShape(stp_url, InfoJson={})
|
||||
return feature_info
|
||||
# def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
|
||||
# '''
|
||||
# 通过打包好的.so库,
|
||||
# 以调用autoQuatotion库中Quatotion类,
|
||||
# 初始化后调用类的analyseShape方法对模型文件进行价格预测
|
||||
# '''
|
||||
# # 初始化自动报价类(输入特征数据库和加工时间数据库)
|
||||
# reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
|
||||
# # 获取价格、加工时间、尺寸、XYZ、翻面次数
|
||||
# feature_info = reader.analyseShape(stp_url, InfoJson={})
|
||||
# return feature_info
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from odoo import models, fields, api
|
||||
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
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from datetime import datetime
|
||||
@@ -87,10 +87,10 @@ class QuickEasyOrder(models.Model):
|
||||
|
||||
# 将attach的datas内容转为glb文件
|
||||
def transition_glb_file(self, report_path, model_code):
|
||||
shapes = read_step_file(report_path)
|
||||
# shapes = read_step_file(report_path)
|
||||
# output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
|
||||
output_file = os.path.join('/tmp', str(model_code) + '.stl')
|
||||
write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||
# write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
|
||||
# 转化为glb
|
||||
# output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
|
||||
output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
|
||||
|
||||
Reference in New Issue
Block a user